Commit e23461b9 authored by Jan Krcal's avatar Jan Krcal Committed by Commit Bot

[LabelButton] Fix a glitch when shrinking down label

This CL fixes a glitch with spacing between image and label when the
button is shrinking down its label. Before this CL, the preferred size
jumped by this spacing _at the end_ of the animation when GetText()
becomes empty. This CL makes LabelButton disregard this spacing at the
beginning of the animation.

Bug: 1002160
Change-Id: I213d2ba50aefde01dba1b2615ef47b38f9e3b94c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1849388
Commit-Queue: Jan Krcal <jkrcal@chromium.org>
Auto-Submit: Jan Krcal <jkrcal@chromium.org>
Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704599}
parent 28e888ec
......@@ -530,7 +530,7 @@ gfx::Size LabelButton::GetUnclampedSizeWithoutLabel() const {
size.Enlarge(insets.width(), insets.height());
// Accommodate for spacing between image and text if both are present.
if (!GetText().empty() && image_size.width() > 0)
if (image_size.width() > 0 && !GetText().empty() && !shrinking_down_label_)
size.Enlarge(GetImageLabelSpacing(), 0);
// Make the size at least as large as the minimum size needed by the border.
......
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