diff options
Diffstat (limited to 'WebCore/dom')
-rw-r--r-- | WebCore/dom/CharacterData.cpp | 29 | ||||
-rw-r--r-- | WebCore/dom/CharacterData.h | 3 | ||||
-rw-r--r-- | WebCore/dom/ContainerNode.cpp | 20 | ||||
-rw-r--r-- | WebCore/dom/DOMCoreException.idl | 3 | ||||
-rw-r--r-- | WebCore/dom/DeviceOrientation.cpp | 89 | ||||
-rw-r--r-- | WebCore/dom/DeviceOrientation.h | 60 | ||||
-rw-r--r-- | WebCore/dom/DeviceOrientationClient.h | 3 | ||||
-rw-r--r-- | WebCore/dom/DeviceOrientationController.cpp | 50 | ||||
-rw-r--r-- | WebCore/dom/DeviceOrientationController.h | 12 | ||||
-rw-r--r-- | WebCore/dom/DeviceOrientationEvent.cpp | 25 | ||||
-rw-r--r-- | WebCore/dom/DeviceOrientationEvent.h | 20 | ||||
-rw-r--r-- | WebCore/dom/DeviceOrientationEvent.idl | 8 | ||||
-rw-r--r-- | WebCore/dom/EventException.idl | 3 | ||||
-rw-r--r-- | WebCore/dom/Node.cpp | 3 | ||||
-rw-r--r-- | WebCore/dom/Node.idl | 3 | ||||
-rw-r--r-- | WebCore/dom/NodeRareData.h | 12 | ||||
-rw-r--r-- | WebCore/dom/OverflowEvent.idl | 4 | ||||
-rw-r--r-- | WebCore/dom/RangeException.idl | 2 | ||||
-rw-r--r-- | WebCore/dom/TreeWalker.cpp | 8 |
19 files changed, 283 insertions, 74 deletions
diff --git a/WebCore/dom/CharacterData.cpp b/WebCore/dom/CharacterData.cpp index 5fbb6f2..7accbfb 100644 --- a/WebCore/dom/CharacterData.cpp +++ b/WebCore/dom/CharacterData.cpp @@ -59,10 +59,10 @@ String CharacterData::substringData(unsigned offset, unsigned count, ExceptionCo return m_data->substring(offset, count); } -PassRefPtr<StringImpl> CharacterData::parserAppendData(const String& arg) +PassRefPtr<StringImpl> CharacterData::appendDataCommon(const String& data) { String newStr = m_data; - newStr.append(arg); + newStr.append(data); RefPtr<StringImpl> oldStr = m_data; m_data = newStr.impl(); @@ -76,20 +76,29 @@ PassRefPtr<StringImpl> CharacterData::parserAppendData(const String& arg) return oldStr.release(); } -void CharacterData::appendData(const String& arg, ExceptionCode&) +void CharacterData::parserAppendData(const String& data) { - RefPtr<StringImpl> oldStr = parserAppendData(arg); + appendDataCommon(data); + // We don't call dispatchModifiedEvent here because we don't want the + // parser to dispatch DOM mutation events. + if (parentNode()) + parentNode()->childrenChanged(); +} + +void CharacterData::appendData(const String& data, ExceptionCode&) +{ + RefPtr<StringImpl> oldStr = appendDataCommon(data); dispatchModifiedEvent(oldStr.get()); } -void CharacterData::insertData(unsigned offset, const String& arg, ExceptionCode& ec) +void CharacterData::insertData(unsigned offset, const String& data, ExceptionCode& ec) { checkCharDataOperation(offset, ec); if (ec) return; String newStr = m_data; - newStr.insert(arg, offset); + newStr.insert(data, offset); RefPtr<StringImpl> oldStr = m_data; m_data = newStr.impl(); @@ -102,7 +111,7 @@ void CharacterData::insertData(unsigned offset, const String& arg, ExceptionCode dispatchModifiedEvent(oldStr.get()); - document()->textInserted(this, offset, arg.length()); + document()->textInserted(this, offset, data.length()); } void CharacterData::deleteData(unsigned offset, unsigned count, ExceptionCode& ec) @@ -134,7 +143,7 @@ void CharacterData::deleteData(unsigned offset, unsigned count, ExceptionCode& e document()->textRemoved(this, offset, realCount); } -void CharacterData::replaceData(unsigned offset, unsigned count, const String& arg, ExceptionCode& ec) +void CharacterData::replaceData(unsigned offset, unsigned count, const String& data, ExceptionCode& ec) { checkCharDataOperation(offset, ec); if (ec) @@ -148,7 +157,7 @@ void CharacterData::replaceData(unsigned offset, unsigned count, const String& a String newStr = m_data; newStr.remove(offset, realCount); - newStr.insert(arg, offset); + newStr.insert(data, offset); RefPtr<StringImpl> oldStr = m_data; m_data = newStr.impl(); @@ -163,7 +172,7 @@ void CharacterData::replaceData(unsigned offset, unsigned count, const String& a // update the markers for spell checking and grammar checking document()->textRemoved(this, offset, realCount); - document()->textInserted(this, offset, arg.length()); + document()->textInserted(this, offset, data.length()); } String CharacterData::nodeValue() const diff --git a/WebCore/dom/CharacterData.h b/WebCore/dom/CharacterData.h index ecc0cf7..94e812b 100644 --- a/WebCore/dom/CharacterData.h +++ b/WebCore/dom/CharacterData.h @@ -43,7 +43,7 @@ public: StringImpl* dataImpl() { return m_data.get(); } // Like appendData, but optimized for the parser (e.g., no mutation events). - PassRefPtr<StringImpl> parserAppendData(const String&); + void parserAppendData(const String&); protected: CharacterData(Document* document, const String& text, ConstructionType type) @@ -66,6 +66,7 @@ private: virtual bool offsetInCharacters() const; void checkCharDataOperation(unsigned offset, ExceptionCode&); + PassRefPtr<StringImpl> appendDataCommon(const String&); RefPtr<StringImpl> m_data; }; diff --git a/WebCore/dom/ContainerNode.cpp b/WebCore/dom/ContainerNode.cpp index 80bd035..23b68ba 100644 --- a/WebCore/dom/ContainerNode.cpp +++ b/WebCore/dom/ContainerNode.cpp @@ -215,7 +215,6 @@ bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce bool isFragment = newChild->nodeType() == DOCUMENT_FRAGMENT_NODE; // Add the new child(ren) - int childCountDelta = 0; RefPtr<Node> child = isFragment ? newChild->firstChild() : newChild; while (child) { // If the new child is already in the right place, we're done. @@ -240,8 +239,6 @@ bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce if (child->parentNode()) break; - childCountDelta++; - ASSERT(!child->nextSibling()); ASSERT(!child->previousSibling()); @@ -269,6 +266,7 @@ bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce child->setNextSibling(next); allowEventDispatch(); + childrenChanged(false, prev.get(), next, 1); notifyChildInserted(child.get()); // Add child to the rendering tree @@ -287,8 +285,6 @@ bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce child = nextChild.release(); } - if (childCountDelta) - childrenChanged(false, prev.get(), next.get(), childCountDelta); dispatchSubtreeModifiedEvent(); return true; } @@ -531,6 +527,7 @@ bool ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, bo // Now that the child is attached to the render tree, dispatch // the relevant mutation events. dispatchChildInsertionEvents(child); + prev = child; } dispatchSubtreeModifiedEvent(); @@ -706,7 +703,6 @@ void ContainerNode::cloneChildNodes(ContainerNode *clone) document()->frame()->editor()->deleteButtonController()->enable(); } -// FIXME: This doesn't work correctly with transforms. bool ContainerNode::getUpperLeftCorner(FloatPoint& point) const { if (!renderer()) @@ -716,7 +712,7 @@ bool ContainerNode::getUpperLeftCorner(FloatPoint& point) const RenderObject *p = o; if (!o->isInline() || o->isReplaced()) { - point = o->localToAbsolute(); + point = o->localToAbsolute(FloatPoint(), false, true); return true; } @@ -741,14 +737,14 @@ bool ContainerNode::getUpperLeftCorner(FloatPoint& point) const ASSERT(o); if (!o->isInline() || o->isReplaced()) { - point = o->localToAbsolute(); + point = o->localToAbsolute(FloatPoint(), false, true); return true; } if (p->node() && p->node() == this && o->isText() && !o->isBR() && !toRenderText(o)->firstTextBox()) { // do nothing - skip unrendered whitespace that is a child or next sibling of the anchor } else if ((o->isText() && !o->isBR()) || o->isReplaced()) { - point = o->container()->localToAbsolute(); + point = FloatPoint(); if (o->isText() && toRenderText(o)->firstTextBox()) { point.move(toRenderText(o)->linesBoundingBox().x(), toRenderText(o)->firstTextBox()->root()->lineTop()); @@ -756,6 +752,7 @@ bool ContainerNode::getUpperLeftCorner(FloatPoint& point) const RenderBox* box = toRenderBox(o); point.move(box->x(), box->y()); } + point = o->container()->localToAbsolute(point, false, true); return true; } } @@ -778,7 +775,7 @@ bool ContainerNode::getLowerRightCorner(FloatPoint& point) const RenderObject* o = renderer(); if (!o->isInline() || o->isReplaced()) { RenderBox* box = toRenderBox(o); - point = o->localToAbsolute(); + point = o->localToAbsolute(FloatPoint(), false, true); point.move(box->width(), box->height()); return true; } @@ -801,7 +798,7 @@ bool ContainerNode::getLowerRightCorner(FloatPoint& point) const } ASSERT(o); if (o->isText() || o->isReplaced()) { - point = o->container()->localToAbsolute(); + point = FloatPoint(); if (o->isText()) { RenderText* text = toRenderText(o); IntRect linesBox = text->linesBoundingBox(); @@ -810,6 +807,7 @@ bool ContainerNode::getLowerRightCorner(FloatPoint& point) const RenderBox* box = toRenderBox(o); point.move(box->x() + box->width(), box->y() + box->height()); } + point = o->container()->localToAbsolute(point, false, true); return true; } } diff --git a/WebCore/dom/DOMCoreException.idl b/WebCore/dom/DOMCoreException.idl index 2cbc589..945712d 100644 --- a/WebCore/dom/DOMCoreException.idl +++ b/WebCore/dom/DOMCoreException.idl @@ -29,7 +29,8 @@ module core { interface [ - NoStaticTables + NoStaticTables, + DontCheckEnums ] DOMCoreException { readonly attribute unsigned short code; diff --git a/WebCore/dom/DeviceOrientation.cpp b/WebCore/dom/DeviceOrientation.cpp new file mode 100644 index 0000000..f1c28b1 --- /dev/null +++ b/WebCore/dom/DeviceOrientation.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "DeviceOrientation.h" + +namespace WebCore { + +PassRefPtr<DeviceOrientation> DeviceOrientation::create() +{ + return adoptRef(new DeviceOrientation); +} + +PassRefPtr<DeviceOrientation> DeviceOrientation::create(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) +{ + return adoptRef(new DeviceOrientation(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma)); +} + + +DeviceOrientation::DeviceOrientation() + : m_canProvideAlpha(false) + , m_canProvideBeta(false) + , m_canProvideGamma(false) +{ +} + +DeviceOrientation::DeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) + : m_canProvideAlpha(canProvideAlpha) + , m_canProvideBeta(canProvideBeta) + , m_canProvideGamma(canProvideGamma) + , m_alpha(alpha) + , m_beta(beta) + , m_gamma(gamma) +{ +} + +double DeviceOrientation::alpha() const +{ + return m_alpha; +} + +double DeviceOrientation::beta() const +{ + return m_beta; +} + +double DeviceOrientation::gamma() const +{ + return m_gamma; +} + +bool DeviceOrientation::canProvideAlpha() const +{ + return m_canProvideAlpha; +} + +bool DeviceOrientation::canProvideBeta() const +{ + return m_canProvideBeta; +} + +bool DeviceOrientation::canProvideGamma() const +{ + return m_canProvideGamma; +} + +} // namespace WebCore diff --git a/WebCore/dom/DeviceOrientation.h b/WebCore/dom/DeviceOrientation.h new file mode 100644 index 0000000..c652736 --- /dev/null +++ b/WebCore/dom/DeviceOrientation.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DeviceOrientation_h +#define DeviceOrientation_h + +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class DeviceOrientation : public RefCounted<DeviceOrientation> { +public: + static PassRefPtr<DeviceOrientation> create(); + static PassRefPtr<DeviceOrientation> create(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma); + + double alpha() const; + double beta() const; + double gamma() const; + bool canProvideAlpha() const; + bool canProvideBeta() const; + bool canProvideGamma() const; + +private: + DeviceOrientation(); + DeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma); + + bool m_canProvideAlpha; + bool m_canProvideBeta; + bool m_canProvideGamma; + double m_alpha; + double m_beta; + double m_gamma; +}; + +} // namespace WebCore + +#endif // DeviceOrientation_h diff --git a/WebCore/dom/DeviceOrientationClient.h b/WebCore/dom/DeviceOrientationClient.h index e0f14eb..427412f 100644 --- a/WebCore/dom/DeviceOrientationClient.h +++ b/WebCore/dom/DeviceOrientationClient.h @@ -28,10 +28,13 @@ namespace WebCore { +class DeviceOrientation; + class DeviceOrientationClient { public: virtual void startUpdating() = 0; virtual void stopUpdating() = 0; + virtual DeviceOrientation* lastOrientation() const = 0; protected: virtual ~DeviceOrientationClient() {} diff --git a/WebCore/dom/DeviceOrientationController.cpp b/WebCore/dom/DeviceOrientationController.cpp index 97ddcd8..f6867ec 100644 --- a/WebCore/dom/DeviceOrientationController.cpp +++ b/WebCore/dom/DeviceOrientationController.cpp @@ -28,9 +28,9 @@ #if ENABLE(DEVICE_ORIENTATION) +#include "DeviceOrientation.h" #include "DeviceOrientationClient.h" #include "DeviceOrientationEvent.h" -#include <wtf/UnusedParam.h> namespace WebCore { @@ -40,13 +40,49 @@ DeviceOrientationController::DeviceOrientationController(Page* page, DeviceOrien { } -void DeviceOrientationController::onDeviceOrientationChange(double alpha, double beta, double gamma) +void DeviceOrientationController::addListener(DOMWindow* window) { - // FIXME: Fire DeviceOrientationEvents on the window object of all frames - // that are listening to orientation. - UNUSED_PARAM(alpha); - UNUSED_PARAM(beta); - UNUSED_PARAM(gamma); + // If no client is present, signal that no orientation data is available. + // If the client already has an orientation, call back to this new listener + // immediately. + if (!m_client) { + RefPtr<DeviceOrientation> emptyOrientation = DeviceOrientation::create(); + window->dispatchEvent(DeviceOrientationEvent::create(eventNames().deviceorientationEvent, emptyOrientation.get())); + } else if (m_client && m_client->lastOrientation()) + window->dispatchEvent(DeviceOrientationEvent::create(eventNames().deviceorientationEvent, m_client->lastOrientation())); + + // The client may call back synchronously. + bool wasEmpty = m_listeners.isEmpty(); + m_listeners.add(window); + if (wasEmpty && m_client) + m_client->startUpdating(); +} + +void DeviceOrientationController::removeListener(DOMWindow* window) +{ + m_listeners.remove(window); + if (m_listeners.isEmpty() && m_client) + m_client->stopUpdating(); +} + +void DeviceOrientationController::removeAllListeners(DOMWindow* window) +{ + // May be called with a DOMWindow that's not a listener. + if (!m_listeners.contains(window)) + return; + + m_listeners.removeAll(window); + if (m_listeners.isEmpty() && m_client) + m_client->stopUpdating(); +} + +void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientation* orientation) +{ + RefPtr<DeviceOrientationEvent> event = DeviceOrientationEvent::create(eventNames().deviceorientationEvent, orientation); + Vector<DOMWindow*> listenersVector; + copyToVector(m_listeners, listenersVector); + for (size_t i = 0; i < listenersVector.size(); ++i) + listenersVector[i]->dispatchEvent(event); } } // namespace WebCore diff --git a/WebCore/dom/DeviceOrientationController.h b/WebCore/dom/DeviceOrientationController.h index 5f8f49a..376e14c 100644 --- a/WebCore/dom/DeviceOrientationController.h +++ b/WebCore/dom/DeviceOrientationController.h @@ -26,8 +26,12 @@ #ifndef DeviceOrientationController_h #define DeviceOrientationController_h +#include "DOMWindow.h" +#include <wtf/HashCountedSet.h> + namespace WebCore { +class DeviceOrientation; class DeviceOrientationClient; class Page; @@ -35,13 +39,17 @@ class DeviceOrientationController { public: DeviceOrientationController(Page*, DeviceOrientationClient*); - // FIXME: Add methods to start and stop the service. + void addListener(DOMWindow*); + void removeListener(DOMWindow*); + void removeAllListeners(DOMWindow*); - void onDeviceOrientationChange(double alpha, double beta, double gamma); + void didChangeDeviceOrientation(DeviceOrientation*); private: Page* m_page; DeviceOrientationClient* m_client; + typedef HashCountedSet<DOMWindow*> ListenersSet; + ListenersSet m_listeners; }; } // namespace WebCore diff --git a/WebCore/dom/DeviceOrientationEvent.cpp b/WebCore/dom/DeviceOrientationEvent.cpp index b1aae65..992b6ce 100644 --- a/WebCore/dom/DeviceOrientationEvent.cpp +++ b/WebCore/dom/DeviceOrientationEvent.cpp @@ -26,35 +26,34 @@ #include "config.h" #include "DeviceOrientationEvent.h" +#include "DeviceOrientation.h" + #if ENABLE(DEVICE_ORIENTATION) namespace WebCore { +DeviceOrientationEvent::~DeviceOrientationEvent() +{ +} + DeviceOrientationEvent::DeviceOrientationEvent() - : m_alpha(0) - , m_beta(0) - , m_gamma(0) + : m_orientation(DeviceOrientation::create()) { } -DeviceOrientationEvent::DeviceOrientationEvent(const AtomicString& eventType, double alpha, double beta, double gamma) +DeviceOrientationEvent::DeviceOrientationEvent(const AtomicString& eventType, DeviceOrientation* orientation) : Event(eventType, false, false) // Can't bubble, not cancelable - , m_alpha(alpha) - , m_beta(beta) - , m_gamma(gamma) + , m_orientation(orientation) { } -void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& eventType, bool canBubble, bool cancelable, double alpha, double beta, double gamma) +void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceOrientation* orientation) { if (dispatched()) return; - initEvent(eventType, canBubble, cancelable); - - m_alpha = alpha; - m_beta = beta; - m_gamma = gamma; + initEvent(type, bubbles, cancelable); + m_orientation = orientation; } } // namespace WebCore diff --git a/WebCore/dom/DeviceOrientationEvent.h b/WebCore/dom/DeviceOrientationEvent.h index 33ff026..bfdf8fb 100644 --- a/WebCore/dom/DeviceOrientationEvent.h +++ b/WebCore/dom/DeviceOrientationEvent.h @@ -30,31 +30,31 @@ namespace WebCore { +class DeviceOrientation; + class DeviceOrientationEvent : public Event { public: + ~DeviceOrientationEvent(); static PassRefPtr<DeviceOrientationEvent> create() { return adoptRef(new DeviceOrientationEvent); } - static PassRefPtr<DeviceOrientationEvent> create(const AtomicString& eventType, double alpha, double beta, double gamma) + static PassRefPtr<DeviceOrientationEvent> create(const AtomicString& eventType, DeviceOrientation* orientation) { - return adoptRef(new DeviceOrientationEvent(eventType, alpha, beta, gamma)); + return adoptRef(new DeviceOrientationEvent(eventType, orientation)); } - void initDeviceOrientationEvent(const AtomicString& eventType, bool canBubble, bool cancelable, double alpha, double beta, double gamma); - double alpha() const { return m_alpha; } - double beta() const { return m_beta; } - double gamma() const { return m_gamma; } + void initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceOrientation*); virtual bool isDeviceOrientationEvent() const { return true; } + DeviceOrientation* orientation() const { return m_orientation.get(); } + private: DeviceOrientationEvent(); - DeviceOrientationEvent(const AtomicString& eventType, double alpha, double beta, double gamma); + DeviceOrientationEvent(const AtomicString& eventType, DeviceOrientation*); - double m_alpha; - double m_beta; - double m_gamma; + RefPtr<DeviceOrientation> m_orientation; }; } // namespace WebCore diff --git a/WebCore/dom/DeviceOrientationEvent.idl b/WebCore/dom/DeviceOrientationEvent.idl index 95d96ec..5582f0d 100644 --- a/WebCore/dom/DeviceOrientationEvent.idl +++ b/WebCore/dom/DeviceOrientationEvent.idl @@ -28,10 +28,10 @@ module core { interface [ Conditional=DEVICE_ORIENTATION ] DeviceOrientationEvent : Event { - readonly attribute double alpha; - readonly attribute double beta; - readonly attribute double gamma; - void initDeviceOrientationEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in double alpha, in double beta, in double gamma); + readonly attribute [Custom] double alpha; + readonly attribute [Custom] double beta; + readonly attribute [Custom] double gamma; + [Custom] void initDeviceOrientationEvent(in DOMString type, in boolean bubbles, in boolean cancelable, in double alpha, in double beta, in double gamma); }; } diff --git a/WebCore/dom/EventException.idl b/WebCore/dom/EventException.idl index 1c8fac6..c8f2bde 100644 --- a/WebCore/dom/EventException.idl +++ b/WebCore/dom/EventException.idl @@ -30,7 +30,8 @@ module events { // Introduced in DOM Level 2: interface [ - NoStaticTables + NoStaticTables, + DontCheckEnums ] EventException { readonly attribute unsigned short code; diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp index 73eb926..2032612 100644 --- a/WebCore/dom/Node.cpp +++ b/WebCore/dom/Node.cpp @@ -683,9 +683,8 @@ RenderBoxModelObject* Node::renderBoxModelObject() const IntRect Node::getRect() const { - // FIXME: broken with transforms if (renderer()) - return renderer()->absoluteBoundingBoxRect(); + return renderer()->absoluteBoundingBoxRect(true); return IntRect(); } diff --git a/WebCore/dom/Node.idl b/WebCore/dom/Node.idl index 07046d1..e15b210 100644 --- a/WebCore/dom/Node.idl +++ b/WebCore/dom/Node.idl @@ -28,7 +28,8 @@ module core { EventTarget, GenerateNativeConverter, InlineGetOwnPropertySlot, - Polymorphic + Polymorphic, + DontCheckEnums ] Node #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C : Object, EventTarget diff --git a/WebCore/dom/NodeRareData.h b/WebCore/dom/NodeRareData.h index 4d80cee..531fc57 100644 --- a/WebCore/dom/NodeRareData.h +++ b/WebCore/dom/NodeRareData.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2010 Apple Inc. All rights reserved. * Copyright (C) 2008 David Smith <catfish.man@gmail.com> * * This library is free software; you can redistribute it and/or @@ -29,8 +29,8 @@ #include "StringHash.h" #include "TagNodeList.h" #include <wtf/HashSet.h> -#include <wtf/PassOwnPtr.h> #include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace WebCore { @@ -77,6 +77,10 @@ public: { } + virtual ~NodeRareData() + { + } + typedef HashMap<const Node*, NodeRareData*> NodeRareDataMap; static NodeRareDataMap& rareDataMap() @@ -123,6 +127,6 @@ private: bool m_needsFocusAppearanceUpdateSoonAfterAttach : 1; }; -} //namespace +} // namespace WebCore -#endif +#endif // NodeRareData_h diff --git a/WebCore/dom/OverflowEvent.idl b/WebCore/dom/OverflowEvent.idl index 0b4f5c6..74cf56b 100644 --- a/WebCore/dom/OverflowEvent.idl +++ b/WebCore/dom/OverflowEvent.idl @@ -23,8 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ module events { - - interface OverflowEvent : Event { + // FIXME: Converge these consts and OverflowEvent::orientType values and remove DontCheckEnums attribute. + interface [DontCheckEnums] OverflowEvent : Event { const unsigned short HORIZONTAL = 0; const unsigned short VERTICAL = 1; const unsigned short BOTH = 2; diff --git a/WebCore/dom/RangeException.idl b/WebCore/dom/RangeException.idl index 100912d..c7c8558 100644 --- a/WebCore/dom/RangeException.idl +++ b/WebCore/dom/RangeException.idl @@ -19,7 +19,7 @@ module ranges { - interface RangeException { + interface [DontCheckEnums] RangeException { readonly attribute unsigned short code; readonly attribute DOMString name; diff --git a/WebCore/dom/TreeWalker.cpp b/WebCore/dom/TreeWalker.cpp index de06363..9c46fb3 100644 --- a/WebCore/dom/TreeWalker.cpp +++ b/WebCore/dom/TreeWalker.cpp @@ -151,8 +151,8 @@ Node* TreeWalker::previousSibling(ScriptState* state) m_current = sibling.release(); return m_current.get(); case NodeFilter::FILTER_SKIP: - if (sibling->firstChild()) { - sibling = sibling->firstChild(); + if (sibling->lastChild()) { + sibling = sibling->lastChild(); continue; } break; @@ -224,8 +224,8 @@ Node* TreeWalker::previousNode(ScriptState* state) acceptNodeResult = acceptNode(state, node.get()); if (state && state->hadException()) return 0; - if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) - continue; + if (acceptNodeResult == NodeFilter::FILTER_REJECT) + break; } if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) { m_current = node.release(); |