Title: [102370] branches/safari-534.53-branch/Source
Revision
102370
Author
lforsch...@apple.com
Date
2011-12-08 13:03:01 -0800 (Thu, 08 Dec 2011)

Log Message

Merged r101290.

Modified Paths

Diff

Modified: branches/safari-534.53-branch/Source/WebCore/ChangeLog (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebCore/ChangeLog	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebCore/ChangeLog	2011-12-08 21:03:01 UTC (rev 102370)
@@ -1,5 +1,44 @@
 2011-12-08  Lucas Forschler  <lforsch...@apple.com>
 
+    Merge 101290
+
+    2011-11-28  Beth Dakin  <bda...@apple.com>
+
+            https://bugs.webkit.org/show_bug.cgi?id=72551
+            When the recommended scrollbar style changes, WKView's tracking options should 
+            adjust accordingly
+            -and corresponding-
+            <rdar://problem/10409328>
+
+            Reviewed by Darin Adler.
+
+            This new ChromeClient function is called when the recommended scrollbar style 
+            changes. This way, WebKit can respond to the change by adjusting its mouse 
+            tracking.
+            * page/ChromeClient.h:
+            (WebCore::ChromeClient::recommendedScrollbarStyleDidChange):
+
+            Existing ScrollableArea function scrollbarStyleChanged() now takes an int 
+            indicating the new scrollbar style and a bool indicating whether it is necessary 
+            to force an update. It used to be the case that this function was ONLY used to 
+            force an update (and only called when an updated was needed), but now that it must 
+            also call into the ChromeClient, it is necessary to include a bool tracking 
+            whether we need to force an update. New implementation on FrameView is responsible 
+            for calling ChromeClient, and then that calls into the pre-existing ScrollView 
+            function for the forceUpdate part.
+            * page/FrameView.cpp:
+            (WebCore::FrameView::scrollbarStyleChanged):
+            * page/FrameView.h:
+            * platform/ScrollView.cpp:
+            (WebCore::ScrollView:: scrollbarStyleChanged):
+            * platform/ScrollView.h:
+            * platform/ScrollableArea.h:
+            (WebCore::ScrollableArea::scrollbarStyleChanged):
+            * platform/mac/ScrollAnimatorMac.mm:
+            (WebCore::ScrollAnimatorMac::updateScrollerStyle):
+
+2011-12-08  Lucas Forschler  <lforsch...@apple.com>
+
     Merge 100483
 
     2011-11-16  Beth Dakin  <bda...@apple.com>

Modified: branches/safari-534.53-branch/Source/WebCore/page/ChromeClient.h (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebCore/page/ChromeClient.h	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebCore/page/ChromeClient.h	2011-12-08 21:03:01 UTC (rev 102370)
@@ -315,6 +315,7 @@
         virtual void didCompleteAnimatedScroll() const { }
         
         virtual void notifyScrollerThumbIsVisibleInRect(const IntRect&) { }
+        virtual void recommendedScrollbarStyleDidChange(int /*newStyle*/) { }
 
         enum DialogType {
             AlertDialog = 0,

Modified: branches/safari-534.53-branch/Source/WebCore/page/FrameView.cpp (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebCore/page/FrameView.cpp	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebCore/page/FrameView.cpp	2011-12-08 21:03:01 UTC (rev 102370)
@@ -2248,6 +2248,19 @@
     return m_frame->loader()->state() != FrameStateComplete;
 }
 
+void FrameView::scrollbarStyleChanged(int newStyle, bool forceUpdate)
+{
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+    if (page->mainFrame() != m_frame)
+        return;
+    page->chrome()->client()->recommendedScrollbarStyleDidChange(newStyle);
+
+    if (forceUpdate)
+        ScrollView::scrollbarStyleChanged(newStyle, forceUpdate);
+}
+
 void FrameView::setAnimatorsAreActive()
 {
     Page* page = m_frame->page();

Modified: branches/safari-534.53-branch/Source/WebCore/page/FrameView.h (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebCore/page/FrameView.h	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebCore/page/FrameView.h	2011-12-08 21:03:01 UTC (rev 102370)
@@ -278,6 +278,7 @@
     void flushAnyPendingPostLayoutTasks();
 
     virtual bool shouldSuspendScrollAnimations() const;
+    virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate);
 
     void setAnimatorsAreActive();
 

Modified: branches/safari-534.53-branch/Source/WebCore/platform/ScrollView.cpp (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebCore/platform/ScrollView.cpp	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebCore/platform/ScrollView.cpp	2011-12-08 21:03:01 UTC (rev 102370)
@@ -971,6 +971,15 @@
     return !scrollCornerRect().isEmpty();
 }
 
+void ScrollView::scrollbarStyleChanged(int, bool forceUpdate)
+{
+    if (!forceUpdate)
+        return;
+
+    contentsResized();
+    updateScrollbars(scrollOffset());
+}
+
 void ScrollView::updateScrollCorner()
 {
 }

Modified: branches/safari-534.53-branch/Source/WebCore/platform/ScrollView.h (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebCore/platform/ScrollView.h	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebCore/platform/ScrollView.h	2011-12-08 21:03:01 UTC (rev 102370)
@@ -59,6 +59,7 @@
     virtual void didCompleteRubberBand(const IntSize&) const;
     virtual void notifyPageThatContentAreaWillPaint() const;
     virtual bool isScrollCornerVisible() const;
+    virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate);
 
     // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea.
     virtual void scrollTo(const IntSize& newOffset);

Modified: branches/safari-534.53-branch/Source/WebCore/platform/ScrollableArea.h (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebCore/platform/ScrollableArea.h	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebCore/platform/ScrollableArea.h	2011-12-08 21:03:01 UTC (rev 102370)
@@ -135,7 +135,7 @@
     virtual void didCompleteAnimatedScroll() const { }
     
     virtual bool shouldSuspendScrollAnimations() const { return true; }
-    virtual void scrollbarStyleChanged() { }
+    virtual void scrollbarStyleChanged(int /*newStyle*/, bool /*forceUpdate*/) { }
     virtual void setVisibleScrollerThumbRect(const IntRect&) { }
 
     virtual bool isOnActivePage() const { ASSERT_NOT_REACHED(); return true; }

Modified: branches/safari-534.53-branch/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2011-12-08 21:03:01 UTC (rev 102370)
@@ -1438,8 +1438,7 @@
 
     // If needsScrollerStyleUpdate() is true, then the page is restoring from the page cache, and 
     // a relayout will happen on its own. Otherwise, we must initiate a re-layout ourselves.
-    if (!needsScrollerStyleUpdate())
-        scrollableArea()->scrollbarStyleChanged();
+    scrollableArea()->scrollbarStyleChanged(newStyle, !needsScrollerStyleUpdate());
 
     setNeedsScrollerStyleUpdate(false);
 }

Modified: branches/safari-534.53-branch/Source/WebKit2/ChangeLog (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebKit2/ChangeLog	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebKit2/ChangeLog	2011-12-08 21:03:01 UTC (rev 102370)
@@ -1,5 +1,43 @@
 2011-12-08  Lucas Forschler  <lforsch...@apple.com>
 
+    Merge 101290
+
+    2011-11-28  Beth Dakin  <bda...@apple.com>
+
+            https://bugs.webkit.org/show_bug.cgi?id=72551
+            When the recommended scrollbar style changes, WKView's tracking options should 
+            adjust accordingly
+            -and corresponding-
+            <rdar://problem/10409328>
+
+            Reviewed by Darin Adler.
+
+            These new functions take care of passing along the 
+            recommendedScrollbarStyleDidChange() message that originates in the ChromeClient. 
+            * UIProcess/API/mac/PageClientImpl.h:
+            * UIProcess/PageClient.h:
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::recommendedScrollbarStyleDidChange):
+            * UIProcess/WebPageProxy.h:
+            * UIProcess/WebPageProxy.messages.in:
+            * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+            (WebKit::WebChromeClient::recommendedScrollbarStyleDidChange):
+            * WebProcess/WebCoreSupport/WebChromeClient.h:
+
+            This is where we actually respond to the recommendedScrollbarStyleDidChange 
+            message. We remove the existing tracking area and create a new tracking area with 
+            the appropriate tracking options.
+            * UIProcess/API/mac/PageClientImpl.mm:
+            (WebKit::PageClientImpl::recommendedScrollbarStyleDidChange):
+
+            BuiltInPDFView inherits from WebCore::ScrollableArea, so scrollbarStyleChanged() 
+            must now take two parameters like the one in ScrollableArea.
+            * WebProcess/Plugins/PDF/BuiltInPDFView.cpp:
+            (WebKit::BuiltInPDFView::scrollbarStyleChanged):
+            * WebProcess/Plugins/PDF/BuiltInPDFView.h:
+
+2011-12-08  Lucas Forschler  <lforsch...@apple.com>
+
     Merge 100483
 
     2011-11-16  Beth Dakin  <bda...@apple.com>

Modified: branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2011-12-08 21:03:01 UTC (rev 102370)
@@ -120,6 +120,8 @@
     virtual String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingCorrectionPanel);
     virtual void recordAutocorrectionResponse(WebCore::EditorClient::AutocorrectionResponseType, const String& replacedString, const String& replacementString);
 
+    virtual void recommendedScrollbarStyleDidChange(int32_t newStyle);
+
     virtual WKView* wkView() const { return m_wkView; }
 
     WKView* m_wkView;

Modified: branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2011-12-08 21:03:01 UTC (rev 102370)
@@ -462,6 +462,34 @@
 #endif
 }
 
+void PageClientImpl::recommendedScrollbarStyleDidChange(int32_t newStyle)
+{
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+    NSArray *trackingAreas = [m_wkView trackingAreas];
+    NSUInteger count = [trackingAreas count];
+    ASSERT(count == 1);
+    
+    for (NSUInteger i = 0; i < count; ++i)
+        [m_wkView removeTrackingArea:[trackingAreas objectAtIndex:i]];
+
+    // Now re-create a tracking area with the appropriate options given the new scrollbar style
+    NSTrackingAreaOptions options = NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingInVisibleRect;
+    if (newStyle == NSScrollerStyleLegacy)
+        options |= NSTrackingActiveAlways;
+    else
+        options |= NSTrackingActiveInKeyWindow;
+
+    NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:[m_wkView frame]
+                                                                options:options
+                                                                  owner:m_wkView
+                                                               userInfo:nil];
+    [m_wkView addTrackingArea:trackingArea];
+    [trackingArea release];
+#else
+    UNUSED_PARAM(newStyle);
+#endif
+}
+
 bool PageClientImpl::executeSavedCommandBySelector(const String& selectorString)
 {
     return [m_wkView _executeSavedCommandBySelector:NSSelectorFromString(selectorString)];

Modified: branches/safari-534.53-branch/Source/WebKit2/UIProcess/PageClient.h (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebKit2/UIProcess/PageClient.h	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebKit2/UIProcess/PageClient.h	2011-12-08 21:03:01 UTC (rev 102370)
@@ -161,6 +161,7 @@
     virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingCorrectionPanel) = 0;
     virtual String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingCorrectionPanel) = 0;
     virtual void recordAutocorrectionResponse(WebCore::EditorClient::AutocorrectionResponseType, const String& replacedString, const String& replacementString) = 0;
+    virtual void recommendedScrollbarStyleDidChange(int32_t newStyle) = 0;
     
     virtual WKView* wkView() const = 0;
 #endif

Modified: branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-12-08 21:03:01 UTC (rev 102370)
@@ -3136,6 +3136,13 @@
     m_visibleScrollerThumbRect = scrollerThumb;
 }
 
+void WebPageProxy::recommendedScrollbarStyleDidChange(int32_t newStyle)
+{
+#if PLATFORM(MAC)
+    m_pageClient->recommendedScrollbarStyleDidChange(newStyle);
+#endif
+}
+
 void WebPageProxy::didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
 {
     m_mainFrameHasHorizontalScrollbar = hasHorizontalScrollbar;

Modified: branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.h (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2011-12-08 21:03:01 UTC (rev 102370)
@@ -623,6 +623,7 @@
     void runModal();
     void didCompleteRubberBandForMainFrame(const WebCore::IntSize&);
     void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&);
+    void recommendedScrollbarStyleDidChange(int32_t newStyle);
     void didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar);
     void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide);
     void didFailToInitializePlugin(const String& mimeType);

Modified: branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2011-12-08 21:03:01 UTC (rev 102370)
@@ -62,6 +62,7 @@
     RunModal()
     DidCompleteRubberBandForMainFrame(WebCore::IntSize initialOverhang)
     NotifyScrollerThumbIsVisibleInRect(WebCore::IntRect scrollerThumb)
+    RecommendedScrollbarStyleDidChange(int32_t newStyle)
     DidChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
     DidChangeScrollOffsetPinningForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
     DidFailToInitializePlugin(WTF::String mimeType)

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp	2011-12-08 21:03:01 UTC (rev 102370)
@@ -694,8 +694,11 @@
     return !pluginView()->frame()->document()->inPageCache();
 }
 
-void BuiltInPDFView::scrollbarStyleChanged()
+void BuiltInPDFView::scrollbarStyleChanged(int, bool forceUpdate)
 {
+    if (!forceUpdate)
+        return;
+
     // If the PDF was scrolled all the way to bottom right and scrollbars change to overlay style, we don't want to display white rectangles where scrollbars were.
     IntPoint newScrollOffset = IntPoint(m_scrollOffset).shrunkTo(maximumScrollPosition());
     setScrollOffset(newScrollOffset);

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2011-12-08 21:03:01 UTC (rev 102370)
@@ -139,7 +139,7 @@
     virtual bool isOnActivePage() const;
     virtual void disconnectFromPage() { m_page = 0; }
     virtual bool shouldSuspendScrollAnimations() const { return false; } // If we return true, ScrollAnimatorMac will keep cycling a timer forever, waiting for a good time to animate.
-    virtual void scrollbarStyleChanged();
+    virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate);
 
     // FIXME: Implement the other conversion functions; this one is enough to get scrollbar hit testing working. 
     virtual WebCore::IntPoint convertFromContainingViewToScrollbar(const WebCore::Scrollbar*, const WebCore::IntPoint& parentPoint) const;

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2011-12-08 21:03:01 UTC (rev 102370)
@@ -800,6 +800,11 @@
     m_page->send(Messages::WebPageProxy::NotifyScrollerThumbIsVisibleInRect(scrollerThumb));
 }
 
+void WebChromeClient::recommendedScrollbarStyleDidChange(int32_t newStyle)
+{
+    m_page->send(Messages::WebPageProxy::RecommendedScrollbarStyleDidChange(newStyle));
+}
+
 bool WebChromeClient::shouldRubberBandInDirection(WebCore::ScrollDirection direction) const
 {
     ASSERT(direction != WebCore::ScrollUp && direction != WebCore::ScrollDown);

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (102369 => 102370)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2011-12-08 20:59:19 UTC (rev 102369)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2011-12-08 21:03:01 UTC (rev 102370)
@@ -225,6 +225,7 @@
     virtual void didCompleteAnimatedScroll() const;
 
     virtual void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&);
+    virtual void recommendedScrollbarStyleDidChange(int32_t newStyle);
     virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const;
     
     virtual void numWheelEventHandlersChanged(unsigned);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to