Closed Bug 1390694 Opened 9 years ago Closed 8 years ago

stylo: :-moz-window-inactive doesn't respond to window state change dynamically

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox57 --- wontfix
firefox58 --- fixed

People

(Reporter: xidorn, Assigned: heycam)

References

(Blocks 1 open bug)

Details

Attachments

(8 files, 4 obsolete files)

119 bytes, text/html
Details
59 bytes, text/x-review-board-request
emilio
: review+
Details
59 bytes, text/x-review-board-request
emilio
: review+
Details
59 bytes, text/x-review-board-request
emilio
: review+
Details
59 bytes, text/x-review-board-request
emilio
: review+
Details
41 bytes, text/x-github-pull-request
Details | Review
2.40 KB, patch
emilio
: review+
Details | Diff | Splinter Review
1.24 KB, patch
emilio
: review+
Details | Diff | Splinter Review
Attached file testcase
See the testcase. You would see a green background initially, and when you activate other window, the background should turn red, because now :-moz-window-inactive should match. However, in Stylo, it doesn't. We need to invalidate selector matching somehow when window changes its state. This causes test browser/base/content/test/general/browser_windowactivation.js to timeout.
Priority: -- → P3
Probably worth fixing this before shipping.
Priority: P3 → P2
Depends on: 1290285
Xidorn makes a case for this being P3 in bug 1290285 comment 4.
Priority: P2 → P3
Blocks: stylo-chrome
Assignee: nobody → cam
Status: NEW → ASSIGNED
Originally I wanted to track the dependencies for invalidation just like we do for element states, but this proved to be more annoying than I'd hoped. We would need to post an invalidation from the root of the document, since we don't have a specific element whose state has updated to start from. (Or, you can think of it as some intrinsic state of every element in the document has changed, and some of those might generate invalidations.) I managed to get the invalidation processing working even when starting from the very left of the selector, but then I realized I'd need to do something to allow the :-moz-window-inactive to match regardless of the actual current (or snapshotted) document state value. That seemed a bit much just to make this one (or two) pseudo-class work, so I fell back to just posting a subtree restyle like Gecko does currently.
Attachment #8919652 - Flags: review?(emilio)
Attachment #8919653 - Flags: review?(emilio)
Attachment #8919654 - Flags: review?(emilio)
Attachment #8919655 - Flags: review?(emilio)
Comment on attachment 8919652 [details] style: Remove Stylist::might_have_state_dependency. https://reviewboard.mozilla.org/r/190562/#review195784
Attachment #8919652 - Flags: review?(emilio) → review+
Comment on attachment 8919653 [details] style: Remove unused SelectorImpl::pseudo_class_state_flag. https://reviewboard.mozilla.org/r/190564/#review195786
Attachment #8919653 - Flags: review?(emilio) → review+
Comment on attachment 8919655 [details] geckolib: Add FFI function for checking document state dependencies. https://reviewboard.mozilla.org/r/190568/#review195788 ::: servo/ports/geckolib/glue.rs:4053 (Diff revision 1) > #[no_mangle] > +pub extern "C" fn Servo_StyleSet_HasDocumentStateDependency( > + raw_data: RawServoStyleSetBorrowed, > + state: u64, > +) -> bool { > + let state = ElementState::from_bits_truncate(state); Shouldn't this be `DocumentState`, and `has_document_state_dependency`?
Attachment #8919655 - Flags: review?(emilio)
Comment on attachment 8919654 [details] style: Record DocumentState dependencies. https://reviewboard.mozilla.org/r/190566/#review195796
Attachment #8919654 - Flags: review?(emilio) → review+
Comment on attachment 8919655 [details] geckolib: Add FFI function for checking document state dependencies. https://reviewboard.mozilla.org/r/190568/#review195798 ::: servo/ports/geckolib/glue.rs:4053 (Diff revision 1) > #[no_mangle] > +pub extern "C" fn Servo_StyleSet_HasDocumentStateDependency( > + raw_data: RawServoStyleSetBorrowed, > + state: u64, > +) -> bool { > + let state = ElementState::from_bits_truncate(state); This fixed, r=me
Attachment #8919655 - Flags: review+
Comment on attachment 8919656 [details] Bug 1390694 - Part 1: Add ServoStyleSet function for checking document state dependencies. https://reviewboard.mozilla.org/r/190570/#review195800
Attachment #8919656 - Flags: review?(emilio) → review+
Blocks: 1409672
Comment on attachment 8919657 [details] Bug 1390694 - Part 2: Allow EnumerateBoundContentBindings callbacks to stop enumeration. https://reviewboard.mozilla.org/r/190572/#review195802
Attachment #8919657 - Flags: review?(emilio) → review+
Comment on attachment 8919658 [details] Bug 1390694 - Part 3: Add nsBindingManager function to check for document state dependencies. https://reviewboard.mozilla.org/r/190574/#review195804
Attachment #8919658 - Flags: review?(emilio) → review+
Comment on attachment 8919659 [details] Bug 1390694 - Part 4: Restyle the document when document state dependencies change. https://reviewboard.mozilla.org/r/190576/#review195808 r=me. Maybe file a bug on how we can make it better / more fine-grained and reference it from there? I agree that if Gecko was doing full doc restyles anyway it's unlikely to matter that much.
Attachment #8919659 - Flags: review?(emilio) → review+
Attachment #8919652 - Attachment is obsolete: true
Attachment #8919653 - Attachment is obsolete: true
Attachment #8919654 - Attachment is obsolete: true
Attachment #8919655 - Attachment is obsolete: true
Attached file Servo PR
Pushed by cmccormack@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/484a2644318f Part 1: Add ServoStyleSet function for checking document state dependencies. r=emilio https://hg.mozilla.org/integration/autoland/rev/83ff9e245757 Part 2: Allow EnumerateBoundContentBindings callbacks to stop enumeration. r=emilio https://hg.mozilla.org/integration/autoland/rev/e13dd2a3651f Part 3: Add nsBindingManager function to check for document state dependencies. r=emilio https://hg.mozilla.org/integration/autoland/rev/b9cff3469bfd Part 4: Restyle the document when document state dependencies change. r=emilio
We probably should re-enable browser/base/content/test/general/browser_windowactivation.js?
Flags: needinfo?(cam)
Backed out 4 changesets (bug 1390694) for failing crash test and in reftest/tests/layout/reftests/xul/mac-tab-toolbar.xul https://hg.mozilla.org/integration/autoland/rev/ca6138ea6ef6800a6c4ff7625c2644d366ebcf3b
I fixed the crash (needed a null check for the document root element), but the mac-tab-toolbar.xul failure is confusing. I don't think I'll get a chance to look into this properly before I'm leave, so I'll leave the ni for myself.
status-firefox57=wontfix unless someone thinks this bug should block 57
(In reply to Cameron McCormack (:heycam) (away 24 Oct – 12 Nov) from comment #33) > I fixed the crash (needed a null check for the document root element), but > the mac-tab-toolbar.xul failure is confusing. I don't think I'll get a > chance to look into this properly before I'm leave, so I'll leave the ni for > myself. This test was initially introduced in bug 1340627 for catching tab switching regression. That regression was because of not popping layer correctly as indicated in bug 1340627 comment 35. Looking at the patches, I'm suspecting this may be related to part 4, where it skips the final SchedulePaint() call in some cases where the old code didn't skip. I can have a try run and see if this is really the problem.
This is based on the original part 4. The difference is that this doesn't use early return, so the paint may be scheduled like what the function does before.
Attachment #8924048 - Flags: review?(emilio)
Comment on attachment 8924048 [details] [diff] [review] Part 4: Restyle the document when document state dependencies change. Review of attachment 8924048 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/base/PresShell.cpp @@ +4305,5 @@ > NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument"); > > + if (mDidInitialize) { > + Element* rootElement = aDocument->GetRootElement(); > + bool needRestyle = false; Maybe a function like: static bool NeedRestyleForDocumentStateChange(nsIDocument*, EventStates, RestyleManager*) or a method looks nicer? Your call, no big deal.
Attachment #8924048 - Flags: review?(emilio) → review+
Attachment #8924051 - Flags: review?(emilio) → review+
(In reply to Emilio Cobos Álvarez [:emilio] from comment #40) > Comment on attachment 8924048 [details] [diff] [review] > Part 4: Restyle the document when document state dependencies change. > > Review of attachment 8924048 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: layout/base/PresShell.cpp > @@ +4305,5 @@ > > NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument"); > > > > + if (mDidInitialize) { > > + Element* rootElement = aDocument->GetRootElement(); > > + bool needRestyle = false; > > Maybe a function like: > > static bool NeedRestyleForDocumentStateChange(nsIDocument*, EventStates, > RestyleManager*) > > or a method looks nicer? It doesn't seem to me that would make it much nicer... I'll just leave it as-is.
Pushed by xquan@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/faafb9307cb1 Part 1: Add ServoStyleSet function for checking document state dependencies. r=emilio https://hg.mozilla.org/integration/autoland/rev/68e5971edabb Part 2: Allow EnumerateBoundContentBindings callbacks to stop enumeration. r=emilio https://hg.mozilla.org/integration/autoland/rev/4617a3675f58 Part 3: Add nsBindingManager function to check for document state dependencies. r=emilio https://hg.mozilla.org/integration/autoland/rev/6b2e7817128b Part 4: Restyle the document when document state dependencies change. r=emilio https://hg.mozilla.org/integration/autoland/rev/0238eee84c25 Part 5: Enable browser_windowactivation.js test. r=emilio
Depends on: 1413777
Depends on: 1428164
Depends on: 1440036
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: