| Index: chrome/browser/android/vr_shell/ui_elements/textured_element.cc
|
| diff --git a/chrome/browser/android/vr_shell/ui_elements/textured_element.cc b/chrome/browser/android/vr_shell/ui_elements/textured_element.cc
|
| index b4a065a5e9529e9a3db75a6cc6dd4ca6322e3812..e0a7a168f9546b1038c3694e415be72bc2e78a3c 100644
|
| --- a/chrome/browser/android/vr_shell/ui_elements/textured_element.cc
|
| +++ b/chrome/browser/android/vr_shell/ui_elements/textured_element.cc
|
| @@ -26,9 +26,6 @@ void TexturedElement::Initialize() {
|
| initialized_ = true;
|
| UpdateTexture();
|
| set_fill(Fill::SELF);
|
| - gfx::SizeF drawn_size = GetTexture()->GetDrawnSize();
|
| - float y = drawn_size.height() / drawn_size.width() * size().x();
|
| - set_size({size().x(), y, 1});
|
| }
|
|
|
| void TexturedElement::UpdateTexture() {
|
| @@ -38,6 +35,15 @@ void TexturedElement::UpdateTexture() {
|
| texture_size_.width(), texture_size_.height());
|
| GetTexture()->DrawAndLayout(surface->getCanvas(), texture_size_);
|
| Flush(surface.get());
|
| + // Update the element size's aspect ratio to match the texture.
|
| + UpdateElementSize();
|
| +}
|
| +
|
| +void TexturedElement::UpdateElementSize() {
|
| + // Updating the height according to width is a hack. This may be overridden.
|
| + gfx::SizeF drawn_size = GetTexture()->GetDrawnSize();
|
| + float y = drawn_size.height() / drawn_size.width() * size().x();
|
| + set_size({size().x(), y, 1});
|
| }
|
|
|
| void TexturedElement::Render(UiElementRenderer* renderer,
|
|
|