Closed Bug 1422654 Opened 2 years ago Closed 2 years ago

stylo: Avoid restyling the element if it has bindings without stylesheets.

Categories

(Core :: CSS Parsing and Computation, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox57 --- wontfix
firefox58 --- wontfix
firefox59 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

No description provided.
Comment on attachment 8934035 [details]
Bug 1422654: stylo: Avoid restyling XBL-bound element if the binding doesn't have stylesheets.

https://reviewboard.mozilla.org/r/204964/#review210436

::: dom/xbl/nsXBLService.cpp:450
(Diff revision 1)
>    {
>      if (mHadData) {

MOZ_ASSERT(aResolveStyle) in here?

::: layout/base/ServoRestyleManager.h:247
(Diff revision 1)
>                                  ServoStyleSet& aStyleSet);
>  
>  public:
>    /**
> +   * Whether to clear all the style data (including the element itself), or just
> +   * the descendant's data.

descendants'

::: layout/base/nsCSSFrameConstructor.cpp:5904
(Diff revision 1)
> -      // See the comment in the similar-looking block in
> +      if (resolveStyle) {
> -      // ConstructDocElementFrame to see why we always re-fetch the style
> -      // context in Servo.
> -      if (styleContext->IsServo()) {
> +        if (styleContext->IsServo()) {
> -        styleContext =
> +          styleContext =
> -          mPresShell->StyleSet()->AsServo()->ResolveServoStyle(aContent->AsElement());
> +            mPresShell->StyleSet()->AsServo()->ResolveServoStyle(aContent->AsElement());
> -      } else if (resolveStyle) {
> +        } else {
> -        styleContext =
> +          styleContext =
> -          ResolveStyleContext(styleContext->AsGecko()->GetParent(),
> +            ResolveStyleContext(styleContext->AsGecko()->GetParent(),
> -                              aContent, &aState);
> +                                aContent, &aState);
> -      }
> +        }
> +      }

I'm not quite sure why we need to do different things in the two branches.  Can you explain in a comment?
Attachment #8934035 - Flags: review?(cam) → review+
(In reply to Cameron McCormack (:heycam) (away until Austin) from comment #2)
> Comment on attachment 8934035 [details]
> Bug 1422654: stylo: Avoid restyling XBL-bound element if the binding doesn't
> have stylesheets.
> 
> https://reviewboard.mozilla.org/r/204964/#review210436
> 
> ::: dom/xbl/nsXBLService.cpp:450
> (Diff revision 1)
> >    {
> >      if (mHadData) {
> 
> MOZ_ASSERT(aResolveStyle) in here?
> 
> ::: layout/base/ServoRestyleManager.h:247
> I'm not quite sure why we need to do different things in the two branches. 
> Can you explain in a comment?

The TL;DR is: No GetParent() for Servo.
Pushed by ecoal95@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/50ccf635c731
stylo: Avoid restyling XBL-bound element if the binding doesn't have stylesheets. r=heycam
Priority: -- → P2
https://hg.mozilla.org/mozilla-central/rev/50ccf635c731
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.