Commit 42e58c6d authored by ggaren's avatar ggaren

LayoutTests:

        Reviewed by Darin.

        * fast/dom/prototype-chain-expected.txt: Updated to reflect new
        prototype chain.

WebCore:

        Reviewed by Darin.

        - Fixed some crashes in event dispatch and settled the question of 
        when getDocument() can return NULL, removing superfluous NULL checks.

        I promise to check in a test case soon, but I need to land this before
        the global rename happens, and I left the test file on my other machine.

        Here's what I did:

        (1) Removed NULL checks for getDocument() in cases where we know it
        should not return NULL (which turned out to be all but one). Replaced 
        with ASSERT inside getDocument(). Tested to ensure there was no 
        regression @ albertsons.com.

        (2) Added the EventTargetNode class, which represents Nodes that
        implement the DOM EventTarget interface. Discussed this design with
        Maciej and Hyatt. The previous dsign -- assuming that all Nodes were 
        EventTargets -- made it possible to crash WebKit by, for example, 
        dispatching a mouse event to a documentType node that was not 
        associated with a document.

        (3) Reflected (2) into the JS bindings and touched JSDOMCore.cpp to 
        force a re-build.

        (4) Using classInfo checking, strengthened type constraints on 
        JavaScript method dispatch so that you can't finagle JavaScript into, 
        for example, invoking a document-dependent method belonging to a
        node type that's guaranteed to have a document on a node type that may
        not have one. 

        (5) Pushed some IE-specific JS bindings that depend on a node having a 
        document down from DOMNode to DOMElement. (An element always has a 
        document.) Tested that Firefox's behavior matched. Confirmed with MSDN.

        (6) Updated Objc bindigns to throw an exception if you try to use
        the event interface on a node that doesn't support it. Discussed this
        design with Maciej and TimH.

        (7) Consolidated repeated documentElement-finding code in the Position 
        class into the Position::documentElement() method. Did the same for
        repeated top-level document finding and DocumentImpl::topDocument().
        
        * WebCore+SVG/KDOMHeaders.h:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSDOMCore.cpp:
        * bindings/objc/DOM.mm:
        (-[DOMNode addEventListener:::]):
        (-[DOMNode removeEventListener:::]):
        (-[DOMNode dispatchEvent:]):
        (-[DOMNode KJS::Bindings::]):
        * bridge/mac/MacFrame.mm:
        (WebCore::MacFrame::keyEvent):
        (WebCore::MacFrame::dispatchCPPEvent):
        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge setSelectedDOMRange:affinity:closeTyping:]):
        (-[WebCoreFrameBridge smartDeleteRangeForProposedRange:]):
        * css/css_base.cpp:
        (WebCore::StyleBaseImpl::baseURL):
        * css/css_computedstyle.cpp:
        (WebCore::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
        * css/css_valueimpl.cpp:
        (WebCore::CSSMutableStyleDeclarationImpl::removeProperty):
        (WebCore::CSSMutableStyleDeclarationImpl::setProperty):
        * css/cssstyleselector.cpp:
        (WebCore::CSSStyleSelector::applyProperty):
        * dom/Attr.idl:
        * dom/CharacterData.idl:
        * dom/CharacterDataImpl.cpp:
        (WebCore::CharacterDataImpl::CharacterDataImpl):
        (WebCore::CharacterDataImpl::rendererIsNeeded):
        (WebCore::CharacterDataImpl::dump):
        * dom/CharacterDataImpl.h:
        * dom/ContainerNodeImpl.cpp:
        (WebCore::ContainerNodeImpl::ContainerNodeImpl):
        (WebCore::ContainerNodeImpl::removeChild):
        (WebCore::ContainerNodeImpl::attach):
        (WebCore::ContainerNodeImpl::detach):
        (WebCore::ContainerNodeImpl::insertedIntoDocument):
        (WebCore::ContainerNodeImpl::removedFromDocument):
        (WebCore::ContainerNodeImpl::insertedIntoTree):
        (WebCore::ContainerNodeImpl::removedFromTree):
        (WebCore::ContainerNodeImpl::setFocus):
        (WebCore::ContainerNodeImpl::setActive):
        (WebCore::ContainerNodeImpl::setHovered):
        (WebCore::dispatchChildInsertionEvents):
        (WebCore::dispatchChildRemovalEvents):
        * dom/ContainerNodeImpl.h:
        * dom/DOMImplementationImpl.cpp:
        (WebCore::DOMImplementationImpl::createDocument):
        * dom/DocumentImpl.cpp:
        (WebCore::DocumentImpl::removeAllEventListenersFromAllNodes):
        (WebCore::DocumentImpl::removeAllDisconnectedNodeEventListeners):
        (WebCore::DocumentImpl::getAccObjectCache):
        (WebCore::DocumentImpl::setFocusNode):
        (WebCore::DocumentImpl::topDocument):
        * dom/Element.idl:
        * dom/EventTargetNodeImpl.cpp: Added.
        (WebCore::EventTargetNodeImpl::EventTargetNodeImpl):
        (WebCore::EventTargetNodeImpl::~EventTargetNodeImpl):
        (WebCore::EventTargetNodeImpl::insertedIntoDocument):
        (WebCore::EventTargetNodeImpl::removedFromDocument):
        (WebCore::EventTargetNodeImpl::addEventListener):
        (WebCore::EventTargetNodeImpl::removeEventListener):
        (WebCore::EventTargetNodeImpl::removeAllEventListeners):
        (WebCore::EventTargetNodeImpl::handleLocalEvents):
        (WebCore::EventTargetNodeImpl::dispatchGenericEvent):
        (WebCore::EventTargetNodeImpl::dispatchEvent):
        (WebCore::EventTargetNodeImpl::dispatchSubtreeModifiedEvent):
        (WebCore::EventTargetNodeImpl::dispatchWindowEvent):
        (WebCore::EventTargetNodeImpl::dispatchUIEvent):
        (WebCore::EventTargetNodeImpl::dispatchKeyEvent):
        (WebCore::EventTargetNodeImpl::dispatchMouseEvent):
        (WebCore::EventTargetNodeImpl::dispatchSimulatedMouseEvent):
        (WebCore::EventTargetNodeImpl::dispatchWheelEvent):
        (WebCore::EventTargetNodeImpl::dispatchHTMLEvent):
        (WebCore::EventTargetNodeImpl::removeHTMLEventListener):
        (WebCore::EventTargetNodeImpl::setHTMLEventListener):
        (WebCore::EventTargetNodeImpl::getHTMLEventListener):
        (WebCore::EventTargetNodeImpl::disabled):
        (WebCore::EventTargetNodeImpl::defaultEventHandler):
        (WebCore::EventTargetNodeImpl::dump):
        * dom/EventTargetNodeImpl.h: Added.
        (WebCore::EventTargetNodeImpl::isEventTargetNode):
        (WebCore::EventTargetNodeImpl::preDispatchEventHandler):
        (WebCore::EventTargetNodeImpl::postDispatchEventHandler):
        (WebCore::EventTarget):
        (WebCore::forbidEventDispatch):
        (WebCore::allowEventDispatch):
        (WebCore::eventDispatchForbidden):
        * dom/NodeImpl.cpp:
        (WebCore::NodeImpl::NodeImpl):
        (WebCore::NodeImpl::~NodeImpl):
        (WebCore::NodeImpl::dump):
        (WebCore::NodeImpl::detach):
        (WebCore::NodeImpl::insertedIntoDocument):
        (WebCore::NodeImpl::removedFromDocument):
        * dom/NodeImpl.h:
        (WebCore::NodeImpl::isEventTargetNode):
        (WebCore::NodeImpl::isLink):
        (WebCore::NodeImpl::getDocument):
        (WebCore::NodeImpl::inDocument):
        * dom/dom2_eventsimpl.cpp:
        (WebCore::MouseRelatedEventImpl::receivedTarget):
        * dom/dom2_rangeimpl.cpp:
        (WebCore::RangeImpl::commonAncestorContainer):
        * dom/dom_elementimpl.cpp:
        (WebCore::inHTMLDocument):
        (WebCore::ElementImpl::focus):
        (WebCore::ElementImpl::blur):
        (WebCore::StyledElementImpl::parseMappedAttribute):
        * dom/dom_position.cpp:
        (WebCore::Position::documentElement):
        * dom/dom_position.h:
        * editing/ReplaceSelectionCommand.cpp:
        (WebCore::computeAndStoreNodeDesiredStyle):
        * editing/SelectionController.cpp:
        (WebCore::SelectionController::needsCaretRepaint):
        * editing/visible_units.cpp:
        (WebCore::previousBoundary):
        (WebCore::nextBoundary):
        (WebCore::previousLinePosition):
        (WebCore::nextLinePosition):
        (WebCore::startOfDocument):
        (WebCore::endOfDocument):
        * khtml/ecma/kjs_dom.cpp:
        (KJS::DOMNode::mark):
        (KJS::DOMNode::getValueProperty):
        (KJS::DOMNode::putValueProperty):
        (KJS::DOMNodeProtoFunc::callAsFunction):
        (KJS::DOMEventTargetNode::DOMEventTargetNode):
        (KJS::DOMEventTargetNode::getOwnPropertySlot):
        (KJS::DOMEventTargetNode::getValueProperty):
        (KJS::DOMEventTargetNode::put):
        (KJS::DOMEventTargetNode::putValueProperty):
        (KJS::DOMEventTargetNode::setListener):
        (KJS::DOMEventTargetNode::getListener):
        (KJS::DOMEventTargetNode::pushEventHandlerScope):
        (KJS::DOMEventTargetNodeProtoFunc::callAsFunction):
        (KJS::):
        (KJS::DOMDocument::DOMDocument):
        (KJS::DOMDocument::getOwnPropertySlot):
        (KJS::DOMDocument::put):
        (KJS::DOMDocument::putValueProperty):
        (KJS::DOMDocumentProtoFunc::callAsFunction):
        (KJS::DOMElement::DOMElement):
        (KJS::DOMElement::getValueProperty):
        (KJS::DOMElement::put):
        (KJS::DOMElement::putValueProperty):
        (KJS::DOMElement::getOwnPropertySlot):
        (KJS::DOMElementProtoFunc::callAsFunction):
        (KJS::checkNodeSecurity):
        * khtml/ecma/kjs_dom.h:
        (KJS::DOMNode::):
        (KJS::DOMEventTargetNode::):
        (KJS::DOMElement::):
        * khtml/ecma/kjs_events.cpp:
        (KJS::JSLazyEventListener::parseCode):
        (KJS::getNodeEventListener):
        * khtml/ecma/kjs_html.cpp:
        (KJS::HTMLElement::bodyGetter):
        (KJS::HTMLElement::anchorGetter):
        (KJS::HTMLElement::getValueProperty):
        (KJS::HTMLElement::bodySetter):
        * khtml/ecma/kjs_views.cpp:
        (KJS::DOMAbstractViewProtoFunc::callAsFunction):
        * khtml/html/HTMLFormElementImpl.cpp:
        (WebCore::HTMLFormElementImpl::registerFormElement):
        (WebCore::HTMLFormElementImpl::removeFormElement):
        * khtml/html/HTMLGenericFormElementImpl.cpp:
        (WebCore::HTMLGenericFormElementImpl::insertedIntoTree):
        * khtml/html/HTMLInputElementImpl.cpp:
        (WebCore::HTMLInputElementImpl::~HTMLInputElementImpl):
        (WebCore::HTMLInputElementImpl::focus):
        * khtml/html/HTMLOptionElementImpl.cpp:
        (WebCore::HTMLOptionElementImpl::text):
        * khtml/html/HTMLSelectElementImpl.cpp:
        (WebCore::HTMLSelectElementImpl::~HTMLSelectElementImpl):
        * khtml/html/HTMLTextAreaElementImpl.cpp:
        (WebCore::HTMLTextAreaElementImpl::~HTMLTextAreaElementImpl):
        * khtml/html/html_baseimpl.cpp:
        (WebCore::HTMLBodyElementImpl::insertedIntoDocument):
        (WebCore::HTMLFrameElementImpl::isURLAllowed):
        (WebCore::HTMLFrameElementImpl::openURL):
        (WebCore::HTMLFrameElementImpl::frameWidth):
        (WebCore::HTMLFrameElementImpl::frameHeight):
        * khtml/html/html_imageimpl.cpp:
        (WebCore::HTMLImageLoader::~HTMLImageLoader):
        (WebCore::HTMLImageLoader::updateFromElement):
        (WebCore::HTMLImageLoader::notifyFinished):
        (WebCore::HTMLImageElementImpl::width):
        (WebCore::HTMLImageElementImpl::height):
        (WebCore::HTMLMapElementImpl::~HTMLMapElementImpl):
        * khtml/html/html_inlineimpl.cpp:
        (WebCore::HTMLAnchorElementImpl::defaultEventHandler):
        * khtml/html/htmltokenizer.cpp:
        (WebCore::HTMLTokenizer::notifyFinished):
        * ksvg2/svg/SVGAnimateColorElementImpl.cpp:
        (SVGAnimateColorElementImpl::handleTimerEvent):
        * ksvg2/svg/SVGAnimateElementImpl.cpp:
        (SVGAnimateElementImpl::handleTimerEvent):
        * ksvg2/svg/SVGAnimateTransformElementImpl.cpp:
        (SVGAnimateTransformElementImpl::handleTimerEvent):
        * ksvg2/svg/SVGAnimationElementImpl.cpp:
        (SVGAnimationElementImpl::closeRenderer):
        * ksvg2/svg/SVGDOMImplementationImpl.cpp:
        * ksvg2/svg/SVGDocumentImpl.cpp:
        (WebCore::SVGDocumentImpl::dispatchRecursiveEvent):
        * ksvg2/svg/SVGDocumentImpl.h:
        * ksvg2/svg/SVGImageElementImpl.cpp:
        * ksvg2/svg/SVGSetElementImpl.cpp:
        (SVGSetElementImpl::handleTimerEvent):
        * kwq/KWQAccObject.mm:
        (-[KWQAccObject mouseButtonListener]):
        (-[KWQAccObject accessibilityPerformAction:]):
        * kwq/KWQTextArea.mm:
        (-[KWQTextAreaTextView dispatchHTMLEvent:]):
        * page/Frame.cpp:
        (WebCore::dispatchKHTMLEditableContentChanged):
        * page/FrameView.cpp:
        (WebCore::FrameView::dispatchDragEvent):
        (WebCore::FrameView::dispatchMouseEvent):
        (WebCore::FrameView::viewportWheelEvent):
        * rendering/render_layer.cpp:
        (WebCore::RenderLayer::scrollToOffset):
        * rendering/render_object.cpp:
        (WebCore::RenderObject::shouldSelect):
        (WebCore::RenderObject::backslashAsCurrencySymbol):
        * rendering/render_replaced.cpp:
        (WebCore::RenderWidget::sendConsumedMouseUp):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@13369 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0589f07a
2006-03-17 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin.
* fast/dom/prototype-chain-expected.txt: Updated to reflect new
prototype chain.
2006-03-17 Beth Dakin <bdakin@apple.com>
Reviewed by hyatt
......
......@@ -2,20 +2,24 @@ This page prints out the prototype chains of select DOM objects. Older versions
NOTE: This test will start failing if you change the layout of a related prototype chain in WebCore. That does not necessarily mean that you have done something wrong; you may just need to check in new results.
----- [object HTMLDocument] (3 prototypes) -----
----- [object HTMLDocument] (4 prototypes) -----
[object Object]
[object DOMNode]
[object DOMEventTargetNode]
[object DOMDocument]
----- [object DIV] (4 prototypes) -----
----- [object DIV] (5 prototypes) -----
[object Object]
[object DOMNode]
[object DOMEventTargetNode]
[object DOMElement]
[object JSElement]
......
2006-03-17 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin.
- Fixed some crashes in event dispatch and settled the question of
when getDocument() can return NULL, removing superfluous NULL checks.
I promise to check in a test case soon, but I need to land this before
the global rename happens, and I left the test file on my other machine.
Here's what I did:
(1) Removed NULL checks for getDocument() in cases where we know it
should not return NULL (which turned out to be all but one). Replaced
with ASSERT inside getDocument(). Tested to ensure there was no
regression @ albertsons.com.
(2) Added the EventTargetNode class, which represents Nodes that
implement the DOM EventTarget interface. Discussed this design with
Maciej and Hyatt. The previous dsign -- assuming that all Nodes were
EventTargets -- made it possible to crash WebKit by, for example,
dispatching a mouse event to a documentType node that was not
associated with a document.
(3) Reflected (2) into the JS bindings and touched JSDOMCore.cpp to
force a re-build.
(4) Using classInfo checking, strengthened type constraints on
JavaScript method dispatch so that you can't finagle JavaScript into,
for example, invoking a document-dependent method belonging to a
node type that's guaranteed to have a document on a node type that may
not have one.
(5) Pushed some IE-specific JS bindings that depend on a node having a
document down from DOMNode to DOMElement. (An element always has a
document.) Tested that Firefox's behavior matched. Confirmed with MSDN.
(6) Updated Objc bindigns to throw an exception if you try to use
the event interface on a node that doesn't support it. Discussed this
design with Maciej and TimH.
(7) Consolidated repeated documentElement-finding code in the Position
class into the Position::documentElement() method. Did the same for
repeated top-level document finding and DocumentImpl::topDocument().
* WebCore+SVG/KDOMHeaders.h:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMCore.cpp:
* bindings/objc/DOM.mm:
(-[DOMNode addEventListener:::]):
(-[DOMNode removeEventListener:::]):
(-[DOMNode dispatchEvent:]):
(-[DOMNode KJS::Bindings::]):
* bridge/mac/MacFrame.mm:
(WebCore::MacFrame::keyEvent):
(WebCore::MacFrame::dispatchCPPEvent):
* bridge/mac/WebCoreFrameBridge.mm:
(-[WebCoreFrameBridge setSelectedDOMRange:affinity:closeTyping:]):
(-[WebCoreFrameBridge smartDeleteRangeForProposedRange:]):
* css/css_base.cpp:
(WebCore::StyleBaseImpl::baseURL):
* css/css_computedstyle.cpp:
(WebCore::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
* css/css_valueimpl.cpp:
(WebCore::CSSMutableStyleDeclarationImpl::removeProperty):
(WebCore::CSSMutableStyleDeclarationImpl::setProperty):
* css/cssstyleselector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
* dom/Attr.idl:
* dom/CharacterData.idl:
* dom/CharacterDataImpl.cpp:
(WebCore::CharacterDataImpl::CharacterDataImpl):
(WebCore::CharacterDataImpl::rendererIsNeeded):
(WebCore::CharacterDataImpl::dump):
* dom/CharacterDataImpl.h:
* dom/ContainerNodeImpl.cpp:
(WebCore::ContainerNodeImpl::ContainerNodeImpl):
(WebCore::ContainerNodeImpl::removeChild):
(WebCore::ContainerNodeImpl::attach):
(WebCore::ContainerNodeImpl::detach):
(WebCore::ContainerNodeImpl::insertedIntoDocument):
(WebCore::ContainerNodeImpl::removedFromDocument):
(WebCore::ContainerNodeImpl::insertedIntoTree):
(WebCore::ContainerNodeImpl::removedFromTree):
(WebCore::ContainerNodeImpl::setFocus):
(WebCore::ContainerNodeImpl::setActive):
(WebCore::ContainerNodeImpl::setHovered):
(WebCore::dispatchChildInsertionEvents):
(WebCore::dispatchChildRemovalEvents):
* dom/ContainerNodeImpl.h:
* dom/DOMImplementationImpl.cpp:
(WebCore::DOMImplementationImpl::createDocument):
* dom/DocumentImpl.cpp:
(WebCore::DocumentImpl::removeAllEventListenersFromAllNodes):
(WebCore::DocumentImpl::removeAllDisconnectedNodeEventListeners):
(WebCore::DocumentImpl::getAccObjectCache):
(WebCore::DocumentImpl::setFocusNode):
(WebCore::DocumentImpl::topDocument):
* dom/Element.idl:
* dom/EventTargetNodeImpl.cpp: Added.
(WebCore::EventTargetNodeImpl::EventTargetNodeImpl):
(WebCore::EventTargetNodeImpl::~EventTargetNodeImpl):
(WebCore::EventTargetNodeImpl::insertedIntoDocument):
(WebCore::EventTargetNodeImpl::removedFromDocument):
(WebCore::EventTargetNodeImpl::addEventListener):
(WebCore::EventTargetNodeImpl::removeEventListener):
(WebCore::EventTargetNodeImpl::removeAllEventListeners):
(WebCore::EventTargetNodeImpl::handleLocalEvents):
(WebCore::EventTargetNodeImpl::dispatchGenericEvent):
(WebCore::EventTargetNodeImpl::dispatchEvent):
(WebCore::EventTargetNodeImpl::dispatchSubtreeModifiedEvent):
(WebCore::EventTargetNodeImpl::dispatchWindowEvent):
(WebCore::EventTargetNodeImpl::dispatchUIEvent):
(WebCore::EventTargetNodeImpl::dispatchKeyEvent):
(WebCore::EventTargetNodeImpl::dispatchMouseEvent):
(WebCore::EventTargetNodeImpl::dispatchSimulatedMouseEvent):
(WebCore::EventTargetNodeImpl::dispatchWheelEvent):
(WebCore::EventTargetNodeImpl::dispatchHTMLEvent):
(WebCore::EventTargetNodeImpl::removeHTMLEventListener):
(WebCore::EventTargetNodeImpl::setHTMLEventListener):
(WebCore::EventTargetNodeImpl::getHTMLEventListener):
(WebCore::EventTargetNodeImpl::disabled):
(WebCore::EventTargetNodeImpl::defaultEventHandler):
(WebCore::EventTargetNodeImpl::dump):
* dom/EventTargetNodeImpl.h: Added.
(WebCore::EventTargetNodeImpl::isEventTargetNode):
(WebCore::EventTargetNodeImpl::preDispatchEventHandler):
(WebCore::EventTargetNodeImpl::postDispatchEventHandler):
(WebCore::EventTarget):
(WebCore::forbidEventDispatch):
(WebCore::allowEventDispatch):
(WebCore::eventDispatchForbidden):
* dom/NodeImpl.cpp:
(WebCore::NodeImpl::NodeImpl):
(WebCore::NodeImpl::~NodeImpl):
(WebCore::NodeImpl::dump):
(WebCore::NodeImpl::detach):
(WebCore::NodeImpl::insertedIntoDocument):
(WebCore::NodeImpl::removedFromDocument):
* dom/NodeImpl.h:
(WebCore::NodeImpl::isEventTargetNode):
(WebCore::NodeImpl::isLink):
(WebCore::NodeImpl::getDocument):
(WebCore::NodeImpl::inDocument):
* dom/dom2_eventsimpl.cpp:
(WebCore::MouseRelatedEventImpl::receivedTarget):
* dom/dom2_rangeimpl.cpp:
(WebCore::RangeImpl::commonAncestorContainer):
* dom/dom_elementimpl.cpp:
(WebCore::inHTMLDocument):
(WebCore::ElementImpl::focus):
(WebCore::ElementImpl::blur):
(WebCore::StyledElementImpl::parseMappedAttribute):
* dom/dom_position.cpp:
(WebCore::Position::documentElement):
* dom/dom_position.h:
* editing/ReplaceSelectionCommand.cpp:
(WebCore::computeAndStoreNodeDesiredStyle):
* editing/SelectionController.cpp:
(WebCore::SelectionController::needsCaretRepaint):
* editing/visible_units.cpp:
(WebCore::previousBoundary):
(WebCore::nextBoundary):
(WebCore::previousLinePosition):
(WebCore::nextLinePosition):
(WebCore::startOfDocument):
(WebCore::endOfDocument):
* khtml/ecma/kjs_dom.cpp:
(KJS::DOMNode::mark):
(KJS::DOMNode::getValueProperty):
(KJS::DOMNode::putValueProperty):
(KJS::DOMNodeProtoFunc::callAsFunction):
(KJS::DOMEventTargetNode::DOMEventTargetNode):
(KJS::DOMEventTargetNode::getOwnPropertySlot):
(KJS::DOMEventTargetNode::getValueProperty):
(KJS::DOMEventTargetNode::put):
(KJS::DOMEventTargetNode::putValueProperty):
(KJS::DOMEventTargetNode::setListener):
(KJS::DOMEventTargetNode::getListener):
(KJS::DOMEventTargetNode::pushEventHandlerScope):
(KJS::DOMEventTargetNodeProtoFunc::callAsFunction):
(KJS::):
(KJS::DOMDocument::DOMDocument):
(KJS::DOMDocument::getOwnPropertySlot):
(KJS::DOMDocument::put):
(KJS::DOMDocument::putValueProperty):
(KJS::DOMDocumentProtoFunc::callAsFunction):
(KJS::DOMElement::DOMElement):
(KJS::DOMElement::getValueProperty):
(KJS::DOMElement::put):
(KJS::DOMElement::putValueProperty):
(KJS::DOMElement::getOwnPropertySlot):
(KJS::DOMElementProtoFunc::callAsFunction):
(KJS::checkNodeSecurity):
* khtml/ecma/kjs_dom.h:
(KJS::DOMNode::):
(KJS::DOMEventTargetNode::):
(KJS::DOMElement::):
* khtml/ecma/kjs_events.cpp:
(KJS::JSLazyEventListener::parseCode):
(KJS::getNodeEventListener):
* khtml/ecma/kjs_html.cpp:
(KJS::HTMLElement::bodyGetter):
(KJS::HTMLElement::anchorGetter):
(KJS::HTMLElement::getValueProperty):
(KJS::HTMLElement::bodySetter):
* khtml/ecma/kjs_views.cpp:
(KJS::DOMAbstractViewProtoFunc::callAsFunction):
* khtml/html/HTMLFormElementImpl.cpp:
(WebCore::HTMLFormElementImpl::registerFormElement):
(WebCore::HTMLFormElementImpl::removeFormElement):
* khtml/html/HTMLGenericFormElementImpl.cpp:
(WebCore::HTMLGenericFormElementImpl::insertedIntoTree):
* khtml/html/HTMLInputElementImpl.cpp:
(WebCore::HTMLInputElementImpl::~HTMLInputElementImpl):
(WebCore::HTMLInputElementImpl::focus):
* khtml/html/HTMLOptionElementImpl.cpp:
(WebCore::HTMLOptionElementImpl::text):
* khtml/html/HTMLSelectElementImpl.cpp:
(WebCore::HTMLSelectElementImpl::~HTMLSelectElementImpl):
* khtml/html/HTMLTextAreaElementImpl.cpp:
(WebCore::HTMLTextAreaElementImpl::~HTMLTextAreaElementImpl):
* khtml/html/html_baseimpl.cpp:
(WebCore::HTMLBodyElementImpl::insertedIntoDocument):
(WebCore::HTMLFrameElementImpl::isURLAllowed):
(WebCore::HTMLFrameElementImpl::openURL):
(WebCore::HTMLFrameElementImpl::frameWidth):
(WebCore::HTMLFrameElementImpl::frameHeight):
* khtml/html/html_imageimpl.cpp:
(WebCore::HTMLImageLoader::~HTMLImageLoader):
(WebCore::HTMLImageLoader::updateFromElement):
(WebCore::HTMLImageLoader::notifyFinished):
(WebCore::HTMLImageElementImpl::width):
(WebCore::HTMLImageElementImpl::height):
(WebCore::HTMLMapElementImpl::~HTMLMapElementImpl):
* khtml/html/html_inlineimpl.cpp:
(WebCore::HTMLAnchorElementImpl::defaultEventHandler):
* khtml/html/htmltokenizer.cpp:
(WebCore::HTMLTokenizer::notifyFinished):
* ksvg2/svg/SVGAnimateColorElementImpl.cpp:
(SVGAnimateColorElementImpl::handleTimerEvent):
* ksvg2/svg/SVGAnimateElementImpl.cpp:
(SVGAnimateElementImpl::handleTimerEvent):
* ksvg2/svg/SVGAnimateTransformElementImpl.cpp:
(SVGAnimateTransformElementImpl::handleTimerEvent):
* ksvg2/svg/SVGAnimationElementImpl.cpp:
(SVGAnimationElementImpl::closeRenderer):
* ksvg2/svg/SVGDOMImplementationImpl.cpp:
* ksvg2/svg/SVGDocumentImpl.cpp:
(WebCore::SVGDocumentImpl::dispatchRecursiveEvent):
* ksvg2/svg/SVGDocumentImpl.h:
* ksvg2/svg/SVGImageElementImpl.cpp:
* ksvg2/svg/SVGSetElementImpl.cpp:
(SVGSetElementImpl::handleTimerEvent):
* kwq/KWQAccObject.mm:
(-[KWQAccObject mouseButtonListener]):
(-[KWQAccObject accessibilityPerformAction:]):
* kwq/KWQTextArea.mm:
(-[KWQTextAreaTextView dispatchHTMLEvent:]):
* page/Frame.cpp:
(WebCore::dispatchKHTMLEditableContentChanged):
* page/FrameView.cpp:
(WebCore::FrameView::dispatchDragEvent):
(WebCore::FrameView::dispatchMouseEvent):
(WebCore::FrameView::viewportWheelEvent):
* rendering/render_layer.cpp:
(WebCore::RenderLayer::scrollToOffset):
* rendering/render_object.cpp:
(WebCore::RenderObject::shouldSelect):
(WebCore::RenderObject::backslashAsCurrencySymbol):
* rendering/render_replaced.cpp:
(WebCore::RenderWidget::sendConsumedMouseUp):
2006-03-17 David Hyatt <hyatt@apple.com>
Fix for 7837, make opacity work with table rows. Make transparent backgrounds
......@@ -4,14 +4,14 @@ namespace khtml {
}
namespace DOM {
class NodeImpl;
class EventTargetNodeImpl;
}
namespace KDOM {
using namespace DOM;
using namespace khtml;
typedef khtml::StyleListImpl CSSStyleSelectorList;
typedef NodeImpl EventTargetImpl;
typedef EventTargetNodeImpl EventTargetImpl;
}
#include "Shared.h"
......
......@@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
14EC267F09CA07E000E1EEEC /* EventTargetNodeImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 14EC267D09CA07E000E1EEEC /* EventTargetNodeImpl.h */; };
14EC268009CA07E000E1EEEC /* EventTargetNodeImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14EC267E09CA07E000E1EEEC /* EventTargetNodeImpl.cpp */; };
1A2154EE099A11A800343DF8 /* JSDOMCore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2154EC099A11A800343DF8 /* JSDOMCore.cpp */; };
1A2154EF099A11A800343DF8 /* JSDOMEvents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2154ED099A11A800343DF8 /* JSDOMEvents.cpp */; };
1A69D381085627410009880D /* domparser.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A69D37F085627410009880D /* domparser.h */; };
......@@ -1124,6 +1126,8 @@
/* End PBXBuildStyle section */
/* Begin PBXFileReference section */
14EC267D09CA07E000E1EEEC /* EventTargetNodeImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventTargetNodeImpl.h; sourceTree = "<group>"; };
14EC267E09CA07E000E1EEEC /* EventTargetNodeImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventTargetNodeImpl.cpp; sourceTree = "<group>"; };
1A2154EC099A11A800343DF8 /* JSDOMCore.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMCore.cpp; path = bindings/js/JSDOMCore.cpp; sourceTree = "<group>"; };
1A2154ED099A11A800343DF8 /* JSDOMEvents.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMEvents.cpp; path = bindings/js/JSDOMEvents.cpp; sourceTree = "<group>"; };
1A69D37F085627410009880D /* domparser.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = domparser.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
......@@ -1577,7 +1581,7 @@
A81872110977D3C0005826D9 /* ContainerNodeImpl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ContainerNodeImpl.h; sourceTree = "<group>"; };
A81872120977D3C0005826D9 /* NodeImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = NodeImpl.cpp; sourceTree = "<group>"; };
A81872130977D3C0005826D9 /* NameNodeListImpl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NameNodeListImpl.h; sourceTree = "<group>"; };
A81872140977D3C0005826D9 /* ContainerNodeImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ContainerNodeImpl.cpp; sourceTree = "<group>"; };
A81872140977D3C0005826D9 /* ContainerNodeImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContainerNodeImpl.cpp; sourceTree = "<group>"; };
A81872150977D3C0005826D9 /* ChildNodeListImpl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ChildNodeListImpl.h; sourceTree = "<group>"; };
A81872160977D3C0005826D9 /* NodeListImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = NodeListImpl.cpp; sourceTree = "<group>"; };
A81872170977D3C0005826D9 /* NodeImpl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NodeImpl.h; sourceTree = "<group>"; };
......@@ -3847,6 +3851,8 @@
93EEC1F709C2877700C515D1 /* WheelEvent.idl */,
F523D30902DE4476018635CA /* xml_tokenizer.cpp */,
F523D30A02DE4476018635CA /* xml_tokenizer.h */,
14EC267D09CA07E000E1EEEC /* EventTargetNodeImpl.h */,
14EC267E09CA07E000E1EEEC /* EventTargetNodeImpl.cpp */,
);
path = dom;
sourceTree = "<group>";
......@@ -4446,6 +4452,7 @@
9352071E09BD3BBB00F2038D /* WebCoreWidgetHolder.h in Headers */,
935207BE09BD410A00F2038D /* LocalizedStrings.h in Headers */,
9352088209BD45E900F2038D /* CookieJar.h in Headers */,
14EC267F09CA07E000E1EEEC /* EventTargetNodeImpl.h in Headers */,
93EEC1FA09C2877700C515D1 /* DocPtr.h in Headers */,
93EEC20009C2877700C515D1 /* CanvasRenderingContext2D.h in Headers */,
93EEC20109C2877700C515D1 /* CanvasStyle.h in Headers */,
......@@ -5600,6 +5607,7 @@
935207C009BD412100F2038D /* LocalizedStringsMac.mm in Sources */,
9352084509BD43B900F2038D /* Language.mm in Sources */,
9352087709BD453400F2038D /* CookieJar.mm in Sources */,
14EC268009CA07E000E1EEEC /* EventTargetNodeImpl.cpp in Sources */,
93E47C5C09BE2BBB0019C5C1 /* PageMac.mm in Sources */,
93EEC1FF09C2877700C515D1 /* CanvasRenderingContext2D.cpp in Sources */,
93EEC20209C2877700C515D1 /* CanvasGradient.cpp in Sources */,
......
......@@ -2,6 +2,7 @@
// The files below are all generated by a script.
#include "JSAttr.cpp"
#include "JSCharacterData.cpp"
#include "JSDocumentType.cpp"
......
......@@ -412,21 +412,30 @@ static ListenerMap *listenerMap;
- (void)addEventListener:(NSString *)type :(id <DOMEventListener>)listener :(BOOL)useCapture
{
if (![self _nodeImpl]->isEventTargetNode())
raiseDOMException(DOM_NOT_SUPPORTED_ERR);
EventListener *wrapper = ObjCEventListener::create(listener);
[self _nodeImpl]->addEventListener(type, wrapper, useCapture);
EventTargetNodeCast([self _nodeImpl])->addEventListener(type, wrapper, useCapture);
wrapper->deref();
}
- (void)removeEventListener:(NSString *)type :(id <DOMEventListener>)listener :(BOOL)useCapture
{
if (![self _nodeImpl]->isEventTargetNode())
raiseDOMException(DOM_NOT_SUPPORTED_ERR);
if (EventListener *wrapper = ObjCEventListener::find(listener))
[self _nodeImpl]->removeEventListener(type, wrapper, useCapture);
EventTargetNodeCast([self _nodeImpl])->removeEventListener(type, wrapper, useCapture);
}
- (BOOL)dispatchEvent:(DOMEvent *)event
{
if (![self _nodeImpl]->isEventTargetNode())
raiseDOMException(DOM_NOT_SUPPORTED_ERR);
ExceptionCode ec = 0;
BOOL result = [self _nodeImpl]->dispatchEvent([event _eventImpl], ec);
BOOL result = EventTargetNodeCast([self _nodeImpl])->dispatchEvent([event _eventImpl], ec);
raiseOnDOMError(ec);
return result;
}
......@@ -657,19 +666,11 @@ static ListenerMap *listenerMap;
- (const KJS::Bindings::RootObject *)_executionContext
{
NodeImpl *n = [self _nodeImpl];
if (!n)
return 0;
DocumentImpl *doc = n->getDocument();
if (!doc)
return 0;
MacFrame *p = Mac(doc->frame());
if (!p)
return 0;
return p->executionContextForDOM();
if (NodeImpl *n = [self _nodeImpl])
if (MacFrame *f = Mac(n->getDocument()->frame()))
return f->executionContextForDOM();
return 0;
}
@end
......
......@@ -1369,7 +1369,7 @@ bool MacFrame::keyEvent(NSEvent *event)
_currentEvent = KWQRetain(event);
KeyEvent qEvent(event);
result = !node->dispatchKeyEvent(qEvent);
result = !EventTargetNodeCast(node)->dispatchKeyEvent(qEvent);
// We want to send both a down and a press for the initial key event.
// To get KHTML to do this, we send a second KeyPress with "is repeat" set to true,
......@@ -1377,7 +1377,7 @@ bool MacFrame::keyEvent(NSEvent *event)
// That's not a great hack; it would be good to do this in a better way.
if ([event type] == NSKeyDown && ![event isARepeat]) {
KeyEvent repeatEvent(event, true);
if (!node->dispatchKeyEvent(repeatEvent))
if (!EventTargetNodeCast(node)->dispatchKeyEvent(repeatEvent))
result = true;
}
......@@ -1784,7 +1784,7 @@ bool MacFrame::dispatchCPPEvent(const AtomicString &eventType, KWQClipboard::Acc
ExceptionCode ec = 0;
RefPtr<EventImpl> evt = new ClipboardEventImpl(eventType, true, true, clipboard.get());
target->dispatchEvent(evt, ec, true);
EventTargetNodeCast(target)->dispatchEvent(evt, ec, true);
bool noDefaultProcessing = evt->defaultPrevented();
// invalidate clipboard here for security
......
......@@ -1700,7 +1700,6 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
NodeImpl *endContainer = [[range endContainer] _nodeImpl];
ASSERT(startContainer);
ASSERT(endContainer);
ASSERT(startContainer->getDocument());
ASSERT(startContainer->getDocument() == endContainer->getDocument());
m_frame->document()->updateLayoutIgnorePendingStylesheets();
......@@ -1849,7 +1848,6 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
if (startContainer == nil || endContainer == nil)
return nil;
ASSERT(startContainer->getDocument());
ASSERT(startContainer->getDocument() == endContainer->getDocument());
m_frame->document()->updateLayoutIgnorePendingStylesheets();
......
......@@ -59,13 +59,13 @@ DOMString StyleBaseImpl::baseURL()
return sheet->href();
// find parent
if(sheet->parent()) return sheet->parent()->baseURL();
if(sheet->parent())
return sheet->parent()->baseURL();
if(!sheet->ownerNode()) return DOMString();
if(!sheet->ownerNode())
return DOMString();
DocumentImpl *doc = sheet->ownerNode()->getDocument();
return doc->baseURL();
return sheet->ownerNode()->getDocument()->baseURL();
}
// ------------------------------------------------------------------------------
......
......@@ -315,9 +315,8 @@ PassRefPtr<CSSValueImpl> CSSComputedStyleDeclarationImpl::getPropertyCSSValue(in
return 0;
// Make sure our layout is up to date before we allow a query on these attributes.
DocumentImpl* docimpl = node->getDocument();
if (docimpl && updateLayout)
docimpl->updateLayout();
if (updateLayout)
node->getDocument()->updateLayout();
RenderObject* renderer = node->renderer();
if (!renderer)
......
......@@ -346,11 +346,6 @@ String CSSMutableStyleDeclarationImpl::removeProperty(int propertyID, bool notif
{
ec = 0;
if (m_node && !m_node->getDocument())
return ""; // FIXME: This (not well-understood) situation happens on albertsons.com.
// We don't really know how they managed to run a script on a node
// with no document pointer, but this sidesteps the crash.
String value;
QValueListIterator<CSSProperty> end;
......@@ -431,9 +426,6 @@ String CSSMutableStyleDeclarationImpl::removeProperty(int propertyID, ExceptionC
bool CSSMutableStyleDeclarationImpl::setProperty(int propertyID, const String &value, bool important, bool notifyChanged, ExceptionCode& ec)
{
if (m_node && !m_node->getDocument())
return false; // FIXME: This (not well-understood) situation happens on albertsons.com. We don't really know how they managed to run a script on a node
// with no document pointer, but this sidesteps the crash.
ec = 0;
removeProperty(propertyID);
......
......@@ -3921,7 +3921,7 @@ void CSSStyleSelector::applyProperty( int id, CSSValueImpl *value )
region = region->m_next.get();
}
element->getDocument()->setHasDashboardRegions (true);
element->getDocument()->setHasDashboardRegions(true);
break;
}
......
......@@ -19,7 +19,7 @@
module core {
interface [LegacyParent=KJS::DOMNode] Attr : Node {
interface [LegacyParent=KJS::DOMEventTargetNode] Attr : EventTargetNode {
// DOM Level 1
......
......@@ -19,7 +19,7 @@
module core {
interface [LegacyParent=KJS::DOMNode] CharacterData : Node {
interface [LegacyParent=KJS::DOMEventTargetNode] CharacterData : EventTargetNode {
attribute DOMString data
raises (DOMException);
......
......@@ -36,13 +36,13 @@ namespace WebCore {
using namespace EventNames;
CharacterDataImpl::CharacterDataImpl(DocumentImpl *doc)
: NodeImpl(doc)
: EventTargetNodeImpl(doc)
{
str = 0;
}
CharacterDataImpl::CharacterDataImpl(DocumentImpl *doc, const DOMString &_text)
: NodeImpl(doc)
: EventTargetNodeImpl(doc)
{
str = _text.impl() ? _text.impl() : new DOMStringImpl((QChar*)0, 0);
str->ref();
......@@ -275,7 +275,7 @@ bool CharacterDataImpl::rendererIsNeeded(RenderStyle *style)
{
if (!str || str->l == 0)
return false;
return NodeImpl::rendererIsNeeded(style);
return EventTargetNodeImpl::rendererIsNeeded(style);
}
bool CharacterDataImpl::offsetInCharacters() const
......@@ -288,7 +288,7 @@ void CharacterDataImpl::dump(QTextStream *stream, QString ind) const
{
*stream << " str=\"" << DOMString(str).qstring().ascii() << "\"";
NodeImpl::dump(stream,ind);
EventTargetNodeImpl::dump(stream,ind);
}
#endif
......
......@@ -25,11 +25,11 @@
#ifndef DOM_CharacterDataImpl_h
#define DOM_CharacterDataImpl_h
#include "NodeImpl.h"
#include "EventTargetNodeImpl.h"
namespace WebCore {
class CharacterDataImpl : public NodeImpl {
class CharacterDataImpl : public EventTargetNodeImpl {
public: