:hover style not applied on hover if its display property is different from original...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Jun 2013 17:18:09 +0000 (17:18 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Jun 2013 17:18:09 +0000 (17:18 +0000)
commit83fb9b9a5c63436b39d0babedce795f82e3e48a0
tree3d8311a43fdf9181a008974bafd856baf7d71326
parent1ff9bbc275b415f500b2807a341d3da5c17e5bff
: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:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151282 268f45cc-cd09-0410-ab3c-d52691b4dbfc
71 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/events/drag-display-none-element-expected.txt
LayoutTests/fast/events/drag-display-none-element.html
LayoutTests/fast/regions/hover-display-block-inline-expected.txt [new file with mode: 0644]
LayoutTests/fast/regions/hover-display-block-inline.html [new file with mode: 0644]
LayoutTests/fast/regions/hover-display-block-none-expected.txt [new file with mode: 0644]
LayoutTests/fast/regions/hover-display-block-none.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/ContainerNode.cpp
Source/WebCore/dom/ContainerNode.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/Node.h
Source/WebCore/dom/NodeRenderingContext.cpp
Source/WebCore/dom/NodeRenderingContext.h
Source/WebCore/dom/PseudoElement.cpp
Source/WebCore/dom/PseudoElement.h
Source/WebCore/dom/ShadowRoot.cpp
Source/WebCore/dom/ShadowRoot.h
Source/WebCore/dom/Text.cpp
Source/WebCore/dom/Text.h
Source/WebCore/html/HTMLCanvasElement.cpp
Source/WebCore/html/HTMLCanvasElement.h
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormControlElement.h
Source/WebCore/html/HTMLFrameElement.cpp
Source/WebCore/html/HTMLFrameElement.h
Source/WebCore/html/HTMLFrameElementBase.cpp
Source/WebCore/html/HTMLFrameElementBase.h
Source/WebCore/html/HTMLFrameSetElement.cpp
Source/WebCore/html/HTMLFrameSetElement.h
Source/WebCore/html/HTMLImageElement.cpp
Source/WebCore/html/HTMLImageElement.h
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/HTMLLIElement.cpp
Source/WebCore/html/HTMLLIElement.h
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/HTMLOptGroupElement.cpp
Source/WebCore/html/HTMLOptGroupElement.h
Source/WebCore/html/HTMLOptionElement.cpp
Source/WebCore/html/HTMLOptionElement.h
Source/WebCore/html/HTMLPlugInElement.cpp
Source/WebCore/html/HTMLPlugInElement.h
Source/WebCore/html/HTMLPlugInImageElement.cpp
Source/WebCore/html/HTMLPlugInImageElement.h
Source/WebCore/html/HTMLProgressElement.cpp
Source/WebCore/html/HTMLProgressElement.h
Source/WebCore/html/HTMLTextAreaElement.cpp
Source/WebCore/html/HTMLTextAreaElement.h
Source/WebCore/html/HTMLVideoElement.cpp
Source/WebCore/html/HTMLVideoElement.h
Source/WebCore/html/PluginDocument.cpp
Source/WebCore/html/PluginDocument.h
Source/WebCore/html/shadow/InsertionPoint.cpp
Source/WebCore/html/shadow/InsertionPoint.h
Source/WebCore/html/shadow/SliderThumbElement.cpp
Source/WebCore/html/shadow/SliderThumbElement.h
Source/WebCore/html/shadow/SpinButtonElement.cpp
Source/WebCore/html/shadow/SpinButtonElement.h
Source/WebCore/html/shadow/TextControlInnerElements.cpp
Source/WebCore/html/shadow/TextControlInnerElements.h
Source/WebCore/loader/PlaceholderDocument.cpp
Source/WebCore/loader/PlaceholderDocument.h
Source/WebCore/page/DragController.cpp
Source/WebCore/svg/SVGImageElement.cpp
Source/WebCore/svg/SVGImageElement.h