Issue #2135 - Bug 1425864: Ensure printing documents which have shadow DOM works

This commit is contained in:
FranklinDM 2023-03-04 19:17:22 +08:00 committed by roytam1
commit 015148fcc3
3 changed files with 47 additions and 2 deletions

View file

@ -101,6 +101,23 @@ ShadowRoot::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
return mozilla::dom::ShadowRootBinding::Wrap(aCx, this, aGivenProto);
}
void
ShadowRoot::CloneInternalDataFrom(ShadowRoot* aOther)
{
size_t sheetCount = aOther->SheetCount();
for (size_t i = 0; i < sheetCount; ++i) {
StyleSheet* sheet = aOther->SheetAt(i);
if (sheet && sheet->IsApplicable()) {
// TODO: Remove AsGecko() call once Stylo is removed.
RefPtr<CSSStyleSheet> clonedSheet =
sheet->AsGecko()->Clone(nullptr, nullptr, nullptr, nullptr);
if (clonedSheet) {
AppendStyleSheet(*clonedSheet);
}
}
}
}
ShadowRoot*
ShadowRoot::FromNode(nsINode* aNode)
{