Bug 1175509 Part 2 - Make TryLayout correctly consider ScrolledContentDependsOnBSize in vertical writing-mode. r=emilio

This patch potentially changes the behavior when the scrolled frame is in
vertical writing-mode, but it should be the correct way to handle the scrollbar
change.

Differential Revision: https://phabricator.services.mozilla.com/D130711
This commit is contained in:
Ting-Yu Lin 2021-11-15 18:51:29 +00:00
Родитель a1c0177324
Коммит 3285bbf67e
1 изменённых файлов: 17 добавлений и 7 удалений

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

@ -437,10 +437,23 @@ bool nsHTMLScrollFrame::TryLayout(ScrollReflowInput* aState,
return false;
}
if (aAssumeVScroll != aState->mReflowedContentsWithVScrollbar ||
(aAssumeHScroll != aState->mReflowedContentsWithHScrollbar &&
ScrolledContentDependsOnBSize(aState))) {
if (aAssumeHScroll != aState->mReflowedContentsWithHScrollbar) {
const bool assumeVScrollChanged =
aAssumeVScroll != aState->mReflowedContentsWithVScrollbar;
const bool assumeHScrollChanged =
aAssumeHScroll != aState->mReflowedContentsWithHScrollbar;
const bool isVertical = GetWritingMode().IsVertical();
const bool shouldReflowScolledFrame = [=]() {
if (isVertical) {
return assumeHScrollChanged ||
(assumeVScrollChanged && ScrolledContentDependsOnBSize(aState));
}
return assumeVScrollChanged ||
(assumeHScrollChanged && ScrolledContentDependsOnBSize(aState));
}();
if (shouldReflowScolledFrame) {
if (isVertical ? assumeVScrollChanged : assumeHScrollChanged) {
nsLayoutUtils::MarkIntrinsicISizesDirtyIfDependentOnBSize(
mHelper.mScrolledFrame);
}
@ -644,9 +657,6 @@ bool nsHTMLScrollFrame::TryLayout(ScrollReflowInput* aState,
return true;
}
// XXX Height/BSize mismatch needs to be addressed here; check the caller!
// Currently this will only behave as expected for horizontal writing modes.
// (See bug 1175509.)
bool nsHTMLScrollFrame::ScrolledContentDependsOnBSize(
ScrollReflowInput* aState) const {
return mHelper.mScrolledFrame->HasAnyStateBits(