Now, `IMContextWrapper::Selection` and `IMMHandler::Selection` have same
structure. Therefore, we can merge them into one place. This will help to
fix bug 1259690 in the future.
Differential Revision: https://phabricator.services.mozilla.com/D137421
Perhaps, we should disable IME when DOM Selection does not have range. However,
it's out of scope of this bug. This patch makes `IMContextWrapper` try to
keep working with no selection range except at "compositionstart".
Differential Revision: https://phabricator.services.mozilla.com/D137420
For consistency with `IMMHandler::Selection`, let's make it use
`OffsetAndData<uint32_t>` for preparing them to use a new common class.
Differential Revision: https://phabricator.services.mozilla.com/D137419
It's always overwritten with same value so that it is not necessary at least for
now and on Windows, we just do not update it in same situation. Therefore,
we should drop it until we become need to use it.
Differential Revision: https://phabricator.services.mozilla.com/D137414
With wrapping `IMMHandler::mSelection` with `Maybe`, we can represent there is
no unexpected cases, but there is no selection.
Differential Revision: https://phabricator.services.mozilla.com/D137413
For making it simpler and have "no selection" state, this patch rewrites it
with `OffsetAndData<uint32_t>` wrapped with `Maybe`. Although `IMMHandler`
does nothing if there is no selection.
Differential Revision: https://phabricator.services.mozilla.com/D137412
I'd like to use `OffsetAndData` in `IMMHandler` to store selection range.
Before doing this, this patch adds some useful methods into it.
Differential Revision: https://phabricator.services.mozilla.com/D137411
It needs to have a state whether it's set or unset, and whether there is at
least one selection range or no selection range. Currently, its valid state
represents both of them, but it'll has no selection state in the following
patches. Therefore, the former state should be manged with `Maybe`.
Differential Revision: https://phabricator.services.mozilla.com/D137406
This patch introduces a number of subtle but important changes
to how we deal with off-screen surfaces. The overall goals are:
- Improve rendering correctness in a number of edge cases.
- Begin reducing complexity related to surfaces, scaling
factors, surface size adjustments and clipping.
- Improve CPU performance by removing some per-primitive work.
- Simplify implementation of future SVG and CSS filters by
having explicit support for picture rects + inflation regions.
- Lay the groundwork for caching child picture surfaces,
reduction of per-primitive work during visibility pass,
simplifying picture code.
Unfortunately, the nature of the changes make it impossible to
split up in to small isolated patches. Details below:
* Introduce `LocalRectKind` concept. This allows us to separate
out the bounding rect of the surface (a group of primitives
backed by a texture) from the bounding rect of the picture
compositing that surface (e.g. a drop-shadow which draws the
surface once at the local origin and once at a specific offset
+ blur-radius). This fixes a number of correctness bugs we have
related to culling, clipping, invalidation regions of complex
primitives such as drop-shadows and blur filters. Importantly,
it makes it simpler to implement (or fix) SVG filter chains,
backdrop-filter implementations.
* Establish raster roots for all off-screen surfaces. Every off-screen
surface uses the spatial node of the enclosing stacking context as
a coordinate system root, ensuring that each off-screen surface is
drawn in a 2D coordinate system, with appropriate scaling factors
applied to ensure high quality rendering. The primary goal is to make
it possible to correctly inflate and clip off-screen surfaces, removing
some correctness issues we currently have with complex filters interacting
with transforms. The initial work here doesn't reduce complexity a huge
amount, but will allow us to simplify large parts of the picture/surface
handling code in future, as well as simplify a number of shaders that
currently must handle arbitrarily complex transform matrices. This will
also allow us to simplify the implementation of features such as
mix-blend-mode and backdrop-filter, which rely on readback and UV mapping
from the parent surface.
* Remove concepts of `estimated` and `precise` local rects for pictures. This
is both a performance optimization and a code simplification. Instead, we
only determine the estimated local rect during bounding rect propagation,
and rely on the clipping regions from the tile dirty regions to reduce which
parts of the picture we allocate if drawing to an off-screen surface. This
removes some per-primitive work during the visibility pass, and also means
we can rely on the final picture bounding rect from the start of the visibility
pass. This also removes much of the complexity in `take_context` where we
previously determined surface scale factors and device pixel ratio - instead
these can be determined earlier during `propagate_bounding_rects`.
* Remove some complexity in `update_prim_visibility`. This is still recursive,
but follow up patches will aim to remove this recursion and integrate this
pass with the picture graph (similar to how `propagate_bounding_rects` works).
* Remove `PictureOptions` struct. Instead, store `inflate_if_required` with
the Blur filter enum, which is the only place that uses it.
* Remove `root_scaling_factor` from text runs - this is handled implicitly
by the surface device-pixel scale.
* Skip calling `update_clip_task` for pass-through pictures (since they have
no defined local rect).
* Improve scaling factors used for determining the render task cache size for
complex line decorations.
Differential Revision: https://phabricator.services.mozilla.com/D137569
Previously, we would get the wrong bounds on HiDPI displays.
This matches what's done in ComputeClipForMaskItem and makes things a bit
more explicit by using typed units.
Differential Revision: https://phabricator.services.mozilla.com/D137880
Some try selectors (like 'release' or 'scriptworker') depend on modifying
source files to work. Normally, these changes will be committed into the
temporary commit that the 'hg push-to-try' extension makes.
But if the --no-push flag is specified, these changes will be left lying around
in the sourcedir. This ensures we don't modify anything when '--no-push' is
used.
Differential Revision: https://phabricator.services.mozilla.com/D137806
This is designed to mitigate the problem of third-party fonts that render poorly
under DirectWrite's bold simulation, by using multi-strike synthetic bold (like
we use on macOS) instead.
The behavior is controlled by a pref, so that we can readily switch between
using DWrite's bold simulation for all fonts (pref=2, our current behavior);
using it only for installed fonts and falling back to multi-strike for webfonts
(pref=1, new behavior); or never using the DWrite simulation (pref=0).
Differential Revision: https://phabricator.services.mozilla.com/D137584
For all purposes, this is the same as devicePixelRatio. It was meant to
skip the resistFingerprinting check the devicePixelRatio getter does,
but we do that now using CallerType in WebIDL, so if we cared about that
for these tests (which we don't) we could just do
SpecialPowers.wrap(window).devicePixelRatio.
As a follow-up we could move the NoOverride to window for symmetry. But
it's only used by devtools touch simulation so not sure if worth it.
Differential Revision: https://phabricator.services.mozilla.com/D138021
It does the same as window.devicePixelRatio. However a bunch of this
code is copy-pasted code trying to scale a canvas, but not messing with
full zoom is the right thing to do.
The full zoom value in the top level browser.xhtml page is always 1
anyways, and WindowsPreviewPerTab looking at the current browser tab's
full zoom is just bizarre...
Differential Revision: https://phabricator.services.mozilla.com/D138020
It only pokes at the document's pres context, there's no need to
roundtrip through the outer window. No behavior change.
Differential Revision: https://phabricator.services.mozilla.com/D138019