Closed Bug 945105 Opened 11 years ago Closed 11 years ago

style changes not handled properly with ::first-line and continuations

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla29
Tracking Status
firefox26 --- unaffected
firefox27 --- wontfix
firefox28 + fixed
firefox29 --- fixed
b2g-v1.3 --- fixed
b2g-v1.3T --- fixed
b2g-v1.4 --- fixed

People

(Reporter: heycam, Assigned: dbaron)

References

Details

(Keywords: regression, Whiteboard: [qa-])

Attachments

(5 files)

Attached file test
Attached is a simpler version of the test from bug 670467. The change to the <span>'s visibility should cause the continuations to be restyled, and show the entire "This is some text", but only the "This" is shown.
Priority: -- → P4
Flags: needinfo?(dbaron)
Blocks: 931668
I think the problem is that the changes to RestyleManager::ComputeStyleChangeFor in https://hg.mozilla.org/mozilla-central/rev/ed9c22ef51e0 assume that all ib-siblings and next-in-flows actually do copy the style; this code instead needs to use GetPrevContinuationWithSameStyle like ElementRestyler::RestyleContentChildren does. I'll have a go at a patch.
Assignee: nobody → dbaron
Status: NEW → ASSIGNED
Flags: needinfo?(dbaron)
OS: Mac OS X → All
Hardware: x86 → All
I confirmed that the test fails as expected without the patch, and passes with the patch.
Attachment #8360764 - Flags: review?(cam)
(In reply to David Baron [:dbaron] (needinfo? me) (UTC-8) from comment #7) > https://tbpl.mozilla.org/?tree=Try&rev=d1d6ba480474 try: --build d --platform linux64 --unittests crashtest,reftest,mochitests --talos none --no-emails all green
David, can you explain to me how block-in-inline frames are structured, how the IBSplitSpecialSibling frame properties point to differents parts of the split up frames, which frames get NS_FRAME_IS_SPECIAL, and whether continuations are also used between the parts of the IB split? I'd like to have a better grasp of that before reviewing patch 2.
Flags: needinfo?(dbaron)
When we split an inline that contains blocks, we split it into a sequence of alternating inline-parts and block-parts. These parts might then in turn be split into continuations during line breaking or pagination. The first continuation of each of these parts has an IBSplitSpecialSibling property that points to the next such part. That said, I think patch 2 can be verified to change nothing using only local knowledge (i.e., knowing nothing about the world outside of that function).
Flags: needinfo?(dbaron)
Oh, and we set NS_FRAME_IS_SPECIAL on all of the split parts, and the bit gets gets copied to continuations as well in nsFrame::Init.
(In reply to David Baron [:dbaron] (needinfo? me) (UTC-8) from comment #10) > That said, I think patch 2 can be verified to change nothing using only > local knowledge (i.e., knowing nothing about the world outside of that > function). (I meant to say patch 1.)
Attachment #8360761 - Flags: review?(cam) → review+
Attachment #8360762 - Flags: review?(cam) → review+
Comment on attachment 8360763 [details] [diff] [review] patch 3: Replace changes to ComputeStyleChangeFor with a check of GetPrevContinuationWithSameStyle to avoid the duplication in a way that still doesn't break direct restyling of an element whose continuations have different styles. Review of attachment 8360763 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/base/RestyleManager.cpp @@ +2869,5 @@ > + // continuations, and skipping everything else. However, when we have > + // a style change for something inside a style difference (e.g., a > + // style change on an element that extends from inside a styled > + // ::first-line to outside of that first line), we might restyle more > + // than that. I don't understand "when we have a style change for something inside a style difference", though the parenthetical makes sense. Could you reword or clarify?
Attachment #8360763 - Flags: review?(cam) → review+
Attachment #8360764 - Flags: review?(cam) → review+
(In reply to Cameron McCormack (:heycam) from comment #13) > Comment on attachment 8360763 [details] [diff] [review] > > + // continuations, and skipping everything else. However, when we have > > + // a style change for something inside a style difference (e.g., a > > + // style change on an element that extends from inside a styled > > + // ::first-line to outside of that first line), we might restyle more > > + // than that. > > I don't understand "when we have a style change for something inside a style > difference", though the parenthetical makes sense. Could you reword or > clarify? Oops. How about: However, when we have a style change targeted at an element inside a context where styles vary between continuations (e.g., ...
(In reply to Cameron McCormack (:heycam) from comment #12) > (In reply to David Baron [:dbaron] (needinfo? me) (UTC-8) from comment #10) > > That said, I think patch 2 can be verified to change nothing using only > > local knowledge (i.e., knowing nothing about the world outside of that > > function). > > (I meant to say patch 1.) To be clear: patch 1 is pure backout of an overzealous optimization in the previous patch; this change replaces it with a valid optimization.
(In reply to David Baron [:dbaron] (needinfo? me) (UTC-8) from comment #14) > Oops. How about: > > However, when we have a style change targeted at an element inside a > context where styles vary between continuations (e.g., ... Sounds good.
Comment on attachment 8360761 [details] [diff] [review] patch 1: Revert the changes to RestyleManager::ComputeStyleChangeFor from bug 898333, patch 2, since they cause skipping (in addition to the desired skipping) of continuations that do need restyling, in the case of directly restyling an element where con [Approval Request Comment] Bug caused by (feature/regressing bug #): bug 898333 User impact if declined: incorrect styles (and possibly other symptoms, see above) when a page changes style on an element that starts but does not end in a styled ::first-letter or ::first-line Testing completed (on m-c, etc.): been on m-c for a month, passes automated tests Risk to taking this patch (and alternatives if risky): I think it's pretty low risk; it fixes a relatively obvius regession in the old code. String or IDL/UUID changes made by this patch: none
Attachment #8360761 - Flags: approval-mozilla-beta?
Comment on attachment 8360762 [details] [diff] [review] patch 2: Convert RestyleManager::ComputeStyleChangeFor from while loops to for loops to make it easier to add continue statements to it. [Approval Request Comment] same as comment 20
Attachment #8360762 - Flags: approval-mozilla-beta?
Comment on attachment 8360763 [details] [diff] [review] patch 3: Replace changes to ComputeStyleChangeFor with a check of GetPrevContinuationWithSameStyle to avoid the duplication in a way that still doesn't break direct restyling of an element whose continuations have different styles. [Approval Request Comment] same as comment 20
Attachment #8360763 - Flags: approval-mozilla-beta?
Attachment #8360761 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #8360762 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #8360763 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Whiteboard: [qa-]
No longer blocks: 948181
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: