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

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

Issue 654283002: Fix style issues in RenderBlockLineLayout::stripTrailingSpaces (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 child->borderEnd(); 1159 child->borderEnd();
1160 } 1160 }
1161 return getBPMWidth(child->marginStart(), childStyle->marginStart()) + 1161 return getBPMWidth(child->marginStart(), childStyle->marginStart()) +
1162 getBPMWidth(child->paddingStart(), childStyle->paddingStart()) + 1162 getBPMWidth(child->paddingStart(), childStyle->paddingStart()) +
1163 child->borderStart(); 1163 child->borderStart();
1164 } 1164 }
1165 1165
1166 static inline void stripTrailingSpace(float& inlineMax, float& inlineMin, Render Object* trailingSpaceChild) 1166 static inline void stripTrailingSpace(float& inlineMax, float& inlineMin, Render Object* trailingSpaceChild)
1167 { 1167 {
1168 if (trailingSpaceChild && trailingSpaceChild->isText()) { 1168 if (trailingSpaceChild && trailingSpaceChild->isText()) {
1169 bool useComplexCodePath = !toRenderText(trailingSpaceChild)->
1170 canUseSimpleFontCodePath();
1171 // Collapse away the trailing space at the end of a block. 1169 // Collapse away the trailing space at the end of a block.
1172 RenderText* t = toRenderText(trailingSpaceChild); 1170 RenderText* text = toRenderText(trailingSpaceChild);
1171 bool useComplexCodePath = !text->canUseSimpleFontCodePath();
1173 const UChar space = ' '; 1172 const UChar space = ' ';
1174 const Font& font = t->style()->font(); // FIXME: This ignores first-line . 1173 const Font& font = text->style()->font(); // FIXME: This ignores first-l ine.
1175 TextRun run = constructTextRun(t, font, &space, 1, t->style(), LTR); 1174 TextRun run = constructTextRun(text, font, &space, 1, text->style(), LTR );
1176 if (useComplexCodePath) 1175 if (useComplexCodePath)
1177 run.setUseComplexCodePath(true); 1176 run.setUseComplexCodePath(true);
1178 float spaceWidth = font.width(run); 1177 float spaceWidth = font.width(run);
1179 inlineMax -= spaceWidth + font.fontDescription().wordSpacing(); 1178 inlineMax -= spaceWidth + font.fontDescription().wordSpacing();
1180 if (inlineMin > inlineMax) 1179 if (inlineMin > inlineMax)
1181 inlineMin = inlineMax; 1180 inlineMin = inlineMax;
1182 } 1181 }
1183 } 1182 }
1184 1183
1185 static inline void updatePreferredWidth(LayoutUnit& preferredWidth, float& resul t) 1184 static inline void updatePreferredWidth(LayoutUnit& preferredWidth, float& resul t)
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
2046 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat (); 2045 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat ();
2047 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft; 2046 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft;
2048 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 2047 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
2049 2048
2050 if (!style()->isLeftToRightDirection()) 2049 if (!style()->isLeftToRightDirection())
2051 return logicalWidth() - logicalLeft; 2050 return logicalWidth() - logicalLeft;
2052 return logicalLeft; 2051 return logicalLeft;
2053 } 2052 }
2054 2053
2055 } 2054 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698