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

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

Issue 67473002: Have ElementTraversal / NodeTraversal's next() methods take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master Created 7 years, 1 month 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/DocumentMarkerController.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 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 window->willDetachDocumentFromFrame(); 2053 window->willDetachDocumentFromFrame();
2054 detach(); 2054 detach();
2055 } 2055 }
2056 2056
2057 void Document::removeAllEventListeners() 2057 void Document::removeAllEventListeners()
2058 { 2058 {
2059 EventTarget::removeAllEventListeners(); 2059 EventTarget::removeAllEventListeners();
2060 2060
2061 if (DOMWindow* domWindow = this->domWindow()) 2061 if (DOMWindow* domWindow = this->domWindow())
2062 domWindow->removeAllEventListeners(); 2062 domWindow->removeAllEventListeners();
2063 for (Node* node = firstChild(); node; node = NodeTraversal::next(node)) 2063 for (Node* node = firstChild(); node; node = NodeTraversal::next(*node))
2064 node->removeAllEventListeners(); 2064 node->removeAllEventListeners();
2065 } 2065 }
2066 2066
2067 void Document::clearAXObjectCache() 2067 void Document::clearAXObjectCache()
2068 { 2068 {
2069 ASSERT(topDocument() == this); 2069 ASSERT(topDocument() == this);
2070 // Clear the cache member variable before calling delete because attempts 2070 // Clear the cache member variable before calling delete because attempts
2071 // are made to access it during destruction. 2071 // are made to access it during destruction.
2072 m_axObjectCache.clear(); 2072 m_axObjectCache.clear();
2073 } 2073 }
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
2634 ASSERT(!m_elemSheet->contents()->ruleCount()); 2634 ASSERT(!m_elemSheet->contents()->ruleCount());
2635 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits(); 2635 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits();
2636 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); 2636 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL);
2637 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely. 2637 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely.
2638 m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits); 2638 m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits);
2639 } 2639 }
2640 2640
2641 if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) { 2641 if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) {
2642 // Base URL change changes any relative visited links. 2642 // Base URL change changes any relative visited links.
2643 // FIXME: There are other URLs in the tree that would need to be re-eval uated on dynamic base URL change. Style should be invalidated too. 2643 // FIXME: There are other URLs in the tree that would need to be re-eval uated on dynamic base URL change. Style should be invalidated too.
2644 for (Element* element = ElementTraversal::firstWithin(this); element; el ement = ElementTraversal::next(element)) { 2644 for (Element* element = ElementTraversal::firstWithin(this); element; el ement = ElementTraversal::next(*element)) {
2645 if (isHTMLAnchorElement(element)) 2645 if (isHTMLAnchorElement(element))
2646 toHTMLAnchorElement(element)->invalidateCachedVisitedLinkHash(); 2646 toHTMLAnchorElement(element)->invalidateCachedVisitedLinkHash();
2647 } 2647 }
2648 } 2648 }
2649 } 2649 }
2650 2650
2651 void Document::setBaseURLOverride(const KURL& url) 2651 void Document::setBaseURLOverride(const KURL& url)
2652 { 2652 {
2653 m_baseURLOverride = url; 2653 m_baseURLOverride = url;
2654 updateBaseURL(); 2654 updateBaseURL();
2655 } 2655 }
2656 2656
2657 void Document::processBaseElement() 2657 void Document::processBaseElement()
2658 { 2658 {
2659 // Find the first href attribute in a base element and the first target attr ibute in a base element. 2659 // Find the first href attribute in a base element and the first target attr ibute in a base element.
2660 const AtomicString* href = 0; 2660 const AtomicString* href = 0;
2661 const AtomicString* target = 0; 2661 const AtomicString* target = 0;
2662 for (Element* element = ElementTraversal::firstWithin(this); element && (!hr ef || !target); element = ElementTraversal::next(element)) { 2662 for (Element* element = ElementTraversal::firstWithin(this); element && (!hr ef || !target); element = ElementTraversal::next(*element)) {
2663 if (element->hasTagName(baseTag)) { 2663 if (element->hasTagName(baseTag)) {
2664 if (!href) { 2664 if (!href) {
2665 const AtomicString& value = element->fastGetAttribute(hrefAttr); 2665 const AtomicString& value = element->fastGetAttribute(hrefAttr);
2666 if (!value.isNull()) 2666 if (!value.isNull())
2667 href = &value; 2667 href = &value;
2668 } 2668 }
2669 if (!target) { 2669 if (!target) {
2670 const AtomicString& value = element->fastGetAttribute(targetAttr ); 2670 const AtomicString& value = element->fastGetAttribute(targetAttr );
2671 if (!value.isNull()) 2671 if (!value.isNull())
2672 target = &value; 2672 target = &value;
(...skipping 2518 matching lines...) Expand 10 before | Expand all | Expand 10 after
5191 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode) 5191 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode)
5192 { 5192 {
5193 if (!isActive()) 5193 if (!isActive())
5194 return; 5194 return;
5195 5195
5196 styleEngine()->modifiedStyleSheet(sheet); 5196 styleEngine()->modifiedStyleSheet(sheet);
5197 styleResolverChanged(when, updateMode); 5197 styleResolverChanged(when, updateMode);
5198 } 5198 }
5199 5199
5200 } // namespace WebCore 5200 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/dom/DocumentMarkerController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698