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

Side by Side 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, 5 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 5403 matching lines...) Expand 10 before | Expand all | Expand 10 after
5414 m_frame->eventHandler().notifyElementActivated(); 5414 m_frame->eventHandler().notifyElementActivated();
5415 5415
5416 Element* innerElementInDocument = innerElement; 5416 Element* innerElementInDocument = innerElement;
5417 while (innerElementInDocument && innerElementInDocument->document() != this) { 5417 while (innerElementInDocument && innerElementInDocument->document() != this) {
5418 innerElementInDocument->document().updateHoverActiveState(request, inner ElementInDocument, event); 5418 innerElementInDocument->document().updateHoverActiveState(request, inner ElementInDocument, event);
5419 innerElementInDocument = innerElementInDocument->document().ownerElement (); 5419 innerElementInDocument = innerElementInDocument->document().ownerElement ();
5420 } 5420 }
5421 5421
5422 Element* oldActiveElement = activeHoverElement(); 5422 Element* oldActiveElement = activeHoverElement();
5423 if (oldActiveElement && !request.active()) { 5423 if (oldActiveElement && !request.active()) {
5424 // We are clearing the :active chain because the mouse has been released . 5424 // The oldActiveElement renderer is null, dropped on :active by setting display: none,
5425 for (RenderObject* curr = oldActiveElement->renderer(); curr; curr = cur r->parent()) { 5425 // for instance. We still need to clear the ActiveChain as the mouse is released.
5426 if (curr->node()) { 5426 for (Node* node = oldActiveElement; node; node = NodeRenderingTraversal: :parent(node)) {
5427 ASSERT(!curr->node()->isTextNode()); 5427 ASSERT(!node->isTextNode());
5428 curr->node()->setActive(false); 5428 node->setActive(false);
5429 m_userActionElements.setInActiveChain(curr->node(), false); 5429 m_userActionElements.setInActiveChain(node, false);
5430 }
5431 } 5430 }
5432 setActiveHoverElement(nullptr); 5431 setActiveHoverElement(nullptr);
5433 } else { 5432 } else {
5434 Element* newActiveElement = innerElementInDocument; 5433 Element* newActiveElement = innerElementInDocument;
5435 if (!oldActiveElement && newActiveElement && !newActiveElement->isDisabl edFormControl() && request.active() && !request.touchMove()) { 5434 if (!oldActiveElement && newActiveElement && !newActiveElement->isDisabl edFormControl() && request.active() && !request.touchMove()) {
5436 // We are setting the :active chain and freezing it. If future moves happen, they 5435 // We are setting the :active chain and freezing it. If future moves happen, they
5437 // will need to reference this chain. 5436 // will need to reference this chain.
5438 for (RenderObject* curr = newActiveElement->renderer(); curr; curr = curr->parent()) { 5437 for (Node* node = newActiveElement; node; node = NodeRenderingTraver sal::parent(node)) {
5439 if (curr->node() && !curr->isText()) 5438 ASSERT(!node->isTextNode());
5440 m_userActionElements.setInActiveChain(curr->node(), true); 5439 m_userActionElements.setInActiveChain(node, true);
5441 } 5440 }
5442
5443 setActiveHoverElement(newActiveElement); 5441 setActiveHoverElement(newActiveElement);
5444 } 5442 }
5445 } 5443 }
5446 // If the mouse has just been pressed, set :active on the chain. Those (and only those) 5444 // If the mouse has just been pressed, set :active on the chain. Those (and only those)
5447 // nodes should remain :active until the mouse is released. 5445 // nodes should remain :active until the mouse is released.
5448 bool allowActiveChanges = !oldActiveElement && activeHoverElement(); 5446 bool allowActiveChanges = !oldActiveElement && activeHoverElement();
5449 5447
5450 // If the mouse is down and if this is a mouse move event, we want to restri ct changes in 5448 // If the mouse is down and if this is a mouse move event, we want to restri ct changes in
5451 // :hover/:active to only apply to elements that are in the :active chain th at we froze 5449 // :hover/:active to only apply to elements that are in the :active chain th at we froze
5452 // at the time the mouse went down. 5450 // at the time the mouse went down.
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
5816 visitor->trace(m_compositorPendingAnimations); 5814 visitor->trace(m_compositorPendingAnimations);
5817 visitor->trace(m_contextDocument); 5815 visitor->trace(m_contextDocument);
5818 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); 5816 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this);
5819 DocumentSupplementable::trace(visitor); 5817 DocumentSupplementable::trace(visitor);
5820 TreeScope::trace(visitor); 5818 TreeScope::trace(visitor);
5821 ContainerNode::trace(visitor); 5819 ContainerNode::trace(visitor);
5822 ExecutionContext::trace(visitor); 5820 ExecutionContext::trace(visitor);
5823 } 5821 }
5824 5822
5825 } // namespace WebCore 5823 } // namespace WebCore
OLDNEW
« 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