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

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: rebasline 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/platform/linux/fast/spatial-navigation/snav-multiple-select-focusring-expected.png ('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 5423 matching lines...) Expand 10 before | Expand all | Expand 10 after
5434 m_frame->eventHandler().notifyElementActivated(); 5434 m_frame->eventHandler().notifyElementActivated();
5435 5435
5436 Element* innerElementInDocument = innerElement; 5436 Element* innerElementInDocument = innerElement;
5437 while (innerElementInDocument && innerElementInDocument->document() != this) { 5437 while (innerElementInDocument && innerElementInDocument->document() != this) {
5438 innerElementInDocument->document().updateHoverActiveState(request, inner ElementInDocument, event); 5438 innerElementInDocument->document().updateHoverActiveState(request, inner ElementInDocument, event);
5439 innerElementInDocument = innerElementInDocument->document().ownerElement (); 5439 innerElementInDocument = innerElementInDocument->document().ownerElement ();
5440 } 5440 }
5441 5441
5442 Element* oldActiveElement = activeHoverElement(); 5442 Element* oldActiveElement = activeHoverElement();
5443 if (oldActiveElement && !request.active()) { 5443 if (oldActiveElement && !request.active()) {
5444 // We are clearing the :active chain because the mouse has been released . 5444 // The oldActiveElement renderer is null, dropped on :active by setting display: none,
5445 for (RenderObject* curr = oldActiveElement->renderer(); curr; curr = cur r->parent()) { 5445 // for instance. We still need to clear the ActiveChain as the mouse is released.
5446 if (curr->node()) { 5446 for (Node* node = oldActiveElement; node; node = NodeRenderingTraversal: :parent(node)) {
5447 ASSERT(!curr->node()->isTextNode()); 5447 ASSERT(node->isTextNode());
spartha 2014/06/26 19:01:36 @morrita, the assert was added in one of your patc
5448 curr->node()->setActive(false); 5448 node->setActive(false);
5449 m_userActionElements.setInActiveChain(curr->node(), false); 5449 m_userActionElements.setInActiveChain(node, false);
5450 }
5451 } 5450 }
5452 setActiveHoverElement(nullptr); 5451 setActiveHoverElement(nullptr);
5453 } else { 5452 } else {
5454 Element* newActiveElement = innerElementInDocument; 5453 Element* newActiveElement = innerElementInDocument;
5455 if (!oldActiveElement && newActiveElement && !newActiveElement->isDisabl edFormControl() && request.active() && !request.touchMove()) { 5454 if (!oldActiveElement && newActiveElement && !newActiveElement->isDisabl edFormControl() && request.active() && !request.touchMove()) {
5456 // We are setting the :active chain and freezing it. If future moves happen, they 5455 // We are setting the :active chain and freezing it. If future moves happen, they
5457 // will need to reference this chain. 5456 // will need to reference this chain.
5458 for (RenderObject* curr = newActiveElement->renderer(); curr; curr = curr->parent()) { 5457 for (Node* node = newActiveElement; node; node = NodeRenderingTraver sal::parent(node)) {
5459 if (curr->node() && !curr->isText()) 5458 if (!node->isTextNode())
5460 m_userActionElements.setInActiveChain(curr->node(), true); 5459 m_userActionElements.setInActiveChain(node, true);
5461 } 5460 }
5462
5463 setActiveHoverElement(newActiveElement); 5461 setActiveHoverElement(newActiveElement);
5464 } 5462 }
5465 } 5463 }
5466 // If the mouse has just been pressed, set :active on the chain. Those (and only those) 5464 // If the mouse has just been pressed, set :active on the chain. Those (and only those)
5467 // nodes should remain :active until the mouse is released. 5465 // nodes should remain :active until the mouse is released.
5468 bool allowActiveChanges = !oldActiveElement && activeHoverElement(); 5466 bool allowActiveChanges = !oldActiveElement && activeHoverElement();
5469 5467
5470 // If the mouse is down and if this is a mouse move event, we want to restri ct changes in 5468 // If the mouse is down and if this is a mouse move event, we want to restri ct changes in
5471 // :hover/:active to only apply to elements that are in the :active chain th at we froze 5469 // :hover/:active to only apply to elements that are in the :active chain th at we froze
5472 // at the time the mouse went down. 5470 // at the time the mouse went down.
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
5835 visitor->trace(m_compositorPendingAnimations); 5833 visitor->trace(m_compositorPendingAnimations);
5836 visitor->trace(m_contextDocument); 5834 visitor->trace(m_contextDocument);
5837 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); 5835 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this);
5838 DocumentSupplementable::trace(visitor); 5836 DocumentSupplementable::trace(visitor);
5839 TreeScope::trace(visitor); 5837 TreeScope::trace(visitor);
5840 ContainerNode::trace(visitor); 5838 ContainerNode::trace(visitor);
5841 ExecutionContext::trace(visitor); 5839 ExecutionContext::trace(visitor);
5842 } 5840 }
5843 5841
5844 } // namespace WebCore 5842 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/platform/linux/fast/spatial-navigation/snav-multiple-select-focusring-expected.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698