Closed Bug 1268759 Opened 9 years ago Closed 9 years ago

make ServoStyleSet::GetContext not crash when it encounters anonymous content

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: heycam, Assigned: heycam)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch (obsolete) — Splinter Review
This patch gives anonymous content incorrect styles but at least doesn't crash. (This lets us get past styling <xul:scrollbar> elements in the initial document styling.)
Attachment #8746921 - Flags: review?(bobbyholley)
Comment on attachment 8746921 [details] [diff] [review] patch Review of attachment 8746921 [details] [diff] [review]: ----------------------------------------------------------------- r=me with those issues sorted out. ::: layout/style/ServoStyleSet.cpp @@ +92,5 @@ > + MOZ_ASSERT(aContent->IsElement() || > + aContent->IsNodeOfType(nsINode::eTEXT)); > + > + // XXXheycam: Anonymous content is not present when the document > + // is initially styled by Servo_RestyleDocument. Just use the I guess that's true, but the other problem is we have no API to traverse anonymous content from Servo. Worth expanding the comment to point out both issues. @@ +100,5 @@ > + do { > + nsIContent* parent = aContent->GetBindingParent(); > + aContent = parent->IsElement() ? parent->AsElement() : nullptr; > + } while (aContent && aContent->IsInAnonymousSubtree()); > + MOZ_ASSERT(aContent, "couldn't break out of anonymous content"); Why do we bother handling the parent-as-non-element case when it will effectively just result in a MOZ_ASSERT below? Seems like we should either just assert that the binding parent is an element, or do what I did locally: + while (aElement->IsInAnonymousSubtree()) { + aElement = aElement->GetParentElement(); + }
Attachment #8746921 - Flags: review?(bobbyholley) → review+
Attachment #8746921 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: