| 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/CSSParserMode.h" | 28 #include "core/css/CSSParserMode.h" |
| 29 | 29 |
| 30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
| 31 #include "core/dom/TreeScope.h" |
| 31 #include "core/frame/Settings.h" | 32 #include "core/frame/Settings.h" |
| 32 | 33 |
| 33 namespace WebCore { | 34 namespace WebCore { |
| 34 | 35 |
| 35 CSSParserContext::CSSParserContext(CSSParserMode mode) | 36 CSSParserContext::CSSParserContext(CSSParserMode mode) |
| 36 : m_mode(mode) | 37 : m_mode(mode) |
| 37 , m_isHTMLDocument(false) | 38 , m_isHTMLDocument(false) |
| 38 , m_useLegacyBackgroundSizeShorthandBehavior(false) | 39 , m_useLegacyBackgroundSizeShorthandBehavior(false) |
| 39 { | 40 { |
| 40 } | 41 } |
| 41 | 42 |
| 42 CSSParserContext::CSSParserContext(const Document& document, const KURL& baseURL
, const String& charset) | 43 CSSParserContext::CSSParserContext(const TreeScope& treeScope, const KURL& baseU
RL, const String& charset) |
| 43 : m_baseURL(baseURL.isNull() ? document.baseURL() : baseURL) | 44 : m_baseURL(baseURL.isNull() ? treeScope.baseURL() : baseURL) |
| 44 , m_charset(charset) | 45 , m_charset(charset) |
| 45 , m_mode(document.inQuirksMode() ? HTMLQuirksMode : HTMLStandardMode) | 46 , m_mode(treeScope.document().inQuirksMode() ? HTMLQuirksMode : HTMLStandard
Mode) |
| 46 , m_isHTMLDocument(document.isHTMLDocument()) | 47 , m_isHTMLDocument(treeScope.document().isHTMLDocument()) |
| 47 , m_useLegacyBackgroundSizeShorthandBehavior(document.settings() ? document.
settings()->useLegacyBackgroundSizeShorthandBehavior() : false) | 48 , m_useLegacyBackgroundSizeShorthandBehavior(treeScope.document().settings()
? treeScope.document().settings()->useLegacyBackgroundSizeShorthandBehavior() :
false) |
| 48 { | 49 { |
| 49 } | 50 } |
| 50 | 51 |
| 51 bool CSSParserContext::operator==(const CSSParserContext& other) const | 52 bool CSSParserContext::operator==(const CSSParserContext& other) const |
| 52 { | 53 { |
| 53 return m_baseURL == other.m_baseURL | 54 return m_baseURL == other.m_baseURL |
| 54 && m_charset == other.m_charset | 55 && m_charset == other.m_charset |
| 55 && m_mode == other.m_mode | 56 && m_mode == other.m_mode |
| 56 && m_isHTMLDocument == other.m_isHTMLDocument | 57 && m_isHTMLDocument == other.m_isHTMLDocument |
| 57 && m_useLegacyBackgroundSizeShorthandBehavior == other.m_useLegacyBackgr
oundSizeShorthandBehavior; | 58 && m_useLegacyBackgroundSizeShorthandBehavior == other.m_useLegacyBackgr
oundSizeShorthandBehavior; |
| 58 } | 59 } |
| 59 | 60 |
| 60 const CSSParserContext& strictCSSParserContext() | 61 const CSSParserContext& strictCSSParserContext() |
| 61 { | 62 { |
| 62 DEFINE_STATIC_LOCAL(CSSParserContext, strictContext, (HTMLStandardMode)); | 63 DEFINE_STATIC_LOCAL(CSSParserContext, strictContext, (HTMLStandardMode)); |
| 63 return strictContext; | 64 return strictContext; |
| 64 } | 65 } |
| 65 | 66 |
| 66 KURL CSSParserContext::completeURL(const String& url) const | 67 KURL CSSParserContext::completeURL(const String& url) const |
| 67 { | 68 { |
| 68 if (url.isNull()) | 69 if (url.isNull()) |
| 69 return KURL(); | 70 return KURL(); |
| 70 if (charset().isEmpty()) | 71 if (charset().isEmpty()) |
| 71 return KURL(baseURL(), url); | 72 return KURL(baseURL(), url); |
| 72 return KURL(baseURL(), url, charset()); | 73 return KURL(baseURL(), url, charset()); |
| 73 } | 74 } |
| 74 | 75 |
| 75 | 76 |
| 76 } // namespace WebCore | 77 } // namespace WebCore |
| OLD | NEW |