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

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

Issue 65303008: 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
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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 if (!frame()) 667 if (!frame())
668 return 0; 668 return 0;
669 669
670 return domWindow()->location(); 670 return domWindow()->location();
671 } 671 }
672 672
673 void Document::childrenChanged(bool changedByParser, Node* beforeChange, Node* a fterChange, int childCountDelta) 673 void Document::childrenChanged(bool changedByParser, Node* beforeChange, Node* a fterChange, int childCountDelta)
674 { 674 {
675 ContainerNode::childrenChanged(changedByParser, beforeChange, afterChange, c hildCountDelta); 675 ContainerNode::childrenChanged(changedByParser, beforeChange, afterChange, c hildCountDelta);
676 676
677 Element* newDocumentElement = ElementTraversal::firstWithin(this); 677 Element* newDocumentElement = ElementTraversal::firstWithin(*this);
678 if (newDocumentElement == m_documentElement) 678 if (newDocumentElement == m_documentElement)
679 return; 679 return;
680 m_documentElement = newDocumentElement; 680 m_documentElement = newDocumentElement;
681 // The root style used for media query matching depends on the document elem ent. 681 // The root style used for media query matching depends on the document elem ent.
682 clearStyleResolver(); 682 clearStyleResolver();
683 } 683 }
684 684
685 PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionS tate& es) 685 PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionS tate& es)
686 { 686 {
687 if (!isValidName(name)) { 687 if (!isValidName(name)) {
(...skipping 1943 matching lines...) Expand 10 before | Expand all | Expand 10 after
2631 ASSERT(!m_elemSheet->contents()->ruleCount()); 2631 ASSERT(!m_elemSheet->contents()->ruleCount());
2632 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits(); 2632 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits();
2633 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); 2633 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL);
2634 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely. 2634 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely.
2635 m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits); 2635 m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits);
2636 } 2636 }
2637 2637
2638 if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) { 2638 if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) {
2639 // Base URL change changes any relative visited links. 2639 // Base URL change changes any relative visited links.
2640 // 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. 2640 // 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.
2641 for (Element* element = ElementTraversal::firstWithin(this); element; el ement = ElementTraversal::next(*element)) { 2641 for (Element* element = ElementTraversal::firstWithin(*this); element; e lement = ElementTraversal::next(*element)) {
2642 if (isHTMLAnchorElement(element)) 2642 if (isHTMLAnchorElement(element))
2643 toHTMLAnchorElement(element)->invalidateCachedVisitedLinkHash(); 2643 toHTMLAnchorElement(element)->invalidateCachedVisitedLinkHash();
2644 } 2644 }
2645 } 2645 }
2646 } 2646 }
2647 2647
2648 void Document::setBaseURLOverride(const KURL& url) 2648 void Document::setBaseURLOverride(const KURL& url)
2649 { 2649 {
2650 m_baseURLOverride = url; 2650 m_baseURLOverride = url;
2651 updateBaseURL(); 2651 updateBaseURL();
2652 } 2652 }
2653 2653
2654 void Document::processBaseElement() 2654 void Document::processBaseElement()
2655 { 2655 {
2656 // Find the first href attribute in a base element and the first target attr ibute in a base element. 2656 // Find the first href attribute in a base element and the first target attr ibute in a base element.
2657 const AtomicString* href = 0; 2657 const AtomicString* href = 0;
2658 const AtomicString* target = 0; 2658 const AtomicString* target = 0;
2659 for (Element* element = ElementTraversal::firstWithin(this); element && (!hr ef || !target); element = ElementTraversal::next(*element)) { 2659 for (Element* element = ElementTraversal::firstWithin(*this); element && (!h ref || !target); element = ElementTraversal::next(*element)) {
2660 if (element->hasTagName(baseTag)) { 2660 if (element->hasTagName(baseTag)) {
2661 if (!href) { 2661 if (!href) {
2662 const AtomicString& value = element->fastGetAttribute(hrefAttr); 2662 const AtomicString& value = element->fastGetAttribute(hrefAttr);
2663 if (!value.isNull()) 2663 if (!value.isNull())
2664 href = &value; 2664 href = &value;
2665 } 2665 }
2666 if (!target) { 2666 if (!target) {
2667 const AtomicString& value = element->fastGetAttribute(targetAttr ); 2667 const AtomicString& value = element->fastGetAttribute(targetAttr );
2668 if (!value.isNull()) 2668 if (!value.isNull())
2669 target = &value; 2669 target = &value;
(...skipping 2518 matching lines...) Expand 10 before | Expand all | Expand 10 after
5188 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode) 5188 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode)
5189 { 5189 {
5190 if (!isActive()) 5190 if (!isActive())
5191 return; 5191 return;
5192 5192
5193 styleEngine()->modifiedStyleSheet(sheet); 5193 styleEngine()->modifiedStyleSheet(sheet);
5194 styleResolverChanged(when, updateMode); 5194 styleResolverChanged(when, updateMode);
5195 } 5195 }
5196 5196
5197 } // namespace WebCore 5197 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698