Bug 1297835. Don't suppress the scroll bits of a non-open <details> that has the appropriate overflow styles. r=TYLin

This commit is contained in:
Boris Zbarsky 2016-08-25 14:35:33 -04:00
Родитель 0de02db832
Коммит adcdc0aaed
10 изменённых файлов: 179 добавлений и 2 удалений

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

@ -0,0 +1,6 @@
<body onload="document.documentElement.offsetWidth; document.querySelector('details').style.color = 'green'">
<details style="display: block; overflow: scroll;">
<summary>Some summary</summary>
The details
</details>
</body>

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

@ -476,4 +476,5 @@ pref(dom.webcomponents.enabled,true) load 1261351.html
load 1270797-1.html
load 1278455-1.html
load 1286889.html
load 1297835.html
load 1288608.html

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

@ -5713,9 +5713,15 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
}
// When constructing a child of a non-open <details>, create only the frame
// for the main <summary> element, and skip other elements.
// for the main <summary> element, and skip other elements. This only applies
// to things that are not roots of native anonymous subtrees (except for
// ::before and ::after); we always want to create "internal" anonymous
// content.
auto* details = HTMLDetailsElement::FromContentOrNull(parent);
if (details && details->IsDetailsEnabled() && !details->Open()) {
if (details && details->IsDetailsEnabled() && !details->Open() &&
(!aContent->IsRootOfNativeAnonymousSubtree() ||
aContent->IsGeneratedContentContainerForBefore() ||
aContent->IsGeneratedContentContainerForAfter())) {
auto* summary = HTMLSummaryElement::FromContentOrNull(aContent);
if (!summary || !summary->IsMainSummary()) {
SetAsUndisplayedContent(aState, aItems, aContent, styleContext,

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

@ -0,0 +1,21 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<head>
<style>
details::after {
content: "This is the details.";
/* Match the margins and display of <p> */
display: block;
margin-block-start: 1em;
margin-block-end: 1em;
}
</style>
</head>
<html>
<body>
<details>
<summary>Summary</summary>
</details>
</body>
</html>

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

@ -0,0 +1,21 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<head>
<style>
details::before {
content: "This is the details.";
/* Match the margins and display of <p> */
display: block;
margin-block-start: 1em;
margin-block-end: 1em;
}
</style>
</head>
<html>
<body>
<details>
<summary>Summary</summary>
</details>
</body>
</html>

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

@ -0,0 +1,21 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<head>
<style>
details::after {
content: "This is the details.";
/* Match the margins and display of <p> */
display: block;
margin-block-start: 1em;
margin-block-end: 1em;
}
</style>
</head>
<html>
<body>
<details open>
<summary>Summary</summary>
</details>
</body>
</html>

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

@ -0,0 +1,21 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<head>
<style>
details::before {
content: "This is the details.";
/* Match the margins and display of <p> */
display: block;
margin-block-start: 1em;
margin-block-end: 1em;
}
</style>
</head>
<html>
<body>
<details open>
<summary>Summary</summary>
</details>
</body>
</html>

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

@ -0,0 +1,31 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<style>
div#details {
background-color: orange;
overflow: scroll;
width: 300px;
height: 200px;
}
div#summary {
background-color: green;
width: 200px;
height: 100px;
}
</style>
<body>
<div id="details">
<div id="summary">Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit
in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
officia deserunt mollit anim id est laborum.
</div>
</div>
</body>
</html>

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

@ -0,0 +1,42 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<style>
details {
background-color: orange;
overflow: scroll;
width: 300px;
height: 200px;
}
summary::-moz-list-bullet {
/* Hide the triangle for comparing with div in reftest. */
list-style-type: none;
}
summary {
background-color: green;
width: 200px;
height: 100px;
}
</style>
<body>
<details>
<summary>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
</summary>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
est laborum.
</details>
</body>
</html>

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

@ -42,6 +42,7 @@ pref(dom.details_element.enabled,false) == no-summary.html disabled-no-summary-r
# With 'overflow' property
== overflow-hidden-open-details.html overflow-hidden-open-details-ref.html
== overflow-auto-open-details.html overflow-auto-open-details-ref.html
== overflow-scroll-details.html overflow-scroll-details-ref.html
# With pagination property
== details-page-break-after-1.html details-two-pages.html
@ -84,3 +85,9 @@ pref(dom.details_element.enabled,false) == no-summary.html disabled-no-summary-r
== key-enter-open-second-summary.html open-multiple-summary.html
== key-enter-prevent-default.html single-summary.html
== key-space-single-summary.html open-single-summary.html
# Generated content bits
== details-after.html single-summary.html
== details-before.html single-summary.html
== open-details-after.html open-single-summary.html
== open-details-before.html open-single-summary.html