Closed
Bug 1350671
Opened 8 years ago
Closed 8 years ago
stylo: PresShell::RecreateFramesFor is sometimes called when there are pending restyles
Categories
(Core :: CSS Parsing and Computation, enhancement, P1)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: heycam, Assigned: heycam)
References
Details
Attachments
(1 file)
layout/reftests/bugs/289480.html triggers the assertions in bug 1345695 about non-lazy restyles. The test has an <object> element, and when the referenced file starts to load, we land in nsObjectLoadingContent::NotifyStateChanged. This calls UpdateState() on the element, which causes an ElementSnapshot to be created. Then we call PresShell::RecreateFramesFor. During frame reconstruction, we grab styles off the element without allowing lazy restyling. Due to the presence of the ElementSnapshot, we think the styles are out of date, so we assert.
I don't think it matters much that we get out of date styles during the explicit frame reconstruction, but it's probably not worth the effort of passing through state to allow it. Instead, we can just flush styles inside PresShell::RecreateFramesFor.
Assignee | ||
Comment 1•8 years ago
|
||
Assignee | ||
Comment 2•8 years ago
|
||
Comment hidden (mozreview-request) |
Assignee | ||
Comment 4•8 years ago
|
||
Hmm, that seems to have caused some assertions in a few mochitests in non-stylo builds: https://treeherder.mozilla.org/#/jobs?repo=try&revision=6c5ce3fe6918ffc557764dd43125ba744b3fb957&group_state=expanded&selectedJob=86493035
###!!! ASSERTION: Unexpected document; this will lead to incorrect behavior!: 'aElement->GetComposedDoc() == Document()', file /z/mozilla-central/layout/base/RestyleTracker.cpp, line 39
###!!! ASSERTION: Have parent context and shouldn't: 'Error', file /z/mozilla-central/layout/base/RestyleManager.cpp, line 607
###!!! ASSERTION: Wrong parent style context: 'Error', file /z/mozilla-central/layout/base/RestyleManager.cpp, line 595
###!!! ASSERTION: frame still referencing style context: 'mFrameRefCnt == 0', file /z/mozilla-central/layout/style/nsStyleContext.cpp, line 1588
Something to do with the XML pretty printing binding.
So maybe we should preserve the existing behaviour and allow existing (but out of dates) styles under PresShell::RecreateFramesFor.
Assignee | ||
Updated•8 years ago
|
Attachment #8851339 -
Flags: review?(bobbyholley)
Assignee | ||
Updated•8 years ago
|
Summary: stylo: flush styles before explicitly recreating frames → stylo: PresShell::RecreateFramesFor is sometimes called when there are pending restyles
Comment hidden (mozreview-request) |
Assignee | ||
Comment 6•8 years ago
|
||
Comment 7•8 years ago
|
||
mozreview-review |
Comment on attachment 8851339 [details]
Bug 1350671 - stylo: Allow resolving out of date styles when explicitly reconstructing frames for an element.
https://reviewboard.mozilla.org/r/123658/#review126578
::: layout/style/ServoStyleSet.h:323
(Diff revision 2)
> nsPresContext* mPresContext;
> UniquePtr<RawServoStyleSet> mRawSet;
> EnumeratedArray<SheetType, SheetType::Count,
> nsTArray<RefPtr<ServoStyleSheet>>> mSheets;
> int32_t mBatching;
> + bool mAllowResolveExistingStyles;
I think we should rename "Existing" to "Stale" here and everywhere else in this patch.
::: servo/ports/geckolib/glue.rs:1475
(Diff revision 2)
> + if !data.has_styles() {
> + warn!("Resolving existing style on unstyled element with lazy computation forbidden.");
> let per_doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
> return per_doc_data.default_computed_values().clone().into_strong();
> }
Do we also hit this, or can we assert against this case? If we do hit it, we should fix up these cases as well as part of the work you're doing.
I guess this should probably be called Servo_ResolvePossiblyStaleStyle. I think I'd actually prefer to pass a boolean of aAllowStale to Servo_ResolveStyle than to introduce this additional API. I'll leave it up to you though.
Attachment #8851339 -
Flags: review?(bobbyholley) → review+
Assignee | ||
Comment 8•8 years ago
|
||
(In reply to Bobby Holley (:bholley) (busy with Stylo) from comment #7)
> Do we also hit this, or can we assert against this case? If we do hit it, we
> should fix up these cases as well as part of the work you're doing.
In my testing patches I have this converted to an assertion, so I will find out.
Comment hidden (mozreview-request) |
Comment 10•8 years ago
|
||
Pushed by cmccormack@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6e4ccddb5c4b
stylo: Allow resolving out of date styles when explicitly reconstructing frames for an element. r=bholley
Comment 11•8 years ago
|
||
backed out for build bustage like https://treeherder.mozilla.org/logviewer.html#?job_id=86852837&repo=autoland&lineNumber=4829
https://hg.mozilla.org/integration/autoland/rev/011bcfa6ca13
Flags: needinfo?(cam)
Comment hidden (mozreview-request) |
Assignee | ||
Comment 13•8 years ago
|
||
Updated•8 years ago
|
Assignee: nobody → cam
Priority: -- → P1
Comment 14•8 years ago
|
||
Pushed by cmccormack@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e05359a30577
stylo: Allow resolving out of date styles when explicitly reconstructing frames for an element. r=bholley
Comment 15•8 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Assignee | ||
Updated•8 years ago
|
Flags: needinfo?(cam)
You need to log in
before you can comment on or make changes to this bug.
Description
•