Title: [95245] trunk/Source/WebCore
Revision
95245
Author
simon.fra...@apple.com
Date
2011-09-15 17:18:34 -0700 (Thu, 15 Sep 2011)

Log Message

Make custom scrollbar theme for use in DRT, to reduce pixel differences between platforms
https://bugs.webkit.org/show_bug.cgi?id=68134

Reviewed by James Robinson.

Add new scrollbar theme, called ScrollbarThemeMock, for use in layout
tests. The mock scrollbar simply draws a light gray box in the track,
with a dark gray box for the thumb.

Add ScrollbarThemeMock files to the build on all platforms. It isn't hooked up yet.

* CMakeLists.txt:
* CMakeListsEfl.txt:
* CMakeListsWinCE.txt:
* GNUmakefile.list.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* platform/mac/ScrollbarThemeMac.mm:
(WebCore::ScrollbarTheme::nativeTheme):
* platform/mock/ScrollbarThemeMock.cpp: Added.
(WebCore::ScrollbarThemeMock::trackRect):
(WebCore::ScrollbarThemeMock::scrollbarThickness):
(WebCore::ScrollbarThemeMock::paintTrackBackground):
(WebCore::ScrollbarThemeMock::paintThumb):
* platform/mock/ScrollbarThemeMock.h: Added.
(WebCore::ScrollbarThemeMock::hasButtons):
(WebCore::ScrollbarThemeMock::hasThumb):
(WebCore::ScrollbarThemeMock::backButtonRect):
(WebCore::ScrollbarThemeMock::forwardButtonRect):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (95244 => 95245)


--- trunk/Source/WebCore/CMakeLists.txt	2011-09-16 00:17:50 UTC (rev 95244)
+++ trunk/Source/WebCore/CMakeLists.txt	2011-09-16 00:18:34 UTC (rev 95245)
@@ -1123,6 +1123,7 @@
     platform/mock/DeviceOrientationClientMock.cpp
     platform/mock/GeolocationClientMock.cpp
     platform/mock/GeolocationServiceMock.cpp
+    platform/mock/ScrollbarThemeMock.cpp
 
     platform/network/AuthenticationChallengeBase.cpp
     platform/network/BlobData.cpp

Modified: trunk/Source/WebCore/CMakeListsEfl.txt (95244 => 95245)


--- trunk/Source/WebCore/CMakeListsEfl.txt	2011-09-16 00:17:50 UTC (rev 95244)
+++ trunk/Source/WebCore/CMakeListsEfl.txt	2011-09-16 00:18:34 UTC (rev 95245)
@@ -69,6 +69,7 @@
   platform/image-decoders/jpeg/JPEGImageDecoder.cpp
   platform/image-decoders/png/PNGImageDecoder.cpp
   platform/image-decoders/webp/WEBPImageDecoder.cpp
+  platform/mock/ScrollbarThemeMock.cpp
   platform/posix/FileSystemPOSIX.cpp
   platform/text/efl/TextBreakIteratorInternalICUEfl.cpp
   plugins/PluginDataNone.cpp

Modified: trunk/Source/WebCore/CMakeListsWinCE.txt (95244 => 95245)


--- trunk/Source/WebCore/CMakeListsWinCE.txt	2011-09-16 00:17:50 UTC (rev 95244)
+++ trunk/Source/WebCore/CMakeListsWinCE.txt	2011-09-16 00:18:34 UTC (rev 95245)
@@ -46,6 +46,8 @@
     platform/image-decoders/png/PNGImageDecoder.cpp
     platform/image-decoders/webp/WEBPImageDecoder.cpp
 
+    platform/mock/ScrollbarThemeMock.cpp
+
     platform/win/BitmapInfo.cpp
     platform/win/ClipboardUtilitiesWin.cpp
     platform/win/ClipboardWin.cpp

Modified: trunk/Source/WebCore/ChangeLog (95244 => 95245)


--- trunk/Source/WebCore/ChangeLog	2011-09-16 00:17:50 UTC (rev 95244)
+++ trunk/Source/WebCore/ChangeLog	2011-09-16 00:18:34 UTC (rev 95245)
@@ -1,3 +1,37 @@
+2011-09-15  Simon Fraser  <simon.fra...@apple.com>
+
+        Make custom scrollbar theme for use in DRT, to reduce pixel differences between platforms
+        https://bugs.webkit.org/show_bug.cgi?id=68134
+
+        Reviewed by James Robinson.
+
+        Add new scrollbar theme, called ScrollbarThemeMock, for use in layout
+        tests. The mock scrollbar simply draws a light gray box in the track,
+        with a dark gray box for the thumb.
+        
+        Add ScrollbarThemeMock files to the build on all platforms. It isn't hooked up yet.
+
+        * CMakeLists.txt:
+        * CMakeListsEfl.txt:
+        * CMakeListsWinCE.txt:
+        * GNUmakefile.list.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/mac/ScrollbarThemeMac.mm:
+        (WebCore::ScrollbarTheme::nativeTheme):
+        * platform/mock/ScrollbarThemeMock.cpp: Added.
+        (WebCore::ScrollbarThemeMock::trackRect):
+        (WebCore::ScrollbarThemeMock::scrollbarThickness):
+        (WebCore::ScrollbarThemeMock::paintTrackBackground):
+        (WebCore::ScrollbarThemeMock::paintThumb):
+        * platform/mock/ScrollbarThemeMock.h: Added.
+        (WebCore::ScrollbarThemeMock::hasButtons):
+        (WebCore::ScrollbarThemeMock::hasThumb):
+        (WebCore::ScrollbarThemeMock::backButtonRect):
+        (WebCore::ScrollbarThemeMock::forwardButtonRect):
+
 2011-09-15  Beth Dakin  <bda...@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=67884

Modified: trunk/Source/WebCore/GNUmakefile.list.am (95244 => 95245)


--- trunk/Source/WebCore/GNUmakefile.list.am	2011-09-16 00:17:50 UTC (rev 95244)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2011-09-16 00:18:34 UTC (rev 95245)
@@ -2684,6 +2684,8 @@
 	Source/WebCore/platform/mock/GeolocationClientMock.h \
 	Source/WebCore/platform/mock/GeolocationServiceMock.cpp \
 	Source/WebCore/platform/mock/GeolocationServiceMock.h \
+	Source/WebCore/platform/mock/ScrollbarThemeMock.cpp \
+	Source/WebCore/platform/mock/ScrollbarThemeMock.cpp \
 	Source/WebCore/platform/mock/SpeechInputClientMock.cpp \
 	Source/WebCore/platform/mock/SpeechInputClientMock.h \
 	Source/WebCore/platform/network/AuthenticationChallengeBase.cpp \

Modified: trunk/Source/WebCore/WebCore.gypi (95244 => 95245)


--- trunk/Source/WebCore/WebCore.gypi	2011-09-16 00:17:50 UTC (rev 95244)
+++ trunk/Source/WebCore/WebCore.gypi	2011-09-16 00:18:34 UTC (rev 95245)
@@ -4130,6 +4130,8 @@
             'platform/mock/GeolocationClientMock.cpp',
             'platform/mock/GeolocationServiceMock.cpp',
             'platform/mock/GeolocationServiceMock.h',
+            'platform/mock/ScrollbarThemeMock.cpp',
+            'platform/mock/ScrollbarThemeMock.h',
             'platform/mock/SpeechInputClientMock.cpp',
             'platform/mock/SpeechInputClientMock.h',
             'platform/network/AuthenticationChallengeBase.cpp',

Modified: trunk/Source/WebCore/WebCore.pro (95244 => 95245)


--- trunk/Source/WebCore/WebCore.pro	2011-09-16 00:17:50 UTC (rev 95244)
+++ trunk/Source/WebCore/WebCore.pro	2011-09-16 00:18:34 UTC (rev 95245)
@@ -1041,6 +1041,7 @@
     platform/mock/GeolocationClientMock.cpp \
     platform/mock/GeolocationServiceMock.cpp \
     platform/mock/SpeechInputClientMock.cpp \
+    platform/mock/ScrollbarThemeMock.cpp \
     platform/network/AuthenticationChallengeBase.cpp \
     platform/network/BlobData.cpp \
     platform/network/BlobRegistryImpl.cpp \
@@ -1962,6 +1963,7 @@
     platform/mock/GeolocationClientMock.cpp \
     platform/mock/GeolocationServiceMock.h \
     platform/mock/SpeechInputClientMock.h \
+    platform/mock/ScrollbarThemeMock.h \
     platform/graphics/BitmapImage.h \
     platform/graphics/Color.h \
     platform/graphics/filters/FEBlend.h \

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (95244 => 95245)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-09-16 00:17:50 UTC (rev 95244)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-09-16 00:18:34 UTC (rev 95245)
@@ -32681,6 +32681,14 @@
 					>
 				</File>
 				<File
+					RelativePath="..\platform\mock\ScrollbarThemeMock.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\platform\mock\ScrollbarThemeMock.h"
+					>
+				</File>
+				<File
 					RelativePath="..\platform\mock\SpeechInputClientMock.cpp"
 					>
 				</File>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (95244 => 95245)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-09-16 00:17:50 UTC (rev 95244)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-09-16 00:18:34 UTC (rev 95245)
@@ -229,6 +229,8 @@
 		0FD308D6117D168500A791F7 /* RenderIFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD308D4117D168400A791F7 /* RenderIFrame.h */; };
 		0FD723820EC8BD9300CA5DD7 /* FloatQuad.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD723800EC8BD9300CA5DD7 /* FloatQuad.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0FD723830EC8BD9300CA5DD7 /* FloatQuad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FD723810EC8BD9300CA5DD7 /* FloatQuad.cpp */; };
+		0FE71405142170B800DB33BA /* ScrollbarThemeMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FE71403142170B800DB33BA /* ScrollbarThemeMock.cpp */; };
+		0FE71406142170B800DB33BA /* ScrollbarThemeMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE71404142170B800DB33BA /* ScrollbarThemeMock.h */; };
 		0FF5025B102BA9010066F39A /* DOMStyleMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF50259102BA9010066F39A /* DOMStyleMedia.h */; };
 		0FF5025C102BA9010066F39A /* DOMStyleMedia.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FF5025A102BA9010066F39A /* DOMStyleMedia.mm */; };
 		0FF50263102BA92C0066F39A /* DOMStyleMediaInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF50262102BA92B0066F39A /* DOMStyleMediaInternal.h */; };
@@ -6721,6 +6723,8 @@
 		0FD308D4117D168400A791F7 /* RenderIFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderIFrame.h; sourceTree = "<group>"; };
 		0FD723800EC8BD9300CA5DD7 /* FloatQuad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatQuad.h; sourceTree = "<group>"; };
 		0FD723810EC8BD9300CA5DD7 /* FloatQuad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FloatQuad.cpp; sourceTree = "<group>"; };
+		0FE71403142170B800DB33BA /* ScrollbarThemeMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScrollbarThemeMock.cpp; path = mock/ScrollbarThemeMock.cpp; sourceTree = "<group>"; };
+		0FE71404142170B800DB33BA /* ScrollbarThemeMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ScrollbarThemeMock.h; path = mock/ScrollbarThemeMock.h; sourceTree = "<group>"; };
 		0FF50259102BA9010066F39A /* DOMStyleMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMStyleMedia.h; sourceTree = "<group>"; };
 		0FF5025A102BA9010066F39A /* DOMStyleMedia.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMStyleMedia.mm; sourceTree = "<group>"; };
 		0FF50262102BA92B0066F39A /* DOMStyleMediaInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMStyleMediaInternal.h; sourceTree = "<group>"; };
@@ -14334,6 +14338,8 @@
 				59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */,
 				052BFCE8128ABF1500FD338D /* GeolocationClientMock.cpp */,
 				052BFCEA128ABF2100FD338D /* GeolocationClientMock.h */,
+				0FE71403142170B800DB33BA /* ScrollbarThemeMock.cpp */,
+				0FE71404142170B800DB33BA /* ScrollbarThemeMock.h */,
 				7535BC9212020CFF0037EC45 /* SpeechInputClientMock.cpp */,
 				7535BC9312020CFF0037EC45 /* SpeechInputClientMock.h */,
 			);
@@ -19208,8 +19214,8 @@
 				BCAA90C20A7EBA60008B1229 /* Scrollbar.cpp */,
 				BC7B2AF80450824100A8000F /* Scrollbar.h */,
 				BC8B854A0E7C7F5600AB6984 /* ScrollbarTheme.h */,
+				BC1402890E83680800319717 /* ScrollbarThemeComposite.h */,
 				BC1402880E83680800319717 /* ScrollbarThemeComposite.cpp */,
-				BC1402890E83680800319717 /* ScrollbarThemeComposite.h */,
 				93C09C850B0657AA005ABD4D /* ScrollTypes.h */,
 				BC2441C30E8B65D00055320F /* ScrollView.cpp */,
 				BC6D6E2509AF943500F59759 /* ScrollView.h */,
@@ -23482,6 +23488,7 @@
 				1A927FD31416A15B003A83C8 /* npruntime.h in Headers */,
 				1A927FD41416A15B003A83C8 /* nptypes.h in Headers */,
 				CECCFC3B141973D5002A0AC1 /* DecodeEscapeSequences.h in Headers */,
+				0FE71406142170B800DB33BA /* ScrollbarThemeMock.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -26298,6 +26305,7 @@
 				E44B4BB3141650D7002B1D8B /* SelectorChecker.cpp in Sources */,
 				978AD67414130A8D00C7CAE3 /* HTMLSpanElement.cpp in Sources */,
 				9752D38D1413104B003305BD /* JSHTMLSpanElement.cpp in Sources */,
+				0FE71405142170B800DB33BA /* ScrollbarThemeMock.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Added: trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp (0 => 95245)


--- trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp	2011-09-16 00:18:34 UTC (rev 95245)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "ScrollbarThemeMock.h"
+
+#include "Scrollbar.h"
+
+namespace WebCore {
+
+static int cScrollbarThickness[] = { 15, 11 };
+
+IntRect ScrollbarThemeMock::trackRect(Scrollbar* scrollbar, bool)
+{
+    return scrollbar->frameRect();
+}
+
+int ScrollbarThemeMock::scrollbarThickness(ScrollbarControlSize controlSize)
+{
+    return cScrollbarThickness[controlSize];
+}
+
+void ScrollbarThemeMock::paintTrackBackground(GraphicsContext* context, Scrollbar*, const IntRect& trackRect)
+{
+    context->fillRect(trackRect, Color::lightGray, ColorSpaceDeviceRGB);
+}
+
+void ScrollbarThemeMock::paintThumb(GraphicsContext* context, Scrollbar*, const IntRect& thumbRect)
+{
+    context->fillRect(thumbRect, Color::darkGray, ColorSpaceDeviceRGB);
+}
+
+}
+
Property changes on: trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp
___________________________________________________________________

Added: svn:keywords

Added: svn:eol-style

Added: trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.h (0 => 95245)


--- trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.h	2011-09-16 00:18:34 UTC (rev 95245)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef ScrollbarThemeMock_h
+#define ScrollbarThemeMock_h
+
+#include "ScrollbarThemeComposite.h"
+
+namespace WebCore {
+
+// Scrollbar theme used in image snapshots, to eliminate appearance differences between platforms.
+class ScrollbarThemeMock : public ScrollbarThemeComposite {
+public:
+    virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar);
+
+protected:
+    virtual bool hasButtons(Scrollbar*) { return false; }
+    virtual bool hasThumb(Scrollbar*) { return true; }
+
+    virtual IntRect backButtonRect(Scrollbar*, ScrollbarPart, bool /*painting*/ = false) { return IntRect(); }
+    virtual IntRect forwardButtonRect(Scrollbar*, ScrollbarPart, bool /*painting*/ = false) { return IntRect(); }
+    virtual IntRect trackRect(Scrollbar*, bool painting = false);
+    
+    virtual void paintTrackBackground(GraphicsContext*, Scrollbar*, const IntRect&);
+    virtual void paintThumb(GraphicsContext*, Scrollbar*, const IntRect&);
+};
+
+}
+#endif // ScrollbarThemeMock_h
Property changes on: trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.h
___________________________________________________________________

Added: svn:keywords

Added: svn:eol-style

_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to