Commit graph

3476 commits

Author SHA1 Message Date
Ting-Yu Lin
040feb02dd Bug 1798373 Part 7 - Change nsContainerFrame::InsertFrames() to take rvalue reference of nsFrameList. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D160843
2022-11-01 21:15:55 +00:00
Ting-Yu Lin
c99b45fa14 Bug 1798373 Part 6 - Change nsContainerFrame::AppendFrames() to take rvalue reference of nsFrameList. r=emilio
Change nsBlockFrame::AppendFrames() helper, too.

Differential Revision: https://phabricator.services.mozilla.com/D160842
2022-11-01 21:15:54 +00:00
Ting-Yu Lin
4787078c5c Bug 1798373 Part 5 - Change nsContainerFrame::SetInitialChildList() to take rvalue reference of nsFrameList. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D160841
2022-11-01 21:15:54 +00:00
Ting-Yu Lin
fc3719b5aa Bug 1798373 Part 4 - Remove nsFrameList::SetFrames() that takes nsFrameList. r=emilio
SetFrame() is equivalent to `operator=`, so external callers can use `operator=`
instead. For the two callers wanting to set `nsFrameList` to `AbsoluteFrameList`
in `nsCSSFrameConstructor`, removing SetFrame() disallows it. However, we can
easily change the declaration from `nsFrameList` to a `AbsoluteFrameList` to
resolve the problem.

Differential Revision: https://phabricator.services.mozilla.com/D160840
2022-11-01 21:15:53 +00:00
Ting-Yu Lin
adf4fab73c Bug 1798373 Part 2 - Change nsFrameList::AppendFrames to take rvalue reference of nsFrameList. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D160838
2022-11-01 21:15:52 +00:00
Ting-Yu Lin
569c5f244b Bug 1798373 Part 1 - Change nsFrameList::InsertFrames to take rvalue reference of nsFrameList. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D160837
2022-11-01 21:15:52 +00:00
Emilio Cobos Álvarez
73ff5f1ac4 Bug 1797308 - Make <xul:spacer> use non-XUL layout. r=jwatt
Nothing overrides its display value so it would get -moz-box display by
default, like all other XUL elements.

Differential Revision: https://phabricator.services.mozilla.com/D160222
2022-10-29 21:51:29 +00:00
Emilio Cobos Álvarez
953f64d63b Bug 1797703 - Fix frame constructor save state restoration. r=emilio
Restore the old logic [1] prior to introducing Bug 1797011 Part 2.

[1] https://searchfox.org/mozilla-central/rev/85cbcecd24554c1fa88360412452ad0f7ed48630/layout/base/nsCSSFrameConstructor.cpp#1309-1335
[2] https://hg.mozilla.org/mozilla-central/rev/3f443cbb5bdd

The wpt test is written by Emilio Cobos Álvarez <emilio@crisal.io> in
https://phabricator.services.mozilla.com/D160523.

Differential Revision: https://phabricator.services.mozilla.com/D160600
2022-10-28 07:56:50 +00:00
Noemi Erli
9ad9fc4449 Backed out changeset 4dfea46f3cd0 (bug 1797703) for causing reftest failures 2022-10-28 01:40:58 +03:00
Emilio Cobos Álvarez
bc6fbbde9c Bug 1797703 - Fix frame constructor save state restoration. r=TYLin,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D160523
2022-10-27 21:20:02 +00:00
Ting-Yu Lin
c0245a1523 Bug 1797011 Part 4 - Rename AbsoluteFrameList::containingBlock to mContainingBlock to match coding style. r=emilio,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D160104
2022-10-26 04:22:25 +00:00
Ting-Yu Lin
babc81bc9c Bug 1797011 Part 3 - Delete nsFrameList's copy assigment operator. r=emilio
This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D160015
2022-10-26 04:22:25 +00:00
Ting-Yu Lin
b91a315ae3 Bug 1797011 Part 2 - Make AbsoluteFrameList a move-only class; improve nsFrameConstructorSaveState and PushAbsoluteContainingBlock(). r=emilio
This patch doesn't change behavior.

AbsoluteFrameList is a derived class of nsFrameList, so we change it a move-only
class in order to nsFrameList move-only in Part 3.

Some detail of this patch:

- Define move constructor and move assignment operator for AbsoluteFrameList.
  This effectively disables the auto generated copy constructor and copy
  assignement operator.

- Initialize nsFrameConstructorSaveState's member variables in class definition,
  and remove its constructor.

- Remove `mSavedFixedList` since we can rewire the logic in
  `~nsFrameConstructorSaveState` and `PushAbsoluteContainingBlock()` to make it
  redundant.

- Make self-assignment correct in nsFrameList's move assignment operator.

Differential Revision: https://phabricator.services.mozilla.com/D160014
2022-10-26 04:22:24 +00:00
Butkovits Atila
b704dcf231 Backed out 4 changesets (bug 1797011) for causing high frequency ThreadSanitizer failures. CLOSED TREE
Backed out changeset e55bef9aa488 (bug 1797011)
Backed out changeset 515757be2f7e (bug 1797011)
Backed out changeset 360739dfb6d1 (bug 1797011)
Backed out changeset 9a3f104b78c5 (bug 1797011)
2022-10-25 01:03:29 +03:00
Ting-Yu Lin
4cd1e6f862 Bug 1797011 Part 4 - Rename AbsoluteFrameList::containingBlock to mContainingBlock to match coding style. r=emilio,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D160104
2022-10-24 19:14:33 +00:00
Ting-Yu Lin
aae6173a16 Bug 1797011 Part 3 - Delete nsFrameList's copy assigment operator. r=emilio
This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D160015
2022-10-24 19:14:33 +00:00
Ting-Yu Lin
5f9b5759c1 Bug 1797011 Part 2 - Make AbsoluteFrameList a move-only class; improve nsFrameConstructorSaveState and PushAbsoluteContainingBlock(). r=emilio
This patch doesn't change behavior.

AbsoluteFrameList is a derived class of nsFrameList, so we change it a move-only
class in order to nsFrameList move-only in Part 3.

Some detail of this patch:

- Define move constructor and move assignment operator for AbsoluteFrameList.
  This effectively disables the auto generated copy constructor and copy
  assignement operator.

- Initialize nsFrameConstructorSaveState's member variables in class definition,
  and remove its constructor.

- Remove `mSavedFixedList` since we can rewire the logic in
  `~nsFrameConstructorSaveState` and `PushAbsoluteContainingBlock()` to make it
  redundant.

- Make self-assignment correct in nsFrameList's move assignment operator.

Differential Revision: https://phabricator.services.mozilla.com/D160014
2022-10-24 19:14:32 +00:00
Ting-Yu Lin
ce9040c985 Bug 1794035 Part 4 - Use range-based for loops to iterate nsFrameList. r=emilio
After this patch, we still need nsFrameList::Enumerator to iterate
nsFrameList::Slice. We might enhance nsFrameList::Iterator to support Slice, but
I'll leave this for another day.

Differential Revision: https://phabricator.services.mozilla.com/D158809
2022-10-07 01:41:41 +00:00
Ting-Yu Lin
171f18c10d Bug 1794035 Part 1 - Rename nsFrameList::ExtractHead to TakeFramesBefore. r=emilio
I feel it's hard to understand the purpose of ExtractHead(), especially where
aFrame is going after the call. Therefore, I rename it to TakeFramesBefore(),
and have it complement the existing RemoveFramesAfter(), which will be rename
later. No behavioral change intended.

Also, slightly reword the method's documentation to reflect the its new
name. (Remove the "sibling" wording from the comment since it's an
implementation details that frames are actually a doubly linked list.)

Differential Revision: https://phabricator.services.mozilla.com/D158806
2022-10-07 01:41:40 +00:00
Ting-Yu Lin
296fa869bc Bug 1793826 Part 2 - Remove nsFrameList::FrameLinkEnumerator. r=emilio
Change the last caller of FrameLinkEnumerator to use Iterator instead, and we
are ready to remove it.

Differential Revision: https://phabricator.services.mozilla.com/D158701
2022-10-06 06:47:25 +00:00
Ting-Yu Lin
ff8e435a59 Bug 1793826 Part 1 - Change nsFrameList::ExtractHead and ExtractTail to take nsIFrame* argument. r=emilio
This is a preparation to remove nsFrameList::FrameLinkEnumerator in the next
part.

Differential Revision: https://phabricator.services.mozilla.com/D158700
2022-10-06 06:47:25 +00:00
Csoregi Natalia
eb363bd64e Backed out 2 changesets (bug 1793826) for causing build bustages. CLOSED TREE
Backed out changeset 9e398426c46f (bug 1793826)
Backed out changeset 01820845ab62 (bug 1793826)
2022-10-06 03:41:00 +03:00
Ting-Yu Lin
1d1bc48ebc Bug 1793826 Part 2 - Remove nsFrameList::FrameLinkEnumerator. r=emilio
Change the last caller of FrameLinkEnumerator to use Iterator instead, and we
are ready to remove it.

Differential Revision: https://phabricator.services.mozilla.com/D158701
2022-10-06 00:19:42 +00:00
Ting-Yu Lin
307de24fc3 Bug 1793826 Part 1 - Change nsFrameList::ExtractHead and ExtractTail to take nsIFrame* argument. r=emilio
This is a preparation to remove nsFrameList::FrameLinkEnumerator in the next
part.

FrameLinkEnumerator::Find() can be replaced with std::find/std::find_if.

Differential Revision: https://phabricator.services.mozilla.com/D158700
2022-10-06 00:19:41 +00:00
Emily McDonough
1f2d745a94 Bug 1782597 Part 2 - Use null to indicate page value equal to the auto value for CSS named pages r=dholbert
This applies both to the individual mStartPageValue and mEndPageValue fields
of the nsIFrame::PageValues struct, and for the nsIFrame::PageValuesProperty
being null to indicate both mStartPageValue and mEndPageValue are auto.

Fetching this is handled by nsIFrame::GetStartPageValue and
nsIFrame::GetEndPageValue, which also ensure the use of first-in-flow frames.

Differential Revision: https://phabricator.services.mozilla.com/D157873
2022-10-05 22:07:47 +00:00
Emily McDonough
be4dd4a026 Bug 1782597 Part 1 - Store auto page value on each frame when in a paginated context. r=dholbert,emilio
Differential Revision: https://phabricator.services.mozilla.com/D157872
2022-10-05 22:07:46 +00:00
Emilio Cobos Álvarez
048e9bb783 Bug 1792741 - Remove nsDocElementBoxFrame. r=TYLin
After bug 1665476, it's pretty much a regular XUL box with a couple
special-cases that we can use IsRootElementStyle for. Do that, and allow
using nsFlexContainerFrame when using flexbox emulation.

Differential Revision: https://phabricator.services.mozilla.com/D158288
2022-10-01 02:35:31 +00:00
Csoregi Natalia
462f51927a Backed out changeset 63fbc22d2223 (bug 1792741) for causing assertion failures on nsCSSFrameConstructor.cpp. CLOSED TREE 2022-10-01 04:22:22 +03:00
Emilio Cobos Álvarez
39da87ded4 Bug 1792741 - Remove nsDocElementBoxFrame. r=TYLin
After bug 1665476, it's pretty much a regular XUL box with a couple
special-cases that we can use IsRootElementStyle for. Do that, and allow
using nsFlexContainerFrame when using flexbox emulation.

Differential Revision: https://phabricator.services.mozilla.com/D158288
2022-10-01 00:28:13 +00:00
Butkovits Atila
c01a6393db Backed out changeset 511ee0f8727c (bug 1792741) for causing failures at browser_aboutDialog_distribution. 2022-09-30 03:56:41 +03:00
Emilio Cobos Álvarez
04c73bdd6a Bug 1792741 - Remove nsDocElementBoxFrame. r=TYLin
After bug 1665476, it's pretty much a regular XUL box with a couple
special-cases that we can use IsRootElementStyle for. Do that, and allow
using nsFlexContainerFrame when using flexbox emulation.

Differential Revision: https://phabricator.services.mozilla.com/D158288
2022-09-29 23:34:41 +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
4e978b56b5 Bug 1689816 - Implement <tabpanels> and <deck> without XUL layout. r=Gijs,Jamie,morgan,preferences-reviewers,mconley,TYLin
Gijs for front-end bits, layout for the new CSS properties and the
removal of nsDeckFrame / nsStackLayout, Jamie and Morgan for the a11y
changes.

As discussed in the bug, the main tricky part here is handling a11y
correctly. For <deck>, that's trivial (just use `visibility: hidden` to
hide the panels visually, while removing the unselected panels from the
a11y tree).

For <tabpanels> however we need to do something special. We do want to
hide stuff visually, but we want to preserve the contents in the a11y
tree.

For that, the easiest fix is introducing a new privileged CSS property
(-moz-subtree-hidden-only-visually), which takes care of not painting
the frame, but marks stuff offscreen in the accessibility tree. This is
not intended to be a property used widely.

Other than that, the changes are relatively straight-forward, though
some of the accessible/mac changes I could get a sanity-check on.

Differential Revision: https://phabricator.services.mozilla.com/D157875
2022-09-27 04:18:16 +00:00
Marian-Vasile Laza
f54a464c90 Backed out changeset 2f74f8f2ed19 (bug 1689816) for causing reftest failures on skip-ink-multiline-position.html. 2022-09-26 23:24:03 +03:00
Emilio Cobos Álvarez
f875681246 Bug 1689816 - Implement <tabpanels> and <deck> without XUL layout. r=Gijs,Jamie,morgan,preferences-reviewers,mconley,TYLin
Gijs for front-end bits, layout for the new CSS properties and the
removal of nsDeckFrame / nsStackLayout, Jamie and Morgan for the a11y
changes.

As discussed in the bug, the main tricky part here is handling a11y
correctly. For <deck>, that's trivial (just use `visibility: hidden` to
hide the panels visually, while removing the unselected panels from the
a11y tree).

For <tabpanels> however we need to do something special. We do want to
hide stuff visually, but we want to preserve the contents in the a11y
tree.

For that, the easiest fix is introducing a new privileged CSS property
(-moz-subtree-hidden-only-visually), which takes care of not painting
the frame, but marks stuff offscreen in the accessibility tree. This is
not intended to be a property used widely.

Other than that, the changes are relatively straight-forward, though
some of the accessible/mac changes I could get a sanity-check on.

Differential Revision: https://phabricator.services.mozilla.com/D157875
2022-09-26 17:40:30 +00:00
Emily McDonough
673e9552a0 Bug 1764437 - Check for prev/next sibling when propagating start/end page values for frames r=dholbert
This also properly handles placeholder frames, and ensures that when checking
next/prev sibling we ignore placeholder frames.

To properly test this for multiple levels of page value propagation, we also
need to use FirstInFlow to get page values when checking for breaks in block
frames.

Differential Revision: https://phabricator.services.mozilla.com/D157175
2022-09-20 21:42:34 +00:00
Emilio Cobos Álvarez
121b2bb157 Bug 1790920 - Remove nsButtonBoxFrame. r=smaug
Create XULButtonElement instead to do the event handling. Pretty much a
straight port, this allows these elements to respect CSS display
properly (and use modern flexbox rather than old XUL layout).

Differential Revision: https://phabricator.services.mozilla.com/D157509
2022-09-19 17:02:37 +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
Emily McDonough
211e48aee3 Bug 1786399 - Check for block layout when applying and propagating page-name properties r=dholbert
The page-name property only applies to boxes which can create class A
breakpoints. One of the qualifiers for this is a block-level item, which is
the child of a block frame. Additionally, page-name propagation only occurs
through frames for which the page-name property applies, because where it does
not apply the auto page-name is propagated instead.

This means we only need to worry about block frames, and only use specified
page-name for BlockOutside frames.

Differential Revision: https://phabricator.services.mozilla.com/D155285
2022-09-13 21:29:38 +00:00
Emily McDonough
aea863f3d5 Bug 1779645 Part 1 - Switch CSS named page fragmentation to happen at reflow instead of frame construction r=dholbert
This also adds a small post-processing step for frame-construction to ensure
that replaced frames (or more generally frames with content but no children)
have the auto page-name set on them.

When page-name value tracking is switched to be lazy, this post-processing step
will likely be redundant and can be removed.

Differential Revision: https://phabricator.services.mozilla.com/D152701
2022-09-13 21:29:37 +00:00
criss
a4d6291cea Backed out 3 changesets (bug 1786399, bug 1779645) for causing reftest failures on page-name-zero-height-001.html. CLOSED TREE
Backed out changeset 81c8d6a2d6f9 (bug 1786399)
Backed out changeset 3ee5fb016aa0 (bug 1779645)
Backed out changeset b626e11a262d (bug 1779645)
2022-09-13 04:19:42 +03:00
Emily McDonough
b924dafc06 Bug 1786399 - Check for block layout when applying and propagating page-name properties r=dholbert
The page-name property only applies to boxes which can create class A
breakpoints. One of the qualifiers for this is a block-level item, which is
the child of a block frame. Additionally, page-name propagation only occurs
through frames for which the page-name property applies, because where it does
not apply the auto page-name is propagated instead.

This means we only need to worry about block frames, and only use specified
page-name for BlockOutside frames.

Differential Revision: https://phabricator.services.mozilla.com/D155285
2022-09-12 22:44:49 +00:00
Emily McDonough
dbbd632586 Bug 1779645 Part 1 - Switch CSS named page fragmentation to happen at reflow instead of frame construction r=dholbert
This also adds a small post-processing step for frame-construction to ensure
that replaced frames (or more generally frames with content but no children)
have the auto page-name set on them.

When page-name value tracking is switched to be lazy, this post-processing step
will likely be redundant and can be removed.

Differential Revision: https://phabricator.services.mozilla.com/D152701
2022-09-12 22:44:48 +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
34c59f52a7 Bug 1789123 - Unify anonymous flex/grid items. r=dholbert
This has no behavior change, just unifies the pseudo-element used for
these.

Differential Revision: https://phabricator.services.mozilla.com/D156736
2022-09-08 11:45:31 +00:00
Frederic Wang
39dd537031 Bug 1588733 - Make maction/semantics elements behave as an mrow with the first child. r=emilio
See https://groups.google.com/forum/#!topic/mozilla.dev.platform/BWUvjERSXUM

Differential Revision: https://phabricator.services.mozilla.com/D49285
2022-09-06 04:32:15 +00:00