Remove our old orientation hacks as webkit now supports the orientation event.
Call down into webkit when the orientation changes to send the js event.
The change to Frame.cpp has been submited to bugs.webkit.org as issue 32321.
// This prevents unnecessary invals.
#define ENABLE_TEXT_CARET 1
#define ENABLE_JAVASCRIPT_DEBUGGER 0
+#define ENABLE_ORIENTATION_EVENTS 1
#endif
#if PLATFORM(WIN)
bindings/scripts/generate-bindings.pl \
)
-FEATURE_DEFINES := ANDROID_ORIENTATION_SUPPORT ENABLE_TOUCH_EVENTS=1 ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_WORKERS=1 ENABLE_GEOLOCATION=1 ENABLE_CHANNEL_MESSAGING=1
+FEATURE_DEFINES := ENABLE_ORIENTATION_EVENTS=1 ENABLE_TOUCH_EVENTS=1 ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_WORKERS=1 ENABLE_GEOLOCATION=1 ENABLE_CHANNEL_MESSAGING=1
# CSS
GEN := \
$(LOCAL_PATH)/bindings/scripts/IDLStructure.pm \
$(LOCAL_PATH)/bindings/scripts/generate-bindings.pl
-FEATURE_DEFINES := ANDROID_ORIENTATION_SUPPORT ENABLE_TOUCH_EVENTS=1 V8_BINDING ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_WORKERS=1 ENABLE_GEOLOCATION=1
+FEATURE_DEFINES := ENABLE_ORIENTATION_EVENTS=1 ENABLE_TOUCH_EVENTS=1 V8_BINDING ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_WORKERS=1 ENABLE_GEOLOCATION=1
# CSS
GEN := \
// PLUGIN_SCHEDULE_TIMER)
#define ANDROID_PLUGINS
-// Add support for the orientation window property
-#define ANDROID_ORIENTATION_SUPPORT
-
// This enables a portable implementation of NPN_[Un]ScheduleTimer
// Will submit this as a patch to apple
#define PLUGIN_SCHEDULE_TIMER
return static_cast<int>(view->scrollX() / m_frame->pageZoomFactor());
}
-#ifdef ANDROID_ORIENTATION_SUPPORT
-int DOMWindow::orientation() const
-{
- return screen()->orientation();
-}
-#endif
-
int DOMWindow::scrollY() const
{
if (!m_frame)
int scrollY() const;
int pageXOffset() const { return scrollX(); }
int pageYOffset() const { return scrollY(); }
-#ifdef ANDROID_ORIENTATION_SUPPORT
- int orientation() const;
-#endif
bool closed() const;
attribute [Replaceable] long scrollY;
readonly attribute long pageXOffset;
readonly attribute long pageYOffset;
-#if defined(ANDROID_ORIENTATION_SUPPORT)
- attribute [Replaceable] long orientation;
-#endif
[RequiresAllArguments] void scrollBy(in long x, in long y);
[RequiresAllArguments] void scrollTo(in long x, in long y);
{
m_orientation = orientation;
if (Document* doc = document())
- doc->dispatchWindowEvent(eventNames().orientationchangeEvent, false, false);
+ doc->dispatchWindowEvent(Event::create(eventNames().orientationchangeEvent, false, false));
}
#endif // ENABLE(ORIENTATION_EVENTS)
unsigned availTop() const;
unsigned availHeight() const;
unsigned availWidth() const;
-#ifdef ANDROID_ORIENTATION_SUPPORT
- int orientation() const;
-#endif
private:
Screen(Frame*);
return false;
}
-#ifdef ANDROID_ORIENTATION_SUPPORT
-int Screen::orientation() const
-{
- android::DisplayInfo info;
- android::SurfaceComposerClient::getDisplayInfo(
- android::DisplayID(0), &info);
- // getDisplayInfo returns an enum describing the orientation. Map the enum
- // to the values described here
- // (http://developer.apple.com/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/chapter_8_section_6.html)
- switch (info.orientation) {
- case android::ISurfaceComposer::eOrientationDefault:
- return 0;
- case android::ISurfaceComposer::eOrientation90:
- return 90;
- case android::ISurfaceComposer::eOrientation180:
- return 180;
- case android::ISurfaceComposer::eOrientation270:
- return -90;
- default:
- LOGE("Bad orientation returned from getDisplayIndo %d",
- info.orientation);
- return 0;
- }
-}
-#endif
-
// The only place I have seen these values used is
// positioning popup windows. If we support multiple windows
// they will be most likely full screen. Therefore,
return hashMap;
}
+static void OrientationChanged(JNIEnv *env, jobject obj, int orientation)
+{
+#ifdef ANDROID_INSTRUMENT
+ TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter);
+#endif
+ WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj);
+ LOGE("Sending orientation: %d", orientation);
+ pFrame->sendOrientationChangeEvent(orientation);
+}
+
// ----------------------------------------------------------------------------
/*
{ "setUsernamePassword", "(Ljava/lang/String;Ljava/lang/String;)V",
(void*) SetUsernamePassword },
{ "getFormTextData", "()Ljava/util/HashMap;",
- (void*) GetFormTextData }
+ (void*) GetFormTextData },
+ { "nativeOrientationChanged", "(I)V",
+ (void*) OrientationChanged }
};
int register_webframe(JNIEnv* env)