Commit 9ea05472 authored by Christopher Grant's avatar Christopher Grant Committed by Commit Bot

VR: Fix single-line text clipping on bottom edge

BUG=825203

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_vr;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I06bd09f0c0599756541ac0ce1077e7275fe41a64
Reviewed-on: https://chromium-review.googlesource.com/981295Reviewed-by: default avatarBiao She <bshe@chromium.org>
Commit-Queue: Christopher Grant <cjgrant@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546230}
parent eeed7dfe
......@@ -279,16 +279,16 @@ UiTexture* Text::GetTexture() const {
}
void TextTexture::LayOutText() {
gfx::FontList fonts;
int pixel_font_height = DmmToPixel(font_height_dmms_);
GetDefaultFontList(pixel_font_height, text_, &fonts);
gfx::Rect text_bounds;
if (text_layout_mode_ == kSingleLineFixedHeight) {
text_bounds.set_height(pixel_font_height);
} else {
if (text_layout_mode_ == kSingleLineFixedWidth ||
text_layout_mode_ == kMultiLineFixedWidth) {
text_bounds.set_width(DmmToPixel(text_width_));
}
gfx::FontList fonts;
GetDefaultFontList(pixel_font_height, text_, &fonts);
TextRenderParameters parameters;
parameters.color = color_;
parameters.text_alignment = alignment_;
......
......@@ -26,9 +26,9 @@ class RenderTextWrapper;
class TextTexture;
enum TextLayoutMode {
kSingleLineFixedWidth,
kSingleLineFixedHeight,
kMultiLineFixedWidth,
kSingleLine,
kSingleLineFixedWidth,
};
// This class describes a formatting attribute, applicable to a Text element.
......
......@@ -349,7 +349,7 @@ std::unique_ptr<UiElement> CreateSnackbar(
auto text = Create<Text>(kNone, kPhaseForeground, kSnackbarFontHeightDMM);
text->SetText(label);
text->SetLayoutMode(TextLayoutMode::kSingleLineFixedHeight);
text->SetLayoutMode(TextLayoutMode::kSingleLine);
VR_BIND_COLOR(model, text.get(), &ColorScheme::snackbar_foreground,
&Text::SetColor);
......@@ -370,7 +370,7 @@ std::unique_ptr<UiElement> CreateSnackbar(
auto button_text =
Create<Text>(kNone, kPhaseForeground, kSnackbarFontHeightDMM);
button_text->SetText(button_label);
button_text->SetLayoutMode(TextLayoutMode::kSingleLineFixedHeight);
button_text->SetLayoutMode(TextLayoutMode::kSingleLine);
button_text->AddBinding(
VR_BIND_FUNC(SkColor, Model, model,
model->color_scheme().snackbar_button_colors.foreground,
......@@ -489,7 +489,7 @@ std::unique_ptr<UiElement> CreateControllerLabel(UiElementName name,
label->SetColor(model->color_scheme().controller_label_callout);
label->SetVisible(true);
label->SetAlignment(UiTexture::kTextAlignmentRight);
label->SetLayoutMode(kSingleLineFixedHeight);
label->SetLayoutMode(kSingleLine);
label->SetRotate(1, 0, 0, -base::kPiFloat / 2);
label->SetShadowsEnabled(true);
label->SetScale(kControllerLabelScale, kControllerLabelScale,
......@@ -979,7 +979,7 @@ void UiSceneCreator::CreateSystemIndicators() {
auto text_element =
Create<Text>(kNone, kPhaseForeground, kWebVrPermissionFontHeight);
text_element->SetLayoutMode(kSingleLineFixedHeight);
text_element->SetLayoutMode(kSingleLine);
text_element->SetColor(SK_ColorWHITE);
text_element->set_owner_name_for_test(element->name());
text_element->SetSize(0.0f, kWebVrPermissionFontHeight);
......@@ -2144,7 +2144,7 @@ void UiSceneCreator::CreateOverflowMenu() {
Create<Text>(kNone, kPhaseForeground, kSuggestionContentTextHeightDMM);
text->SetDrawPhase(kPhaseForeground);
text->SetText(l10n_util::GetStringUTF16(std::get<1>(item)));
text->SetLayoutMode(TextLayoutMode::kSingleLineFixedHeight);
text->SetLayoutMode(TextLayoutMode::kSingleLine);
text->SetAlignment(UiTexture::kTextAlignmentLeft);
text->AddBinding(VR_BIND_FUNC(
SkColor, Model, model_, model->color_scheme().url_bar_button.foreground,
......@@ -2810,7 +2810,7 @@ void UiSceneCreator::CreateFullscreenToast() {
element->set_corner_radius(kExclusiveScreenToastCornerRadiusDMM);
element->AddText(l10n_util::GetStringUTF16(IDS_PRESS_APP_TO_EXIT_FULLSCREEN),
kExclusiveScreenToastTextFontHeightDMM,
TextLayoutMode::kSingleLineFixedHeight);
TextLayoutMode::kSingleLine);
VR_BIND_COLOR(model_, element.get(),
&ColorScheme::exclusive_screen_toast_background,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment