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

Side by Side Diff: third_party/WebKit/Source/core/css/StyleRuleImport.cpp

Issue 2777433003: Remove base URL, referrer, and charset setters from CSSParserContext (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/parser/CSSParserContext.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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010, 2012 Apple Inc. All rights 4 * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010, 2012 Apple Inc. All rights
5 * reserved. 5 * reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 void StyleRuleImport::setCSSStyleSheet( 67 void StyleRuleImport::setCSSStyleSheet(
68 const String& href, 68 const String& href,
69 const KURL& baseURL, 69 const KURL& baseURL,
70 const String& charset, 70 const String& charset,
71 const CSSStyleSheetResource* cachedStyleSheet) { 71 const CSSStyleSheetResource* cachedStyleSheet) {
72 if (m_styleSheet) 72 if (m_styleSheet)
73 m_styleSheet->clearOwnerRule(); 73 m_styleSheet->clearOwnerRule();
74 74
75 CSSParserContext* context = CSSParserContext::create( 75 Document* document = nullptr;
76 m_parentStyleSheet ? m_parentStyleSheet->parserContext() 76 const CSSParserContext* context = strictCSSParserContext();
77 : strictCSSParserContext(), 77 if (m_parentStyleSheet) {
78 nullptr); 78 document = m_parentStyleSheet->singleOwnerDocument();
79 context->setCharset(charset); 79 context = m_parentStyleSheet->parserContext();
80 Document* document =
81 m_parentStyleSheet ? m_parentStyleSheet->singleOwnerDocument() : nullptr;
82 if (!baseURL.isNull()) {
83 context->setBaseURL(baseURL);
84 if (document) {
85 context->setReferrer(Referrer(baseURL.strippedForUseAsReferrer(),
86 document->getReferrerPolicy()));
87 }
88 } 80 }
81 context = CSSParserContext::create(
82 context, baseURL, charset,
83 (!baseURL.isNull() && document)
84 ? Referrer(baseURL.strippedForUseAsReferrer(),
85 document->getReferrerPolicy())
86 : context->referrer(),
87 document);
89 88
90 m_styleSheet = StyleSheetContents::create(this, href, context); 89 m_styleSheet = StyleSheetContents::create(this, href, context);
91 90
92 m_styleSheet->parseAuthorStyleSheet( 91 m_styleSheet->parseAuthorStyleSheet(
93 cachedStyleSheet, document ? document->getSecurityOrigin() : 0); 92 cachedStyleSheet, document ? document->getSecurityOrigin() : 0);
94 93
95 m_loading = false; 94 m_loading = false;
96 95
97 if (m_parentStyleSheet) { 96 if (m_parentStyleSheet) {
98 m_parentStyleSheet->notifyLoadedSheet(cachedStyleSheet); 97 m_parentStyleSheet->notifyLoadedSheet(cachedStyleSheet);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // the sheet being imported is pending. 143 // the sheet being imported is pending.
145 if (m_parentStyleSheet && m_parentStyleSheet->loadCompleted() && 144 if (m_parentStyleSheet && m_parentStyleSheet->loadCompleted() &&
146 rootSheet == m_parentStyleSheet) 145 rootSheet == m_parentStyleSheet)
147 m_parentStyleSheet->startLoadingDynamicSheet(); 146 m_parentStyleSheet->startLoadingDynamicSheet();
148 m_loading = true; 147 m_loading = true;
149 m_resource->addClient(m_styleSheetClient); 148 m_resource->addClient(m_styleSheetClient);
150 } 149 }
151 } 150 }
152 151
153 } // namespace blink 152 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/parser/CSSParserContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698