Bug 1323655 - Handle unstyled elements when applying XBL bindings. r=heycam

This commit is contained in:
Bobby Holley 2017-01-04 17:24:30 -08:00
parent d549af8fc6
commit 3ae99d4463
3 changed files with 13 additions and 3 deletions

View File

@ -31,7 +31,7 @@ load 515829-2.html
load 564461.xhtml
load 570566-1.html
load 571428-1.html
skip-if(stylo) load 580507-1.xhtml # bug 1323655
load 580507-1.xhtml
load 590387.html
load 596785-1.html
load 596785-2.html

View File

@ -418,9 +418,19 @@ public:
nsIPresShell* presShell = mElement->OwnerDoc()->GetShell();
ServoStyleSet* servoSet = presShell ? presShell->StyleSet()->GetAsServo() : nullptr;
if (servoSet) {
// In general the element is always styled by the time we're applying XBL
// bindings, because we need to style the element to know what the binding
// URI is. However, programmatic consumers of the XBL service (like the
// XML pretty printer) _can_ apply bindings without having styled the bound
// element. We could assert against this and require the callers manually
// resolve the style first, but it's easy enough to just handle here.
if (MOZ_UNLIKELY(!mElement->HasServoData())) {
servoSet->StyleNewSubtree(mElement);
} else {
servoSet->StyleNewChildren(mElement);
}
}
}
private:
Element* mElement;

View File

@ -28,7 +28,7 @@ load 503709-1.xhtml
skip-if(stylo) load 513375-1.xhtml # bug 1323654
load 535632-1.xhtml
load 574558-1.xhtml
skip-if(stylo) load 580151-1.xhtml # bug 1323655
load 580151-1.xhtml
load 582138-1.xhtml
load 612565-1.html
load 615015-1.html