Bug 1488817 - Remove the has-first-letter-child bit from the block when the first-letter is removed from a first-line. r=bzbarsky

Always new reasons to remove the first-line frame and this reparenting stuff...
I hope I can get to it.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2018-09-17 17:36:06 +00:00
Родитель fe39a234fe
Коммит 6133d4c3a3
3 изменённых файлов: 43 добавлений и 5 удалений

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

@ -10690,6 +10690,18 @@ FindFirstLetterFrame(nsIFrame* aFrame, nsIFrame::ChildListID aListID)
return nullptr;
}
static void ClearHasFirstLetterChildFrom(nsContainerFrame* aParentFrame)
{
MOZ_ASSERT(aParentFrame);
auto* parent =
static_cast<nsContainerFrame*>(aParentFrame->FirstContinuation());
if (MOZ_UNLIKELY(parent->IsLineFrame())) {
parent = parent->GetParent();
}
MOZ_ASSERT(parent->HasFirstLetterChild());
parent->ClearHasFirstLetterChild();
}
void
nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
nsIPresShell* aPresShell,
@ -10724,8 +10736,8 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
// Somethings really wrong
return;
}
static_cast<nsContainerFrame*>(parentFrame->FirstContinuation())->
ClearHasFirstLetterChild();
ClearHasFirstLetterChildFrom(parentFrame);
// Create a new text frame with the right style that maps all of the content
// that was previously part of the letter frame (and probably continued
@ -10790,9 +10802,7 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresShell* aPresShell,
while (kid) {
if (kid->IsLetterFrame()) {
// Bingo. Found it. First steal away the text frame.
static_cast<nsContainerFrame*>(aFrame->FirstContinuation())->
ClearHasFirstLetterChild();
ClearHasFirstLetterChildFrom(aFrame);
nsIFrame* textFrame = kid->PrincipalChildList().FirstChild();
if (!textFrame) {
break;

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

@ -0,0 +1,27 @@
<html>
<head>
<style id='style'></style>
<script>
function start() {
o1 = document.createElement('figcaption')
o1.innerText = 'ᾂ﷞ 󠈂7阘𝅨ᷱ𝉗٩m󠙅,︥𖕬שּׁ︦ n-፝󠿸𫮨𯚪҅҈h"٪۰󠗽錐󠇪҈שּׁ𛜑𝔡L\r\n埤സ&\n<<=󠺁킻&e󠔥\b\r>𯉸󠕯'
document.documentElement.appendChild(o1)
document.getElementById('style').textContent = `
FIGCAPTION::before, FIGCAPTION {
content: counters(\\46, \'.\')
}
HTML {
-webkit-transition-delay: 1s, 250ms
}
FIGCAPTION::first-letter, * {
fill: currentColor
}
FIGCAPTION::first-line {}`
document.body.offsetTop;
document.replaceChild(document.documentElement, document.documentElement)
}
document.addEventListener('DOMContentLoaded', start)
</script>
<body></body>
</html>

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

@ -292,4 +292,5 @@ pref(dom.webcomponents.shadowdom.enabled,true) load 1468640.html
load 1469076.html
load 1475003.html
load 1479681.html
load 1488817.html
load 1490012.html