Commit 20df12c9 authored by Fabrice de Gans-Riberi's avatar Fabrice de Gans-Riberi Committed by Commit Bot

Revert "Fixed color bugs in CustomTabBarView"

This reverts commit a1342aa6.

Reason for revert: Broke MSAN bots:
https://ci.chromium.org/p/chromium/builders/ci/Linux%20MSan%20Tests/21649
https://ci.chromium.org/p/chromium/builders/ci/Linux%20ChromiumOS%20MSan%20Tests/17229

Stack trace from crash:
==29357==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x56541d07524c in views::Label::SetBackgroundColor(unsigned int) ./../../ui/views/controls/label.cc:141:7
    #1 0x5654292ce540 in IconLabelBubbleView::OnThemeChanged() ./../../chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc:308:12
    #2 0x565429331693 in LocationIconView::UpdateTextVisibility(bool) ./../../chrome/browser/ui/views/location_bar/location_icon_view.cc:195:3
    #3 0x56542932f4ff in LocationIconView::Update(bool) ./../../chrome/browser/ui/views/location_bar/location_icon_view.cc:214:3
    #4 0x56541d29bb17 in views::View::PropagateAddNotifications(views::ViewHierarchyChangedDetails const&, bool) ./../../ui/views/view.cc:2326:5
    #5 0x56541d29ba53 in views::View::PropagateAddNotifications(views::ViewHierarchyChangedDetails const&, bool) ./../../ui/views/view.cc:2322:14
    #6 0x56541d2972cf in views::View::AddChildViewAtImpl(views::View*, int) ./../../ui/views/view.cc:2218:9
[...]

Original change's description:
> Fixed color bugs in CustomTabBarView
> 
> Fixed CustomTabBarView to set and update its colors only once
> attached to a widget, preventing the fallback to the default
> NativeTheme.
> 
> Updated CustomTabBarView to respond to theme changes.
> 
> Removed the dependency on GetThemeProviderForProfile from
> CustomTabBarView and from LocationBarView.
> 
> Bug: None
> Change-Id: If505b0bede8f112329dcef5f2a7aab9e67dcfd2e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1989085
> Commit-Queue: Thomas Lukaszewicz <tluk@chromium.org>
> Reviewed-by: Peter Kasting <pkasting@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#729904}

TBR=pkasting@chromium.org,tluk@chromium.org

Change-Id: I768a90892980c5522075ed7cda38e2678b797552
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: None
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1994661Reviewed-by: default avatarFabrice de Gans-Riberi <fdegans@chromium.org>
Commit-Queue: Fabrice de Gans-Riberi <fdegans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#730020}
parent b343ca46
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "ui/base/models/simple_menu_model.h" #include "ui/base/models/simple_menu_model.h"
#include "ui/views/accessible_pane_view.h" #include "ui/views/accessible_pane_view.h"
#include "ui/views/context_menu_controller.h" #include "ui/views/context_menu_controller.h"
#include "ui/views/controls/button/button.h"
namespace gfx { namespace gfx {
class Rect; class Rect;
...@@ -21,7 +22,6 @@ class Rect; ...@@ -21,7 +22,6 @@ class Rect;
namespace views { namespace views {
class FlexLayout; class FlexLayout;
class MenuRunner; class MenuRunner;
class ImageButton;
} }
class CustomTabBarTitleOriginView; class CustomTabBarTitleOriginView;
...@@ -47,19 +47,20 @@ class CustomTabBarView : public views::AccessiblePaneView, ...@@ -47,19 +47,20 @@ class CustomTabBarView : public views::AccessiblePaneView,
LocationIconView* location_icon_view() { return location_icon_view_; } LocationIconView* location_icon_view() { return location_icon_view_; }
// views::AccessiblePaneView: // views::View:
gfx::Rect GetAnchorBoundsInScreen() const override; gfx::Rect GetAnchorBoundsInScreen() const override;
const char* GetClassName() const override; const char* GetClassName() const override;
gfx::Size CalculatePreferredSize() const override;
void OnPaintBackground(gfx::Canvas* canvas) override;
void ChildPreferredSizeChanged(views::View* child) override;
void OnThemeChanged() override;
// TabstripModelObserver: // TabstripModelObserver:
void TabChangedAt(content::WebContents* contents, void TabChangedAt(content::WebContents* contents,
int index, int index,
TabChangeType change_type) override; TabChangeType change_type) override;
// views::View:
gfx::Size CalculatePreferredSize() const override;
void OnPaintBackground(gfx::Canvas* canvas) override;
void ChildPreferredSizeChanged(views::View* child) override;
// IconLabelBubbleView::Delegate: // IconLabelBubbleView::Delegate:
SkColor GetIconLabelBubbleSurroundingForegroundColor() const override; SkColor GetIconLabelBubbleSurroundingForegroundColor() const override;
SkColor GetIconLabelBubbleBackgroundColor() const override; SkColor GetIconLabelBubbleBackgroundColor() const override;
...@@ -82,7 +83,7 @@ class CustomTabBarView : public views::AccessiblePaneView, ...@@ -82,7 +83,7 @@ class CustomTabBarView : public views::AccessiblePaneView,
// Methods for testing. // Methods for testing.
base::string16 title_for_testing() const { return last_title_; } base::string16 title_for_testing() const { return last_title_; }
base::string16 location_for_testing() const { return last_location_; } base::string16 location_for_testing() const { return last_location_; }
views::ImageButton* close_button_for_testing() const { return close_button_; } views::Button* close_button_for_testing() const { return close_button_; }
ui::SimpleMenuModel* context_menu_for_testing() const { ui::SimpleMenuModel* context_menu_for_testing() const {
return context_menu_model_.get(); return context_menu_model_.get();
} }
...@@ -112,7 +113,7 @@ class CustomTabBarView : public views::AccessiblePaneView, ...@@ -112,7 +113,7 @@ class CustomTabBarView : public views::AccessiblePaneView,
base::string16 last_title_; base::string16 last_title_;
base::string16 last_location_; base::string16 last_location_;
views::ImageButton* close_button_ = nullptr; views::Button* close_button_ = nullptr;
LocationBarView::Delegate* delegate_ = nullptr; LocationBarView::Delegate* delegate_ = nullptr;
LocationIconView* location_icon_view_ = nullptr; LocationIconView* location_icon_view_ = nullptr;
CustomTabBarTitleOriginView* title_origin_view_ = nullptr; CustomTabBarTitleOriginView* title_origin_view_ = nullptr;
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "content/public/test/test_navigation_observer.h" #include "content/public/test/test_navigation_observer.h"
#include "net/dns/mock_host_resolver.h" #include "net/dns/mock_host_resolver.h"
#include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/clipboard.h"
#include "ui/views/controls/button/image_button.h"
namespace { namespace {
......
...@@ -305,8 +305,8 @@ bool LocationBarView::IsInitialized() const { ...@@ -305,8 +305,8 @@ bool LocationBarView::IsInitialized() const {
} }
SkColor LocationBarView::GetColor(OmniboxPart part) const { SkColor LocationBarView::GetColor(OmniboxPart part) const {
DCHECK(GetWidget()); return GetOmniboxColor(&ThemeService::GetThemeProviderForProfile(profile_),
return GetOmniboxColor(GetThemeProvider(), part); part);
} }
SkColor LocationBarView::GetOpaqueBorderColor() const { SkColor LocationBarView::GetOpaqueBorderColor() const {
......
...@@ -36,6 +36,7 @@ LocationIconView::LocationIconView( ...@@ -36,6 +36,7 @@ LocationIconView::LocationIconView(
DCHECK(delegate_); DCHECK(delegate_);
SetID(VIEW_ID_LOCATION_ICON); SetID(VIEW_ID_LOCATION_ICON);
Update(true);
SetUpForAnimation(); SetUpForAnimation();
// Readability is guaranteed by the omnibox theme. // Readability is guaranteed by the omnibox theme.
...@@ -100,10 +101,6 @@ void LocationIconView::GetAccessibleNodeData(ui::AXNodeData* node_data) { ...@@ -100,10 +101,6 @@ void LocationIconView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
node_data->role = ax::mojom::Role::kPopUpButton; node_data->role = ax::mojom::Role::kPopUpButton;
} }
void LocationIconView::AddedToWidget() {
Update(true);
}
int LocationIconView::GetMinimumLabelTextWidth() const { int LocationIconView::GetMinimumLabelTextWidth() const {
int width = 0; int width = 0;
......
...@@ -72,7 +72,6 @@ class LocationIconView : public IconLabelBubbleView { ...@@ -72,7 +72,6 @@ class LocationIconView : public IconLabelBubbleView {
bool IsBubbleShowing() const override; bool IsBubbleShowing() const override;
bool OnMousePressed(const ui::MouseEvent& event) override; bool OnMousePressed(const ui::MouseEvent& event) override;
void GetAccessibleNodeData(ui::AXNodeData* node_data) override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
void AddedToWidget() override;
// Returns what the minimum width for the label text. // Returns what the minimum width for the label text.
int GetMinimumLabelTextWidth() const; int GetMinimumLabelTextWidth() const;
......
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