Commit Graph

4162 Commits

Author SHA1 Message Date
Ting-Yu Lin
bd049e9e7c Bug 1879996 Part 3 - Implement GetFrameName() for nsCheckboxRadioFrame and nsSelectsAreaFrame. r=layout-reviewers,emilio
Before this patch, `nsCheckboxRadioFrame` and `nsSelectsAreaFrame` are shown as
`Frame` and `Block` in the frame tree dump. This patch gives them proper names
so that it is easier to find their implementation when looking at the frame tree
dump.

Differential Revision: https://phabricator.services.mozilla.com/D201667
2024-02-14 23:57:19 +00:00
Ting-Yu Lin
b200f5577e Bug 1879996 Part 2 - Remove 'virtual' keyword for methods already having 'override'. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D201666
2024-02-14 23:57:18 +00:00
Ting-Yu Lin
5f82538069 Bug 1879996 Part 1 - Remove an obsolete comment for nsCheckboxRadioFrame. r=tlouw
We've moved `GetUsableScreenRect()` into `nsComboboxControlFrame.cpp` in
https://hg.mozilla.org/mozilla-central/rev/7f37547c29ff

Differential Revision: https://phabricator.services.mozilla.com/D201665
2024-02-14 23:57:18 +00:00
Edgar Chen
c185ccc69a Bug 1878976 - Remove plugin-related code in EventStateManager; r=emilio
`nsIFrame::GetCursor()` can never return `Nothing()` after bug 1687239, which
removes `nsPluginFrame`. Therefore `mLastFrameConsumedSetCursor` in
`EventStateManager` can never be true.

Differential Revision: https://phabricator.services.mozilla.com/D200890
2024-02-07 12:35:27 +00:00
Frédéric Wang
f14fe86c4a Bug 1874823 - Make nsBlockFrame::Init set NS_BLOCK_STATIC_BFC by checking classes. r=layout-reviewers,AlaskanEmily
The following classes deriving from nsBlockFrame always set
NS_BLOCK_STATIC_BFC in their constructors or initializers:

- nsComboboxControlFrame
- nsFileControlFrame
- nsSelectsAreaFrame
- ColumnSetWrapperFrame
- nsMathMLmathBlockFrame

Do that in nsBlockFrame::Init instead. Behavior is unchanged.

Differential Revision: https://phabricator.services.mozilla.com/D199097
2024-01-24 12:13:42 +00:00
Sandor Molnar
4ae4759abd 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
5fa95b9531 Bug 1874823 - Make nsBlockFrame::Init set NS_BLOCK_STATIC_BFC by checking classes. r=layout-reviewers,AlaskanEmily
The following classes deriving from nsBlockFrame always set
NS_BLOCK_STATIC_BFC in their constructors or initializers:

- nsComboboxControlFrame
- nsFileControlFrame
- nsSelectsAreaFrame
- ColumnSetWrapperFrame
- nsMathMLmathBlockFrame

Do that in nsBlockFrame::Init instead. Behavior is unchanged.

Differential Revision: https://phabricator.services.mozilla.com/D199097
2024-01-24 10:52:29 +00:00
Sandor Molnar
64e6f63b98 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
29824d3fa4 Bug 1874823 - Make nsBlockFrame::Init set NS_BLOCK_STATIC_BFC by checking classes. r=layout-reviewers,AlaskanEmily
The following classes deriving from nsBlockFrame always set
NS_BLOCK_STATIC_BFC in their constructors or initializers:

- nsComboboxControlFrame
- nsFileControlFrame
- nsSelectsAreaFrame
- ColumnSetWrapperFrame
- nsMathMLmathBlockFrame

Do that in nsBlockFrame::Init instead. Behavior is unchanged.

Differential Revision: https://phabricator.services.mozilla.com/D199097
2024-01-24 09:50:45 +00:00
Ting-Yu Lin
1055b1302e Bug 1875600 - Use nsIFrame::PresShell() to simply some callers. r=layout-reviewers,emilio
Those callers who using the pointer immediately after getting from
`GetPresShell()` can be replaced with `PresShell()`.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D199164
2024-01-23 00:30:53 +00:00
Daniel Holbert
d6f406d8ba Bug 1873802: Make nsRangeFrame place the thumb at the minimum position if it happens to get reflowed before its element is done being created. r=emilio
Some context:
- Our HTML parser treats element creation, attribute-parsing, and
  "DoneCreatingElement"-calls as being separate operations, and it can yield
  between them.
- HTMLInputElement doesn't sanitize its values until DoneCreatingElement has
  been called, presumably sanitization itself depends on values (e.g. min/max)
  that might not have been parsed yet.
- So if the HTML parser yields at just the right point (before
  DoneCreatingElement), then we might generate and reflow a nsRangeFrame whose
  underlying values (on the element) haven't yet been sanitized.

This patch handles this situation by exposing a getter to tell us whether
DoneCreatingElement has been called.  If that getter returns false, we assume
that value-sanitization hasn't happened, and we disregard the element's
(presumed-to-be-unsanitized) numeric values when determining the
range's thumb-position.

Differential Revision: https://phabricator.services.mozilla.com/D198331
2024-01-16 17:38:30 +00:00
Emilio Cobos Álvarez
71838e2f11 Bug 1850295 - Update :user-{valid,invalid} to follow the spec. r=smaug
(Modulo open spec issues linked in comments)

Differential Revision: https://phabricator.services.mozilla.com/D196986
2024-01-16 11:09:01 +00:00
Frédéric Wang
477553d92b 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
532c46bc37 Bug 1765615 - Always add NS_BLOCK_FLOAT_MGR and NS_BLOCK_MARGIN_ROOT simultaneously. r=layout-reviewers,emilio
These flags are generally always set simultaneously via
NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS. This commit changes the three
remaining places where only NS_BLOCK_FLOAT_MGR is set:

1. nsFileControlFrame, used by <input type="file">
2. nsComboboxControlFrame used by <select>
3. nsSelectsAreaFrame, used by <select multiple>

(1) and (2) create their own child frames that can't be styled by
authors. (3) wraps its children into a -moz-scrolled-content which
already prevents them from taking collapsing margins with their parent.
So it is safe to add NS_BLOCK_MARGIN_ROOT here.

Differential Revision: https://phabricator.services.mozilla.com/D198523
2024-01-15 16:59:51 +00:00
Frédéric Wang
2bdaf0b4eb 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
8fad687bb1 Bug 1874336 Part 1 - Use ApplyMinMaxBSize() and ApplyMinMaxISize() more. r=layout-reviewers,jfkthame
Also, add a note to `NS_CSS_MINMAX` to point to these two methods.

Differential Revision: https://phabricator.services.mozilla.com/D198351
2024-01-12 21:25:39 +00:00
Emilio Cobos Álvarez
04ae02f69f Bug 1800077 - Add a missing include to fix non-unified builds.
MANUAL PUSH: Trivial orange fix CLOSED TREE
2023-12-21 23:02:52 +01:00
Emilio Cobos Álvarez
86b517635b Bug 1800077 - Make <input type=button> magic clip not magic. r=jwatt,zcorpan
This implements the proposal in: https://github.com/whatwg/html/issues/9976

MANUAL PUSH: see bug 1871425

Differential Revision: https://phabricator.services.mozilla.com/D195419
2023-12-21 22:30:50 +01:00
Cristian Tuns
e7933d8cf2 Backed out changeset 1fb09caf9d62 (bug 1800077) for causing build bustages in nsHTMLButtonControlFrame.cpp 2023-12-21 12:59:21 -05:00
Emilio Cobos Álvarez
74a0a3f9ed Bug 1800077 - Make <input type=button> magic clip not magic. r=jwatt,zcorpan
This implements the proposal in:

  https://github.com/whatwg/html/issues/9976

Will wait till that is settled to land this.

MANUAL PUSH: See bug 1871425

Differential Revision: https://phabricator.services.mozilla.com/D195419
2023-12-21 17:22:27 +01: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
Emilio Cobos Álvarez
2efe17814f Bug 1860666 - Add pref-gated ::slider-* pseudo-elements, and some tests. r=layout-reviewers,jfkthame
We fail some because we right now we have a track pseudo for meter/progress.

I plan to fix this, but a lot of these frame classes are basically copy-pasta,
so I wanted to get rid of them first.

Differential Revision: https://phabricator.services.mozilla.com/D192097
2023-10-30 15:15:24 +00:00
Emilio Cobos Álvarez
07b0055ecc Bug 1861027 - Handle editor readonly mask update based on element state instead of attributes. r=masayuki
An element can be disabled even if it doesn't have the disabled
attribute.

Differential Revision: https://phabricator.services.mozilla.com/D191947
2023-10-27 08:31:29 +00:00
Emilio Cobos Álvarez
4dcca913a5 Bug 1861027 - Make nsTextControlFrame -> TextControlElement casts less verbose. r=masayuki
No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D191946
2023-10-27 08:31:29 +00:00
Tom Marble
0cb91fe33e Bug 1855300 - convert .ini manifests to .toml: batch 11 remaining **/mochitest.ini r=jmaher,geckoview-reviewers,extension-reviewers,valentin,credential-management-reviewers,cookie-reviewers,sgalich,m_kato,robwu
Differential Revision: https://phabricator.services.mozilla.com/D190515
2023-10-13 02:32:24 +00:00
Jan Varga
c458754592 Bug 1855134 - Move existing MOZ_TRY macros to a dedicated header file; r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D189226
2023-09-28 20:46:07 +00:00
Markus Stange
1797b920c8 Bug 1853712 - Allow blob image recording for nsDisplayButtonBorder. r=nical
These only paint inner box shadows and borders, both of which we support with
WR display items, so we probably never hit fallback rendering for this and don't
call this method. But in case we do, it should be fine to use blob rendering
for it these days.

Depends on D188490

Differential Revision: https://phabricator.services.mozilla.com/D188491
2023-09-25 23:36:27 +00:00
Ting-Yu Lin
0319ff2c6b Bug 1854424 - Add a LogicalMargin method returning an offset to start-sides. r=layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D188847
2023-09-22 15:39:25 +00:00
Ting-Yu Lin
2b2646bd48 Bug 1853090 - Add ContentISize() and ContentBSize() convenience methods to nsIFrame. r=layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D188157
2023-09-14 18:13:17 +00:00
Emilio Cobos Álvarez
d12231ae7a Bug 1852457 - Simplify nsITheme::ThemeWantsButtonInnerFocusRing(). r=jfkthame,layout-reviewers
In practice, this is only ever true on the native windows theme. All
other themes return true for ThemeDrawsFocusForWidget for Button and
Menulist, which are the relevant appearance values here. So make this
more explicit.

Differential Revision: https://phabricator.services.mozilla.com/D187856
2023-09-14 09:46:42 +00:00
Tom Marble
9e40a719f2 Bug 1850545 - convert .ini manifests to .toml: batch 3 chrome.ini (bis) r=jmaher,geckoview-reviewers,extension-reviewers,credential-management-reviewers,devtools-reviewers,fxview-reviewers,places-reviewers,profiler-reviewers,m_kato,mak,mtigley
Differential Revision: https://phabricator.services.mozilla.com/D187597
2023-09-13 18:28:32 +00:00
Emilio Cobos Álvarez
aefd1ddb30 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
Emilio Cobos Álvarez
52d097c513 Bug 1851868 - Refactor nsIFrame::Destroy to pass a single DestroyContext parameter. r=dholbert
This shouldn't change behavior, but it packs the two arguments to
DestroyFrom into a single thing, and makes nsIFrame::Destroy not so easy
to call without a previous context.

This is a prerequisite to pass aDestroyContext to various things that
right now just mint one, which can cause badness, see bug 1851787 and
related bugs.

It's also a bit nicer to add things there if we need to in the future.

Differential Revision: https://phabricator.services.mozilla.com/D187578
2023-09-07 11:46:30 +00:00
Narcis Beleuzu
77ba6cde90 Backed out changeset 55052ae7d067 (bug 1851868) for reftest failure on 1153695.html . CLOSED TREE 2023-09-07 02:42:25 +03:00
Emilio Cobos Álvarez
59766eeba4 Bug 1851868 - Refactor nsIFrame::Destroy to pass a single DestroyContext parameter. r=dholbert
This shouldn't change behavior, but it packs the two arguments to
DestroyFrom into a single thing, and makes nsIFrame::Destroy not so easy
to call without a previous context.

This is a prerequisite to pass aDestroyContext to various things that
right now just mint one, which can cause badness, see bug 1851787 and
related bugs.

It's also a bit nicer to add things there if we need to in the future.

Differential Revision: https://phabricator.services.mozilla.com/D187578
2023-09-06 22:34:35 +00:00
Olli Pettay
dd6135f330 Bug 1850712 - Remove unused nsCheckboxRadioFrame::GetCurrentCheckState, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D187104
2023-08-30 14:07:32 +00:00
Markus Stange
3d20b7df6c Bug 1843484 - Use EventTarget* instead of nsISupports* for the event target parameter of the nsContentUtils::Dispatch methods. r=smaug
This saves a few queryInterface calls on the hot path.

Differential Revision: https://phabricator.services.mozilla.com/D186976
2023-08-28 23:38:42 +00:00
Sean Feng
4379a8876c Bug 1848409 - Tweak the UpdateDefaultPreventedOnContent call to only special case the HTMLEditorEventListener case r=masayuki,dom-core
Calling `UpdateDefaultPreventedOnContent` separately from
`PreventDefault()` is error-prone. This patch should make it
safer.

Differential Revision: https://phabricator.services.mozilla.com/D186052
2023-08-15 13:46:42 +00:00
David Shin
cc513776a4 Bug 1846982: Baseline calculation for textarea. r=emilio
Tests are added as tentative, because the behaviour when there's no content,
or when there's placeholder text, seem very differnt for each browser.

Differential Revision: https://phabricator.services.mozilla.com/D185958
2023-08-15 13:30:17 +00:00
Iulian Moraru
e88ec18198 Backed out changeset 928b78db7b30 (bug 1846982) for causing reftest failures on display-block-baselines-3.html. CLOSED TREE 2023-08-11 23:26:38 +03:00
David Shin
2b3acf83b0 Bug 1846982: Baseline calculation for textarea. r=emilio
Tests are added as tentative, because the behaviour when there's no content,
or when there's placeholder text, seem very differnt for each browser.

Differential Revision: https://phabricator.services.mozilla.com/D185958
2023-08-11 19:24:32 +00:00
Sean Feng
117b1123ce Bug 1847363 - Add the missing UpdateDefaultPreventedOnContent call for nsFileControlFrame r=masayuki
Without setting mDefaultPreventedOnContent, the dragSession could
be considered as Chrome only.

Differential Revision: https://phabricator.services.mozilla.com/D185844
2023-08-10 14:21:06 +00:00
Masayuki Nakano
0f39d7eda7 Bug 1266437 - Drop "OS" modifier r=smaug,m_kato,karlt,Gijs
On Windows, Windows logo key was mapped to "OS" modifier, and on Linux,
it's same and the key is called "Super" and "Hyper".  That conformed to the
older UI Events spec.

However, UI Events declares that they should be mapped to "Meta" now and Chrome
handles it as the spec in Windows and Linux.  Therefore, we should align the
behavior to them.

Note that we've treated the legacy "Meta" modifier on Linux as DOM "Meta"
modifier state, and we'll keep this as-is because in Sun/Solaris keyboard
layout, they keys are mapped to the legacy "Meta".

Finally, the following check only `IsMeta()` but not `IsOS()`.  I think that
they should've checked `IsOS()` too.  Therefore, they will behave differently
in Windows and Linux.
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/base/Element.cpp#3287-3288
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLInputElement.cpp#3762-3764
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLInputElement.cpp#3796-3806
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLLabelElement.cpp#127-128
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/widget/gtk/nsGtkKeyUtils.cpp#1461-1462

Note that `KEY_NAME_INDEX_OS` will be removed in the patch for bug 1232918.

Differential Revision: https://phabricator.services.mozilla.com/D183480
2023-08-07 01:03:58 +00:00
Cristian Tuns
f5572b469f Backed out 2 changesets (bug 1266437, bug 1232918) for causing mochitest failures in test_autoplay_policy_key_blacklist.html CLOSED TREE
Backed out changeset 33e3c6593d4b (bug 1232918)
Backed out changeset 1b56e99dd221 (bug 1266437)
2023-08-03 23:29:52 -04:00
Masayuki Nakano
0664d98bce Bug 1266437 - Drop "OS" modifier r=smaug,m_kato,karlt,Gijs
On Windows, Windows logo key was mapped to "OS" modifier, and on Linux,
it's same and the key is called "Super" and "Hyper".  That conformed to the
older UI Events spec.

However, UI Events declares that they should be mapped to "Meta" now and Chrome
handles it as the spec in Windows and Linux.  Therefore, we should align the
behavior to them.

Note that we've treated the legacy "Meta" modifier on Linux as DOM "Meta"
modifier state, and we'll keep this as-is because in Sun/Solaris keyboard
layout, they keys are mapped to the legacy "Meta".

Finally, the following check only `IsMeta()` but not `IsOS()`.  I think that
they should've checked `IsOS()` too.  Therefore, they will behave differently
in Windows and Linux.
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/base/Element.cpp#3287-3288
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLInputElement.cpp#3762-3764
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLInputElement.cpp#3796-3806
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLLabelElement.cpp#127-128
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/widget/gtk/nsGtkKeyUtils.cpp#1461-1462

Note that `KEY_NAME_INDEX_OS` will be removed in the patch for bug 1232918.

Differential Revision: https://phabricator.services.mozilla.com/D183480
2023-08-04 00:10:11 +00:00
Jan-Niklas Jaeschke
c84288a36d 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
Mathew Hodson
21cd613492 Bug 1564391 - Rename internal uses of mozInputSource. r=emilio,pip-reviewers,tabbrowser-reviewers,dao,kpatenio
This allows us to deprecate `mozInputSource` for the Web while
avoiding console warnings for internal uses, which now use the
ChromeOnly `inputSource` attribute.

Differential Revision: https://phabricator.services.mozilla.com/D183643
2023-07-26 09:27:45 +00:00
Emilio Cobos Álvarez
945ed5ad06 Bug 1842027 - Remove nsTextControlFrame::TextEquals. r=masayuki
It is always called from TextControlState, and always ends up in
TextControlState::ValueEquals, so we can avoid some indirection and just
use that.

Depends on D183282

Differential Revision: https://phabricator.services.mozilla.com/D183283
2023-07-12 08:58:09 +00:00
Emilio Cobos Álvarez
035b0a67ec Bug 1842027 - Remove always-true aIgnoreWrap parameter from TextControlElement::GetTextEditorValue. r=masayuki
Depends on D183281

Differential Revision: https://phabricator.services.mozilla.com/D183282
2023-07-12 08:57:12 +00:00
Emilio Cobos Álvarez
b543055b6e Bug 1842027 - Remove dead nsTextControlFrame::GetText. r=masayuki
Depends on D183254

Differential Revision: https://phabricator.services.mozilla.com/D183281
2023-07-12 08:56:25 +00:00