Граф коммитов

1159 Коммитов

Автор SHA1 Сообщение Дата
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
Emily McDonough c0c82e4fc5 Bug 1819468 - Do not propagate page names from subclasses of block frames r=dholbert
Remove some related now-default pref setting in printing crashtests.list
while we're here.

Differential Revision: https://phabricator.services.mozilla.com/D172342
2023-03-28 22:22:59 +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
Emily McDonough 543eb5e869 Bug 1804794 - Do not allow CSS named page breaks except in specific subtrees. r=dholbert
This currently only includes block frames, grid containers, and flex
containers, and the document and pagination frames. It is possible more frames
will need to be added or more advanced checks in the future.

This adds some related tests to ignoring some subtrees, but are expected fails
until bug 1816570 is fixed.

Differential Revision: https://phabricator.services.mozilla.com/D169018
2023-02-22 23:49:51 +00:00
Butkovits Atila 9159bcd837 Backed out changeset 70a0f82267f1 (bug 1804794) for causing build bustages at ReflowInput.cpp. CLOSED TREE 2023-02-22 06:48:12 +02:00
Emily McDonough 75a6f4f11e Bug 1804794 - Do not allow CSS named page breaks except in specific subtrees. r=dholbert
This currently only includes block frames, grid containers, and flex
containers, and the document and pagination frames. It is possible more frames
will need to be added or more advanced checks in the future.

This adds some related tests to ignoring some subtrees, but are expected fails
until bug 1816570 is fixed.

Differential Revision: https://phabricator.services.mozilla.com/D169018
2023-02-22 02:29:31 +00:00
Jonathan Kew 1b3e69f8aa Bug 1815404 - Remove refcounting from gfxContext. r=gfx-reviewers,lsalzman
Depends on D170367

Differential Revision: https://phabricator.services.mozilla.com/D170369
2023-02-21 07:28:24 +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
David Shin 824e42a012 Bug 1785046 - Part 2: Ensure `RemotePrintJobParent` reports completion to its listeners at when all of its work is done. r=emilio,nika
Previously, we notified the listeners with a done event when `RemotePrintJobChild`
reported done, even if there is work left on the parent side.

Differential Revision: https://phabricator.services.mozilla.com/D163507
2022-12-19 15:42:47 +00:00
Frederic Wang f2e17c3b46 Bug 1586574 - apply horizontal writing mode to mathml elements. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D48279
2022-12-16 17:07:56 +00:00
Emily McDonough a7d0e54361 Bug 1804798 - Explicitly set auto page name (and corresponding debug flag) when inserting frames in nsCSSFrameConstructor::ContentRangeInserted r=dholbert
Unfortunately, this can be called through both reflow and frame construction
much like nsCSSFrameConstructor::ContentAppended, so we can't just use a page-
name tracker.

Differential Revision: https://phabricator.services.mozilla.com/D164760
2022-12-15 20:30:29 +00:00
Emily McDonough 9d851b65c0 Bug 1804571 - Fix missing page-name trackers for Ruby frames r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D164622
2022-12-14 23:16:05 +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
Emilio Cobos Álvarez 42b7f1a58c Bug 1780788 - Use abstract strings as in-arguments for ipdl. r=nika,necko-reviewers,media-playback-reviewers,alwu,dragana
This prevents copies and avoids the hack we have to avoid this, which
right now is using nsDependent{C,}String.

Non-virtual actors can still use `nsString` if they need to on the
receiving end.

Differential Revision: https://phabricator.services.mozilla.com/D152519
2022-07-25 20:19:48 +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 e7ce1d2a70 Bug 1776074 part 6: Simplify nsPrintObject init list. r=emilio
Move two assignments to the declaration site, and remove an unnecessary
nullptr assignment (for a nsCOMPtr which is nullptr by default).

Depends on D150079

Differential Revision: https://phabricator.services.mozilla.com/D150176
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
Daniel Holbert 28249f9570 Bug 1776074 part 0: Mark nsPrintObject as 'final' and drop irrelevant comment about its destructor being non-virtual. r=emilio
It has no parent or child classes, so there's no reason that any of its methods
(including its destructor) would be virtual. So it's more-confusing than
helpful to have an explicit "non-virtual" code-comment.

The `final` keyword on the class hopefully makes this more-clear.

Differential Revision: https://phabricator.services.mozilla.com/D150080
2022-06-23 22:56:57 +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
Emilio Cobos Álvarez 98d42ab61a Bug 1770372 - Notify with STATE_IS_DOCUMENT from RemotePrintJobParent. r=nika
This ensures we reject pending promises in PrintListenerAdapter.

Differential Revision: https://phabricator.services.mozilla.com/D147311
2022-05-25 20:56:01 +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
Jonathan Watt 47516e9e83 Bug 1770539 p4 - Move nsPrintData::mNumPrintablePages to nsPrintJob. r=emilio
Depends on D146975

Differential Revision: https://phabricator.services.mozilla.com/D146976
2022-05-22 09:37:56 +00:00
Jonathan Watt db89857906 Bug 1770539 p3 - Move nsPrintData::mShrinkRatio to nsPrintJob::mShrinkToFitFactor. r=emilio
Depends on D146974

Differential Revision: https://phabricator.services.mozilla.com/D146975
2022-05-22 09:37:56 +00:00
Jonathan Watt c0b9f77a02 Bug 1770539 p2 - Move nsPrintData::mShrinkToFit to nsPrintJob. r=emilio
Depends on D146973

Differential Revision: https://phabricator.services.mozilla.com/D146974
2022-05-22 09:37:56 +00:00
Jonathan Watt 90a01d7930 Bug 1770539 p1 - Move nsPrintData::mPrintSettings to nsPrintJob. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D146973
2022-05-22 09:37:55 +00:00
Jonathan Watt ca15f68e8a Bug 1754308 p2 - Stop sending nsIPrintSettings.printerName to content processes. r=bobowen
This avoids exposing printer names to potentially compromised content processes.

The changes in bug 1770211 mean that we no longer create platform specific
nsIDeviceContextSpec instances in the content process, so we no longer need
the printer name to instantiate an nsDeviceContextSpecWin there.

Differential Revision: https://phabricator.services.mozilla.com/D146868
2022-05-20 22:51:00 +00:00