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

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

Issue 655073002: Fix trailing space handling for complex text (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
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 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 child->borderEnd(); 1160 child->borderEnd();
1161 } 1161 }
1162 return getBPMWidth(child->marginStart(), childStyle->marginStart()) + 1162 return getBPMWidth(child->marginStart(), childStyle->marginStart()) +
1163 getBPMWidth(child->paddingStart(), childStyle->paddingStart()) + 1163 getBPMWidth(child->paddingStart(), childStyle->paddingStart()) +
1164 child->borderStart(); 1164 child->borderStart();
1165 } 1165 }
1166 1166
1167 static inline void stripTrailingSpace(float& inlineMax, float& inlineMin, Render Object* trailingSpaceChild) 1167 static inline void stripTrailingSpace(float& inlineMax, float& inlineMin, Render Object* trailingSpaceChild)
1168 { 1168 {
1169 if (trailingSpaceChild && trailingSpaceChild->isText()) { 1169 if (trailingSpaceChild && trailingSpaceChild->isText()) {
1170 bool useComplexCodePath = !toRenderText(trailingSpaceChild)->
pdr. 2014/10/14 23:56:59 Can you move this below and use the (poorly-named)
1171 canUseSimpleFontCodePath();
chrishtr 2014/10/14 23:50:09 Nit: make this one line.
eae 2014/10/15 00:30:37 96 characters seems rather long for a single line,
1170 // Collapse away the trailing space at the end of a block. 1172 // Collapse away the trailing space at the end of a block.
1171 RenderText* t = toRenderText(trailingSpaceChild); 1173 RenderText* t = toRenderText(trailingSpaceChild);
1172 const UChar space = ' '; 1174 const UChar space = ' ';
1173 const Font& font = t->style()->font(); // FIXME: This ignores first-line . 1175 const Font& font = t->style()->font(); // FIXME: This ignores first-line .
1174 float spaceWidth = font.width(constructTextRun(t, font, &space, 1, t->st yle(), LTR)); 1176 TextRun run = constructTextRun(t, font, &space, 1, t->style(), LTR);
1177 if (useComplexCodePath)
pdr. 2014/10/14 23:21:20 Why doesn't constructTextRun handle setting whethe
1178 run.setUseComplexCodePath(true);
1179 float spaceWidth = font.width(run);
1175 inlineMax -= spaceWidth + font.fontDescription().wordSpacing(); 1180 inlineMax -= spaceWidth + font.fontDescription().wordSpacing();
1176 if (inlineMin > inlineMax) 1181 if (inlineMin > inlineMax)
1177 inlineMin = inlineMax; 1182 inlineMin = inlineMax;
1178 } 1183 }
1179 } 1184 }
1180 1185
1181 static inline void updatePreferredWidth(LayoutUnit& preferredWidth, float& resul t) 1186 static inline void updatePreferredWidth(LayoutUnit& preferredWidth, float& resul t)
1182 { 1187 {
1183 LayoutUnit snappedResult = LayoutUnit::fromFloatCeil(result); 1188 LayoutUnit snappedResult = LayoutUnit::fromFloatCeil(result);
1184 preferredWidth = std::max(snappedResult, preferredWidth); 1189 preferredWidth = std::max(snappedResult, preferredWidth);
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
2042 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat (); 2047 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat ();
2043 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft; 2048 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft;
2044 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 2049 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
2045 2050
2046 if (!style()->isLeftToRightDirection()) 2051 if (!style()->isLeftToRightDirection())
2047 return logicalWidth() - logicalLeft; 2052 return logicalWidth() - logicalLeft;
2048 return logicalLeft; 2053 return logicalLeft;
2049 } 2054 }
2050 2055
2051 } 2056 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698