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

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

Issue 16599003: :hover style not applied on hover if its display property is different from original style's (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch Created 7 years, 6 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: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 16e663cf47c325a4dd86cdef9ede42a8bf2edc50..0d77ab9dbe1b26be914c5b883ce76c46f9d7fb4c 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -1258,18 +1258,18 @@ void Element::removedFrom(ContainerNode* insertionPoint)
document()->accessSVGExtensions()->removeElementFromPendingResources(this);
}
-void Element::createRendererIfNeeded()
+void Element::createRendererIfNeeded(const AttachContext& context)
{
- NodeRenderingContext(this).createRendererForElementIfNeeded();
+ NodeRenderingContext(this, context).createRendererForElementIfNeeded();
}
-void Element::attach()
+void Element::attach(const AttachContext& context)
{
PostAttachCallbackDisabler callbackDisabler(this);
StyleResolverParentPusher parentPusher(this);
WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
- createRendererIfNeeded();
+ createRendererIfNeeded(context);
if (parentElement() && parentElement()->isInCanvasSubtree())
setIsInCanvasSubtree(true);
@@ -1283,7 +1283,7 @@ void Element::attach()
} else if (firstChild())
parentPusher.push();
- ContainerNode::attach();
+ ContainerNode::attach(context);
createPseudoElementIfNeeded(AFTER);
@@ -1303,7 +1303,7 @@ void Element::unregisterNamedFlowContentNode()
document()->renderView()->flowThreadController()->unregisterNamedFlowContentNode(this);
}
-void Element::detach()
+void Element::detach(const AttachContext& context)
{
WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
unregisterNamedFlowContentNode();
@@ -1321,7 +1321,7 @@ void Element::detach()
detachChildrenIfNeeded();
shadow->detach();
}
- ContainerNode::detach();
+ ContainerNode::detach(context);
}
bool Element::pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderStyle* newStyle)
@@ -1405,8 +1405,10 @@ void Element::recalcStyle(StyleChange change, int childIndex)
localChange = Node::diff(currentStyle.get(), newStyle.get(), document());
}
if (localChange == Detach) {
- // FIXME: The style gets computed twice by calling attach. We could do better if we passed the style along.
- reattach();
+ AttachContext reattachContext;
+ reattachContext.resolvedStyle = newStyle.get();
+ reattach(reattachContext);
+
// attach recalculates the style for all children. No need to do it twice.
clearNeedsStyleRecalc();
clearChildNeedsStyleRecalc();

Powered by Google App Engine
This is Rietveld 408576698