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

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

Issue 317733004: Update an Element's ancestor chain at the end of its activation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed assert Created 6 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
« no previous file with comments | « LayoutTests/fast/css/clear-activechain-list-shadow-dom-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 06358ba1a9ba74808740dfedc081e52c7cec81f6..9e10b0a7fcaa2176491cdd4db0681b3d421312a3 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -5421,13 +5421,12 @@ void Document::updateHoverActiveState(const HitTestRequest& request, Element* in
Element* oldActiveElement = activeHoverElement();
if (oldActiveElement && !request.active()) {
- // We are clearing the :active chain because the mouse has been released.
- for (RenderObject* curr = oldActiveElement->renderer(); curr; curr = curr->parent()) {
- if (curr->node()) {
- ASSERT(!curr->node()->isTextNode());
- curr->node()->setActive(false);
- m_userActionElements.setInActiveChain(curr->node(), false);
- }
+ // The oldActiveElement renderer is null, dropped on :active by setting display: none,
+ // for instance. We still need to clear the ActiveChain as the mouse is released.
+ for (Node* node = oldActiveElement; node; node = NodeRenderingTraversal::parent(node)) {
+ ASSERT(!node->isTextNode());
+ node->setActive(false);
+ m_userActionElements.setInActiveChain(node, false);
}
setActiveHoverElement(nullptr);
} else {
@@ -5435,11 +5434,10 @@ void Document::updateHoverActiveState(const HitTestRequest& request, Element* in
if (!oldActiveElement && newActiveElement && !newActiveElement->isDisabledFormControl() && request.active() && !request.touchMove()) {
// We are setting the :active chain and freezing it. If future moves happen, they
// will need to reference this chain.
- for (RenderObject* curr = newActiveElement->renderer(); curr; curr = curr->parent()) {
- if (curr->node() && !curr->isText())
- m_userActionElements.setInActiveChain(curr->node(), true);
+ for (Node* node = newActiveElement; node; node = NodeRenderingTraversal::parent(node)) {
+ ASSERT(!node->isTextNode());
+ m_userActionElements.setInActiveChain(node, true);
}
-
setActiveHoverElement(newActiveElement);
}
}
« no previous file with comments | « LayoutTests/fast/css/clear-activechain-list-shadow-dom-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698