mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1802238
- Don't allow using mixed page sizes when printing unless layout.css.allow-mixed-page-sizes is set r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D162920
This commit is contained in:
parent
b71d7b535b
commit
7b23072da6
@ -402,6 +402,8 @@ void nsPageContentFrame::AppendDirectlyOwnedAnonBoxes(
|
||||
}
|
||||
|
||||
void nsPageContentFrame::EnsurePageName() {
|
||||
MOZ_ASSERT(HasAnyStateBits(NS_FRAME_FIRST_REFLOW),
|
||||
"Should only have been called on first reflow");
|
||||
if (mPageName) {
|
||||
return;
|
||||
}
|
||||
|
@ -594,18 +594,20 @@ nsPageContentFrame* nsPageFrame::PageContentFrame() const {
|
||||
}
|
||||
|
||||
nsSize nsPageFrame::ComputePageSize() const {
|
||||
const nsPageContentFrame* const pcf = PageContentFrame();
|
||||
nsSize size = PresContext()->GetPageSize();
|
||||
|
||||
// Compute the expected page-size.
|
||||
const nsStylePage* const stylePage = pcf->StylePage();
|
||||
const StylePageSize& pageSize = stylePage->mSize;
|
||||
const nsPageFrame* const frame =
|
||||
StaticPrefs::layout_css_allow_mixed_page_sizes()
|
||||
? this
|
||||
: static_cast<nsPageFrame*>(FirstContinuation());
|
||||
const StylePageSize& pageSize = frame->PageContentFrame()->StylePage()->mSize;
|
||||
|
||||
if (pageSize.IsSize()) {
|
||||
// Use the specified size
|
||||
return nsSize{pageSize.AsSize().width.ToAppUnits(),
|
||||
pageSize.AsSize().height.ToAppUnits()};
|
||||
}
|
||||
|
||||
nsSize size = PresContext()->GetPageSize();
|
||||
if (pageSize.IsOrientation()) {
|
||||
// Ensure the correct orientation is applied.
|
||||
if (pageSize.AsOrientation() == StylePageSizeOrientation::Portrait) {
|
||||
@ -631,8 +633,16 @@ float nsPageFrame::ComputePageSizeScale(const nsSize aContentPageSize) const {
|
||||
|
||||
// Check for the simplest case first, an auto page-size which requires no
|
||||
// scaling at all.
|
||||
if (PageContentFrame()->StylePage()->mSize.IsAuto()) {
|
||||
return 1.0f;
|
||||
{
|
||||
const nsPageFrame* const frame =
|
||||
StaticPrefs::layout_css_allow_mixed_page_sizes()
|
||||
? this
|
||||
: static_cast<nsPageFrame*>(FirstContinuation());
|
||||
const StylePageSize& pageSize =
|
||||
frame->PageContentFrame()->StylePage()->mSize;
|
||||
if (pageSize.IsAuto()) {
|
||||
return 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
// Compute scaling due to a possible mismatch in the paper size we are
|
||||
|
@ -8524,6 +8524,12 @@
|
||||
mirror: always
|
||||
rust: true
|
||||
|
||||
# Enables support for different CSS page sizes on each page when printing.
|
||||
- name: layout.css.allow-mixed-page-sizes
|
||||
type: RelaxedAtomicBool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
# Dictates whether or not the prefers contrast media query will be
|
||||
# usable.
|
||||
# true: prefers-contrast will toggle based on OS and browser settings.
|
||||
|
Loading…
Reference in New Issue
Block a user