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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutText.h

Issue 2473863003: Fix BiDi directionality for surrogate pair characters (Closed)
Patch Set: eae review: add </td> and </tr> to tests Created 4 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
Index: third_party/WebKit/Source/core/layout/LayoutText.h
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.h b/third_party/WebKit/Source/core/layout/LayoutText.h
index cfa37465ad4ba29420de969b5b53d1fbddeb0aee..9df94450e42381ac11cec4c32ae478dc8994157e 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.h
+++ b/third_party/WebKit/Source/core/layout/LayoutText.h
@@ -325,12 +325,13 @@ inline UChar LayoutText::characterAt(unsigned i) const {
}
inline UChar32 LayoutText::codepointAt(unsigned i) const {
- UChar32 character = characterAt(i);
- if (!U16_IS_LEAD(character))
- return character;
- UChar trail = characterAt(i + 1);
- return U16_IS_TRAIL(trail) ? U16_GET_SUPPLEMENTARY(character, trail)
- : character;
+ if (i >= textLength())
+ return 0;
+ if (is8Bit())
+ return characters8()[i];
+ UChar32 c;
+ U16_GET(characters16(), 0, i, textLength(), c);
+ return c;
}
inline float LayoutText::hyphenWidth(const Font& font,

Powered by Google App Engine
This is Rietveld 408576698