Commit Graph

3612 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
14c69b2672 Bug 1362907 - Make select use nsHTMLButtonControlFrame for layout. r=jfkthame,dholbert
This simplifies our combobox code a bit more:

 * Reflow() is only needed to compute the label isize.
 * Frame construction uses a setup more similar to <input type=file> to
   get the right frame tree, removing a bunch of special code.
 * Lots of special code removed all over the place.

Differential Revision: https://phabricator.services.mozilla.com/D203010
2024-02-29 11:15:52 +00:00
Emily McDonough
d8944d6766 Bug 1865172 Part 1 - Always store a page name value when a breakpoint is first found during block reflow. r=dholbert
This happens in a similar location to where we find a breakpoint caused by a
change in page name. However, if the breakpoint was caused by something else,
we still need to compute this value so that the next page being constructed
will have the correct page name.

This also "fixes" the WPT /css/printing/page-name-007-print.html, which passed
before this patch just because our previous logic would continue using the last
page value in those cases, which coincidentally matched what was expected.

Part 2 will include a test that specifically detects this discrepency.

Differential Revision: https://phabricator.services.mozilla.com/D196895
2024-02-24 04:05:45 +00:00
Stanca Serban
f3138fcd27 Backed out 2 changesets (bug 1865172) for causing wpt failures in page-name-unnamed-trailing-001-print.html.
Backed out changeset fc1f91bbfd85 (bug 1865172)
Backed out changeset 17019e03e97c (bug 1865172)
2024-02-24 01:53:19 +02:00
Emily McDonough
fee7314f2a Bug 1865172 Part 1 - Always store a page name value when a breakpoint is first found during block reflow. r=dholbert
This happens in a similar location to where we find a breakpoint caused by a
change in page name. However, if the breakpoint was caused by something else,
we still need to compute this value so that the next page being constructed
will have the correct page name.

This also "fixes" the WPT /css/printing/page-name-007-print.html, which passed
before this patch just because our previous logic would continue using the last
page value in those cases, which coincidentally matched what was expected.

Part 2 will include a test that specifically detects this discrepency.

Differential Revision: https://phabricator.services.mozilla.com/D196895
2024-02-23 22:34:37 +00:00
Emilio Cobos Álvarez
affea68f07 Bug 1877591 - Suppress scrollable table cells when printing. r=dholbert
Much like we suppress most (all?) other block-level scrollframes, see:

  https://searchfox.org/mozilla-central/rev/5c4a45eb17423373ecb71aea9819d41a6231613e/layout/base/nsCSSFrameConstructor.cpp#4392-4394

Otherwise we try to fragment a scrollframe, not good.

Differential Revision: https://phabricator.services.mozilla.com/D200370
2024-02-02 00:41:01 +00:00
Emilio Cobos Álvarez
679a43f9a1 Bug 1876702 - Remove unnecessary distinction between TYPE_FALLBACK and TYPE_NULL. r=smaug
The frame constructor always treats them the same nowadays
(TYPE_FALLBACK used to mean "show the pluginproblem code").

Differential Revision: https://phabricator.services.mozilla.com/D199719
2024-01-29 16:14:09 +00:00
Emilio Cobos Álvarez
e10cc9b317 Bug 1875822 - Remove unused TYPE_FAKE_PLUGIN from nsObjectLoadingContent. r=dom-core,webidl,peterv,smaug
Bonus clean-up.

Differential Revision: https://phabricator.services.mozilla.com/D199271
2024-01-25 18:41:16 +00:00
Frédéric Wang
45c39bb2ac Bug 1874823 - Use NS_BLOCK_DYNAMIC_BFC flag on multi-column containers. r=layout-reviewers,emilio
Per https://drafts.csswg.org/css-multicol/#columns:

"A multi-column container therefore is a regular block container that
 establishes a new independent formatting context"

IsColumnContainerStyle() and BeginBuildingColumns() are currently
used in three places and always together (namely
ConstructFieldSetFrame, ConstructFrameFromItemInternal and the
generic ConstructBlock).

BeginBuildingColumns() asserts that aColumnContent is an nsBlockFrame
and that aComputedStyle corresponds to multi-column container. It
always adds the NS_BLOCK_STATIC_BFC to aColumnContent. It also
makes aColumnContent a `PseudoStyleType::columnContent` and that's
the only place where it's used.

This patch instead makes StyleEstablishesBFC() return true for
PseudoStyleType::columnContent so that the NS_BLOCK_DYNAMIC_BFC bit
is set at init and after further style updates. It thus removes the
need for to explicitly set NS_BLOCK_STATIC_BFC in
BeginBuildingColumns().

There is no behavior changes.

Differential Revision: https://phabricator.services.mozilla.com/D199091
2024-01-24 12:13:42 +00:00
Sandor Molnar
a6c0549a83 Backed out 2 changesets (bug 1874823) for causing assertion failures at builds/worker/checkouts/gecko/layout/generic/nsIFrame.cpp CLOSED TREE
Backed out changeset 4e0e2448d7a5 (bug 1874823)
Backed out changeset 2c0d41730484 (bug 1874823)
2024-01-24 13:39:51 +02:00
Frédéric Wang
7955331c7e Bug 1874823 - Use NS_BLOCK_DYNAMIC_BFC flag on multi-column containers. r=layout-reviewers,emilio
Per https://drafts.csswg.org/css-multicol/#columns:

"A multi-column container therefore is a regular block container that
 establishes a new independent formatting context"

IsColumnContainerStyle() and BeginBuildingColumns() are currently
used in three places and always together (namely
ConstructFieldSetFrame, ConstructFrameFromItemInternal and the
generic ConstructBlock).

BeginBuildingColumns() asserts that aColumnContent is an nsBlockFrame
and that aComputedStyle corresponds to multi-column container. It
always adds the NS_BLOCK_STATIC_BFC to aColumnContent. It also
makes aColumnContent a `PseudoStyleType::columnContent` and that's
the only place where it's used.

This patch instead makes StyleEstablishesBFC() return true for
PseudoStyleType::columnContent so that the NS_BLOCK_DYNAMIC_BFC bit
is set at init and after further style updates. It thus removes the
need for to explicitly set NS_BLOCK_STATIC_BFC in
BeginBuildingColumns().

There is no behavior changes.

Differential Revision: https://phabricator.services.mozilla.com/D199091
2024-01-24 10:52:29 +00:00
Sandor Molnar
91365e8cd8 Backed out 2 changesets (bug 1874823) for causing assertion failures at builds/worker/checkouts/gecko/layout/generic/nsBlockFrame.cpp CLOSED TREE
Backed out changeset f5d297181393 (bug 1874823)
Backed out changeset a38e1f388fd2 (bug 1874823)
2024-01-24 12:22:11 +02:00
Frédéric Wang
bfd7a1a5ef Bug 1874823 - Use NS_BLOCK_DYNAMIC_BFC flag on multi-column containers. r=layout-reviewers,emilio
Per https://drafts.csswg.org/css-multicol/#columns:

"A multi-column container therefore is a regular block container that
 establishes a new independent formatting context"

IsColumnContainerStyle() and BeginBuildingColumns() are currently
used in three places and always together (namely
ConstructFieldSetFrame, ConstructFrameFromItemInternal and the
generic ConstructBlock).

BeginBuildingColumns() asserts that aColumnContent is an nsBlockFrame
and that aComputedStyle corresponds to multi-column container. It
always adds the NS_BLOCK_STATIC_BFC to aColumnContent. It also
makes aColumnContent a `PseudoStyleType::columnContent` and that's
the only place where it's used.

This patch instead makes StyleEstablishesBFC() return true for
PseudoStyleType::columnContent so that the NS_BLOCK_DYNAMIC_BFC bit
is set at init and after further style updates. It thus removes the
need for to explicitly set NS_BLOCK_STATIC_BFC in
BeginBuildingColumns().

There is no behavior changes.

Differential Revision: https://phabricator.services.mozilla.com/D199091
2024-01-24 09:50:44 +00:00
Ting-Yu Lin
46f5143aab Bug 1865012 Part 4 - Remove PageValuesProperty copy in frame continuations. r=dholbert
It was added in bug 1804772. After Part 1, accessing FirstInFlow() is constant
time, so we don't need to duplicate PageValuesProperty in each frame
continuation.

Differential Revision: https://phabricator.services.mozilla.com/D197759
2024-01-23 23:15:02 +00:00
Emilio Cobos Álvarez
d79ce67c15 Bug 221154 - Make overflow work on table cells. r=dholbert
Depends on D198786

Differential Revision: https://phabricator.services.mozilla.com/D197978
2024-01-23 09:45:26 +00:00
Norisz Fay
a7b0088da8 Backed out 4 changesets (bug 1865012) for causing mochitest failure on test_gencontent.html CLOSED TREE
Backed out changeset 95d920859b91 (bug 1865012)
Backed out changeset 26f6c2765cb5 (bug 1865012)
Backed out changeset 30a3c356ebc9 (bug 1865012)
Backed out changeset 4fb71ff990ae (bug 1865012)
2024-01-23 02:17:49 +02:00
Ting-Yu Lin
064ae31be8 Bug 1865012 Part 4 - Remove PageValuesProperty copy in frame continuations. r=dholbert
It was added in bug 1804772. After Part 1, accessing FirstInFlow() is constant
time, so we don't need to duplicate PageValuesProperty in each frame
continuation.

Differential Revision: https://phabricator.services.mozilla.com/D197759
2024-01-22 19:50:49 +00:00
Tom Schuster
8c14e039c0 Bug 1875466 - Remove nsIObjectLoadingContent::TYPE_IMAGE. r=webidl,emilio
Depends on D199116

Differential Revision: https://phabricator.services.mozilla.com/D199117
2024-01-22 14:26:11 +00:00
Tom Schuster
549a8ff507 Bug 1875466 - Remove browser.opaqueResponseBlocking.syntheticBrowsingContext pref. r=emilio
Depends on D199115

Differential Revision: https://phabricator.services.mozilla.com/D199116
2024-01-22 14:26:11 +00:00
Narcis Beleuzu
600cbc7a39 Backed out 2 changesets (bug 221154) for causing crashtests. CLOSED TREE
Backed out changeset 166b593890ef (bug 221154)
Backed out changeset 274f73457318 (bug 221154)
2024-01-19 20:17:38 +02:00
Emilio Cobos Álvarez
3bab568d66 Bug 221154 - Make overflow work on table cells. r=dholbert
Depends on D198786

Differential Revision: https://phabricator.services.mozilla.com/D197978
2024-01-19 16:33:54 +00:00
Iulian Moraru
0abfc3b0a4 Backed out 2 changesets (bug 1865172) for causing wpt failures on page-size-007-print.html. CLOSED TREE
Backed out changeset ab9a94d4c0bf (bug 1865172)
Backed out changeset 087e1d3a393f (bug 1865172)
2024-01-19 00:49:06 +02:00
Emily McDonough
6d48e8f2ad Bug 1865172 Part 1 - Use computed page value on first reflow for all pages that don't have a pushed page name r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D196895
2024-01-18 19:11:00 +00:00
Ting-Yu Lin
5c884d5335 Bug 1874897 - Revert Bug 1873530 Part 3 to fix performance regression. r=dholbert
This reverts commit https://hg.mozilla.org/mozilla-central/rev/dfcfa98a7e21
without any additional modification.

Differential Revision: https://phabricator.services.mozilla.com/D198764
2024-01-17 05:14:35 +00:00
Frédéric Wang
8656a4a0a7 Bug 1765615 - Introduce NS_BLOCK_DYNAMIC_BFC state bit. r=layout-reviewers,emilio
After D198523, NS_BLOCK_FLOAT_MGR and NS_BLOCK_MARGIN_ROOT are always
set simultaneously when initiating a frame, so we can merge them into a
single NS_BLOCK_STATIC_BFC flag. The freed bit is used to define a new
NS_BLOCK_DYNAMIC_BFC flag that has the same effect and is now used for
frames with paint/layout containment so that in D197043 they can be
updated later without having to reconstruct the frame tree. Finally
NS_BLOCK_BFC_STATE_BITS is the bitwise union of these BFC flags.

The following changes are made and cause no behavior changes:

- Instead of testing whether NS_BLOCK_FLOAT_MGR or NS_BLOCK_MARGIN_ROOT
  is set, or whether all of the bits from
  NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS are set, we test whether any
  of the NS_BLOCK_BFC_STATE_BITS is set.

- Instead of adding NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS when
  constructing a frame, we add NS_BLOCK_STATIC_BFC. The exception is
  for frame with paint/layout containment, for which we set
  NS_BLOCK_DYNAMIC_BFC instead.

Differential Revision: https://phabricator.services.mozilla.com/D198530
2024-01-16 07:58:47 +00:00
Frédéric Wang
81d67ee144 Bug 1765615 - Remove flags parameter from NS_NewComboboxControlFrame/NS_NewSelectsAreaFrame. r=layout-reviewers,emilio
nsCSSFrameConstructor::ConstructSelectFrame is the only place where
these functions are called and the flags parameter is always set to
NS_BLOCK_FLOAT_MGR.

Differential Revision: https://phabricator.services.mozilla.com/D198520
2024-01-15 15:35:50 +00:00
Ting-Yu Lin
1c5fd05aca Bug 1873530 Part 3 - Unify continuation linking operations by removing SetPrevContinuation() and SetPrevInFlow(). r=jfkthame
SetNextContinuation() and SetPrevContinuation() are almost always called
together when setting up a continuation link, but the callers don't call them in
particular order. We should unify them as one method so that it's more
ergonomics and robust, especially when we do more complex work such as caching
continuations. Same reason for SetNextInFlow() and SetPrevInFlow().

We choose to merge the SetPrevContinuation() code into SetNextContinuation() for
the symmetry of SetNextSibling(). (Yes, we don't have SetPrevSibling().)

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D197966
2024-01-11 19:50:58 +00:00
Emilio Cobos Álvarez
c27730d3df Bug 1364813 - Remove IsFrameOfType, use non-virtual checks. r=jwatt
Extend the per-frame-class bit we have to devirtualize IsLeaf to also
devirtualize IsFrameOfType. That is, move this data to FrameClasses.py.

This was done by going through all the frame classes, trying to preserve
behavior.

The only quirky thing is that I had to add two more trivial frame
classes, `nsAudioFrame` for audio elements, and
`nsFloatingFirstLetterFrame`. That's because these frame classes were
returning different answers at runtime, but they do this only on
conditions that trigger frame reconstruction (floating, and being an
audio element, respectively).

Differential Revision: https://phabricator.services.mozilla.com/D194703
2023-11-26 22:17:28 +00:00
David Shin
3730f7260b Bug 1865668: Don't generate text node for pseudo-elements with empty string content. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D194094
2023-11-21 21:14:11 +00:00
Emilio Cobos Álvarez
c1820e53c4 Bug 1863402 - Simplify top layer fixed list set-up and back out bug 1799036. r=dholbert
The top layer fixed list CB and the regular fixed list CB are always the
same (the viewport frame). We're currently using two different
AbsoluteFrameList for these, but that's wrong. Make sure to use the same
AbsoluteFrameList. This makes sure that placeholders for the fixed list
are properly ordered.

Revert bug 1799036 (for now at least), since this also fixes that issue
in a better, less breaking way.

While at it, also insert the top layer abspos list after the
non-top-layer one. This is needed so that a non-top-layer abspos element
and a top layer abspos element are laid out in the right order.

We don't need to share a list for those tho, because all top-layer
abspos items are also abspos containers themselves, so a non-top-layer
descendant of a top layer item can't escape the top layer chain. This
fixes a couple non-fatal asserts.

Differential Revision: https://phabricator.services.mozilla.com/D192908
2023-11-09 11:29:59 +00:00
Emilio Cobos Álvarez
67372ce7e5 Bug 1856374 - Add a pref to stop forcing details elements to be blocks. r=TYLin
This is probably something we want to move towards, so it doesn't hurt
adding a pref to allow people to experiment with it.

Differential Revision: https://phabricator.services.mozilla.com/D189919
2023-10-05 16:59:33 +00:00
Robert Longson
f81a0dc1a1 Bug 1856213 - remove some queryinterface calls r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D190022
2023-10-04 10:41:41 +00:00
Robert Longson
64704c4dba Bug 1856362 part 2 - introduce and use IsSVGFilterPrimitiveElement r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D189858
2023-10-03 10:40:46 +00:00
Robert Longson
2b397759f3 Bug 1856362 part 1 - rename SVGFE to SVGFilterPrimitiveelement and SVGFEUnstyledElement to SVGFilterPrimitiveChildElement r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D189857
2023-10-03 10:40:45 +00:00
Emilio Cobos Álvarez
a3c886e9ba Bug 1855668 - Trivially fix some orange tests.
MANUAL PUSH: Orange fix CLOSED TREE
2023-10-02 14:27:04 +02:00
Emilio Cobos Álvarez
e7563558ed Bug 1855668 - Make ::backdrop inherit from the originating element. r=zrhoffman
This is as a result of a spec change (see link in the test), but it
addresses a very long-standing issue with this pseudo-element, see
https://github.com/whatwg/fullscreen/issues/124.

Differential Revision: https://phabricator.services.mozilla.com/D189484
2023-10-02 08:53:54 +00:00
Emily McDonough
c9c5b63c97 Bug 1855567 - Use nsPageFrame::PageContentFrame() in nsCSSFrameConstructor::ConstructPageFrame() r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D189435
2023-09-29 18:28:15 +00:00
Emily McDonough
329253be60 Bug 1854027 - Remove obsolete comments about page frame construction r=dholbert DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D189434
2023-09-28 19:00:51 +00:00
Emily McDonough
c650091e27 Bug 1853455 - Fix nsIFrame::ComputePageValue to check for page style values, rather than checking the start page value. r=dholbert
Because we use NULL to indicate the auto value, once a page contributes a
non-auto page value then that will be all that is seen by ComputePageValue
when a later page doesn't have a page-name at all.

Actually checking for the page-name value will fix page-name values when
an empty/auto page-name follows pages with a non-auto value. It is also
slightly more efficient, as it avoids a frame property lookup and instead
just looks at the computed style.

While we are here, remove an assert that is clearly not possible to occur
anymore, and add a short explanation of the code in ComputePageValue.

Differential Revision: https://phabricator.services.mozilla.com/D188544
2023-09-27 19:06:17 +00:00
Markus Stange
48895feea5 Bug 1853720 - Add a "hot" variant of AUTO_PROFILER_LABEL, for lower overhead when the profiler is disabled. r=aabh,profiler-reviewers
The overhead is showing up in Speedometer 3, especially in the innerHTML setter
when it calls into the frame constructor.

Full breakdown of callers across sp3 is here: https://share.firefox.dev/3rfckTG

Time spent in AutoProfilerLabel during TodoMVC-jQuery innerHTML:
Before: https://share.firefox.dev/3Znlydp 378 sampes
After: https://share.firefox.dev/45VdVgr 71 samples

Differential Revision: https://phabricator.services.mozilla.com/D188487
2023-09-25 19:36:41 +00:00
CanadaHonk
642c4e8df4 Bug 1448248 - Implement CSS attr() fallback r=emilio
Implemented support for fallback values in CSS attr():
`attr(<attr-name>, <attr-fallback>)`

Full syntax supported as of this rev:
`[namespace? `|`]? ident [`,` fallback]?`

Spec: https://drafts.csswg.org/css-values-5/#attr-notation

Also added a new WPT reftest for attr fallback without a type,
and some new attr serialization WPTs (namespace and fallback).

Differential Revision: https://phabricator.services.mozilla.com/D176801
2023-09-20 10:50:05 +00:00
Martin Robinson
a03065ffcd Bug 1845223 - Destroy ContainStyleScopes before recalculating counters & quotes during frame destruction r=emilio
Instead of recalculating quotes and counter before destroying contain
style scopes, calculate them after. This prevents stale frame pointers
from sticking around during counter and quote recalculation.

Differential Revision: https://phabricator.services.mozilla.com/D188254
2023-09-14 20:41:45 +00:00
Emilio Cobos Álvarez
1965f04370 Bug 1851787 - Reduce the amount of stack space ConstructFrameFromItemInternal takes.
This prevents ASAN from exhausting the stack with deep frame trees.

MANUAL PUSH: Trivial ASAN reftest fix.
2023-09-08 17:36:34 +02:00
Emilio Cobos Álvarez
0b366c953e Bug 1851787 - Plumb a DestroyContext through all functions that can destroy frames. r=dholbert
This prevents anonymous content getting destroyed at weird times
during frame destruction.

Differential Revision: https://phabricator.services.mozilla.com/D187693
2023-09-08 15:11:17 +00:00
Olli Pettay
42cc25f02b Bug 1851250, recreate the frame if single char math:mi changes, r=emilio
Depends on D187334

Differential Revision: https://phabricator.services.mozilla.com/D187335
2023-09-03 17:45:41 +00:00
Emilio Cobos Álvarez
6fd5ddc656 Bug 1850238 - Make BROKEN state non-intrinsic. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D187108
2023-08-31 09:20:40 +00:00
Cristina Horotan
c37791a4a6 Backed out 3 changesets (bug 1850238, bug 1850161) for causing multiple failures at Element.cpp CLOSED TREE
Backed out changeset 30526c800ca7 (bug 1850161)
Backed out changeset ebc81e5e7750 (bug 1850161)
Backed out changeset e66a62c2f8c5 (bug 1850238)
2023-08-31 12:12:05 +03:00
Emilio Cobos Álvarez
01b6773528 Bug 1850238 - Make BROKEN state non-intrinsic. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D187108
2023-08-31 07:46:24 +00:00
Emilio Cobos Álvarez
a67155e52a Bug 1835864 - Make printing / paged mode deal with multiple canvas backgrounds properly. r=dholbert
The subdocument call when there's no root frame is silly, because we
won't find a canvas frame and we'll end up with transparent.

This needs to tweak the canvas frame construction code to make canvas
anon content show up on the "top" canvas, not on the page content
canvas.

This can be simplified now, because the reason we had to build canvas
anon content before processing kids of the root frame (bug 1558352) no
longer applies since I made popups regular out-of-flow elements
(bug 1799343).

Differential Revision: https://phabricator.services.mozilla.com/D179461
2023-08-10 12:59:00 +00:00
Jan-Niklas Jaeschke
4134763b27 Bug 1838262, part 2: Implemented getComputedStyle() for custom highlight api. r=emilio
This patch introduces functional pseudo parameters, i.e. `::highlight(foo)`,
for `getComputedStyle()`. This required adapting the parse algorithm (`nsCSSPseudoElements::ParsePseudoElement()`) and forwarding the functional pseudo parameter into the style engine.

Differential Revision: https://phabricator.services.mozilla.com/D183773
2023-07-31 13:47:54 +00:00
Frederic Wang
a61a50c1e2 Bug 1788223 - Remove preferences for maction/semantics. r=emilio
This commit removes the preference
mathml.legacy_maction_and_semantics_implementations.disabled
that controls whether we layout maction/semantics as an mrow +
extra style. It has been set to true since Firefox 106.

Differential Revision: https://phabricator.services.mozilla.com/D184720
2023-07-31 07:46:30 +00:00