| 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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 // want the scope to be destructed until after | 683 // want the scope to be destructed until after |
| 684 // removeAllChildren returns, so we guard ourselves with an | 684 // removeAllChildren returns, so we guard ourselves with an |
| 685 // extra self-only ref. | 685 // extra self-only ref. |
| 686 guardRef(); | 686 guardRef(); |
| 687 | 687 |
| 688 // We must make sure not to be retaining any of our children through | 688 // We must make sure not to be retaining any of our children through |
| 689 // these extra pointers or we will create a reference cycle. | 689 // these extra pointers or we will create a reference cycle. |
| 690 m_docType = 0; | 690 m_docType = 0; |
| 691 m_focusedNode = 0; | 691 m_focusedNode = 0; |
| 692 m_hoverNode = 0; | 692 m_hoverNode = 0; |
| 693 m_activeNode = 0; | 693 m_activeElement = 0; |
| 694 m_titleElement = 0; | 694 m_titleElement = 0; |
| 695 m_documentElement = 0; | 695 m_documentElement = 0; |
| 696 m_contextFeatures = ContextFeatures::defaultSwitch(); | 696 m_contextFeatures = ContextFeatures::defaultSwitch(); |
| 697 m_userActionElements.documentDidRemoveLastRef(); | 697 m_userActionElements.documentDidRemoveLastRef(); |
| 698 #if ENABLE(FULLSCREEN_API) | 698 #if ENABLE(FULLSCREEN_API) |
| 699 m_fullScreenElement = 0; | 699 m_fullScreenElement = 0; |
| 700 m_fullScreenElementStack.clear(); | 700 m_fullScreenElementStack.clear(); |
| 701 #endif | 701 #endif |
| 702 | 702 |
| 703 detachParser(); | 703 detachParser(); |
| (...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2114 // indicate destruction mode, i.e. attached() but renderer == 0 | 2114 // indicate destruction mode, i.e. attached() but renderer == 0 |
| 2115 setRenderer(0); | 2115 setRenderer(0); |
| 2116 | 2116 |
| 2117 #if ENABLE(FULLSCREEN_API) | 2117 #if ENABLE(FULLSCREEN_API) |
| 2118 if (m_fullScreenRenderer) | 2118 if (m_fullScreenRenderer) |
| 2119 setFullScreenRenderer(0); | 2119 setFullScreenRenderer(0); |
| 2120 #endif | 2120 #endif |
| 2121 | 2121 |
| 2122 m_hoverNode = 0; | 2122 m_hoverNode = 0; |
| 2123 m_focusedNode = 0; | 2123 m_focusedNode = 0; |
| 2124 m_activeNode = 0; | 2124 m_activeElement = 0; |
| 2125 | 2125 |
| 2126 ContainerNode::detach(); | 2126 ContainerNode::detach(); |
| 2127 | 2127 |
| 2128 unscheduleStyleRecalc(); | 2128 unscheduleStyleRecalc(); |
| 2129 | 2129 |
| 2130 if (render) | 2130 if (render) |
| 2131 render->destroy(); | 2131 render->destroy(); |
| 2132 | 2132 |
| 2133 // This is required, as our Frame might delete itself as soon as it detaches | 2133 // This is required, as our Frame might delete itself as soon as it detaches |
| 2134 // us. However, this violates Node::detach() semantics, as it's never | 2134 // us. However, this violates Node::detach() semantics, as it's never |
| (...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3233 } | 3233 } |
| 3234 } | 3234 } |
| 3235 | 3235 |
| 3236 void Document::setHoverNode(PassRefPtr<Node> newHoverNode) | 3236 void Document::setHoverNode(PassRefPtr<Node> newHoverNode) |
| 3237 { | 3237 { |
| 3238 m_hoverNode = newHoverNode; | 3238 m_hoverNode = newHoverNode; |
| 3239 } | 3239 } |
| 3240 | 3240 |
| 3241 void Document::setActiveNode(PassRefPtr<Node> newActiveNode) | 3241 void Document::setActiveNode(PassRefPtr<Node> newActiveNode) |
| 3242 { | 3242 { |
| 3243 m_activeNode = newActiveNode; | 3243 if (!newActiveNode) { |
| 3244 m_activeElement.clear(); |
| 3245 return; |
| 3246 } |
| 3247 |
| 3248 m_activeElement = newActiveNode->isElementNode() ? toElement(newActiveNode.g
et()) : newActiveNode->parentElement(); |
| 3244 } | 3249 } |
| 3245 | 3250 |
| 3246 void Document::focusedNodeRemoved() | 3251 void Document::focusedNodeRemoved() |
| 3247 { | 3252 { |
| 3248 setFocusedNode(0); | 3253 setFocusedNode(0); |
| 3249 } | 3254 } |
| 3250 | 3255 |
| 3251 void Document::removeFocusedNodeOfSubtree(Node* node, bool amongChildrenOnly) | 3256 void Document::removeFocusedNodeOfSubtree(Node* node, bool amongChildrenOnly) |
| 3252 { | 3257 { |
| 3253 if (!m_focusedNode || this->inPageCache()) // If the document is in the page
cache, then we don't need to clear out the focused node. | 3258 if (!m_focusedNode || this->inPageCache()) // If the document is in the page
cache, then we don't need to clear out the focused node. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3274 | 3279 |
| 3275 m_hoverNode = node->parentNode(); | 3280 m_hoverNode = node->parentNode(); |
| 3276 while (m_hoverNode && !m_hoverNode->renderer()) | 3281 while (m_hoverNode && !m_hoverNode->renderer()) |
| 3277 m_hoverNode = m_hoverNode->parentNode(); | 3282 m_hoverNode = m_hoverNode->parentNode(); |
| 3278 if (frame()) | 3283 if (frame()) |
| 3279 frame()->eventHandler()->scheduleHoverStateUpdate(); | 3284 frame()->eventHandler()->scheduleHoverStateUpdate(); |
| 3280 } | 3285 } |
| 3281 | 3286 |
| 3282 void Document::activeChainNodeDetached(Node* node) | 3287 void Document::activeChainNodeDetached(Node* node) |
| 3283 { | 3288 { |
| 3284 if (!m_activeNode || (node != m_activeNode && (!m_activeNode->isTextNode() |
| node != m_activeNode->parentNode()))) | 3289 if (!m_activeElement || (node != m_activeElement && (!m_activeElement->isTex
tNode() || node != m_activeElement->parentNode()))) |
| 3285 return; | 3290 return; |
| 3286 | 3291 |
| 3287 m_activeNode = node->parentNode(); | 3292 m_activeElement = node->parentElement(); |
| 3288 while (m_activeNode && !m_activeNode->renderer()) | 3293 while (m_activeElement && !m_activeElement->renderer()) |
| 3289 m_activeNode = m_activeNode->parentNode(); | 3294 m_activeElement = m_activeElement->parentElement(); |
| 3290 } | 3295 } |
| 3291 | 3296 |
| 3292 #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(DRAGGABLE_REGION) | 3297 #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(DRAGGABLE_REGION) |
| 3293 const Vector<AnnotatedRegionValue>& Document::annotatedRegions() const | 3298 const Vector<AnnotatedRegionValue>& Document::annotatedRegions() const |
| 3294 { | 3299 { |
| 3295 return m_annotatedRegions; | 3300 return m_annotatedRegions; |
| 3296 } | 3301 } |
| 3297 | 3302 |
| 3298 void Document::setAnnotatedRegions(const Vector<AnnotatedRegionValue>& regions) | 3303 void Document::setAnnotatedRegions(const Vector<AnnotatedRegionValue>& regions) |
| 3299 { | 3304 { |
| (...skipping 2504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5804 | 5809 |
| 5805 void Document::updateHoverActiveState(const HitTestRequest& request, HitTestResu
lt& result) | 5810 void Document::updateHoverActiveState(const HitTestRequest& request, HitTestResu
lt& result) |
| 5806 { | 5811 { |
| 5807 // We don't update :hover/:active state when the result is marked as readOnl
y. | 5812 // We don't update :hover/:active state when the result is marked as readOnl
y. |
| 5808 if (request.readOnly()) | 5813 if (request.readOnly()) |
| 5809 return; | 5814 return; |
| 5810 | 5815 |
| 5811 Node* innerNodeInDocument = result.innerNode(); | 5816 Node* innerNodeInDocument = result.innerNode(); |
| 5812 ASSERT(!innerNodeInDocument || innerNodeInDocument->document() == this); | 5817 ASSERT(!innerNodeInDocument || innerNodeInDocument->document() == this); |
| 5813 | 5818 |
| 5814 Node* oldActiveNode = activeNode(); | 5819 Node* oldActiveNode = activeElement(); |
| 5815 if (oldActiveNode && !request.active()) { | 5820 if (oldActiveNode && !request.active()) { |
| 5816 // We are clearing the :active chain because the mouse has been released
. | 5821 // We are clearing the :active chain because the mouse has been released
. |
| 5817 for (RenderObject* curr = oldActiveNode->renderer(); curr; curr = curr->
parent()) { | 5822 for (RenderObject* curr = oldActiveNode->renderer(); curr; curr = curr->
parent()) { |
| 5818 if (curr->node() && !curr->isText()) { | 5823 if (curr->node() && !curr->isText()) { |
| 5819 curr->node()->setActive(false); | 5824 curr->node()->setActive(false); |
| 5820 m_userActionElements.setInActiveChain(curr->node(), false); | 5825 m_userActionElements.setInActiveChain(curr->node(), false); |
| 5821 } | 5826 } |
| 5822 } | 5827 } |
| 5823 setActiveNode(0); | 5828 setActiveNode(0); |
| 5824 } else { | 5829 } else { |
| 5825 Node* newActiveNode = innerNodeInDocument; | 5830 Node* newActiveNode = innerNodeInDocument; |
| 5826 if (!oldActiveNode && newActiveNode && request.active() && !request.touc
hMove()) { | 5831 if (!oldActiveNode && newActiveNode && request.active() && !request.touc
hMove()) { |
| 5827 // We are setting the :active chain and freezing it. If future moves
happen, they | 5832 // We are setting the :active chain and freezing it. If future moves
happen, they |
| 5828 // will need to reference this chain. | 5833 // will need to reference this chain. |
| 5829 for (RenderObject* curr = newActiveNode->renderer(); curr; curr = cu
rr->parent()) { | 5834 for (RenderObject* curr = newActiveNode->renderer(); curr; curr = cu
rr->parent()) { |
| 5830 if (curr->node() && !curr->isText()) | 5835 if (curr->node() && !curr->isText()) |
| 5831 m_userActionElements.setInActiveChain(curr->node(), true); | 5836 m_userActionElements.setInActiveChain(curr->node(), true); |
| 5832 } | 5837 } |
| 5838 |
| 5833 setActiveNode(newActiveNode); | 5839 setActiveNode(newActiveNode); |
| 5834 } | 5840 } |
| 5835 } | 5841 } |
| 5836 // If the mouse has just been pressed, set :active on the chain. Those (and
only those) | 5842 // If the mouse has just been pressed, set :active on the chain. Those (and
only those) |
| 5837 // nodes should remain :active until the mouse is released. | 5843 // nodes should remain :active until the mouse is released. |
| 5838 bool allowActiveChanges = !oldActiveNode && activeNode(); | 5844 bool allowActiveChanges = !oldActiveNode && activeElement(); |
| 5839 | 5845 |
| 5840 // If the mouse is down and if this is a mouse move event, we want to restri
ct changes in | 5846 // If the mouse is down and if this is a mouse move event, we want to restri
ct changes in |
| 5841 // :hover/:active to only apply to elements that are in the :active chain th
at we froze | 5847 // :hover/:active to only apply to elements that are in the :active chain th
at we froze |
| 5842 // at the time the mouse went down. | 5848 // at the time the mouse went down. |
| 5843 bool mustBeInActiveChain = request.active() && request.move(); | 5849 bool mustBeInActiveChain = request.active() && request.move(); |
| 5844 | 5850 |
| 5845 RefPtr<Node> oldHoverNode = hoverNode(); | 5851 RefPtr<Node> oldHoverNode = hoverNode(); |
| 5846 // Clear the :hover chain when the touch gesture is over. | 5852 // Clear the :hover chain when the touch gesture is over. |
| 5847 if (request.touchRelease()) { | 5853 if (request.touchRelease()) { |
| 5848 if (oldHoverNode) { | 5854 if (oldHoverNode) { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5977 m_templateContentsOwnerDocument = HTMLDocument::create(0, blankURL()
); | 5983 m_templateContentsOwnerDocument = HTMLDocument::create(0, blankURL()
); |
| 5978 else | 5984 else |
| 5979 m_templateContentsOwnerDocument = Document::create(0, blankURL()); | 5985 m_templateContentsOwnerDocument = Document::create(0, blankURL()); |
| 5980 } | 5986 } |
| 5981 | 5987 |
| 5982 return m_templateContentsOwnerDocument.get(); | 5988 return m_templateContentsOwnerDocument.get(); |
| 5983 } | 5989 } |
| 5984 #endif | 5990 #endif |
| 5985 | 5991 |
| 5986 } // namespace WebCore | 5992 } // namespace WebCore |
| OLD | NEW |