diff --git a/engine/core/dom/Element.cpp b/engine/core/dom/Element.cpp index 7ed41225758..f0b3e53e048 100644 --- a/engine/core/dom/Element.cpp +++ b/engine/core/dom/Element.cpp @@ -902,17 +902,12 @@ PassRefPtr Element::styleForRenderer() { ASSERT(document().inStyleRecalc()); - RefPtr style; - // FIXME: Instead of clearing updates that may have been added from calls to styleForElement // outside recalcStyle, we should just never set them if we're not inside recalcStyle. if (ActiveAnimations* activeAnimations = this->activeAnimations()) activeAnimations->cssAnimations().setPendingUpdate(nullptr); - if (hasCustomStyleCallbacks()) - style = customStyleForRenderer(); - if (!style) - style = originalStyleForRenderer(); + RefPtr style = document().ensureStyleResolver().styleForElement(this); ASSERT(style); // styleForElement() might add active animations so we need to get it again. @@ -930,19 +925,13 @@ PassRefPtr Element::styleForRenderer() return style.release(); } -PassRefPtr Element::originalStyleForRenderer() -{ - ASSERT(document().inStyleRecalc()); - return document().ensureStyleResolver().styleForElement(this); -} - void Element::recalcStyle(StyleRecalcChange change, Text* nextTextSibling) { ASSERT(document().inStyleRecalc()); ASSERT(!parentOrShadowHostNode()->needsStyleRecalc()); - if (hasCustomStyleCallbacks()) - willRecalcStyle(change); + if (isInsertionPoint()) + toInsertionPoint(this)->willRecalcStyle(change); if (change >= Inherit || needsStyleRecalc()) { if (hasRareData()) { @@ -965,9 +954,6 @@ void Element::recalcStyle(StyleRecalcChange change, Text* nextTextSibling) clearChildNeedsStyleRecalc(); } - if (hasCustomStyleCallbacks()) - didRecalcStyle(change); - if (change == Reattach) reattachWhitespaceSiblings(nextTextSibling); } @@ -1673,23 +1659,6 @@ void Element::setSavedLayerScrollOffset(const IntSize& size) ensureElementRareData().setSavedLayerScrollOffset(size); } -void Element::willRecalcStyle(StyleRecalcChange) -{ - ASSERT(hasCustomStyleCallbacks()); -} - -void Element::didRecalcStyle(StyleRecalcChange) -{ - ASSERT(hasCustomStyleCallbacks()); -} - - -PassRefPtr Element::customStyleForRenderer() -{ - ASSERT(hasCustomStyleCallbacks()); - return nullptr; -} - void Element::cloneAttributesFromElement(const Element& other) { other.synchronizeAllAttributes(); diff --git a/engine/core/dom/Element.h b/engine/core/dom/Element.h index 58551f60fcc..f0c77cd3f63 100644 --- a/engine/core/dom/Element.h +++ b/engine/core/dom/Element.h @@ -315,10 +315,6 @@ protected: virtual void removedFrom(ContainerNode*) override; virtual void childrenChanged(const ChildrenChange&) override; - virtual void willRecalcStyle(StyleRecalcChange); - virtual void didRecalcStyle(StyleRecalcChange); - virtual PassRefPtr customStyleForRenderer(); - void clearTabIndexExplicitlyIfNeeded(); void setTabIndexExplicitly(short); // Subclasses may override this method to affect focusability. Unlike @@ -337,8 +333,6 @@ protected: // svgAttributeChanged (called when element.className.baseValue is set) void classAttributeChanged(const AtomicString& newClassString); - PassRefPtr originalStyleForRenderer(); - private: void attributeChanged(const QualifiedName&, const AtomicString&, AttributeModificationReason = ModifiedDirectly); diff --git a/engine/core/dom/Node.h b/engine/core/dom/Node.h index 0994031bbf0..f569d596f7c 100644 --- a/engine/core/dom/Node.h +++ b/engine/core/dom/Node.h @@ -214,8 +214,6 @@ public: bool isShadowRoot() const { return isDocumentFragment() && isTreeScope(); } bool isInsertionPoint() const { return getFlag(IsInsertionPointFlag); } - bool hasCustomStyleCallbacks() const { return getFlag(HasCustomStyleCallbacksFlag); } - // If this node is in a shadow tree, returns its shadow host. Otherwise, returns 0. Element* shadowHost() const; ShadowRoot* containingShadowRoot() const; @@ -596,9 +594,8 @@ private: // Flags related to recalcStyle. - // FIXME(sky): Flags 12 and 13 are free. + // FIXME(sky): Flags 12-14 are free. - HasCustomStyleCallbacksFlag = 1 << 14, ChildNeedsStyleInvalidationFlag = 1 << 15, NeedsStyleInvalidationFlag = 1 << 16, ChildNeedsDistributionRecalcFlag = 1 << 17, @@ -617,7 +614,7 @@ private: DefaultNodeFlags = ChildNeedsStyleRecalcFlag | NeedsReattachStyleChange }; - // 6 bits remaining. + // 7 bits remaining. bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } void setFlag(bool f, NodeFlags mask) { m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); } @@ -658,8 +655,6 @@ protected: void clearEventTargetData(); #endif - void setHasCustomStyleCallbacks() { setFlag(true, HasCustomStyleCallbacksFlag); } - void setTreeScope(TreeScope* scope) { m_treeScope = scope; } // isTreeScopeInitialized() can be false diff --git a/engine/core/dom/shadow/InsertionPoint.cpp b/engine/core/dom/shadow/InsertionPoint.cpp index 07aab073e9a..1f35f0df858 100644 --- a/engine/core/dom/shadow/InsertionPoint.cpp +++ b/engine/core/dom/shadow/InsertionPoint.cpp @@ -43,7 +43,6 @@ InsertionPoint::InsertionPoint(const QualifiedName& tagName, Document& document) : HTMLElement(tagName, document, CreateInsertionPoint) , m_registeredWithShadowRoot(false) { - setHasCustomStyleCallbacks(); } InsertionPoint::~InsertionPoint() @@ -239,12 +238,6 @@ void InsertionPoint::removedFrom(ContainerNode* insertionPoint) HTMLElement::removedFrom(insertionPoint); } -void InsertionPoint::trace(Visitor* visitor) -{ - visitor->trace(m_distribution); - HTMLElement::trace(visitor); -} - const InsertionPoint* resolveReprojection(const Node* projectedNode) { ASSERT(projectedNode); diff --git a/engine/core/dom/shadow/InsertionPoint.h b/engine/core/dom/shadow/InsertionPoint.h index fa6c48fe4b4..c17063c06fc 100644 --- a/engine/core/dom/shadow/InsertionPoint.h +++ b/engine/core/dom/shadow/InsertionPoint.h @@ -67,7 +67,7 @@ public: Node* nextTo(const Node* node) const { return m_distribution.nextTo(node); } Node* previousTo(const Node* node) const { return m_distribution.previousTo(node); } - virtual void trace(Visitor*) override; + void willRecalcStyle(StyleRecalcChange); protected: InsertionPoint(const QualifiedName&, Document&); @@ -75,7 +75,6 @@ protected: virtual void childrenChanged(const ChildrenChange&) override; virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; virtual void removedFrom(ContainerNode*) override; - virtual void willRecalcStyle(StyleRecalcChange) override; private: bool isInsertionPoint() const = delete; // This will catch anyone doing an unnecessary check. diff --git a/engine/core/dom/shadow/ShadowRoot.cpp b/engine/core/dom/shadow/ShadowRoot.cpp index c8e63f0e3d4..c8dd7b2bb9f 100644 --- a/engine/core/dom/shadow/ShadowRoot.cpp +++ b/engine/core/dom/shadow/ShadowRoot.cpp @@ -105,9 +105,6 @@ PassRefPtr ShadowRoot::cloneNode(bool, ExceptionState& exceptionState) void ShadowRoot::recalcStyle(StyleRecalcChange change) { - // ShadowRoot doesn't support custom callbacks. - ASSERT(!hasCustomStyleCallbacks()); - if (styleChangeType() >= SubtreeStyleChange) change = Force;