Changeset 151282 in webkit


Ignore:
Timestamp:
Jun 6, 2013 10:18:09 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

:hover style not applied on hover if its display property is different from original style's
https://bugs.webkit.org/show_bug.cgi?id=7555

Source/WebCore:

Properly apply the :hover pseudo-class when reattaching is required (e.g. when changing the display type)

A new AttachContext class was created to be passed along as an optional parameter to the attach/detach/reattach methods.
This new parameter is used to:

  • prevent the element from being removed from the list of hovered/active elements upon detach when a reattach is in progress
  • prevent the style from being incorrectly computed (due to the previous point)
  • prevent the style from being computed twice (the attach() method used to recompute it)

Special care was required to the case when display:none is specified in the :hover class. Enabling the :hover style
was leaving the element without a renderer, which was causing it to remain stuck in the :hover state (subsequent mouseMove
events were not able to reset the element to its normal style due to the fact that it had no renderer).

The DragController::startDrag method was updated to properly handle the case when dragImage is NULL
(for instance by setting display:none inside the -webkit-drag pseudo-class).

Patch by Radu Stavila <stavila@adobe.com> on 2013-06-06
Reviewed by Antti Koivisto.

Tests: fast/regions/hover-display-block-inline.html

fast/regions/hover-display-block-none.html

  • page/DragController.cpp:

(WebCore::DragController::startDrag):

  • dom/ContainerNode.cpp:

(WebCore::ContainerNode::attach):
(WebCore::ContainerNode::detach):

  • dom/ContainerNode.h:
  • dom/Document.cpp:

(WebCore::Document::attach):
(WebCore::Document::detach):
(WebCore::Document::updateHoverActiveState):

  • dom/Document.h:
  • dom/Element.cpp:

(WebCore::Element::setHovered):
(WebCore::Element::createRendererIfNeeded):
(WebCore::Element::attach):
(WebCore::Element::detach):
(WebCore::Element::recalcStyle):

  • dom/Element.h:
  • dom/Node.cpp:

(WebCore::Node::AttachDetachContext::AttachDetachContext):
(WebCore::Node::AttachDetachContext::~AttachDetachContext):
(WebCore::Node::attach):
(WebCore::Node::detach):

  • dom/Node.h:

(WebCore::Node::reattach):
(WebCore::Node::reattachIfAttached):

  • dom/NodeRenderingContext.cpp:

(WebCore::NodeRenderingContext::NodeRenderingContext):

  • dom/PseudoElement.cpp:

(WebCore::PseudoElement::attach):

  • dom/PseudoElement.h:
  • dom/ShadowRoot.cpp:

(WebCore::ShadowRoot::attach):

  • dom/ShadowRoot.h:
  • dom/Text.cpp:

(WebCore::Text::attach):

  • dom/Text.h:
  • html/HTMLCanvasElement.cpp:

(WebCore::HTMLCanvasElement::attach):

  • html/HTMLCanvasElement.h:
  • html/HTMLFormControlElement.cpp:

(WebCore::HTMLFormControlElement::attach):

  • html/HTMLFormControlElement.h:
  • html/HTMLFrameElement.cpp:

(WebCore::HTMLFrameElement::attach):

  • html/HTMLFrameElement.h:
  • html/HTMLFrameElementBase.cpp:

(WebCore::HTMLFrameElementBase::attach):

  • html/HTMLFrameElementBase.h:
  • html/HTMLFrameSetElement.cpp:

(WebCore::HTMLFrameSetElement::attach):

  • html/HTMLFrameSetElement.h:
  • html/HTMLImageElement.cpp:

(WebCore::HTMLImageElement::attach):

  • html/HTMLImageElement.h:
  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::attach):
(WebCore::HTMLInputElement::detach):

  • html/HTMLInputElement.h:
  • html/HTMLLIElement.cpp:

(WebCore::HTMLLIElement::attach):

  • html/HTMLLIElement.h:
  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::attach):

  • html/HTMLMediaElement.h:
  • html/HTMLOptGroupElement.cpp:

(WebCore::HTMLOptGroupElement::attach):
(WebCore::HTMLOptGroupElement::detach):

  • html/HTMLOptGroupElement.h:
  • html/HTMLOptionElement.cpp:

(WebCore::HTMLOptionElement::attach):
(WebCore::HTMLOptionElement::detach):

  • html/HTMLOptionElement.h:
  • html/HTMLPlugInElement.cpp:

(WebCore::HTMLPlugInElement::detach):

  • html/HTMLPlugInElement.h:
  • html/HTMLPlugInImageElement.cpp:

(WebCore::HTMLPlugInImageElement::attach):
(WebCore::HTMLPlugInImageElement::detach):

  • html/HTMLPlugInImageElement.h:
  • html/HTMLProgressElement.cpp:

(WebCore::HTMLProgressElement::attach):

  • html/HTMLProgressElement.h:
  • html/HTMLTextAreaElement.cpp:

(WebCore::HTMLTextAreaElement::attach):

  • html/HTMLTextAreaElement.h:
  • html/HTMLVideoElement.cpp:

(WebCore::HTMLVideoElement::attach):

  • html/HTMLVideoElement.h:
  • html/PluginDocument.cpp:

(WebCore::PluginDocument::detach):

  • html/PluginDocument.h:
  • html/shadow/InsertionPoint.cpp:

(WebCore::InsertionPoint::attach):
(WebCore::InsertionPoint::detach):

  • html/shadow/InsertionPoint.h:
  • html/shadow/SliderThumbElement.cpp:

(WebCore::SliderThumbElement::detach):

  • html/shadow/SliderThumbElement.h:
  • html/shadow/SpinButtonElement.cpp:

(WebCore::SpinButtonElement::detach):

  • html/shadow/SpinButtonElement.h:
  • html/shadow/TextControlInnerElements.cpp:

(WebCore::SearchFieldCancelButtonElement::detach):
(WebCore::InputFieldSpeechButtonElement::attach):
(WebCore::InputFieldSpeechButtonElement::detach):

  • html/shadow/TextControlInnerElements.h:
  • loader/PlaceholderDocument.cpp:

(WebCore::PlaceholderDocument::attach):

  • loader/PlaceholderDocument.h:
  • svg/SVGImageElement.cpp:

(WebCore::SVGImageElement::attach):

  • svg/SVGImageElement.h:

LayoutTests:

Patch by Radu Stavila <stavila@adobe.com> on 2013-06-06
Reviewed by Antti Koivisto.

  • fast/regions/hover-display-block-inline-expected.txt: Added.
  • fast/regions/hover-display-block-inline.html: Added.
  • fast/regions/hover-display-block-none-expected.txt: Added.
  • fast/regions/hover-display-block-none.html: Added.
  • fast/events/drag-display-none-element-expected.txt:
  • fast/events/drag-display-none-element:
Location:
trunk
Files:
4 added
67 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r151279 r151282  
     12013-06-06  Radu Stavila  <stavila@adobe.com>
     2
     3        :hover style not applied on hover if its display property is different from original style's
     4        https://bugs.webkit.org/show_bug.cgi?id=7555
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * fast/regions/hover-display-block-inline-expected.txt: Added.
     9        * fast/regions/hover-display-block-inline.html: Added.
     10        * fast/regions/hover-display-block-none-expected.txt: Added.
     11        * fast/regions/hover-display-block-none.html: Added.
     12        * fast/events/drag-display-none-element-expected.txt:
     13        * fast/events/drag-display-none-element:
     14
    1152013-06-06  Mihnea Ovidenie  <mihnea@adobe.com>
    216
  • trunk/LayoutTests/fast/events/drag-display-none-element-expected.txt

    r121388 r151282  
    1 To test, try dragging this div around. It shouldn't crash, and PASS should appear below when you end the drag.
    21PASS
  • trunk/LayoutTests/fast/events/drag-display-none-element.html

    r121388 r151282  
    1616            testRunner.notifyDone();
    1717        document.getElementById('console').appendChild(document.createTextNode('PASS'));
     18        dragme.style.display = "none";
    1819    });
    1920
     
    3435</head>
    3536<body>
    36 <div id="dragme" draggable="true">To test, try dragging this div around. It shouldn't crash, and PASS should appear below when you end the drag.</div>
     37<div id="dragme" draggable="true">To test, try dragging this div around. It shouldn't crash, the div should disappear and PASS should appear.</div>
    3738<div id="console"></div>
    3839</body>
  • trunk/Source/WebCore/ChangeLog

    r151281 r151282  
     12013-06-06  Radu Stavila  <stavila@adobe.com>
     2
     3        :hover style not applied on hover if its display property is different from original style's
     4        https://bugs.webkit.org/show_bug.cgi?id=7555
     5
     6        Properly apply the :hover pseudo-class when reattaching is required (e.g. when changing the display type)
     7
     8        A new AttachContext class was created to be passed along as an optional parameter to the attach/detach/reattach methods.
     9        This new parameter is used to:
     10            - prevent the element from being removed from the list of hovered/active elements upon detach when a reattach is in progress
     11            - prevent the style from being incorrectly computed (due to the previous point)
     12            - prevent the style from being computed twice (the attach() method used to recompute it)
     13
     14        Special care was required to the case when display:none is specified in the :hover class. Enabling the :hover style
     15        was leaving the element without a renderer, which was causing it to remain stuck in the :hover state (subsequent mouseMove
     16        events were not able to reset the element to its normal style due to the fact that it had no renderer).
     17
     18        The DragController::startDrag method was updated to properly handle the case when dragImage is NULL
     19        (for instance by setting display:none inside the -webkit-drag pseudo-class).
     20
     21        Reviewed by Antti Koivisto.
     22
     23        Tests: fast/regions/hover-display-block-inline.html
     24               fast/regions/hover-display-block-none.html
     25
     26        * page/DragController.cpp:
     27        (WebCore::DragController::startDrag):
     28        * dom/ContainerNode.cpp:
     29        (WebCore::ContainerNode::attach):
     30        (WebCore::ContainerNode::detach):
     31        * dom/ContainerNode.h:
     32        * dom/Document.cpp:
     33        (WebCore::Document::attach):
     34        (WebCore::Document::detach):
     35        (WebCore::Document::updateHoverActiveState):
     36        * dom/Document.h:
     37        * dom/Element.cpp:
     38        (WebCore::Element::setHovered):
     39        (WebCore::Element::createRendererIfNeeded):
     40        (WebCore::Element::attach):
     41        (WebCore::Element::detach):
     42        (WebCore::Element::recalcStyle):
     43        * dom/Element.h:
     44        * dom/Node.cpp:
     45        (WebCore::Node::AttachDetachContext::AttachDetachContext):
     46        (WebCore::Node::AttachDetachContext::~AttachDetachContext):
     47        (WebCore::Node::attach):
     48        (WebCore::Node::detach):
     49        * dom/Node.h:
     50        (WebCore::Node::reattach):
     51        (WebCore::Node::reattachIfAttached):
     52        * dom/NodeRenderingContext.cpp:
     53        (WebCore::NodeRenderingContext::NodeRenderingContext):
     54        * dom/PseudoElement.cpp:
     55        (WebCore::PseudoElement::attach):
     56        * dom/PseudoElement.h:
     57        * dom/ShadowRoot.cpp:
     58        (WebCore::ShadowRoot::attach):
     59        * dom/ShadowRoot.h:
     60        * dom/Text.cpp:
     61        (WebCore::Text::attach):
     62        * dom/Text.h:
     63        * html/HTMLCanvasElement.cpp:
     64        (WebCore::HTMLCanvasElement::attach):
     65        * html/HTMLCanvasElement.h:
     66        * html/HTMLFormControlElement.cpp:
     67        (WebCore::HTMLFormControlElement::attach):
     68        * html/HTMLFormControlElement.h:
     69        * html/HTMLFrameElement.cpp:
     70        (WebCore::HTMLFrameElement::attach):
     71        * html/HTMLFrameElement.h:
     72        * html/HTMLFrameElementBase.cpp:
     73        (WebCore::HTMLFrameElementBase::attach):
     74        * html/HTMLFrameElementBase.h:
     75        * html/HTMLFrameSetElement.cpp:
     76        (WebCore::HTMLFrameSetElement::attach):
     77        * html/HTMLFrameSetElement.h:
     78        * html/HTMLImageElement.cpp:
     79        (WebCore::HTMLImageElement::attach):
     80        * html/HTMLImageElement.h:
     81        * html/HTMLInputElement.cpp:
     82        (WebCore::HTMLInputElement::attach):
     83        (WebCore::HTMLInputElement::detach):
     84        * html/HTMLInputElement.h:
     85        * html/HTMLLIElement.cpp:
     86        (WebCore::HTMLLIElement::attach):
     87        * html/HTMLLIElement.h:
     88        * html/HTMLMediaElement.cpp:
     89        (WebCore::HTMLMediaElement::attach):
     90        * html/HTMLMediaElement.h:
     91        * html/HTMLOptGroupElement.cpp:
     92        (WebCore::HTMLOptGroupElement::attach):
     93        (WebCore::HTMLOptGroupElement::detach):
     94        * html/HTMLOptGroupElement.h:
     95        * html/HTMLOptionElement.cpp:
     96        (WebCore::HTMLOptionElement::attach):
     97        (WebCore::HTMLOptionElement::detach):
     98        * html/HTMLOptionElement.h:
     99        * html/HTMLPlugInElement.cpp:
     100        (WebCore::HTMLPlugInElement::detach):
     101        * html/HTMLPlugInElement.h:
     102        * html/HTMLPlugInImageElement.cpp:
     103        (WebCore::HTMLPlugInImageElement::attach):
     104        (WebCore::HTMLPlugInImageElement::detach):
     105        * html/HTMLPlugInImageElement.h:
     106        * html/HTMLProgressElement.cpp:
     107        (WebCore::HTMLProgressElement::attach):
     108        * html/HTMLProgressElement.h:
     109        * html/HTMLTextAreaElement.cpp:
     110        (WebCore::HTMLTextAreaElement::attach):
     111        * html/HTMLTextAreaElement.h:
     112        * html/HTMLVideoElement.cpp:
     113        (WebCore::HTMLVideoElement::attach):
     114        * html/HTMLVideoElement.h:
     115        * html/PluginDocument.cpp:
     116        (WebCore::PluginDocument::detach):
     117        * html/PluginDocument.h:
     118        * html/shadow/InsertionPoint.cpp:
     119        (WebCore::InsertionPoint::attach):
     120        (WebCore::InsertionPoint::detach):
     121        * html/shadow/InsertionPoint.h:
     122        * html/shadow/SliderThumbElement.cpp:
     123        (WebCore::SliderThumbElement::detach):
     124        * html/shadow/SliderThumbElement.h:
     125        * html/shadow/SpinButtonElement.cpp:
     126        (WebCore::SpinButtonElement::detach):
     127        * html/shadow/SpinButtonElement.h:
     128        * html/shadow/TextControlInnerElements.cpp:
     129        (WebCore::SearchFieldCancelButtonElement::detach):
     130        (WebCore::InputFieldSpeechButtonElement::attach):
     131        (WebCore::InputFieldSpeechButtonElement::detach):
     132        * html/shadow/TextControlInnerElements.h:
     133        * loader/PlaceholderDocument.cpp:
     134        (WebCore::PlaceholderDocument::attach):
     135        * loader/PlaceholderDocument.h:
     136        * svg/SVGImageElement.cpp:
     137        (WebCore::SVGImageElement::attach):
     138        * svg/SVGImageElement.h:
     139
    11402013-06-06  Allan Sandfeld Jensen  <allan.jensen@digia.com>
    2141
  • trunk/Source/WebCore/dom/ContainerNode.cpp

    r150715 r151282  
    788788}
    789789
    790 void ContainerNode::attach()
     790void ContainerNode::attach(const AttachContext& context)
    791791{
    792792    attachChildren();
    793     Node::attach();
    794 }
    795 
    796 void ContainerNode::detach()
     793    Node::attach(context);
     794}
     795
     796void ContainerNode::detach(const AttachContext& context)
    797797{
    798798    detachChildren();
    799799    clearChildNeedsStyleRecalc();
    800     Node::detach();
     800    Node::detach(context);
    801801}
    802802
  • trunk/Source/WebCore/dom/ContainerNode.h

    r150715 r151282  
    107107    void cloneChildNodes(ContainerNode* clone);
    108108
    109     virtual void attach() OVERRIDE;
    110     virtual void detach() OVERRIDE;
     109    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
     110    virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
    111111    virtual LayoutRect boundingBox() const OVERRIDE;
    112112    virtual void scheduleSetNeedsStyleRecalc(StyleChangeType = FullStyleChange) OVERRIDE FINAL;
  • trunk/Source/WebCore/dom/Document.cpp

    r150957 r151282  
    20392039}
    20402040
    2041 void Document::attach()
     2041void Document::attach(const AttachContext& context)
    20422042{
    20432043    ASSERT(!attached());
     
    20592059    setRenderer(0);
    20602060
    2061     ContainerNode::attach();
     2061    ContainerNode::attach(context);
    20622062
    20632063    setRenderer(render);
    20642064}
    20652065
    2066 void Document::detach()
     2066void Document::detach(const AttachContext& context)
    20672067{
    20682068    ASSERT(attached());
     
    21152115    m_activeElement = 0;
    21162116
    2117     ContainerNode::detach();
     2117    ContainerNode::detach(context);
    21182118
    21192119    unscheduleStyleRecalc();
     
    58935893
    58945894    if (oldHoverObj != newHoverObj) {
     5895        // If the old hovered element is not nil but it's renderer is, it was probably detached as part of the :hover style
     5896        // (for instance by setting display:none in the :hover pseudo-class). In this case, the old hovered element
     5897        // must be updated, to ensure it's normal style is re-applied.
     5898        if (oldHoveredElement && !oldHoverObj) {
     5899            if (!mustBeInActiveChain || (oldHoveredElement->isElementNode() && oldHoveredElement->inActiveChain()))
     5900                nodesToRemoveFromChain.append(oldHoveredElement);
     5901        }
     5902
    58955903        // The old hover path only needs to be cleared up to (and not including) the common ancestor;
    58965904        for (RenderObject* curr = oldHoverObj; curr && curr != ancestor; curr = curr->hoverAncestor()) {
  • trunk/Source/WebCore/dom/Document.h

    r150873 r151282  
    533533    CachedResourceLoader* cachedResourceLoader() { return m_cachedResourceLoader.get(); }
    534534
    535     virtual void attach();
    536     virtual void detach();
     535    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
     536    virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
    537537    void prepareForDestruction();
    538538
  • trunk/Source/WebCore/dom/Element.cpp

    r151072 r151282  
    550550        document->userActionElements().setHovered(this, flag);
    551551
    552     if (!renderer())
    553         return;
     552    if (!renderer()) {
     553        // When setting hover to false, the style needs to be recalc'd even when
     554        // there's no renderer (imagine setting display:none in the :hover class,
     555        // if a nil renderer would prevent this element from recalculating its
     556        // style, it would never go back to its normal style and remain
     557        // stuck in its hovered style).
     558        if (!flag)
     559            setNeedsStyleRecalc();
     560
     561        return;
     562    }
    554563
    555564    if (renderer()->style()->affectedByHover() || childrenAffectedByHover())
     
    14061415}
    14071416
    1408 void Element::createRendererIfNeeded()
    1409 {
    1410     NodeRenderingContext(this).createRendererForElementIfNeeded();
    1411 }
    1412 
    1413 void Element::attach()
     1417void Element::createRendererIfNeeded(const AttachContext& context)
     1418{
     1419    NodeRenderingContext(this, context).createRendererForElementIfNeeded();
     1420}
     1421
     1422void Element::attach(const AttachContext& context)
    14141423{
    14151424    PostAttachCallbackDisabler callbackDisabler(this);
     
    14171426    WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
    14181427
    1419     createRendererIfNeeded();
     1428    createRendererIfNeeded(context);
    14201429
    14211430    if (parentElement() && parentElement()->isInCanvasSubtree())
     
    14311440        parentPusher.push();
    14321441
    1433     ContainerNode::attach();
     1442    ContainerNode::attach(context);
    14341443
    14351444    updatePseudoElement(AFTER);
     
    14511460}
    14521461
    1453 void Element::detach()
     1462void Element::detach(const AttachContext& context)
    14541463{
    14551464    WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
     
    14701479    }
    14711480
    1472     if (isUserActionElement()) {
    1473         if (hovered())
    1474             document()->hoveredElementDidDetach(this);
    1475         if (inActiveChain())
    1476             document()->elementInActiveChainDidDetach(this);
    1477         document()->userActionElements().didDetach(this);
    1478     }
    1479 
    1480     ContainerNode::detach();
     1481    // Do not remove the element's hovered and active status
     1482    // if performing a reattach.
     1483    if (!context.performingReattach) {
     1484        if (isUserActionElement()) {
     1485            if (hovered())
     1486                document()->hoveredElementDidDetach(this);
     1487            if (inActiveChain())
     1488                document()->elementInActiveChainDidDetach(this);
     1489            document()->userActionElements().didDetach(this);
     1490        }
     1491    }
     1492
     1493    ContainerNode::detach(context);
    14811494}
    14821495
     
    15541567        }
    15551568        if (localChange == Detach) {
    1556             // FIXME: The style gets computed twice by calling attach. We could do better if we passed the style along.
    1557             reattach();
     1569            AttachContext reattachContext;
     1570            reattachContext.resolvedStyle = newStyle.get();
     1571            reattach(reattachContext);
     1572
    15581573            // attach recalculates the style for all children. No need to do it twice.
    15591574            clearNeedsStyleRecalc();
  • trunk/Source/WebCore/dom/Element.h

    r151071 r151282  
    410410    virtual void copyNonAttributePropertiesFromElement(const Element&) { }
    411411
    412     virtual void attach();
    413     virtual void detach();
     412    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
     413    virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
    414414    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
    415415    virtual bool rendererIsNeeded(const NodeRenderingContext&);
     
    757757    void detachAttrNodeFromElementWithValue(Attr*, const AtomicString& value);
    758758
    759     void createRendererIfNeeded();
     759    void createRendererIfNeeded(const AttachContext&);
    760760
    761761    bool isJavaScriptURLAttribute(const Attribute&) const;
  • trunk/Source/WebCore/dom/Node.cpp

    r150879 r151282  
    974974}
    975975
    976 void Node::attach()
     976void Node::attach(const AttachContext&)
    977977{
    978978    ASSERT(!attached());
     
    10171017#endif
    10181018
    1019 void Node::detach()
     1019void Node::detach(const AttachContext&)
    10201020{
    10211021#ifndef NDEBUG
  • trunk/Source/WebCore/dom/Node.h

    r151071 r151282  
    476476    RenderBoxModelObject* renderBoxModelObject() const;
    477477
     478    struct AttachContext {
     479        RenderStyle* resolvedStyle;
     480        bool performingReattach;
     481
     482        AttachContext() : resolvedStyle(0), performingReattach(false) { }
     483    };
     484
    478485    // Attaches this node to the rendering tree. This calculates the style to be applied to the node and creates an
    479486    // appropriate RenderObject which will be inserted into the tree (except when the style has display: none). This
    480487    // makes the node visible in the FrameView.
    481     virtual void attach();
     488    virtual void attach(const AttachContext& = AttachContext());
    482489
    483490    // Detaches the node from the rendering tree, making it invisible in the rendered view. This method will remove
    484491    // the node's rendering object from the rendering tree and delete it.
    485     virtual void detach();
     492    virtual void detach(const AttachContext& = AttachContext());
    486493
    487494#ifndef NDEBUG
     
    489496#endif
    490497
    491     void reattach();
    492     void reattachIfAttached();
     498    void reattach(const AttachContext& = AttachContext());
     499    void reattachIfAttached(const AttachContext& = AttachContext());
    493500    ContainerNode* parentNodeForRenderingAndStyle();
    494501   
     
    808815}
    809816
    810 inline void Node::reattach()
     817inline void Node::reattach(const AttachContext& context)
     818{
     819    AttachContext reattachContext(context);
     820    reattachContext.performingReattach = true;
     821
     822    if (attached())
     823        detach(reattachContext);
     824    attach(reattachContext);
     825}
     826
     827inline void Node::reattachIfAttached(const AttachContext& context)
    811828{
    812829    if (attached())
    813         detach();
    814     attach();
    815 }
    816 
    817 inline void Node::reattachIfAttached()
    818 {
    819     if (attached())
    820         reattach();
     830        reattach(context);
    821831}
    822832
  • trunk/Source/WebCore/dom/NodeRenderingContext.cpp

    r149525 r151282  
    6969}
    7070
     71NodeRenderingContext::NodeRenderingContext(Node* node, const Node::AttachContext& context)
     72    : m_node(node)
     73    , m_style(context.resolvedStyle)
     74    , m_parentFlowRenderer(0)
     75{
     76    m_renderingParent = NodeRenderingTraversal::parent(node, &m_parentDetails);
     77}
     78
    7179NodeRenderingContext::~NodeRenderingContext()
    7280{
  • trunk/Source/WebCore/dom/NodeRenderingContext.h

    r148865 r151282  
    4848    explicit NodeRenderingContext(Node*);
    4949    NodeRenderingContext(Node*, RenderStyle*);
     50    NodeRenderingContext(Node*, const Node::AttachContext&);
    5051    ~NodeRenderingContext();
    5152
  • trunk/Source/WebCore/dom/PseudoElement.cpp

    r145312 r151282  
    7777}
    7878
    79 void PseudoElement::attach()
     79void PseudoElement::attach(const AttachContext& context)
    8080{
    8181    ASSERT(!renderer());
    8282
    83     Element::attach();
     83    Element::attach(context);
    8484
    8585    RenderObject* renderer = this->renderer();
  • trunk/Source/WebCore/dom/PseudoElement.h

    r149960 r151282  
    4444
    4545    virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE;
    46     virtual void attach() OVERRIDE;
     46    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
    4747    virtual bool rendererIsNeeded(const NodeRenderingContext&) OVERRIDE;
    4848
  • trunk/Source/WebCore/dom/ShadowRoot.cpp

    r150480 r151282  
    166166}
    167167
    168 void ShadowRoot::attach()
     168void ShadowRoot::attach(const AttachContext& context)
    169169{
    170170    StyleResolver* styleResolver = document()->ensureStyleResolver();
    171171    styleResolver->pushParentShadowRoot(this);
    172     DocumentFragment::attach();
     172    DocumentFragment::attach(context);
    173173    styleResolver->popParentShadowRoot(this);
    174174}
  • trunk/Source/WebCore/dom/ShadowRoot.h

    r150733 r151282  
    7272    Element* activeElement() const;
    7373
    74     virtual void attach();
     74    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
    7575
    7676    virtual void registerScopedHTMLStyleChild() OVERRIDE;
  • trunk/Source/WebCore/dom/Text.cpp

    r151236 r151282  
    278278}
    279279
    280 void Text::attach()
     280void Text::attach(const AttachContext& context)
    281281{
    282282    createTextRendererIfNeeded();
    283     CharacterData::attach();
     283    CharacterData::attach(context);
    284284}
    285285
  • trunk/Source/WebCore/dom/Text.h

    r149960 r151282  
    5151    void updateTextRenderer(unsigned offsetOfReplacedData, unsigned lengthOfReplacedData);
    5252
    53     virtual void attach() OVERRIDE FINAL;
     53    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE FINAL;
    5454   
    5555    virtual bool canContainRangeEndPoint() const OVERRIDE FINAL { return true; }
  • trunk/Source/WebCore/html/HTMLCanvasElement.cpp

    r151259 r151282  
    122122}
    123123
    124 void HTMLCanvasElement::attach()
     124void HTMLCanvasElement::attach(const AttachContext& context)
    125125{
    126126    setIsInCanvasSubtree(true);
    127     HTMLElement::attach();
     127    HTMLElement::attach(context);
    128128}
    129129
  • trunk/Source/WebCore/html/HTMLCanvasElement.h

    r149960 r151282  
    145145    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    146146    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
    147     virtual void attach();
     147    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
    148148    virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; }
    149149
  • trunk/Source/WebCore/html/HTMLFormControlElement.cpp

    r150805 r151282  
    209209}
    210210
    211 void HTMLFormControlElement::attach()
     211void HTMLFormControlElement::attach(const AttachContext& context)
    212212{
    213213    PostAttachCallbackDisabler disabler(this);
    214214
    215     HTMLElement::attach();
     215    HTMLElement::attach(context);
    216216
    217217    // The call to updateFromElement() needs to go after the call through
  • trunk/Source/WebCore/html/HTMLFormControlElement.h

    r150805 r151282  
    112112    virtual void requiredAttributeChanged();
    113113    virtual void disabledAttributeChanged();
    114     virtual void attach();
     114    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
    115115    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
    116116    virtual void removedFrom(ContainerNode*) OVERRIDE;
  • trunk/Source/WebCore/html/HTMLFrameElement.cpp

    r135069 r151282  
    7373}
    7474
    75 void HTMLFrameElement::attach()
     75void HTMLFrameElement::attach(const AttachContext& context)
    7676{
    77     HTMLFrameElementBase::attach();
     77    HTMLFrameElementBase::attach(context);
    7878   
    7979    if (HTMLFrameSetElement* frameSetElement = containingFrameSetElement(this)) {
  • trunk/Source/WebCore/html/HTMLFrameElement.h

    r149960 r151282  
    4040    HTMLFrameElement(const QualifiedName&, Document*);
    4141
    42     virtual void attach();
     42    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
    4343
    4444    virtual bool rendererIsNeeded(const NodeRenderingContext&);
  • trunk/Source/WebCore/html/HTMLFrameElementBase.cpp

    r147281 r151282  
    173173}
    174174
    175 void HTMLFrameElementBase::attach()
    176 {
    177     HTMLFrameOwnerElement::attach();
     175void HTMLFrameElementBase::attach(const AttachContext& context)
     176{
     177    HTMLFrameOwnerElement::attach(context);
    178178
    179179    if (RenderPart* part = renderPart()) {
  • trunk/Source/WebCore/html/HTMLFrameElementBase.h

    r150710 r151282  
    5353    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
    5454    virtual void didNotifySubtreeInsertions(ContainerNode*) OVERRIDE;
    55     virtual void attach();
     55    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
    5656
    5757private:
  • trunk/Source/WebCore/html/HTMLFrameSetElement.cpp

    r144568 r151282  
    166166}
    167167
    168 void HTMLFrameSetElement::attach()
     168void HTMLFrameSetElement::attach(const AttachContext& context)
    169169{
    170170    // Inherit default settings from parent frameset
     
    187187    }
    188188
    189     HTMLElement::attach();
     189    HTMLElement::attach(context);
    190190}
    191191
  • trunk/Source/WebCore/html/HTMLFrameSetElement.h

    r149960 r151282  
    7272    virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStylePropertySet*) OVERRIDE;
    7373
    74     virtual void attach();
     74    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
    7575    virtual bool rendererIsNeeded(const NodeRenderingContext&);
    7676    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
  • trunk/Source/WebCore/html/HTMLImageElement.cpp

    r149881 r151282  
    173173}
    174174
    175 void HTMLImageElement::attach()
    176 {
    177     HTMLElement::attach();
     175void HTMLImageElement::attach(const AttachContext& context)
     176{
     177    HTMLElement::attach(context);
    178178
    179179    if (renderer() && renderer()->isImage() && !m_imageLoader.hasPendingBeforeLoadEvent()) {
  • trunk/Source/WebCore/html/HTMLImageElement.h

    r149652 r151282  
    8989    virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStylePropertySet*) OVERRIDE;
    9090
    91     virtual void attach();
     91    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
    9292    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
    9393
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r150876 r151282  
    800800}
    801801
    802 void HTMLInputElement::attach()
     802void HTMLInputElement::attach(const AttachContext& context)
    803803{
    804804    PostAttachCallbackDisabler disabler(this);
     
    807807        updateType();
    808808
    809     HTMLTextFormControlElement::attach();
     809    HTMLTextFormControlElement::attach(context);
    810810
    811811    m_inputType->attach();
     
    815815}
    816816
    817 void HTMLInputElement::detach()
    818 {
    819     HTMLTextFormControlElement::detach();
     817void HTMLInputElement::detach(const AttachContext& context)
     818{
     819    HTMLTextFormControlElement::detach(context);
    820820    setFormControlValueMatchesRenderer(false);
    821821    m_inputType->detach();
  • trunk/Source/WebCore/html/HTMLInputElement.h

    r150876 r151282  
    189189    virtual bool rendererIsNeeded(const NodeRenderingContext&);
    190190    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
    191     virtual void detach();
     191    virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
    192192
    193193    // FIXME: For isActivatedSubmit and setActivatedSubmit, we should use the NVI-idiom here by making
     
    352352    virtual void copyNonAttributePropertiesFromElement(const Element&);
    353353
    354     virtual void attach();
     354    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
    355355
    356356    virtual bool appendFormData(FormDataList&, bool);
  • trunk/Source/WebCore/html/HTMLLIElement.cpp

    r148863 r151282  
    8686}
    8787
    88 void HTMLLIElement::attach()
     88void HTMLLIElement::attach(const AttachContext& context)
    8989{
    9090    ASSERT(!attached());
    9191
    92     HTMLElement::attach();
     92    HTMLElement::attach(context);
    9393
    9494    if (renderer() && renderer()->isListItem()) {
  • trunk/Source/WebCore/html/HTMLLIElement.h

    r149960 r151282  
    4040    virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStylePropertySet*) OVERRIDE;
    4141
    42     virtual void attach();
     42    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
    4343
    4444    void parseValue(const AtomicString&);
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r150971 r151282  
    617617}
    618618
    619 void HTMLMediaElement::attach()
     619void HTMLMediaElement::attach(const AttachContext& context)
    620620{
    621621    ASSERT(!attached());
     
    625625#endif
    626626
    627     HTMLElement::attach();
     627    HTMLElement::attach(context);
    628628
    629629    if (renderer())
  • trunk/Source/WebCore/html/HTMLMediaElement.h

    r150971 r151282  
    389389    virtual void finishParsingChildren();
    390390    virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
    391     virtual void attach() OVERRIDE;
     391    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
    392392
    393393    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
  • trunk/Source/WebCore/html/HTMLOptGroupElement.cpp

    r149392 r151282  
    9797}
    9898
    99 void HTMLOptGroupElement::attach()
     99void HTMLOptGroupElement::attach(const AttachContext& context)
    100100{
    101     HTMLElement::attach();
     101    HTMLElement::attach(context);
    102102    // If after attaching nothing called styleForRenderer() on this node we
    103103    // manually cache the value. This happens if our parent doesn't have a
     
    107107}
    108108
    109 void HTMLOptGroupElement::detach()
     109void HTMLOptGroupElement::detach(const AttachContext& context)
    110110{
    111111    m_style.clear();
    112     HTMLElement::detach();
     112    HTMLElement::detach(context);
    113113}
    114114
  • trunk/Source/WebCore/html/HTMLOptGroupElement.h

    r150710 r151282  
    4848    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    4949    virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; }
    50     virtual void attach();
    51     virtual void detach();
     50    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
     51    virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
    5252
    5353    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
  • trunk/Source/WebCore/html/HTMLOptionElement.cpp

    r149392 r151282  
    9191}
    9292
    93 void HTMLOptionElement::attach()
    94 {
    95     HTMLElement::attach();
     93void HTMLOptionElement::attach(const AttachContext& context)
     94{
     95    HTMLElement::attach(context);
    9696    // If after attaching nothing called styleForRenderer() on this node we
    9797    // manually cache the value. This happens if our parent doesn't have a
     
    101101}
    102102
    103 void HTMLOptionElement::detach()
     103void HTMLOptionElement::detach(const AttachContext& context)
    104104{
    105105    m_style.clear();
    106     HTMLElement::detach();
     106    HTMLElement::detach(context);
    107107}
    108108
  • trunk/Source/WebCore/html/HTMLOptionElement.h

    r150710 r151282  
    7373    virtual bool isFocusable() const OVERRIDE;
    7474    virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; }
    75     virtual void attach();
    76     virtual void detach();
     75    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
     76    virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
    7777
    7878    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
  • trunk/Source/WebCore/html/HTMLPlugInElement.cpp

    r149980 r151282  
    9494}
    9595
    96 void HTMLPlugInElement::detach()
     96void HTMLPlugInElement::detach(const AttachContext& context)
    9797{
    9898    m_instance.clear();
     
    111111#endif
    112112
    113     HTMLFrameOwnerElement::detach();
     113    HTMLFrameOwnerElement::detach(context);
    114114}
    115115
  • trunk/Source/WebCore/html/HTMLPlugInElement.h

    r150687 r151282  
    8484    HTMLPlugInElement(const QualifiedName& tagName, Document*);
    8585
    86     virtual void detach();
     86    virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
    8787    virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
    8888    virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStylePropertySet*) OVERRIDE;
  • trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp

    r150731 r151282  
    235235}
    236236
    237 void HTMLPlugInImageElement::attach()
     237void HTMLPlugInImageElement::attach(const AttachContext& context)
    238238{
    239239    PostAttachCallbackDisabler disabler(this);
     
    244244        queuePostAttachCallback(&HTMLPlugInImageElement::updateWidgetCallback, this);
    245245
    246     HTMLPlugInElement::attach();
     246    HTMLPlugInElement::attach(context);
    247247
    248248    if (isImage && renderer() && !useFallbackContent()) {
     
    253253}
    254254
    255 void HTMLPlugInImageElement::detach()
     255void HTMLPlugInImageElement::detach(const AttachContext& context)
    256256{
    257257    // FIXME: Because of the insanity that is HTMLPlugInImageElement::recalcStyle,
     
    261261        // Update the widget the next time we attach (detaching destroys the plugin).
    262262        setNeedsWidgetUpdate(true);
    263     HTMLPlugInElement::detach();
     263    HTMLPlugInElement::detach(context);
    264264}
    265265
  • trunk/Source/WebCore/html/HTMLPlugInImageElement.h

    r150731 r151282  
    111111
    112112    static void updateWidgetCallback(Node*, unsigned = 0);
    113     virtual void attach();
    114     virtual void detach();
     113    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
     114    virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
    115115
    116116    bool allowedToLoadFrameURL(const String& url);
  • trunk/Source/WebCore/html/HTMLProgressElement.cpp

    r146860 r151282  
    9393}
    9494
    95 void HTMLProgressElement::attach()
     95void HTMLProgressElement::attach(const AttachContext& context)
    9696{
    97     LabelableElement::attach();
     97    LabelableElement::attach(context);
    9898    if (RenderProgress* render = renderProgress())
    9999        render->updateFromElement();
  • trunk/Source/WebCore/html/HTMLProgressElement.h

    r149960 r151282  
    6161    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    6262
    63     virtual void attach();
     63    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
    6464
    6565    void didElementStateChange();
  • trunk/Source/WebCore/html/HTMLTextAreaElement.cpp

    r150796 r151282  
    525525}
    526526
    527 void HTMLTextAreaElement::attach()
    528 {
    529     HTMLTextFormControlElement::attach();
     527void HTMLTextAreaElement::attach(const AttachContext& context)
     528{
     529    HTMLTextFormControlElement::attach(context);
    530530    fixPlaceholderRenderer(m_placeholder, innerTextElement());
    531531}
  • trunk/Source/WebCore/html/HTMLTextAreaElement.h

    r150692 r151282  
    112112
    113113    virtual bool shouldUseInputMethod();
    114     virtual void attach() OVERRIDE;
     114    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
    115115    virtual bool matchesReadOnlyPseudoClass() const OVERRIDE;
    116116    virtual bool matchesReadWritePseudoClass() const OVERRIDE;
  • trunk/Source/WebCore/html/HTMLVideoElement.cpp

    r150214 r151282  
    7575#endif
    7676
    77 void HTMLVideoElement::attach()
    78 {
    79     HTMLMediaElement::attach();
     77void HTMLVideoElement::attach(const AttachContext& context)
     78{
     79    HTMLMediaElement::attach(context);
    8080
    8181#if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)
  • trunk/Source/WebCore/html/HTMLVideoElement.h

    r149960 r151282  
    7979    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
    8080#endif
    81     virtual void attach();
     81    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
    8282    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    8383    virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
  • trunk/Source/WebCore/html/PluginDocument.cpp

    r150700 r151282  
    162162}
    163163
    164 void PluginDocument::detach()
     164void PluginDocument::detach(const AttachContext& context)
    165165{
    166166    // Release the plugin Element so that we don't have a circular reference.
     
    168168    if (FrameLoader* loader = frame()->loader())
    169169        loader->client()->redirectDataToPlugin(0);
    170     HTMLDocument::detach();
     170    HTMLDocument::detach(context);
    171171}
    172172
  • trunk/Source/WebCore/html/PluginDocument.h

    r150700 r151282  
    4545    HTMLPlugInElement* pluginElement() { return m_pluginElement.get(); }
    4646
    47     virtual void detach() OVERRIDE;
     47    virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
    4848
    4949    void cancelManualPluginLoad();
  • trunk/Source/WebCore/html/shadow/InsertionPoint.cpp

    r150483 r151282  
    5252}
    5353
    54 void InsertionPoint::attach()
     54void InsertionPoint::attach(const AttachContext& context)
    5555{
    5656    if (ShadowRoot* shadowRoot = containingShadowRoot())
     
    5858    for (Node* current = firstDistributed(); current; current = nextDistributedTo(current)) {
    5959        if (!current->attached())
    60             current->attach();
    61     }
    62 
    63     HTMLElement::attach();
    64 }
    65 
    66 void InsertionPoint::detach()
     60            current->attach(context);
     61    }
     62
     63    HTMLElement::attach(context);
     64}
     65
     66void InsertionPoint::detach(const AttachContext& context)
    6767{
    6868    if (ShadowRoot* shadowRoot = containingShadowRoot())
     
    7070
    7171    for (Node* current = firstDistributed(); current; current = nextDistributedTo(current))
    72         current->detach();
    73 
    74     HTMLElement::detach();
     72        current->detach(context);
     73
     74    HTMLElement::detach(context);
    7575}
    7676
  • trunk/Source/WebCore/html/shadow/InsertionPoint.h

    r150483 r151282  
    6767    void setResetStyleInheritance(bool);
    6868
    69     virtual void attach();
    70     virtual void detach();
     69    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
     70    virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
    7171
    7272    bool shouldUseFallbackElements() const;
  • trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp

    r150697 r151282  
    388388}
    389389
    390 void SliderThumbElement::detach()
     390void SliderThumbElement::detach(const AttachContext& context)
    391391{
    392392    if (m_inDragMode) {
     
    394394            frame->eventHandler()->setCapturingMouseEventsNode(0);
    395395    }
    396     HTMLDivElement::detach();
     396    HTMLDivElement::detach(context);
    397397}
    398398
  • trunk/Source/WebCore/html/shadow/SliderThumbElement.h

    r150697 r151282  
    5757    virtual bool willRespondToMouseMoveEvents() OVERRIDE;
    5858    virtual bool willRespondToMouseClickEvents() OVERRIDE;
    59     virtual void detach();
     59    virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
    6060    virtual const AtomicString& shadowPseudoId() const;
    6161    HTMLInputElement* hostInput() const;
  • trunk/Source/WebCore/html/shadow/SpinButtonElement.cpp

    r150214 r151282  
    6464}
    6565
    66 void SpinButtonElement::detach()
     66void SpinButtonElement::detach(const AttachContext& context)
    6767{
    6868    releaseCapture();
    69     HTMLDivElement::detach();
     69    HTMLDivElement::detach(context);
    7070}
    7171
  • trunk/Source/WebCore/html/shadow/SpinButtonElement.h

    r150684 r151282  
    7171
    7272    virtual const AtomicString& shadowPseudoId() const;
    73     virtual void detach();
     73    virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
    7474    virtual bool isSpinButtonElement() const { return true; }
    7575    virtual bool isDisabledFormControl() const OVERRIDE { return shadowHost() && shadowHost()->isDisabledFormControl(); }
  • trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp

    r146977 r151282  
    200200}
    201201
    202 void SearchFieldCancelButtonElement::detach()
     202void SearchFieldCancelButtonElement::detach(const AttachContext& context)
    203203{
    204204    if (m_capturing) {
     
    206206            frame->eventHandler()->setCapturingMouseEventsNode(0);
    207207    }
    208     HTMLDivElement::detach();
     208    HTMLDivElement::detach(context);
    209209}
    210210
     
    409409}
    410410
    411 void InputFieldSpeechButtonElement::attach()
     411void InputFieldSpeechButtonElement::attach(const AttachContext& context)
    412412{
    413413    ASSERT(!m_listenerId);
    414414    if (SpeechInput* input = SpeechInput::from(document()->page()))
    415415        m_listenerId = input->registerListener(this);
    416     HTMLDivElement::attach();
    417 }
    418 
    419 void InputFieldSpeechButtonElement::detach()
     416    HTMLDivElement::attach(context);
     417}
     418
     419void InputFieldSpeechButtonElement::detach(const AttachContext& context)
    420420{
    421421    if (m_capturing) {
     
    431431    }
    432432
    433     HTMLDivElement::detach();
     433    HTMLDivElement::detach(context);
    434434}
    435435
  • trunk/Source/WebCore/html/shadow/TextControlInnerElements.h

    r150692 r151282  
    9292    SearchFieldCancelButtonElement(Document*);
    9393    virtual const AtomicString& shadowPseudoId() const;
    94     virtual void detach();
     94    virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
    9595    virtual bool isMouseFocusable() const OVERRIDE { return false; }
    9696
     
    132132    virtual const AtomicString& shadowPseudoId() const;
    133133    virtual bool isMouseFocusable() const OVERRIDE { return false; }
    134     virtual void attach();
     134    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
    135135
    136136    bool m_capturing;
  • trunk/Source/WebCore/loader/PlaceholderDocument.cpp

    r95901 r151282  
    2929namespace WebCore {
    3030
    31 void PlaceholderDocument::attach()
     31void PlaceholderDocument::attach(const AttachContext& context)
    3232{
    3333    ASSERT(!attached());
    3434
    3535    // Skipping Document::attach().
    36     ContainerNode::attach();
     36    ContainerNode::attach(context);
    3737}
    3838
  • trunk/Source/WebCore/loader/PlaceholderDocument.h

    r149705 r151282  
    3838    }
    3939
    40     virtual void attach();
     40    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
    4141
    4242private:
  • trunk/Source/WebCore/page/DragController.cpp

    r150354 r151282  
    851851        doSystemDrag(dragImage, dragLoc, mouseDraggedPoint, clipboard, src, true);
    852852    } else if (state.type == DragSourceActionDHTML) {
    853         ASSERT(m_dragSourceAction & DragSourceActionDHTML);
    854         m_client->willPerformDragSourceAction(DragSourceActionDHTML, dragOrigin, clipboard);
    855         doSystemDrag(dragImage, dragLoc, dragOrigin, clipboard, src, false);
     853        if (dragImage) {
     854            ASSERT(m_dragSourceAction & DragSourceActionDHTML);
     855            m_client->willPerformDragSourceAction(DragSourceActionDHTML, dragOrigin, clipboard);
     856            doSystemDrag(dragImage, dragLoc, dragOrigin, clipboard, src, false);
     857        } else
     858            startedDrag = false;
    856859    } else {
    857860        // draggableElement() determined an image or link node was draggable, but it turns out the
  • trunk/Source/WebCore/svg/SVGImageElement.cpp

    r145750 r151282  
    200200}
    201201
    202 void SVGImageElement::attach()
    203 {
    204     SVGStyledTransformableElement::attach();
     202void SVGImageElement::attach(const AttachContext& context)
     203{
     204    SVGStyledTransformableElement::attach(context);
    205205
    206206    if (RenderSVGImage* imageObj = toRenderSVGImage(renderer())) {
  • trunk/Source/WebCore/svg/SVGImageElement.h

    r150710 r151282  
    5555    virtual void svgAttributeChanged(const QualifiedName&);
    5656
    57     virtual void attach();
     57    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
    5858    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
    5959
Note: See TracChangeset for help on using the changeset viewer.