Commit b554c05a authored by tkent's avatar tkent Committed by Commit bot

LayoutTheme: Invalidate cache on WebThemeEngine change.

A LayoutThemeDefault instance can be associated to a real
WebThemeEngine or a mock WebThemeEngine, which have different
metrics. We need to invalidate a cached value when a WebThemeEngine is
switched.

The bug affects only layout tests.

BUG=673754

Review-Url: https://codereview.chromium.org/2627773002
Cr-Commit-Position: refs/heads/master@{#442799}
parent 275b25d4
...@@ -758,6 +758,8 @@ crbug.com/498539 [ Win7 ] inspector/elements/styles-4/styles-update-from-js.html ...@@ -758,6 +758,8 @@ crbug.com/498539 [ Win7 ] inspector/elements/styles-4/styles-update-from-js.html
crbug.com/596968 [ Win ] inspector-protocol/input/eventTimestamp.html [ Failure Pass ] crbug.com/596968 [ Win ] inspector-protocol/input/eventTimestamp.html [ Failure Pass ]
crbug.com/487281 [ Mac ] fast/forms/select/menulist-narrow-width.html [ Failure ] crbug.com/487281 [ Mac ] fast/forms/select/menulist-narrow-width.html [ Failure ]
crbug.com/673754 fast/forms/color/input-appearance-color.html [ NeedsRebaseline ]
crbug.com/673754 fast/forms/select/menulist-appearance-basic.html [ NeedsRebaseline ]
crbug.com/543110 [ Mac ] fast/text/international/text-shaping-arabic.html [ Failure ] crbug.com/543110 [ Mac ] fast/text/international/text-shaping-arabic.html [ Failure ]
......
...@@ -58,6 +58,10 @@ class CORE_EXPORT LayoutTheme : public RefCounted<LayoutTheme> { ...@@ -58,6 +58,10 @@ class CORE_EXPORT LayoutTheme : public RefCounted<LayoutTheme> {
virtual ThemePainter& painter() = 0; virtual ThemePainter& painter() = 0;
// This function is called after associated WebThemeEngine instance
// was replaced. This is called only in tests.
virtual void didChangeThemeEngine() {}
static void setSizeIfAuto(ComputedStyle&, const IntSize&); static void setSizeIfAuto(ComputedStyle&, const IntSize&);
// This method is called whenever style has been computed for an element and // This method is called whenever style has been computed for an element and
......
...@@ -363,6 +363,10 @@ float LayoutThemeDefault::clampedMenuListArrowPaddingSize( ...@@ -363,6 +363,10 @@ float LayoutThemeDefault::clampedMenuListArrowPaddingSize(
return originalSize * style.effectiveZoom(); return originalSize * style.effectiveZoom();
} }
void LayoutThemeDefault::didChangeThemeEngine() {
m_menuListArrowWidthInDIP = 0;
}
// static // static
void LayoutThemeDefault::setDefaultFontSize(int fontSize) { void LayoutThemeDefault::setDefaultFontSize(int fontSize) {
LayoutThemeFontProvider::setDefaultFontSize(fontSize); LayoutThemeFontProvider::setDefaultFontSize(fontSize);
......
...@@ -147,6 +147,7 @@ class CORE_EXPORT LayoutThemeDefault : public LayoutTheme { ...@@ -147,6 +147,7 @@ class CORE_EXPORT LayoutThemeDefault : public LayoutTheme {
private: private:
ThemePainter& painter() override { return m_painter; } ThemePainter& painter() override { return m_painter; }
void didChangeThemeEngine() override;
int menuListInternalPadding(const ComputedStyle&, int padding) const; int menuListInternalPadding(const ComputedStyle&, int padding) const;
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "bindings/core/v8/V8GCController.h" #include "bindings/core/v8/V8GCController.h"
#include "bindings/core/v8/V8Initializer.h" #include "bindings/core/v8/V8Initializer.h"
#include "core/animation/AnimationClock.h" #include "core/animation/AnimationClock.h"
#include "core/layout/LayoutTheme.h"
#include "core/page/Page.h" #include "core/page/Page.h"
#include "core/workers/WorkerBackingThread.h" #include "core/workers/WorkerBackingThread.h"
#include "gin/public/v8_platform.h" #include "gin/public/v8_platform.h"
...@@ -124,6 +125,7 @@ bool layoutTestMode() { ...@@ -124,6 +125,7 @@ bool layoutTestMode() {
void setMockThemeEnabledForTest(bool value) { void setMockThemeEnabledForTest(bool value) {
LayoutTestSupport::setMockThemeEnabledForTest(value); LayoutTestSupport::setMockThemeEnabledForTest(value);
LayoutTheme::theme().didChangeThemeEngine();
} }
void setFontAntialiasingEnabledForTest(bool value) { void setFontAntialiasingEnabledForTest(bool value) {
......
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