Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1348)

Unified Diff: Source/core/platform/ScrollbarThemeGtkOrAura.cpp

Issue 41733004: Roll up patch for running layout tests under Aura. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add even more comments about why we have special logic for the layout tests Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/platform/ScrollbarThemeGtkOrAura.cpp
diff --git a/Source/core/platform/ScrollbarThemeGtkOrAura.cpp b/Source/core/platform/ScrollbarThemeGtkOrAura.cpp
index da0b4097d074cffe6ed3d4da6254ea13d1cc8f85..7900d42e403445d11c8402e2e922a119dd406f13 100644
--- a/Source/core/platform/ScrollbarThemeGtkOrAura.cpp
+++ b/Source/core/platform/ScrollbarThemeGtkOrAura.cpp
@@ -34,6 +34,7 @@
#include "RuntimeEnabledFeatures.h"
#include "core/platform/ScrollbarThemeOverlay.h"
#include "core/platform/graphics/GraphicsContext.h"
+#include "platform/LayoutTestSupport.h"
#include "platform/PlatformMouseEvent.h"
#include "platform/scroll/ScrollbarThemeClient.h"
#include "public/platform/Platform.h"
@@ -63,9 +64,22 @@ int ScrollbarThemeGtkOrAura::scrollbarThickness(ScrollbarControlSize controlSize
void ScrollbarThemeGtkOrAura::paintTrackPiece(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect, ScrollbarPart partType)
{
WebKit::WebThemeEngine::State state = scrollbar->hoveredPart() == partType ? WebKit::WebThemeEngine::StateHover : WebKit::WebThemeEngine::StateNormal;
+
+ if (isRunningLayoutTest()) {
+ if (!scrollbar->enabled())
+ state = WebKit::WebThemeEngine::StateDisabled;
+ else if (scrollbar->hoveredPart() == partType)
+ state = WebKit::WebThemeEngine::StateHot;
+ else if (scrollbar->hoveredPart() != NoPart)
+ state = WebKit::WebThemeEngine::StateHover;
+ else
+ state = WebKit::WebThemeEngine::StateNormal;
+ }
+
IntRect alignRect = trackRect(scrollbar, false);
WebKit::WebThemeEngine::ExtraParams extraParams;
WebKit::WebCanvas* canvas = gc->canvas();
+ extraParams.scrollbarTrack.isBack = (partType == BackTrackPart);
extraParams.scrollbarTrack.trackX = alignRect.x();
extraParams.scrollbarTrack.trackY = alignRect.y();
extraParams.scrollbarTrack.trackWidth = alignRect.width();
@@ -78,6 +92,38 @@ void ScrollbarThemeGtkOrAura::paintButton(GraphicsContext* gc, ScrollbarThemeCli
WebKit::WebThemeEngine::Part paintPart;
WebKit::WebThemeEngine::State state = WebKit::WebThemeEngine::StateNormal;
WebKit::WebCanvas* canvas = gc->canvas();
+
+ if (isRunningLayoutTest()) {
+ if (scrollbar->orientation() == HorizontalScrollbar) {
+ if (part == BackButtonStartPart)
+ paintPart = WebKit::WebThemeEngine::PartScrollbarLeftArrow;
+ else if (part == ForwardButtonEndPart)
+ paintPart = WebKit::WebThemeEngine::PartScrollbarRightArrow;
+ else
+ return;
+ } else {
+ if (part == BackButtonStartPart)
+ paintPart = WebKit::WebThemeEngine::PartScrollbarUpArrow;
+ else if (part == ForwardButtonEndPart)
+ paintPart = WebKit::WebThemeEngine::PartScrollbarDownArrow;
+ else
+ return;
+ }
+
+ if (!scrollbar->enabled()) {
+ state = WebKit::WebThemeEngine::StateDisabled;
+ } else {
+ if (part == scrollbar->pressedPart())
+ state = WebKit::WebThemeEngine::StatePressed;
+ else if (part == scrollbar->hoveredPart())
+ state = WebKit::WebThemeEngine::StateDisabled;
+ else if (NoPart != scrollbar->hoveredPart())
+ state = WebKit::WebThemeEngine::StateHover;
+ }
+ WebKit::Platform::current()->themeEngine()->paint(canvas, paintPart, state, WebKit::WebRect(rect), 0);
jamesr 2013/11/06 21:54:09 how is this code different from the non-testing co
Dirk Pranke 2013/11/06 22:29:11 Are you referring to just lines 123-124, or the wh
jamesr 2013/11/06 23:16:15 Let's optimize for how the code is in this patch,
Dirk Pranke 2013/11/06 23:46:38 Okay, I was pretty sure that keeping all the code
+ return;
+ }
+
bool checkMin = false;
bool checkMax = false;
if (scrollbar->orientation() == HorizontalScrollbar) {
@@ -116,7 +162,7 @@ void ScrollbarThemeGtkOrAura::paintThumb(GraphicsContext* gc, ScrollbarThemeClie
if (scrollbar->pressedPart() == ThumbPart)
state = WebKit::WebThemeEngine::StatePressed;
else if (scrollbar->hoveredPart() == ThumbPart)
- state = WebKit::WebThemeEngine::StateHover;
+ state = isRunningLayoutTest() ? WebKit::WebThemeEngine::StateHot : WebKit::WebThemeEngine::StateHover;
jamesr 2013/11/06 21:54:09 i think you should teach the mock WebThemeEngine t
Dirk Pranke 2013/11/06 22:29:11 I don't think I can. The theme engine is told whet
jamesr 2013/11/06 23:16:15 It looks like what you want to do is treat StateHo
else
state = WebKit::WebThemeEngine::StateNormal;
WebKit::Platform::current()->themeEngine()->paint(canvas, scrollbar->orientation() == HorizontalScrollbar ? WebKit::WebThemeEngine::PartScrollbarHorizontalThumb : WebKit::WebThemeEngine::PartScrollbarVerticalThumb, state, WebKit::WebRect(rect), 0);

Powered by Google App Engine
This is Rietveld 408576698