Bug 1527725 - Exclude ColumnSetWrapperFrame from the first letter style consistency check in nsBlockFrame. r=dbaron

If there's ::first-letter pseudo element on the multicol container,
ColumnSetWrapperFrame will have the first letter style, but it won't get
the NS_BLOCK_HAS_FIRST_LETTER_STYLE bit during frame construction. The
actual first-letter frame construction happens under -moz-column-content
anonymous block.

This patch excludes ColumnSetWrapperFrame from the debug check to meet
the expectation.

Add a reftest to make sure ::first-letter and ::first-line still work
after introducing ColumnSetWrapperFrame, and no assertion is fired.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ting-Yu Lin 2019-02-22 01:14:45 +00:00
parent 3b7aa5a584
commit 000992e33e
4 changed files with 37 additions and 0 deletions

View File

@ -6772,6 +6772,7 @@ void nsBlockFrame::SetInitialChildList(ChildListID aListID,
!GetParent()->IsListControlFrame()) ||
pseudo == PseudoStyleType::mozSVGText) &&
!IsComboboxControlFrame() && !IsFrameOfType(eMathML) &&
!IsColumnSetWrapperFrame() &&
RefPtr<ComputedStyle>(GetFirstLetterStyle(PresContext())) != nullptr;
NS_ASSERTION(haveFirstLetterStyle ==
((mState & NS_BLOCK_HAS_FIRST_LETTER_STYLE) != 0),

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
div {
border: 1px solid red;
width: 400px;
}
div::first-letter {
font-size: 200%;
}
div::first-line {
color: blue;
}
</style>
<div>first line (blue)<br>second line</div>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
div {
column-count: 1;
border: 1px solid red;
width: 400px;
}
div::first-letter {
font-size: 200%;
}
div::first-line {
color: blue;
}
</style>
<div id="column">first line (blue)<br>second line</div>

View File

@ -40,3 +40,4 @@ fuzzy-if(browserIsRemote&&winWidget,0-142,0-276) == fieldset-columns-001.html fi
== dynamic-text-indent-2.html dynamic-text-indent-2-ref.html
== break-avoid-line-position-1.html break-avoid-line-position-1-ref.html
pref(layout.css.column-span.enabled,true) == column-span-bidi-1.html column-span-bidi-1-ref.html
pref(layout.css.column-span.enabled,true) == first-line-first-letter.html first-line-first-letter-ref.html