Skip to content

Commit 9138e3b

Browse files
committed
Backed out changeset 842955b61f01 (bug 1365806) for wr failures on contain-size-scrollbars-002.html . CLOSED TREE
1 parent ef98547 commit 9138e3b

File tree

7 files changed

+32
-27
lines changed

7 files changed

+32
-27
lines changed

layout/generic/nsGfxScrollFrame.cpp

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,10 @@ static void GetScrollbarMetrics(nsBoxLayoutState& aState, nsIFrame* aBox,
385385
* 1) the style is not HIDDEN
386386
* 2) our inside-border height is at least the scrollbar height (i.e., the
387387
* scrollbar fits vertically)
388-
* 3) the style is SCROLL, or the kid's overflow-area XMost is
388+
* 3) our scrollport width (the inside-border width minus the width allocated
389+
* for a vertical scrollbar, if showing) is at least the scrollbar's min-width
390+
* (i.e., the scrollbar fits horizontally)
391+
* 4) the style is SCROLL, or the kid's overflow-area XMost is
389392
* greater than the scrollport width
390393
*
391394
* @param aForce if true, then we just assume the layout is consistent.
@@ -411,37 +414,42 @@ bool nsHTMLScrollFrame::TryLayout(ScrollReflowInput* aState,
411414
ReflowScrolledFrame(aState, aAssumeHScroll, aAssumeVScroll, aKidMetrics);
412415
}
413416

417+
nsSize vScrollbarMinSize(0, 0);
414418
nsSize vScrollbarPrefSize(0, 0);
415419
if (mHelper.mVScrollbarBox) {
416420
GetScrollbarMetrics(aState->mBoxState, mHelper.mVScrollbarBox,
417-
nullptr,
421+
&vScrollbarMinSize,
418422
aAssumeVScroll ? &vScrollbarPrefSize : nullptr);
419423
nsScrollbarFrame* scrollbar = do_QueryFrame(mHelper.mVScrollbarBox);
420424
scrollbar->SetScrollbarMediatorContent(mContent);
421425
}
422426
nscoord vScrollbarDesiredWidth =
423427
aAssumeVScroll ? vScrollbarPrefSize.width : 0;
428+
nscoord vScrollbarMinHeight = aAssumeVScroll ? vScrollbarMinSize.height : 0;
424429

430+
nsSize hScrollbarMinSize(0, 0);
425431
nsSize hScrollbarPrefSize(0, 0);
426432
if (mHelper.mHScrollbarBox) {
427433
GetScrollbarMetrics(aState->mBoxState, mHelper.mHScrollbarBox,
428-
nullptr,
434+
&hScrollbarMinSize,
429435
aAssumeHScroll ? &hScrollbarPrefSize : nullptr);
430436
nsScrollbarFrame* scrollbar = do_QueryFrame(mHelper.mHScrollbarBox);
431437
scrollbar->SetScrollbarMediatorContent(mContent);
432438
}
433-
434439
nscoord hScrollbarDesiredHeight =
435440
aAssumeHScroll ? hScrollbarPrefSize.height : 0;
441+
nscoord hScrollbarMinWidth = aAssumeHScroll ? hScrollbarMinSize.width : 0;
436442

437443
// First, compute our inside-border size and scrollport size
438444
// XXXldb Can we depend more on ComputeSize here?
439445
nsSize kidSize = aState->mReflowInput.mStyleDisplay->IsContainSize()
440446
? nsSize(0, 0)
441447
: aKidMetrics->PhysicalSize();
442448
nsSize desiredInsideBorderSize;
443-
desiredInsideBorderSize.width = vScrollbarDesiredWidth + kidSize.width;
444-
desiredInsideBorderSize.height = hScrollbarDesiredHeight + kidSize.height;
449+
desiredInsideBorderSize.width =
450+
vScrollbarDesiredWidth + std::max(kidSize.width, hScrollbarMinWidth);
451+
desiredInsideBorderSize.height =
452+
hScrollbarDesiredHeight + std::max(kidSize.height, vScrollbarMinHeight);
445453
aState->mInsideBorderSize =
446454
ComputeInsideBorderSize(aState, desiredInsideBorderSize);
447455

@@ -499,9 +507,9 @@ bool nsHTMLScrollFrame::TryLayout(ScrollReflowInput* aState,
499507
aState->mHScrollbar == ShowScrollbar::Always ||
500508
scrolledRect.XMost() >= visualViewportSize.width + oneDevPixel ||
501509
scrolledRect.x <= -oneDevPixel;
502-
if (wantHScrollbar != aAssumeHScroll) {
503-
return false;
504-
}
510+
if (scrollPortSize.width < hScrollbarMinSize.width)
511+
wantHScrollbar = false;
512+
if (wantHScrollbar != aAssumeHScroll) return false;
505513
}
506514

507515
// If the style is HIDDEN then we already know that aAssumeVScroll is false
@@ -510,9 +518,9 @@ bool nsHTMLScrollFrame::TryLayout(ScrollReflowInput* aState,
510518
aState->mVScrollbar == ShowScrollbar::Always ||
511519
scrolledRect.YMost() >= visualViewportSize.height + oneDevPixel ||
512520
scrolledRect.y <= -oneDevPixel;
513-
if (wantVScrollbar != aAssumeVScroll) {
514-
return false;
515-
}
521+
if (scrollPortSize.height < vScrollbarMinSize.height)
522+
wantVScrollbar = false;
523+
if (wantVScrollbar != aAssumeVScroll) return false;
516524
}
517525
}
518526

layout/xul/test/test_bug563416.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</head>
1111
<body>
1212
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=563416">Mozilla Bug 563416</a>
13-
<p id="display"><iframe id="test" srcdoc='<textarea style="box-sizing:content-box; overflow: hidden; -moz-appearance:none; height: 0px; padding: 0px;" cols="20" rows="10">hsldkjvmshlkkajskdlfksdjflskdjflskdjflskdjflskdjfddddddddd</textarea>'></iframe></p>
13+
<p id="display"><iframe id="test" srcdoc='<textarea style="box-sizing:content-box; -moz-appearance:none; height: 0px; padding: 0px;" cols="20" rows="10">hsldkjvmshlkkajskdlfksdjflskdjflskdjflskdjflskdjfddddddddd</textarea>'></iframe></p>
1414
<div id="content" style="display: none">
1515

1616
</div>
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[contain-size-flexbox-002.html]
2-
expected: FAIL
2+
expected:
3+
if (os == "android"): FAIL
34
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1560420
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[grid-container-scrollbar-vertical-lr-001.html]
2+
expected:
3+
if os == "mac": FAIL
4+
if (os == 'linux' and os_version == '18.04'): FAIL # Bug 1601497
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[grid-container-scrollbar-vertical-rl-001.html]
2+
expected:
3+
if os == "mac": FAIL
4+
if (os == 'linux' and os_version == '18.04'): FAIL # Bug 1601500

testing/web-platform/tests/css/css-overflow/scrollbar-empty-001.html

Lines changed: 0 additions & 12 deletions
This file was deleted.

testing/web-platform/tests/css/css-scrollbars/auto-scrollbar-inline-children.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
.container { width:100px; }
1010
</style>
1111
<p>There should be a blue rectangle below, and possibly a scrollbar (depending
12-
on OS / browser), that should not obscure any parts of the rectangle. The
12+
on OS / browser), that shouldn not obscure any parts of the rectangle. The
1313
word "FAIL" should not be seen.</p>
1414
<div class="container" style="overflow:auto; height:200px;">
1515
<div id="child" style="display:inline-block; box-sizing:border-box; width:100%; height:100%; border:10px solid blue;"></div>

0 commit comments

Comments
 (0)