Commit 6e217a49 authored by Ahmed Mehfooz's avatar Ahmed Mehfooz Committed by Commit Bot

Fix toolbar button highlights

Remove RTL handling in toolbar_ink_drop_util since it's taken care
of by inkdrops.
Fix inkdrop highlight flip to use GetLocalBounds instead of
GetContentsBounds.

Bug: 1001417
Change-Id: I93c3cbe9badd9fa0f22b833e1634392e43998ebe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1790407Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Commit-Queue: Robert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694490}
parent 401811c4
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "chrome/browser/ui/views/toolbar/toolbar_ink_drop_util.h" #include "chrome/browser/ui/views/toolbar/toolbar_ink_drop_util.h"
#include "base/i18n/rtl.h"
#include "chrome/browser/themes/theme_properties.h" #include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/layout_constants.h" #include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_layout_provider.h"
...@@ -27,19 +26,13 @@ constexpr float kToolbarInkDropHighlightVisibleOpacity = 0.08f; ...@@ -27,19 +26,13 @@ constexpr float kToolbarInkDropHighlightVisibleOpacity = 0.08f;
gfx::Insets GetToolbarInkDropInsets(const views::View* host_view, gfx::Insets GetToolbarInkDropInsets(const views::View* host_view,
const gfx::Insets& margin_insets) { const gfx::Insets& margin_insets) {
// TODO(pbos): Inkdrop masks and layers should be flipped with RTL. Fix this
// and remove RTL handling from here.
gfx::Insets inkdrop_insets =
base::i18n::IsRTL()
? gfx::Insets(margin_insets.top(), margin_insets.right(),
margin_insets.bottom(), margin_insets.left())
: margin_insets;
// Inset the inkdrop insets so that the end result matches the target inkdrop // Inset the inkdrop insets so that the end result matches the target inkdrop
// dimensions. // dimensions.
const gfx::Size host_size = host_view->size(); const gfx::Size host_size = host_view->size();
const int inkdrop_dimensions = GetLayoutConstant(LOCATION_BAR_HEIGHT); const int inkdrop_dimensions = GetLayoutConstant(LOCATION_BAR_HEIGHT);
inkdrop_insets += gfx::Insets((host_size.height() - inkdrop_dimensions) / 2); gfx::Insets inkdrop_insets =
margin_insets +
gfx::Insets((host_size.height() - inkdrop_dimensions) / 2);
return inkdrop_insets; return inkdrop_insets;
} }
......
...@@ -184,9 +184,9 @@ SkRRect FocusRing::RingRectFromPathRect(const SkRRect& rrect) const { ...@@ -184,9 +184,9 @@ SkRRect FocusRing::RingRectFromPathRect(const SkRRect& rrect) const {
SkPath GetHighlightPath(const View* view) { SkPath GetHighlightPath(const View* view) {
SkPath path = GetHighlightPathInternal(view); SkPath path = GetHighlightPathInternal(view);
if (view->flip_canvas_on_paint_for_rtl_ui()) { if (view->flip_canvas_on_paint_for_rtl_ui()) {
gfx::Point center = view->GetContentsBounds().CenterPoint(); gfx::Point center = view->GetLocalBounds().CenterPoint();
SkMatrix flip; SkMatrix flip;
flip.setRotate(180, center.x(), center.y()); flip.setScale(-1, 1, center.x(), center.y());
path.transform(flip); path.transform(flip);
} }
return path; return path;
......
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