Commit graph

789 commits

Author SHA1 Message Date
Ting-Yu Lin
b174442fac Bug 1897135 Part 3 - Change two APIs to ensure root frame is a ViewportFrame. r=dholbert
Move `SetRootFrame()` to nsFrameManager.cpp, because in order to compile
`mRootFrame = aRootFrame` the compiler requires the full definition of
`ViewportFrame` to know that `ViewportFrame` is a subclass of `nsIFrame`

Differential Revision: https://phabricator.services.mozilla.com/D210671
2024-05-17 21:37:02 +00:00
Ting-Yu Lin
7e4bee6f3b Bug 1897135 Part 2 - Remove redundant mFrameManager member in PresShell. r=dholbert
We can just use `mFrameConstructor` to call `GetRootFrame()`. In order to do so
while keeping `PresShell::GetRootFrame()` as a inline method, we need to include
`nsCSSFrameConstructor` header in `PresShell.h`, and remove `PresShell` header
in `nsCSSFrameConstructor.h`. That means we can no longer inline
`RestyleManager()` since it needs to access `PresShell`, but it's OK since
`RestyleManager` is used only in the frame constructor, and is probably not in
the hot path.

Differential Revision: https://phabricator.services.mozilla.com/D210670
2024-05-17 21:37:01 +00:00
Ting-Yu Lin
fe8f4920f8 Bug 1897135 Part 1 - Sort #includes and forward declarations in nsFrameManager, nsCSSFrameConstructor, and PresShell. r=dholbert
Also, delete unused `DEBUG_UNDISPLAYED_MAP` and `DEBUG_DISPLAY_CONTENTS_MAP` in
nsFrameManager.cpp.

Delete the comments between the #includes in PresShell.cpp per coding style
guideline: "Don't place comments between non-conditional includes." in
https://firefox-source-docs.mozilla.org/code-quality/coding-style/coding_style_cpp.html#include-directives

Differential Revision: https://phabricator.services.mozilla.com/D210669
2024-05-17 21:37:01 +00:00
Ting-Yu Lin
927ea5f38a Bug 1824877 Part 5 - Revise build scroll container frame APIs in frame constructor. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D210359
2024-05-15 17:50:50 +00:00
Emilio Cobos Álvarez
4d5aee49f3 Bug 1281158 - Parse alternative text for the content property. r=dshin
This doesn't yet expose it to a11y but that will be done by the a11y
folks, since this blocks some of the a11y interop test-cases.

Modify the tests to not hit the network, and make -moz-alt-content not
exposed to content (we only need it for UA stylesheets).

Differential Revision: https://phabricator.services.mozilla.com/D209690
2024-05-08 16:06:47 +00:00
Ting-Yu Lin
90e99c4665 Bug 1888702 Part 2 - Remove PrependPageBreakItem() and simplify AppendPageBreakItem(). r=layout-reviewers,emilio
The last caller of PrependPageBreakItem() is removed in
https://hg.mozilla.org/mozilla-central/rev/97613a0619b2

Since we only need to append page break items, we don't need
InsertPageBreakItem() and InsertPageBreakLocation enum. We can just implement
AppendPageBreakItem directly.

Differential Revision: https://phabricator.services.mozilla.com/D206150
2024-03-29 23:16:46 +00:00
Emilio Cobos Álvarez
cde53b825e Bug 1874823 - Remove NS_BLOCK_STATIC_BFC and NS_BLOCK_CLIP_PAGINATED_OVERFLOW. r=fredw
Put all the "is this block a BFC" logic in nsBlockFrame.cpp.

The CLIP_PAGINATED_OVERFLOW flag is also redundant, it can just be "has
non-propagated overflow styles" check in ShouldApplyOverflowClipping(),
and frees another bit.

Shouldn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D203590
2024-03-07 16:36:56 +00:00
Emilio Cobos Álvarez
fb89acd3b5 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
2bf56c0358 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
6b93b80768 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
66e4438f6a 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
5730ee0ca5 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
Ting-Yu Lin
a7a6a5f089 Bug 1865186 - Update comment referencing named-pages pref. r=dholbert DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D193836
2023-11-17 21:33:41 +00:00
Emilio Cobos Álvarez
4f153f57ec 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
Emilio Cobos Álvarez
dbbf7dc0fb 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
Ting-Yu Lin
a2e0009587 Bug 1831976 - Fix typos in comments regarding CSS named pages pref. r=dholbert
Replace underscore with hyphen in the pref name.

Differential Revision: https://phabricator.services.mozilla.com/D177421
2023-05-09 00:10:44 +00:00
Emilio Cobos Álvarez
2d0e69f4a1 Bug 1824957 - Remove a bunch of now completely dead XUL layout code. r=layout-reviewers,desktop-theme-reviewers,devtools-reviewers,dao,TYLin
And some related tests.

A bunch of -moz-box* properties are web exposed, so I'll file a
follow-up for hiding them.

Differential Revision: https://phabricator.services.mozilla.com/D173819
2023-03-29 21:23:55 +00:00
Emilio Cobos Álvarez
31c279d479 Bug 1799460 - Implement label[value] and start/end cropping with CSS rather than XUL layout. r=Gijs,jfkthame
This reduces the weird interactions that can appear on menus.

This also progresses BiDi support, including for accesskeys.

Differential Revision: https://phabricator.services.mozilla.com/D161498
2022-11-16 16:27:59 +00:00
Emily McDonough
d146c1f89b Bug 1740365 Part 1 - Use CSS page name when constructing nsPageContentFrames and computed page content style r=dholbert,emilio
This works with margin and page-size, though we can't properly test mixed
page-size yet due to limitations in both print preview testing (which does not
handle multiple pages) and paged reftests (which ignore page-size).

It may be appropriate to remove the @page { margin } propagation from Servo
after this change.

Differential Revision: https://phabricator.services.mozilla.com/D158227
2022-11-10 23:43:48 +00:00
Cosmin Sabou
9909a4a8bb Backed out 2 changesets (bug 1740365) for causing bp-hybrid bustages on PresShell.h. CLOSED TREE
Backed out changeset b52bc7d5cf65 (bug 1740365)
Backed out changeset 5ba5fdd07fe0 (bug 1740365)
2022-11-10 18:06:51 +02:00
Emily McDonough
3a6ac592fe Bug 1740365 Part 1 - Use CSS page name when constructing nsPageContentFrames and computed page content style r=dholbert,emilio
This works with margin and page-size, though we can't properly test mixed
page-size yet due to limitations in both print preview testing (which does not
handle multiple pages) and paged reftests (which ignore page-size).

It may be appropriate to remove the @page { margin } propagation from Servo
after this change.

Differential Revision: https://phabricator.services.mozilla.com/D158227
2022-11-10 15:30:39 +00:00
Emilio Cobos Álvarez
ccf616b673 Bug 1799343 - Simplify XUL popup handling. r=TYLin
* Make non-menulist popups just absolute positioned top-layer items.
 * Simplify menulist popups to just be static-positioned items under
   nsMenuFrame.

We need to keep kPopupList only for nsMenuFrame. In the future it can be
removed, see TODO in xul.css

Differential Revision: https://phabricator.services.mozilla.com/D161404
2022-11-09 20:38:04 +00:00
Csoregi Natalia
9d2ea21e26 Backed out 3 changesets (bug 1799343, bug 1799580) for causing failures on /browser_history_after_appMenu.js. CLOSED TREE
Backed out changeset 63c270ba91ad (bug 1799343)
Backed out changeset 713e6f0fbd20 (bug 1799580)
Backed out changeset 42d1b8742662 (bug 1799343)
2022-11-09 21:26:06 +02:00
Emilio Cobos Álvarez
5c5c337a98 Bug 1799343 - Simplify XUL popup handling. r=TYLin
* Make non-menulist popups just absolute positioned top-layer items.
 * Simplify menulist popups to just be static-positioned items under
   nsMenuFrame.

We need to keep kPopupList only for nsMenuFrame. In the future it can be
removed, see TODO in xul.css

Differential Revision: https://phabricator.services.mozilla.com/D161404
2022-11-09 14:19:22 +00:00
Cristian Tuns
01dcbc81d3 Backed out 2 changesets (bug 1799580, bug 1799343) for causing mochitest failures on win7 CLOSED TREE
Backed out changeset fb0df93a4719 (bug 1799580)
Backed out changeset 493c9ca00c91 (bug 1799343)
2022-11-09 07:15:51 -05:00
Emilio Cobos Álvarez
b513d45bea Bug 1799343 - Simplify XUL popup handling. r=TYLin
* Make non-menulist popups just absolute positioned top-layer items.
 * Simplify menulist popups to just be static-positioned items under
   nsMenuFrame.

We need to keep kPopupList only for nsMenuFrame. In the future it can be
removed, see TODO in xul.css

Differential Revision: https://phabricator.services.mozilla.com/D161404
2022-11-09 09:17:21 +00:00
Sandor Molnar
8e6fe2de11 Backed out 4 changesets (bug 1799343) for causing multiple crashes. CLOSED TREE
Backed out changeset 3150074bccfd (bug 1799343)
Backed out changeset 7f6358a0b692 (bug 1799343)
Backed out changeset 34f040f379b1 (bug 1799343)
Backed out changeset a609c8c27ca8 (bug 1799343)
2022-11-08 05:54:37 +02:00
Emilio Cobos Álvarez
7c743cf916 Bug 1799343 - Simplify XUL popup handling. r=TYLin
* Make non-menulist popups just absolute positioned top-layer items.
 * Simplify menulist popups to just be static-positioned items under
   nsMenuFrame.

We need to keep kPopupList only for nsMenuFrame. In the future it can be
removed, see TODO in xul.css

Differential Revision: https://phabricator.services.mozilla.com/D161404
2022-11-08 00:18:00 +00:00
Timothy Nikkel
81dc489b3c Bug 1798571. Remove unused nsCSSFrameConstructor::mIsDestroyingFrameTree. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D160967
2022-11-01 22:41:13 +00:00
Emilio Cobos Álvarez
235b091ad3 Bug 1665476 - Remove nsRootBoxFrame to unify background propagation between XUL and non-XUL documents. r=layout-reviewers,mats
It's unused on mozilla-central, and Thunderbird can just use the canvas
frame as regular (X)HTML documents, so just use a canvas frame instead
of an nsRootBoxFrame for XUL as well.

nsRootBoxFrame was needed because of various XUL-specific things like
tooltips and so on lived there. But with the move away from XUL, that
functionality has been added to nsCanvasFrame already, behind a
principal check instead.

This also allows simplifying our background propagation setup, which was
only half-working for XUL documents (this bug is a consequence of that).

With this, most of the callers of nsCSSRendering::IsCanvasFrame can go.
They're only two of the frames that would return true for that that
actually paint backgrounds (nsCanvasFrame and nsRootBoxFrame), so the
codepaths in display list building and painting can just check
frame->IsCanvasFrame() instead.

The remaining caller to that function is
nsContainerFrame::SyncWindowProperties, and the change is also legit, in
the sense that the only thing SyncWindowProperties() really cares about
is propagating the max/min-width constraints from the root element's
style to the view/widget, and the only frame that would return true from
IsCanvasFrame and have a view is the viewport frame which is the root of
the frame tree.

Differential Revision: https://phabricator.services.mozilla.com/D90846
2022-09-28 02:56:41 +00:00
Butkovits Atila
7b7cfe8e1b Backed out changeset 503c84054f68 (bug 1665476) for causing mochitest mass failures. CLOSED TREE 2022-09-27 13:04:54 +03:00
Emilio Cobos Álvarez
8ed6f78bb0 Bug 1665476 - Remove nsRootBoxFrame to unify background propagation between XUL and non-XUL documents. r=layout-reviewers,mats
It's unused on mozilla-central, and Thunderbird can just use the canvas
frame as regular (X)HTML documents, so just use a canvas frame instead
of an nsRootBoxFrame for XUL as well.

nsRootBoxFrame was needed because of various XUL-specific things like
tooltips and so on lived there. But with the move away from XUL, that
functionality has been added to nsCanvasFrame already, behind a
principal check instead.

This also allows simplifying our background propagation setup, which was
only half-working for XUL documents (this bug is a consequence of that).

With this, most of the callers of nsCSSRendering::IsCanvasFrame can go.
They're only two of the frames that would return true for that that
actually paint backgrounds (nsCanvasFrame and nsRootBoxFrame), so the
codepaths in display list building and painting can just check
frame->IsCanvasFrame() instead.

The remaining caller to that function is
nsContainerFrame::SyncWindowProperties, and the change is also legit, in
the sense that the only thing SyncWindowProperties() really cares about
is propagating the max/min-width constraints from the root element's
style to the view/widget, and the only frame that would return true from
IsCanvasFrame and have a view is the viewport frame which is the root of
the frame tree.

Differential Revision: https://phabricator.services.mozilla.com/D90846
2022-09-27 08:18:58 +00:00
Emilio Cobos Álvarez
3fddb3b833 Bug 1308080 - Make <details> use a shadow tree as per spec. r=TYLin,smaug
The behavior changes match WebKit and Blink. I can look into upstreaming
some of these to WPT.

Differential Revision: https://phabricator.services.mozilla.com/D34754
2022-09-16 14:54:12 +00:00
Sandor Molnar
259f357a67 Backed out changeset 27c0485f1740 (bug 1308080) for causing assertion failure in dom/ShadowRoot.h & wr failures in /css/css-multicol/multicol-span-all-dynamic CLOSED TREE 2022-09-14 05:47:49 +03:00
Emilio Cobos Álvarez
97f29b0b89 Bug 1308080 - Make <details> use a shadow tree as per spec. r=TYLin,smaug
The behavior changes match WebKit and Blink. I can look into upstreaming
some of these to WPT.

Differential Revision: https://phabricator.services.mozilla.com/D34754
2022-09-13 21:52:50 +00:00
Emilio Cobos Álvarez
b5c2fd645c Bug 1789123 - Make anonymous box wrapping inside XUL boxes be similar to modern flex boxes. r=dholbert
I haven't spotted any UI regression from this, and this should generally
make the XUL -> modern flex transition easier, and simplify some
of the relevant code.

This does fix a few layout issues with emulated flexbox.

For the most part, this shouldn't change behavior without that. This
changes behavior if you have mixed inline/non-inline content in the same
XUL box (before they'd get a single item, now you'd get the flexbox /
grid behavior of one item per inline run), and multiple inline-elements
(which would become their own flex items). But I pushed a patch with
some asserts and they didn't fire on our browser mochitests, so I think
we're good.

The UA rule refactoring (removing the inherit from xul anon blocks)
shouldn't matter in practice, since we only have one item (so
box-ordinal is irrelevant) and they have overflow: visible (so
text-overflow and overflow-clip-box shouldn't have an effect).

Differential Revision: https://phabricator.services.mozilla.com/D156375
2022-09-08 11:51:15 +00:00
Emilio Cobos Álvarez
e23e2a0212 Bug 1783934 - Add a chrome-only -moz-box-layout: legacy | flex, and use that to implement flexbox emulation. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D154153
2022-08-10 19:46:37 +00:00
Marian-Vasile Laza
8274331cda Backed out changeset 449fe2d946ea (bug 1783934) for causing mochitest failures on test_animation-type-longhand.html. CLOSED TREE 2022-08-10 19:48:38 +03:00
Emilio Cobos Álvarez
f4206bdde5 Bug 1783934 - Add a chrome-only -moz-box-layout: legacy | flex, and use that to implement flexbox emulation. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D154153
2022-08-10 15:47:41 +00:00
Emily McDonough
2ab827df0d Bug 1766685 - Do not perform page-breaks in the destructor of the page name tracker RAII struct r=dholbert
Instead, do this just before we addd the frame construction items, where CSS
break-after/break-before is handled.

This also fixes the expectations of three tests where our expectations have
changed. The test page-name-img-001 now succeeds with correct results because
of this change, though the other img and the canvas tests fail due issues with
fragmentation named pages and replaced frames.

The issues with replaced frames are currently caused because our page-break
logic occurs in nsCSSFrameConstructor::AddFrameConstructionItemsInternal, but
this is performed for the parent frame. As the replaced frames have no
children, we never process their children in
nsCSSFrameConstructor::AddFrameConstructionItemsInternal.

The issue with replaced frames will be fixed by
https://bugzilla.mozilla.org/1779645

Differential Revision: https://phabricator.services.mozilla.com/D151331
2022-08-01 20:17:34 +00:00
Emily McDonough
cecd0ac37f Bug 1781957 - Remove argument to nsCSSFrameConstructor::AddFCItemsForAnonymousContent which is not useful r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D152952
2022-07-28 20:21:49 +00:00
Emilio Cobos Álvarez
f912244bff Bug 1778965 - Clean-up a bit alt text code. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D151482
2022-07-11 17:29:31 +00:00
Martin Robinson
f85b73bf84 Bug 1463600 - Implement CSS 'contain: style' r=emilio
Add an implementation of CSS `contain: style`. This introduces two new
data structures, the ContainStyleScope and ContainStyleScopeManager.

ContainStyleScope manages one `contain: style` "world" which has its own
counter and quote lists. The contents of these lists depend on their
parent scopes, but are not affected by their children.
ContainStyleScopeManager manages a tree of scopes starting at a root
scope which is outside of any `contain: style` element.

Scopes are stored in a hash table that is keyed off of the nsIContent
which establishes the `contain: style` scope. When modifying quote or
content lists, the ContainStyleScopeManager is responsible for finding
the appropriate `contain: style` scope to modify.

Perhaps the most complex part of this is that counters and quotes have
read access to the state of counters and quotes that are in ancestor
`contain: style` scopes. In the case of counters, USE nodes that are at
the beginning of counter lists might have a counter scope that starts in
an ancestor `contain: style` scope. When nsCounterNode::SetScope() is
called, the code may look upward in the `contain: style` scope tree to
find the start of the counter scope. In the case of quotes, the first
node in the quote list must look for the state of quotes in ancestor
`contain: style` scopes.

Differential Revision: https://phabricator.services.mozilla.com/D149508
2022-06-22 16:16:59 +00:00
Bogdan Szekely
b56ae513c7 Backed out changeset 86e9449aba35 (bug 1463600) for causing xpcshell failures on test_css-properties-db.js 2022-06-22 15:35:33 +03:00
Martin Robinson
83640bbee6 Bug 1463600 - Implement CSS 'contain: style' r=emilio
Add an implementation of CSS `contain: style`. This introduces two new
data structures, the ContainStyleScope and ContainStyleScopeManager.

ContainStyleScope manages one `contain: style` "world" which has its own
counter and quote lists. The contents of these lists depend on their
parent scopes, but are not affected by their children.
ContainStyleScopeManager manages a tree of scopes starting at a root
scope which is outside of any `contain: style` element.

Scopes are stored in a hash table that is keyed off of the nsIContent
which establishes the `contain: style` scope. When modifying quote or
content lists, the ContainStyleScopeManager is responsible for finding
the appropriate `contain: style` scope to modify.

Perhaps the most complex part of this is that counters and quotes have
read access to the state of counters and quotes that are in ancestor
`contain: style` scopes. In the case of counters, USE nodes that are at
the beginning of counter lists might have a counter scope that starts in
an ancestor `contain: style` scope. When nsCounterNode::SetScope() is
called, the code may look upward in the `contain: style` scope tree to
find the start of the counter scope. In the case of quotes, the first
node in the quote list must look for the state of quotes in ancestor
`contain: style` scopes.

Differential Revision: https://phabricator.services.mozilla.com/D149508
2022-06-22 10:42:34 +00:00
Emilio Cobos Álvarez
27e31ed3bf Bug 1771571 - Fix include header mess between frame constructor / restyle manager. r=layout-reviewers,AlaskanEmily
RestyleManager includes nsPresContextInlines which includes
nsCSSFrameConstructor which includes RestyleManager.

Break the cycle, since turns out the later include is not needed.

Differential Revision: https://phabricator.services.mozilla.com/D147560
2022-05-31 20:07:38 +00:00
Emily McDonough
f7af34aa62 Bug 1740366 - Implement paginated fragmentation on page-name boundaries r=dholbert
This has a TODO about empty page names on previous sibling frames, to match
Chrome's behavior of page break coalescing we should be looking to the frame
before that sibling and check for page breaks there instead.

Differential Revision: https://phabricator.services.mozilla.com/D140423
2022-04-28 00:03:19 +00:00
Emilio Cobos Álvarez
72d2420c2b Bug 1766395 - Remove dom.forms.datetime-local prefs. r=edgar
We shipped this a while ago.

Differential Revision: https://phabricator.services.mozilla.com/D144800
2022-04-27 14:10:27 +00:00
Emilio Cobos Álvarez
b651bfe99a Bug 1744009 - Simplify combobox <select> code. r=mconley,dholbert
With this patch on its own we get some a11y tests failures, but those
are fixed on a later patch.

Combobox select no longer creates frames for its <options>, nor an
nsListControlFrame. Instead, it computes its right intrinsic size using
the largest size of the options. This is better, because we render the
option text using the select style so if the select and option styles
are mismatched it'd cause changes in the size of the select when text
changes. See the following in a build without the patch, for example:

  <select>
    <option>ABC</option>
    <option style="font-size: 1px">Something long</option>
  </select>

This seems like a rather obscure case, but it's important to get it
right, see bug 1741888.

With this patch we use the same setup in content and parent processes
(this needs bug 1596852 and bug 1744152). This means we can remove a
bunch of the native view and popup code in nsListControlFrame. A couple
browser_* tests are affected by this change and have been tweaked
appropriately (the changes there are trivial).

Not creating an nsListControlFrame for dropdown select means that we
need to move a bunch of the event handling code from nsListControlFrame
to a common place that nsComboboxControlFrame can also use. That place
is HTMLSelectEventListener, and I think the setup is much nicer than
having the code intertwined with nsListControlFrame. It should be
relatively straight-forward to review, mostly moving code from one part
to another.

Another thing that we need to do in HTMLSelectEventListener that we
didn't use to do is listening for DOM mutations on the dropdown. Before,
we were relying on changes like text mutations triggering a reflow of
the listcontrolframe, which also triggered a reflow of the
comboboxcontrolframe, which in turn updated the text of the anonymous
content. Now we need to trigger that reflow manually.

There are some further simplifications that can be done after this
lands (cleanup naming of openInParentProcess and so on, among others),
but I'd rather land this first (after the merge of course) and work on
them separately.

Differential Revision: https://phabricator.services.mozilla.com/D132719
2022-01-17 11:10:05 +00:00
Marian-Vasile Laza
35a88d897e Backed out 2 changesets (bug 1744009) for causing reftest failures on select-3.html.
Backed out changeset 3e44e31d3d12 (bug 1744009)
Backed out changeset 619389788775 (bug 1744009)
2022-01-17 11:14:27 +02:00