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

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

Issue 68173014: Have ElementTraversal::firstWithin() take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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/DocumentOrderedMap.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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 if (!frame()) 668 if (!frame())
669 return 0; 669 return 0;
670 670
671 return domWindow()->location(); 671 return domWindow()->location();
672 } 672 }
673 673
674 void Document::childrenChanged(bool changedByParser, Node* beforeChange, Node* a fterChange, int childCountDelta) 674 void Document::childrenChanged(bool changedByParser, Node* beforeChange, Node* a fterChange, int childCountDelta)
675 { 675 {
676 ContainerNode::childrenChanged(changedByParser, beforeChange, afterChange, c hildCountDelta); 676 ContainerNode::childrenChanged(changedByParser, beforeChange, afterChange, c hildCountDelta);
677 677
678 Element* newDocumentElement = ElementTraversal::firstWithin(this); 678 Element* newDocumentElement = ElementTraversal::firstWithin(*this);
679 if (newDocumentElement == m_documentElement) 679 if (newDocumentElement == m_documentElement)
680 return; 680 return;
681 m_documentElement = newDocumentElement; 681 m_documentElement = newDocumentElement;
682 // The root style used for media query matching depends on the document elem ent. 682 // The root style used for media query matching depends on the document elem ent.
683 clearStyleResolver(); 683 clearStyleResolver();
684 } 684 }
685 685
686 PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionS tate& es) 686 PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionS tate& es)
687 { 687 {
688 if (!isValidName(name)) { 688 if (!isValidName(name)) {
(...skipping 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after
2666 ASSERT(!m_elemSheet->contents()->ruleCount()); 2666 ASSERT(!m_elemSheet->contents()->ruleCount());
2667 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits(); 2667 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits();
2668 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); 2668 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL);
2669 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely. 2669 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely.
2670 m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits); 2670 m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits);
2671 } 2671 }
2672 2672
2673 if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) { 2673 if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) {
2674 // Base URL change changes any relative visited links. 2674 // Base URL change changes any relative visited links.
2675 // 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. 2675 // 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.
2676 for (Element* element = ElementTraversal::firstWithin(this); element; el ement = ElementTraversal::next(*element)) { 2676 for (Element* element = ElementTraversal::firstWithin(*this); element; e lement = ElementTraversal::next(*element)) {
2677 if (isHTMLAnchorElement(element)) 2677 if (isHTMLAnchorElement(element))
2678 toHTMLAnchorElement(element)->invalidateCachedVisitedLinkHash(); 2678 toHTMLAnchorElement(element)->invalidateCachedVisitedLinkHash();
2679 } 2679 }
2680 } 2680 }
2681 } 2681 }
2682 2682
2683 void Document::setBaseURLOverride(const KURL& url) 2683 void Document::setBaseURLOverride(const KURL& url)
2684 { 2684 {
2685 m_baseURLOverride = url; 2685 m_baseURLOverride = url;
2686 updateBaseURL(); 2686 updateBaseURL();
2687 } 2687 }
2688 2688
2689 void Document::processBaseElement() 2689 void Document::processBaseElement()
2690 { 2690 {
2691 // Find the first href attribute in a base element and the first target attr ibute in a base element. 2691 // Find the first href attribute in a base element and the first target attr ibute in a base element.
2692 const AtomicString* href = 0; 2692 const AtomicString* href = 0;
2693 const AtomicString* target = 0; 2693 const AtomicString* target = 0;
2694 for (Element* element = ElementTraversal::firstWithin(this); element && (!hr ef || !target); element = ElementTraversal::next(*element)) { 2694 for (Element* element = ElementTraversal::firstWithin(*this); element && (!h ref || !target); element = ElementTraversal::next(*element)) {
2695 if (element->hasTagName(baseTag)) { 2695 if (element->hasTagName(baseTag)) {
2696 if (!href) { 2696 if (!href) {
2697 const AtomicString& value = element->fastGetAttribute(hrefAttr); 2697 const AtomicString& value = element->fastGetAttribute(hrefAttr);
2698 if (!value.isNull()) 2698 if (!value.isNull())
2699 href = &value; 2699 href = &value;
2700 } 2700 }
2701 if (!target) { 2701 if (!target) {
2702 const AtomicString& value = element->fastGetAttribute(targetAttr ); 2702 const AtomicString& value = element->fastGetAttribute(targetAttr );
2703 if (!value.isNull()) 2703 if (!value.isNull())
2704 target = &value; 2704 target = &value;
(...skipping 2518 matching lines...) Expand 10 before | Expand all | Expand 10 after
5223 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode) 5223 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode)
5224 { 5224 {
5225 if (!isActive()) 5225 if (!isActive())
5226 return; 5226 return;
5227 5227
5228 styleEngine()->modifiedStyleSheet(sheet); 5228 styleEngine()->modifiedStyleSheet(sheet);
5229 styleResolverChanged(when, updateMode); 5229 styleResolverChanged(when, updateMode);
5230 } 5230 }
5231 5231
5232 } // namespace WebCore 5232 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/dom/DocumentOrderedMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698