Commit graph

135 commits

Author SHA1 Message Date
Mirko Brodesser
c0d32bffc5 Bug 1685303: part 10) Annotate nsFrameSelection::HandleClick with MOZ_CAN_RUN_SCRIPT. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D101598
2021-01-14 13:24:36 +00:00
Mirko Brodesser
f6f7a6f1aa Bug 1685303: part 8) Annotate nsFrameSelection::SetDragState with MOZ_CAN_RUN_SCRIPT. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D101467
2021-01-14 13:24:16 +00:00
Bogdan Tara
0700454a9e Backed out 4 changesets (bug 1685303) for bustage complaining about offsets CLOSED TREE
Backed out changeset a4640aac6619 (bug 1685303)
Backed out changeset bd2020c26531 (bug 1685303)
Backed out changeset 3f2e96b93f19 (bug 1685303)
Backed out changeset 8cf49a7677c9 (bug 1685303)
2021-01-14 12:58:25 +02:00
Mirko Brodesser
353996bf27 Bug 1685303: part 8) Annotate nsFrameSelection::SetDragState with MOZ_CAN_RUN_SCRIPT. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D101467
2021-01-14 10:20:30 +00:00
Mats Palmgren
51ff79f7fa Bug 1686310 part 7 - Remove ReflowInput::mFrameType and associated code, which is now dead code. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D101554
2021-01-14 03:23:40 +00:00
Mats Palmgren
cd4d90de10 Bug 1686310 part 2 - Replace NS_FRAME_IS_REPLACED* with a bit that caches the corresponding IsFrameOfType result. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D101549
2021-01-14 03:15:31 +00:00
Emilio Cobos Álvarez
dbf895e4c3 Bug 1685078 - Use enum classes and more explicit names for ImageLoader flags. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D101070
2021-01-08 09:44:47 +00:00
Emilio Cobos Álvarez
8558796b8d Bug 1351248 - nsFieldSetFrame should claim to be focusable if its inner scrollframe is. r=smaug
Otherwise we stop moving focus because, when we find the scrollable
area, we determine that we need to focus the fieldset, but then the
focus manager early-returns in `nsFocusManager::SetFocusInner`.

Depends on D100423

Differential Revision: https://phabricator.services.mozilla.com/D100424
2020-12-29 22:28:42 +00:00
Emilio Cobos Álvarez
bd8cffdd58 Bug 1351248 - Simplify nsIFrame::IsFocusable API. r=layout-reviewers,mats
We always compute the tabindex value, so just return it to the caller
all the time. This allows us to use early-returns which makes the code a
bit easier to follow.

This patch shouldn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D100423
2021-01-03 23:30:51 +00:00
Boris Chiou
361f923f82 Bug 1683424 - Add UseBoxSizing for AspectRatio class, and fix non-replaced element usage. r=TYLin
Based on the spec, if the aspect-ratio property value is:
1) auto: we should always use content-box dimensions.
2) <ratio>: the aspect-ratio works with box sizing dimensions.
3) auto && <ratio>: we use content-box dimensions in all cases.

So we need an extra flag to address that we should use box-sizing or
always use content-box dimensions while computing the size in
ratio-dependent axis.

This also updates some wpts for non-replaced elements because we should
use content-box if aspect-ratio is 'auto && <ratio>'.

Differential Revision: https://phabricator.services.mozilla.com/D100072
2020-12-23 22:42:55 +00:00
Edgar Chen
2b16b12d46 Bug 1680405 - Make mouse capture working on OOP iframe; r=smaug
This patch add a way to track remote target for mouse capturing. The tracking
remote target will be reset when capturing content is changed or
ReleaseCapturingContent() is called.

In order to make `mouseup` would also be dispatched to correct remote target, we
do ReleaseCapturingContent in EventSetateManager::PostHandleEvent, instead of
in nsIFrame::HandleRelease.

Differential Revision: https://phabricator.services.mozilla.com/D98592
2020-12-18 18:21:23 +00:00
Ting-Yu Lin
378bde9842 Bug 1585485 Part 2 - Move IsReplacedBoxResolvedAgainstZero() into nsIFrame, and rename it. r=dholbert
We want to call it in nsFlexContainerFrame in the next part.

The method also tests form control elements via the helper
FormControlShrinksForPercentISize, not just replaced boxes, so rename it
for accuracy. We also rename the helper by dropping "I" from the
"PercentISize" because the axis the element contributingx to isn't
necessarily its inline-axis.

Differential Revision: https://phabricator.services.mozilla.com/D99951
2020-12-17 20:01:58 +00:00
Emilio Cobos Álvarez
039592f4d8 Bug 1682003 - Avoid UTF-8 -> UTF-16 conversion during CSSOM serialization. r=heycam
This lifts a bunch of string conversions higher up the stack, but allows
us to make the servo code use utf-8 unconditionally, and seemed faster
in my benchmarking (see comment 0).

It should also make a bunch of attribute setters faster too (like
setting .cssText), now that we use UTF8String for them (we couldn't
because we couldn't specify different string types for the getter and
setters).

Differential Revision: https://phabricator.services.mozilla.com/D99590
2020-12-17 14:04:35 +00:00
Razvan Maries
a7af908f30 Backed out changeset 5e9006d8c218 (bug 1680405) for perma failures on PresShell.cpp and browser_mouse_enterleave_switch_tab.js. CLOSED TREE 2020-12-17 13:24:39 +02:00
Edgar Chen
45ea02297b Bug 1680405 - Make mouse capture working on OOP iframe; r=smaug
This patch add a way to track remote target for mouse capturing. The tracking
remote target will be reset when capturing content is changed or
ReleaseCapturingContent() is called.

In order to make `mouseup` would also be dispatched to correct remote target, we
do ReleaseCapturingContent in EventSetateManager::PostHandleEvent, instead of
in nsIFrame::HandleRelease.

Differential Revision: https://phabricator.services.mozilla.com/D98592
2020-12-17 09:28:00 +00:00
Dorel Luca
c7cf087b6e Backed out changeset 7253a9d881d0 (bug 1680405) for assertion failures in worker/checkouts/gecko/layout/base/PresShell.cpp. CLOSED TREE 2020-12-16 07:19:44 +02:00
Edgar Chen
9b5d278abd Bug 1680405 - Make mouse capture working on OOP iframe; r=smaug
This patch add a way to track remote target for mouse capturing. The tracking
remote target will be reset when capturing content is changed or
ReleaseCapturingContent() is called.

In order to make `mouseup` would also be dispatched to correct remote target, we
do ReleaseCapturingContent in EventSetateManager::PostHandleEvent, instead of
in nsIFrame::HandleRelease.

Differential Revision: https://phabricator.services.mozilla.com/D98592
2020-12-16 00:29:40 +00:00
Matt Woodrow
9650124868 Bug 1680863 - Set the used value of transform-style to flat if the element has mix-blend-mode or isolation. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D99741
2020-12-15 21:44:02 +00:00
Emilio Cobos Álvarez
47a5e9cd5a Bug 1681375 - Allow scrolled-content-block to have a height for editable elements. r=layout-reviewers,mats
Differential Revision: https://phabricator.services.mozilla.com/D99460
2020-12-14 18:15:24 +00:00
Emilio Cobos Álvarez
679bd6efdb Bug 1681022 - Fix the check introduced in the previous patch to actually not override main-size with auto.
MANUAL PUSH: Orange in a CLOSED TREE.
2020-12-07 18:30:53 +01:00
Emilio Cobos Álvarez
0fd0a72af6 Bug 1681022 - Ignore flex-basis: content on a table wrapper. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D98897
2020-12-07 16:29:23 +00:00
Botond Ballo
3695fe3d68 Bug 1673073 - Do not add clip to masked content if a filter applies to the content as well. r=mstange
Depends on D98559

Differential Revision: https://phabricator.services.mozilla.com/D98560
2020-12-03 17:11:40 +00:00
Botond Ballo
755d4c2725 Bug 1673073 - Add a comment to better explain what we're already doing. r=mstange
Depends on D98558

Differential Revision: https://phabricator.services.mozilla.com/D98559
2020-12-03 17:11:22 +00:00
Bogdan Tara
4a649093b9 Backed out changeset 3e90a3759639 (bug 1679208) for scrollbars-no-margin.html failures CLOSED TREE 2020-12-03 01:11:32 +02:00
Emilio Cobos Álvarez
aa15236426 Bug 1679208 - Don't assume int return values in nsITheme. r=mstange
This doesn't hold with fractional scale values. Right now GTK truncates
the scale factor, Windows rounds, and non-native theme rounds as well.

With this native theme will propagate correctly the floating point
values.

I tried to not change behavior meaningfully in any of the other themes,
mostly to avoid risk. GTK and Windows can be trivially tweaked to
support fractional scale factors properly if we wanted to, but seems
better to not do that as part of this patch.

Depends on D98099

Differential Revision: https://phabricator.services.mozilla.com/D98100
2020-12-02 21:40:05 +00:00
Sunita Sen
c95c4ff2ca Bug 1329241 - Add support for touch-action:pinch-zoom - update hittest_touchaction and nsIFrame r=kats
Differential Revision: https://phabricator.services.mozilla.com/D97923
2020-11-24 16:15:57 +00:00
Simon Giesecke
071c7c035f Bug 1676356 - Avoid including PresShell.h from header files. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D96534

Depends on D95184
2020-11-23 16:08:23 +00:00
Boris Chiou
d494534798 Bug 1651776 - Move Compute{Inline|Block}SizeFromAspectRatio() into AspectRatio struct. r=TYLin
We add a new file, AspectRatio.cpp, to definte the method,
ComputeRatioDependentSize. So we don't have to move this function to
WritingModes.h

Besides, we miss the forward declaration of IPC::ParamTraits, so add it
into AspectRatio.h.

Differential Revision: https://phabricator.services.mozilla.com/D95822
2020-11-20 22:38:36 +00:00
Ting-Yu Lin
2151575956 Bug 1677642 - Add a wpt testing an empty box doesn't contribute to parent's scrollable overflow area. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D97513
2020-11-20 01:13:05 +00:00
Ting-Yu Lin
592df41a3f Bug 1678098 - Remove redundant writing mode conversion after calling ReflowOutput::Size(). r=mats
As of bug 1671726, ReflowOutput::Size() accepts any writing mode, so we
don't need to do an extra conversion.

Differential Revision: https://phabricator.services.mozilla.com/D97480
2020-11-19 00:29:45 +00:00
Emilio Cobos Álvarez
2892508f9b Bug 1675376 - Pass consumed bsize to ApplySkipSides when during reflow. r=mats
The caller has it, so let's pass it down so that we don't need to compute it on
demand.

Differential Revision: https://phabricator.services.mozilla.com/D97356
2020-11-18 11:04:27 +00:00
Bogdan Tara
a051dd1b28 Backed out 3 changesets (bug 1675376) for asan crashtest failures CLOSED TREE
Backed out changeset b276c591ea2d (bug 1675376)
Backed out changeset 20d5c7217304 (bug 1675376)
Backed out changeset e3aa6fb62422 (bug 1675376)
2020-11-18 08:00:38 +02:00
Emilio Cobos Álvarez
433b2ca30a Bug 1675376 - Pass consumed bsize to ApplySkipSides when during reflow. r=mats
The caller has it, so let's pass it down so that we don't need to compute it on
demand.

Differential Revision: https://phabricator.services.mozilla.com/D97356
2020-11-18 03:08:06 +00:00
Ting-Yu Lin
545a6376cd Bug 1677635 Part 4 - Rename nsOverflowAreas to OverflowAreas, and move it into mozilla namespace. r=layout-reviewers,emilio
This patch is generated via the rename functionality in my editor; add
`mozilla::` prefix to `OverflowAreas` in headers; and remove the
`OverflowType` alias added in Part 1.

Differential Revision: https://phabricator.services.mozilla.com/D97235
2020-11-18 00:08:12 +00:00
Ting-Yu Lin
6c3c98b004 Bug 1677635 Part 2 - Remove all external users of the obsolete nsOverflowType. r=layout-reviewers,emilio
In the next part, we are going to remove `nsOverflowType` in
OverflowAreas' implementation.

Differential Revision: https://phabricator.services.mozilla.com/D97233
2020-11-17 23:43:33 +00:00
Ting-Yu Lin
05d16fd80b Bug 1677635 Part 1 - Add an enum class mozilla::OverflowType, and remove NS_FOR_FRAME_OVERFLOW_TYPES. r=layout-reviewers,emilio
The existing nsOverflowType will be removed in the next part.

Also, I change `UnionRectIncludeEmpty` to `UnionRectEdges` in two FIXME
comments because the method is renamed in Bug 641426 Part 5
https://hg.mozilla.org/mozilla-central/rev/90e46b3e8e6f

Differential Revision: https://phabricator.services.mozilla.com/D97232
2020-11-17 23:45:09 +00:00
Ting-Yu Lin
bfa631581a Bug 1675128 Part 5 - Store ReflowInput::mComputedOffsets in LogicalMargin. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D96129
2020-11-07 00:03:40 +00:00
Boris Chiou
1a43abe700 Bug 1665327 - The minor refactoring to avoid duplicate code when checking if the {min|max} block-size is auto. r=TYLin
The check of auto min/max block size happens many times and we can avoid
these duplicates.

Differential Revision: https://phabricator.services.mozilla.com/D95900
2020-11-04 22:48:55 +00:00
Boris Chiou
2ca58af841 Bug 1665327 - Support transferred {min|max} inline-size by using definite {min|max} block-size and aspect-ratio for non-replaced elements. r=TYLin
This addressed https://github.com/w3c/csswg-drafts/issues/5257.
The min-block-size or max-block-size should affect the inline size computed
through an aspect ratio.

I intentionally don't implement this for transferred {min|max}
block-size because
1. This is useful only if block-size is indefinite.
2. If block-size is indefinite, we may use the inline-size and aspect-ratio to
   get the block-size, which makes block-size definite.
3. This means it is useful when both inline-size and block-size are
   indefinite (e.g. auto).
   In this case, we still resolve a possible inline-size by clamping it
   between specified (and transferred) min and max inline-sizes. Then
   we map this inline-size to block-size through aspect-ratio. This
   transferred block-size should also be between specified (and
   transferred) min and max block-sizes.

Differential Revision: https://phabricator.services.mozilla.com/D94911
2020-11-04 23:44:03 +00:00
Ting-Yu Lin
1c052b9ff3 Bug 1674931 Part 2 - Add WritingMode argument to SizeComputationInput::ComputedLogicalBorderPadding(), and adapt callers. r=jfkthame
This patch is similar to Part 1, but for ComputedLogicalBorderPadding().

Differential Revision: https://phabricator.services.mozilla.com/D95662
2020-11-03 19:57:40 +00:00
Ting-Yu Lin
9910d9e651 Bug 1674931 Part 1 - Add WritingMode argument to SizeComputationInput::ComputedLogicalMargin(), and adapt callers. r=jfkthame
It's straightforward to determine which writing mode is required to pass
to ComputedLogicalMargin() by looking at any subsequent method called on
the margin.

For example, if we see

```
ComputedLogicalMargin().BStartEnd(wm);
```

the writing mode needed to pass to `ComputedLogicalMargin()` is `wm`.

Differential Revision: https://phabricator.services.mozilla.com/D95661
2020-11-03 19:44:58 +00:00
Boris Chiou
850434d326 Bug 1672793 - Treat 0 or infinity as auto for aspect-ratio on replaced elements. r=emilio
For replaced elements, if <ratio> is not finite, we should treat is as
auto and just use its intrinic ratio.

Differential Revision: https://phabricator.services.mozilla.com/D95412
2020-11-02 18:43:01 +00:00
Boris Chiou
686b5fd424 Bug 1672793 - Treat 0 or infinity as auto for aspect-ratio on non-replaced elements. r=emilio
Basically, we compute aspect-ratio property only when aspect-ratio is
finite non-zero, so just need to drop the comment and add the wpts.

Differential Revision: https://phabricator.services.mozilla.com/D95411
2020-11-02 18:14:59 +00:00
Ting-Yu Lin
1531f4b093 Bug 1674450 Part 7 - Store SizeComputationInput's computed margin, border/padding, and padding in logical coordinates. r=layout-reviewers,jfkthame
The one-argument SetComputedLogicalMargin(),
SetComputedLogicalBorderPadding(), and SetComputedLogicalPadding() are
not changed because the next part are going to delete them.

Note that I'm deliberately not making ComputedLogicalMargin() and others
to return `const LogicalMargin&` because the compilers can use RVO to
eliminate unnecessary copy. If we'd like to convert them to accept all
writing mode like `nsIFrame::GetLogicalUsedMargin(WritingMode)` so that
the caller don't need to call `ConvertTo`, they can't return a const
reference anyway.

Differential Revision: https://phabricator.services.mozilla.com/D95370
2020-10-31 14:42:04 +00:00
Ting-Yu Lin
8c17380539 Bug 1674450 Part 6 - Convert ReflowInput::Init()'s optional border and padding parameters to Maybe<LogicalMargin>. r=layout-reviewers,jfkthame
Similar to the optional aContainingBlockSize parameter, both border and
padding should use logical coordinates in ReflowInput::mFrame's writing
mode.

Table frames that need to override border and padding can be simplified a bit.
However, DR_init_constraints_cookie and DR_init_offsets_cookie become more
complex, but they're only for debugging. I'm not planning to update their
internal APIs.

Differential Revision: https://phabricator.services.mozilla.com/D95369
2020-10-31 14:39:23 +00:00
Ting-Yu Lin
acabe0a427 Bug 1674450 Part 5 - Remove SizeComputationInput::ComputedPhysicalBorderPadding() that returns a writable-reference. r=layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D95368
2020-10-31 14:30:11 +00:00
Ting-Yu Lin
d151cd5349 Bug 1674450 Part 4 - Remove SizeComputationInput::ComputedPhysicalPadding() that returns a writable-reference. r=layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D95367
2020-10-31 14:29:50 +00:00
Ting-Yu Lin
e1e3ab6157 Bug 1674450 Part 3 - Remove SizeComputationInput::ComputedPhysicalMargin() that returns a writable-reference. r=layout-reviewers,jfkthame
I favor two-argument SetComputedLogicalMargin() for clarity in this
patch series because it works for any pair of writing mode and logical
margin.

Spoiler alert: the one-argument SetComputedLogicalMargin() will be
removed in a later part.

Differential Revision: https://phabricator.services.mozilla.com/D95366
2020-10-31 14:29:27 +00:00
Ting-Yu Lin
c4f22dc89f Bug 1672462 - Compute flex item's content size suggestion in inline axis via nsIFrame::ComputeSize. r=emilio
Flex item's content size suggestion is the min-content size in the main
axis. Quoting from the CSS Sizing spec, section "5.1. Intrinsic Sizes",

    The min-content size of a box in each axis is the size it would have
    if it was a float given an auto size in that axis (and no minimum or
    maximum size in that axis) and if its containing block was
    zero-sized in that axis. (In other words, the minimum size it has
    when sized as “shrink-to-fit”.)

However, all the frame types' GetMinISize() doesn't consider aspect
ratio (either the intrinsic aspect ratio on images or svg, or the
preferred aspect ratio set by the aspect-ratio property). That is, we
currently don't allow `aspect ratio * definite block-size` as part of
the equation in `inline-size:min-content` (bug 1646100 or bug 1670151).

Luckily, nsIFrame::ComputeSize() already takes care of this [2]. We just
need to add a flag to let ComputeSize() behave as if the flex item had
an auto inline size. The code should be similar to FloatMarginISize() in
BlockReflowInput.cpp except we are calculate the flex item's content-box
size.

[1] https://drafts.csswg.org/css-sizing-3/#intrinsic-sizes
[2] https://searchfox.org/mozilla-central/rev/dbced93f1c57942501c23d4633d01ce59d9087a1/layout/generic/nsContainerFrame.cpp#2732,2735-2736

Differential Revision: https://phabricator.services.mozilla.com/D94802
2020-10-29 22:43:53 +00:00
Miko Mynttinen
db736e8e19 Bug 1640197 - Part 2: Add an additional offset to reference frame r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D88639
2020-10-28 18:27:57 +00:00