| Index: third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp b/third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp
|
| index 6314b189868fc6cab52c10390e96fa3d16362477..5f6d60807a964114156add7f39ee213263353938 100644
|
| --- a/third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp
|
| @@ -221,32 +221,18 @@ void RootInlineBox::childRemoved(InlineBox* box) {
|
| }
|
| }
|
|
|
| -static inline void snapHeight(int& maxAscent,
|
| - int& maxDescent,
|
| - const ComputedStyle& style) {
|
| - // If position is 0, add spaces to over/under equally.
|
| - // https://drafts.csswg.org/css-snap-size/#snap-height
|
| - int unit = style.snapHeightUnit();
|
| - ASSERT(unit);
|
| - int position = style.snapHeightPosition();
|
| - if (!position) {
|
| - int space = unit - ((maxAscent + maxDescent) % unit);
|
| - maxDescent += space / 2;
|
| - maxAscent += space - space / 2;
|
| +static inline void applyLineHeightStep(uint8_t lineHeightStep,
|
| + int& maxAscent,
|
| + int& maxDescent) {
|
| + // Round up to the multiple of units, by adding spaces to over/under equally.
|
| + // https://drafts.csswg.org/css-rhythm/#line-height-step
|
| + int remainder = (maxAscent + maxDescent) % lineHeightStep;
|
| + if (!remainder)
|
| return;
|
| - }
|
| -
|
| - // Match the baseline to the specified position.
|
| - // https://drafts.csswg.org/css-snap-size/#snap-baseline
|
| - ASSERT(position > 0 && position <= 100);
|
| - position = position * unit / 100;
|
| - int spaceOver = position - maxAscent % unit;
|
| - if (spaceOver < 0) {
|
| - spaceOver += unit;
|
| - ASSERT(spaceOver >= 0);
|
| - }
|
| - maxAscent += spaceOver;
|
| - maxDescent += unit - (maxAscent + maxDescent) % unit;
|
| + DCHECK_GT(remainder, 0);
|
| + int space = lineHeightStep - remainder;
|
| + maxDescent += space / 2;
|
| + maxAscent += space - space / 2;
|
| }
|
|
|
| LayoutUnit RootInlineBox::alignBoxesInBlockDirection(
|
| @@ -278,8 +264,8 @@ LayoutUnit RootInlineBox::alignBoxesInBlockDirection(
|
| adjustMaxAscentAndDescent(maxAscent, maxDescent, maxPositionTop.toInt(),
|
| maxPositionBottom.toInt());
|
|
|
| - if (getLineLayoutItem().styleRef().snapHeightUnit())
|
| - snapHeight(maxAscent, maxDescent, getLineLayoutItem().styleRef());
|
| + if (uint8_t lineHeightStep = getLineLayoutItem().styleRef().lineHeightStep())
|
| + applyLineHeightStep(lineHeightStep, maxAscent, maxDescent);
|
|
|
| LayoutUnit maxHeight = LayoutUnit(maxAscent + maxDescent);
|
| LayoutUnit lineTop = heightOfBlock;
|
|
|