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

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: With test case 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-crash-expected.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 9ae36fc83ca78d1ffee41b510d576eb556914cdd..22d362c61207f78b0ec2ec2633fcaad32a7e7ee8 100644
--- a/Source/platform/fonts/Character.cpp
+++ b/Source/platform/fonts/Character.cpp
@@ -341,6 +341,11 @@ bool Character::isCJKIdeographOrSymbol(UChar32 c)
unsigned Character::expansionOpportunityCount(const LChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion, const TextJustify textJustify)
{
+ if (length == 0) {
+ isAfterExpansion = false;
kojii 2014/12/05 06:23:22 Why do we need to set |isAfterExpansion = false| h
dw.im 2014/12/05 07:16:42 Because the caller use this value after getting re
kojii 2014/12/05 13:11:21 The |isAfterExpansion| is in-out parameter, not ou
+ return 0;
+ }
+
unsigned count = 0;
if (textJustify == TextJustifyDistribute) {
count = length - 1;
@@ -357,7 +362,7 @@ unsigned Character::expansionOpportunityCount(const LChar* characters, size_t le
}
}
}
- int lastCharacter = (direction == LTR) ? length - 1 : 0;
+ size_t 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-crash-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698