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

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

Issue 148243004: Use LocalStyleChange for :hover/:active not affected by descendants. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased. Created 6 years, 10 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
« no previous file with comments | « Source/core/css/HoverUpdateTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ContainerNode.cpp
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp
index b3b98063d8af013cbb5537545bd0056c2dc67df2..8eaa551f86f3b8bc5927f213e7565c0bd297871f 100644
--- a/Source/core/dom/ContainerNode.cpp
+++ b/Source/core/dom/ContainerNode.cpp
@@ -835,8 +835,11 @@ void ContainerNode::setActive(bool down)
// FIXME: Why does this not need to handle the display: none transition like :hover does?
if (renderer()) {
- if (renderStyle()->affectedByActive() || (isElementNode() && toElement(this)->childrenAffectedByActive()))
+ if (isElementNode() && toElement(this)->childrenAffectedByActive())
setNeedsStyleRecalc(SubtreeStyleChange);
+ else if (renderStyle()->affectedByActive())
+ setNeedsStyleRecalc(LocalStyleChange);
+
if (renderStyle()->hasAppearance())
RenderTheme::theme().stateChanged(renderer(), PressedState);
}
@@ -851,17 +854,22 @@ void ContainerNode::setHovered(bool over)
// If :hover sets display: none we lose our hover but still need to recalc our style.
if (!renderer()) {
- if (!over)
+ if (over)
+ return;
+ if (isElementNode() && toElement(this)->childrenAffectedByHover())
setNeedsStyleRecalc(SubtreeStyleChange);
+ else
+ setNeedsStyleRecalc(LocalStyleChange);
return;
}
- if (renderer()) {
- if (renderStyle()->affectedByHover() || (isElementNode() && toElement(this)->childrenAffectedByHover()))
- setNeedsStyleRecalc(SubtreeStyleChange);
- if (renderer() && renderer()->style()->hasAppearance())
- RenderTheme::theme().stateChanged(renderer(), HoverState);
- }
+ if (isElementNode() && toElement(this)->childrenAffectedByHover())
+ setNeedsStyleRecalc(SubtreeStyleChange);
+ else if (renderStyle()->affectedByHover())
+ setNeedsStyleRecalc(LocalStyleChange);
+
+ if (renderer()->style()->hasAppearance())
+ RenderTheme::theme().stateChanged(renderer(), HoverState);
}
PassRefPtr<HTMLCollection> ContainerNode::children()
« no previous file with comments | « Source/core/css/HoverUpdateTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698