зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1042151 Part 2 - Refactor the conditions that decide which edge to clamp when getting scrolled rect. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D86076
This commit is contained in:
Родитель
04e997fc43
Коммит
b040f29dc0
|
@ -2219,13 +2219,19 @@ nsRect nsLayoutUtils::GetScrolledRect(nsIFrame* aScrolledFrame,
|
|||
y1 = aScrolledFrameOverflowArea.y,
|
||||
y2 = aScrolledFrameOverflowArea.YMost();
|
||||
|
||||
bool horizontal = !wm.IsVertical();
|
||||
const bool isHorizontalWM = !wm.IsVertical();
|
||||
const bool isVerticalWM = wm.IsVertical();
|
||||
bool isInlineFlowFromTopOrLeft = !wm.IsInlineReversed();
|
||||
bool isBlockFlowFromTopOrLeft = isHorizontalWM || wm.IsVerticalLR();
|
||||
|
||||
// TODO: Consider flexbox's main-axis and cross-axis in
|
||||
// isInlineFlowFromTopOrLeft and isBlockFlowFromTopOrLeft.
|
||||
|
||||
// Clamp the horizontal start-edge (x1 or x2, depending whether the logical
|
||||
// axis that corresponds to horizontal progresses from L-R or R-L).
|
||||
// In horizontal writing mode, we need to check IsInlineReversed() to see
|
||||
// which side to clamp; in vertical mode, it depends on the block direction.
|
||||
if ((horizontal && !wm.IsInlineReversed()) || wm.IsVerticalLR()) {
|
||||
// axis that corresponds to horizontal progresses from left-to-right or
|
||||
// right-to-left).
|
||||
if ((isHorizontalWM && isInlineFlowFromTopOrLeft) ||
|
||||
(isVerticalWM && isBlockFlowFromTopOrLeft)) {
|
||||
if (x1 < 0) {
|
||||
x1 = 0;
|
||||
}
|
||||
|
@ -2245,10 +2251,11 @@ nsRect nsLayoutUtils::GetScrolledRect(nsIFrame* aScrolledFrame,
|
|||
x2 += extraWidth;
|
||||
}
|
||||
|
||||
// Similarly, clamp the vertical start-edge.
|
||||
// In horizontal writing mode, the block direction is always top-to-bottom;
|
||||
// in vertical writing mode, we need to check IsInlineReversed().
|
||||
if (horizontal || !wm.IsInlineReversed()) {
|
||||
// Similarly, clamp the vertical start-edge (y1 or y2, depending whether the
|
||||
// logical axis that corresponds to vertical progresses from top-to-bottom or
|
||||
// buttom-to-top).
|
||||
if ((isHorizontalWM && isBlockFlowFromTopOrLeft) ||
|
||||
(isVerticalWM && isInlineFlowFromTopOrLeft)) {
|
||||
if (y1 < 0) {
|
||||
y1 = 0;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче