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

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

Issue 135643004: Make TreeScope::baseURL pure virtual (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Made TreeScope::baseURL virtual Created 6 years, 11 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/TreeScope.h » ('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 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 if (!implementation()->hasFeature("XML", String())) { 1139 if (!implementation()->hasFeature("XML", String())) {
1140 exceptionState.throwDOMException(NotSupportedError, "This document does not support XML."); 1140 exceptionState.throwDOMException(NotSupportedError, "This document does not support XML.");
1141 return; 1141 return;
1142 } 1142 }
1143 1143
1144 m_xmlStandalone = standalone ? Standalone : NotStandalone; 1144 m_xmlStandalone = standalone ? Standalone : NotStandalone;
1145 } 1145 }
1146 1146
1147 KURL Document::baseURI() const 1147 KURL Document::baseURI() const
1148 { 1148 {
1149 return baseURL(); 1149 return m_baseURL;
1150 } 1150 }
1151 1151
1152 void Document::setContent(const String& content) 1152 void Document::setContent(const String& content)
1153 { 1153 {
1154 open(); 1154 open();
1155 // FIXME: This should probably use insert(), but that's (intentionally) 1155 // FIXME: This should probably use insert(), but that's (intentionally)
1156 // not implemented for the XML parser as it's normally synonymous with 1156 // not implemented for the XML parser as it's normally synonymous with
1157 // document.write(). append() will end up yielding, but close() will 1157 // document.write(). append() will end up yielding, but close() will
1158 // pump the tokenizer syncrhonously and finish the parse. 1158 // pump the tokenizer syncrhonously and finish the parse.
1159 m_parser->pinToMainThread(); 1159 m_parser->pinToMainThread();
(...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after
2585 if (newURL == m_url) 2585 if (newURL == m_url)
2586 return; 2586 return;
2587 2587
2588 m_url = newURL; 2588 m_url = newURL;
2589 updateBaseURL(); 2589 updateBaseURL();
2590 contextFeatures()->urlDidChange(this); 2590 contextFeatures()->urlDidChange(this);
2591 } 2591 }
2592 2592
2593 void Document::updateBaseURL() 2593 void Document::updateBaseURL()
2594 { 2594 {
2595 KURL oldBaseURL = baseURL(); 2595 KURL oldBaseURL = m_baseURL;
2596 // DOM 3 Core: When the Document supports the feature "HTML" [DOM Level 2 HT ML], the base URI is computed using 2596 // DOM 3 Core: When the Document supports the feature "HTML" [DOM Level 2 HT ML], the base URI is computed using
2597 // first the value of the href attribute of the HTML BASE element if any, an d the value of the documentURI attribute 2597 // first the value of the href attribute of the HTML BASE element if any, an d the value of the documentURI attribute
2598 // from the Document interface otherwise (which we store, preparsed, in m_ur l). 2598 // from the Document interface otherwise (which we store, preparsed, in m_ur l).
2599 if (!m_baseElementURL.isEmpty()) 2599 if (!m_baseElementURL.isEmpty())
2600 setBaseURL(m_baseElementURL); 2600 m_baseURL = m_baseElementURL;
2601 else if (!m_baseURLOverride.isEmpty()) 2601 else if (!m_baseURLOverride.isEmpty())
2602 setBaseURL(m_baseURLOverride); 2602 m_baseURL = m_baseURLOverride;
2603 else 2603 else
2604 setBaseURL(m_url); 2604 m_baseURL = m_url;
2605 2605
2606 selectorQueryCache().invalidate(); 2606 selectorQueryCache().invalidate();
2607 2607
2608 if (!baseURL().isValid()) 2608 if (!m_baseURL.isValid())
2609 setBaseURL(KURL()); 2609 m_baseURL = KURL();
2610 2610
2611 if (m_elemSheet) { 2611 if (m_elemSheet) {
2612 // Element sheet is silly. It never contains anything. 2612 // Element sheet is silly. It never contains anything.
2613 ASSERT(!m_elemSheet->contents()->ruleCount()); 2613 ASSERT(!m_elemSheet->contents()->ruleCount());
2614 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits(); 2614 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits();
2615 m_elemSheet = CSSStyleSheet::createInline(this, baseURL()); 2615 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL);
2616 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely. 2616 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely.
2617 m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits); 2617 m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits);
2618 } 2618 }
2619 2619
2620 if (!equalIgnoringFragmentIdentifier(oldBaseURL, baseURL())) { 2620 if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) {
2621 // Base URL change changes any relative visited links. 2621 // Base URL change changes any relative visited links.
2622 // 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. 2622 // 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.
2623 for (Element* element = ElementTraversal::firstWithin(*this); element; e lement = ElementTraversal::next(*element)) { 2623 for (Element* element = ElementTraversal::firstWithin(*this); element; e lement = ElementTraversal::next(*element)) {
2624 if (element->hasTagName(aTag)) 2624 if (element->hasTagName(aTag))
2625 toHTMLAnchorElement(element)->invalidateCachedVisitedLinkHash(); 2625 toHTMLAnchorElement(element)->invalidateCachedVisitedLinkHash();
2626 } 2626 }
2627 } 2627 }
2628 } 2628 }
2629 2629
2630 void Document::setBaseURLOverride(const KURL& url) 2630 void Document::setBaseURLOverride(const KURL& url)
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
2783 if (!haveStylesheetsAndImportsLoaded()) 2783 if (!haveStylesheetsAndImportsLoaded())
2784 return; 2784 return;
2785 if (ScriptableDocumentParser* parser = scriptableDocumentParser()) 2785 if (ScriptableDocumentParser* parser = scriptableDocumentParser())
2786 parser->executeScriptsWaitingForResources(); 2786 parser->executeScriptsWaitingForResources();
2787 } 2787 }
2788 2788
2789 2789
2790 CSSStyleSheet* Document::elementSheet() 2790 CSSStyleSheet* Document::elementSheet()
2791 { 2791 {
2792 if (!m_elemSheet) 2792 if (!m_elemSheet)
2793 m_elemSheet = CSSStyleSheet::createInline(this, baseURL()); 2793 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL);
2794 return m_elemSheet.get(); 2794 return m_elemSheet.get();
2795 } 2795 }
2796 2796
2797 void Document::processHttpEquiv(const AtomicString& equiv, const AtomicString& c ontent) 2797 void Document::processHttpEquiv(const AtomicString& equiv, const AtomicString& c ontent)
2798 { 2798 {
2799 ASSERT(!equiv.isNull() && !content.isNull()); 2799 ASSERT(!equiv.isNull() && !content.isNull());
2800 2800
2801 if (equalIgnoringCase(equiv, "default-style")) 2801 if (equalIgnoringCase(equiv, "default-style"))
2802 processHttpEquivDefaultStyle(content); 2802 processHttpEquivDefaultStyle(content);
2803 else if (equalIgnoringCase(equiv, "refresh")) 2803 else if (equalIgnoringCase(equiv, "refresh"))
(...skipping 2444 matching lines...) Expand 10 before | Expand all | Expand 10 after
5248 } 5248 }
5249 5249
5250 FastTextAutosizer* Document::fastTextAutosizer() 5250 FastTextAutosizer* Document::fastTextAutosizer()
5251 { 5251 {
5252 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d()) 5252 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d())
5253 m_fastTextAutosizer = FastTextAutosizer::create(this); 5253 m_fastTextAutosizer = FastTextAutosizer::create(this);
5254 return m_fastTextAutosizer.get(); 5254 return m_fastTextAutosizer.get();
5255 } 5255 }
5256 5256
5257 } // namespace WebCore 5257 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/TreeScope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698