| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 #include "core/dom/SelectorQuery.h" | 97 #include "core/dom/SelectorQuery.h" |
| 98 #include "core/dom/StaticNodeList.h" | 98 #include "core/dom/StaticNodeList.h" |
| 99 #include "core/dom/StyleEngine.h" | 99 #include "core/dom/StyleEngine.h" |
| 100 #include "core/dom/TouchList.h" | 100 #include "core/dom/TouchList.h" |
| 101 #include "core/dom/TransformSource.h" | 101 #include "core/dom/TransformSource.h" |
| 102 #include "core/dom/TreeWalker.h" | 102 #include "core/dom/TreeWalker.h" |
| 103 #include "core/dom/VisitedLinkState.h" | 103 #include "core/dom/VisitedLinkState.h" |
| 104 #include "core/dom/XMLDocument.h" | 104 #include "core/dom/XMLDocument.h" |
| 105 #include "core/dom/custom/CustomElementMicrotaskRunQueue.h" | 105 #include "core/dom/custom/CustomElementMicrotaskRunQueue.h" |
| 106 #include "core/dom/custom/CustomElementRegistrationContext.h" | 106 #include "core/dom/custom/CustomElementRegistrationContext.h" |
| 107 #include "core/dom/shadow/ComposedTreeTraversal.h" | |
| 108 #include "core/dom/shadow/ElementShadow.h" | 107 #include "core/dom/shadow/ElementShadow.h" |
| 108 #include "core/dom/shadow/FlatTreeTraversal.h" |
| 109 #include "core/dom/shadow/ShadowRoot.h" | 109 #include "core/dom/shadow/ShadowRoot.h" |
| 110 #include "core/editing/DragCaretController.h" | 110 #include "core/editing/DragCaretController.h" |
| 111 #include "core/editing/Editor.h" | 111 #include "core/editing/Editor.h" |
| 112 #include "core/editing/FrameSelection.h" | 112 #include "core/editing/FrameSelection.h" |
| 113 #include "core/editing/InputMethodController.h" | 113 #include "core/editing/InputMethodController.h" |
| 114 #include "core/editing/markers/DocumentMarkerController.h" | 114 #include "core/editing/markers/DocumentMarkerController.h" |
| 115 #include "core/editing/serializers/Serialization.h" | 115 #include "core/editing/serializers/Serialization.h" |
| 116 #include "core/editing/spellcheck/SpellChecker.h" | 116 #include "core/editing/spellcheck/SpellChecker.h" |
| 117 #include "core/events/BeforeUnloadEvent.h" | 117 #include "core/events/BeforeUnloadEvent.h" |
| 118 #include "core/events/Event.h" | 118 #include "core/events/Event.h" |
| (...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1883 | 1883 |
| 1884 layoutView()->handleSubtreeModifications(); | 1884 layoutView()->handleSubtreeModifications(); |
| 1885 ASSERT(!layoutView()->wasNotifiedOfSubtreeChange()); | 1885 ASSERT(!layoutView()->wasNotifiedOfSubtreeChange()); |
| 1886 | 1886 |
| 1887 m_lifecycle.advanceTo(DocumentLifecycle::LayoutSubtreeChangeClean); | 1887 m_lifecycle.advanceTo(DocumentLifecycle::LayoutSubtreeChangeClean); |
| 1888 } | 1888 } |
| 1889 | 1889 |
| 1890 void Document::updateLayoutTreeForNodeIfNeeded(Node* node) | 1890 void Document::updateLayoutTreeForNodeIfNeeded(Node* node) |
| 1891 { | 1891 { |
| 1892 ASSERT(node); | 1892 ASSERT(node); |
| 1893 if (!node->canParticipateInComposedTree()) | 1893 if (!node->canParticipateInFlatTree()) |
| 1894 return; | 1894 return; |
| 1895 if (!needsLayoutTreeUpdate()) | 1895 if (!needsLayoutTreeUpdate()) |
| 1896 return; | 1896 return; |
| 1897 if (!node->inDocument()) | 1897 if (!node->inDocument()) |
| 1898 return; | 1898 return; |
| 1899 | 1899 |
| 1900 bool needsRecalc = needsFullLayoutTreeUpdate() || node->needsStyleRecalc() |
| node->needsStyleInvalidation(); | 1900 bool needsRecalc = needsFullLayoutTreeUpdate() || node->needsStyleRecalc() |
| node->needsStyleInvalidation(); |
| 1901 | 1901 |
| 1902 if (!needsRecalc) { | 1902 if (!needsRecalc) { |
| 1903 for (const ContainerNode* ancestor = LayoutTreeBuilderTraversal::parent(
*node); ancestor && !needsRecalc; ancestor = LayoutTreeBuilderTraversal::parent(
*ancestor)) | 1903 for (const ContainerNode* ancestor = LayoutTreeBuilderTraversal::parent(
*node); ancestor && !needsRecalc; ancestor = LayoutTreeBuilderTraversal::parent(
*ancestor)) |
| (...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3509 if (contains && (m_focusedElement != node || !amongChildrenOnly)) | 3509 if (contains && (m_focusedElement != node || !amongChildrenOnly)) |
| 3510 clearFocusedElement(); | 3510 clearFocusedElement(); |
| 3511 } | 3511 } |
| 3512 | 3512 |
| 3513 void Document::hoveredNodeDetached(Element& element) | 3513 void Document::hoveredNodeDetached(Element& element) |
| 3514 { | 3514 { |
| 3515 if (!m_hoverNode) | 3515 if (!m_hoverNode) |
| 3516 return; | 3516 return; |
| 3517 | 3517 |
| 3518 m_hoverNode->updateDistribution(); | 3518 m_hoverNode->updateDistribution(); |
| 3519 if (element != m_hoverNode && (!m_hoverNode->isTextNode() || element != Comp
osedTreeTraversal::parent(*m_hoverNode))) | 3519 if (element != m_hoverNode && (!m_hoverNode->isTextNode() || element != Flat
TreeTraversal::parent(*m_hoverNode))) |
| 3520 return; | 3520 return; |
| 3521 | 3521 |
| 3522 m_hoverNode = ComposedTreeTraversal::parent(element); | 3522 m_hoverNode = FlatTreeTraversal::parent(element); |
| 3523 while (m_hoverNode && !m_hoverNode->layoutObject()) | 3523 while (m_hoverNode && !m_hoverNode->layoutObject()) |
| 3524 m_hoverNode = ComposedTreeTraversal::parent(*m_hoverNode); | 3524 m_hoverNode = FlatTreeTraversal::parent(*m_hoverNode); |
| 3525 | 3525 |
| 3526 // If the mouse cursor is not visible, do not clear existing | 3526 // If the mouse cursor is not visible, do not clear existing |
| 3527 // hover effects on the ancestors of |element| and do not invoke | 3527 // hover effects on the ancestors of |element| and do not invoke |
| 3528 // new hover effects on any other element. | 3528 // new hover effects on any other element. |
| 3529 if (!page()->isCursorVisible()) | 3529 if (!page()->isCursorVisible()) |
| 3530 return; | 3530 return; |
| 3531 | 3531 |
| 3532 if (frame()) | 3532 if (frame()) |
| 3533 frame()->eventHandler().scheduleHoverStateUpdate(); | 3533 frame()->eventHandler().scheduleHoverStateUpdate(); |
| 3534 } | 3534 } |
| 3535 | 3535 |
| 3536 void Document::activeChainNodeDetached(Element& element) | 3536 void Document::activeChainNodeDetached(Element& element) |
| 3537 { | 3537 { |
| 3538 if (!m_activeHoverElement) | 3538 if (!m_activeHoverElement) |
| 3539 return; | 3539 return; |
| 3540 | 3540 |
| 3541 if (element != m_activeHoverElement) | 3541 if (element != m_activeHoverElement) |
| 3542 return; | 3542 return; |
| 3543 | 3543 |
| 3544 Node* activeNode = ComposedTreeTraversal::parent(element); | 3544 Node* activeNode = FlatTreeTraversal::parent(element); |
| 3545 while (activeNode && activeNode->isElementNode() && !activeNode->layoutObjec
t()) | 3545 while (activeNode && activeNode->isElementNode() && !activeNode->layoutObjec
t()) |
| 3546 activeNode = ComposedTreeTraversal::parent(*activeNode); | 3546 activeNode = FlatTreeTraversal::parent(*activeNode); |
| 3547 | 3547 |
| 3548 m_activeHoverElement = activeNode && activeNode->isElementNode() ? toElement
(activeNode) : 0; | 3548 m_activeHoverElement = activeNode && activeNode->isElementNode() ? toElement
(activeNode) : 0; |
| 3549 } | 3549 } |
| 3550 | 3550 |
| 3551 const Vector<AnnotatedRegionValue>& Document::annotatedRegions() const | 3551 const Vector<AnnotatedRegionValue>& Document::annotatedRegions() const |
| 3552 { | 3552 { |
| 3553 return m_annotatedRegions; | 3553 return m_annotatedRegions; |
| 3554 } | 3554 } |
| 3555 | 3555 |
| 3556 void Document::setAnnotatedRegions(const Vector<AnnotatedRegionValue>& regions) | 3556 void Document::setAnnotatedRegions(const Vector<AnnotatedRegionValue>& regions) |
| (...skipping 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5488 while (innerElementInDocument && innerElementInDocument->document() != this)
{ | 5488 while (innerElementInDocument && innerElementInDocument->document() != this)
{ |
| 5489 innerElementInDocument->document().updateHoverActiveState(request, inner
ElementInDocument); | 5489 innerElementInDocument->document().updateHoverActiveState(request, inner
ElementInDocument); |
| 5490 innerElementInDocument = innerElementInDocument->document().ownerElement
(); | 5490 innerElementInDocument = innerElementInDocument->document().ownerElement
(); |
| 5491 } | 5491 } |
| 5492 | 5492 |
| 5493 updateDistribution(); | 5493 updateDistribution(); |
| 5494 Element* oldActiveElement = activeHoverElement(); | 5494 Element* oldActiveElement = activeHoverElement(); |
| 5495 if (oldActiveElement && !request.active()) { | 5495 if (oldActiveElement && !request.active()) { |
| 5496 // The oldActiveElement layoutObject is null, dropped on :active by sett
ing display: none, | 5496 // The oldActiveElement layoutObject is null, dropped on :active by sett
ing display: none, |
| 5497 // for instance. We still need to clear the ActiveChain as the mouse is
released. | 5497 // for instance. We still need to clear the ActiveChain as the mouse is
released. |
| 5498 for (RefPtrWillBeRawPtr<Node> node = oldActiveElement; node; node = Comp
osedTreeTraversal::parent(*node)) { | 5498 for (RefPtrWillBeRawPtr<Node> node = oldActiveElement; node; node = Flat
TreeTraversal::parent(*node)) { |
| 5499 ASSERT(!node->isTextNode()); | 5499 ASSERT(!node->isTextNode()); |
| 5500 node->setActive(false); | 5500 node->setActive(false); |
| 5501 m_userActionElements.setInActiveChain(node.get(), false); | 5501 m_userActionElements.setInActiveChain(node.get(), false); |
| 5502 } | 5502 } |
| 5503 setActiveHoverElement(nullptr); | 5503 setActiveHoverElement(nullptr); |
| 5504 } else { | 5504 } else { |
| 5505 Element* newActiveElement = innerElementInDocument; | 5505 Element* newActiveElement = innerElementInDocument; |
| 5506 if (!oldActiveElement && newActiveElement && !newActiveElement->isDisabl
edFormControl() && request.active() && !request.touchMove()) { | 5506 if (!oldActiveElement && newActiveElement && !newActiveElement->isDisabl
edFormControl() && request.active() && !request.touchMove()) { |
| 5507 // We are setting the :active chain and freezing it. If future moves
happen, they | 5507 // We are setting the :active chain and freezing it. If future moves
happen, they |
| 5508 // will need to reference this chain. | 5508 // will need to reference this chain. |
| 5509 for (Node* node = newActiveElement; node; node = ComposedTreeTravers
al::parent(*node)) { | 5509 for (Node* node = newActiveElement; node; node = FlatTreeTraversal::
parent(*node)) { |
| 5510 ASSERT(!node->isTextNode()); | 5510 ASSERT(!node->isTextNode()); |
| 5511 m_userActionElements.setInActiveChain(node, true); | 5511 m_userActionElements.setInActiveChain(node, true); |
| 5512 } | 5512 } |
| 5513 setActiveHoverElement(newActiveElement); | 5513 setActiveHoverElement(newActiveElement); |
| 5514 } | 5514 } |
| 5515 } | 5515 } |
| 5516 // If the mouse has just been pressed, set :active on the chain. Those (and
only those) | 5516 // If the mouse has just been pressed, set :active on the chain. Those (and
only those) |
| 5517 // nodes should remain :active until the mouse is released. | 5517 // nodes should remain :active until the mouse is released. |
| 5518 bool allowActiveChanges = !oldActiveElement && activeHoverElement(); | 5518 bool allowActiveChanges = !oldActiveElement && activeHoverElement(); |
| 5519 | 5519 |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5935 #ifndef NDEBUG | 5935 #ifndef NDEBUG |
| 5936 using namespace blink; | 5936 using namespace blink; |
| 5937 void showLiveDocumentInstances() | 5937 void showLiveDocumentInstances() |
| 5938 { | 5938 { |
| 5939 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 5939 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
| 5940 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5940 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5941 for (Document* document : set) | 5941 for (Document* document : set) |
| 5942 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5942 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
| 5943 } | 5943 } |
| 5944 #endif | 5944 #endif |
| OLD | NEW |