зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1258657 Part 1 - Change summary default style to "display: list-item" to match html spec. r=bz
Per html spec, the disclosure triangle can be generated via "display: list-item", I removed the code to generate the triangle in SummaryFrame::SetInitialChildList(). That is, when a web page set "display: block" to the summary, the triangle will disappear, too. Now SummaryFrame does nothing and is going to be removed in Part 2. Also summary element should not increment the counter as hinted as "counter-increment: list-item 0" in the spec. Hence the change in nsBlockFrame::RenumberListsFor(). The rendering hint in html spec: https://html.spec.whatwg.org/multipage/rendering.html#the-details-and-summary-elements MozReview-Commit-ID: DELGYFe3zGX --HG-- rename : layout/reftests/details-summary/open-summary-block-style.html => layout/reftests/details-summary/open-summary-block-style-ref.html extra : rebase_source : 4bd5493fb6a1108eea31aef1d89f563f781b753f
This commit is contained in:
Родитель
441c1e30d4
Коммит
7379c19c84
|
@ -35,16 +35,4 @@ void
|
|||
SummaryFrame::SetInitialChildList(ChildListID aListID, nsFrameList& aChildList)
|
||||
{
|
||||
nsBlockFrame::SetInitialChildList(aListID, aChildList);
|
||||
|
||||
// Construct the disclosure triangle if it's the main summary. We leverage the
|
||||
// list-item property and nsBulletFrame to draw the triangle. Need to set
|
||||
// list-style-type for :moz-list-bullet in html.css.
|
||||
// TODO: Bug 1221416 for styling the disclosure triangle.
|
||||
if (aListID == kPrincipalList) {
|
||||
auto* summary = HTMLSummaryElement::FromContent(GetContent());
|
||||
if (summary->IsMainSummary() &&
|
||||
StyleDisplay()->mDisplay != NS_STYLE_DISPLAY_LIST_ITEM) {
|
||||
CreateBulletFrameForListItem(true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,6 +52,8 @@
|
|||
#include "nsIFrameInlines.h"
|
||||
#include "CounterStyleManager.h"
|
||||
#include "nsISelection.h"
|
||||
#include "mozilla/dom/HTMLDetailsElement.h"
|
||||
#include "mozilla/dom/HTMLSummaryElement.h"
|
||||
#include "mozilla/StyleSetHandle.h"
|
||||
#include "mozilla/StyleSetHandleInlines.h"
|
||||
|
||||
|
@ -6918,7 +6920,6 @@ nsBlockFrame::CreateBulletFrameForListItem(bool aCreateBulletList,
|
|||
// If the list bullet frame should be positioned inside then add
|
||||
// it to the flow now.
|
||||
if (aListStylePositionInside) {
|
||||
|
||||
nsFrameList bulletList(bullet, bullet);
|
||||
AddFrames(bulletList, nullptr);
|
||||
Properties().Set(InsideBulletProperty(), bullet);
|
||||
|
@ -7090,6 +7091,15 @@ nsBlockFrame::RenumberListsFor(nsPresContext* aPresContext,
|
|||
if (!kid)
|
||||
return false;
|
||||
|
||||
// Do not renumber list for summary elements.
|
||||
if (HTMLDetailsElement::IsDetailsEnabled()) {
|
||||
HTMLSummaryElement* summary =
|
||||
HTMLSummaryElement::FromContent(kid->GetContent());
|
||||
if (summary && summary->IsMainSummary()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool kidRenumberedABullet = false;
|
||||
|
||||
// If the frame is a list-item and the frame implements our
|
||||
|
|
|
@ -7,8 +7,21 @@
|
|||
<ol>
|
||||
<li>First item
|
||||
<div>
|
||||
<summary>Summary</summary>
|
||||
<summary>Summary
|
||||
<ul>
|
||||
<li>First unordered item in summary</li>
|
||||
<li>Second unordered item in summary</li>
|
||||
</ul>
|
||||
<div>
|
||||
<ol>
|
||||
<li>First item in summary</li>
|
||||
<li>Second item in summary</li>
|
||||
</ol>
|
||||
</div>
|
||||
</summary>
|
||||
<p>This is the details.</p>
|
||||
<li>First item in details</li>
|
||||
<li>Second item in details</li>
|
||||
</div>
|
||||
</li>
|
||||
<li>Second item</li>
|
||||
|
|
|
@ -14,8 +14,24 @@
|
|||
<ol>
|
||||
<li>First item
|
||||
<details open>
|
||||
<summary>Summary</summary>
|
||||
<summary>Summary
|
||||
<ul>
|
||||
<li>First unordered item in summary</li>
|
||||
<li>Second unordered item in summary</li>
|
||||
</ul>
|
||||
<div>
|
||||
<ol>
|
||||
<li>First item in summary</li>
|
||||
<li>Second item in summary</li>
|
||||
</ol>
|
||||
</div>
|
||||
</summary>
|
||||
<p>This is the details.</p>
|
||||
<!-- Although html spec does not allow <li> inside <details>, we
|
||||
deliberately omit the <ol> to test the renumbering isn't affected
|
||||
by the summary. -->
|
||||
<li>First item in details</li>
|
||||
<li>Second item in details</li>
|
||||
</details>
|
||||
</li>
|
||||
<li>Second item</li>
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
- http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
|
||||
<html>
|
||||
<body>
|
||||
<div>
|
||||
<div>Summary</div>
|
||||
<p>This is the details.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -5,7 +5,8 @@
|
|||
<html>
|
||||
<body>
|
||||
<details open>
|
||||
<summary style="display: list-item; list-style-type: disc; list-style-position: inside;">Summary</summary>
|
||||
<!-- Test the disclosure triangle is gone. -->
|
||||
<summary style="display: block;">Summary</summary>
|
||||
<p>This is the details.</p>
|
||||
</details>
|
||||
</body>
|
||||
|
|
|
@ -8,7 +8,7 @@ pref(dom.details_element.enabled,true) == multiple-summary.html single-summary.h
|
|||
pref(dom.details_element.enabled,true) == open-multiple-summary.html open-multiple-summary-ref.html
|
||||
pref(dom.details_element.enabled,true) == summary-not-first-child.html single-summary.html
|
||||
pref(dom.details_element.enabled,true) == open-summary-not-first-child.html open-single-summary.html
|
||||
pref(dom.details_element.enabled,true) == open-summary-block-style.html open-single-summary.html
|
||||
pref(dom.details_element.enabled,true) == open-summary-block-style.html open-summary-block-style-ref.html
|
||||
pref(dom.details_element.enabled,true) == no-summary.html no-summary-ref.html
|
||||
pref(dom.details_element.enabled,true) == open-no-summary.html open-no-summary-ref.html
|
||||
pref(dom.details_element.enabled,true) == summary-not-in-details.html summary-not-in-details-ref.html
|
||||
|
|
|
@ -773,13 +773,21 @@ video > .caption-box {
|
|||
/* details & summary */
|
||||
/* Need to revert Bug 1259889 Part 2 when removing details preference. */
|
||||
@supports -moz-bool-pref("dom.details_element.enabled") {
|
||||
details > summary::-moz-list-bullet {
|
||||
list-style-type: disclosure-closed;
|
||||
details > summary:first-of-type,
|
||||
details > summary:-moz-native-anonymous {
|
||||
display: list-item;
|
||||
list-style: disclosure-closed inside;
|
||||
}
|
||||
|
||||
details[open] > summary::-moz-list-bullet {
|
||||
details[open] > summary:first-of-type,
|
||||
details[open] > summary:-moz-native-anonymous {
|
||||
list-style-type: disclosure-open;
|
||||
}
|
||||
|
||||
details > summary:first-of-type > * {
|
||||
/* Cancel "list-style-position: inside" inherited from summary. */
|
||||
list-style-position: initial;
|
||||
}
|
||||
}
|
||||
|
||||
/* emulation of non-standard HTML <marquee> tag */
|
||||
|
|
Загрузка…
Ссылка в новой задаче