Backed out changeset c0235b7bddcc (bug 1621415) for Mochitest perma failures on test_printpreview.xhtml. CLOSED TREE

This commit is contained in:
Razvan Maries 2020-03-14 02:52:09 +02:00
parent 2e250c45f3
commit a2e3903c68
11 changed files with 1 additions and 91 deletions

View File

@ -12012,7 +12012,6 @@ already_AddRefed<Document> Document::CreateStaticClone(
}
}
}
clonedDoc->CloneAdoptedSheetsFrom(*this);
for (int t = 0; t < AdditionalSheetTypeCount; ++t) {
auto& sheets = mAdditionalSheets[additionalSheetType(t)];

View File

@ -198,27 +198,6 @@ void DocumentOrShadowRoot::ClearAdoptedStyleSheets() {
mAdoptedStyleSheets.Clear();
}
void DocumentOrShadowRoot::CloneAdoptedSheetsFrom(
DocumentOrShadowRoot& aSource) {
Document& ownerDoc = *AsNode().OwnerDoc();
Sequence<OwningNonNull<StyleSheet>> list;
if (!list.SetCapacity(mAdoptedStyleSheets.Length(), fallible)) {
return;
}
// TODO(nordzilla) We can improve the performance here for some cases.
// https://bugzilla.mozilla.org/show_bug.cgi?id=1622322
for (auto& sheet : aSource.mAdoptedStyleSheets) {
DebugOnly<bool> succeeded =
list.AppendElement(sheet->CloneAdoptedSheet(ownerDoc), fallible);
MOZ_ASSERT(succeeded);
}
ErrorResult rv;
SetAdoptedStyleSheets(list, rv);
MOZ_ASSERT(!rv.Failed());
}
Element* DocumentOrShadowRoot::GetElementById(const nsAString& aElementId) {
if (MOZ_UNLIKELY(aElementId.IsEmpty())) {
nsContentUtils::ReportEmptyGetElementByIdArg(AsNode().OwnerDoc());

View File

@ -245,12 +245,6 @@ class DocumentOrShadowRoot {
void RemoveSheetFromStylesIfApplicable(StyleSheet&);
void ClearAdoptedStyleSheets();
/**
* Clone's the argument's adopted style sheets into this.
* This should only be used when cloning a static document for printing.
*/
void CloneAdoptedSheetsFrom(DocumentOrShadowRoot&);
// Returns the reference to the sheet, if found in mStyleSheets.
already_AddRefed<StyleSheet> RemoveSheet(StyleSheet& aSheet);
void InsertSheetAt(size_t aIndex, StyleSheet& aSheet);

View File

@ -107,7 +107,6 @@ void ShadowRoot::CloneInternalDataFrom(ShadowRoot* aOther) {
}
}
}
CloneAdoptedSheetsFrom(*aOther);
}
nsresult ShadowRoot::Bind() {

View File

@ -1,6 +1,5 @@
[DEFAULT]
prefs =
layout.css.constructable-stylesheets.enabled=true
layout.css.individual-transform.enabled=true
layout.css.motion-path.enabled=true
plugin.load_flash_only=false
@ -22,9 +21,6 @@ support-files =
printpreview_font_mozprintcallback_ref.html
printpreview_quirks.html
printpreview_quirks_ref.html
test_adopted_styles_ref.html
test_document_adopted_styles.html
test_shadow_root_adopted_styles.html
file_bug1018265.xhtml
[test_bug396367-1.html]

View File

@ -422,19 +422,8 @@ async function runTest11() {
requestAnimationFrame(function() { setTimeout(runTest12); } );
}
async function runTest12() {
await compareFiles("test_document_adopted_styles.html", "test_adopted_styles_ref.html");
requestAnimationFrame(function() { setTimeout(runTest13); } );
}
async function runTest13() {
await compareFiles("test_shadow_root_adopted_styles.html", "test_adopted_styles_ref.html");
requestAnimationFrame(function() { setTimeout(runTest14); } );
}
// Crash test for bug 1615261
async function runTest14() {
async function runTest12() {
frameElts[0].contentDocument.body.innerHTML =
'<style> div { width: 100px; height: 100px; background-image: url("animated.gif"); } </style>' +
'<div>Firefox will crash if you try and print this page</div>';

View File

@ -1,3 +0,0 @@
<!doctype html>
<meta charset="utf-8">
<p style="color: blue;">This text should be blue.</p>

View File

@ -1,8 +0,0 @@
<!doctype html>
<meta charset="utf-8">
<p class="target">This text should be blue.</p>
<script>
const sheet = new CSSStyleSheet();
document.adoptedStyleSheets = [sheet];
sheet.replaceSync(".target { color: blue; }");
</script>

View File

@ -1,11 +0,0 @@
<!doctype html>
<meta charset="utf-8">
<body>
<script>
document.body.attachShadow({mode: "open"}).innerHTML = `
<p class="target">This text should be blue.</p>
`;
const sheet = new CSSStyleSheet();
sheet.replaceSync(".target { color: blue; }");
document.body.shadowRoot.adoptedStyleSheets = [sheet];
</script>

View File

@ -1321,29 +1321,12 @@ already_AddRefed<StyleSheet> StyleSheet::Clone(
StyleSheet* aCloneParent, dom::CSSImportRule* aCloneOwnerRule,
dom::DocumentOrShadowRoot* aCloneDocumentOrShadowRoot,
nsINode* aCloneOwningNode) const {
MOZ_ASSERT(!IsConstructed(),
"Cannot create a non-constructed sheet from a constructed sheet");
RefPtr<StyleSheet> clone =
new StyleSheet(*this, aCloneParent, aCloneOwnerRule,
aCloneDocumentOrShadowRoot, aCloneOwningNode);
return clone.forget();
}
already_AddRefed<StyleSheet> StyleSheet::CloneAdoptedSheet(
Document& aConstructorDocument) const {
MOZ_ASSERT(IsConstructed(),
"Cannot create a constructed sheet from a non-constructed sheet");
MOZ_ASSERT(aConstructorDocument.IsStaticDocument(),
"Should never clone adopted sheets for a non-static document");
RefPtr<StyleSheet> clone = new StyleSheet(*this,
/* aParentToUse */ nullptr,
/* aOwnerRuleToUse */ nullptr,
/* aDocumentOrShadowRoot */ nullptr,
/* aOwningNodeToUse */ nullptr);
clone->mConstructorDocument = &aConstructorDocument;
return clone.forget();
}
ServoCSSRuleList* StyleSheet::GetCssRulesInternal() {
if (!mRuleList) {
EnsureUniqueInner();

View File

@ -221,13 +221,6 @@ class StyleSheet final : public nsICSSLoaderObserver, public nsWrapperCache {
dom::DocumentOrShadowRoot* aCloneDocumentOrShadowRoot,
nsINode* aCloneOwningNode) const;
/**
* Creates a clone of the adopted style sheet as though it were constructed
* by aConstructorDocument. This should only be used for printing.
*/
already_AddRefed<StyleSheet> CloneAdoptedSheet(
dom::Document& aConstructorDocument) const;
bool HasForcedUniqueInner() const {
return bool(mState & State::ForcedUniqueInner);
}