Commit dcfc7898 authored by bolsinga@apple.com's avatar bolsinga@apple.com

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
parent ed07aae7
2009-09-21 Greg Bolsinga <bolsinga@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@nokia.com>
Reviewed by Eric Seidel.
......
......@@ -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
......
2009-09-21 Greg Bolsinga <bolsinga@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@apple.com>
Try fixing the build again.
* platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenu::wndProc):
2009-09-21 Pavel Feldman <pfeldman@chromium.org>
Reviewed by Timothy Hatcher.
......@@ -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)
......
__ZN7WebCore5Frame26sendOrientationChangeEventEi
......@@ -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 */,
......@@ -136,6 +136,8 @@ namespace WebCore {
\
macro(webkitTransitionEnd) \
\
macro(orientationchange) \
\
// end of DOM_EVENT_NAMES_FOR_EACH
class EventNames {
......
......@@ -167,6 +167,7 @@ onmouseup
onmousewheel
ononline
onoffline
onorientationchange
onpagehide
onpageshow
onpaste
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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.
......
......@@ -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();
......
......@@ -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,
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment