#include "config.h"
#include "core/css/CSSStyleSheet.h"
-#include "HTMLNames.h"
-#include "SVGNames.h"
-#include "bindings/v8/ExceptionState.h"
-#include "bindings/v8/V8PerIsolateData.h"
+#include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/V8Binding.h"
+#include "bindings/core/v8/V8PerIsolateData.h"
+#include "core/HTMLNames.h"
+#include "core/SVGNames.h"
#include "core/css/CSSCharsetRule.h"
#include "core/css/CSSImportRule.h"
-#include "core/css/parser/BisonCSSParser.h"
#include "core/css/CSSRuleList.h"
#include "core/css/MediaList.h"
#include "core/css/StyleRule.h"
#include "core/css/StyleSheetContents.h"
+#include "core/css/parser/CSSParser.h"
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/Node.h"
#include "platform/weborigin/SecurityOrigin.h"
#include "wtf/text/StringBuilder.h"
-namespace WebCore {
+namespace blink {
-class StyleSheetCSSRuleList FINAL : public CSSRuleList {
+class StyleSheetCSSRuleList final : public CSSRuleList {
public:
static PassOwnPtrWillBeRawPtr<StyleSheetCSSRuleList> create(CSSStyleSheet* sheet)
{
return adoptPtrWillBeNoop(new StyleSheetCSSRuleList(sheet));
}
- virtual void trace(Visitor* visitor) OVERRIDE
+ virtual void trace(Visitor* visitor) override
{
visitor->trace(m_styleSheet);
+ CSSRuleList::trace(visitor);
}
private:
StyleSheetCSSRuleList(CSSStyleSheet* sheet) : m_styleSheet(sheet) { }
#if !ENABLE(OILPAN)
- virtual void ref() OVERRIDE { m_styleSheet->ref(); }
- virtual void deref() OVERRIDE { m_styleSheet->deref(); }
+ virtual void ref() override { m_styleSheet->ref(); }
+ virtual void deref() override { m_styleSheet->deref(); }
#endif
- virtual unsigned length() const OVERRIDE { return m_styleSheet->length(); }
- virtual CSSRule* item(unsigned index) const OVERRIDE { return m_styleSheet->item(index); }
+ virtual unsigned length() const override { return m_styleSheet->length(); }
+ virtual CSSRule* item(unsigned index) const override { return m_styleSheet->item(index); }
- virtual CSSStyleSheet* styleSheet() const OVERRIDE { return m_styleSheet; }
+ virtual CSSStyleSheet* styleSheet() const override { return m_styleSheet; }
RawPtrWillBeMember<CSSStyleSheet> m_styleSheet;
};
-#if !ASSERT_DISABLED
+#if ENABLE(ASSERT)
static bool isAcceptableCSSStyleSheetParent(Node* parentNode)
{
- // Only these nodes can be parents of StyleSheets, and they need to call clearOwnerNode() when moved out of document.
+ // Only these nodes can be parents of StyleSheets, and they need to call
+ // clearOwnerNode() when moved out of document.
+ // Destruction of the style sheet counts as being "moved out of the
+ // document", but only in the non-oilpan version of blink. I.e. don't call
+ // clearOwnerNode() in the owner's destructor in oilpan.
return !parentNode
|| parentNode->isDocumentNode()
|| isHTMLLinkElement(*parentNode)
: m_contents(contents)
, m_isInlineStylesheet(false)
, m_isDisabled(false)
- , m_ownerNode(0)
+ , m_ownerNode(nullptr)
, m_ownerRule(ownerRule)
, m_startPosition(TextPosition::minimumPosition())
, m_loadCompleted(false)
// Need FullStyleUpdate when insertRule or deleteRule,
// because StyleSheetCollection::analyzeStyleSheetChange cannot detect partial rule update.
StyleResolverUpdateMode updateMode = updateType != PartialRuleUpdate ? AnalyzedStyleUpdate : FullStyleUpdate;
- owner->modifiedStyleSheet(this, RecalcStyleDeferred, updateMode);
+ owner->modifiedStyleSheet(this, updateMode);
}
void CSSStyleSheet::reattachChildRuleCSSOMWrappers()
didMutate(EntireStyleSheetUpdate);
if (m_ownerNode)
m_contents->unregisterClient(this);
- m_ownerNode = 0;
+ m_ownerNode = nullptr;
}
bool CSSStyleSheet::canAccessRules() const
return 0;
}
CSSParserContext context(m_contents->parserContext(), UseCounter::getFrom(this));
- BisonCSSParser p(context);
- RefPtrWillBeRawPtr<StyleRuleBase> rule = p.parseRule(m_contents.get(), ruleString);
+ RefPtrWillBeRawPtr<StyleRuleBase> rule = CSSParser::parseRule(context, m_contents.get(), ruleString);
if (!rule) {
exceptionState.throwDOMException(SyntaxError, "Failed to parse the rule '" + ruleString + "'.");
{
visitor->trace(m_contents);
visitor->trace(m_mediaQueries);
+ visitor->trace(m_ownerNode);
visitor->trace(m_ownerRule);
visitor->trace(m_mediaCSSOMWrapper);
visitor->trace(m_childRuleCSSOMWrappers);
visitor->trace(m_ruleListCSSOMWrapper);
+ StyleSheet::trace(visitor);
}
-}
+} // namespace blink