From 689b91c36dad81e944a1c07db8b0c57fb4f8cbda Mon Sep 17 00:00:00 2001 From: Elliott Sprehn Date: Mon, 12 Jan 2015 18:23:55 -0800 Subject: [PATCH] Replace sheet change methods with styleResolverChanged. Unlike blink in sky we just want to mark tree scopes dirty. We can remove these methods, the dirty tree scope tracking we'll add in the future will take care of this. R=ojan@chromium.org Review URL: https://codereview.chromium.org/836893003 --- engine/core/css/CSSStyleSheet.cpp | 2 +- engine/core/dom/Document.cpp | 16 ---------------- engine/core/dom/Document.h | 6 ------ engine/core/html/HTMLStyleElement.cpp | 4 ++-- 4 files changed, 3 insertions(+), 25 deletions(-) diff --git a/engine/core/css/CSSStyleSheet.cpp b/engine/core/css/CSSStyleSheet.cpp index 536b622d902..94fb4c51b2f 100644 --- a/engine/core/css/CSSStyleSheet.cpp +++ b/engine/core/css/CSSStyleSheet.cpp @@ -78,7 +78,7 @@ void CSSStyleSheet::setMediaQueries(PassRefPtr mediaQueries) void CSSStyleSheet::clearOwnerNode() { if (Document* owner = ownerDocument()) - owner->modifiedStyleSheet(this); + owner->styleResolverChanged(); m_ownerNode = nullptr; } diff --git a/engine/core/dom/Document.cpp b/engine/core/dom/Document.cpp index 7d9068547ac..a3965deea32 100644 --- a/engine/core/dom/Document.cpp +++ b/engine/core/dom/Document.cpp @@ -2620,22 +2620,6 @@ DocumentLifecycleNotifier& Document::lifecycleNotifier() return static_cast(LifecycleContext::lifecycleNotifier()); } -void Document::removedStyleSheet(CSSStyleSheet* sheet) -{ - // If we're in document teardown, then we don't need this notification of our sheet's removal. - // styleResolverChanged() is needed even when the document is inactive so that - // imported docuements (which is inactive) notifies the change to the master document. - styleResolverChanged(); -} - -void Document::modifiedStyleSheet(CSSStyleSheet* sheet) -{ - // If we're in document teardown, then we don't need this notification of our sheet's removal. - // styleResolverChanged() is needed even when the document is inactive so that - // imported docuements (which is inactive) notifies the change to the master document. - styleResolverChanged(); -} - Element* Document::activeElement() const { if (Element* element = treeScope().adjustedFocusedElement()) diff --git a/engine/core/dom/Document.h b/engine/core/dom/Document.h index cb45790ccfc..741588fb759 100644 --- a/engine/core/dom/Document.h +++ b/engine/core/dom/Document.h @@ -237,12 +237,6 @@ public: // Called when one or more stylesheets in the document may have been added, removed, or changed. void styleResolverChanged(); - // FIXME: Switch all callers of styleResolverChanged to these or better ones and then make them - // do something smarter. - void removedStyleSheet(CSSStyleSheet*); - void addedStyleSheet(CSSStyleSheet*) { styleResolverChanged(); } - void modifiedStyleSheet(CSSStyleSheet*); - void evaluateMediaQueryList(); void setStateForNewFormElements(const Vector&); diff --git a/engine/core/html/HTMLStyleElement.cpp b/engine/core/html/HTMLStyleElement.cpp index 13501168ff7..aade005816b 100644 --- a/engine/core/html/HTMLStyleElement.cpp +++ b/engine/core/html/HTMLStyleElement.cpp @@ -59,7 +59,7 @@ void HTMLStyleElement::parseAttribute(const QualifiedName& name, const AtomicStr { if (name == HTMLNames::mediaAttr && inDocument() && document().isActive() && m_sheet) { m_sheet->setMediaQueries(MediaQuerySet::create(value)); - document().modifiedStyleSheet(m_sheet.get()); + document().styleResolverChanged(); } else { HTMLElement::parseAttribute(name, value); } @@ -91,7 +91,7 @@ void HTMLStyleElement::removedFrom(ContainerNode* insertionPoint) if (m_sheet) clearSheet(); if (removedSheet) - document().removedStyleSheet(removedSheet.get()); + document().styleResolverChanged(); } void HTMLStyleElement::childrenChanged(const ChildrenChange& change)