mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Backed out changeset 8bb12620232e (bug 1869217) for causing bc failures on browser_modal_print.js
This commit is contained in:
parent
d63b2a2057
commit
f6eb559256
@ -1374,8 +1374,18 @@ nsresult nsPrintJob::ReflowPrintObject(const UniquePtr<nsPrintObject>& aPO) {
|
||||
|
||||
RefPtr<PresShell> presShell = aPO->mPresShell;
|
||||
{
|
||||
const ServoStyleSet::PageSizeAndOrientation sizeAndOrientation =
|
||||
presShell->StyleSet()->GetDefaultPageSizeAndOrientation();
|
||||
// Get the initial page name. Even though we haven't done any page-name
|
||||
// fragmentation (that happens during block reflow), this will still be
|
||||
// valid to find the first page's name.
|
||||
const nsAtom* firstPageName = nsGkAtoms::_empty;
|
||||
if (const Element* const rootElement = aPO->mDocument->GetRootElement()) {
|
||||
if (const nsIFrame* const rootFrame = rootElement->GetPrimaryFrame()) {
|
||||
firstPageName = rootFrame->ComputePageValue();
|
||||
}
|
||||
}
|
||||
|
||||
const ServoStyleSet::FirstPageSizeAndOrientation sizeAndOrientation =
|
||||
presShell->StyleSet()->GetFirstPageSizeAndOrientation(firstPageName);
|
||||
// XXX Should we enable this for known save-to-PDF pseudo-printers once
|
||||
// bug 1826301 is fixed?
|
||||
if (mPrintSettings->GetOutputFormat() ==
|
||||
|
@ -662,11 +662,11 @@ StyleSheet* ServoStyleSet::SheetAt(Origin aOrigin, size_t aIndex) const {
|
||||
Servo_StyleSet_GetSheetAt(mRawData.get(), aOrigin, aIndex));
|
||||
}
|
||||
|
||||
ServoStyleSet::PageSizeAndOrientation
|
||||
ServoStyleSet::GetDefaultPageSizeAndOrientation() {
|
||||
PageSizeAndOrientation retval;
|
||||
ServoStyleSet::FirstPageSizeAndOrientation
|
||||
ServoStyleSet::GetFirstPageSizeAndOrientation(const nsAtom* aFirstPageName) {
|
||||
FirstPageSizeAndOrientation retval;
|
||||
const RefPtr<ComputedStyle> style =
|
||||
ResolvePageContentStyle(nullptr, StylePagePseudoClassFlags::NONE);
|
||||
ResolvePageContentStyle(aFirstPageName, StylePagePseudoClassFlags::FIRST);
|
||||
const StylePageSize& pageSize = style->StylePage()->mSize;
|
||||
|
||||
if (pageSize.IsSize()) {
|
||||
|
@ -260,12 +260,12 @@ class ServoStyleSet {
|
||||
size_t SheetCount(Origin) const;
|
||||
StyleSheet* SheetAt(Origin, size_t aIndex) const;
|
||||
|
||||
struct PageSizeAndOrientation {
|
||||
struct FirstPageSizeAndOrientation {
|
||||
Maybe<StylePageSizeOrientation> orientation;
|
||||
Maybe<nsSize> size;
|
||||
};
|
||||
// Gets the default page size and orientation (the size/orientation specified
|
||||
// by @page rules without a selector list), if any.
|
||||
// Gets the specified orientation and size used when the first page printed
|
||||
// has the name |aFirstPageName|, based on the page-size property.
|
||||
//
|
||||
// If the specified size is just an orientation, then the size will be set to
|
||||
// nothing and the orientation will be set accordingly.
|
||||
@ -273,7 +273,8 @@ class ServoStyleSet {
|
||||
// to nothing.
|
||||
// Otherwise, the size will and orientation is determined by the specified
|
||||
// page size.
|
||||
PageSizeAndOrientation GetDefaultPageSizeAndOrientation();
|
||||
FirstPageSizeAndOrientation GetFirstPageSizeAndOrientation(
|
||||
const nsAtom* aFirstPageName);
|
||||
|
||||
void AppendAllNonDocumentAuthorSheets(nsTArray<StyleSheet*>& aArray) const;
|
||||
|
||||
|
@ -1,28 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Paged Media: @page without selector provides defaults</title>
|
||||
<link rel="author" title="Jonathan Watt" href="mailto:jwatt@jwatt.org"/>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-page/#cascading-and-page-context"/>
|
||||
<meta name="assert" content="@page with a selector should not apply to non-matched pages">
|
||||
<link rel="match" href="page-rule-specificity-print-landscape-ref.html"/>
|
||||
<meta name="reftest-pages" content="2">
|
||||
<style>
|
||||
|
||||
/* WPT Print Reftest default size is 5x3in - this should only change that for the first page */
|
||||
@page :first {
|
||||
size: portrait;
|
||||
}
|
||||
div:first-of-type {
|
||||
break-after: page;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<div>Portrait</div>
|
||||
<div>Landscape</div>
|
||||
</body>
|
||||
</html>
|
@ -1,30 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Paged Media: @page without selector provides defaults</title>
|
||||
<link rel="author" title="Jonathan Watt" href="mailto:jwatt@jwatt.org"/>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-page/#cascading-and-page-context"/>
|
||||
<meta name="assert" content="@page rule without a selector list should apply to pages not matched by rules with selectors">
|
||||
<link rel="match" href="page-rule-specificity-print-landscape-ref.html"/>
|
||||
<meta name="reftest-pages" content="2">
|
||||
<style>
|
||||
|
||||
@page :first {
|
||||
size: portrait;
|
||||
}
|
||||
@page {
|
||||
size: landscape;
|
||||
}
|
||||
div:first-of-type {
|
||||
break-after: page;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<div>Portrait</div>
|
||||
<div>Landscape</div>
|
||||
</body>
|
||||
</html>
|
@ -1,30 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Paged Media: @page without selector provides defaults</title>
|
||||
<link rel="author" title="Jonathan Watt" href="mailto:jwatt@jwatt.org"/>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-page/#cascading-and-page-context"/>
|
||||
<meta name="assert" content="@page rule without a selector list should apply to pages not matched by rules with selectors">
|
||||
<link rel="match" href="page-rule-specificity-print-portrait-ref.html"/>
|
||||
<meta name="reftest-pages" content="2">
|
||||
<style>
|
||||
|
||||
@page :first {
|
||||
size: landscape;
|
||||
}
|
||||
@page {
|
||||
size: portrait;
|
||||
}
|
||||
div:first-of-type {
|
||||
break-after: page;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<div>Landscape</div>
|
||||
<div>Portrait</div>
|
||||
</body>
|
||||
</html>
|
@ -1,15 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<link rel="author" title="Jonathan Watt" href="mailto:jwatt@jwatt.org"/>
|
||||
<style>
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<div>Landscape</div>
|
||||
</body>
|
||||
</html>
|
@ -1,18 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<link rel="author" title="Jonathan Watt" href="mailto:jwatt@jwatt.org"/>
|
||||
<style>
|
||||
|
||||
@page :first {
|
||||
size: portrait;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<div>Portrait</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user