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 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 else | 1003 else |
1004 updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirectio
n(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); | 1004 updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirectio
n(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); |
1005 break; | 1005 break; |
1006 } | 1006 } |
1007 } | 1007 } |
1008 | 1008 |
1009 static IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBrea
k, RenderStyle* style) | 1009 static IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBrea
k, RenderStyle* style) |
1010 { | 1010 { |
1011 if (isFirstLine) | 1011 if (isFirstLine) |
1012 return IndentText; | 1012 return IndentText; |
1013 #if ENABLE(CSS3_TEXT) | |
1014 if (isAfterHardLineBreak && style->textIndentLine() == TextIndentEachLine) | 1013 if (isAfterHardLineBreak && style->textIndentLine() == TextIndentEachLine) |
1015 return IndentText; | 1014 return IndentText; |
1016 #else | 1015 |
1017 UNUSED_PARAM(isAfterHardLineBreak); | |
1018 UNUSED_PARAM(style); | |
1019 #endif | |
1020 return DoNotIndentText; | 1016 return DoNotIndentText; |
1021 } | 1017 } |
1022 | 1018 |
1023 static void updateLogicalInlinePositions(RenderBlock* block, float& lineLogicalL
eft, float& lineLogicalRight, float& availableLogicalWidth, bool firstLine, Inde
ntTextOrNot shouldIndentText, LayoutUnit boxLogicalHeight) | 1019 static void updateLogicalInlinePositions(RenderBlock* block, float& lineLogicalL
eft, float& lineLogicalRight, float& availableLogicalWidth, bool firstLine, Inde
ntTextOrNot shouldIndentText, LayoutUnit boxLogicalHeight) |
1024 { | 1020 { |
1025 LayoutUnit lineLogicalHeight = logicalHeightForLine(block, firstLine, boxLog
icalHeight); | 1021 LayoutUnit lineLogicalHeight = logicalHeightForLine(block, firstLine, boxLog
icalHeight); |
1026 lineLogicalLeft = block->pixelSnappedLogicalLeftOffsetForLine(block->logical
Height(), shouldIndentText == IndentText, lineLogicalHeight); | 1022 lineLogicalLeft = block->pixelSnappedLogicalLeftOffsetForLine(block->logical
Height(), shouldIndentText == IndentText, lineLogicalHeight); |
1027 lineLogicalRight = block->pixelSnappedLogicalRightOffsetForLine(block->logic
alHeight(), shouldIndentText == IndentText, lineLogicalHeight); | 1023 lineLogicalRight = block->pixelSnappedLogicalRightOffsetForLine(block->logic
alHeight(), shouldIndentText == IndentText, lineLogicalHeight); |
1028 availableLogicalWidth = lineLogicalRight - lineLogicalLeft; | 1024 availableLogicalWidth = lineLogicalRight - lineLogicalLeft; |
1029 } | 1025 } |
1030 | 1026 |
1031 void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox,
const LineInfo& lineInfo, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool re
achedEnd, | 1027 void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox,
const LineInfo& lineInfo, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool re
achedEnd, |
1032 GlyphOverflowAndFallbac
kFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMea
surements& wordMeasurements) | 1028 GlyphOverflowAndFallbac
kFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMea
surements& wordMeasurements) |
1033 { | 1029 { |
1034 ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWit
hBreak()); | 1030 ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWit
hBreak()); |
1035 | 1031 |
1036 // 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 | 1032 // 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 |
1037 // box is only affected if it is the first child of its parent element." | 1033 // box is only affected if it is the first child of its parent element." |
1038 // 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, | 1034 // CSS3 "text-indent", "each-line" affects the first line of the block conta
iner as well as each line after a forced line break, |
1039 // but does not affect lines after a soft wrap break. | 1035 // but does not affect lines after a soft wrap break. |
1040 bool isFirstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent(
)->firstChild() != this); | 1036 bool isFirstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent(
)->firstChild() != this); |
1041 bool isAfterHardLineBreak = lineBox->prevRootBox() && lineBox->prevRootBox()
->endsWithBreak(); | 1037 bool isAfterHardLineBreak = lineBox->prevRootBox() && lineBox->prevRootBox()
->endsWithBreak(); |
1042 IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLi
neBreak, style()); | 1038 IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLi
neBreak, style()); |
1043 float lineLogicalLeft; | 1039 float lineLogicalLeft; |
1044 float lineLogicalRight; | 1040 float lineLogicalRight; |
1045 float availableLogicalWidth; | 1041 float availableLogicalWidth; |
1046 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availa
bleLogicalWidth, isFirstLine, shouldIndentText, 0); | 1042 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availa
bleLogicalWidth, isFirstLine, shouldIndentText, 0); |
1047 bool needsWordSpacing; | 1043 bool needsWordSpacing; |
1048 ShapeInsideInfo* shapeInsideInfo = layoutShapeInsideInfo(); | 1044 ShapeInsideInfo* shapeInsideInfo = layoutShapeInsideInfo(); |
(...skipping 2484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3533 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); | 3529 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); |
3534 | 3530 |
3535 setLineGridBox(lineGridBox); | 3531 setLineGridBox(lineGridBox); |
3536 | 3532 |
3537 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying | 3533 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying |
3538 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping | 3534 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping |
3539 // to this grid. | 3535 // to this grid. |
3540 } | 3536 } |
3541 | 3537 |
3542 } | 3538 } |
OLD | NEW |