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

Side by Side Diff: ui/gfx/render_text_win.cc

Issue 19666006: Supports FontList in Textfield. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updates ui_unittests_disabled for Android. Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/render_text_win.h" 5 #include "ui/gfx/render_text_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/break_iterator.h" 9 #include "base/i18n/break_iterator.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 // Build the list of runs from the script items and ranged styles. Use an 568 // Build the list of runs from the script items and ranged styles. Use an
569 // empty color BreakList to avoid breaking runs at color boundaries. 569 // empty color BreakList to avoid breaking runs at color boundaries.
570 BreakList<SkColor> empty_colors; 570 BreakList<SkColor> empty_colors;
571 empty_colors.SetMax(text().length()); 571 empty_colors.SetMax(text().length());
572 internal::StyleIterator style(empty_colors, styles()); 572 internal::StyleIterator style(empty_colors, styles());
573 SCRIPT_ITEM* script_item = &script_items[0]; 573 SCRIPT_ITEM* script_item = &script_items[0];
574 const size_t max_run_length = kMaxGlyphs / 2; 574 const size_t max_run_length = kMaxGlyphs / 2;
575 for (size_t run_break = 0; run_break < layout_text_length;) { 575 for (size_t run_break = 0; run_break < layout_text_length;) {
576 internal::TextRun* run = new internal::TextRun(); 576 internal::TextRun* run = new internal::TextRun();
577 run->range.set_start(run_break); 577 run->range.set_start(run_break);
578 run->font = GetFont(); 578 run->font = GetPrimaryFont();
579 run->font_style = (style.style(BOLD) ? Font::BOLD : 0) | 579 run->font_style = (style.style(BOLD) ? Font::BOLD : 0) |
580 (style.style(ITALIC) ? Font::ITALIC : 0); 580 (style.style(ITALIC) ? Font::ITALIC : 0);
581 DeriveFontIfNecessary(run->font.GetFontSize(), run->font.GetHeight(), 581 DeriveFontIfNecessary(run->font.GetFontSize(), run->font.GetHeight(),
582 run->font_style, &run->font); 582 run->font_style, &run->font);
583 run->strike = style.style(STRIKE); 583 run->strike = style.style(STRIKE);
584 run->diagonal_strike = style.style(DIAGONAL_STRIKE); 584 run->diagonal_strike = style.style(DIAGONAL_STRIKE);
585 run->underline = style.style(UNDERLINE); 585 run->underline = style.style(UNDERLINE);
586 run->script_analysis = script_item->a; 586 run->script_analysis = script_item->a;
587 587
588 // Find the next break and advance the iterators as needed. 588 // Find the next break and advance the iterators as needed.
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 size_t position = LayoutIndexToTextIndex(run->range.end()); 889 size_t position = LayoutIndexToTextIndex(run->range.end());
890 position = IndexOfAdjacentGrapheme(position, CURSOR_BACKWARD); 890 position = IndexOfAdjacentGrapheme(position, CURSOR_BACKWARD);
891 return SelectionModel(position, CURSOR_FORWARD); 891 return SelectionModel(position, CURSOR_FORWARD);
892 } 892 }
893 893
894 RenderText* RenderText::CreateInstance() { 894 RenderText* RenderText::CreateInstance() {
895 return new RenderTextWin; 895 return new RenderTextWin;
896 } 896 }
897 897
898 } // namespace gfx 898 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698