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

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

Issue 1173283002: Move some Element specific code from Node::detach to Element::detach. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Document.h ('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 3327 matching lines...) Expand 10 before | Expand all | Expand 10 after
3338 return; 3338 return;
3339 3339
3340 // We can't be focused if we're not in the document. 3340 // We can't be focused if we're not in the document.
3341 if (!node->inDocument()) 3341 if (!node->inDocument())
3342 return; 3342 return;
3343 bool contains = node->containsIncludingShadowDOM(m_focusedElement.get()); 3343 bool contains = node->containsIncludingShadowDOM(m_focusedElement.get());
3344 if (contains && (m_focusedElement != node || !amongChildrenOnly)) 3344 if (contains && (m_focusedElement != node || !amongChildrenOnly))
3345 setFocusedElement(nullptr); 3345 setFocusedElement(nullptr);
3346 } 3346 }
3347 3347
3348 void Document::hoveredNodeDetached(Node* node) 3348 void Document::hoveredNodeDetached(Element& element)
3349 { 3349 {
3350 ASSERT(node);
3351 if (!m_hoverNode) 3350 if (!m_hoverNode)
3352 return; 3351 return;
3353 3352
3354 m_hoverNode->updateDistribution(); 3353 m_hoverNode->updateDistribution();
3355 if (node != m_hoverNode && (!m_hoverNode->isTextNode() || node != ComposedTr eeTraversal::parent(*m_hoverNode))) 3354 if (element != m_hoverNode && (!m_hoverNode->isTextNode() || element != Comp osedTreeTraversal::parent(*m_hoverNode)))
3356 return; 3355 return;
3357 3356
3358 m_hoverNode = ComposedTreeTraversal::parent(*node); 3357 m_hoverNode = ComposedTreeTraversal::parent(element);
3359 while (m_hoverNode && !m_hoverNode->layoutObject()) 3358 while (m_hoverNode && !m_hoverNode->layoutObject())
3360 m_hoverNode = ComposedTreeTraversal::parent(*m_hoverNode); 3359 m_hoverNode = ComposedTreeTraversal::parent(*m_hoverNode);
3361 3360
3362 // If the mouse cursor is not visible, do not clear existing 3361 // If the mouse cursor is not visible, do not clear existing
3363 // hover effects on the ancestors of |node| and do not invoke 3362 // hover effects on the ancestors of |element| and do not invoke
3364 // new hover effects on any other element. 3363 // new hover effects on any other element.
3365 if (!page()->isCursorVisible()) 3364 if (!page()->isCursorVisible())
3366 return; 3365 return;
3367 3366
3368 if (frame()) 3367 if (frame())
3369 frame()->eventHandler().scheduleHoverStateUpdate(); 3368 frame()->eventHandler().scheduleHoverStateUpdate();
3370 } 3369 }
3371 3370
3372 void Document::activeChainNodeDetached(Node* node) 3371 void Document::activeChainNodeDetached(Element& element)
3373 { 3372 {
3374 if (!m_activeHoverElement) 3373 if (!m_activeHoverElement)
3375 return; 3374 return;
3376 3375
3377 if (node != m_activeHoverElement) 3376 if (element != m_activeHoverElement)
3378 return; 3377 return;
3379 3378
3380 Node* activeNode = ComposedTreeTraversal::parent(*node); 3379 Node* activeNode = ComposedTreeTraversal::parent(element);
3381 while (activeNode && activeNode->isElementNode() && !activeNode->layoutObjec t()) 3380 while (activeNode && activeNode->isElementNode() && !activeNode->layoutObjec t())
3382 activeNode = ComposedTreeTraversal::parent(*activeNode); 3381 activeNode = ComposedTreeTraversal::parent(*activeNode);
3383 3382
3384 m_activeHoverElement = activeNode && activeNode->isElementNode() ? toElement (activeNode) : 0; 3383 m_activeHoverElement = activeNode && activeNode->isElementNode() ? toElement (activeNode) : 0;
3385 } 3384 }
3386 3385
3387 const Vector<AnnotatedRegionValue>& Document::annotatedRegions() const 3386 const Vector<AnnotatedRegionValue>& Document::annotatedRegions() const
3388 { 3387 {
3389 return m_annotatedRegions; 3388 return m_annotatedRegions;
3390 } 3389 }
(...skipping 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after
5710 #ifndef NDEBUG 5709 #ifndef NDEBUG
5711 using namespace blink; 5710 using namespace blink;
5712 void showLiveDocumentInstances() 5711 void showLiveDocumentInstances()
5713 { 5712 {
5714 WeakDocumentSet& set = liveDocumentSet(); 5713 WeakDocumentSet& set = liveDocumentSet();
5715 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5714 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5716 for (Document* document : set) 5715 for (Document* document : set)
5717 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5716 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5718 } 5717 }
5719 #endif 5718 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698