Diff
Modified: trunk/Source/Platform/ChangeLog (125129 => 125130)
--- trunk/Source/Platform/ChangeLog 2012-08-09 01:02:07 UTC (rev 125129)
+++ trunk/Source/Platform/ChangeLog 2012-08-09 01:04:31 UTC (rev 125130)
@@ -1,3 +1,31 @@
+2012-08-08 Adrienne Walker <[email protected]>
+
+ [chromium] Move scrollbar pointer into WebScrollbarThemePainter
+ https://bugs.webkit.org/show_bug.cgi?id=93541
+
+ Reviewed by James Robinson.
+
+ Update WebScrollbarThemePainter to encapsulate a pointer to the
+ scrollbar as well. Lion scrollbars and RenderScrollbars are both
+ incompatible with wrapping a scrollbar in a WebScrollbar.
+
+ ScrollbarTheme(Chromium)Mac attaches extra data to a scrollbar based
+ on the pointer value (via a static map keyed on the pointer) so
+ passing an object that returns all the same values for the
+ ScrollbarThemeClient interface but has a different pointer will fail
+ to paint.
+
+ RenderScrollbar does static casts on the ScrollbarThemeClient pointer
+ that it is passed, assuming that it is the same. Therefore, it also
+ cannot use a WebScrollbar.
+
+ To fix this, push the real scrollbar pointer into the painter.
+
+ * chromium/public/WebScrollbarThemePainter.h:
+ (WebCore):
+ (WebKit::WebScrollbarThemePainter::WebScrollbarThemePainter):
+ (WebScrollbarThemePainter):
+
2012-08-07 James Robinson <[email protected]>
[chromium] Only use public Platform API in NonCompositedContentHost
Modified: trunk/Source/Platform/chromium/public/WebScrollbarThemePainter.h (125129 => 125130)
--- trunk/Source/Platform/chromium/public/WebScrollbarThemePainter.h 2012-08-09 01:02:07 UTC (rev 125129)
+++ trunk/Source/Platform/chromium/public/WebScrollbarThemePainter.h 2012-08-09 01:04:31 UTC (rev 125130)
@@ -30,6 +30,7 @@
namespace WebCore {
class ScrollbarThemeComposite;
+class Scrollbar;
};
namespace WebKit {
@@ -40,7 +41,7 @@
class WebScrollbarThemePainter {
public:
WebScrollbarThemePainter() : m_theme(0) { }
- WebScrollbarThemePainter(const WebScrollbarThemePainter& geometry) { assign(geometry); }
+ WebScrollbarThemePainter(const WebScrollbarThemePainter& painter) { assign(painter); }
virtual ~WebScrollbarThemePainter() { }
WebScrollbarThemePainter& operator=(const WebScrollbarThemePainter& painter)
{
@@ -51,19 +52,19 @@
bool isNull() const { return m_theme; }
WEBKIT_EXPORT void assign(const WebScrollbarThemePainter&);
- WEBKIT_EXPORT void paintScrollbarBackground(WebCanvas*, WebScrollbar*, const WebRect&);
- WEBKIT_EXPORT void paintTrackBackground(WebCanvas*, WebScrollbar*, const WebRect&);
- WEBKIT_EXPORT void paintBackTrackPart(WebCanvas*, WebScrollbar*, const WebRect&);
- WEBKIT_EXPORT void paintForwardTrackPart(WebCanvas*, WebScrollbar*, const WebRect&);
- WEBKIT_EXPORT void paintBackButtonStart(WebCanvas*, WebScrollbar*, const WebRect&);
- WEBKIT_EXPORT void paintBackButtonEnd(WebCanvas*, WebScrollbar*, const WebRect&);
- WEBKIT_EXPORT void paintForwardButtonStart(WebCanvas*, WebScrollbar*, const WebRect&);
- WEBKIT_EXPORT void paintForwardButtonEnd(WebCanvas*, WebScrollbar*, const WebRect&);
- WEBKIT_EXPORT void paintTickmarks(WebCanvas*, WebScrollbar*, const WebRect&);
- WEBKIT_EXPORT void paintThumb(WebCanvas*, WebScrollbar*, const WebRect&);
+ WEBKIT_EXPORT void paintScrollbarBackground(WebCanvas*, const WebRect&);
+ WEBKIT_EXPORT void paintTrackBackground(WebCanvas*, const WebRect&);
+ WEBKIT_EXPORT void paintBackTrackPart(WebCanvas*, const WebRect&);
+ WEBKIT_EXPORT void paintForwardTrackPart(WebCanvas*, const WebRect&);
+ WEBKIT_EXPORT void paintBackButtonStart(WebCanvas*, const WebRect&);
+ WEBKIT_EXPORT void paintBackButtonEnd(WebCanvas*, const WebRect&);
+ WEBKIT_EXPORT void paintForwardButtonStart(WebCanvas*, const WebRect&);
+ WEBKIT_EXPORT void paintForwardButtonEnd(WebCanvas*, const WebRect&);
+ WEBKIT_EXPORT void paintTickmarks(WebCanvas*, const WebRect&);
+ WEBKIT_EXPORT void paintThumb(WebCanvas*, const WebRect&);
#if WEBKIT_IMPLEMENTATION
- WebScrollbarThemePainter(WebCore::ScrollbarThemeComposite*);
+ WebScrollbarThemePainter(WebCore::ScrollbarThemeComposite*, WebCore::Scrollbar*);
#endif
private:
@@ -72,6 +73,12 @@
// called from the painter may not be thread-safe, so all calls must be made
// from the same thread that it is created on.
WebCore::ScrollbarThemeComposite* m_theme;
+
+ // It is assumed that the constructor of this paint object is responsible
+ // for the lifetime of this scrollbar. The painter has to use the real
+ // scrollbar (and not a WebScrollbar wrapper) due to static_casts for
+ // RenderScrollbar and pointer-based HashMap lookups for Lion scrollbars.
+ WebCore::Scrollbar* m_scrollbar;
};
} // namespace WebKit
Modified: trunk/Source/WebCore/ChangeLog (125129 => 125130)
--- trunk/Source/WebCore/ChangeLog 2012-08-09 01:02:07 UTC (rev 125129)
+++ trunk/Source/WebCore/ChangeLog 2012-08-09 01:04:31 UTC (rev 125130)
@@ -1,3 +1,16 @@
+2012-08-08 Adrienne Walker <[email protected]>
+
+ [chromium] Move scrollbar pointer into WebScrollbarThemePainter
+ https://bugs.webkit.org/show_bug.cgi?id=93541
+
+ Reviewed by James Robinson.
+
+ Update clients of WebScrollbarThemePainter.
+
+ * page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
+ (WebCore::createScrollbarLayer):
+ * platform/graphics/chromium/ScrollbarLayerChromium.cpp:
+
2012-08-08 Alexandru Chiculita <[email protected]>
[CSS Shaders] Invalid shaders should act as pass-through filters
Modified: trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp (125129 => 125130)
--- trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp 2012-08-09 01:02:07 UTC (rev 125129)
+++ trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp 2012-08-09 01:04:31 UTC (rev 125130)
@@ -143,7 +143,7 @@
// All Chromium scrollbar themes derive from ScrollbarThemeComposite.
ScrollbarThemeComposite* themeComposite = static_cast<ScrollbarThemeComposite*>(scrollbar->theme());
- WebKit::WebScrollbarThemePainter painter(themeComposite);
+ WebKit::WebScrollbarThemePainter painter(themeComposite, scrollbar);
OwnPtr<WebKit::WebScrollbarThemeGeometry> geometry(WebKit::WebScrollbarThemeGeometryNative::create(themeComposite));
WebScrollbarLayer scrollbarLayer = WebScrollbarLayer::create(scrollbar, painter, geometry.release());
Modified: trunk/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp (125129 => 125130)
--- trunk/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp 2012-08-09 01:02:07 UTC (rev 125129)
+++ trunk/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp 2012-08-09 01:04:31 UTC (rev 125130)
@@ -98,34 +98,34 @@
WebKit::WebCanvas* canvas = skCanvas;
// The following is a simplification of ScrollbarThemeComposite::paint.
WebKit::WebRect contentWebRect(contentRect.x(), contentRect.y(), contentRect.width(), contentRect.height());
- m_painter.paintScrollbarBackground(canvas, m_scrollbar, contentWebRect);
+ m_painter.paintScrollbarBackground(canvas, contentWebRect);
if (m_geometry->hasButtons(m_scrollbar)) {
WebRect backButtonStartPaintRect = m_geometry->backButtonStartRect(m_scrollbar);
- m_painter.paintBackButtonStart(canvas, m_scrollbar, backButtonStartPaintRect);
+ m_painter.paintBackButtonStart(canvas, backButtonStartPaintRect);
WebRect backButtonEndPaintRect = m_geometry->backButtonEndRect(m_scrollbar);
- m_painter.paintBackButtonEnd(canvas, m_scrollbar, backButtonEndPaintRect);
+ m_painter.paintBackButtonEnd(canvas, backButtonEndPaintRect);
WebRect forwardButtonStartPaintRect = m_geometry->forwardButtonStartRect(m_scrollbar);
- m_painter.paintForwardButtonStart(canvas, m_scrollbar, forwardButtonStartPaintRect);
+ m_painter.paintForwardButtonStart(canvas, forwardButtonStartPaintRect);
WebRect forwardButtonEndPaintRect = m_geometry->forwardButtonEndRect(m_scrollbar);
- m_painter.paintForwardButtonEnd(canvas, m_scrollbar, forwardButtonEndPaintRect);
+ m_painter.paintForwardButtonEnd(canvas, forwardButtonEndPaintRect);
}
WebRect trackPaintRect = m_geometry->trackRect(m_scrollbar);
- m_painter.paintTrackBackground(canvas, m_scrollbar, trackPaintRect);
+ m_painter.paintTrackBackground(canvas, trackPaintRect);
bool thumbPresent = m_geometry->hasThumb(m_scrollbar);
if (thumbPresent) {
if (m_trackPart == WebKit::WebScrollbar::ForwardTrackPart)
- m_painter.paintForwardTrackPart(canvas, m_scrollbar, trackPaintRect);
+ m_painter.paintForwardTrackPart(canvas, trackPaintRect);
else
- m_painter.paintBackTrackPart(canvas, m_scrollbar, trackPaintRect);
+ m_painter.paintBackTrackPart(canvas, trackPaintRect);
}
- m_painter.paintTickmarks(canvas, m_scrollbar, trackPaintRect);
+ m_painter.paintTickmarks(canvas, trackPaintRect);
}
private:
ScrollbarBackgroundPainter(WebKit::WebScrollbar* scrollbar, WebKit::WebScrollbarThemePainter painter, WebKit::WebScrollbarThemeGeometry* geometry, WebKit::WebScrollbar::ScrollbarPart trackPart)
@@ -158,7 +158,7 @@
WebRect thumbRect = m_geometry->thumbRect(m_scrollbar);
thumbRect.x = 0;
thumbRect.y = 0;
- m_painter.paintThumb(canvas, m_scrollbar, thumbRect);
+ m_painter.paintThumb(canvas, thumbRect);
}
private:
Modified: trunk/Source/WebKit/chromium/ChangeLog (125129 => 125130)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-08-09 01:02:07 UTC (rev 125129)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-08-09 01:04:31 UTC (rev 125130)
@@ -1,3 +1,30 @@
+2012-08-08 Adrienne Walker <[email protected]>
+
+ [chromium] Move scrollbar pointer into WebScrollbarThemePainter
+ https://bugs.webkit.org/show_bug.cgi?id=93541
+
+ Reviewed by James Robinson.
+
+ Fix WebScrollbarThemePainter implementation to make direct calls on
+ the scrollbar rather than through the WebScrollbarThemeClientImpl
+ adapter.
+
+ * src/WebScrollbarThemePainter.cpp:
+ (WebKit::WebScrollbarThemePainter::assign):
+ (WebKit::WebScrollbarThemePainter::paintScrollbarBackground):
+ (WebKit::WebScrollbarThemePainter::paintTrackBackground):
+ (WebKit::WebScrollbarThemePainter::paintBackTrackPart):
+ (WebKit::WebScrollbarThemePainter::paintForwardTrackPart):
+ (WebKit::WebScrollbarThemePainter::paintBackButtonStart):
+ (WebKit::WebScrollbarThemePainter::paintBackButtonEnd):
+ (WebKit::WebScrollbarThemePainter::paintForwardButtonStart):
+ (WebKit::WebScrollbarThemePainter::paintForwardButtonEnd):
+ (WebKit::WebScrollbarThemePainter::paintTickmarks):
+ (WebKit::WebScrollbarThemePainter::paintThumb):
+ (WebKit::WebScrollbarThemePainter::WebScrollbarThemePainter):
+ * tests/ScrollbarLayerChromiumTest.cpp:
+ (WebCore::TEST):
+
2012-08-08 Alexei Svitkine <[email protected]>
[chromium/mac] Map NSEventPhaseMayBegin appropriately on 10.8
Modified: trunk/Source/WebKit/chromium/src/WebScrollbarThemePainter.cpp (125129 => 125130)
--- trunk/Source/WebKit/chromium/src/WebScrollbarThemePainter.cpp 2012-08-09 01:02:07 UTC (rev 125129)
+++ trunk/Source/WebKit/chromium/src/WebScrollbarThemePainter.cpp 2012-08-09 01:04:31 UTC (rev 125130)
@@ -28,10 +28,9 @@
#include <public/WebScrollbarThemePainter.h>
#include "PlatformContextSkia.h"
+#include "Scrollbar.h"
#include "ScrollbarThemeComposite.h"
-#include "WebScrollbarThemeClientImpl.h"
#include <public/WebRect.h>
-#include <public/WebScrollbar.h>
using namespace WebCore;
@@ -41,103 +40,95 @@
{
// This is a pointer to a static object, so no ownership transferral.
m_theme = painter.m_theme;
+ m_scrollbar = painter.m_scrollbar;
}
-void WebScrollbarThemePainter::paintScrollbarBackground(WebCanvas* canvas, WebScrollbar* scrollbar, const WebRect& rect)
+void WebScrollbarThemePainter::paintScrollbarBackground(WebCanvas* canvas, const WebRect& rect)
{
SkRect clip = SkRect::MakeXYWH(rect.x, rect.y, rect.width, rect.height);
canvas->clipRect(clip);
- WebScrollbarThemeClientImpl client(scrollbar);
PlatformContextSkia platformContext(canvas);
platformContext.setDrawingToImageBuffer(true);
GraphicsContext context(&platformContext);
- m_theme->paintScrollbarBackground(&context, &client);
+ m_theme->paintScrollbarBackground(&context, m_scrollbar);
}
-void WebScrollbarThemePainter::paintTrackBackground(WebCanvas* canvas, WebScrollbar* scrollbar, const WebRect& rect)
+void WebScrollbarThemePainter::paintTrackBackground(WebCanvas* canvas, const WebRect& rect)
{
- WebScrollbarThemeClientImpl client(scrollbar);
PlatformContextSkia platformContext(canvas);
platformContext.setDrawingToImageBuffer(true);
GraphicsContext context(&platformContext);
- m_theme->paintTrackBackground(&context, &client, IntRect(rect));
+ m_theme->paintTrackBackground(&context, m_scrollbar, IntRect(rect));
}
-void WebScrollbarThemePainter::paintBackTrackPart(WebCanvas* canvas, WebScrollbar* scrollbar, const WebRect& rect)
+void WebScrollbarThemePainter::paintBackTrackPart(WebCanvas* canvas, const WebRect& rect)
{
- WebScrollbarThemeClientImpl client(scrollbar);
PlatformContextSkia platformContext(canvas);
platformContext.setDrawingToImageBuffer(true);
GraphicsContext context(&platformContext);
- m_theme->paintTrackPiece(&context, &client, IntRect(rect), WebCore::BackTrackPart);
+ m_theme->paintTrackPiece(&context, m_scrollbar, IntRect(rect), WebCore::BackTrackPart);
}
-void WebScrollbarThemePainter::paintForwardTrackPart(WebCanvas* canvas, WebScrollbar* scrollbar, const WebRect& rect)
+void WebScrollbarThemePainter::paintForwardTrackPart(WebCanvas* canvas, const WebRect& rect)
{
- WebScrollbarThemeClientImpl client(scrollbar);
PlatformContextSkia platformContext(canvas);
platformContext.setDrawingToImageBuffer(true);
GraphicsContext context(&platformContext);
- m_theme->paintTrackPiece(&context, &client, IntRect(rect), WebCore::ForwardTrackPart);
+ m_theme->paintTrackPiece(&context, m_scrollbar, IntRect(rect), WebCore::ForwardTrackPart);
}
-void WebScrollbarThemePainter::paintBackButtonStart(WebCanvas* canvas, WebScrollbar* scrollbar, const WebRect& rect)
+void WebScrollbarThemePainter::paintBackButtonStart(WebCanvas* canvas, const WebRect& rect)
{
- WebScrollbarThemeClientImpl client(scrollbar);
PlatformContextSkia platformContext(canvas);
platformContext.setDrawingToImageBuffer(true);
GraphicsContext context(&platformContext);
- m_theme->paintButton(&context, &client, IntRect(rect), WebCore::BackButtonStartPart);
+ m_theme->paintButton(&context, m_scrollbar, IntRect(rect), WebCore::BackButtonStartPart);
}
-void WebScrollbarThemePainter::paintBackButtonEnd(WebCanvas* canvas, WebScrollbar* scrollbar, const WebRect& rect)
+void WebScrollbarThemePainter::paintBackButtonEnd(WebCanvas* canvas, const WebRect& rect)
{
- WebScrollbarThemeClientImpl client(scrollbar);
PlatformContextSkia platformContext(canvas);
platformContext.setDrawingToImageBuffer(true);
GraphicsContext context(&platformContext);
- m_theme->paintButton(&context, &client, IntRect(rect), WebCore::BackButtonEndPart);
+ m_theme->paintButton(&context, m_scrollbar, IntRect(rect), WebCore::BackButtonEndPart);
}
-void WebScrollbarThemePainter::paintForwardButtonStart(WebCanvas* canvas, WebScrollbar* scrollbar, const WebRect& rect)
+void WebScrollbarThemePainter::paintForwardButtonStart(WebCanvas* canvas, const WebRect& rect)
{
- WebScrollbarThemeClientImpl client(scrollbar);
PlatformContextSkia platformContext(canvas);
platformContext.setDrawingToImageBuffer(true);
GraphicsContext context(&platformContext);
- m_theme->paintButton(&context, &client, IntRect(rect), WebCore::ForwardButtonStartPart);
+ m_theme->paintButton(&context, m_scrollbar, IntRect(rect), WebCore::ForwardButtonStartPart);
}
-void WebScrollbarThemePainter::paintForwardButtonEnd(WebCanvas* canvas, WebScrollbar* scrollbar, const WebRect& rect)
+void WebScrollbarThemePainter::paintForwardButtonEnd(WebCanvas* canvas, const WebRect& rect)
{
- WebScrollbarThemeClientImpl client(scrollbar);
PlatformContextSkia platformContext(canvas);
platformContext.setDrawingToImageBuffer(true);
GraphicsContext context(&platformContext);
- m_theme->paintButton(&context, &client, IntRect(rect), WebCore::ForwardButtonEndPart);
+ m_theme->paintButton(&context, m_scrollbar, IntRect(rect), WebCore::ForwardButtonEndPart);
}
-void WebScrollbarThemePainter::paintTickmarks(WebCanvas* canvas, WebScrollbar* scrollbar, const WebRect& rect)
+void WebScrollbarThemePainter::paintTickmarks(WebCanvas* canvas, const WebRect& rect)
{
- WebScrollbarThemeClientImpl client(scrollbar);
PlatformContextSkia platformContext(canvas);
platformContext.setDrawingToImageBuffer(true);
GraphicsContext context(&platformContext);
- m_theme->paintTickmarks(&context, &client, IntRect(rect));
+ m_theme->paintTickmarks(&context, m_scrollbar, IntRect(rect));
}
-void WebScrollbarThemePainter::paintThumb(WebCanvas* canvas, WebScrollbar* scrollbar, const WebRect& rect)
+void WebScrollbarThemePainter::paintThumb(WebCanvas* canvas, const WebRect& rect)
{
- WebScrollbarThemeClientImpl client(scrollbar);
PlatformContextSkia platformContext(canvas);
platformContext.setDrawingToImageBuffer(true);
GraphicsContext context(&platformContext);
- m_theme->paintThumb(&context, &client, IntRect(rect));
+ m_theme->paintThumb(&context, m_scrollbar, IntRect(rect));
}
-WebScrollbarThemePainter::WebScrollbarThemePainter(WebCore::ScrollbarThemeComposite* theme)
+WebScrollbarThemePainter::WebScrollbarThemePainter(WebCore::ScrollbarThemeComposite* theme, WebCore::Scrollbar* scrollbar)
: m_theme(theme)
+ , m_scrollbar(scrollbar)
{
}
Modified: trunk/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp (125129 => 125130)
--- trunk/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp 2012-08-09 01:02:07 UTC (rev 125129)
+++ trunk/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp 2012-08-09 01:04:31 UTC (rev 125130)
@@ -99,7 +99,7 @@
DebugScopedSetImplThread impl;
RefPtr<MockScrollbar> mockScrollbar = adoptRef(new MockScrollbar);
- WebKit::WebScrollbarThemePainter painter(0);
+ WebKit::WebScrollbarThemePainter painter(0, mockScrollbar.get());
Settings::setMockScrollbarsEnabled(true);
{
@@ -142,7 +142,7 @@
DebugScopedSetImplThread impl;
RefPtr<MockScrollbar> mockScrollbar = adoptRef(new MockScrollbar);
- WebKit::WebScrollbarThemePainter painter(0);
+ WebKit::WebScrollbarThemePainter painter(0, mockScrollbar.get());
Settings::setMockScrollbarsEnabled(true);