| OLD | NEW | 
|    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.
      All rights reserved. |    4  * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
      All rights reserved. | 
|    5  * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |    5  * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 
|    6  * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |    6  * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 
|    7  * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
     bile.com/) |    7  * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
     bile.com/) | 
|    8  * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |    8  * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 
|    9  * Copyright (C) 2012 Intel Corporation. All rights reserved. |    9  * Copyright (C) 2012 Intel Corporation. All rights reserved. | 
|   10  * |   10  * | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
|   21  * You should have received a copy of the GNU Library General Public License |   21  * You should have received a copy of the GNU Library General Public License | 
|   22  * along with this library; see the file COPYING.LIB.  If not, write to |   22  * along with this library; see the file COPYING.LIB.  If not, write to | 
|   23  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |   23  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 
|   24  * Boston, MA 02110-1301, USA. |   24  * Boston, MA 02110-1301, USA. | 
|   25  */ |   25  */ | 
|   26  |   26  | 
|   27 #include "config.h" |   27 #include "config.h" | 
|   28 #include "core/css/parser/CSSParserMode.h" |   28 #include "core/css/parser/CSSParserMode.h" | 
|   29  |   29  | 
|   30 #include "core/dom/Document.h" |   30 #include "core/dom/Document.h" | 
|   31 #include "core/frame/LocalFrame.h" |  | 
|   32 #include "core/frame/Settings.h" |   31 #include "core/frame/Settings.h" | 
|   33 #include "core/frame/csp/ContentSecurityPolicy.h" |   32 #include "core/frame/csp/ContentSecurityPolicy.h" | 
|   34  |   33  | 
|   35 namespace blink { |   34 namespace blink { | 
|   36  |   35  | 
|   37 CSSParserContext::CSSParserContext(CSSParserMode mode, UseCounter* useCounter) |   36 CSSParserContext::CSSParserContext(CSSParserMode mode, UseCounter* useCounter) | 
|   38     : m_mode(mode) |   37     : m_mode(mode) | 
|   39     , m_isHTMLDocument(false) |   38     , m_isHTMLDocument(false) | 
|   40     , m_useLegacyBackgroundSizeShorthandBehavior(false) |   39     , m_useLegacyBackgroundSizeShorthandBehavior(false) | 
|   41     , m_shouldCheckContentSecurityPolicy(DoNotCheckContentSecurityPolicy) |   40     , m_shouldCheckContentSecurityPolicy(DoNotCheckContentSecurityPolicy) | 
|   42     , m_useCounter(useCounter) |   41     , m_useCounter(useCounter) | 
|   43 { |   42 { | 
|   44 } |   43 } | 
|   45  |   44  | 
|   46 CSSParserContext::CSSParserContext(const Document& document, UseCounter* useCoun
     ter, const KURL& baseURL, const String& charset) |   45 CSSParserContext::CSSParserContext(const Document& document, UseCounter* useCoun
     ter, const KURL& baseURL, const String& charset) | 
|   47     : m_baseURL(baseURL.isNull() ? document.baseURL() : baseURL) |   46     : m_baseURL(baseURL.isNull() ? document.baseURL() : baseURL) | 
|   48     , m_charset(charset) |   47     , m_charset(charset) | 
|   49     , m_mode(document.inQuirksMode() ? HTMLQuirksMode : HTMLStandardMode) |   48     , m_mode(document.inQuirksMode() ? HTMLQuirksMode : HTMLStandardMode) | 
|   50     , m_referrer(m_baseURL.strippedForUseAsReferrer(), document.referrerPolicy()
     ) |   49     , m_referrer(m_baseURL.strippedForUseAsReferrer(), document.referrerPolicy()
     ) | 
|   51     , m_isHTMLDocument(document.isHTMLDocument()) |   50     , m_isHTMLDocument(document.isHTMLDocument()) | 
|   52     , m_useLegacyBackgroundSizeShorthandBehavior(document.settings() ? document.
     settings()->useLegacyBackgroundSizeShorthandBehavior() : false) |   51     , m_useLegacyBackgroundSizeShorthandBehavior(document.settings() ? document.
     settings()->useLegacyBackgroundSizeShorthandBehavior() : false) | 
|   53     , m_shouldCheckContentSecurityPolicy(DoNotCheckContentSecurityPolicy) |   52     , m_shouldCheckContentSecurityPolicy(DoNotCheckContentSecurityPolicy) | 
|   54     , m_useCounter(useCounter) |   53     , m_useCounter(useCounter) | 
|   55 { |   54 { | 
|   56     if (ContentSecurityPolicy::shouldBypassMainWorld(&document)) |   55     if (ContentSecurityPolicy::shouldBypassMainWorld(&document)) | 
|   57         m_shouldCheckContentSecurityPolicy = DoNotCheckContentSecurityPolicy; |   56         m_shouldCheckContentSecurityPolicy = DoNotCheckContentSecurityPolicy; | 
|   58     else |   57     else | 
|   59         m_shouldCheckContentSecurityPolicy = CheckContentSecurityPolicy; |   58         m_shouldCheckContentSecurityPolicy = CheckContentSecurityPolicy; | 
|   60     m_frame = document.frame(); |  | 
|   61 } |   59 } | 
|   62  |   60  | 
|   63 CSSParserContext::CSSParserContext(const CSSParserContext& other, LocalFrame* fr
     ame, UseCounter* useCounter) |   61 CSSParserContext::CSSParserContext(const CSSParserContext& other, UseCounter* us
     eCounter) | 
|   64     : m_baseURL(other.m_baseURL) |   62     : m_baseURL(other.m_baseURL) | 
|   65     , m_charset(other.m_charset) |   63     , m_charset(other.m_charset) | 
|   66     , m_mode(other.m_mode) |   64     , m_mode(other.m_mode) | 
|   67     , m_referrer(other.m_referrer) |   65     , m_referrer(other.m_referrer) | 
|   68     , m_isHTMLDocument(other.m_isHTMLDocument) |   66     , m_isHTMLDocument(other.m_isHTMLDocument) | 
|   69     , m_useLegacyBackgroundSizeShorthandBehavior(other.m_useLegacyBackgroundSize
     ShorthandBehavior) |   67     , m_useLegacyBackgroundSizeShorthandBehavior(other.m_useLegacyBackgroundSize
     ShorthandBehavior) | 
|   70     , m_shouldCheckContentSecurityPolicy(other.m_shouldCheckContentSecurityPolic
     y) |   68     , m_shouldCheckContentSecurityPolicy(other.m_shouldCheckContentSecurityPolic
     y) | 
|   71     , m_frame(frame) |  | 
|   72     , m_useCounter(useCounter) |   69     , m_useCounter(useCounter) | 
|   73 { |   70 { | 
|   74 } |   71 } | 
|   75  |   72  | 
|   76 CSSParserContext::~CSSParserContext() |  | 
|   77 { |  | 
|   78 } |  | 
|   79  |  | 
|   80 bool CSSParserContext::operator==(const CSSParserContext& other) const |   73 bool CSSParserContext::operator==(const CSSParserContext& other) const | 
|   81 { |   74 { | 
|   82     return m_baseURL == other.m_baseURL |   75     return m_baseURL == other.m_baseURL | 
|   83         && m_charset == other.m_charset |   76         && m_charset == other.m_charset | 
|   84         && m_mode == other.m_mode |   77         && m_mode == other.m_mode | 
|   85         && m_isHTMLDocument == other.m_isHTMLDocument |   78         && m_isHTMLDocument == other.m_isHTMLDocument | 
|   86         && m_useLegacyBackgroundSizeShorthandBehavior == other.m_useLegacyBackgr
     oundSizeShorthandBehavior |   79         && m_useLegacyBackgroundSizeShorthandBehavior == other.m_useLegacyBackgr
     oundSizeShorthandBehavior; | 
|   87         && m_frame == other.m_frame; |  | 
|   88 } |   80 } | 
|   89  |   81  | 
|   90 const CSSParserContext& strictCSSParserContext() |   82 const CSSParserContext& strictCSSParserContext() | 
|   91 { |   83 { | 
|   92     DEFINE_STATIC_LOCAL(CSSParserContext, strictContext, (HTMLStandardMode, 0)); |   84     DEFINE_STATIC_LOCAL(CSSParserContext, strictContext, (HTMLStandardMode, 0)); | 
|   93     return strictContext; |   85     return strictContext; | 
|   94 } |   86 } | 
|   95  |   87  | 
|   96 KURL CSSParserContext::completeURL(const String& url) const |   88 KURL CSSParserContext::completeURL(const String& url) const | 
|   97 { |   89 { | 
|   98     if (url.isNull()) |   90     if (url.isNull()) | 
|   99         return KURL(); |   91         return KURL(); | 
|  100     if (charset().isEmpty()) |   92     if (charset().isEmpty()) | 
|  101         return KURL(baseURL(), url); |   93         return KURL(baseURL(), url); | 
|  102     return KURL(baseURL(), url, charset()); |   94     return KURL(baseURL(), url, charset()); | 
|  103 } |   95 } | 
|  104  |   96  | 
|  105 } // namespace blink |   97 } // namespace blink | 
| OLD | NEW |