Closed Bug 1349457 Opened 7 years ago Closed 7 years ago

stylo: eagerly style generated content just after it is created

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: heycam, Assigned: heycam)

References

Details

Attachments

(1 file)

When generated content is created, we need to eagerly style it.  Not doing this is the cause of layout/reftests/bugs/451168-1.html tripping the bug 1345695 assertion.
Comment on attachment 8849891 [details]
Bug 1349457 - stylo: Eagerly style generated content.

https://reviewboard.mozilla.org/r/122636/#review125012

r=me with the |createdGeneratedContent| stuff removed, or a good reason why we should keep it.

::: layout/base/nsCSSFrameConstructor.cpp:1918
(Diff revision 2)
> +  if (createdGeneratedContent && aParentContent->IsStyledByServo()) {
> +    mPresShell->StyleSet()->AsServo()->StyleNewSubtree(container);
> +  }

Hm, shouldn't we style |container| unconditionally? I don't understand what case we're trying to optimize for with |createdGeneratedContent| and why it would be ok to skip |container| even if |createdGeneratedContent| were false.
Attachment #8849891 - Flags: review?(bobbyholley) → review+
Note that I'm assuming here that we only end up in this function if we are very likely to create actual generated content. Otherwise we'd be appending a lot of unnecessary XUL NAC to the DOM.
Assignee: nobody → cam
Priority: -- → P1
You are right that we get in here only if we have ::before/::after rules that could produce generated content.  It is possible for nsCSSFrameConstructor::CreateGeneratedContent to return null, either (a) if the |content: url()| didn't resolve to an image, or (b) the |content: attr(x)| didn't refer to an existing attribute on the element.  I assume such cases are rare, so we could style |container| unconditionally if you think it's not worth checking whether CreateGeneratedContent succeeded.
Yeah, let's keep it simple and unconditional.
Pushed by cmccormack@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0c15ca7e1ba7
stylo: Eagerly style generated content. r=bholley
https://hg.mozilla.org/mozilla-central/rev/0c15ca7e1ba7
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: