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

Unified Diff: Source/platform/fonts/Character.cpp

Issue 777143002: Early return when the value of test-justify is distribute, and the length of line is 0 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: patch for landing Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/css3-text/css3-text-justify/text-justify-distribute.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/Character.cpp
diff --git a/Source/platform/fonts/Character.cpp b/Source/platform/fonts/Character.cpp
index e250cb370688e4524d1a9189662687ce364f3699..d2cb86cb1ec24580f4612b2b4bc6183347d8f684 100644
--- a/Source/platform/fonts/Character.cpp
+++ b/Source/platform/fonts/Character.cpp
@@ -343,22 +343,29 @@ unsigned Character::expansionOpportunityCount(const LChar* characters, size_t le
{
unsigned count = 0;
if (textJustify == TextJustifyDistribute) {
- count = length - 1;
- } else {
- if (direction == LTR) {
- for (size_t i = 0; i < length; ++i) {
- if (treatAsSpace(characters[i]))
- count++;
+ isAfterExpansion = true;
+ return length;
+ }
+
+ if (direction == LTR) {
+ for (size_t i = 0; i < length; ++i) {
+ if (treatAsSpace(characters[i])) {
+ count++;
+ isAfterExpansion = true;
+ } else {
+ isAfterExpansion = false;
}
- } else {
- for (size_t i = length; i > 0; --i) {
- if (treatAsSpace(characters[i - 1]))
- count++;
+ }
+ } else {
+ for (size_t i = length; i > 0; --i) {
+ if (treatAsSpace(characters[i - 1])) {
+ count++;
+ isAfterExpansion = true;
+ } else {
+ isAfterExpansion = false;
}
}
}
- int lastCharacter = (direction == LTR) ? length - 1 : 0;
- isAfterExpansion = treatAsSpace(characters[lastCharacter]);
return count;
}
« no previous file with comments | « LayoutTests/fast/css3-text/css3-text-justify/text-justify-distribute.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698