Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp

Issue 1583783002: Use IndentTextOrNot instead of a bool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@568851-2
Patch Set: Update Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved.
4 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 if (direction == LTR) 561 if (direction == LTR)
562 updateLogicalWidthForRightAlignedBlock(style()->isLeftToRightDirecti on(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 562 updateLogicalWidthForRightAlignedBlock(style()->isLeftToRightDirecti on(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);
563 else 563 else
564 updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirectio n(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 564 updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirectio n(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);
565 break; 565 break;
566 } 566 }
567 if (shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) 567 if (shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
568 logicalLeft += verticalScrollbarWidth(); 568 logicalLeft += verticalScrollbarWidth();
569 } 569 }
570 570
571 static void updateLogicalInlinePositions(LayoutBlockFlow* block, LayoutUnit& lin eLogicalLeft, LayoutUnit& lineLogicalRight, LayoutUnit& availableLogicalWidth, b ool firstLine, IndentTextOrNot shouldIndentText, LayoutUnit boxLogicalHeight) 571 static void updateLogicalInlinePositions(LayoutBlockFlow* block, LayoutUnit& lin eLogicalLeft, LayoutUnit& lineLogicalRight, LayoutUnit& availableLogicalWidth, b ool firstLine, IndentTextOrNot indentText, LayoutUnit boxLogicalHeight)
572 { 572 {
573 LayoutUnit lineLogicalHeight = block->minLineHeightForReplacedObject(firstLi ne, boxLogicalHeight); 573 LayoutUnit lineLogicalHeight = block->minLineHeightForReplacedObject(firstLi ne, boxLogicalHeight);
574 lineLogicalLeft = block->logicalLeftOffsetForLine(block->logicalHeight(), sh ouldIndentText == IndentText, lineLogicalHeight); 574 lineLogicalLeft = block->logicalLeftOffsetForLine(block->logicalHeight(), in dentText, lineLogicalHeight);
575 lineLogicalRight = block->logicalRightOffsetForLine(block->logicalHeight(), shouldIndentText == IndentText, lineLogicalHeight); 575 lineLogicalRight = block->logicalRightOffsetForLine(block->logicalHeight(), indentText, lineLogicalHeight);
576 availableLogicalWidth = lineLogicalRight - lineLogicalLeft; 576 availableLogicalWidth = lineLogicalRight - lineLogicalLeft;
577 } 577 }
578 578
579 void LayoutBlockFlow::computeInlineDirectionPositionsForLine(RootInlineBox* line Box, const LineInfo& lineInfo, BidiRun* firstRun, BidiRun* trailingSpaceRun, boo l reachedEnd, 579 void LayoutBlockFlow::computeInlineDirectionPositionsForLine(RootInlineBox* line Box, const LineInfo& lineInfo, BidiRun* firstRun, BidiRun* trailingSpaceRun, boo l reachedEnd,
580 GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& ver ticalPositionCache, WordMeasurements& wordMeasurements) 580 GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& ver ticalPositionCache, WordMeasurements& wordMeasurements)
581 { 581 {
582 ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWit hBreak()); 582 ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWit hBreak());
583 583
584 // CSS 2.1: "'Text-indent' only affects a line if it is the first formatted line of an element. For example, the first line of an anonymous block 584 // CSS 2.1: "'Text-indent' only affects a line if it is the first formatted line of an element. For example, the first line of an anonymous block
585 // box is only affected if it is the first child of its parent element." 585 // box is only affected if it is the first child of its parent element."
586 // CSS3 "text-indent", "each-line" affects the first line of the block conta iner as well as each line after a forced line break, 586 // CSS3 "text-indent", "each-line" affects the first line of the block conta iner as well as each line after a forced line break,
587 // but does not affect lines after a soft wrap break. 587 // but does not affect lines after a soft wrap break.
588 bool isFirstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent( )->slowFirstChild() != this); 588 bool isFirstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent( )->slowFirstChild() != this);
589 bool isAfterHardLineBreak = lineBox->prevRootBox() && lineBox->prevRootBox() ->endsWithBreak(); 589 bool isAfterHardLineBreak = lineBox->prevRootBox() && lineBox->prevRootBox() ->endsWithBreak();
590 IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLi neBreak, styleRef()); 590 IndentTextOrNot indentText = requiresIndent(isFirstLine, isAfterHardLineBrea k, styleRef());
591 LayoutUnit lineLogicalLeft; 591 LayoutUnit lineLogicalLeft;
592 LayoutUnit lineLogicalRight; 592 LayoutUnit lineLogicalRight;
593 LayoutUnit availableLogicalWidth; 593 LayoutUnit availableLogicalWidth;
594 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availa bleLogicalWidth, isFirstLine, shouldIndentText, 0); 594 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availa bleLogicalWidth, isFirstLine, indentText, 0);
595 bool needsWordSpacing; 595 bool needsWordSpacing;
596 596
597 if (firstRun && firstRun->m_object->isAtomicInlineLevel()) { 597 if (firstRun && firstRun->m_object->isAtomicInlineLevel()) {
598 LayoutBox* layoutBox = toLayoutBox(firstRun->m_object); 598 LayoutBox* layoutBox = toLayoutBox(firstRun->m_object);
599 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, av ailableLogicalWidth, isFirstLine, shouldIndentText, layoutBox->logicalHeight()); 599 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, av ailableLogicalWidth, isFirstLine, indentText, layoutBox->logicalHeight());
600 } 600 }
601 601
602 computeInlineDirectionPositionsForSegment(lineBox, lineInfo, textAlign, line LogicalLeft, availableLogicalWidth, firstRun, trailingSpaceRun, textBoxDataMap, verticalPositionCache, wordMeasurements); 602 computeInlineDirectionPositionsForSegment(lineBox, lineInfo, textAlign, line LogicalLeft, availableLogicalWidth, firstRun, trailingSpaceRun, textBoxDataMap, verticalPositionCache, wordMeasurements);
603 // The widths of all runs are now known. We can now place every inline box ( and 603 // The widths of all runs are now known. We can now place every inline box ( and
604 // compute accurate widths for the inline flow boxes). 604 // compute accurate widths for the inline flow boxes).
605 needsWordSpacing = lineBox->isLeftToRightDirection() ? false: true; 605 needsWordSpacing = lineBox->isLeftToRightDirection() ? false: true;
606 lineBox->placeBoxesInInlineDirection(lineLogicalLeft, needsWordSpacing); 606 lineBox->placeBoxesInInlineDirection(lineLogicalLeft, needsWordSpacing);
607 } 607 }
608 608
609 BidiRun* LayoutBlockFlow::computeInlineDirectionPositionsForSegment(RootInlineBo x* lineBox, const LineInfo& lineInfo, ETextAlign textAlign, LayoutUnit& logicalL eft, 609 BidiRun* LayoutBlockFlow::computeInlineDirectionPositionsForSegment(RootInlineBo x* lineBox, const LineInfo& lineInfo, ETextAlign textAlign, LayoutUnit& logicalL eft,
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 904
905 if (lineBox) { 905 if (lineBox) {
906 lineBox->setLineBreakInfo(endOfLine.object(), endOfLine.offset() , resolver.status()); 906 lineBox->setLineBreakInfo(endOfLine.object(), endOfLine.offset() , resolver.status());
907 if (layoutState.usesPaintInvalidationBounds()) 907 if (layoutState.usesPaintInvalidationBounds())
908 layoutState.updatePaintInvalidationRangeFromBox(lineBox); 908 layoutState.updatePaintInvalidationRangeFromBox(lineBox);
909 909
910 if (paginated) { 910 if (paginated) {
911 LayoutUnit adjustment = 0; 911 LayoutUnit adjustment = 0;
912 adjustLinePositionForPagination(*lineBox, adjustment); 912 adjustLinePositionForPagination(*lineBox, adjustment);
913 if (adjustment) { 913 if (adjustment) {
914 LayoutUnit oldLineWidth = availableLogicalWidthForLine(o ldLogicalHeight, layoutState.lineInfo().isFirstLine()); 914 LayoutUnit oldLineWidth = availableLogicalWidthForLine(o ldLogicalHeight, layoutState.lineInfo().isFirstLine() ? IndentText : DoNotIndent Text);
915 lineBox->moveInBlockDirection(adjustment); 915 lineBox->moveInBlockDirection(adjustment);
916 if (layoutState.usesPaintInvalidationBounds()) 916 if (layoutState.usesPaintInvalidationBounds())
917 layoutState.updatePaintInvalidationRangeFromBox(line Box); 917 layoutState.updatePaintInvalidationRangeFromBox(line Box);
918 918
919 if (availableLogicalWidthForLine(oldLogicalHeight + adju stment, layoutState.lineInfo().isFirstLine()) != oldLineWidth) { 919 if (availableLogicalWidthForLine(oldLogicalHeight + adju stment, layoutState.lineInfo().isFirstLine() ? IndentText: DoNotIndentText) != o ldLineWidth) {
920 // We have to delete this line, remove all floats th at got added, and let line layout re-run. 920 // We have to delete this line, remove all floats th at got added, and let line layout re-run.
921 lineBox->deleteLine(); 921 lineBox->deleteLine();
922 endOfLine = restartLayoutRunsAndFloatsInRange(oldLog icalHeight, oldLogicalHeight + adjustment, lastFloatFromPreviousLine, resolver, previousEndofLine); 922 endOfLine = restartLayoutRunsAndFloatsInRange(oldLog icalHeight, oldLogicalHeight + adjustment, lastFloatFromPreviousLine, resolver, previousEndofLine);
923 logicalWidthIsAvailable = true; 923 logicalWidthIsAvailable = true;
924 } else { 924 } else {
925 setLogicalHeight(lineBox->lineBottomWithLeading()); 925 setLogicalHeight(lineBox->lineBottomWithLeading());
926 } 926 }
927 } 927 }
928 } 928 }
929 } 929 }
930 } 930 }
931 931
932 if (!logicalWidthIsAvailable) { 932 if (!logicalWidthIsAvailable) {
933 for (size_t i = 0; i < lineBreaker.positionedObjects().size(); ++i) 933 for (size_t i = 0; i < lineBreaker.positionedObjects().size(); ++i)
934 setStaticPositions(LineLayoutBlockFlow(this), LineLayoutBox(line Breaker.positionedObjects()[i]), false); 934 setStaticPositions(LineLayoutBlockFlow(this), LineLayoutBox(line Breaker.positionedObjects()[i]), DoNotIndentText);
935 935
936 if (!layoutState.lineInfo().isEmpty()) 936 if (!layoutState.lineInfo().isEmpty())
937 layoutState.lineInfo().setFirstLine(false); 937 layoutState.lineInfo().setFirstLine(false);
938 clearFloats(lineBreaker.clear()); 938 clearFloats(lineBreaker.clear());
939 939
940 if (m_floatingObjects && lastRootBox()) { 940 if (m_floatingObjects && lastRootBox()) {
941 InlineBidiResolver endOfLineResolver; 941 InlineBidiResolver endOfLineResolver;
942 endOfLineResolver.setPosition(endOfLine, numberOfIsolateAncestor s(endOfLine)); 942 endOfLineResolver.setPosition(endOfLine, numberOfIsolateAncestor s(endOfLine));
943 endOfLineResolver.setStatus(resolver.status()); 943 endOfLineResolver.setStatus(resolver.status());
944 appendFloatsToLastLine(layoutState, cleanLineStart, endOfLineRes olver, cleanLineBidiStatus); 944 appendFloatsToLastLine(layoutState, cleanLineStart, endOfLineRes olver, cleanLineBidiStatus);
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
1900 outlineBounds.inflate(o.styleRef().outlineOutsetExtent()); 1900 outlineBounds.inflate(o.styleRef().outlineOutsetExtent());
1901 outlineBoundsOfAllContinuations.unite(outlineBounds); 1901 outlineBoundsOfAllContinuations.unite(outlineBounds);
1902 } 1902 }
1903 } 1903 }
1904 addContentsVisualOverflow(outlineBoundsOfAllContinuations); 1904 addContentsVisualOverflow(outlineBoundsOfAllContinuations);
1905 } 1905 }
1906 1906
1907 void LayoutBlockFlow::deleteEllipsisLineBoxes() 1907 void LayoutBlockFlow::deleteEllipsisLineBoxes()
1908 { 1908 {
1909 ETextAlign textAlign = style()->textAlign(); 1909 ETextAlign textAlign = style()->textAlign();
1910 bool firstLine = true; 1910 IndentTextOrNot indentText = IndentText;
1911 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) { 1911 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
1912 if (curr->hasEllipsisBox()) { 1912 if (curr->hasEllipsisBox()) {
1913 curr->clearTruncation(); 1913 curr->clearTruncation();
1914 1914
1915 // Shift the line back where it belongs if we cannot accomodate an e llipsis. 1915 // Shift the line back where it belongs if we cannot accomodate an e llipsis.
1916 LayoutUnit logicalLeft = logicalLeftOffsetForLine(curr->lineTop(), f irstLine); 1916 LayoutUnit logicalLeft = logicalLeftOffsetForLine(curr->lineTop(), i ndentText);
1917 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(curr->l ineTop(), false) - logicalLeft; 1917 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(curr->l ineTop(), DoNotIndentText) - logicalLeft;
1918 LayoutUnit totalLogicalWidth = curr->logicalWidth(); 1918 LayoutUnit totalLogicalWidth = curr->logicalWidth();
1919 updateLogicalWidthForAlignment(textAlign, curr, 0, logicalLeft, tota lLogicalWidth, availableLogicalWidth, 0); 1919 updateLogicalWidthForAlignment(textAlign, curr, 0, logicalLeft, tota lLogicalWidth, availableLogicalWidth, 0);
1920 1920
1921 curr->moveInInlineDirection(logicalLeft - curr->logicalLeft()); 1921 curr->moveInInlineDirection(logicalLeft - curr->logicalLeft());
1922 } 1922 }
1923 firstLine = false; 1923 indentText = DoNotIndentText;
1924 } 1924 }
1925 } 1925 }
1926 1926
1927 void LayoutBlockFlow::checkLinesForTextOverflow() 1927 void LayoutBlockFlow::checkLinesForTextOverflow()
1928 { 1928 {
1929 // Determine the width of the ellipsis using the current font. 1929 // Determine the width of the ellipsis using the current font.
1930 const Font& font = style()->font(); 1930 const Font& font = style()->font();
1931 1931
1932 const size_t fullStopStringLength = 3; 1932 const size_t fullStopStringLength = 3;
1933 const UChar fullStopString[] = {fullstopCharacter, fullstopCharacter, fullst opCharacter}; 1933 const UChar fullStopString[] = {fullstopCharacter, fullstopCharacter, fullst opCharacter};
(...skipping 28 matching lines...) Expand all
1962 ellipsisWidth = font.width(constructTextRun(font, fullStopString, fu llStopStringLength, styleRef(), ellipsisDirection)); 1962 ellipsisWidth = font.width(constructTextRun(font, fullStopString, fu llStopStringLength, styleRef(), ellipsisDirection));
1963 } 1963 }
1964 } 1964 }
1965 1965
1966 // For LTR text truncation, we want to get the right edge of our padding box , and then we want to see 1966 // For LTR text truncation, we want to get the right edge of our padding box , and then we want to see
1967 // if the right edge of a line box exceeds that. For RTL, we use the left e dge of the padding box and 1967 // if the right edge of a line box exceeds that. For RTL, we use the left e dge of the padding box and
1968 // check the left edge of the line box to see if it is less 1968 // check the left edge of the line box to see if it is less
1969 // Include the scrollbar for overflow blocks, which means we want to use "co ntentWidth()" 1969 // Include the scrollbar for overflow blocks, which means we want to use "co ntentWidth()"
1970 bool ltr = style()->isLeftToRightDirection(); 1970 bool ltr = style()->isLeftToRightDirection();
1971 ETextAlign textAlign = style()->textAlign(); 1971 ETextAlign textAlign = style()->textAlign();
1972 bool firstLine = true; 1972 IndentTextOrNot indentText = IndentText;
1973 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) { 1973 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
1974 LayoutUnit currLogicalLeft = curr->logicalLeft(); 1974 LayoutUnit currLogicalLeft = curr->logicalLeft();
1975 LayoutUnit blockRightEdge = logicalRightOffsetForLine(curr->lineTop(), f irstLine); 1975 LayoutUnit blockRightEdge = logicalRightOffsetForLine(curr->lineTop(), i ndentText);
1976 LayoutUnit blockLeftEdge = logicalLeftOffsetForLine(curr->lineTop(), fir stLine); 1976 LayoutUnit blockLeftEdge = logicalLeftOffsetForLine(curr->lineTop(), ind entText);
1977 LayoutUnit lineBoxEdge = ltr ? currLogicalLeft + curr->logicalWidth() : currLogicalLeft; 1977 LayoutUnit lineBoxEdge = ltr ? currLogicalLeft + curr->logicalWidth() : currLogicalLeft;
1978 if ((ltr && lineBoxEdge > blockRightEdge) || (!ltr && lineBoxEdge < bloc kLeftEdge)) { 1978 if ((ltr && lineBoxEdge > blockRightEdge) || (!ltr && lineBoxEdge < bloc kLeftEdge)) {
1979 // This line spills out of our box in the appropriate direction. No w we need to see if the line 1979 // This line spills out of our box in the appropriate direction. No w we need to see if the line
1980 // can be truncated. In order for truncation to be possible, the li ne must have sufficient space to 1980 // can be truncated. In order for truncation to be possible, the li ne must have sufficient space to
1981 // accommodate our truncation string, and no replaced elements (imag es, tables) can overlap the ellipsis 1981 // accommodate our truncation string, and no replaced elements (imag es, tables) can overlap the ellipsis
1982 // space. 1982 // space.
1983 1983
1984 LayoutUnit width = firstLine ? firstLineEllipsisWidth : ellipsisWidt h; 1984 LayoutUnit width = indentText == IndentText ? firstLineEllipsisWidth : ellipsisWidth;
1985 LayoutUnit blockEdge = ltr ? blockRightEdge : blockLeftEdge; 1985 LayoutUnit blockEdge = ltr ? blockRightEdge : blockLeftEdge;
1986 if (curr->lineCanAccommodateEllipsis(ltr, blockEdge, lineBoxEdge, wi dth)) { 1986 if (curr->lineCanAccommodateEllipsis(ltr, blockEdge, lineBoxEdge, wi dth)) {
1987 LayoutUnit totalLogicalWidth = curr->placeEllipsis(selectedEllip sisStr, ltr, blockLeftEdge, blockRightEdge, width); 1987 LayoutUnit totalLogicalWidth = curr->placeEllipsis(selectedEllip sisStr, ltr, blockLeftEdge, blockRightEdge, width);
1988 LayoutUnit logicalLeft; // We are only interested in the delta f rom the base position. 1988 LayoutUnit logicalLeft; // We are only interested in the delta f rom the base position.
1989 LayoutUnit availableLogicalWidth = blockRightEdge - blockLeftEdg e; 1989 LayoutUnit availableLogicalWidth = blockRightEdge - blockLeftEdg e;
1990 updateLogicalWidthForAlignment(textAlign, curr, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0); 1990 updateLogicalWidthForAlignment(textAlign, curr, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0);
1991 if (ltr) 1991 if (ltr)
1992 curr->moveInInlineDirection(logicalLeft); 1992 curr->moveInInlineDirection(logicalLeft);
1993 else 1993 else
1994 curr->moveInInlineDirection(logicalLeft - (availableLogicalW idth - totalLogicalWidth)); 1994 curr->moveInInlineDirection(logicalLeft - (availableLogicalW idth - totalLogicalWidth));
1995 } 1995 }
1996 } 1996 }
1997 firstLine = false; 1997 indentText = DoNotIndentText;
1998 } 1998 }
1999 } 1999 }
2000 2000
2001 bool LayoutBlockFlow::positionNewFloatOnLine(FloatingObject& newFloat, FloatingO bject* lastFloatFromPreviousLine, LineInfo& lineInfo, LineWidth& width) 2001 bool LayoutBlockFlow::positionNewFloatOnLine(FloatingObject& newFloat, FloatingO bject* lastFloatFromPreviousLine, LineInfo& lineInfo, LineWidth& width)
2002 { 2002 {
2003 if (!positionNewFloats(&width)) 2003 if (!positionNewFloats(&width))
2004 return false; 2004 return false;
2005 2005
2006 // We only connect floats to lines for pagination purposes if the floats occ ur at the start of 2006 // We only connect floats to lines for pagination purposes if the floats occ ur at the start of
2007 // the line and the previous line had a hard break (so this line is either t he first in the block 2007 // the line and the previous line had a hard break (so this line is either t he first in the block
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2042 m_floatingObjects->addPlacedObject(floatingObject); 2042 m_floatingObjects->addPlacedObject(floatingObject);
2043 } 2043 }
2044 } 2044 }
2045 2045
2046 // Just update the line info's pagination strut without altering our logical height yet. If the line ends up containing 2046 // Just update the line info's pagination strut without altering our logical height yet. If the line ends up containing
2047 // no content, then we don't want to improperly grow the height of the block . 2047 // no content, then we don't want to improperly grow the height of the block .
2048 lineInfo.setFloatPaginationStrut(lineInfo.floatPaginationStrut() + paginatio nStrut); 2048 lineInfo.setFloatPaginationStrut(lineInfo.floatPaginationStrut() + paginatio nStrut);
2049 return true; 2049 return true;
2050 } 2050 }
2051 2051
2052 LayoutUnit LayoutBlockFlow::startAlignedOffsetForLine(LayoutUnit position, bool firstLine) 2052 LayoutUnit LayoutBlockFlow::startAlignedOffsetForLine(LayoutUnit position, Inden tTextOrNot indentText)
2053 { 2053 {
2054 ETextAlign textAlign = style()->textAlign(); 2054 ETextAlign textAlign = style()->textAlign();
2055 2055
2056 if (textAlign == TASTART) // FIXME: Handle TAEND here 2056 if (textAlign == TASTART) // FIXME: Handle TAEND here
2057 return startOffsetForLine(position, firstLine); 2057 return startOffsetForLine(position, indentText);
2058 2058
2059 // updateLogicalWidthForAlignment() handles the direction of the block so no need to consider it here 2059 // updateLogicalWidthForAlignment() handles the direction of the block so no need to consider it here
2060 LayoutUnit totalLogicalWidth; 2060 LayoutUnit totalLogicalWidth;
2061 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); 2061 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), DoNotInde ntText);
2062 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight() , false) - logicalLeft; 2062 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight() , DoNotIndentText) - logicalLeft;
2063 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 2063 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
2064 2064
2065 if (!style()->isLeftToRightDirection()) 2065 if (!style()->isLeftToRightDirection())
2066 return logicalWidth() - logicalLeft; 2066 return logicalWidth() - logicalLeft;
2067 return logicalLeft; 2067 return logicalLeft;
2068 } 2068 }
2069 2069
2070 void LayoutBlockFlow::invalidateDisplayItemClientsOfFirstLine() 2070 void LayoutBlockFlow::invalidateDisplayItemClientsOfFirstLine()
2071 { 2071 {
2072 ASSERT(childrenInline()); 2072 ASSERT(childrenInline());
(...skipping 10 matching lines...) Expand all
2083 if (!line || !line->isFirstLineStyle()) 2083 if (!line || !line->isFirstLineStyle())
2084 return reason; 2084 return reason;
2085 // It's the RootInlineBox that paints the ::first-line background. Note that since it may be 2085 // It's the RootInlineBox that paints the ::first-line background. Note that since it may be
2086 // expensive to figure out if the first line is affected by any ::first-line selectors at all, 2086 // expensive to figure out if the first line is affected by any ::first-line selectors at all,
2087 // we just invalidate it unconditionally, since that's typically cheaper. 2087 // we just invalidate it unconditionally, since that's typically cheaper.
2088 invalidateDisplayItemClient(*line); 2088 invalidateDisplayItemClient(*line);
2089 return reason; 2089 return reason;
2090 } 2090 }
2091 2091
2092 } 2092 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698