Title: [105006] trunk/Source/WebCore
Revision
105006
Author
[email protected]
Date
2012-01-13 15:58:22 -0800 (Fri, 13 Jan 2012)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=71230
Clicking where the overlay scroll track would be should not scroll the page
-and corresponding-
<rdar://problem/9585424>

Reviewed by Alexey Proskuryakov.

These new functions indicate whether the scrollbar should participate in hit 
testing. Non-overlay scrollbars always should, so they return true. Overlay 
scrollbars consult the animator, which checks the current alpha. 
* platform/ScrollAnimator.h:
(WebCore::ScrollAnimator::shouldScrollbarParticipateInHitTesting):
* platform/Scrollbar.cpp:
(WebCore::Scrollbar:: shouldParticipateInHitTesting):
* platform/Scrollbar.h:
* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac:: shouldScrollbarParticipateInHitTesting):

In these hit-testing functions, only hit-test when the scrollbar should 
participate.
* platform/ScrollView.cpp:
(WebCore::ScrollView::scrollbarAtPoint):
* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::nodeAtPoint):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hitTestOverflowControls):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::isPointInOverflowControl):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (105005 => 105006)


--- trunk/Source/WebCore/ChangeLog	2012-01-13 23:56:26 UTC (rev 105005)
+++ trunk/Source/WebCore/ChangeLog	2012-01-13 23:58:22 UTC (rev 105006)
@@ -1,3 +1,35 @@
+2012-01-13  Beth Dakin  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=71230
+        Clicking where the overlay scroll track would be should not scroll the page
+        -and corresponding-
+        <rdar://problem/9585424>
+
+        Reviewed by Alexey Proskuryakov.
+
+        These new functions indicate whether the scrollbar should participate in hit 
+        testing. Non-overlay scrollbars always should, so they return true. Overlay 
+        scrollbars consult the animator, which checks the current alpha. 
+        * platform/ScrollAnimator.h:
+        (WebCore::ScrollAnimator::shouldScrollbarParticipateInHitTesting):
+        * platform/Scrollbar.cpp:
+        (WebCore::Scrollbar:: shouldParticipateInHitTesting):
+        * platform/Scrollbar.h:
+        * platform/mac/ScrollAnimatorMac.h:
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::ScrollAnimatorMac:: shouldScrollbarParticipateInHitTesting):
+
+        In these hit-testing functions, only hit-test when the scrollbar should 
+        participate.
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::scrollbarAtPoint):
+        * rendering/RenderEmbeddedObject.cpp:
+        (WebCore::RenderEmbeddedObject::nodeAtPoint):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::hitTestOverflowControls):
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::isPointInOverflowControl):
+
 2012-01-13  Dan Bernstein  <[email protected]>
 
         REGRESSION: svg/custom/use-instanceRoot-event-listeners.xhtml & svg/custom/pointer-events-invalid-fill.svg broken on the Bots

Modified: trunk/Source/WebCore/platform/ScrollAnimator.h (105005 => 105006)


--- trunk/Source/WebCore/platform/ScrollAnimator.h	2012-01-13 23:56:26 UTC (rev 105005)
+++ trunk/Source/WebCore/platform/ScrollAnimator.h	2012-01-13 23:58:22 UTC (rev 105006)
@@ -96,6 +96,8 @@
     virtual void resetZoom();
     virtual void setZoomParametersForTest(float, float, float);
 
+    virtual bool shouldScrollbarParticipateInHitTesting(Scrollbar*) { return true; }
+
 protected:
     ScrollAnimator(ScrollableArea*);
 

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (105005 => 105006)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2012-01-13 23:56:26 UTC (rev 105005)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2012-01-13 23:58:22 UTC (rev 105006)
@@ -828,9 +828,9 @@
         return 0;
 
     IntPoint viewPoint = convertFromContainingWindow(windowPoint);
-    if (m_horizontalScrollbar && m_horizontalScrollbar->frameRect().contains(viewPoint))
+    if (m_horizontalScrollbar && m_horizontalScrollbar->shouldParticipateInHitTesting() && m_horizontalScrollbar->frameRect().contains(viewPoint))
         return m_horizontalScrollbar.get();
-    if (m_verticalScrollbar && m_verticalScrollbar->frameRect().contains(viewPoint))
+    if (m_verticalScrollbar && m_verticalScrollbar->shouldParticipateInHitTesting() && m_verticalScrollbar->frameRect().contains(viewPoint))
         return m_verticalScrollbar.get();
     return 0;
 }

Modified: trunk/Source/WebCore/platform/Scrollbar.cpp (105005 => 105006)


--- trunk/Source/WebCore/platform/Scrollbar.cpp	2012-01-13 23:56:26 UTC (rev 105005)
+++ trunk/Source/WebCore/platform/Scrollbar.cpp	2012-01-13 23:58:22 UTC (rev 105006)
@@ -487,6 +487,14 @@
     return m_theme->usesOverlayScrollbars();
 }
 
+bool Scrollbar::shouldParticipateInHitTesting()
+{
+    // Non-overlay scrollbars should always participate in hit testing.
+    if (!isOverlayScrollbar())
+        return true;
+    return m_scrollableArea->scrollAnimator()->shouldScrollbarParticipateInHitTesting(this);
+}
+
 bool Scrollbar::isWindowActive() const
 {
     return m_scrollableArea && m_scrollableArea->isActive();

Modified: trunk/Source/WebCore/platform/Scrollbar.h (105005 => 105006)


--- trunk/Source/WebCore/platform/Scrollbar.h	2012-01-13 23:56:26 UTC (rev 105005)
+++ trunk/Source/WebCore/platform/Scrollbar.h	2012-01-13 23:58:22 UTC (rev 105006)
@@ -87,6 +87,7 @@
     virtual void setEnabled(bool e);
 
     virtual bool isOverlayScrollbar() const;
+    bool shouldParticipateInHitTesting();
 
     bool isWindowActive() const;
 

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h (105005 => 105006)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2012-01-13 23:56:26 UTC (rev 105005)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2012-01-13 23:58:22 UTC (rev 105006)
@@ -118,6 +118,8 @@
     virtual void didAddHorizontalScrollbar(Scrollbar*);
     virtual void willRemoveHorizontalScrollbar(Scrollbar*);
 
+    virtual bool shouldScrollbarParticipateInHitTesting(Scrollbar*);
+
     float adjustScrollXPositionIfNecessary(float) const;
     float adjustScrollYPositionIfNecessary(float) const;
     FloatPoint adjustScrollPositionIfNecessary(const FloatPoint&) const;

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (105005 => 105006)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2012-01-13 23:56:26 UTC (rev 105005)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2012-01-13 23:58:22 UTC (rev 105006)
@@ -863,6 +863,22 @@
     }
 }
 
+bool ScrollAnimatorMac::shouldScrollbarParticipateInHitTesting(Scrollbar* scrollbar)
+{
+    // Non-overlay scrollbars should always participate in hit testing.
+    if (recommendedScrollerStyle() != NSScrollerStyleOverlay)
+        return true;
+
+    if (!isScrollbarOverlayAPIAvailable())
+        return true;
+
+    // Overlay scrollbars should participate in hit testing whenever they are at all visible.
+    ScrollbarPainter painter = scrollbarPainterForScrollbar(scrollbar);
+    if (!painter)
+        return false;
+    return [painter knobAlpha] > 0;
+}
+
 void ScrollAnimatorMac::cancelAnimations()
 {
     m_haveScrolledSincePageLoad = false;

Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (105005 => 105006)


--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp	2012-01-13 23:56:26 UTC (rev 105005)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp	2012-01-13 23:58:22 UTC (rev 105006)
@@ -262,14 +262,14 @@
     PluginViewBase* view = static_cast<PluginViewBase*>(widget());
 
     if (Scrollbar* horizontalScrollbar = view->horizontalScrollbar()) {
-        if (horizontalScrollbar->frameRect().contains(pointInContainer)) {
+        if (horizontalScrollbar->shouldParticipateInHitTesting() && horizontalScrollbar->frameRect().contains(pointInContainer)) {
             result.setScrollbar(horizontalScrollbar);
             return true;
         }
     }
 
     if (Scrollbar* verticalScrollbar = view->verticalScrollbar()) {
-        if (verticalScrollbar->frameRect().contains(pointInContainer)) {
+        if (verticalScrollbar->shouldParticipateInHitTesting() && verticalScrollbar->frameRect().contains(pointInContainer)) {
             result.setScrollbar(verticalScrollbar);
             return true;
         }

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (105005 => 105006)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-01-13 23:56:26 UTC (rev 105005)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-01-13 23:58:22 UTC (rev 105006)
@@ -2552,7 +2552,7 @@
 
     int resizeControlSize = max(resizeControlRect.height(), 0);
 
-    if (m_vBar) {
+    if (m_vBar && m_vBar->shouldParticipateInHitTesting()) {
         LayoutRect vBarRect(box->width() - box->borderRight() - m_vBar->width(), 
                             box->borderTop(),
                             m_vBar->width(),
@@ -2564,7 +2564,7 @@
     }
 
     resizeControlSize = max(resizeControlRect.width(), 0);
-    if (m_hBar) {
+    if (m_hBar && m_hBar->shouldParticipateInHitTesting()) {
         LayoutRect hBarRect(box->borderLeft(),
                             box->height() - box->borderBottom() - m_hBar->height(),
                             box->width() - (box->borderLeft() + box->borderRight()) - (m_vBar ? m_vBar->width() : resizeControlSize),

Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (105005 => 105006)


--- trunk/Source/WebCore/rendering/RenderListBox.cpp	2012-01-13 23:56:26 UTC (rev 105005)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp	2012-01-13 23:58:22 UTC (rev 105006)
@@ -448,7 +448,7 @@
 
 bool RenderListBox::isPointInOverflowControl(HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset)
 {
-    if (!m_vBar)
+    if (!m_vBar || !m_vBar->shouldParticipateInHitTesting())
         return false;
 
     LayoutRect vertRect(accumulatedOffset.x() + width() - borderRight() - m_vBar->width(),
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to