From 60ac348ac59bdf232d7abbea1a7e460b39610dff Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Thu, 27 Jun 2019 00:24:54 +0000 Subject: [PATCH] Bug 1554571 - Part 1: Remove unused argument from Servo_ResolveStyle. r=emilio Differential Revision: https://phabricator.services.mozilla.com/D33121 --HG-- extra : moz-landing-system : lando --- layout/base/RestyleManager.cpp | 8 +++----- layout/base/nsCSSFrameConstructor.cpp | 10 ++++------ layout/base/nsLayoutUtils.cpp | 10 +++++----- layout/generic/nsFrame.cpp | 2 +- layout/generic/nsFrameSetFrame.cpp | 2 +- layout/generic/nsPlaceholderFrame.cpp | 2 +- layout/style/ServoStyleSet.h | 3 ++- layout/style/ServoStyleSetInlines.h | 3 +-- servo/ports/geckolib/glue.rs | 1 - 9 files changed, 18 insertions(+), 23 deletions(-) diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index d32a970785e4..34f87515fe44 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -2431,7 +2431,7 @@ struct RestyleManager::TextPostTraversalState { ComputedStyle& ParentStyle() { if (!mParentContext) { mLazilyResolvedParentContext = - mParentRestyleState.StyleSet().ResolveServoStyle(mParentElement); + ServoStyleSet::ResolveServoStyle(mParentElement); mParentContext = mLazilyResolvedParentContext; } return *mParentContext; @@ -2668,8 +2668,7 @@ bool RestyleManager::ProcessPostTraversal(Element* aElement, static_cast(Servo_TakeChangeHint(aElement, &wasRestyled)); RefPtr upToDateStyleIfRestyled = - wasRestyled ? aRestyleState.StyleSet().ResolveServoStyle(*aElement) - : nullptr; + wasRestyled ? ServoStyleSet::ResolveServoStyle(*aElement) : nullptr; // We should really fix the weird primary frame mapping for image maps // (bug 135040)... @@ -2767,8 +2766,7 @@ bool RestyleManager::ProcessPostTraversal(Element* aElement, const bool isDisplayContents = !styleFrame && aElement->HasServoData() && Servo_Element_IsDisplayContents(aElement); if (isDisplayContents) { - oldOrDisplayContentsStyle = - aRestyleState.StyleSet().ResolveServoStyle(*aElement); + oldOrDisplayContentsStyle = ServoStyleSet::ResolveServoStyle(*aElement); } Maybe thisFrameRestyleState; diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 9ccb8be3f869..c99fe09d8109 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -1761,7 +1761,7 @@ void nsCSSFrameConstructor::CreateGeneratedContentItem( // above. We need to grab style with animations from the pseudo element and // replace old one. mPresShell->StyleSet()->StyleNewSubtree(container); - pseudoStyle = styleSet->ResolveServoStyle(*container); + pseudoStyle = ServoStyleSet::ResolveServoStyle(*container); } uint32_t contentCount = pseudoStyle->StyleContent()->ContentCount(); @@ -2253,7 +2253,7 @@ nsIFrame* nsCSSFrameConstructor::ConstructDocElementFrame( } RefPtr computedStyle = - mPresShell->StyleSet()->ResolveServoStyle(*aDocElement); + ServoStyleSet::ResolveServoStyle(*aDocElement); const nsStyleDisplay* display = computedStyle->StyleDisplay(); @@ -4621,10 +4621,8 @@ void nsCSSFrameConstructor::InitAndRestoreFrame( already_AddRefed nsCSSFrameConstructor::ResolveComputedStyle( nsIContent* aContent) { - ServoStyleSet* styleSet = mPresShell->StyleSet(); - if (auto* element = Element::FromNode(aContent)) { - return styleSet->ResolveServoStyle(*element); + return ServoStyleSet::ResolveServoStyle(*element); } MOZ_ASSERT(aContent->IsText(), @@ -4646,7 +4644,7 @@ already_AddRefed nsCSSFrameConstructor::ResolveComputedStyle( // out. RefPtr parentStyle = Servo_Element_GetPrimaryComputedValues(parent).Consume(); - return styleSet->ResolveStyleForText(aContent, parentStyle); + return mPresShell->StyleSet()->ResolveStyleForText(aContent, parentStyle); } // MathML Mod - RBS diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index d65aca2cd3ea..61beabbdb260 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -10044,12 +10044,12 @@ ComputedStyle* nsLayoutUtils::StyleForScrollbar(nsIFrame* aScrollbarPart) { // from the element directly. This can happen on viewport, because // the scrollbar of viewport may be shown when the root element has // > display: none; overflow: scroll; - nsPresContext* pc = aScrollbarPart->PresContext(); - MOZ_ASSERT(content == pc->Document()->GetRootElement(), - "Root element is the only case for this fallback " - "path to be triggered"); + MOZ_ASSERT( + content == aScrollbarPart->PresContext()->Document()->GetRootElement(), + "Root element is the only case for this fallback " + "path to be triggered"); RefPtr style = - pc->StyleSet()->ResolveServoStyle(*content->AsElement()); + ServoStyleSet::ResolveServoStyle(*content->AsElement()); // Dropping the strong reference is fine because the style should be // held strongly by the element. return style.get(); diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 83f7fd799257..3a9cd3d465b2 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -9738,7 +9738,7 @@ ComputedStyle* nsFrame::DoGetParentComputedStyle( pseudo == PseudoStyleType::tableWrapper) { if (Servo_Element_IsDisplayContents(parentElement)) { RefPtr style = - PresShell()->StyleSet()->ResolveServoStyle(*parentElement); + ServoStyleSet::ResolveServoStyle(*parentElement); // NOTE(emilio): we return a weak reference because the element also // holds the style context alive. This is a bit silly (we could've // returned a weak ref directly), but it's probably not worth diff --git a/layout/generic/nsFrameSetFrame.cpp b/layout/generic/nsFrameSetFrame.cpp index 03745486aa10..6435331159fb 100644 --- a/layout/generic/nsFrameSetFrame.cpp +++ b/layout/generic/nsFrameSetFrame.cpp @@ -286,7 +286,7 @@ void nsHTMLFramesetFrame::Init(nsIContent* aContent, nsContainerFrame* aParent, // // Maybe we should change that though. RefPtr kidStyle = - presShell->StyleSet()->ResolveServoStyle(*child->AsElement()); + ServoStyleSet::ResolveServoStyle(*child->AsElement()); nsIFrame* frame; if (child->IsHTMLElement(nsGkAtoms::frameset)) { frame = NS_NewHTMLFramesetFrame(presShell, kidStyle); diff --git a/layout/generic/nsPlaceholderFrame.cpp b/layout/generic/nsPlaceholderFrame.cpp index ce8e877d8f7d..81173f15cb44 100644 --- a/layout/generic/nsPlaceholderFrame.cpp +++ b/layout/generic/nsPlaceholderFrame.cpp @@ -207,7 +207,7 @@ ComputedStyle* nsPlaceholderFrame::GetParentComputedStyleForOutOfFlow( mContent ? mContent->GetFlattenedTreeParentElement() : nullptr; if (parentElement && Servo_Element_IsDisplayContents(parentElement)) { RefPtr style = - PresShell()->StyleSet()->ResolveServoStyle(*parentElement); + ServoStyleSet::ResolveServoStyle(*parentElement); *aProviderFrame = nullptr; // See the comment in GetParentComputedStyle to see why returning this as a // weak ref is fine. diff --git a/layout/style/ServoStyleSet.h b/layout/style/ServoStyleSet.h index d535d070aa83..6a5f66e450f5 100644 --- a/layout/style/ServoStyleSet.h +++ b/layout/style/ServoStyleSet.h @@ -322,7 +322,8 @@ class ServoStyleSet { * * FIXME(emilio): Is there a point in this after bug 1367904? */ - inline already_AddRefed ResolveServoStyle(const dom::Element&); + static inline already_AddRefed ResolveServoStyle( + const dom::Element&); bool GetKeyframesForName(const dom::Element&, const ComputedStyle&, nsAtom* aName, diff --git a/layout/style/ServoStyleSetInlines.h b/layout/style/ServoStyleSetInlines.h index 39e5e5268700..9daae29f3c1a 100644 --- a/layout/style/ServoStyleSetInlines.h +++ b/layout/style/ServoStyleSetInlines.h @@ -19,8 +19,7 @@ nscoord ServoStyleSet::EvaluateSourceSizeList( already_AddRefed ServoStyleSet::ResolveServoStyle( const dom::Element& aElement) { - // TODO(emilio): mRawSet isn't used by this function, remove. - return Servo_ResolveStyle(&aElement, mRawSet.get()).Consume(); + return Servo_ResolveStyle(&aElement).Consume(); } } // namespace mozilla diff --git a/servo/ports/geckolib/glue.rs b/servo/ports/geckolib/glue.rs index b5cecf773cc1..c2c7667fb0ca 100644 --- a/servo/ports/geckolib/glue.rs +++ b/servo/ports/geckolib/glue.rs @@ -5089,7 +5089,6 @@ pub extern "C" fn Servo_TakeChangeHint( #[no_mangle] pub extern "C" fn Servo_ResolveStyle( element: &RawGeckoElement, - _raw_data: &RawServoStyleSet, ) -> Strong { let element = GeckoElement(element); debug!("Servo_ResolveStyle: {:?}", element);