This source file includes following definitions.
- m_useCounter
- m_useCounter
- m_useCounter
- strictCSSParserContext
- completeURL
#include "config.h"
#include "core/css/CSSParserMode.h"
#include "core/dom/Document.h"
#include "core/frame/Settings.h"
namespace WebCore {
CSSParserContext::CSSParserContext(CSSParserMode mode, UseCounter* useCounter)
: m_mode(mode)
, m_isHTMLDocument(false)
, m_useLegacyBackgroundSizeShorthandBehavior(false)
, m_useCounter(useCounter)
{
}
CSSParserContext::CSSParserContext(const Document& document, UseCounter* useCounter, const KURL& baseURL, const String& charset)
: m_baseURL(baseURL.isNull() ? document.baseURL() : baseURL)
, m_charset(charset)
, m_mode(document.inQuirksMode() ? HTMLQuirksMode : HTMLStandardMode)
, m_isHTMLDocument(document.isHTMLDocument())
, m_useLegacyBackgroundSizeShorthandBehavior(document.settings() ? document.settings()->useLegacyBackgroundSizeShorthandBehavior() : false)
, m_useCounter(useCounter)
{
}
CSSParserContext::CSSParserContext(const CSSParserContext& other, UseCounter* useCounter)
: m_baseURL(other.m_baseURL)
, m_charset(other.m_charset)
, m_mode(other.m_mode)
, m_isHTMLDocument(other.m_isHTMLDocument)
, m_useLegacyBackgroundSizeShorthandBehavior(other.m_useLegacyBackgroundSizeShorthandBehavior)
, m_useCounter(useCounter)
{
}
bool CSSParserContext::operator==(const CSSParserContext& other) const
{
return m_baseURL == other.m_baseURL
&& m_charset == other.m_charset
&& m_mode == other.m_mode
&& m_isHTMLDocument == other.m_isHTMLDocument
&& m_useLegacyBackgroundSizeShorthandBehavior == other.m_useLegacyBackgroundSizeShorthandBehavior;
}
const CSSParserContext& strictCSSParserContext()
{
DEFINE_STATIC_LOCAL(CSSParserContext, strictContext, (HTMLStandardMode, 0));
return strictContext;
}
KURL CSSParserContext::completeURL(const String& url) const
{
if (url.isNull())
return KURL();
if (charset().isEmpty())
return KURL(baseURL(), url);
return KURL(baseURL(), url, charset());
}
}