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

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

Issue 2580793005: Split the CSSParserContext class out of CSSParserMode into its own file. (Closed)
Patch Set: fix compile Created 3 years, 12 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
OLDNEW
1 /* 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) 2 // Use of this source code is governed by a BSD-style license that can be
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 // found in the LICENSE file.
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
5 * All rights reserved.
6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
7 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
11 * Copyright (C) 2012 Intel Corporation. All rights reserved.
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details.
22 *
23 * You should have received a copy of the GNU Library General Public License
24 * along with this library; see the file COPYING.LIB. If not, write to
25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 * Boston, MA 02110-1301, USA.
27 */
28 4
29 #include "core/css/parser/CSSParserMode.h" 5 #include "core/css/parser/CSSParserContext.h"
30 6
31 #include "core/dom/Document.h"
32 #include "core/frame/Settings.h" 7 #include "core/frame/Settings.h"
33 #include "core/frame/csp/ContentSecurityPolicy.h" 8 #include "core/frame/csp/ContentSecurityPolicy.h"
34 #include "core/html/imports/HTMLImportTreeRoot.h"
35 #include "core/html/imports/HTMLImportsController.h" 9 #include "core/html/imports/HTMLImportsController.h"
36 10
37 namespace blink { 11 namespace blink {
38 12
39 CSSParserContext::CSSParserContext(CSSParserMode mode, 13 CSSParserContext::CSSParserContext(CSSParserMode mode,
40 UseCounter* useCounter, 14 UseCounter* useCounter,
41 SelectorProfile profile) 15 SelectorProfile profile)
42 : m_mode(mode), 16 : m_mode(mode),
43 m_matchMode(mode), 17 m_matchMode(mode),
44 m_profile(profile), 18 m_profile(profile),
(...skipping 18 matching lines...) Expand all
63 document.settings() 37 document.settings()
64 ? document.settings()->useLegacyBackgroundSizeShorthandBehavior() 38 ? document.settings()->useLegacyBackgroundSizeShorthandBehavior()
65 : false), 39 : false),
66 m_shouldCheckContentSecurityPolicy(DoNotCheckContentSecurityPolicy), 40 m_shouldCheckContentSecurityPolicy(DoNotCheckContentSecurityPolicy),
67 m_useCounter(useCounter) { 41 m_useCounter(useCounter) {
68 if (ContentSecurityPolicy::shouldBypassMainWorld(&document)) 42 if (ContentSecurityPolicy::shouldBypassMainWorld(&document))
69 m_shouldCheckContentSecurityPolicy = DoNotCheckContentSecurityPolicy; 43 m_shouldCheckContentSecurityPolicy = DoNotCheckContentSecurityPolicy;
70 else 44 else
71 m_shouldCheckContentSecurityPolicy = CheckContentSecurityPolicy; 45 m_shouldCheckContentSecurityPolicy = CheckContentSecurityPolicy;
72 46
73 if (HTMLImportsController* importsController = document.importsController()) 47 if (HTMLImportsController* importsController = document.importsController()) {
74 m_matchMode = importsController->master()->inQuirksMode() 48 m_matchMode = importsController->master()->inQuirksMode()
75 ? HTMLQuirksMode 49 ? HTMLQuirksMode
76 : HTMLStandardMode; 50 : HTMLStandardMode;
77 else 51 } else {
78 m_matchMode = m_mode; 52 m_matchMode = m_mode;
53 }
79 } 54 }
80 55
81 CSSParserContext::CSSParserContext(const CSSParserContext& other, 56 CSSParserContext::CSSParserContext(const CSSParserContext& other,
82 UseCounter* useCounter) 57 UseCounter* useCounter)
83 : m_baseURL(other.m_baseURL), 58 : m_baseURL(other.m_baseURL),
84 m_charset(other.m_charset), 59 m_charset(other.m_charset),
85 m_mode(other.m_mode), 60 m_mode(other.m_mode),
86 m_matchMode(other.m_matchMode), 61 m_matchMode(other.m_matchMode),
87 m_profile(other.m_profile), 62 m_profile(other.m_profile),
88 m_referrer(other.m_referrer), 63 m_referrer(other.m_referrer),
(...skipping 21 matching lines...) Expand all
110 85
111 KURL CSSParserContext::completeURL(const String& url) const { 86 KURL CSSParserContext::completeURL(const String& url) const {
112 if (url.isNull()) 87 if (url.isNull())
113 return KURL(); 88 return KURL();
114 if (charset().isEmpty()) 89 if (charset().isEmpty())
115 return KURL(baseURL(), url); 90 return KURL(baseURL(), url);
116 return KURL(baseURL(), url, charset()); 91 return KURL(baseURL(), url, charset());
117 } 92 }
118 93
119 } // namespace blink 94 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698