зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1567773 - [css-lists] Look for an inside ::marker frame too when searching for a suitable sibling. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D38902 --HG-- extra : rebase_source : a09bf54989c7cea4b263c845ffe6d10770b050dc
This commit is contained in:
Родитель
a530f658c5
Коммит
f75547f074
|
@ -6140,16 +6140,32 @@ nsIFrame* nsCSSFrameConstructor::FindSiblingInternal(
|
||||||
: aIter.GetPreviousChild();
|
: aIter.GetPreviousChild();
|
||||||
};
|
};
|
||||||
|
|
||||||
auto getNearPseudo = [](const nsIContent* aContent) -> nsIFrame* {
|
auto getInsideMarkerFrame = [](const nsIContent* aContent) -> nsIFrame* {
|
||||||
return aDirection == SiblingDirection::Forward
|
auto* marker = nsLayoutUtils::GetMarkerFrame(aContent);
|
||||||
? nsLayoutUtils::GetBeforeFrame(aContent)
|
const bool isInsideMarker = marker &&
|
||||||
: nsLayoutUtils::GetAfterFrame(aContent);
|
marker->GetInFlowParent()->StyleList()->mListStylePosition ==
|
||||||
|
NS_STYLE_LIST_STYLE_POSITION_INSIDE;
|
||||||
|
return isInsideMarker ? marker : nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto getFarPseudo = [](const nsIContent* aContent) -> nsIFrame* {
|
auto getNearPseudo = [&](const nsIContent* aContent) -> nsIFrame* {
|
||||||
return aDirection == SiblingDirection::Forward
|
if (aDirection == SiblingDirection::Forward) {
|
||||||
? nsLayoutUtils::GetAfterFrame(aContent)
|
if (auto* marker = getInsideMarkerFrame(aContent)) {
|
||||||
: nsLayoutUtils::GetBeforeFrame(aContent);
|
return marker;
|
||||||
|
}
|
||||||
|
return nsLayoutUtils::GetBeforeFrame(aContent);
|
||||||
|
}
|
||||||
|
return nsLayoutUtils::GetAfterFrame(aContent);
|
||||||
|
};
|
||||||
|
|
||||||
|
auto getFarPseudo = [&](const nsIContent* aContent) -> nsIFrame* {
|
||||||
|
if (aDirection == SiblingDirection::Forward) {
|
||||||
|
return nsLayoutUtils::GetAfterFrame(aContent);
|
||||||
|
}
|
||||||
|
if (auto* before = nsLayoutUtils::GetBeforeFrame(aContent)) {
|
||||||
|
return before;
|
||||||
|
}
|
||||||
|
return getInsideMarkerFrame(aContent);
|
||||||
};
|
};
|
||||||
|
|
||||||
while (nsIContent* sibling = nextDomSibling(aIter)) {
|
while (nsIContent* sibling = nextDomSibling(aIter)) {
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<!--
|
||||||
|
Any copyright is dedicated to the Public Domain.
|
||||||
|
http://creativecommons.org/publicdomain/zero/1.0/
|
||||||
|
-->
|
||||||
|
<html><head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Reference: Insert text node as first child in LI</title>
|
||||||
|
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.org">
|
||||||
|
<style>
|
||||||
|
ul.inside { list-style-position: inside; }
|
||||||
|
.before::before { content: "before"; }
|
||||||
|
.after::after { content: "after"; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<ul class="inside">
|
||||||
|
<li>AB</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul class="inside">
|
||||||
|
<li class="before">AB</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul class="inside">
|
||||||
|
<li class="after">AB</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul class="inside">
|
||||||
|
<li class="before after">AB</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>AB</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li class="before">AB</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li class="after">AB</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li class="before after">AB</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,60 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<!--
|
||||||
|
Any copyright is dedicated to the Public Domain.
|
||||||
|
http://creativecommons.org/publicdomain/zero/1.0/
|
||||||
|
-->
|
||||||
|
<html class="reftest-wait"><head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Test: Insert text node as first child in LI</title>
|
||||||
|
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.org">
|
||||||
|
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1567773">
|
||||||
|
<link rel="match" href="li-insert-child-ref.html">
|
||||||
|
<style>
|
||||||
|
ul.inside { list-style-position: inside; }
|
||||||
|
.before::before { content: "before"; }
|
||||||
|
.after::after { content: "after"; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<ul class="inside">
|
||||||
|
<li>B</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul class="inside">
|
||||||
|
<li class="before">B</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul class="inside">
|
||||||
|
<li class="after">B</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul class="inside">
|
||||||
|
<li class="before after">B</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>B</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li class="before">B</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li class="after">B</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li class="before after">B</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.body.offsetHeight;
|
||||||
|
let items = Array.prototype.slice.call(document.querySelectorAll('li'));
|
||||||
|
items.map(li => li.insertBefore(document.createTextNode('A'), li.firstChild));
|
||||||
|
document.documentElement.className = '';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Загрузка…
Ссылка в новой задаче