Commit f6fc7ec4 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

Remove WTF_USE_DEFAULT_RENDER_THEME

This was used only to guard calls to the static method
LayoutThemeDefault::SetSelectionColors. This static methods should
have been virtual on blink::LayoutTheme to begin with. It also
shouldn't be routed through blink::WebView (rather, it should be
called directly, like the adjacent blink::SetFocusRingColor).

Note that after changing selection colors, we call both
blink::WebWidget::ThemeChanged and blink::Page::PlatformColorsChanged.
I don't know the distinction between the two.

Bug: 961342
Change-Id: I3edd3d41d6ad6de1fc3331bb03308f2dc7c6a683
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1606185
Commit-Queue: ccameron <ccameron@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Reviewed-by: default avatarccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659136}
parent fe518cba
...@@ -1972,14 +1972,12 @@ void RenderViewImpl::OnSetRendererPrefs( ...@@ -1972,14 +1972,12 @@ void RenderViewImpl::OnSetRendererPrefs(
#if BUILDFLAG(USE_DEFAULT_RENDER_THEME) #if BUILDFLAG(USE_DEFAULT_RENDER_THEME)
if (renderer_prefs.use_custom_colors) { if (renderer_prefs.use_custom_colors) {
blink::SetFocusRingColor(renderer_prefs.focus_ring_color); blink::SetFocusRingColor(renderer_prefs.focus_ring_color);
blink::SetSelectionColors(renderer_prefs.active_selection_bg_color,
if (webview()) { renderer_prefs.active_selection_fg_color,
webview()->SetSelectionColors(renderer_prefs.active_selection_bg_color, renderer_prefs.inactive_selection_bg_color,
renderer_prefs.active_selection_fg_color, renderer_prefs.inactive_selection_fg_color);
renderer_prefs.inactive_selection_bg_color, if (webview())
renderer_prefs.inactive_selection_fg_color);
webview()->MainFrameWidget()->ThemeChanged(); webview()->MainFrameWidget()->ThemeChanged();
}
} }
#endif // BUILDFLAG(USE_DEFAULT_RENDER_THEME) #endif // BUILDFLAG(USE_DEFAULT_RENDER_THEME)
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "third_party/blink/public/web/web_frame_widget.h" #include "third_party/blink/public/web/web_frame_widget.h"
#include "third_party/blink/public/web/web_input_element.h" #include "third_party/blink/public/web/web_input_element.h"
#include "third_party/blink/public/web/web_local_frame.h" #include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_render_theme.h"
#include "third_party/blink/public/web/web_script_source.h" #include "third_party/blink/public/web/web_script_source.h"
#include "third_party/blink/public/web/web_security_policy.h" #include "third_party/blink/public/web/web_security_policy.h"
#include "third_party/blink/public/web/web_serialized_script_value.h" #include "third_party/blink/public/web/web_serialized_script_value.h"
...@@ -90,8 +91,7 @@ void TestRunnerForSpecificView::Reset() { ...@@ -90,8 +91,7 @@ void TestRunnerForSpecificView::Reset() {
#if !defined(OS_MACOSX) && !defined(OS_WIN) #if !defined(OS_MACOSX) && !defined(OS_WIN)
// (Constants copied because we can't depend on the header that defined // (Constants copied because we can't depend on the header that defined
// them from this file.) // them from this file.)
web_view()->SetSelectionColors(0xff1e90ff, 0xff000000, 0xffc8c8c8, blink::SetSelectionColors(0xff1e90ff, 0xff000000, 0xffc8c8c8, 0xff323232);
0xff323232);
#endif #endif
if (web_view()->MainFrame()->IsWebLocalFrame()) { if (web_view()->MainFrame()->IsWebLocalFrame()) {
web_view()->MainFrame()->ToWebLocalFrame()->EnableViewSourceMode(false); web_view()->MainFrame()->ToWebLocalFrame()->EnableViewSourceMode(false);
...@@ -483,8 +483,7 @@ bool TestRunnerForSpecificView::HasCustomPageSizeStyle(int page_index) { ...@@ -483,8 +483,7 @@ bool TestRunnerForSpecificView::HasCustomPageSizeStyle(int page_index) {
} }
void TestRunnerForSpecificView::ForceRedSelectionColors() { void TestRunnerForSpecificView::ForceRedSelectionColors() {
web_view()->SetSelectionColors(0xffee0000, 0xff00ee00, 0xff000000, blink::SetSelectionColors(0xffee0000, 0xff00ee00, 0xff000000, 0xffc0c0c0);
0xffc0c0c0);
} }
void TestRunnerForSpecificView::SetPageVisibility( void TestRunnerForSpecificView::SetPageVisibility(
......
...@@ -42,6 +42,11 @@ BLINK_EXPORT void SetCaretBlinkInterval(base::TimeDelta); ...@@ -42,6 +42,11 @@ BLINK_EXPORT void SetCaretBlinkInterval(base::TimeDelta);
BLINK_EXPORT void SetFocusRingColor(SkColor); BLINK_EXPORT void SetFocusRingColor(SkColor);
BLINK_EXPORT void SetSelectionColors(unsigned active_background_color,
unsigned active_foreground_color,
unsigned inactive_background_color,
unsigned inactive_foreground_color);
} // namespace blink } // namespace blink
#endif #endif
...@@ -385,11 +385,6 @@ class WebView { ...@@ -385,11 +385,6 @@ class WebView {
// Custom colors ------------------------------------------------------- // Custom colors -------------------------------------------------------
virtual void SetSelectionColors(unsigned active_background_color,
unsigned active_foreground_color,
unsigned inactive_background_color,
unsigned inactive_foreground_color) = 0;
// Sets the default background color when the page has not loaded enough to // Sets the default background color when the page has not loaded enough to
// know a background colour. This can be overridden by the methods below as // know a background colour. This can be overridden by the methods below as
// well. // well.
......
...@@ -74,13 +74,6 @@ if (use_webaudio_pffft) { ...@@ -74,13 +74,6 @@ if (use_webaudio_pffft) {
feature_defines_list += [ "WTF_USE_WEBAUDIO_PFFFT=1" ] feature_defines_list += [ "WTF_USE_WEBAUDIO_PFFFT=1" ]
} }
if (use_default_render_theme) {
# Mirrors the USE_DEFAULT_RENDER_THEME buildflag_header in WebKit/public.
# If/when Blink can use buildflag headers, this should be removed in
# preference to that.
feature_defines_list += [ "WTF_USE_DEFAULT_RENDER_THEME=1" ]
}
if (blink_symbol_level == 0 && is_win && symbol_level != 0) { if (blink_symbol_level == 0 && is_win && symbol_level != 0) {
# If we use no_symbols on Windows when symbol_level is not zero then no # If we use no_symbols on Windows when symbol_level is not zero then no
# PDB will be generated but ninja will be expecting one. This would mean # PDB will be generated but ninja will be expecting one. This would mean
......
...@@ -44,4 +44,13 @@ void SetFocusRingColor(SkColor color) { ...@@ -44,4 +44,13 @@ void SetFocusRingColor(SkColor color) {
LayoutTheme::GetTheme().SetCustomFocusRingColor(color); LayoutTheme::GetTheme().SetCustomFocusRingColor(color);
} }
void SetSelectionColors(unsigned active_background_color,
unsigned active_foreground_color,
unsigned inactive_background_color,
unsigned inactive_foreground_color) {
LayoutTheme::GetTheme().SetSelectionColors(
active_background_color, active_foreground_color,
inactive_background_color, inactive_foreground_color);
}
} // namespace blink } // namespace blink
...@@ -165,10 +165,6 @@ ...@@ -165,10 +165,6 @@
#include "third_party/blink/renderer/platform/wtf/time.h" #include "third_party/blink/renderer/platform/wtf/time.h"
#include "ui/gfx/skia_util.h" #include "ui/gfx/skia_util.h"
#if defined(WTF_USE_DEFAULT_RENDER_THEME)
#include "third_party/blink/renderer/core/layout/layout_theme_default.h"
#endif
// Get rid of WTF's pow define so we can use std::pow. // Get rid of WTF's pow define so we can use std::pow.
#undef pow #undef pow
#include <cmath> // for std::pow #include <cmath> // for std::pow
...@@ -3016,18 +3012,6 @@ void WebViewImpl::SetOpenedByDOM() { ...@@ -3016,18 +3012,6 @@ void WebViewImpl::SetOpenedByDOM() {
AsView().page->SetOpenedByDOM(); AsView().page->SetOpenedByDOM();
} }
void WebViewImpl::SetSelectionColors(unsigned active_background_color,
unsigned active_foreground_color,
unsigned inactive_background_color,
unsigned inactive_foreground_color) {
#if defined(WTF_USE_DEFAULT_RENDER_THEME)
LayoutThemeDefault::SetSelectionColors(
active_background_color, active_foreground_color,
inactive_background_color, inactive_foreground_color);
LayoutTheme::GetTheme().PlatformColorsDidChange();
#endif
}
void WebViewImpl::DidCommitLoad(bool is_new_navigation, void WebViewImpl::DidCommitLoad(bool is_new_navigation,
bool is_navigation_within_page) { bool is_navigation_within_page) {
if (!is_navigation_within_page) { if (!is_navigation_within_page) {
......
...@@ -181,10 +181,6 @@ class CORE_EXPORT WebViewImpl final : public WebView, ...@@ -181,10 +181,6 @@ class CORE_EXPORT WebViewImpl final : public WebView,
uint64_t CreateUniqueIdentifierForRequest() override; uint64_t CreateUniqueIdentifierForRequest() override;
void EnableDeviceEmulation(const WebDeviceEmulationParams&) override; void EnableDeviceEmulation(const WebDeviceEmulationParams&) override;
void DisableDeviceEmulation() override; void DisableDeviceEmulation() override;
void SetSelectionColors(unsigned active_background_color,
unsigned active_foreground_color,
unsigned inactive_background_color,
unsigned inactive_foreground_color) override;
void PerformCustomContextMenuAction(unsigned action) override; void PerformCustomContextMenuAction(unsigned action) override;
void DidCloseContextMenu() override; void DidCloseContextMenu() override;
void CancelPagePopup() override; void CancelPagePopup() override;
......
...@@ -142,6 +142,10 @@ class CORE_EXPORT LayoutTheme : public RefCounted<LayoutTheme> { ...@@ -142,6 +142,10 @@ class CORE_EXPORT LayoutTheme : public RefCounted<LayoutTheme> {
Color InactiveSelectionBackgroundColor() const; Color InactiveSelectionBackgroundColor() const;
Color ActiveSelectionForegroundColor() const; Color ActiveSelectionForegroundColor() const;
Color InactiveSelectionForegroundColor() const; Color InactiveSelectionForegroundColor() const;
virtual void SetSelectionColors(unsigned active_background_color,
unsigned active_foreground_color,
unsigned inactive_background_color,
unsigned inactive_foreground_color) {}
// List box selection colors // List box selection colors
Color ActiveListBoxSelectionBackgroundColor() const; Color ActiveListBoxSelectionBackgroundColor() const;
......
...@@ -187,6 +187,7 @@ void LayoutThemeDefault::SetSelectionColors( ...@@ -187,6 +187,7 @@ void LayoutThemeDefault::SetSelectionColors(
active_selection_foreground_color_ = active_foreground_color; active_selection_foreground_color_ = active_foreground_color;
inactive_selection_background_color_ = inactive_background_color; inactive_selection_background_color_ = inactive_background_color;
inactive_selection_foreground_color_ = inactive_foreground_color; inactive_selection_foreground_color_ = inactive_foreground_color;
PlatformColorsDidChange();
} }
void LayoutThemeDefault::SetCheckboxSize(ComputedStyle& style) const { void LayoutThemeDefault::SetCheckboxSize(ComputedStyle& style) const {
......
...@@ -81,6 +81,10 @@ class CORE_EXPORT LayoutThemeDefault : public LayoutTheme { ...@@ -81,6 +81,10 @@ class CORE_EXPORT LayoutThemeDefault : public LayoutTheme {
// when hovered. // when hovered.
bool SupportsHover(const ComputedStyle&) const final; bool SupportsHover(const ComputedStyle&) const final;
void SetSelectionColors(unsigned active_background_color,
unsigned active_foreground_color,
unsigned inactive_background_color,
unsigned inactive_foreground_color) override;
Color PlatformFocusRingColor() const override; Color PlatformFocusRingColor() const override;
// System fonts. // System fonts.
...@@ -124,11 +128,6 @@ class CORE_EXPORT LayoutThemeDefault : public LayoutTheme { ...@@ -124,11 +128,6 @@ class CORE_EXPORT LayoutThemeDefault : public LayoutTheme {
float ClampedMenuListArrowPaddingSize(const ChromeClient*, float ClampedMenuListArrowPaddingSize(const ChromeClient*,
const ComputedStyle&) const; const ComputedStyle&) const;
static void SetSelectionColors(unsigned active_background_color,
unsigned active_foreground_color,
unsigned inactive_background_color,
unsigned inactive_foreground_color);
protected: protected:
LayoutThemeDefault(); LayoutThemeDefault();
~LayoutThemeDefault() override; ~LayoutThemeDefault() override;
......
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