Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Unified Diff: third_party/WebKit/Source/core/dom/ContainerNode.cpp

Issue 2790133002: Allow display:contents elements in hover chain. (Closed)
Patch Set: Fixed nits. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/ContainerNode.cpp
diff --git a/third_party/WebKit/Source/core/dom/ContainerNode.cpp b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
index f7a37d31d12bee5ea0153a4811cb1ddceb000ace..9adf7e7cbaa0e292cffd501ec7633fad0eb7f8ab 100644
--- a/third_party/WebKit/Source/core/dom/ContainerNode.cpp
+++ b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
@@ -1132,26 +1132,11 @@ void ContainerNode::setHovered(bool over) {
Node::setHovered(over);
- // If :hover sets display: none we lose our hover but still need to recalc our
- // style.
- if (!layoutObject()) {
- if (over)
- return;
- if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByHover())
- toElement(this)->pseudoStateChanged(CSSSelector::PseudoHover);
- else
- setNeedsStyleRecalc(
- LocalStyleChange,
- StyleChangeReasonForTracing::createWithExtraData(
- StyleChangeReason::PseudoClass, StyleChangeExtraData::Hover));
- return;
- }
-
- if (computedStyle()->affectedByHover()) {
- StyleChangeType changeType =
- computedStyle()->hasPseudoStyle(PseudoIdFirstLetter)
- ? SubtreeStyleChange
- : LocalStyleChange;
+ const ComputedStyle* style = computedStyle();
+ if (!style || style->affectedByHover()) {
+ StyleChangeType changeType = LocalStyleChange;
+ if (style && style->hasPseudoStyle(PseudoIdFirstLetter))
+ changeType = SubtreeStyleChange;
setNeedsStyleRecalc(
changeType,
StyleChangeReasonForTracing::createWithExtraData(
@@ -1160,7 +1145,10 @@ void ContainerNode::setHovered(bool over) {
if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByHover())
toElement(this)->pseudoStateChanged(CSSSelector::PseudoHover);
- LayoutTheme::theme().controlStateChanged(*layoutObject(), HoverControlState);
+ if (layoutObject()) {
+ LayoutTheme::theme().controlStateChanged(*layoutObject(),
+ HoverControlState);
+ }
}
HTMLCollection* ContainerNode::children() {
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css/hover-display-contents.html ('k') | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698