Closed Bug 1418456 Opened 8 years ago Closed 8 years ago

stylo: Cleanup the XBL binding style resolution stuff.

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement
Not set
normal

Tracking

()

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

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(3 files)

It's a bit of a mess, and it's not sound.
(In reply to Emilio Cobos Álvarez [:emilio] from comment #5) > https://treeherder.mozilla.org/#/ > jobs?repo=try&revision=ee31d60cf5e2de0b39e75a33f7d70d444b483d96 > > Green! Well, there's an assert there, which is from the patch from bug 1414999, but bug 1418560 fixes it.
Comment on attachment 8929597 [details] Bug 1418456: Cleanup the XBL stuff. https://reviewboard.mozilla.org/r/200870/#review206264 ::: commit-message-810fa:1 (Diff revision 1) > +Bug 1418456: Cleanup the XBL stuff. r?heycam s/Cleanup the XBL stuff/Clear subtree element data when applying an XBL binding/ or something like that? ::: commit-message-810fa:9 (Diff revision 1) > +also about children moving _out_ of the flat tree. > + > +In particular, as of right now we may leave stale data on elements when they > +disappear from the flattened tree. > + > +We're lucky enough that in 99% of the situations we enter in[1] and that clears Missing footnote? ::: dom/xbl/nsXBLService.cpp:385 (Diff revision 1) > // RAII class to invoke StyleNewChildren for Elements in Servo-backed documents > // on destruction. Update this comment? ::: dom/xbl/nsXBLService.cpp:447 (Diff revision 1) > return NS_OK; > } > > // There are various places in this function where we shuffle content around > // the subtree and rebind things to and from insertion points. Once all that's > // done, we want to invoke StyleNewChildren to style any unstyled children And this comment. ::: layout/style/ServoStyleSet.h:184 (Diff revision 1) > // Clear style data and resolve style for the given element and its > - // subtree for changes to -moz-binding. It returns the new style > + // subtree for changes to -moz-binding. This comment needs updating too.
Attachment #8929597 - Flags: review?(cam) → review+
Comment on attachment 8929598 [details] Bug 1418456: Remove the last call to StyleNewlyBoundElement. https://reviewboard.mozilla.org/r/200872/#review206272
Attachment #8929598 - Flags: review?(cam) → review+
Comment on attachment 8929599 [details] Bug 1418456: Get rid of unstyled children only traversals. https://reviewboard.mozilla.org/r/200874/#review206274 ::: layout/base/nsCSSFrameConstructor.cpp:7498 (Diff revision 1) > - // already handled that parent. In the common case of inserting elements > - // into a container that does not have an XBL binding or shadow tree with > - // distributed children, this boils down to a single call to > - // GetFlattenedTreeParent/StyleNewChildren, and traversing the list of > - // children checking HasServoData (which is fast). > if (child->IsElement() && !child->AsElement()->HasServoData()) { Do we still need the HasServoData check now? ::: layout/style/ServoTypes.h:66 (Diff revision 1) > - UnstyledOnly = 1 << 2, > // A forgetful traversal ignores the previous state of the frame tree, and > // thus does not compute damage or maintain other state describing the styles > // pre-traversal. A forgetful traversal is usually the right thing if you > // aren't going to do a post-traversal. > Forgetful = 1 << 3, Feel free to re-number the other values...
Attachment #8929599 - Flags: review?(cam) → review+
Pushed by ecoal95@gmail.com: https://hg.mozilla.org/integration/autoland/rev/391937d9f0d7 Clear subtree element data when applying an XBL binding. r=heycam https://hg.mozilla.org/integration/autoland/rev/24dea2c09495 Remove the last call to StyleNewlyBoundElement. r=heycam https://hg.mozilla.org/integration/autoland/rev/5e9db66be7d4 Get rid of unstyled children only traversals. r=heycam
Pushed by ecoal95@gmail.com: https://hg.mozilla.org/integration/autoland/rev/ae3583071976 followup: undo last-minute cleanup that busts the build. r=me
Pushed by ecoal95@gmail.com: https://hg.mozilla.org/integration/autoland/rev/e254d702b054 followup: Re-add the HasServoData check because I was too optimistic addressing review comments. r=me
Pushed by ecoal95@gmail.com: https://hg.mozilla.org/integration/autoland/rev/66261eec36b3 Yet another followup: Always re-get the style context in the servo case after loading an XBL binding to avoid tripping otherwise useful assertions. r=me
(In reply to Cameron McCormack (:heycam) from comment #9) > Comment on attachment 8929599 [details] > Bug 1418456: Get rid of unstyled children only traversals. > > https://reviewboard.mozilla.org/r/200874/#review206274 > > ::: layout/base/nsCSSFrameConstructor.cpp:7498 > (Diff revision 1) > > - // already handled that parent. In the common case of inserting elements > > - // into a container that does not have an XBL binding or shadow tree with > > - // distributed children, this boils down to a single call to > > - // GetFlattenedTreeParent/StyleNewChildren, and traversing the list of > > - // children checking HasServoData (which is fast). > > if (child->IsElement() && !child->AsElement()->HasServoData()) { > > Do we still need the HasServoData check now? And just to reply here, yes, we do, because we can reenter in ContentRangeInserted from ContentAppended. We can rejigger the code a bit to avoid this though.
Depends on: 1419694
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: