Title: [126791] trunk/Source
Revision
126791
Author
[email protected]
Date
2012-08-27 13:48:57 -0700 (Mon, 27 Aug 2012)

Log Message

[chromium] Prevent scrollbar thumb size from changing during compositor zoom
https://bugs.webkit.org/show_bug.cgi?id=94859

Reviewed by James Robinson.

Source/WebCore:

During a pinch zoom, the total size of a scrollable area will change,
causing the thumb to become a different size. This will cause the
thumb texture (painted at a specific size) to stretch. To fix this,
add a new CCScrollbarGeometryFixedThumb class which behaves just like
a normal WebScrollbarThemeGeometry class, but constrains the thumb to
be a fixed size.

* WebCore.gypi:
* platform/graphics/chromium/ScrollbarLayerChromium.cpp:
(WebCore::ScrollbarLayerChromium::pushPropertiesTo):
* platform/graphics/chromium/cc/CCScrollbarGeometryFixedThumb.cpp: Added.
(WebCore):
(WebCore::CCScrollbarGeometryFixedThumb::create):
(WebCore::CCScrollbarGeometryFixedThumb::~CCScrollbarGeometryFixedThumb):
(WebCore::CCScrollbarGeometryFixedThumb::update):
(WebCore::CCScrollbarGeometryFixedThumb::clone):
(WebCore::CCScrollbarGeometryFixedThumb::thumbLength):
(WebCore::CCScrollbarGeometryFixedThumb::thumbPosition):
(WebCore::CCScrollbarGeometryFixedThumb::splitTrack):
(WebCore::CCScrollbarGeometryFixedThumb::CCScrollbarGeometryFixedThumb):
* platform/graphics/chromium/cc/CCScrollbarGeometryFixedThumb.h: Added.
(WebCore):
(CCScrollbarGeometryFixedThumb):
* platform/graphics/chromium/cc/CCScrollbarGeometryStub.cpp: Added.
(WebCore):
(WebCore::CCScrollbarGeometryStub::CCScrollbarGeometryStub):
(WebCore::CCScrollbarGeometryStub::~CCScrollbarGeometryStub):
(WebCore::CCScrollbarGeometryStub::clone):
(WebCore::CCScrollbarGeometryStub::thumbPosition):
(WebCore::CCScrollbarGeometryStub::thumbLength):
(WebCore::CCScrollbarGeometryStub::trackPosition):
(WebCore::CCScrollbarGeometryStub::trackLength):
(WebCore::CCScrollbarGeometryStub::hasButtons):
(WebCore::CCScrollbarGeometryStub::hasThumb):
(WebCore::CCScrollbarGeometryStub::trackRect):
(WebCore::CCScrollbarGeometryStub::thumbRect):
(WebCore::CCScrollbarGeometryStub::minimumThumbLength):
(WebCore::CCScrollbarGeometryStub::scrollbarThickness):
(WebCore::CCScrollbarGeometryStub::backButtonStartRect):
(WebCore::CCScrollbarGeometryStub::backButtonEndRect):
(WebCore::CCScrollbarGeometryStub::forwardButtonStartRect):
(WebCore::CCScrollbarGeometryStub::forwardButtonEndRect):
(WebCore::CCScrollbarGeometryStub::constrainTrackRectToTrackPieces):
(WebCore::CCScrollbarGeometryStub::splitTrack):
* platform/graphics/chromium/cc/CCScrollbarGeometryStub.h: Added.
(WebCore):
(CCScrollbarGeometryStub):
(WebCore::CCScrollbarGeometryStub::update):
* platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp:
(WebCore::CCScrollbarLayerImpl::setScrollbarGeometry):
(WebCore::CCScrollbarLayerImpl::setScrollbarData):
* platform/graphics/chromium/cc/CCScrollbarLayerImpl.h:
(WebCore::CCScrollbarLayerImpl::scrollbarGeometry):
(CCScrollbarLayerImpl):

Source/WebKit/chromium:

Update test.

* tests/CCLayerTreeHostImplTest.cpp:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126790 => 126791)


--- trunk/Source/WebCore/ChangeLog	2012-08-27 20:46:43 UTC (rev 126790)
+++ trunk/Source/WebCore/ChangeLog	2012-08-27 20:48:57 UTC (rev 126791)
@@ -1,3 +1,65 @@
+2012-08-27  Adrienne Walker  <[email protected]>
+
+        [chromium] Prevent scrollbar thumb size from changing during compositor zoom
+        https://bugs.webkit.org/show_bug.cgi?id=94859
+
+        Reviewed by James Robinson.
+
+        During a pinch zoom, the total size of a scrollable area will change,
+        causing the thumb to become a different size. This will cause the
+        thumb texture (painted at a specific size) to stretch. To fix this,
+        add a new CCScrollbarGeometryFixedThumb class which behaves just like
+        a normal WebScrollbarThemeGeometry class, but constrains the thumb to
+        be a fixed size.
+
+        * WebCore.gypi:
+        * platform/graphics/chromium/ScrollbarLayerChromium.cpp:
+        (WebCore::ScrollbarLayerChromium::pushPropertiesTo):
+        * platform/graphics/chromium/cc/CCScrollbarGeometryFixedThumb.cpp: Added.
+        (WebCore):
+        (WebCore::CCScrollbarGeometryFixedThumb::create):
+        (WebCore::CCScrollbarGeometryFixedThumb::~CCScrollbarGeometryFixedThumb):
+        (WebCore::CCScrollbarGeometryFixedThumb::update):
+        (WebCore::CCScrollbarGeometryFixedThumb::clone):
+        (WebCore::CCScrollbarGeometryFixedThumb::thumbLength):
+        (WebCore::CCScrollbarGeometryFixedThumb::thumbPosition):
+        (WebCore::CCScrollbarGeometryFixedThumb::splitTrack):
+        (WebCore::CCScrollbarGeometryFixedThumb::CCScrollbarGeometryFixedThumb):
+        * platform/graphics/chromium/cc/CCScrollbarGeometryFixedThumb.h: Added.
+        (WebCore):
+        (CCScrollbarGeometryFixedThumb):
+        * platform/graphics/chromium/cc/CCScrollbarGeometryStub.cpp: Added.
+        (WebCore):
+        (WebCore::CCScrollbarGeometryStub::CCScrollbarGeometryStub):
+        (WebCore::CCScrollbarGeometryStub::~CCScrollbarGeometryStub):
+        (WebCore::CCScrollbarGeometryStub::clone):
+        (WebCore::CCScrollbarGeometryStub::thumbPosition):
+        (WebCore::CCScrollbarGeometryStub::thumbLength):
+        (WebCore::CCScrollbarGeometryStub::trackPosition):
+        (WebCore::CCScrollbarGeometryStub::trackLength):
+        (WebCore::CCScrollbarGeometryStub::hasButtons):
+        (WebCore::CCScrollbarGeometryStub::hasThumb):
+        (WebCore::CCScrollbarGeometryStub::trackRect):
+        (WebCore::CCScrollbarGeometryStub::thumbRect):
+        (WebCore::CCScrollbarGeometryStub::minimumThumbLength):
+        (WebCore::CCScrollbarGeometryStub::scrollbarThickness):
+        (WebCore::CCScrollbarGeometryStub::backButtonStartRect):
+        (WebCore::CCScrollbarGeometryStub::backButtonEndRect):
+        (WebCore::CCScrollbarGeometryStub::forwardButtonStartRect):
+        (WebCore::CCScrollbarGeometryStub::forwardButtonEndRect):
+        (WebCore::CCScrollbarGeometryStub::constrainTrackRectToTrackPieces):
+        (WebCore::CCScrollbarGeometryStub::splitTrack):
+        * platform/graphics/chromium/cc/CCScrollbarGeometryStub.h: Added.
+        (WebCore):
+        (CCScrollbarGeometryStub):
+        (WebCore::CCScrollbarGeometryStub::update):
+        * platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp:
+        (WebCore::CCScrollbarLayerImpl::setScrollbarGeometry):
+        (WebCore::CCScrollbarLayerImpl::setScrollbarData):
+        * platform/graphics/chromium/cc/CCScrollbarLayerImpl.h:
+        (WebCore::CCScrollbarLayerImpl::scrollbarGeometry):
+        (CCScrollbarLayerImpl):
+
 2012-08-27  Dana Jansens  <[email protected]>
 
         [chromium] Have RenderSurface create and add its own generated RenderPass

Modified: trunk/Source/WebCore/WebCore.gypi (126790 => 126791)


--- trunk/Source/WebCore/WebCore.gypi	2012-08-27 20:46:43 UTC (rev 126790)
+++ trunk/Source/WebCore/WebCore.gypi	2012-08-27 20:48:57 UTC (rev 126791)
@@ -8497,6 +8497,10 @@
             'platform/graphics/chromium/cc/CCScrollbarAnimationControllerLinearFade.h',
             'platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp',
             'platform/graphics/chromium/cc/CCScrollbarLayerImpl.h',
+            'platform/graphics/chromium/cc/CCScrollbarGeometryFixedThumb.cpp',
+            'platform/graphics/chromium/cc/CCScrollbarGeometryFixedThumb.h',
+            'platform/graphics/chromium/cc/CCScrollbarGeometryStub.cpp',
+            'platform/graphics/chromium/cc/CCScrollbarGeometryStub.h',
             'platform/graphics/chromium/cc/CCSettings.cpp',
             'platform/graphics/chromium/cc/CCSettings.h',
             'platform/graphics/chromium/cc/CCSharedQuadState.cpp',

Modified: trunk/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp (126790 => 126791)


--- trunk/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp	2012-08-27 20:46:43 UTC (rev 126790)
+++ trunk/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp	2012-08-27 20:48:57 UTC (rev 126791)
@@ -65,7 +65,7 @@
     CCScrollbarLayerImpl* scrollbarLayer = static_cast<CCScrollbarLayerImpl*>(layer);
 
     if (!scrollbarLayer->scrollbarGeometry())
-        scrollbarLayer->setScrollbarGeometry(adoptPtr(m_geometry->clone()));
+        scrollbarLayer->setScrollbarGeometry(CCScrollbarGeometryFixedThumb::create(adoptPtr(m_geometry->clone())));
 
     scrollbarLayer->setScrollbarData(m_scrollbar.get());
 

Added: trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarGeometryFixedThumb.cpp (0 => 126791)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarGeometryFixedThumb.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarGeometryFixedThumb.cpp	2012-08-27 20:48:57 UTC (rev 126791)
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2012 Google 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 AND ITS CONTRIBUTORS "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 OR ITS 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 "CCScrollbarGeometryFixedThumb.h"
+
+#include <public/WebRect.h>
+#include <public/WebScrollbar.h>
+
+using WebKit::WebRect;
+using WebKit::WebScrollbar;
+using WebKit::WebScrollbarThemeGeometry;
+
+namespace WebCore {
+
+PassOwnPtr<CCScrollbarGeometryFixedThumb> CCScrollbarGeometryFixedThumb::create(PassOwnPtr<WebScrollbarThemeGeometry> geometry)
+{
+    return adoptPtr(new CCScrollbarGeometryFixedThumb(geometry));
+}
+
+CCScrollbarGeometryFixedThumb::~CCScrollbarGeometryFixedThumb()
+{
+}
+
+void CCScrollbarGeometryFixedThumb::update(WebScrollbar* scrollbar)
+{
+    int length = CCScrollbarGeometryStub::thumbLength(scrollbar);
+
+    if (scrollbar->orientation() == WebScrollbar::Horizontal)
+        m_thumbSize = IntSize(length, scrollbar->size().height);
+    else
+        m_thumbSize = IntSize(scrollbar->size().width, length);
+}
+
+WebScrollbarThemeGeometry* CCScrollbarGeometryFixedThumb::clone() const
+{
+    CCScrollbarGeometryFixedThumb* geometry = new CCScrollbarGeometryFixedThumb(adoptPtr(CCScrollbarGeometryStub::clone()));
+    geometry->m_thumbSize = m_thumbSize;
+    return geometry;
+}
+
+int CCScrollbarGeometryFixedThumb::thumbLength(WebScrollbar* scrollbar)
+{
+    if (scrollbar->orientation() == WebScrollbar::Horizontal)
+        return m_thumbSize.width();
+    return m_thumbSize.height();
+}
+
+int CCScrollbarGeometryFixedThumb::thumbPosition(WebScrollbar* scrollbar)
+{
+    if (scrollbar->enabled()) {
+        float size = scrollbar->maximum();
+        if (!size)
+            return 1;
+        int value = std::min(std::max(0, scrollbar->value()), scrollbar->maximum());
+        float pos = (trackLength(scrollbar) - thumbLength(scrollbar)) * value / size;
+        return static_cast<int>(floorf((pos < 1 && pos > 0) ? 1 : pos));
+    }
+    return 0;
+}
+void CCScrollbarGeometryFixedThumb::splitTrack(WebScrollbar* scrollbar, const WebRect& unconstrainedTrackRect, WebRect& beforeThumbRect, WebRect& thumbRect, WebRect& afterThumbRect)
+{
+    // This is a reimplementation of ScrollbarThemeComposite::splitTrack.
+    // Because the WebScrollbarThemeGeometry functions call down to native
+    // ScrollbarThemeComposite code which uses ScrollbarThemeComposite virtual
+    // helpers, there's no way to override a helper like thumbLength from
+    // the WebScrollbarThemeGeometry level. So, these three functions
+    // (splitTrack, thumbPosition, thumbLength) are copied here so that the
+    // WebScrollbarThemeGeometry helper functions are used instead and
+    // a fixed size thumbLength can be used.
+
+    WebRect trackRect = constrainTrackRectToTrackPieces(scrollbar, unconstrainedTrackRect);
+    int thickness = scrollbar->orientation() == WebScrollbar::Horizontal ? scrollbar->size().height : scrollbar->size().width;
+    int thumbPos = thumbPosition(scrollbar);
+    if (scrollbar->orientation() == WebScrollbar::Horizontal) {
+        thumbRect = WebRect(trackRect.x + thumbPos, trackRect.y + (trackRect.height - thickness) / 2, thumbLength(scrollbar), thickness);
+        beforeThumbRect = WebRect(trackRect.x, trackRect.y, thumbPos + thumbRect.width / 2, trackRect.height);
+        afterThumbRect = WebRect(trackRect.x + beforeThumbRect.width, trackRect.y, trackRect.x + trackRect.width - beforeThumbRect.x - beforeThumbRect.width, trackRect.height);
+    } else {
+        thumbRect = WebRect(trackRect.x + (trackRect.width - thickness) / 2, trackRect.y + thumbPos, thickness, thumbLength(scrollbar));
+        beforeThumbRect = WebRect(trackRect.x, trackRect.y, trackRect.width, thumbPos + thumbRect.height / 2);
+        afterThumbRect = WebRect(trackRect.x, trackRect.y + beforeThumbRect.height, trackRect.width, trackRect.y + trackRect.height - beforeThumbRect.y - beforeThumbRect.height);
+    }
+}
+
+CCScrollbarGeometryFixedThumb::CCScrollbarGeometryFixedThumb(PassOwnPtr<WebScrollbarThemeGeometry> geometry)
+    : CCScrollbarGeometryStub(geometry)
+{
+}
+
+}

Added: trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarGeometryFixedThumb.h (0 => 126791)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarGeometryFixedThumb.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarGeometryFixedThumb.h	2012-08-27 20:48:57 UTC (rev 126791)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2012 Google 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 AND ITS CONTRIBUTORS "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 OR ITS 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 CCScrollbarGeometryFixedThumb_h
+#define CCScrollbarGeometryFixedThumb_h
+
+#include "CCScrollbarGeometryStub.h"
+
+namespace WebCore {
+
+// This scrollbar geometry class behaves exactly like a normal geometry except
+// it always returns a fixed thumb length. This allows a page to zoom (changing
+// the total size of the scrollable area, changing the thumb length) while not
+// requiring the thumb resource to be repainted.
+class CCScrollbarGeometryFixedThumb : public CCScrollbarGeometryStub {
+public:
+    static PassOwnPtr<CCScrollbarGeometryFixedThumb> create(PassOwnPtr<WebKit::WebScrollbarThemeGeometry>);
+    virtual ~CCScrollbarGeometryFixedThumb();
+
+    // Update thumb length from scrollbar
+    void update(WebKit::WebScrollbar*) OVERRIDE;
+
+    // WebScrollbarThemeGeometry interface
+    virtual WebKit::WebScrollbarThemeGeometry* clone() const OVERRIDE;
+    virtual int thumbLength(WebKit::WebScrollbar*) OVERRIDE;
+    virtual int thumbPosition(WebKit::WebScrollbar*) OVERRIDE;
+    virtual void splitTrack(WebKit::WebScrollbar*, const WebKit::WebRect& track, WebKit::WebRect& startTrack, WebKit::WebRect& thumb, WebKit::WebRect& endTrack) OVERRIDE;
+
+private:
+    explicit CCScrollbarGeometryFixedThumb(PassOwnPtr<WebKit::WebScrollbarThemeGeometry>);
+
+    IntSize m_thumbSize;
+};
+
+}
+
+#endif

Added: trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarGeometryStub.cpp (0 => 126791)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarGeometryStub.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarGeometryStub.cpp	2012-08-27 20:48:57 UTC (rev 126791)
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2012 Google 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 AND ITS CONTRIBUTORS "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 OR ITS 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 "CCScrollbarGeometryStub.h"
+
+using WebKit::WebRect;
+using WebKit::WebScrollbar;
+using WebKit::WebScrollbarThemeGeometry;
+
+namespace WebCore {
+
+CCScrollbarGeometryStub::CCScrollbarGeometryStub(PassOwnPtr<WebScrollbarThemeGeometry> geometry)
+    : m_geometry(geometry)
+{
+}
+
+CCScrollbarGeometryStub::~CCScrollbarGeometryStub()
+{
+}
+
+WebScrollbarThemeGeometry* CCScrollbarGeometryStub::clone() const
+{
+    return m_geometry->clone();
+}
+
+int CCScrollbarGeometryStub::thumbPosition(WebScrollbar* scrollbar)
+{
+    return m_geometry->thumbPosition(scrollbar);
+}
+
+int CCScrollbarGeometryStub::thumbLength(WebScrollbar* scrollbar)
+{
+    return m_geometry->thumbLength(scrollbar);
+}
+
+int CCScrollbarGeometryStub::trackPosition(WebScrollbar* scrollbar)
+{
+    return m_geometry->trackPosition(scrollbar);
+}
+
+int CCScrollbarGeometryStub::trackLength(WebScrollbar* scrollbar)
+{
+    return m_geometry->trackLength(scrollbar);
+}
+
+bool CCScrollbarGeometryStub::hasButtons(WebScrollbar* scrollbar)
+{
+    return m_geometry->hasButtons(scrollbar);
+}
+
+bool CCScrollbarGeometryStub::hasThumb(WebScrollbar* scrollbar)
+{
+    return m_geometry->hasThumb(scrollbar);
+}
+
+WebRect CCScrollbarGeometryStub::trackRect(WebScrollbar* scrollbar)
+{
+    return m_geometry->trackRect(scrollbar);
+}
+
+WebRect CCScrollbarGeometryStub::thumbRect(WebScrollbar* scrollbar)
+{
+    return m_geometry->thumbRect(scrollbar);
+}
+
+int CCScrollbarGeometryStub::minimumThumbLength(WebScrollbar* scrollbar)
+{
+    return m_geometry->minimumThumbLength(scrollbar);
+}
+
+int CCScrollbarGeometryStub::scrollbarThickness(WebScrollbar* scrollbar)
+{
+    return m_geometry->scrollbarThickness(scrollbar);
+}
+
+WebRect CCScrollbarGeometryStub::backButtonStartRect(WebScrollbar* scrollbar)
+{
+    return m_geometry->backButtonStartRect(scrollbar);
+}
+
+WebRect CCScrollbarGeometryStub::backButtonEndRect(WebScrollbar* scrollbar)
+{
+    return m_geometry->backButtonEndRect(scrollbar);
+}
+
+WebRect CCScrollbarGeometryStub::forwardButtonStartRect(WebScrollbar* scrollbar)
+{
+    return m_geometry->forwardButtonStartRect(scrollbar);
+}
+
+WebRect CCScrollbarGeometryStub::forwardButtonEndRect(WebScrollbar* scrollbar)
+{
+    return m_geometry->forwardButtonEndRect(scrollbar);
+}
+
+WebRect CCScrollbarGeometryStub::constrainTrackRectToTrackPieces(WebScrollbar* scrollbar, const WebRect& rect)
+{
+    return m_geometry->constrainTrackRectToTrackPieces(scrollbar, rect);
+}
+
+void CCScrollbarGeometryStub::splitTrack(WebScrollbar* scrollbar, const WebRect& unconstrainedTrackRect, WebRect& beforeThumbRect, WebRect& thumbRect, WebRect& afterThumbRect)
+{
+    m_geometry->splitTrack(scrollbar, unconstrainedTrackRect, beforeThumbRect, thumbRect, afterThumbRect);
+}
+
+}

Added: trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarGeometryStub.h (0 => 126791)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarGeometryStub.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarGeometryStub.h	2012-08-27 20:48:57 UTC (rev 126791)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2012 Google 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 AND ITS CONTRIBUTORS "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 OR ITS 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 CCScrollbarGeometryStub_h
+#define CCScrollbarGeometryStub_h
+
+#include <public/WebScrollbarThemeGeometry.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+// This subclass wraps an existing scrollbar geometry class so that
+// another class can derive from it and override specific functions, while
+// passing through the remaining ones.
+class CCScrollbarGeometryStub : public WebKit::WebScrollbarThemeGeometry {
+public:
+    virtual ~CCScrollbarGeometryStub();
+
+    // Allow derived classes to update themselves from a scrollbar.
+    void update(WebKit::WebScrollbar*) { }
+
+    // WebScrollbarThemeGeometry interface
+    virtual WebKit::WebScrollbarThemeGeometry* clone() const OVERRIDE;
+    virtual int thumbPosition(WebKit::WebScrollbar*) OVERRIDE;
+    virtual int thumbLength(WebKit::WebScrollbar*) OVERRIDE;
+    virtual int trackPosition(WebKit::WebScrollbar*) OVERRIDE;
+    virtual int trackLength(WebKit::WebScrollbar*) OVERRIDE;
+    virtual bool hasButtons(WebKit::WebScrollbar*) OVERRIDE;
+    virtual bool hasThumb(WebKit::WebScrollbar*) OVERRIDE;
+    virtual WebKit::WebRect trackRect(WebKit::WebScrollbar*) OVERRIDE;
+    virtual WebKit::WebRect thumbRect(WebKit::WebScrollbar*) OVERRIDE;
+    virtual int minimumThumbLength(WebKit::WebScrollbar*) OVERRIDE;
+    virtual int scrollbarThickness(WebKit::WebScrollbar*) OVERRIDE;
+    virtual WebKit::WebRect backButtonStartRect(WebKit::WebScrollbar*) OVERRIDE;
+    virtual WebKit::WebRect backButtonEndRect(WebKit::WebScrollbar*) OVERRIDE;
+    virtual WebKit::WebRect forwardButtonStartRect(WebKit::WebScrollbar*) OVERRIDE;
+    virtual WebKit::WebRect forwardButtonEndRect(WebKit::WebScrollbar*) OVERRIDE;
+    virtual WebKit::WebRect constrainTrackRectToTrackPieces(WebKit::WebScrollbar*, const WebKit::WebRect&) OVERRIDE;
+    virtual void splitTrack(WebKit::WebScrollbar*, const WebKit::WebRect& track, WebKit::WebRect& startTrack, WebKit::WebRect& thumb, WebKit::WebRect& endTrack) OVERRIDE;
+
+protected:
+    explicit CCScrollbarGeometryStub(PassOwnPtr<WebKit::WebScrollbarThemeGeometry>);
+
+private:
+    OwnPtr<WebKit::WebScrollbarThemeGeometry> m_geometry;
+};
+
+}
+
+#endif

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp (126790 => 126791)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp	2012-08-27 20:46:43 UTC (rev 126790)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp	2012-08-27 20:48:57 UTC (rev 126791)
@@ -62,12 +62,12 @@
 {
 }
 
-void CCScrollbarLayerImpl::setScrollbarGeometry(PassOwnPtr<WebKit::WebScrollbarThemeGeometry> geometry)
+void CCScrollbarLayerImpl::setScrollbarGeometry(PassOwnPtr<CCScrollbarGeometryFixedThumb> geometry)
 {
     m_geometry = geometry;
 }
 
-void CCScrollbarLayerImpl::setScrollbarData(const WebScrollbar* scrollbar)
+void CCScrollbarLayerImpl::setScrollbarData(WebScrollbar* scrollbar)
 {
     m_scrollbarOverlayStyle = scrollbar->scrollbarOverlayStyle();
     m_orientation = scrollbar->orientation();
@@ -81,6 +81,8 @@
     m_isOverlayScrollbar = scrollbar->isOverlay();
 
     scrollbar->getTickmarks(m_tickmarks);
+
+    m_geometry->update(scrollbar);
 }
 
 static FloatRect toUVRect(const WebRect& r, const IntRect& bounds)

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h (126790 => 126791)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h	2012-08-27 20:46:43 UTC (rev 126790)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h	2012-08-27 20:48:57 UTC (rev 126791)
@@ -29,9 +29,9 @@
 #if USE(ACCELERATED_COMPOSITING)
 
 #include "CCLayerImpl.h"
+#include "CCScrollbarGeometryFixedThumb.h"
 #include <public/WebRect.h>
 #include <public/WebScrollbar.h>
-#include <public/WebScrollbarThemeGeometry.h>
 #include <public/WebVector.h>
 
 namespace WebCore {
@@ -42,9 +42,9 @@
 public:
     static PassOwnPtr<CCScrollbarLayerImpl> create(int id);
 
-    WebKit::WebScrollbarThemeGeometry* scrollbarGeometry() const { return m_geometry.get(); }
-    void setScrollbarGeometry(PassOwnPtr<WebKit::WebScrollbarThemeGeometry>);
-    void setScrollbarData(const WebKit::WebScrollbar*);
+    CCScrollbarGeometryFixedThumb* scrollbarGeometry() const { return m_geometry.get(); }
+    void setScrollbarGeometry(PassOwnPtr<CCScrollbarGeometryFixedThumb>);
+    void setScrollbarData(WebKit::WebScrollbar*);
 
     void setBackTrackResourceId(CCResourceProvider::ResourceId id) { m_backTrackResourceId = id; }
     void setForeTrackResourceId(CCResourceProvider::ResourceId id) { m_foreTrackResourceId = id; }
@@ -103,7 +103,7 @@
     CCResourceProvider::ResourceId m_foreTrackResourceId;
     CCResourceProvider::ResourceId m_thumbResourceId;
 
-    OwnPtr<WebKit::WebScrollbarThemeGeometry> m_geometry;
+    OwnPtr<CCScrollbarGeometryFixedThumb> m_geometry;
 
     // Data to implement CCScrollbar
     WebKit::WebScrollbar::ScrollbarOverlayStyle m_scrollbarOverlayStyle;

Modified: trunk/Source/WebKit/chromium/ChangeLog (126790 => 126791)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-08-27 20:46:43 UTC (rev 126790)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-08-27 20:48:57 UTC (rev 126791)
@@ -1,3 +1,14 @@
+2012-08-27  Adrienne Walker  <[email protected]>
+
+        [chromium] Prevent scrollbar thumb size from changing during compositor zoom
+        https://bugs.webkit.org/show_bug.cgi?id=94859
+
+        Reviewed by James Robinson.
+
+        Update test.
+
+        * tests/CCLayerTreeHostImplTest.cpp:
+
 2012-08-27  Dana Jansens  <[email protected]>
 
         [chromium] Have RenderSurface create and add its own generated RenderPass

Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp (126790 => 126791)


--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp	2012-08-27 20:46:43 UTC (rev 126790)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp	2012-08-27 20:48:57 UTC (rev 126791)
@@ -36,6 +36,7 @@
 #include "CCQuadCuller.h"
 #include "CCRenderPassDrawQuad.h"
 #include "CCRendererGL.h"
+#include "CCScrollbarGeometryFixedThumb.h"
 #include "CCScrollbarLayerImpl.h"
 #include "CCSettings.h"
 #include "CCSingleThreadProxy.h"
@@ -2416,7 +2417,7 @@
         IntSize size(10, 10);
         GC3Denum format = GraphicsContext3D::RGBA;
         CCResourceProvider::TextureUsageHint hint = CCResourceProvider::TextureUsageAny;
-        setScrollbarGeometry(FakeWebScrollbarThemeGeometryNonEmpty::create());
+        setScrollbarGeometry(CCScrollbarGeometryFixedThumb::create(FakeWebScrollbarThemeGeometryNonEmpty::create()));
 
         setBackTrackResourceId(provider->createResource(pool, size, format, hint));
         setForeTrackResourceId(provider->createResource(pool, size, format, hint));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to