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

Unified Diff: third_party/WebKit/Source/platform/fonts/Character.h

Issue 1825023002: Fix integer truncation in Character test functions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test for isNormalizedCanvasSpaceCharacter Created 4 years, 9 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 | « no previous file | third_party/WebKit/Source/platform/fonts/CharacterTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/fonts/Character.h
diff --git a/third_party/WebKit/Source/platform/fonts/Character.h b/third_party/WebKit/Source/platform/fonts/Character.h
index 3073f5f356d0b2fb16223f569300a77fc90d361f..0a45145b1dede8a4c6069401e58e8c51362fe6ec 100644
--- a/third_party/WebKit/Source/platform/fonts/Character.h
+++ b/third_party/WebKit/Source/platform/fonts/Character.h
@@ -75,20 +75,20 @@ public:
static bool isUprightInMixedVertical(UChar32 character);
- static bool treatAsSpace(UChar c)
+ static bool treatAsSpace(UChar32 c)
{
return c == spaceCharacter
|| c == tabulationCharacter
|| c == newlineCharacter
|| c == noBreakSpaceCharacter;
}
- static bool treatAsZeroWidthSpace(UChar c)
+ static bool treatAsZeroWidthSpace(UChar32 c)
{
return treatAsZeroWidthSpaceInComplexScript(c)
|| c == zeroWidthNonJoinerCharacter
|| c == zeroWidthJoinerCharacter;
}
- static bool treatAsZeroWidthSpaceInComplexScript(UChar c)
+ static bool treatAsZeroWidthSpaceInComplexScript(UChar32 c)
{
return c < 0x20 // ASCII Control Characters
|| (c >= 0x7F && c < 0xA0) // ASCII Delete .. No-break spaceCharacter
@@ -119,6 +119,7 @@ public:
static inline UChar normalizeSpaces(UChar character)
{
+
if (treatAsSpace(character))
return spaceCharacter;
@@ -128,7 +129,7 @@ public:
return character;
}
- static inline bool isNormalizedCanvasSpaceCharacter(UChar c)
+ static inline bool isNormalizedCanvasSpaceCharacter(UChar32 c)
{
// According to specification all space characters should be replaced with 0x0020 space character.
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#text-preparation-algorithm
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/fonts/CharacterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698