Bug 1042151 Part 4 - Consider flexbox's main & cross axis when getting scrolled rect. r=dholbert

Differential Revision: https://phabricator.services.mozilla.com/D86078
This commit is contained in:
Ting-Yu Lin 2020-08-07 19:11:38 +00:00
Родитель 60882f12fb
Коммит 547520683e
2 изменённых файлов: 29 добавлений и 2 удалений

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

@ -112,6 +112,7 @@
#include "nsDataHashtable.h"
#include "nsDeckFrame.h"
#include "nsDisplayList.h"
#include "nsFlexContainerFrame.h"
#include "nsFontInflationData.h"
#include "nsFontMetrics.h"
#include "nsFrameList.h"
@ -2224,8 +2225,27 @@ nsRect nsLayoutUtils::GetScrolledRect(nsIFrame* aScrolledFrame,
bool isInlineFlowFromTopOrLeft = !wm.IsInlineReversed();
bool isBlockFlowFromTopOrLeft = isHorizontalWM || wm.IsVerticalLR();
// TODO: Consider flexbox's main-axis and cross-axis in
// isInlineFlowFromTopOrLeft and isBlockFlowFromTopOrLeft.
if (aScrolledFrame->IsFlexContainerFrame()) {
// In a flex container, the children flow (and overflow) along the flex
// container's main axis and cross axis. These are analogous to the
// inline/block axes, and by default they correspond exactly to those axes;
// but the flex container's CSS (e.g. flex-direction: column-reverse) may
// have swapped and/or reversed them, and we need to account for that here.
FlexboxAxisInfo info(aScrolledFrame);
if (info.mIsRowOriented) {
// The flex container's inline axis is the main axis.
isInlineFlowFromTopOrLeft =
isInlineFlowFromTopOrLeft == !info.mIsMainAxisReversed;
isBlockFlowFromTopOrLeft =
isBlockFlowFromTopOrLeft == !info.mIsCrossAxisReversed;
} else {
// The flex container's block axis is the main axis.
isBlockFlowFromTopOrLeft =
isBlockFlowFromTopOrLeft == !info.mIsMainAxisReversed;
isInlineFlowFromTopOrLeft =
isInlineFlowFromTopOrLeft == !info.mIsCrossAxisReversed;
}
}
// Clamp the horizontal start-edge (x1 or x2, depending whether the logical
// axis that corresponds to horizontal progresses from left-to-right or

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

@ -1,4 +1,6 @@
[negative-overflow.html]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1626108
[.flexbox 10]
expected: FAIL
@ -8,3 +10,8 @@
[.flexbox 9]
expected: FAIL
[.flexbox 5]
expected: FAIL # Overflow due to wrap-reverse becomes scrollable after bug 1042151.
[.flexbox 11]
expected: FAIL # Overflow due to wrap-reverse becomes scrollable after bug 1042151.