OLD | NEW |
---|---|
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 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1765 void Document::updateStyleIfNeeded() | 1765 void Document::updateStyleIfNeeded() |
1766 { | 1766 { |
1767 ASSERT(isMainThread()); | 1767 ASSERT(isMainThread()); |
1768 ASSERT(!view() || (!view()->isInLayout() && !view()->isPainting())); | 1768 ASSERT(!view() || (!view()->isInLayout() && !view()->isPainting())); |
1769 | 1769 |
1770 if (!m_pendingStyleRecalcShouldForce && !childNeedsStyleRecalc()) | 1770 if (!m_pendingStyleRecalcShouldForce && !childNeedsStyleRecalc()) |
1771 return; | 1771 return; |
1772 | 1772 |
1773 AnimationUpdateBlock animationUpdateBlock(m_frame ? m_frame->animation() : 0 ); | 1773 AnimationUpdateBlock animationUpdateBlock(m_frame ? m_frame->animation() : 0 ); |
1774 recalcStyle(NoChange); | 1774 recalcStyle(NoChange); |
1775 | |
1776 // As a result of the style recalculation, the currently hovered element mig ht have been | |
1777 // detached (for example, by setting display:none in the :hover style), sche dule another mouseMove event | |
1778 // to check if any other elements ended up under the mouse pointer due to re -layout. | |
1779 if (hoverNode() && !hoverNode()->renderer() && frame()) | |
1780 frame()->eventHandler()->dispatchFakeMouseMoveEventSoon(); | |
esprehn
2013/06/17 22:00:27
Hmm, there's a number of other places where we mig
stavila
2013/06/18 08:54:00
Yes, I know Document::recalcStyle is called in mul
| |
1775 } | 1781 } |
1776 | 1782 |
1777 void Document::updateLayout() | 1783 void Document::updateLayout() |
1778 { | 1784 { |
1779 ASSERT(isMainThread()); | 1785 ASSERT(isMainThread()); |
1780 | 1786 |
1781 FrameView* frameView = view(); | 1787 FrameView* frameView = view(); |
1782 if (frameView && frameView->isInLayout()) { | 1788 if (frameView && frameView->isInLayout()) { |
1783 // View layout should not be re-entrant. | 1789 // View layout should not be re-entrant. |
1784 ASSERT_NOT_REACHED(); | 1790 ASSERT_NOT_REACHED(); |
(...skipping 3258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5043 RenderObject* newHoverObj = newHoverNode ? newHoverNode->renderer() : 0; | 5049 RenderObject* newHoverObj = newHoverNode ? newHoverNode->renderer() : 0; |
5044 | 5050 |
5045 // Locate the common ancestor render object for the two renderers. | 5051 // Locate the common ancestor render object for the two renderers. |
5046 RenderObject* ancestor = nearestCommonHoverAncestor(oldHoverObj, newHoverObj ); | 5052 RenderObject* ancestor = nearestCommonHoverAncestor(oldHoverObj, newHoverObj ); |
5047 | 5053 |
5048 Vector<RefPtr<Node>, 32> nodesToRemoveFromChain; | 5054 Vector<RefPtr<Node>, 32> nodesToRemoveFromChain; |
5049 Vector<RefPtr<Node>, 32> nodesToAddToChain; | 5055 Vector<RefPtr<Node>, 32> nodesToAddToChain; |
5050 | 5056 |
5051 if (oldHoverObj != newHoverObj) { | 5057 if (oldHoverObj != newHoverObj) { |
5052 // If the old hovered node is not nil but it's renderer is, it was proba bly detached as part of the :hover style | 5058 // If the old hovered node is not nil but it's renderer is, it was proba bly detached as part of the :hover style |
5053 // (for instance by setting display:none in the :hover pseudo-class). In this case, the old hovered element | 5059 // (for instance by setting display:none in the :hover pseudo-class). In this case, the old hovered element (and its ancestors) |
5054 // must be updated, to ensure it's normal style is re-applied. | 5060 // must be updated, to ensure it's normal style is re-applied. |
5055 if (oldHoverNode && !oldHoverObj) { | 5061 if (oldHoverNode && !oldHoverObj) { |
5056 if (!mustBeInActiveChain || oldHoverNode->inActiveChain()) | 5062 for (Node* node = oldHoverNode.get(); node; node = node->parentNode( )) { |
5057 nodesToRemoveFromChain.append(oldHoverNode); | 5063 if (!mustBeInActiveChain || (node->isElementNode() && toElement( node)->inActiveChain())) |
5064 nodesToRemoveFromChain.append(node); | |
5065 } | |
5066 | |
5058 } | 5067 } |
5059 | 5068 |
5060 // The old hover path only needs to be cleared up to (and not including) the common ancestor; | 5069 // The old hover path only needs to be cleared up to (and not including) the common ancestor; |
5061 for (RenderObject* curr = oldHoverObj; curr && curr != ancestor; curr = curr->hoverAncestor()) { | 5070 for (RenderObject* curr = oldHoverObj; curr && curr != ancestor; curr = curr->hoverAncestor()) { |
5062 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr ->node()->inActiveChain())) | 5071 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr ->node()->inActiveChain())) |
5063 nodesToRemoveFromChain.append(curr->node()); | 5072 nodesToRemoveFromChain.append(curr->node()); |
5064 } | 5073 } |
5065 } | 5074 } |
5066 | 5075 |
5067 // Now set the hover state for our new object up to the root. | 5076 // Now set the hover state for our new object up to the root. |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5227 } | 5236 } |
5228 | 5237 |
5229 void Document::addLifecycleObserver(DocumentLifecycleObserver* observer) | 5238 void Document::addLifecycleObserver(DocumentLifecycleObserver* observer) |
5230 { | 5239 { |
5231 if (!m_lifecycleNotifier) | 5240 if (!m_lifecycleNotifier) |
5232 m_lifecycleNotifier = DocumentLifecycleNotifier::create(); | 5241 m_lifecycleNotifier = DocumentLifecycleNotifier::create(); |
5233 m_lifecycleNotifier->addObserver(observer); | 5242 m_lifecycleNotifier->addObserver(observer); |
5234 } | 5243 } |
5235 | 5244 |
5236 } // namespace WebCore | 5245 } // namespace WebCore |
OLD | NEW |