Closed Bug 1459497 Opened 6 years ago Closed 6 years ago

Refactor the preferred style set stuff in order to move the state away from the loader.

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(1 file)

The goal is to compute whether a stylesheet is alternate ahead of time, instead of with that weird reentrancy of SetHeaderData.

This is only a step in that direction.

I ended up finding another solution that doesn't require doing that right now, but I think this is still worth it.
Comment on attachment 8973523 [details]
Bug 1459497: Refactor the preferred style set stuff in order to move the state away from the loader.

https://reviewboard.mozilla.org/r/241876/#review247764

::: dom/base/nsIDocument.h:3772
(Diff revision 1)
>    void MaybeResolveReadyForIdle();
>  
>    nsCString mReferrer;
>    nsString mLastModified;
>  
> +  nsString mPreferredStyleSheetSet;

Maybe put this next to the mLastStyleSheetSet declaration?

::: dom/xul/nsXULContentSink.cpp
(Diff revision 1)
> -    // XXX this presumes HTTP header info is already set in document
> -    // XXX if it isn't we need to set it here...
> -    // XXXbz not like GetHeaderData on the proto doc _does_ anything....
> -    nsAutoString preferredStyle;
> -    rv = mPrototype->GetHeaderData(nsGkAtoms::headerDefaultStyle,
> -                                   preferredStyle);

I'm not sure how far away we are from XUL documents going away... so maybe file a followup to remove nsXULPrototypeDocument::{Get,Set}HeaderData?

::: layout/style/Loader.cpp:426
(Diff revision 1)
>  }
>  
> -nsresult
> -Loader::SetPreferredSheet(const nsAString& aTitle)
> +void
> +Loader::DocumentStyleSheetSetChanged()
>  {
> -#ifdef DEBUG
> +  MOZ_ASSERT(mDocument, "Huh?");

Nit: no message needed for simple null checks.
Attachment #8973523 - Flags: review?(cam) → review+
Pushed by ecoal95@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/f240bdfb1d69
Refactor the preferred style set stuff in order to move the state away from the loader. r=heycam
Blocks: 1459528
https://hg.mozilla.org/mozilla-central/rev/f240bdfb1d69
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.