Commit Graph

3139 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
31b33c3c16 Bug 1606628 - Remove nsStyleImageRequest. r=tnikkel,heycam
This removes nsStyleImageRequest by moving the load state to LoadData instead
(where other lazy state like the resolved URL and load id lives).

That way we can use cbindgen for more stuff (there's no blocker for using it for
all images now), and we can undo the image tracking shenanigans that I had to do
in bug 1605803 in nsImageFrame.

This removes the mDocGroup member because well, there's no real upside of that
now that quantum DOM is not a thing.

It also removes the static clones of the image requests, and the need for each
computed value instance to have its own request. These were needed because we
needed the image loader for the particular document to observe the image
changes. But we were also tracking the request -> loader for other purposes.
Instead, Now all the images get loaded with GlobalImageObserver as a listener,
which looks in the image map and forwards the notification to all the interested
loaders instead dynamically.

The style value is only responsible to load the image, and no longer tracks /
locks it. Instead, the loader does so, via the image tracker.

Differential Revision: https://phabricator.services.mozilla.com/D58519
2020-02-07 20:36:34 +00:00
Emilio Cobos Álvarez
7e256153ad Bug 1613490 - Cleanup usage of ReferenceBox. r=miko
To avoid computing transform bounds over and over. It is generally just better.

Replace the various "overridebounds" thingies by using the "fallback" of the
transform-reference-box code which we need anyway.

Differential Revision: https://phabricator.services.mozilla.com/D61890
2020-02-07 13:34:42 +00:00
Miko Mynttinen
7edd6dcbd1 Bug 1612895 - Rename nsDisplayHitTestInfoItem to nsDisplayHitTestInfoBase r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D61472
2020-02-04 22:01:48 +00:00
Miko Mynttinen
1f8dd6f369 Bug 1612318 - Use nsDisplayEventReceiver for main thread hit testing instead of nsDisplayBackgroundColor r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D61471
2020-02-04 22:01:00 +00:00
Thomas Dolezal
1d175a57fd Bug 1611733 - Bug 1611633 - convert ns style position defines to enum class. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D61958
2020-02-07 12:35:30 +00:00
Mihai Alexandru Michis
4fd1ac3a38 Backed out changeset c9f4dd3ed78b (bug 1606628) for causing failures in ImageLoader.cpp
CLOSED TREE
2020-02-06 23:19:55 +02:00
Emilio Cobos Álvarez
39c70df4d1 Bug 1606628 - Remove nsStyleImageRequest. r=tnikkel,heycam
This removes nsStyleImageRequest by moving the load state to LoadData instead
(where other lazy state like the resolved URL and load id lives).

That way we can use cbindgen for more stuff (there's no blocker for using it for
all images now), and we can undo the image tracking shenanigans that I had to do
in bug 1605803 in nsImageFrame.

This removes the mDocGroup member because well, there's no real upside of that
now that quantum DOM is not a thing.

It also removes the static clones of the image requests, and the need for each
computed value instance to have its own request. These were needed because we
needed the image loader for the particular document to observe the image
changes. But we were also tracking the request -> loader for other purposes.
Instead, Now all the images get loaded with GlobalImageObserver as a listener,
which looks in the image map and forwards the notification to all the interested
loaders instead dynamically.

The style value is only responsible to load the image, and no longer tracks /
locks it. Instead, the loader does so, via the image tracker.

Differential Revision: https://phabricator.services.mozilla.com/D58519
2020-02-06 20:32:59 +00:00
Emilio Cobos Álvarez
c7c1186c47 Bug 1613349 - Rename nsIFrame::DeleteProperty to RemoveProperty. r=dholbert
As it doesn't necessarily call delete and that may be confusing.

Differential Revision: https://phabricator.services.mozilla.com/D61764
2020-02-06 16:06:49 +00:00
Emilio Cobos Álvarez
096deac0e1 Bug 1613349 - Rename nsIFrame::RemoveProperty to nsIFrame::TakeProperty. r=dholbert
This is hopefully clearer naming.

Differential Revision: https://phabricator.services.mozilla.com/D61755
2020-02-06 00:13:38 +00:00
Emilio Cobos Álvarez
7eca7861ae Bug 1611462 - Use DeleteProperty rather than RemoveProperty to avoid leaking. CLOSED TREE
MANUAL PUSH: LSAN failures.
2020-02-05 00:40:14 +01:00
Emilio Cobos Álvarez
57e7439068 Bug 1611462 - Optimize position changes better. r=dholbert
When our position changes from / to absolute / fixed, then we need to reframe
(most likely, at least). But in some easier cases we can just live with a reflow
plus (optionally) a containing-block update or a repaint, depending on the case.

We need to delete the normal position property when this happens and we switch
from static to relative/sticky, and also need to update the handling of
UpdateContainingBlock to avoid making decisions based on position not changing.

This will actually not cause more reframes, as one would expect, because that
optimization became somewhat obsolete by bug 1519371 (which made the
optimization exact).

Differential Revision: https://phabricator.services.mozilla.com/D61142
2020-02-04 21:20:34 +00:00
Ting-Yu Lin
bc3ed57b49 Bug 1610670 - Add AllPhysicalHalfCorners() to support range-based for loops. r=mats
This patch is generated via:
1. Manually modify gfx/2d/Types.h
2. Run the following script and clang-format.
3. Add brackets for the for loop in nsCSSRendering.cpp.

```

function rename() {
    echo "Renaming $1 to $2"
    rg -l "$1" | xargs sed -i -E -e s/"$1"/"$2"/g
}

rename "NS_FOR_CSS_HALF_CORNERS\(i\)" "for (const auto i : mozilla::AllPhysicalHalfCorners())"
rename "NS_FOR_CSS_HALF_CORNERS\(corner\)" "for (const auto corner : mozilla::AllPhysicalHalfCorners())"
```

Differential Revision: https://phabricator.services.mozilla.com/D61252
2020-02-04 03:28:47 +00:00
Ting-Yu Lin
6205510cad Bug 1610670 - Add AllPhysicalSides() to support range-based for loops. r=mats
This patch is generated via:
1. Manually modify gfx/2d/Types.h
2. Run the following script and clang-format.

```

function rename() {
    echo "Renaming $1 to $2"
    rg -l "$1" | xargs sed -i -E -e s/"$1"/"$2"/g
}

rename "NS_FOR_CSS_SIDES\(side\)" "for (const auto side : mozilla::AllPhysicalSides())"
rename "NS_FOR_CSS_SIDES\(s\)" "for (const auto s : mozilla::AllPhysicalSides())"
rename "NS_FOR_CSS_SIDES\(i\)" "for (const auto i : mozilla::AllPhysicalSides())"
rename "NS_FOR_CSS_SIDES\(ix\)" "for (const auto ix : mozilla::AllPhysicalSides())"
```

Differential Revision: https://phabricator.services.mozilla.com/D61250
2020-02-04 03:28:27 +00:00
Emilio Cobos Álvarez
91b13122ac Bug 1603964 - Only treat block-level frames as line-breaks in paragraph selection code. r=mats
Differential Revision: https://phabricator.services.mozilla.com/D61421
2020-02-04 01:15:28 +00:00
Thomas Dolezal
a69a366a92 Bug 1612148 - Replace transform style defines to an enum class. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D61388
2020-02-01 20:23:26 +00:00
Narcis Beleuzu
e8a9623819 Backed out 2 changesets (bug 1612148) for reftest failures. CLOSED TREE
Backed out changeset e1432ef26779 (bug 1612148)
Backed out changeset 0c1831f15450 (bug 1612148)
2020-02-01 19:23:06 +02:00
Thomas Dolezal
db60806cd3 Bug 1612148 - Replace transform style defines to an enum class. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D61388
2020-02-01 15:50:04 +00:00
Emilio Cobos Álvarez
48eb20de60 Bug 1611912 - Add a style flag for the root element style. r=heycam
This is needed to make the root element not a containing block in presence of
filters or what not.

Differential Revision: https://phabricator.services.mozilla.com/D61167
2020-01-31 14:51:06 +00:00
Emilio Cobos Álvarez
a0eda86c37 Bug 1611583 - Use cbindgen for css-align types. r=dholbert
This provides stronger typing and removes a bunch of subtle constants matching.

Differential Revision: https://phabricator.services.mozilla.com/D61058
2020-01-31 00:56:49 +00:00
Mirko Brodesser
25cd1fd155 Bug 1609662: part 16) Move nsRange::IsNodeSelected to nsINode::IsSelected. r=smaug
Make it const-correct too.

Differential Revision: https://phabricator.services.mozilla.com/D60643
2020-01-27 09:25:00 +00:00
Emilio Cobos Álvarez
98b23176f7 Bug 1597055 - Don't stretch grid items with non-auto block-size. r=mats
Per the resolution in https://github.com/w3c/csswg-drafts/issues/4525.

Differential Revision: https://phabricator.services.mozilla.com/D60675
2020-01-25 20:14:59 +00:00
Sakura Mochizuki
f8e50aafb6 Bug 1611040 - Convert dominant-baseline #defines to an enum class. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D61046
2020-01-25 10:51:24 +00:00
Boris Chiou
61103664ac Bug 1609786 - Make the empty svg path valid. r=emilio
Per SVG2 spec, the EBNF allows the path data string to be empty.
An empty path data string disables rendering of the path.
Therefore, we should make path('') a valid path string.

The related spec issue: https://github.com/w3c/fxtf-drafts/issues/392.
Now we serialize `path("")` as `path("")` for offset-path and clip-path.

Differential Revision: https://phabricator.services.mozilla.com/D60771
2020-01-24 18:59:03 +00:00
Emilio Cobos Álvarez
79768ff848 Bug 1611181 - Make direction use an enum class. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D60857
2020-01-24 11:46:14 +00:00
Sylvestre Ledru
9bd2328337 Bug 1519636 - Automatically reformat recent changes using clang-format r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D60354
2020-01-21 09:51:27 +00:00
Jonathan Kew
c3d3bded5c Bug 1605265 - Don't include overflow child list when computing outline rect. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D59582
2020-01-10 23:44:46 +00:00
Michael Wilson
b27146eb6b Bug 1605874 - nsFrame.cpp: Remove a nested redundant #if. r=sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D58736
2020-01-09 07:54:10 +00:00
Boris Chiou
6883e12a85 Bug 779598 - Do animations of transforms with preserve-3d at compositor. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D57029
2019-12-23 09:52:43 +00:00
Hiroyuki Ikezoe
791a8f760c Bug 779598 - Call GetVisualOverflowRectRelativeToSelf() only in the case of NoPrerender. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D56642
2019-12-23 09:52:39 +00:00
Chris Peterson
0a9155f83b Bug 1570499 - Part 1: Replace MOZ_FALLTHROUGH macro with C++17's [[fallthrough]] attribute. r=froydnj
This changeset is a simple find and replace of `MOZ_FALLTHROUGH` and `[[fallthrough]]`.

Unfortunately, the MOZ_FALLTHROUGH_ASSERT macro (to assert on case fallthrough in debug builds) is still necessary after switching from [[clang::fallthrough]] to [[fallthrough]] because:

* MOZ_ASSERT(false) followed by [[fallthrough]] triggers a -Wunreachable-code warning in DEBUG builds
* but MOZ_ASSERT(false) without [[fallthrough]] triggers a -Wimplicit-fallthrough warning in NDEBUG builds.

Differential Revision: https://phabricator.services.mozilla.com/D56440
2019-12-20 07:16:43 +00:00
Alex Henrie
5b412df3c4 Bug 1604394 - Remove dead assignment from nsIFrame::PeekOffset. r=dbaron
Differential Revision: https://phabricator.services.mozilla.com/D57418
2019-12-17 05:09:00 +00:00
Alex Henrie
94bba66028 Bug 1603995 - Remove dead assignments from nsFrame::BoxReflow. r=dbaron
Differential Revision: https://phabricator.services.mozilla.com/D57233
2019-12-15 06:23:01 +00:00
jeffin143
d3b5feefb7 Bug 1601990 : convert NS_STYLE_POINTER_EVENTS_* to an enum class in nsStyleConsts.h r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D56203
2019-12-12 10:24:16 +00:00
Emilio Cobos Álvarez
d761604f5f Bug 1600536 - user-select: auto on input / textarea should behave as text. r=mats
This is covered by existing tests, via the removal of the rule in forms.css

Differential Revision: https://phabricator.services.mozilla.com/D56355
2019-12-09 18:16:57 +00:00
Emilio Cobos Álvarez
c1ea9d632b Bug 1596050 - When ignoring document colors, ignore ::selection styles altogether. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D53171
2019-12-09 17:24:06 +00:00
Emilio Cobos Álvarez
1fccbabe09 Bug 1602317 - Switch style system to associated constants-in-body. r=heycam
This is closer to the equivalent Rust code.

Differential Revision: https://phabricator.services.mozilla.com/D56306
2019-12-09 03:32:28 +00:00
Gabriele Svelto
eeb9bfc398 Bug 1600545 - Remove useless inclusions of header files generated from IDL files in accessible/, browser/, caps/, chrome/, devtools/, docshell/, editor/, extensions/, gfx/, hal/, image/, intl/, ipc/, js/, layout/, and media/ r=Ehsan
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

Differential Revision: https://phabricator.services.mozilla.com/D55443
2019-12-06 09:16:44 +00:00
Hiroyuki Ikezoe
03cf2ccce1 Bug 1593362 - Bail out from nsFrame::HandleDrag if the corresponding nsFrameSelection has been already destroyed. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D56109
2019-12-06 05:43:03 +00:00
jeffin143
608491cf62 Bug 1600481 : convert NS_STYLE_ISOLATION_* to an enum class in nsStyleConsts.h r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D55378
2019-12-06 04:42:18 +00:00
Coroiu Cristina
90a190ac06 Backed out changeset 6c09d8b07585 (bug 1596050) for reftest failures at layout/reftests/high-contrast/selection-001.html on a CLOSED TREE 2019-12-02 21:29:26 +02:00
Emilio Cobos Álvarez
bfb689a2d1 Bug 1596050 - When ignoring document colors, ignore ::selection styles altogether. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D53171
2019-12-02 17:42:35 +00:00
Emilio Cobos Álvarez
3f9cab940b Bug 1597160 - Remove nsChangeHint_UpdateWidgetProperties. r=mstange
:ntim was about to add another widget-affecting property (pointer-events) to
menupopups to replace the mousethrough attribute, see bug 1597120.

But pointer-events is inherited, and thus changing pointer-events on any element
would cause a change list of length == the number of descendants of the element,
which is not amazing.

So I suggested using DidSetComputedStyle instead, as this is fairly
popup-specific, but we may as well be consistent and do the same everywhere.

This removes the code to handle the -moz-window-* properties on the root frame,
as I haven't seen any usage of them (we always set them in panel or menupopup).

Differential Revision: https://phabricator.services.mozilla.com/D53377
2019-11-20 02:37:06 +00:00
James Hooks
ba8488e17f Bug 1585806 - Make SideBits an enum class, add casting where necessary. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D51291
2019-11-16 20:59:34 +00:00
Emilio Cobos Álvarez
4f61d0a1b3 Bug 1596768 - Remove GetBindingParent usage in layout. r=smaug
We only use it to escape out of NAC trees for ::selection pseudo-element.

Differential Revision: https://phabricator.services.mozilla.com/D53216
2019-11-15 16:18:06 +00:00
Ting-Yu Lin
bd54ded89f Bug 1596339 Part 6 - Use ToString() on nsPoint and nsSize in frame tree dump. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D52967
2019-11-15 03:59:28 +00:00
Ting-Yu Lin
59090d73dd Bug 1596339 Part 5 - Use ToString() on nsRect in frame tree dump. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D52966
2019-11-15 03:52:14 +00:00
Ting-Yu Lin
5f3ec28dc0 Bug 1596339 Part 3 - Implement operator<< for LogicalSize, and use it in frame tree dump. r=dholbert
Note: The output format of BaseSize is "3 x 5", so a pair of parentheses
is added around %s in "logical-size=(%s)" to make it looks better.

Differential Revision: https://phabricator.services.mozilla.com/D52964
2019-11-15 04:49:27 +00:00
Ting-Yu Lin
661474d8d1 Bug 1596339 Part 2 - Implement operator<< for LogicalRect, and use it in frame tree dump. r=dholbert
This change uses parentheses, i.e. '(' and ')', to enclose the dimension
of LogicalRect. This match the output of BaseRect's operator<<.

Note: This introduces inconsistency in the frame tree dump because some
of the output format still use braces to enclose the data. But in later
patches, I'll gradually change the format to use parentheses.

Differential Revision: https://phabricator.services.mozilla.com/D52963
2019-11-15 03:51:56 +00:00
Ting-Yu Lin
055c7552c1 Bug 1596339 Part 1 - Implement operator<< for WritingMode, and use it in frame tree dump. r=dholbert
WritingMode.h already depends on ostream header implicitly via
nsBidiUtils.h -> nsString.h. For completeness, I still add #include
<ostream>.

While I'm here, I make the format of debug prints in nsLineBox more
consistent with the counter-part in nsFrame. Some of them will be
revised in the later patches.

Differential Revision: https://phabricator.services.mozilla.com/D52962
2019-11-15 03:51:54 +00:00
Boris Chiou
ec0567a623 Bug 1484780 - Cache gfx::Path to avoid building and flattening path at each restyle cycle. r=heycam
In most cases, we run an animation on an object by changing its
offset-distance/offset-rotate, but keep its offset-path the same.
Building and flattening the path is sometime expensive, especially for
large path, so caching it makes sense to us and have a significant
performance improvement. This is for the main thread motion path
animations.

Note: Even though we support compositor animations for motion path,
nsIFrame::GetTransformMatrix() is still called during the animations for
other usages, so we may still build the gfx::Path on the main thread
without this patch, so this improvement becomes necessary for most cases.

Differential Revision: https://phabricator.services.mozilla.com/D46667
2019-11-07 03:17:58 +00:00