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

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

Issue 255323004: Rendering text-justify:distribute for 8 bit characters. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: New patchset (with 'const') Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/platform/fonts/Character.cpp
diff --git a/Source/platform/fonts/Character.cpp b/Source/platform/fonts/Character.cpp
index 40ccd3ee22fecd4196832e4db6ffed5b7cd1903f..8848ba04d59d3716704a3f65c5cbbabe0dee3f1a 100644
--- a/Source/platform/fonts/Character.cpp
+++ b/Source/platform/fonts/Character.cpp
@@ -272,32 +272,32 @@ bool Character::isCJKIdeographOrSymbol(UChar32 c)
return valueInIntervalList(cjkSymbolRanges, c);
}
-unsigned Character::expansionOpportunityCount(const LChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion)
+unsigned Character::expansionOpportunityCount(const LChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion, const bool distributeJustification)
{
unsigned count = 0;
if (direction == LTR) {
leviw_travelin_and_unemployed 2014/07/28 23:59:58 This codepath can be simplified now. We only need
dw.im 2014/07/29 01:54:54 If the value of text-justify is distribute, then,
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 Character::expansionOpportunityCount(const UChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion)
+unsigned Character::expansionOpportunityCount(const UChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion, const bool distributeJustification)
{
static bool expandAroundIdeographs = FontPlatformFeatures::canExpandAroundIdeographsInComplexText();
unsigned count = 0;

Powered by Google App Engine
This is Rietveld 408576698