Closed Bug 1338982 Opened 7 years ago Closed 7 years ago

stylo: NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS is not set correctly

Categories

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

defect

Tracking

()

RESOLVED DUPLICATE of bug 1345950

People

(Reporter: heycam, Assigned: heycam)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

Attached file test
Here is a test case that fails due to not setting NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS.  It also fails in Servo.
Attached file test 2
Bobby, is there any fundamental reason why we can't allow RESTYLE_LATER_SIBLINGS to be stored in an element's RestyleData?  Currently we allow snapshot expansion to produce RESTYLE_LATER_SIBLINGS, which we then notice and return back up to preprocess_children to expand out into (RESTYLE_SELF | RESTYLE_DESCENDANTS) on the later siblings.  But we don't allow an eRestyleHint_LaterSiblings to be posted explicitly, which RestyleManager wants to do to handle DOM mutations.  We could make RestyleManager post restyles for the later siblings manually, but that seems wasteful.

I guess it would make it hard for has_current_styles() to tell, though.
Flags: needinfo?(bobbyholley)
Although I guess that is already not accurate if a previous sibling has a snapshot that would expand to include RESTYLE_LATER_SIBLINGS?
Assignee: nobody → cam
Status: NEW → ASSIGNED
Attached patch WIP v0.1Splinter Review
This fixes the "test 2" attachment.
Attachment #8836643 - Flags: feedback?(bobbyholley)
Comment on attachment 8836643 [details] [diff] [review]
WIP v0.1

Review of attachment 8836643 [details] [diff] [review]:
-----------------------------------------------------------------

I think we should move this into StoredRestyleHint. Also, probably worth separating the selectors change into a separate commit and getting Simon or emilio to review it (I don't have the codepaths paged in enough to be sure that this is the right place for the check).
Attachment #8836643 - Flags: feedback?(bobbyholley) → feedback+
Flags: needinfo?(bobbyholley)
Emilio, is this fixed with your recent latersiblings work?
Flags: needinfo?(emilio+bugs)
There's no chance the test case number 1 works on stylo because we don't properly implement :empty.

That being said, it doesn't work on servo too. I'll check if the patch fixes it on servo.
Flags: needinfo?(emilio+bugs)
So, right now only the selectors change is needed to fix that. The change doesn't fix the first test case, but that's just because it doesn't handle the HAS_EMPTY_SELECTOR flag.

Now, the fun stuff. Thinking whether that was the correct place to put the flag, I just realized that all the flag handling introduced in bug 1336646 is broken. Sorry, should've catched that during review :(

Mainly, the way we're doing it right now is that we get this `flags` outparam and apply it to the _original_ element we're matching again, but these selector flags can go arbitrarily around the DOM, for example:

.foo + bar baz baz baz {
    color: red;
}

The flag for the slow selector should be inserted in the element we're trying to match the first `bar` again, which may be an arbitrary ancestor or sibling, etc. of the element we're matching against.

The best idea I have right now is using an outparam Vec<(Element, Flags)>, but that sounds quite terrible :(.
I guess the same is true for relations, but since they're only used for style sharing during the same restyle the worst thing that may happen is that we count more relations than needed.
The fix for the relations thing is straight-forward, but no so much for the element flags. I plan to fix the relations once I have the style cache working in sequential mode, because of test coverage.
(In reply to Emilio Cobos Álvarez [:emilio] from comment #9)
> So, right now only the selectors change is needed to fix that. The change
> doesn't fix the first test case, but that's just because it doesn't handle
> the HAS_EMPTY_SELECTOR flag.
> 
> Now, the fun stuff. Thinking whether that was the correct place to put the
> flag, I just realized that all the flag handling introduced in bug 1336646
> is broken. Sorry, should've catched that during review :(
> 
> Mainly, the way we're doing it right now is that we get this `flags`
> outparam and apply it to the _original_ element we're matching again, but
> these selector flags can go arbitrarily around the DOM, for example:
> 
> .foo + bar baz baz baz {
>     color: red;
> }
> 
> The flag for the slow selector should be inserted in the element we're
> trying to match the first `bar` again, which may be an arbitrary ancestor or
> sibling, etc. of the element we're matching against.

I don't think the selector above would require any slow selectors flags (the later siblings restyle hint should take care of that). But in general I see your point. :-(


I've filed bug 1345950 for this issue.
Depends on: 1345950, 1343496
Priority: -- → P2
(In reply to Bobby Holley (:bholley) (busy with Stylo) from comment #12) 
> > .foo + bar baz baz baz {
> >     color: red;
> > }
> > 
> > The flag for the slow selector should be inserted in the element we're
> > trying to match the first `bar` again, which may be an arbitrary ancestor or
> > sibling, etc. of the element we're matching against.
> 
> I don't think the selector above would require any slow selectors flags (the
> later siblings restyle hint should take care of that). But in general I see
> your point. :-(

How not? That would need the HAS_SLOW_SELECTOR_LATER_SIBLINGS flag, otherwise we don't post the LaterSiblings hint.
Yeah you're right - I was mixing it up with state/attr changes.
Blocks: 1330885
Self-reminder to look at the different tests skipped at https://hg.mozilla.org/integration/autoland/rev/ee95a66bea56e9b7044abab6f12b12257cb6b4b0, which this should fix.
With the recent :empty/:any/etc support and the recent flags patch, we now pass test_bug534804.html and test_bug73586.html, which test this extensively, so I believe we can close this.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Pushed by ecoal95@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/6c10860d02ad
Re-enable no longer timing-dependent tests. r=emilio
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: