[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

bolsinga at apple.com bolsinga at apple.com
Thu Oct 29 20:31:35 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit dcfc78982030e1d25a0edef43e9b7b1d8fadf686
Author: bolsinga at apple.com <bolsinga at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 21 23:10:30 2009 +0000

    JavaScriptCore: Add ENABLE(ORIENTATION_EVENTS)
    https://bugs.webkit.org/show_bug.cgi?id=29508
    
    Reviewed by Simon Fraser & Sam Weinig.
    
    * wtf/Platform.h: Also sort PLATFORM(IPHONE) #defines.
    
    WebCore: Add ENABLE(ORIENTATION_EVENTS)
    https://bugs.webkit.org/show_bug.cgi?id=29508
    
    Reviewed by Simon Fraser & Sam Weinig.
    
    See documentation here:
    http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW16
    
    * DerivedSources.make: Use new WebCore.OrientationEvents.exp file if ENABLE_ORIENTATION_EVENTS.
    Add ENABLE_ORIENTATION_EVENTS to the new ADDITIONAL_IDL_DEFINES variable that is passed to the IDL
    code generator. This is because ENABLE_ORIENTATION_EVENTS is not in FEATURE_DEFINES.
    * WebCore.OrientationEvents.exp: Added.
    * WebCore.xcodeproj/project.pbxproj: Add WebCore.OrientationEvents.exp.
    * dom/EventNames.h: Add onorientationchange.
    * html/HTMLAttributeNames.in: Ditto.
    * html/HTMLBodyElement.cpp: Handle onorientationchange properly.
    (WebCore::HTMLBodyElement::parseMappedAttribute):
    (WebCore::HTMLBodyElement::onorientationchange):
    (WebCore::HTMLBodyElement::setOnorientationchange):
    * html/HTMLBodyElement.h: Ditto.
    * html/HTMLBodyElement.idl: Ditto.
    * html/HTMLFrameSetElement.cpp: Ditto.
    (WebCore::HTMLFrameSetElement::parseMappedAttribute):
    (WebCore::HTMLFrameSetElement::onorientationchange):
    (WebCore::HTMLFrameSetElement::setOnorientationchange):
    * html/HTMLFrameSetElement.h: Ditto.
    * html/HTMLFrameSetElement.idl: Ditto.
    * page/DOMWindow.cpp: Ditto.
    (WebCore::DOMWindow::orientation): Calls up the to the Frame for the orientation value.
    (WebCore::DOMWindow::onorientationchange):
    (WebCore::DOMWindow::setOnorientationchange):
    * page/DOMWindow.h: Handle onorientationchange properly.
    * page/DOMWindow.idl: Ditto.
    * page/Frame.cpp: Ditto.
    (WebCore::Frame::Frame):
    (WebCore::Frame::sendOrientationChangeEvent):
    * page/Frame.h: Ditto.
    (WebCore::Frame::orientation):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48609 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 5a5ceb5..397638f 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,12 @@
+2009-09-21  Greg Bolsinga  <bolsinga at apple.com>
+
+        Reviewed by Simon Fraser & Sam Weinig.
+
+        Add ENABLE(ORIENTATION_EVENTS)
+        https://bugs.webkit.org/show_bug.cgi?id=29508
+
+        * wtf/Platform.h: Also sort PLATFORM(IPHONE) #defines.
+
 2009-09-21  Jedrzej Nowacki  <jedrzej.nowacki at nokia.com>
 
         Reviewed by Eric Seidel.
diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h
index 2894d43..7ddfc95 100644
--- a/JavaScriptCore/wtf/Platform.h
+++ b/JavaScriptCore/wtf/Platform.h
@@ -423,18 +423,19 @@
 #endif
 
 #if PLATFORM(IPHONE)
-#define WTF_PLATFORM_CF 1
-#define WTF_USE_PTHREADS 1
 #define ENABLE_CONTEXT_MENUS 0
 #define ENABLE_DRAG_SUPPORT 0
 #define ENABLE_FTPDIR 1
+#define ENABLE_GEOLOCATION 1
+#define ENABLE_ICONDATABASE 0
 #define ENABLE_INSPECTOR 0
 #define ENABLE_MAC_JAVA_BRIDGE 0
-#define ENABLE_ICONDATABASE 0
-#define ENABLE_GEOLOCATION 1
 #define ENABLE_NETSCAPE_PLUGIN_API 0
-#define HAVE_READLINE 1
+#define ENABLE_ORIENTATION_EVENTS 1
 #define ENABLE_REPAINT_THROTTLING 1
+#define HAVE_READLINE 1
+#define WTF_PLATFORM_CF 1
+#define WTF_USE_PTHREADS 1
 #endif
 
 #if PLATFORM(WIN)
@@ -594,6 +595,10 @@
 #define ENABLE_NETSCAPE_PLUGIN_API 1
 #endif
 
+#if !defined(ENABLE_ORIENTATION_EVENTS)
+#define ENABLE_ORIENTATION_EVENTS 0
+#endif
+
 #if !defined(ENABLE_OPCODE_STATS)
 #define ENABLE_OPCODE_STATS 0
 #endif
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 66006fb..8773a8d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,51 @@
+2009-09-21  Greg Bolsinga  <bolsinga at apple.com>
+
+        Reviewed by Simon Fraser & Sam Weinig.
+
+        Add ENABLE(ORIENTATION_EVENTS)
+        https://bugs.webkit.org/show_bug.cgi?id=29508
+        
+        See documentation here:
+        http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW16
+
+        * DerivedSources.make: Use new WebCore.OrientationEvents.exp file if ENABLE_ORIENTATION_EVENTS.
+        Add ENABLE_ORIENTATION_EVENTS to the new ADDITIONAL_IDL_DEFINES variable that is passed to the IDL
+        code generator. This is because ENABLE_ORIENTATION_EVENTS is not in FEATURE_DEFINES.
+        * WebCore.OrientationEvents.exp: Added.
+        * WebCore.xcodeproj/project.pbxproj: Add WebCore.OrientationEvents.exp.
+        * dom/EventNames.h: Add onorientationchange.
+        * html/HTMLAttributeNames.in: Ditto.
+        * html/HTMLBodyElement.cpp: Handle onorientationchange properly.
+        (WebCore::HTMLBodyElement::parseMappedAttribute):
+        (WebCore::HTMLBodyElement::onorientationchange):
+        (WebCore::HTMLBodyElement::setOnorientationchange):
+        * html/HTMLBodyElement.h: Ditto.
+        * html/HTMLBodyElement.idl: Ditto.
+        * html/HTMLFrameSetElement.cpp: Ditto.
+        (WebCore::HTMLFrameSetElement::parseMappedAttribute):
+        (WebCore::HTMLFrameSetElement::onorientationchange):
+        (WebCore::HTMLFrameSetElement::setOnorientationchange):
+        * html/HTMLFrameSetElement.h: Ditto.
+        * html/HTMLFrameSetElement.idl: Ditto.
+        * page/DOMWindow.cpp: Ditto.
+        (WebCore::DOMWindow::orientation): Calls up the to the Frame for the orientation value.
+        (WebCore::DOMWindow::onorientationchange):
+        (WebCore::DOMWindow::setOnorientationchange):
+        * page/DOMWindow.h: Handle onorientationchange properly.
+        * page/DOMWindow.idl: Ditto.
+        * page/Frame.cpp: Ditto.
+        (WebCore::Frame::Frame):
+        (WebCore::Frame::sendOrientationChangeEvent):
+        * page/Frame.h: Ditto.
+        (WebCore::Frame::orientation):
+
+2009-09-18  Anders Carlsson  <andersca at apple.com>
+
+        Try fixing the build again.
+        
+        * platform/win/PopupMenuWin.cpp:
+        (WebCore::PopupMenu::wndProc):
+
 2009-09-21  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Timothy Hatcher.
diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make
index 7fd63d2..ad689c0 100644
--- a/WebCore/DerivedSources.make
+++ b/WebCore/DerivedSources.make
@@ -449,6 +449,8 @@ all : \
 
 # --------
 
+ADDITIONAL_IDL_DEFINES :=
+
 ifeq ($(OS),MACOS)
 
 FRAMEWORK_FLAGS = $(shell echo $(FRAMEWORK_SEARCH_PATHS) | perl -e 'print "-F " . join(" -F ", split(" ", <>));')
@@ -483,6 +485,13 @@ else
     ENABLE_INSPECTOR = 0
 endif
 
+ifeq ($(shell gcc -isysroot $(SDKROOT) -E -P -dM -F $(BUILT_PRODUCTS_DIR) $(FRAMEWORK_FLAGS) WebCore/ForwardingHeaders/wtf/Platform.h | grep ENABLE_ORIENTATION_EVENTS | cut -d' ' -f3), 1)
+    ENABLE_ORIENTATION_EVENTS = 1
+    ADDITIONAL_IDL_DEFINES := $(ADDITIONAL_IDL_DEFINES) ENABLE_ORIENTATION_EVENTS
+else
+    ENABLE_ORIENTATION_EVENTS = 0
+endif
+
 # CSS property names and value keywords
 
 WEBCORE_CSS_PROPERTY_NAMES := $(WebCore)/css/CSSPropertyNames.in
@@ -765,7 +774,7 @@ GENERATE_BINDINGS_SCRIPTS = \
 #
 
 JS%.h : %.idl $(GENERATE_BINDINGS_SCRIPTS) bindings/scripts/CodeGeneratorJS.pm
-	$(GENERATE_BINDINGS) --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS $<
+	$(GENERATE_BINDINGS) --defines "$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS $<
 
 -include $(JS_DOM_HEADERS:.h=.dep)
 
@@ -817,6 +826,10 @@ ifeq ($(ENABLE_INSPECTOR), 1)
     WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.Inspector.exp
 endif
 
+ifeq ($(ENABLE_ORIENTATION_EVENTS), 1)
+    WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.OrientationEvents.exp
+endif
+
 ifeq ($(findstring 10.4,$(MACOSX_DEPLOYMENT_TARGET)), 10.4)
     WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.Tiger.exp
 endif
@@ -833,7 +846,7 @@ WebCore.exp : WebCore.base.exp $(WEBCORE_EXPORT_DEPENDENCIES)
 # Objective-C bindings
 
 DOM%.h : %.idl $(GENERATE_BINDINGS_SCRIPTS) bindings/scripts/CodeGeneratorObjC.pm bindings/objc/PublicDOMInterfaces.h
-	$(GENERATE_BINDINGS) --defines "$(FEATURE_DEFINES) LANGUAGE_OBJECTIVE_C" --generator ObjC $<
+	$(GENERATE_BINDINGS) --defines "$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_OBJECTIVE_C" --generator ObjC $<
 
 -include $(OBJC_DOM_HEADERS:.h=.dep)
 
diff --git a/WebCore/WebCore.OrientationEvents.exp b/WebCore/WebCore.OrientationEvents.exp
new file mode 100644
index 0000000..ec0978d
--- /dev/null
+++ b/WebCore/WebCore.OrientationEvents.exp
@@ -0,0 +1 @@
+__ZN7WebCore5Frame26sendOrientationChangeEventEi
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index d69dffe..06f34f1 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -9826,6 +9826,7 @@
 		FABE72F31059C1EB00D999DD /* mathtags.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mathtags.in; sourceTree = "<group>"; };
 		FABE72FB1059C21100D999DD /* MathMLElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLElementFactory.cpp; sourceTree = "<group>"; };
 		FABE72FC1059C21100D999DD /* MathMLNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLNames.cpp; sourceTree = "<group>"; };
+		FE136AE710643BE50078CF6D /* WebCore.OrientationEvents.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = WebCore.OrientationEvents.exp; sourceTree = "<group>"; };
 		FE49BD301061719100D0E1AE /* WebCore.Inspector.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = WebCore.Inspector.exp; sourceTree = "<group>"; };
 		FE49EF970DC51462004266E1 /* DashboardSupportCSSPropertyNames.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DashboardSupportCSSPropertyNames.in; sourceTree = "<group>"; };
 		FE6FD4850F676E5700092873 /* Coordinates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Coordinates.h; sourceTree = "<group>"; };
@@ -10462,6 +10463,7 @@
 				4491959C0FBE17D700D9F824 /* WebCore.JNI.exp */,
 				4491959B0FBE17D700D9F824 /* WebCore.LP64.exp */,
 				4491959A0FBE17D700D9F824 /* WebCore.NPAPI.exp */,
+				FE136AE710643BE50078CF6D /* WebCore.OrientationEvents.exp */,
 				449195990FBE17D700D9F824 /* WebCore.SVG.Animation.exp */,
 				449195980FBE17D700D9F824 /* WebCore.SVG.exp */,
 				449195970FBE17D700D9F824 /* WebCore.SVG.Filters.exp */,
diff --git a/WebCore/dom/EventNames.h b/WebCore/dom/EventNames.h
index 382bbf7..0581c95 100644
--- a/WebCore/dom/EventNames.h
+++ b/WebCore/dom/EventNames.h
@@ -136,6 +136,8 @@ namespace WebCore {
     \
     macro(webkitTransitionEnd) \
     \
+    macro(orientationchange) \
+    \
 // end of DOM_EVENT_NAMES_FOR_EACH
 
     class EventNames {
diff --git a/WebCore/html/HTMLAttributeNames.in b/WebCore/html/HTMLAttributeNames.in
index f258bd7..63a5c21 100644
--- a/WebCore/html/HTMLAttributeNames.in
+++ b/WebCore/html/HTMLAttributeNames.in
@@ -167,6 +167,7 @@ onmouseup
 onmousewheel
 ononline
 onoffline
+onorientationchange
 onpagehide
 onpageshow
 onpaste
diff --git a/WebCore/html/HTMLBodyElement.cpp b/WebCore/html/HTMLBodyElement.cpp
index 3813177..924b8f6 100644
--- a/WebCore/html/HTMLBodyElement.cpp
+++ b/WebCore/html/HTMLBodyElement.cpp
@@ -143,6 +143,10 @@ void HTMLBodyElement::parseMappedAttribute(MappedAttribute *attr)
         document()->setWindowAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(document()->frame(), attr));
     else if (attr->name() == onfocusAttr)
         document()->setWindowAttributeEventListener(eventNames().focusEvent, createAttributeEventListener(document()->frame(), attr));
+#if ENABLE(ORIENTATION_EVENTS)
+    else if (attr->name() == onorientationchangeAttr)
+        document()->setWindowAttributeEventListener(eventNames().orientationchangeEvent, createAttributeEventListener(document()->frame(), attr));
+#endif
     else if (attr->name() == onhashchangeAttr)
         document()->setWindowAttributeEventListener(eventNames().hashchangeEvent, createAttributeEventListener(document()->frame(), attr));
     else if (attr->name() == onresizeAttr)
@@ -412,6 +416,18 @@ void HTMLBodyElement::setOnonline(PassRefPtr<EventListener> eventListener)
     document()->setWindowAttributeEventListener(eventNames().onlineEvent, eventListener);
 }
 
+#if ENABLE(ORIENTATION_EVENTS)
+EventListener* HTMLBodyElement::onorientationchange() const
+{
+    return document()->getWindowAttributeEventListener(eventNames().orientationchangeEvent);
+}
+
+void HTMLBodyElement::setOnorientationchange(PassRefPtr<EventListener> eventListener)
+{
+    document()->setWindowAttributeEventListener(eventNames().orientationchangeEvent, eventListener);
+}
+#endif
+
 EventListener* HTMLBodyElement::onresize() const
 {
     return document()->getWindowAttributeEventListener(eventNames().resizeEvent);
diff --git a/WebCore/html/HTMLBodyElement.h b/WebCore/html/HTMLBodyElement.h
index d5efab3..e0d4996 100644
--- a/WebCore/html/HTMLBodyElement.h
+++ b/WebCore/html/HTMLBodyElement.h
@@ -63,6 +63,10 @@ public:
     void setOnoffline(PassRefPtr<EventListener>);
     EventListener* ononline() const;
     void setOnonline(PassRefPtr<EventListener>);
+#if ENABLE(ORIENTATION_EVENTS)
+    EventListener* onorientationchange() const;
+    void setOnorientationchange(PassRefPtr<EventListener>);
+#endif
     EventListener* onresize() const;
     void setOnresize(PassRefPtr<EventListener>);
     EventListener* onstorage() const;
diff --git a/WebCore/html/HTMLBodyElement.idl b/WebCore/html/HTMLBodyElement.idl
index 7be6803..2e93e2e 100644
--- a/WebCore/html/HTMLBodyElement.idl
+++ b/WebCore/html/HTMLBodyElement.idl
@@ -44,6 +44,10 @@ module html {
         attribute [DontEnum] EventListener onstorage;
         attribute [DontEnum] EventListener onunload;
 
+#if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS
+        attribute [DontEnum] EventListener onorientationchange;
+#endif
+
         // Overrides of Element attributes (left in for completeness).
         // attribute [DontEnum] EventListener onblur;
         // attribute [DontEnum] EventListener onerror;
diff --git a/WebCore/html/HTMLFrameSetElement.cpp b/WebCore/html/HTMLFrameSetElement.cpp
index 8dc3964..79381be 100644
--- a/WebCore/html/HTMLFrameSetElement.cpp
+++ b/WebCore/html/HTMLFrameSetElement.cpp
@@ -135,6 +135,10 @@ void HTMLFrameSetElement::parseMappedAttribute(MappedAttribute *attr)
         document()->setWindowAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(document()->frame(), attr));
     else if (attr->name() == onfocusAttr)
         document()->setWindowAttributeEventListener(eventNames().focusEvent, createAttributeEventListener(document()->frame(), attr));
+#if ENABLE(ORIENTATION_EVENTS)
+    else if (attr->name() == onorientationchangeAttr)
+        document()->setWindowAttributeEventListener(eventNames().orientationchangeEvent, createAttributeEventListener(document()->frame(), attr));
+#endif
     else if (attr->name() == onhashchangeAttr)
         document()->setWindowAttributeEventListener(eventNames().hashchangeEvent, createAttributeEventListener(document()->frame(), attr));
     else if (attr->name() == onresizeAttr)
@@ -320,6 +324,18 @@ void HTMLFrameSetElement::setOnonline(PassRefPtr<EventListener> eventListener)
     document()->setWindowAttributeEventListener(eventNames().onlineEvent, eventListener);
 }
 
+#if ENABLE(ORIENTATION_EVENTS)
+EventListener* HTMLFrameSetElement::onorientationchange() const
+{
+    return document()->getWindowAttributeEventListener(eventNames().orientationchangeEvent);
+}
+
+void HTMLFrameSetElement::setOnorientationchange(PassRefPtr<EventListener> eventListener)
+{
+    document()->setWindowAttributeEventListener(eventNames().orientationchangeEvent, eventListener);
+}
+#endif
+    
 EventListener* HTMLFrameSetElement::onresize() const
 {
     return document()->getWindowAttributeEventListener(eventNames().resizeEvent);
diff --git a/WebCore/html/HTMLFrameSetElement.h b/WebCore/html/HTMLFrameSetElement.h
index b51e702..0deacf1 100644
--- a/WebCore/html/HTMLFrameSetElement.h
+++ b/WebCore/html/HTMLFrameSetElement.h
@@ -87,6 +87,10 @@ public:
     void setOnoffline(PassRefPtr<EventListener>);
     EventListener* ononline() const;
     void setOnonline(PassRefPtr<EventListener>);
+#if ENABLE(ORIENTATION_EVENTS)
+    EventListener* onorientationchange() const;
+    void setOnorientationchange(PassRefPtr<EventListener>);
+#endif
     EventListener* onresize() const;
     void setOnresize(PassRefPtr<EventListener>);
     EventListener* onstorage() const;
diff --git a/WebCore/html/HTMLFrameSetElement.idl b/WebCore/html/HTMLFrameSetElement.idl
index 0375c0a..b44a071 100644
--- a/WebCore/html/HTMLFrameSetElement.idl
+++ b/WebCore/html/HTMLFrameSetElement.idl
@@ -41,6 +41,10 @@ module html {
         attribute [DontEnum] EventListener onstorage;
         attribute [DontEnum] EventListener onunload;
 
+#if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS
+        attribute [DontEnum] EventListener onorientationchange;
+#endif
+
         // Overrides of Element attributes (left in for completeness).
         // attribute [DontEnum] EventListener onblur;
         // attribute [DontEnum] EventListener onerror;
diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp
index 783f93d..943f119 100644
--- a/WebCore/page/DOMWindow.cpp
+++ b/WebCore/page/DOMWindow.cpp
@@ -462,6 +462,16 @@ void DOMWindow::clear()
 #endif
 }
 
+#if ENABLE(ORIENTATION_EVENTS)
+int DOMWindow::orientation() const
+{
+    if (!m_frame)
+        return 0;
+    
+    return m_frame->orientation();
+}
+#endif
+    
 Screen* DOMWindow::screen() const
 {
     if (!m_screen)
@@ -2088,6 +2098,18 @@ void DOMWindow::setOninvalid(PassRefPtr<EventListener> eventListener)
     setAttributeEventListener(eventNames().invalidEvent, eventListener);
 }
 
+#if ENABLE(ORIENTATION_EVENTS)
+EventListener* DOMWindow::onorientationchange() const
+{
+    return getAttributeEventListener(eventNames().orientationchangeEvent);
+}
+
+void DOMWindow::setOnorientationchange(PassRefPtr<EventListener> eventListener)
+{
+    setAttributeEventListener(eventNames().orientationchangeEvent, eventListener);
+}
+#endif
+
 void DOMWindow::captureEvents()
 {
     // Not implemented.
diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h
index db4edda..8817511 100644
--- a/WebCore/page/DOMWindow.h
+++ b/WebCore/page/DOMWindow.h
@@ -85,6 +85,13 @@ namespace WebCore {
 
         void clear();
 
+#if ENABLE(ORIENTATION_EVENTS)
+        // This is the interface orientation in degrees. Some examples are:
+        //  0 is straight up; -90 is when the device is rotated 90 clockwise;
+        //  90 is when rotated counter clockwise.
+        int orientation() const;
+#endif
+
         void setSecurityOrigin(SecurityOrigin* securityOrigin) { m_securityOrigin = securityOrigin; }
         SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); }
 
@@ -383,6 +390,10 @@ namespace WebCore {
         void setOncontextmenu(PassRefPtr<EventListener>);
         EventListener* oninvalid() const;
         void setOninvalid(PassRefPtr<EventListener>);
+#if ENABLE(ORIENTATION_EVENTS)
+        EventListener* onorientationchange() const;
+        void setOnorientationchange(PassRefPtr<EventListener>);
+#endif
 
         void captureEvents();
         void releaseEvents();
diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl
index 875f4ea..03a0ce3 100644
--- a/WebCore/page/DOMWindow.idl
+++ b/WebCore/page/DOMWindow.idl
@@ -170,6 +170,13 @@ module window {
         readonly attribute NotificationCenter webkitNotifications;
 #endif
 
+#if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS
+        // This is the interface orientation in degrees. Some examples are:
+        //  0 is straight up; -90 is when the device is rotated 90 clockwise;
+        //  90 is when rotated counter clockwise.
+        readonly attribute long orientation;
+#endif
+
                  attribute [Replaceable] Console console;
 
         // cross-document messaging
@@ -278,6 +285,9 @@ module window {
         attribute EventListener onwebkitanimationiteration;
         attribute EventListener onwebkitanimationstart;
         attribute EventListener onwebkittransitionend;
+#if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS
+        attribute EventListener onorientationchange;
+#endif
 
         // EventTarget interface
         [Custom] void addEventListener(in DOMString type,
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index 7a7c457..1114dee 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -131,6 +131,9 @@ Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient*
     , m_eventHandler(this)
     , m_animationController(this)
     , m_lifeSupportTimer(this, &Frame::lifeSupportTimerFired)
+#if ENABLE(ORIENTATION_EVENTS)
+    , m_orientation(0)
+#endif
     , m_caretVisible(false)
     , m_caretPaint(true)
     , m_highlightTextMatches(false)
@@ -276,6 +279,15 @@ void Frame::setDocument(PassRefPtr<Document> newDoc)
     m_script.updateDocument();
 }
 
+#if ENABLE(ORIENTATION_EVENTS)
+void Frame::sendOrientationChangeEvent(int orientation)
+{
+    m_orientation = orientation;
+    if (Document* doc = document())
+        doc->dispatchWindowEvent(eventNames().orientationchangeEvent, false, false);
+}
+#endif // ENABLE(ORIENTATION_EVENTS)
+    
 Settings* Frame::settings() const
 {
     return m_page ? m_page->settings() : 0;
diff --git a/WebCore/page/Frame.h b/WebCore/page/Frame.h
index ef803f1..ceb6fc1 100644
--- a/WebCore/page/Frame.h
+++ b/WebCore/page/Frame.h
@@ -153,6 +153,14 @@ namespace WebCore {
 
         void setDocument(PassRefPtr<Document>);
 
+#if ENABLE(ORIENTATION_EVENTS)
+        // Orientation is the interface orientation in degrees. Some examples are:
+        //  0 is straight up; -90 is when the device is rotated 90 clockwise;
+        //  90 is when rotated counter clockwise.
+        void sendOrientationChangeEvent(int orientation);
+        int orientation() const { return m_orientation; }
+#endif
+
         void clearTimers();
         static void clearTimers(FrameView*, Document*);
 
@@ -354,6 +362,10 @@ namespace WebCore {
 
         Timer<Frame> m_lifeSupportTimer;
 
+#if ENABLE(ORIENTATION_EVENTS)
+        int m_orientation;
+#endif
+        
         bool m_caretVisible;
         bool m_caretPaint;
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list