Remove custom style callbacks.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/709573002
This commit is contained in:
Elliott Sprehn 2014-11-06 15:16:41 -08:00
parent f79b479bc4
commit 0d95d6d59e
6 changed files with 6 additions and 59 deletions

View File

@ -902,17 +902,12 @@ PassRefPtr<RenderStyle> Element::styleForRenderer()
{
ASSERT(document().inStyleRecalc());
RefPtr<RenderStyle> 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<RenderStyle> style = document().ensureStyleResolver().styleForElement(this);
ASSERT(style);
// styleForElement() might add active animations so we need to get it again.
@ -930,19 +925,13 @@ PassRefPtr<RenderStyle> Element::styleForRenderer()
return style.release();
}
PassRefPtr<RenderStyle> 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<RenderStyle> Element::customStyleForRenderer()
{
ASSERT(hasCustomStyleCallbacks());
return nullptr;
}
void Element::cloneAttributesFromElement(const Element& other)
{
other.synchronizeAllAttributes();

View File

@ -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<RenderStyle> 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<RenderStyle> originalStyleForRenderer();
private:
void attributeChanged(const QualifiedName&, const AtomicString&, AttributeModificationReason = ModifiedDirectly);

View File

@ -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

View File

@ -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);

View File

@ -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.

View File

@ -105,9 +105,6 @@ PassRefPtr<Node> ShadowRoot::cloneNode(bool, ExceptionState& exceptionState)
void ShadowRoot::recalcStyle(StyleRecalcChange change)
{
// ShadowRoot doesn't support custom callbacks.
ASSERT(!hasCustomStyleCallbacks());
if (styleChangeType() >= SubtreeStyleChange)
change = Force;