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

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: patch for landing 2 Created 6 years, 1 month 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/shaping/SimpleShaper.cpp » ('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 b8a49745ba0a4d112999e911c8f91b9aa221879b..eefc781aa25d7c14264bba761bf7d4a9a41c39b6 100644
--- a/Source/platform/fonts/Character.cpp
+++ b/Source/platform/fonts/Character.cpp
@@ -260,32 +260,31 @@ 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 TextJustify textJustify)
{
unsigned count = 0;
- if (direction == LTR) {
- for (size_t i = 0; i < length; ++i) {
- if (treatAsSpace(characters[i])) {
- count++;
- isAfterExpansion = true;
- } else {
- isAfterExpansion = false;
- }
- }
+ if (textJustify == TextJustifyDistribute) {
+ count = length - 1;
} else {
- for (size_t i = length; i > 0; --i) {
- if (treatAsSpace(characters[i - 1])) {
- count++;
- isAfterExpansion = true;
- } else {
- isAfterExpansion = false;
+ if (direction == LTR) {
+ for (size_t i = 0; i < length; ++i) {
+ if (treatAsSpace(characters[i]))
+ count++;
+ }
+ } else {
+ for (size_t i = length; i > 0; --i) {
+ if (treatAsSpace(characters[i - 1]))
+ count++;
}
}
}
+ int lastCharacter = (direction == LTR) ? length - 1 : 0;
+ isAfterExpansion = treatAsSpace(characters[lastCharacter]);
+
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 TextJustify textJustify)
{
unsigned count = 0;
if (direction == LTR) {
« no previous file with comments | « Source/platform/fonts/Character.h ('k') | Source/platform/fonts/shaping/SimpleShaper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698