Index: Source/core/platform/graphics/Font.cpp |
diff --git a/Source/core/platform/graphics/Font.cpp b/Source/core/platform/graphics/Font.cpp |
index 3ba67d93f3a28aaae6fdd7adb7ce6b4ed78e10a2..f08e1c078634a5c0b0f305c7871c955818e6c59e 100644 |
--- a/Source/core/platform/graphics/Font.cpp |
+++ b/Source/core/platform/graphics/Font.cpp |
@@ -601,30 +601,32 @@ bool Font::isCJKIdeographOrSymbol(UChar32 c) |
return isEndOfRange; |
} |
-unsigned Font::expansionOpportunityCount(const LChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion) |
+unsigned Font::expansionOpportunityCount(const LChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion, bool distributeJustification) |
{ |
unsigned count = 0; |
if (direction == LTR) { |
for (size_t i = 0; i < length; ++i) { |
- if (treatAsSpace(characters[i])) { |
+ if (treatAsSpace(characters[i]) || distributeJustification) |
count++; |
- isAfterExpansion = true; |
- } else |
- isAfterExpansion = false; |
} |
+ if (treatAsSpace(characters[length - 1])) |
+ isAfterExpansion = true; |
+ else |
+ isAfterExpansion = false; |
} else { |
for (size_t i = length; i > 0; --i) { |
- if (treatAsSpace(characters[i - 1])) { |
+ if (treatAsSpace(characters[i - 1]) || distributeJustification) |
count++; |
- isAfterExpansion = true; |
- } else |
- isAfterExpansion = false; |
} |
+ if (treatAsSpace(characters[0])) |
+ isAfterExpansion = true; |
+ else |
+ isAfterExpansion = false; |
} |
return count; |
} |
-unsigned Font::expansionOpportunityCount(const UChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion) |
+unsigned Font::expansionOpportunityCount(const UChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion, bool distributeJustification) |
{ |
static bool expandAroundIdeographs = canExpandAroundIdeographsInComplexText(); |
unsigned count = 0; |