Bug 1517297 - Fix nsIFrame::IsColumnSpanInMulticolSubtree(). r=emilio

After Bug 1507244 Part 2 landed, only block or inline frames can have
NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR bit set. We need to fix
IsColumnSpanInMulticolSubtree() for other types of frames.

In multi-column formatting context, every frame having a
"column-span:all" style will be wrapped by a -moz-column-span-wrapper
frame. We can use this to check whether a non-inline and non-block frame
is in a multi-column subtree or not.

Differential Revision: https://phabricator.services.mozilla.com/D15709

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ting-Yu Lin 2019-01-04 19:16:28 +00:00
Родитель 28b5c3416c
Коммит da7650abaa
4 изменённых файлов: 32 добавлений и 5 удалений

Просмотреть файл

@ -0,0 +1,22 @@
<html>
<head>
<style>
* {
column-count: 1;
min-width: -moz-min-content;
column-span: all;
}
ins {
display: grid;
}
</style>
</head>
<body>
<a>
<ins>MJ]yYfC&gt;;M|</ins>
<keygen></keygen>
</a>
</body>
</html>

Просмотреть файл

@ -722,3 +722,4 @@ pref(layout.css.column-span.enabled,true) load 1506216.html
pref(layout.css.column-span.enabled,true) load 1506306.html
pref(layout.css.column-span.enabled,true) load 1507196.html
pref(layout.css.column-span.enabled,true) load 1517033.html
pref(layout.css.column-span.enabled,true) load 1517297.html

Просмотреть файл

@ -3854,10 +3854,9 @@ class nsIFrame : public nsQueryFrame {
// Does this frame have "column-span: all" style.
//
// Note this only checks computed style, but not testing whether the
// containing block formatting context was established by a multicol.
// Callers need to consider NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR to check
// whether multi-column effects apply or not, or use
// IsColumnSpanInMulticolSubtree().
// containing block formatting context was established by a multicol. Callers
// need to use IsColumnSpanInMulticolSubtree() to check whether multi-column
// effects apply or not.
inline bool IsColumnSpan() const;
// Like IsColumnSpan(), but this also checks whether the frame has a

Просмотреть файл

@ -70,7 +70,12 @@ bool nsIFrame::IsColumnSpan() const {
}
bool nsIFrame::IsColumnSpanInMulticolSubtree() const {
return IsColumnSpan() && HasAnyStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR);
return IsColumnSpan() &&
(HasAnyStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR) ||
// A frame other than inline and block won't have
// NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR. We instead test its parent.
(GetParent() && GetParent()->Style()->GetPseudo() ==
nsCSSAnonBoxes::columnSpanWrapper()));
}
mozilla::StyleDisplay nsIFrame::GetDisplay() const {