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

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

Issue 2493003003: Introduce CSS parser mode for distinguishing static/dynamic profile (Closed)
Patch Set: clean up Created 4 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) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
7 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 10 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
(...skipping 29 matching lines...) Expand all
40 : m_mode(mode), 40 : m_mode(mode),
41 m_matchMode(mode), 41 m_matchMode(mode),
42 m_isHTMLDocument(false), 42 m_isHTMLDocument(false),
43 m_useLegacyBackgroundSizeShorthandBehavior(false), 43 m_useLegacyBackgroundSizeShorthandBehavior(false),
44 m_shouldCheckContentSecurityPolicy(DoNotCheckContentSecurityPolicy), 44 m_shouldCheckContentSecurityPolicy(DoNotCheckContentSecurityPolicy),
45 m_useCounter(useCounter) {} 45 m_useCounter(useCounter) {}
46 46
47 CSSParserContext::CSSParserContext(const Document& document, 47 CSSParserContext::CSSParserContext(const Document& document,
48 UseCounter* useCounter, 48 UseCounter* useCounter,
49 const KURL& baseURL, 49 const KURL& baseURL,
50 const String& charset) 50 const String& charset,
51 Profile profile)
51 : m_baseURL(baseURL.isNull() ? document.baseURL() : baseURL), 52 : m_baseURL(baseURL.isNull() ? document.baseURL() : baseURL),
52 m_charset(charset), 53 m_charset(charset),
53 m_mode(document.inQuirksMode() ? HTMLQuirksMode : HTMLStandardMode), 54 m_mode(document.inQuirksMode() ? HTMLQuirksMode : HTMLStandardMode),
55 m_profile(profile),
54 m_referrer(m_baseURL.strippedForUseAsReferrer(), 56 m_referrer(m_baseURL.strippedForUseAsReferrer(),
55 document.getReferrerPolicy()), 57 document.getReferrerPolicy()),
56 m_isHTMLDocument(document.isHTMLDocument()), 58 m_isHTMLDocument(document.isHTMLDocument()),
57 m_useLegacyBackgroundSizeShorthandBehavior( 59 m_useLegacyBackgroundSizeShorthandBehavior(
58 document.settings() 60 document.settings()
59 ? document.settings()->useLegacyBackgroundSizeShorthandBehavior() 61 ? document.settings()->useLegacyBackgroundSizeShorthandBehavior()
60 : false), 62 : false),
61 m_shouldCheckContentSecurityPolicy(DoNotCheckContentSecurityPolicy), 63 m_shouldCheckContentSecurityPolicy(DoNotCheckContentSecurityPolicy),
62 m_useCounter(useCounter) { 64 m_useCounter(useCounter) {
63 if (ContentSecurityPolicy::shouldBypassMainWorld(&document)) 65 if (ContentSecurityPolicy::shouldBypassMainWorld(&document))
64 m_shouldCheckContentSecurityPolicy = DoNotCheckContentSecurityPolicy; 66 m_shouldCheckContentSecurityPolicy = DoNotCheckContentSecurityPolicy;
65 else 67 else
66 m_shouldCheckContentSecurityPolicy = CheckContentSecurityPolicy; 68 m_shouldCheckContentSecurityPolicy = CheckContentSecurityPolicy;
67 69
68 if (HTMLImportsController* importsController = document.importsController()) 70 if (HTMLImportsController* importsController = document.importsController())
69 m_matchMode = importsController->master()->inQuirksMode() 71 m_matchMode = importsController->master()->inQuirksMode()
70 ? HTMLQuirksMode 72 ? HTMLQuirksMode
71 : HTMLStandardMode; 73 : HTMLStandardMode;
72 else 74 else
73 m_matchMode = m_mode; 75 m_matchMode = m_mode;
74 } 76 }
75 77
76 CSSParserContext::CSSParserContext(const CSSParserContext& other, 78 CSSParserContext::CSSParserContext(const CSSParserContext& other,
Timothy Loh 2016/11/15 02:27:07 Technically we should update the copy ctor and ope
kochi 2016/11/15 04:24:38 Good catch, done.
77 UseCounter* useCounter) 79 UseCounter* useCounter)
78 : m_baseURL(other.m_baseURL), 80 : m_baseURL(other.m_baseURL),
79 m_charset(other.m_charset), 81 m_charset(other.m_charset),
80 m_mode(other.m_mode), 82 m_mode(other.m_mode),
81 m_matchMode(other.m_matchMode), 83 m_matchMode(other.m_matchMode),
82 m_referrer(other.m_referrer), 84 m_referrer(other.m_referrer),
83 m_isHTMLDocument(other.m_isHTMLDocument), 85 m_isHTMLDocument(other.m_isHTMLDocument),
84 m_useLegacyBackgroundSizeShorthandBehavior( 86 m_useLegacyBackgroundSizeShorthandBehavior(
85 other.m_useLegacyBackgroundSizeShorthandBehavior), 87 other.m_useLegacyBackgroundSizeShorthandBehavior),
86 m_shouldCheckContentSecurityPolicy( 88 m_shouldCheckContentSecurityPolicy(
(...skipping 16 matching lines...) Expand all
103 105
104 KURL CSSParserContext::completeURL(const String& url) const { 106 KURL CSSParserContext::completeURL(const String& url) const {
105 if (url.isNull()) 107 if (url.isNull())
106 return KURL(); 108 return KURL();
107 if (charset().isEmpty()) 109 if (charset().isEmpty())
108 return KURL(baseURL(), url); 110 return KURL(baseURL(), url);
109 return KURL(baseURL(), url, charset()); 111 return KURL(baseURL(), url, charset());
110 } 112 }
111 113
112 } // namespace blink 114 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698