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

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

Issue 2767163003: Vertically center multi-line RenderTextHarfBuzz that uses SetMinLineHeight(). (Closed)
Patch Set: respond to comments Created 3 years, 8 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
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_harfbuzz.h" 5 #include "ui/gfx/render_text_harfbuzz.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <set> 8 #include <set>
9 9
10 #include "base/i18n/bidi_line_iterator.h" 10 #include "base/i18n/bidi_line_iterator.h"
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 } 1208 }
1209 1209
1210 if (lines().empty()) { 1210 if (lines().empty()) {
1211 // TODO(ckocagil): Remove ScopedTracker below once crbug.com/441028 is 1211 // TODO(ckocagil): Remove ScopedTracker below once crbug.com/441028 is
1212 // fixed. 1212 // fixed.
1213 std::unique_ptr<tracked_objects::ScopedTracker> tracking_profile( 1213 std::unique_ptr<tracked_objects::ScopedTracker> tracking_profile(
1214 new tracked_objects::ScopedTracker( 1214 new tracked_objects::ScopedTracker(
1215 FROM_HERE_WITH_EXPLICIT_FUNCTION("441028 HarfBuzzLineBreaker"))); 1215 FROM_HERE_WITH_EXPLICIT_FUNCTION("441028 HarfBuzzLineBreaker")));
1216 1216
1217 internal::TextRunList* run_list = GetRunList(); 1217 internal::TextRunList* run_list = GetRunList();
1218 const int height = std::max(font_list().GetHeight(), min_line_height());
1218 HarfBuzzLineBreaker line_breaker( 1219 HarfBuzzLineBreaker line_breaker(
1219 display_rect().width(), font_list().GetBaseline(), 1220 display_rect().width(),
1220 std::max(font_list().GetHeight(), min_line_height()), 1221 DetermineBaselineCenteringText(height, font_list()), height,
1221 word_wrap_behavior(), GetDisplayText(), 1222 word_wrap_behavior(), GetDisplayText(),
1222 multiline() ? &GetLineBreaks() : nullptr, *run_list); 1223 multiline() ? &GetLineBreaks() : nullptr, *run_list);
1223 1224
1224 tracking_profile.reset(); 1225 tracking_profile.reset();
1225 1226
1226 if (multiline()) 1227 if (multiline())
1227 line_breaker.ConstructMultiLines(); 1228 line_breaker.ConstructMultiLines();
1228 else 1229 else
1229 line_breaker.ConstructSingleLine(); 1230 line_breaker.ConstructSingleLine();
1230 std::vector<internal::Line> lines; 1231 std::vector<internal::Line> lines;
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 1704
1704 attribute.strike = run.strike; 1705 attribute.strike = run.strike;
1705 attribute.diagonal_strike = run.diagonal_strike; 1706 attribute.diagonal_strike = run.diagonal_strike;
1706 decorated_text->attributes.push_back(attribute); 1707 decorated_text->attributes.push_back(attribute);
1707 } 1708 }
1708 } 1709 }
1709 return true; 1710 return true;
1710 } 1711 }
1711 1712
1712 } // namespace gfx 1713 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698