Commit 477e29d8 authored by Stefan Zager's avatar Stefan Zager Committed by Commit Bot

Clear pending stylesheet flag when xml-stylesheet loads

When an xml-stylesheet is declared before the <html> element, the
document's pending stylesheet count is incremented; but the count is
not decremented when the xml-stylesheet finishes loading.

This has no effect when UpdateStyleAndLayoutIgnorePendingStylesheets
is used; but when that mechanism is removed, it blocks rendering,
causing the test named below to fail.

BUG=521692
TEST=fast/dom/StyleSheet/detached-style-pi-2.xhtml

Change-Id: Ibadae4b66d5351cd58ed00ad654247f53fba6861
Reviewed-on: https://chromium-review.googlesource.com/c/1334946
Commit-Queue: Stefan Zager <szager@chromium.org>
Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608204}
parent 103f57b1
......@@ -87,8 +87,11 @@ Node* ProcessingInstruction::Clone(Document& factory, CloneChildrenFlag) const {
}
void ProcessingInstruction::DidAttributeChanged() {
if (sheet_)
if (sheet_) {
if (sheet_->IsLoading())
RemovePendingSheet();
ClearSheet();
}
String href;
String charset;
......@@ -180,8 +183,7 @@ bool ProcessingInstruction::IsLoading() const {
bool ProcessingInstruction::SheetLoaded() {
if (!IsLoading()) {
if (!DocumentXSLT::SheetLoaded(GetDocument(), this))
GetDocument().GetStyleEngine().RemovePendingSheet(*this,
style_engine_context_);
RemovePendingSheet();
return true;
}
return false;
......@@ -265,6 +267,9 @@ void ProcessingInstruction::RemovedFrom(ContainerNode& insertion_point) {
*this, insertion_point);
}
if (IsLoading())
RemovePendingSheet();
if (sheet_) {
DCHECK_EQ(sheet_->ownerNode(), this);
ClearSheet();
......@@ -276,12 +281,14 @@ void ProcessingInstruction::RemovedFrom(ContainerNode& insertion_point) {
void ProcessingInstruction::ClearSheet() {
DCHECK(sheet_);
if (sheet_->IsLoading())
GetDocument().GetStyleEngine().RemovePendingSheet(*this,
style_engine_context_);
sheet_.Release()->ClearOwnerNode();
}
void ProcessingInstruction::RemovePendingSheet() {
GetDocument().GetStyleEngine().RemovePendingSheet(*this,
style_engine_context_);
}
void ProcessingInstruction::Trace(blink::Visitor* visitor) {
visitor->Trace(sheet_);
visitor->Trace(listener_for_xslt_);
......
......@@ -91,6 +91,7 @@ class CORE_EXPORT ProcessingInstruction final : public CharacterData,
void ParseStyleSheet(const String& sheet);
void ClearSheet();
void RemovePendingSheet();
String DebugName() const override { return "ProcessingInstruction"; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment