Commit graph

358 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
9116e6b532 Bug 1896762 - Make animation timing match the spec. r=smaug,firefox-animation-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D210658
2024-05-17 16:33:06 +00:00
Natalia Csoregi
9dbc1885f6 Backed out changeset afcc70a5e871 (bug 1896762) for causing failures on css-transition-cross-document.html CLOSED TREE 2024-05-17 18:50:54 +03:00
Emilio Cobos Álvarez
7cea28b6eb Bug 1896762 - Make animation timing match the spec. r=smaug,firefox-animation-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D210658
2024-05-17 08:33:36 +00:00
Jonathan Watt
473cc4095f Bug 1869217. Don't use the @page rules that match the first page as the page defaults. r=emilio
page-rule-specificity-001-print.html is the only test that actually fails prior
to this patch (it already passes in Chrome).

Differential Revision: https://phabricator.services.mozilla.com/D196000
2023-12-11 17:53:41 +00:00
Norisz Fay
f6eb559256 Backed out changeset 8bb12620232e (bug 1869217) for causing bc failures on browser_modal_print.js 2023-12-11 16:55:28 +02:00
Jonathan Watt
76a4feb028 Bug 1869217. Don't use the @page rules that match the first page as the page defaults. r=emilio
page-rule-specificity-001-print.html is the only test that actually fails prior
to this patch (it already passes in Chrome).

Differential Revision: https://phabricator.services.mozilla.com/D196000
2023-12-11 14:16:41 +00:00
Norisz Fay
a251b78fad Backed out changeset a4d1a60eed3e (bug 1869217) for causing build bustages on nsPrintJob.cpp CLOSED TREE 2023-12-11 13:54:23 +02:00
Jonathan Watt
7dd21bd102 Bug 1869217. Don't use the @page rules that match the first page as the page defaults. r=emilio
page-rule-specificity-001-print.html is the only test that actually fails prior
to this patch (it already passes in Chrome).

Differential Revision: https://phabricator.services.mozilla.com/D196000
2023-12-11 10:59:18 +00:00
Jonathan Watt
9209f25a68 Bug 1867674. Always honor pref print.save_as_pdf.use_page_rule_size_as_paper_size.enabled. r=AlaskanEmily
Until recently the only place that checked this pref was the Firefox front-end
code, and it communicated to use the CSS page size as the "paper" sheet size
for PDFs by setting nsIPrintSettings.usePageRuleSizeAsPaperSize. This was
expanded in bug 1866319 to make WPT also ask for the same behavior. However,
there are other places that are failing to ask for this.

Rather than play whack-a-mole to fix up the entry points to PDF printing, this
moves the pref check to the platform code.

The one situation that I'm not changing the pref to work in is when Firefox is
running ond Android. That's just because it's not currently clear to me what
the fallout is of Firefox on Android potentially creating PDFs with different
sheet sizes, and I don't want us to potentially deal with negative fallout as
we're finishing up the Gsuite work in December.

For now, I'm also refraining from removing
nsIPrintSettings.usePageRuleSizeAsPaperSize just in case we run into issues
(not very likely on non-Android) and want to temporarily restore the old
behavior.

Differential Revision: https://phabricator.services.mozilla.com/D195181
2023-12-01 21:06:02 +00:00
Jonathan Watt
c96a66c3de Bug 1865480. Rename nsIContentViewer to nsIDocumentViewer. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D193987
2023-11-21 12:45:59 +00:00
Jonathan Watt
50f811aef5 Bug 1865485. Rename nsIPrintSettings::HasOrthogonalSheetsAndPages to HasOrthogonalPagesPerSheet. r=dholbert
The old name is potentially misleading now that we implement 'page-orientation'
since that provides a new mechanism by which pages could end up orthoganal
to the sheet, but this method is very specifically about pages-per-sheet
induced rotation.

Differential Revision: https://phabricator.services.mozilla.com/D193989
2023-11-20 09:14:50 +00:00
Jonathan Watt
d3134d0e61 Bug 1669815. Remove aInRange outparam from nsPrintJob::PrintPage. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D193988
2023-11-18 22:05:43 +00:00
Daniel Holbert
3a2501e3dc Bug 1859025: Add some profiler markers as guideposts for what's going on during long print operations. r=profiler-reviewers,canaltinova
This patch adds a new layout profiling sub-category "LAYOUT_Printing" for the
markers added here.

I'm adding an "interval"-type marker ("AUTO_PROFILER_MARKER_TEXT") for the
function-calls that seem likely to occupy measurable amounts of time (due to
touching the filesystem or printer driver), vs. single-point-in-time markers
("PROFILER_MARKER_TEXT") for functions whose duration isn't particularly long
or interesting, or whose durations we're already measuring with other
closely-associated interval-markers.

Differential Revision: https://phabricator.services.mozilla.com/D191001
2023-10-18 05:34:50 +00:00
Emilio Cobos Álvarez
25c0d10932 Bug 1624819 - Remove TaskCategory and other quantum dom remnants. r=smaug,media-playback-reviewers,credential-management-reviewers,cookie-reviewers,places-reviewers,win-reviewers,valentin,mhowell,sgalich,alwu
Sorry this is not a particularly easy patch to review. But it should be
mostly straight-forward.

I kept Document::Dispatch mostly for convenience, but could be
cleaned-up too / changed by SchedulerGroup::Dispatch. Similarly maybe
that can just be NS_DispatchToMainThread if we add an NS_IsMainThread
check there or something (to preserve shutdown semantics).

Differential Revision: https://phabricator.services.mozilla.com/D190450
2023-10-10 08:51:12 +00:00
Jan Varga
c458754592 Bug 1855134 - Move existing MOZ_TRY macros to a dedicated header file; r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D189226
2023-09-28 20:46:07 +00:00
Emilio Cobos Álvarez
4cc6758558 Bug 1839922 - Remove usage of {Has,Get}Attr(kNameSpaceID_None, ..). r=edgar
We have more readable and faster versions (that just omit the namespace
arg).

Mostly done via sed, with a couple helpers to use the faster lookups
where possible.

Differential Revision: https://phabricator.services.mozilla.com/D181795
2023-06-23 10:01:32 +00:00
Masayuki Nakano
4d1dbfd96c Bug 1829570 - part 4: Add another overload of AsyncEventDispatcher::RunDOMEventWhenSafe r=smaug
Finally, we can hide the instance method.

Differential Revision: https://phabricator.services.mozilla.com/D176490
2023-05-15 01:07:30 +00:00
Masayuki Nakano
e16a783838 Bug 1829570 - part 2: Add an overload of AsyncEventDispatcher::RunDOMEventWhenSafe r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D176488
2023-05-15 01:07:29 +00:00
Emily McDonough
a225e191c6 Bug 1828004 - Combine GetDefaultPageSizeOrientation and GetPageSizeForPageName r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D175420
2023-04-17 23:27:26 +00:00
Fred Chasen
42c8df00ac Bug 1793220 - Use at-page size rule as paper size when printing to PDF r=dholbert,AlaskanEmily
Adds a usePageRuleSizeAsPaperSize setting to allow overriding the default paper size when printing to a PDF file.

Print preview now checks for at-page size rules and when enabled will use that size for the previewed sheet of paper.

The preview will also return the page width and height (in inches) during its callback for the frontend to use to override the default paper settings.

Differential Revision: https://phabricator.services.mozilla.com/D160303
2023-02-27 20:22:18 +00:00
Jan-Niklas Jaeschke
fa75d3a60f Bug 1803355: Basic implementation of Custom Highlight API. r=edgar,emilio
Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++.

Added `::highlight(foo)` pseudo element to CSS engine.

Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections.

Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`.

Differential Revision: https://phabricator.services.mozilla.com/D164203
2023-01-27 11:42:18 +00:00
Sandor Molnar
4c4d29b581 Backed out changeset d7f27aa40260 (bug 1803355) for causing win build bustage. 2023-01-24 18:07:50 +02:00
Jan-Niklas Jaeschke
1b3bff372b Bug 1803355: Basic implementation of Custom Highlight API. r=edgar,emilio
Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++.

Added `::highlight(foo)` pseudo element to CSS engine.

Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections.

Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`.

Differential Revision: https://phabricator.services.mozilla.com/D164203
2023-01-24 11:46:28 +00:00
Sandor Molnar
a610ef723a Backed out changeset 54771a1963b6 (bug 1803355) for causing win build bustage. CLOSED TREE 2023-01-24 12:17:49 +02:00
Jan-Niklas Jaeschke
99eb703228 Bug 1803355: Basic implementation of Custom Highlight API. r=edgar,emilio
Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++.

Added `::highlight(foo)` pseudo element to CSS engine.

Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections.

Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`.

Differential Revision: https://phabricator.services.mozilla.com/D164203
2023-01-24 07:36:13 +00:00
Noemi Erli
aec839cbc8 Backed out changeset 759d4948ed8b (bug 1803355) for causing build bustages CLOSED TREE 2023-01-22 05:03:04 +02:00
Jan-Niklas Jaeschke
0a52844148 Bug 1803355: Basic implementation of Custom Highlight API. r=edgar,emilio
Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++.

Added `::highlight(foo)` pseudo element to CSS engine.

Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections.

Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`.

Differential Revision: https://phabricator.services.mozilla.com/D164203
2023-01-22 02:04:43 +00:00
Boris Chiou
3af19b13db Bug 1803094 - Create PreShell later than the setup of viewport size when reflowing the print job. r=emilio
Basically, we notify the media feature values changed when creating a
new preshell. For the print job, we have to set the page size, the
visible area, and set mIsRootPaginatedDocument before doing this
notification, so we can get the correct viewport size and use it to select
the correct responsive image source, in print preview of the top level
document.

Note: I intentionally set mIsRootPaginatedDocument earilier than visible
area to avoid a potential redundant notification because we notify the
media feature values changed for all changes when creating a new preshell
as well.

Differential Revision: https://phabricator.services.mozilla.com/D165089
2022-12-21 19:04:58 +00:00
David Shin
aab93348e9 Bug 1785046 - Part 3: Let nsIDeviceContextSpec::EndDocument & nsDeviceContext::EndDocument return MozPromise. r=nika,emilio,geckoview-reviewers,m_kato
All implementors currently simply resolve the promise right away, using
crutch code. Asynchronous usage will be added in the changeset that follows.

Differential Revision: https://phabricator.services.mozilla.com/D163508
2022-12-19 15:42:48 +00:00
Emily McDonough
e9b7eac405 Bug 1804017 - Fix asserts when ReflowPrintObject is called multiple times on the same print job r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D163877
2022-12-06 02:42:23 +00:00
Otto Länd
d5db9e3038 No bug: apply code formatting via Lando
# ignore-this-changeset
2022-12-02 23:28:10 +00:00
Emily McDonough
c7d5537c7f Bug 1800546 Part 1 - Use the style given the first page name for setting default orientation when printing r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D162058
2022-12-02 23:22:50 +00:00
Emilio Cobos Álvarez
368171d435 Bug 1800684 - Remove print_via_parent. r=dshin
For a while it was true everywhere but android, but it's been true
unconditionally since forever.

Differential Revision: https://phabricator.services.mozilla.com/D162116
2022-11-15 16:19:30 +00:00
Jonathan Watt
0f1f88eea5 Bug 1798312 - Rename page::PageOrientation to page::PageSizeOrientation. r=AlaskanEmily
The @page rule may contain both 'page-orientation' and 'size' properties. The
'size' property can contain an orientation component which was being
represented as 'PageOrientation' prior to this patch. This patch changes that
to 'PageSizeOrientation' so that 'PageOrientation' can be used for
'page-orientation' in a subsequent patch.

Differential Revision: https://phabricator.services.mozilla.com/D160790
2022-10-31 22:52:16 +00:00
Jonathan Watt
baf3e643f6 Bug 1776296 - Remove nsPrintJob::mIsForModalWindow. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D158777
2022-10-07 17:24:17 +00:00
Daniel Holbert
834d608a51 Bug 1776289 part 2: Merge nsPrintJob::Initialize into the constructor. r=emilio
This patch doesn't change behavior; it's just collapsing logic from
nsPrintJob's Initialize method (which is now de-facto infallible) into the
constructor.

I'm also removing the "Methods needed by the DocViewer" header-comment since
it's clearly innacurate at this point. It's only surrounding this constructor
and GetSeqFrameAndCountSheets, which is silly since nsDocumentViewer uses more
of our API than that.

(I also placed TODO(dholbert) comments for a few things that looked odd, to
follow up on later. In particular, I noticed that nsDocumentViewer holds a
dedicated stack-owned RefPtr reference to nsPrintJob after creating it, which
superficially looks unnecessary. I don't want to risk changing behvior or
introducing a crash by removing that reference in this refactoring patch, so
I'm leaving that as-is and simply flagging it as suspicious.)

Depends on D150194

Differential Revision: https://phabricator.services.mozilla.com/D150195
2022-06-23 22:57:01 +00:00
Daniel Holbert
221e594b00 Bug 1776289 part 1: Change nsPrintJob::Initialize to take references instead of pointers, to avoid the need for unnecessary null-checks. r=emilio
This patch doesn't change behavior.

Depends on D150177

Differential Revision: https://phabricator.services.mozilla.com/D150194
2022-06-23 22:57:00 +00:00
Daniel Holbert
49e37dc76e Bug 1776074 part 7: Remove mFrameType member (and PrintObjectType in general) from nsPrintObject.h. r=emilio
This patch does not change behavior (other than a minor correctness fix in some
off-by-default logging; see below).

As shown in the removed line of the init list, this mFrameType member-var's
semantics are equivalent to a null-check of the mParent member-var.  So: rather
than encoding that same information twice, this patch simplifies to just
directly null-check the mParent pointer at all the usage sites.

Before this patch, nsPrintJob.cpp had two different patterns for logging
mFrameType; sometimes with a global `gFrameTypesStr` array, and other times
with a local `types` array (with shorter 2-character strings).  I've converted
both of these to helper-functions.

In the case of the `types` array, the old code used a 4-value array, which was
interesting since the enum type only had 2 possible values. This discrepancy is
just due to an oversight in bug 1769508, where we recently condensed the enum
from 4 values to 2; that bug technically should've condensed these arrays as
well (but didn't do so).  This left these arrays' enum-to-string mapping being
wrong (since eIFrame changed its numeric value from 2 to 1 in bug 1769508), but
probably nobody has used this logging code in a while, so nobody
noticed. Anyway: in this patch, I'm restoring the mappings that we had before
that change (so we'll log "DC" for root print objects and "IF" for non-root
i.e. iframe-flavored print objects).

Differential Revision: https://phabricator.services.mozilla.com/D150177
2022-06-23 22:57:00 +00:00
Daniel Holbert
63c1d9f029 Bug 1776074 part 5: Merge nsPrintObject's effectively-infallible Init function into constructor. r=emilio
This patch doesn't change behavior; it's just refactoring.

The pre-existing Init code is now clearly infallible, now that earlier patches
have removed all of Init's NS_ENSURE_STATE arg-null-checks (which were Init's
only failure-returning codepaths).

So: now that it's infallible, we can just merge the Init() code directly into
the constructor.

This lets us promote some member-variables to be 'const' as well, since they
will now be initialized in the init list and are never modified after that.

Differential Revision: https://phabricator.services.mozilla.com/D150079
2022-06-23 22:56:59 +00:00
Daniel Holbert
4685a0aa28 Bug 1776074 part 4: Use references instead of pointers for nsPrintObject::Init's Document and nsDocShell args (and in callers). r=emilio
This patch doesn't change behavior. It just changes to c++ reference types and
code-comments to indicate where we know that pointers have been null-checked
(and removes some null-checks that now become trivially-unnecessary).

I've added code-comments to justify why we know these args are non-null.
Generally, `nsPrintObject::Init`'s args are null-checked by the caller, except
in one case (in `nsPrintJob::DoCommonPrint`) where the Document* pointer in
question was _not_ directly null-checked by the caller. But fortunately, it is
null-checked earlier, higher up in the call-stack.  So, this patch simply
propagates the C++ reference type-conversion up to that point for additional
clarity.

Differential Revision: https://phabricator.services.mozilla.com/D150078
2022-06-23 22:56:59 +00:00
Daniel Holbert
dddd82e118 Bug 1776074 part 3: Merge nsPrintObject's Init methods into one method. r=emilio
This patch doesn't change behavior.

The two init functions were already pretty similar.  This patch merges them,
and uses the "aParent" arg as a signal for which variant we're handling (with
the "root" variant being signalled via a null value).

This usage of aParent (to distinguish between variants) is valid, as long as we
can assume that the old `InitAsNestedObject` variant was always guaranteed to
receive a non-null value for its aParent arg.  (That would mean that we're OK to
use that arg's nullness as a way to distinguish between the two variants in
their new merged form.)

And indeed, we're safe to make this assumption, since there's only one callsite
for the `InitAsNestedObject` version (which is in
`nsPrintJob::BuildNestedPrintObjects`), and it dereferences the pointer before
calling into this init function.  So, the pointer has to be non-null, or else
we would have crashed at the earlier dereference.

Therefore, this conversion (and usage of aParent to distinguish between
variants) is valid.

(Spoiler alert: a later patch in this series will merge this Init() method
into the constructor. I'm doing this as a multi-step process with this
intermediate state, in order to hopefully make it easier to reason about the
conversion and confirm that it's valid.)

Differential Revision: https://phabricator.services.mozilla.com/D150077
2022-06-23 22:56:59 +00:00
Daniel Holbert
f1dfc4848e Bug 1776074 part 2: Remove redundant assignment of mPrintObject->mFrameType. r=emilio
This patch doesn't change behavior.

The assignment here is working with a freshly-constructed `nsPrintObject`,
which was initialized via `InitAsRootObject`. Its `mFrameType` will have
already been assigned to `eDoc` in the constructor.  The only place in our
codebase where we might hypothetically reassign `mFrameType` is in
`InitAsNestedObject`, but that's the other init method -- not the one we're
calling here.

So: `mFrameType` will already be `eDoc` when we reach this assignment, and
the assignment is unnecessary.

Differential Revision: https://phabricator.services.mozilla.com/D150076
2022-06-23 22:56:58 +00:00
Daniel Holbert
a7c7dfb8cd Bug 1776074 part 1: Remove unused 'aForPrintPreview' param from nsPrintObject::InitAsRootObject. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D150075
2022-06-23 22:56:58 +00:00
Andrew McCreight
a9465f49df Bug 1771383 - Null check mPrintObject in nsPrintJob::SetupToPrintContent(). r=emilio
We're seeing a lot of null crashes here. Maybe we're running script since
we last checked mPrintObject and the printer was disconnected or
something along those lines, so just add a null check.

Differential Revision: https://phabricator.services.mozilla.com/D149387
2022-06-15 13:34:11 +00:00
Dmitrij Feller
ba3866a5fc Bug 370035 - Remove the aWidget parameter from nsIDeviceContextSpec::Init.r=spohl
Differential Revision: https://phabricator.services.mozilla.com/D145841
2022-05-23 19:34:40 +00:00
Jonathan Watt
4d4c2e7754 Bug 1770539 p9 - Move nsPrintData::mPrintObject to nsPrintJob. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D146980
2022-05-22 09:37:58 +00:00
Jonathan Watt
464b2f7e71 Bug 1770539 p8 - Centralize nulling out of nsPrintJob::mPrt. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D146981
2022-05-22 09:37:58 +00:00
Jonathan Watt
617a76892b Bug 1770539 p7 - Move nsPrintData::mSelectionRoot to nsPrintJob. r=emilio
Depends on D146978

Differential Revision: https://phabricator.services.mozilla.com/D146979
2022-05-22 09:37:57 +00:00
Jonathan Watt
8827bc2beb Bug 1770539 p6 - Move nsPrintData::mPrintDocList to nsPrintJob. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D146978
2022-05-22 09:37:57 +00:00
Jonathan Watt
224cfeb1b9 Bug 1770539 p5 - Move nsPrintData::mPreparingForPrint to nsPrintJob. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D146977
2022-05-22 09:37:57 +00:00