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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 16951003: Fix broken AttachContext from r152289 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed failing test (/fast/forms/file/input-file-re-render.html) 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 unified diff | Download patch
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/dom/Element.cpp » ('j') | 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 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 } 1755 }
1756 } 1756 }
1757 1757
1758 // If we wanted to call implicitClose() during recalcStyle, do so now that w e're finished. 1758 // If we wanted to call implicitClose() during recalcStyle, do so now that w e're finished.
1759 if (m_closeAfterStyleRecalc) { 1759 if (m_closeAfterStyleRecalc) {
1760 m_closeAfterStyleRecalc = false; 1760 m_closeAfterStyleRecalc = false;
1761 implicitClose(); 1761 implicitClose();
1762 } 1762 }
1763 1763
1764 InspectorInstrumentation::didRecalculateStyle(cookie); 1764 InspectorInstrumentation::didRecalculateStyle(cookie);
1765
1766 // As a result of the style recalculation, the currently hovered element mig ht have been
1767 // detached (for example, by setting display:none in the :hover style), sche dule another mouseMove event
1768 // to check if any other elements ended up under the mouse pointer due to re -layout.
1769 if (hoverNode() && !hoverNode()->renderer() && frame())
1770 frame()->eventHandler()->dispatchFakeMouseMoveEventSoon();
ojan 2013/06/23 17:58:11 To my surprised, firing the fake mouse move events
1765 } 1771 }
1766 1772
1767 void Document::updateStyleIfNeeded() 1773 void Document::updateStyleIfNeeded()
1768 { 1774 {
1769 ASSERT(isMainThread()); 1775 ASSERT(isMainThread());
1770 ASSERT(!view() || (!view()->isInLayout() && !view()->isPainting())); 1776 ASSERT(!view() || (!view()->isInLayout() && !view()->isPainting()));
1771 1777
1772 if (!m_pendingStyleRecalcShouldForce && !childNeedsStyleRecalc()) 1778 if (!m_pendingStyleRecalcShouldForce && !childNeedsStyleRecalc())
1773 return; 1779 return;
1774 1780
(...skipping 3271 matching lines...) Expand 10 before | Expand all | Expand 10 after
5046 RenderObject* newHoverObj = newHoverNode ? newHoverNode->renderer() : 0; 5052 RenderObject* newHoverObj = newHoverNode ? newHoverNode->renderer() : 0;
5047 5053
5048 // Locate the common ancestor render object for the two renderers. 5054 // Locate the common ancestor render object for the two renderers.
5049 RenderObject* ancestor = nearestCommonHoverAncestor(oldHoverObj, newHoverObj ); 5055 RenderObject* ancestor = nearestCommonHoverAncestor(oldHoverObj, newHoverObj );
5050 5056
5051 Vector<RefPtr<Node>, 32> nodesToRemoveFromChain; 5057 Vector<RefPtr<Node>, 32> nodesToRemoveFromChain;
5052 Vector<RefPtr<Node>, 32> nodesToAddToChain; 5058 Vector<RefPtr<Node>, 32> nodesToAddToChain;
5053 5059
5054 if (oldHoverObj != newHoverObj) { 5060 if (oldHoverObj != newHoverObj) {
5055 // If the old hovered node is not nil but it's renderer is, it was proba bly detached as part of the :hover style 5061 // If the old hovered node is not nil but it's renderer is, it was proba bly detached as part of the :hover style
5056 // (for instance by setting display:none in the :hover pseudo-class). In this case, the old hovered element 5062 // (for instance by setting display:none in the :hover pseudo-class). In this case, the old hovered element (and its ancestors)
5057 // must be updated, to ensure it's normal style is re-applied. 5063 // must be updated, to ensure it's normal style is re-applied.
5058 if (oldHoverNode && !oldHoverObj) { 5064 if (oldHoverNode && !oldHoverObj) {
5059 if (!mustBeInActiveChain || oldHoverNode->inActiveChain()) 5065 for (Node* node = oldHoverNode.get(); node; node = node->parentNode( )) {
5060 nodesToRemoveFromChain.append(oldHoverNode); 5066 if (!mustBeInActiveChain || (node->isElementNode() && toElement( node)->inActiveChain()))
5067 nodesToRemoveFromChain.append(node);
5068 }
5069
5061 } 5070 }
5062 5071
5063 // The old hover path only needs to be cleared up to (and not including) the common ancestor; 5072 // The old hover path only needs to be cleared up to (and not including) the common ancestor;
5064 for (RenderObject* curr = oldHoverObj; curr && curr != ancestor; curr = curr->hoverAncestor()) { 5073 for (RenderObject* curr = oldHoverObj; curr && curr != ancestor; curr = curr->hoverAncestor()) {
5065 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr ->node()->inActiveChain())) 5074 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr ->node()->inActiveChain()))
5066 nodesToRemoveFromChain.append(curr->node()); 5075 nodesToRemoveFromChain.append(curr->node());
5067 } 5076 }
5068 } 5077 }
5069 5078
5070 // Now set the hover state for our new object up to the root. 5079 // Now set the hover state for our new object up to the root.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
5233 { 5242 {
5234 return DocumentLifecycleNotifier::create(this); 5243 return DocumentLifecycleNotifier::create(this);
5235 } 5244 }
5236 5245
5237 DocumentLifecycleNotifier* Document::lifecycleNotifier() 5246 DocumentLifecycleNotifier* Document::lifecycleNotifier()
5238 { 5247 {
5239 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); 5248 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier());
5240 } 5249 }
5241 5250
5242 } // namespace WebCore 5251 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698