зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1483946 - Fix CSS containment issue with scrollable elements - r=dholbert
Scrollable elements already trap all of their contents, nothing should spill out, so there is no need for special handling of the `contain` CSS property. Differential Revision: https://phabricator.services.mozilla.com/D3854 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
164891642a
Коммит
e3df11afd8
|
@ -1844,23 +1844,14 @@ nsBlockFrame::ComputeOverflowAreas(const nsRect& aBounds,
|
|||
// XXX_perf: This can be done incrementally. It is currently one of
|
||||
// the things that makes incremental reflow O(N^2).
|
||||
nsOverflowAreas areas(aBounds, aBounds);
|
||||
if (mComputedStyle->GetPseudo() == nsCSSAnonBoxes::scrolledContent() &&
|
||||
mParent->StyleDisplay()->IsContainLayout()) {
|
||||
// If we are a scrollframe's inner anonymous box and our parent
|
||||
// has layout containment, we want to pass our parent's style to
|
||||
// ConsiderBlockEndEdgeOfChildren to make sure all overflow from the
|
||||
// layout contained element is processed as ink (visual) overflow.
|
||||
aDisplay = mParent->StyleDisplay();
|
||||
}
|
||||
if (!ShouldApplyOverflowClipping(this, aDisplay)) {
|
||||
for (LineIterator line = LinesBegin(), line_end = LinesEnd();
|
||||
line != line_end;
|
||||
++line) {
|
||||
if (aDisplay->IsContainLayout()) {
|
||||
// If we have layout containment (or, per above, we are a scrollframe's
|
||||
// inner anonymous box and our parent has layout containment), we should
|
||||
// only consider our child's visual overflow, leaving the scrollable
|
||||
// regions of the parent unaffected.
|
||||
// If we have layout containment, we should only consider our child's
|
||||
// visual overflow, leaving the scrollable regions of the parent
|
||||
// unaffected.
|
||||
// Note: scrollable overflow is a subset of visual overflow,
|
||||
// so this has the same affect as unioning the child's visual and
|
||||
// scrollable overflow with its parent's visual overflow.
|
||||
|
|
|
@ -9678,19 +9678,11 @@ void
|
|||
nsFrame::ConsiderChildOverflow(nsOverflowAreas& aOverflowAreas,
|
||||
nsIFrame* aChildFrame)
|
||||
{
|
||||
const nsStyleDisplay* display = StyleDisplay();
|
||||
if (mComputedStyle->GetPseudo() == nsCSSAnonBoxes::scrolledContent()) {
|
||||
// If we are a scrollframe's inner anonymous box, we'll want to check if
|
||||
// our parent has contain:layout below, so we change the nsStyleDisplay we
|
||||
// read from here.
|
||||
display = mParent->StyleDisplay();
|
||||
}
|
||||
if (display->IsContainLayout() && IsFrameOfType(eSupportsContainLayoutAndPaint)) {
|
||||
if (StyleDisplay()->IsContainLayout() &&
|
||||
IsFrameOfType(eSupportsContainLayoutAndPaint)) {
|
||||
// If we have layout containment and are not a non-atomic, inline-level
|
||||
// principal box (or, if we are a scrollframe's inner anonymous box and
|
||||
// our parent has layout containment) we should only consider our child's
|
||||
// visual (ink) overflow, leaving the scrollable regions of the parent
|
||||
// unaffected.
|
||||
// principal box, we should only consider our child's visual (ink) overflow,
|
||||
// leaving the scrollable regions of the parent unaffected.
|
||||
// Note: scrollable overflow is a subset of visual overflow,
|
||||
// so this has the same affect as unioning the child's visual and
|
||||
// scrollable overflow with the parent's visual overflow.
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<!doctype html>
|
||||
<div style="width: 100px; height: 100px; overflow-y: auto;">
|
||||
<div style="width: 200px; height: 200px; background: green"></div>
|
||||
</div>
|
|
@ -0,0 +1,4 @@
|
|||
<!doctype html>
|
||||
<div style="width: 100px; height: 100px; overflow-y: auto; contain: layout;">
|
||||
<div style="width: 200px; height: 200px; background: green"></div>
|
||||
</div>
|
|
@ -2081,3 +2081,4 @@ fuzzy(0-1,0-625) == 1466638-1.html 1466638-1-ref.html
|
|||
== bug1472465-1.html bug1472465-1-ref.html
|
||||
== 1475971-1.html 1475971-1-ref.html
|
||||
== 1483649-1.xul 1483649-1-ref.xul
|
||||
test-pref(layout.css.contain.enabled,true) == 1483946.html 1483946-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче