OLD | NEW |
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 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 else | 951 else |
952 updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirectio
n(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); | 952 updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirectio
n(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); |
953 break; | 953 break; |
954 } | 954 } |
955 } | 955 } |
956 | 956 |
957 static IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBrea
k, RenderStyle* style) | 957 static IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBrea
k, RenderStyle* style) |
958 { | 958 { |
959 if (isFirstLine) | 959 if (isFirstLine) |
960 return IndentText; | 960 return IndentText; |
961 #if ENABLE(CSS3_TEXT) | |
962 if (isAfterHardLineBreak && style->textIndentLine() == TextIndentEachLine) | 961 if (isAfterHardLineBreak && style->textIndentLine() == TextIndentEachLine) |
963 return IndentText; | 962 return IndentText; |
964 #else | 963 |
965 UNUSED_PARAM(isAfterHardLineBreak); | |
966 UNUSED_PARAM(style); | |
967 #endif | |
968 return DoNotIndentText; | 964 return DoNotIndentText; |
969 } | 965 } |
970 | 966 |
971 static void updateLogicalInlinePositions(RenderBlock* block, float& lineLogicalL
eft, float& lineLogicalRight, float& availableLogicalWidth, bool firstLine, Inde
ntTextOrNot shouldIndentText, LayoutUnit boxLogicalHeight) | 967 static void updateLogicalInlinePositions(RenderBlock* block, float& lineLogicalL
eft, float& lineLogicalRight, float& availableLogicalWidth, bool firstLine, Inde
ntTextOrNot shouldIndentText, LayoutUnit boxLogicalHeight) |
972 { | 968 { |
973 LayoutUnit lineLogicalHeight = logicalHeightForLine(block, firstLine, boxLog
icalHeight); | 969 LayoutUnit lineLogicalHeight = logicalHeightForLine(block, firstLine, boxLog
icalHeight); |
974 lineLogicalLeft = block->pixelSnappedLogicalLeftOffsetForLine(block->logical
Height(), shouldIndentText == IndentText, lineLogicalHeight); | 970 lineLogicalLeft = block->pixelSnappedLogicalLeftOffsetForLine(block->logical
Height(), shouldIndentText == IndentText, lineLogicalHeight); |
975 lineLogicalRight = block->pixelSnappedLogicalRightOffsetForLine(block->logic
alHeight(), shouldIndentText == IndentText, lineLogicalHeight); | 971 lineLogicalRight = block->pixelSnappedLogicalRightOffsetForLine(block->logic
alHeight(), shouldIndentText == IndentText, lineLogicalHeight); |
976 availableLogicalWidth = lineLogicalRight - lineLogicalLeft; | 972 availableLogicalWidth = lineLogicalRight - lineLogicalLeft; |
977 } | 973 } |
978 | 974 |
979 void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox,
const LineInfo& lineInfo, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool re
achedEnd, | 975 void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox,
const LineInfo& lineInfo, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool re
achedEnd, |
980 GlyphOverflowAndFallbac
kFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMea
surements& wordMeasurements) | 976 GlyphOverflowAndFallbac
kFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMea
surements& wordMeasurements) |
981 { | 977 { |
982 ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWit
hBreak()); | 978 ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWit
hBreak()); |
983 | 979 |
984 // 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 | 980 // 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 |
985 // box is only affected if it is the first child of its parent element." | 981 // box is only affected if it is the first child of its parent element." |
986 // CSS3 "text-indent", "-webkit-each-line" affects the first line of the blo
ck container as well as each line after a forced line break, | 982 // CSS3 "text-indent", "each-line" affects the first line of the block conta
iner as well as each line after a forced line break, |
987 // but does not affect lines after a soft wrap break. | 983 // but does not affect lines after a soft wrap break. |
988 bool isFirstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent(
)->firstChild() != this); | 984 bool isFirstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent(
)->firstChild() != this); |
989 bool isAfterHardLineBreak = lineBox->prevRootBox() && lineBox->prevRootBox()
->endsWithBreak(); | 985 bool isAfterHardLineBreak = lineBox->prevRootBox() && lineBox->prevRootBox()
->endsWithBreak(); |
990 IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLi
neBreak, style()); | 986 IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLi
neBreak, style()); |
991 float lineLogicalLeft; | 987 float lineLogicalLeft; |
992 float lineLogicalRight; | 988 float lineLogicalRight; |
993 float availableLogicalWidth; | 989 float availableLogicalWidth; |
994 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availa
bleLogicalWidth, isFirstLine, shouldIndentText, 0); | 990 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availa
bleLogicalWidth, isFirstLine, shouldIndentText, 0); |
995 bool needsWordSpacing; | 991 bool needsWordSpacing; |
996 ShapeInsideInfo* shapeInsideInfo = layoutShapeInsideInfo(); | 992 ShapeInsideInfo* shapeInsideInfo = layoutShapeInsideInfo(); |
(...skipping 2484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3481 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); | 3477 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); |
3482 | 3478 |
3483 setLineGridBox(lineGridBox); | 3479 setLineGridBox(lineGridBox); |
3484 | 3480 |
3485 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying | 3481 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying |
3486 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping | 3482 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping |
3487 // to this grid. | 3483 // to this grid. |
3488 } | 3484 } |
3489 | 3485 |
3490 } | 3486 } |
OLD | NEW |