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

Side by Side Diff: Source/core/rendering/RenderBlockLineLayout.cpp

Issue 22336008: Use the runtime flag and remove '-webkit-' prefix for CSS3 text-indent. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 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 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 * 20 *
21 */ 21 */
22 22
23 #include "config.h" 23 #include "config.h"
24 24
25 #include "RuntimeEnabledFeatures.h"
25 #include "core/platform/text/BidiResolver.h" 26 #include "core/platform/text/BidiResolver.h"
26 #include "core/rendering/InlineIterator.h" 27 #include "core/rendering/InlineIterator.h"
27 #include "core/rendering/InlineTextBox.h" 28 #include "core/rendering/InlineTextBox.h"
28 #include "core/rendering/RenderCombineText.h" 29 #include "core/rendering/RenderCombineText.h"
29 #include "core/rendering/RenderCounter.h" 30 #include "core/rendering/RenderCounter.h"
30 #include "core/rendering/RenderFlowThread.h" 31 #include "core/rendering/RenderFlowThread.h"
31 #include "core/rendering/RenderInline.h" 32 #include "core/rendering/RenderInline.h"
32 #include "core/rendering/RenderLayer.h" 33 #include "core/rendering/RenderLayer.h"
33 #include "core/rendering/RenderListMarker.h" 34 #include "core/rendering/RenderListMarker.h"
34 #include "core/rendering/RenderRegion.h" 35 #include "core/rendering/RenderRegion.h"
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 else 952 else
952 updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirectio n(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 953 updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirectio n(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);
953 break; 954 break;
954 } 955 }
955 } 956 }
956 957
957 static IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBrea k, RenderStyle* style) 958 static IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBrea k, RenderStyle* style)
958 { 959 {
959 if (isFirstLine) 960 if (isFirstLine)
960 return IndentText; 961 return IndentText;
961 #if ENABLE(CSS3_TEXT) 962 if (RuntimeEnabledFeatures::css3TextEnabled() && isAfterHardLineBreak && sty le->textIndentLine() == TextIndentEachLine)
Julien - ping for review 2013/08/21 01:50:08 This is unneeded. If CSS3 Text is not enabled, we
jaehun 2013/08/21 05:51:02 Done.
962 if (isAfterHardLineBreak && style->textIndentLine() == TextIndentEachLine)
963 return IndentText; 963 return IndentText;
964 #else 964
965 UNUSED_PARAM(isAfterHardLineBreak);
966 UNUSED_PARAM(style);
967 #endif
968 return DoNotIndentText; 965 return DoNotIndentText;
969 } 966 }
970 967
971 static void updateLogicalInlinePositions(RenderBlock* block, float& lineLogicalL eft, float& lineLogicalRight, float& availableLogicalWidth, bool firstLine, Inde ntTextOrNot shouldIndentText, LayoutUnit boxLogicalHeight) 968 static void updateLogicalInlinePositions(RenderBlock* block, float& lineLogicalL eft, float& lineLogicalRight, float& availableLogicalWidth, bool firstLine, Inde ntTextOrNot shouldIndentText, LayoutUnit boxLogicalHeight)
972 { 969 {
973 LayoutUnit lineLogicalHeight = logicalHeightForLine(block, firstLine, boxLog icalHeight); 970 LayoutUnit lineLogicalHeight = logicalHeightForLine(block, firstLine, boxLog icalHeight);
974 lineLogicalLeft = block->pixelSnappedLogicalLeftOffsetForLine(block->logical Height(), shouldIndentText == IndentText, lineLogicalHeight); 971 lineLogicalLeft = block->pixelSnappedLogicalLeftOffsetForLine(block->logical Height(), shouldIndentText == IndentText, lineLogicalHeight);
975 lineLogicalRight = block->pixelSnappedLogicalRightOffsetForLine(block->logic alHeight(), shouldIndentText == IndentText, lineLogicalHeight); 972 lineLogicalRight = block->pixelSnappedLogicalRightOffsetForLine(block->logic alHeight(), shouldIndentText == IndentText, lineLogicalHeight);
976 availableLogicalWidth = lineLogicalRight - lineLogicalLeft; 973 availableLogicalWidth = lineLogicalRight - lineLogicalLeft;
977 } 974 }
978 975
979 void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox, const LineInfo& lineInfo, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool re achedEnd, 976 void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox, const LineInfo& lineInfo, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool re achedEnd,
980 GlyphOverflowAndFallbac kFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMea surements& wordMeasurements) 977 GlyphOverflowAndFallbac kFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMea surements& wordMeasurements)
981 { 978 {
982 ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWit hBreak()); 979 ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWit hBreak());
983 980
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 981 // 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." 982 // 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, 983 // 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. 984 // but does not affect lines after a soft wrap break.
988 bool isFirstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent( )->firstChild() != this); 985 bool isFirstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent( )->firstChild() != this);
989 bool isAfterHardLineBreak = lineBox->prevRootBox() && lineBox->prevRootBox() ->endsWithBreak(); 986 bool isAfterHardLineBreak = lineBox->prevRootBox() && lineBox->prevRootBox() ->endsWithBreak();
990 IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLi neBreak, style()); 987 IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLi neBreak, style());
991 float lineLogicalLeft; 988 float lineLogicalLeft;
992 float lineLogicalRight; 989 float lineLogicalRight;
993 float availableLogicalWidth; 990 float availableLogicalWidth;
994 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availa bleLogicalWidth, isFirstLine, shouldIndentText, 0); 991 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availa bleLogicalWidth, isFirstLine, shouldIndentText, 0);
995 bool needsWordSpacing; 992 bool needsWordSpacing;
996 ShapeInsideInfo* shapeInsideInfo = layoutShapeInsideInfo(); 993 ShapeInsideInfo* shapeInsideInfo = layoutShapeInsideInfo();
(...skipping 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after
3479 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache); 3476 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache);
3480 3477
3481 setLineGridBox(lineGridBox); 3478 setLineGridBox(lineGridBox);
3482 3479
3483 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying 3480 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying
3484 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping 3481 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping
3485 // to this grid. 3482 // to this grid.
3486 } 3483 }
3487 3484
3488 } 3485 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698