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

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

Issue 54743004: Rendering text-justify:distribute for 8 bit characters. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use const parameter Created 6 years, 8 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
« no previous file with comments | « Source/platform/fonts/Character.h ('k') | Source/platform/fonts/WidthIterator.h » ('j') | 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 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) {
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;
« no previous file with comments | « Source/platform/fonts/Character.h ('k') | Source/platform/fonts/WidthIterator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698