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

Unified Diff: ui/gfx/render_text.cc

Issue 371413002: Don't split text runs on underline style change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoid applying style change in the middle of grapheme Created 6 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text.cc
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
index fe4c59cee9b3239dd18b982628203b55a885b9f6..e0da64d683c69c3b966b54340d8a809be46fdc04 100644
--- a/ui/gfx/render_text.cc
+++ b/ui/gfx/render_text.cc
@@ -651,7 +651,10 @@ void RenderText::SetStyle(TextStyle style, bool value) {
}
void RenderText::ApplyStyle(TextStyle style, bool value, const Range& range) {
- styles_[style].ApplyValue(value, range);
+ // Don't change style in the middle of grapheme to avoid breaking of ligature.
msw 2014/09/03 19:17:32 nit: "Do not change styles mid-grapheme to avoid b
+ const size_t corrected_end =
msw 2014/09/03 19:17:32 We should only correct the range bounds as needed:
+ IndexOfAdjacentGrapheme(range.end() - 1, CURSOR_FORWARD);
+ styles_[style].ApplyValue(value, Range(range.start(), corrected_end));
msw 2014/09/03 19:17:32 We should also correct the range start (using CURS
cached_bounds_and_offset_valid_ = false;
ResetLayout();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698