[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
bdakin at apple.com
bdakin at apple.com
Mon Feb 21 00:32:41 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit 3216752b3235f153ea6c32d2f217ce76df5564bf
Author: bdakin at apple.com <bdakin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Feb 1 20:35:25 2011 +0000
Fix for <rdar://problem/8492788> Adopt WKScrollbarPainterController
Reviewed by Sam Weinig.
Source/WebCore:
Lots of new WebCoreSystemInterface functions to export.
* WebCore.exp.in:
* platform/mac/WebCoreSystemInterface.h:
* platform/mac/WebCoreSystemInterface.mm:
Let the scrollAnimator know when the mouse has
moved anywhere inside the page, and when the mouse
has moved in or out of the window.
* page/EventHandler.cpp:
(WebCore::EventHandler::mouseMoved):
(WebCore::EventHandler::updateMouseEventTargetNode):
Let the scrollAnimator know when the window has become
active or inactive.
* page/FocusController.cpp:
(WebCore::FocusController::setActive):
Let the scrollAnimator know when all of these things
are happening.
* page/FrameView.cpp:
(WebCore::FrameView::setContentsSize):
(WebCore::FrameView::didMoveOnscreen):
(WebCore::FrameView::willMoveOffscreen):
(WebCore::FrameView::currentMousePosition):
(WebCore::FrameView::contentsResized):
New functions called through WebKit2 that allow the
scrollAnimator to know when a live resize starts and ends.
(WebCore::FrameView::willStartLiveResize):
(WebCore::FrameView::willEndLiveResize):
* page/FrameView.h:
New functions on ScrollAnimator that pass information
to the WKPainterController when we're using one.
* platform/ScrollAnimator.h:
(WebCore::ScrollAnimator::scrollableArea):
(WebCore::ScrollAnimator::contentAreaWillPaint):
(WebCore::ScrollAnimator::mouseEnteredContentArea):
(WebCore::ScrollAnimator::mouseExitedContentArea):
(WebCore::ScrollAnimator::mouseMovedInContentArea):
(WebCore::ScrollAnimator::willStartLiveResize):
(WebCore::ScrollAnimator::contentsResized):
(WebCore::ScrollAnimator::willEndLiveResize):
(WebCore::ScrollAnimator::contentAreaDidShow):
(WebCore::ScrollAnimator::contentAreaDidHide):
(WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
(WebCore::ScrollAnimatorMac::scrollbarPainterDelegate):
(WebCore::ScrollAnimatorMac::setPainterForPainterController):
(WebCore::ScrollAnimatorMac::removePainterFromPainterController):
(WebCore::ScrollAnimatorMac::notityPositionChanged):
(WebCore::ScrollAnimatorMac::contentAreaWillPaint):
(WebCore::ScrollAnimatorMac::mouseEnteredContentArea):
(WebCore::ScrollAnimatorMac::mouseExitedContentArea):
(WebCore::ScrollAnimatorMac::mouseMovedInContentArea):
(WebCore::ScrollAnimatorMac::willStartLiveResize):
(WebCore::ScrollAnimatorMac::contentsResized):
(WebCore::ScrollAnimatorMac::willEndLiveResize):
(WebCore::ScrollAnimatorMac::contentAreaDidShow):
(WebCore::ScrollAnimatorMac::contentAreaDidHide):
Let the scrollAnimator know when this is happening.
* platform/ScrollView.cpp:
(WebCore::ScrollView::paint):
New function lets the scrollAnimator get the current
mouse position.
* platform/ScrollView.h:
(WebCore::ScrollView::currentMousePosition):
New function that returns the scrollAnimator when needed.
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::scrollAnimator):
Keep track of if we're in a live resize using a new memeber
variable.
* platform/mac/ScrollAnimatorMac.h:
(WebCore::ScrollAnimatorMac::inLiveResize):
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::view):
New delegates for the WKPainter and WKPainterController
(-[ScrollbarPainterControllerDelegate initWithScrollAnimator:WebCore::]):
(-[ScrollbarPainterControllerDelegate contentAreaRectForScrollerImpPair:]):
(-[ScrollbarPainterControllerDelegate inLiveResizeForScrollerImpPair:]):
(-[ScrollbarPainterControllerDelegate mouseLocationInContentAreaForScrollerImpPair:]):
(-[ScrollbarPainterControllerDelegate scrollerImpPair:convertContentPoint:toScrollerImp:]):
(-[ScrollbarPainterControllerDelegate scrollerImpPair:setContentAreaNeedsDisplayInRect:]):
(-[ScrollbarPainterControllerDelegate scrollerImpPair:updateScrollerStyleForNewRecommendedScrollerStyle:]):
(-[ScrollKnobAnimation initWithScrollbarPainter:forScrollAnimator:WebCore::animateKnobAlphaTo:duration:]):
(-[ScrollKnobAnimation setCurrentProgress:]):
(-[ScrollbarPainterDelegate initWithScrollAnimator:WebCore::]):
(-[ScrollbarPainterDelegate convertRectToBacking:]):
(-[ScrollbarPainterDelegate convertRectFromBacking:]):
(-[ScrollbarPainterDelegate layer]):
(-[ScrollbarPainterDelegate setUpAnimation:scrollerPainter:animateKnobAlphaTo:duration:]):
(-[ScrollbarPainterDelegate scrollerImp:animateKnobAlphaTo:duration:]):
(-[ScrollbarPainterDelegate scrollerImp:animateTrackAlphaTo:duration:]):
(-[ScrollbarPainterDelegate scrollerImp:overlayScrollerStateChangedTo:]):
Get the WKScrollbarPainterRefs to synch up with the
WKScrollbarPainterControllerRefs when appropriate
* platform/mac/ScrollbarThemeMac.h:
* platform/mac/ScrollbarThemeMac.mm:
(WebCore::ScrollbarThemeMac::registerScrollbar):
(WebCore::ScrollbarThemeMac::unregisterScrollbar):
(WebCore::ScrollbarThemeMac::setNewPainterForScrollbar):
(WebCore::ScrollbarThemeMac::usesOverlayScrollbars):
Implement ScrollableArea's virtual function contentsSize() for access
through the scrollAnimator.
* rendering/RenderLayer.h:
(WebCore::RenderLayer::contentsSize):
Source/WebKit/mac:
* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface):
Source/WebKit2:
Implement NSView's viewWillStartLiveResize and
viewDidEndLiveResize and propagate the messages down
to WebCore.
* UIProcess/API/mac/WKView.mm:
(-[WKView viewWillStartLiveResize]):
(-[WKView viewDidEndLiveResize]):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::viewWillStartLiveResize):
(WebKit::WebPageProxy::viewWillEndLiveResize):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::viewWillStartLiveResize):
(WebKit::WebPage::viewWillEndLiveResize):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
A bunch of new WebKitSystemInterface functions.
* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 5cec347..84c0dc6 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,122 @@
+2011-02-01 Beth Dakin <bdakin at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fix for <rdar://problem/8492788> Adopt WKScrollbarPainterController
+
+ Lots of new WebCoreSystemInterface functions to export.
+ * WebCore.exp.in:
+ * platform/mac/WebCoreSystemInterface.h:
+ * platform/mac/WebCoreSystemInterface.mm:
+
+ Let the scrollAnimator know when the mouse has
+ moved anywhere inside the page, and when the mouse
+ has moved in or out of the window.
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::mouseMoved):
+ (WebCore::EventHandler::updateMouseEventTargetNode):
+
+ Let the scrollAnimator know when the window has become
+ active or inactive.
+ * page/FocusController.cpp:
+ (WebCore::FocusController::setActive):
+
+ Let the scrollAnimator know when all of these things
+ are happening.
+ * page/FrameView.cpp:
+ (WebCore::FrameView::setContentsSize):
+ (WebCore::FrameView::didMoveOnscreen):
+ (WebCore::FrameView::willMoveOffscreen):
+ (WebCore::FrameView::currentMousePosition):
+ (WebCore::FrameView::contentsResized):
+
+ New functions called through WebKit2 that allow the
+ scrollAnimator to know when a live resize starts and ends.
+ (WebCore::FrameView::willStartLiveResize):
+ (WebCore::FrameView::willEndLiveResize):
+ * page/FrameView.h:
+
+ New functions on ScrollAnimator that pass information
+ to the WKPainterController when we're using one.
+ * platform/ScrollAnimator.h:
+ (WebCore::ScrollAnimator::scrollableArea):
+ (WebCore::ScrollAnimator::contentAreaWillPaint):
+ (WebCore::ScrollAnimator::mouseEnteredContentArea):
+ (WebCore::ScrollAnimator::mouseExitedContentArea):
+ (WebCore::ScrollAnimator::mouseMovedInContentArea):
+ (WebCore::ScrollAnimator::willStartLiveResize):
+ (WebCore::ScrollAnimator::contentsResized):
+ (WebCore::ScrollAnimator::willEndLiveResize):
+ (WebCore::ScrollAnimator::contentAreaDidShow):
+ (WebCore::ScrollAnimator::contentAreaDidHide):
+ (WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
+ (WebCore::ScrollAnimatorMac::scrollbarPainterDelegate):
+ (WebCore::ScrollAnimatorMac::setPainterForPainterController):
+ (WebCore::ScrollAnimatorMac::removePainterFromPainterController):
+ (WebCore::ScrollAnimatorMac::notityPositionChanged):
+ (WebCore::ScrollAnimatorMac::contentAreaWillPaint):
+ (WebCore::ScrollAnimatorMac::mouseEnteredContentArea):
+ (WebCore::ScrollAnimatorMac::mouseExitedContentArea):
+ (WebCore::ScrollAnimatorMac::mouseMovedInContentArea):
+ (WebCore::ScrollAnimatorMac::willStartLiveResize):
+ (WebCore::ScrollAnimatorMac::contentsResized):
+ (WebCore::ScrollAnimatorMac::willEndLiveResize):
+ (WebCore::ScrollAnimatorMac::contentAreaDidShow):
+ (WebCore::ScrollAnimatorMac::contentAreaDidHide):
+
+ Let the scrollAnimator know when this is happening.
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::paint):
+
+ New function lets the scrollAnimator get the current
+ mouse position.
+ * platform/ScrollView.h:
+ (WebCore::ScrollView::currentMousePosition):
+
+ New function that returns the scrollAnimator when needed.
+ * platform/ScrollableArea.h:
+ (WebCore::ScrollableArea::scrollAnimator):
+
+ Keep track of if we're in a live resize using a new memeber
+ variable.
+ * platform/mac/ScrollAnimatorMac.h:
+ (WebCore::ScrollAnimatorMac::inLiveResize):
+ * platform/mac/ScrollAnimatorMac.mm:
+ (WebCore::view):
+
+ New delegates for the WKPainter and WKPainterController
+ (-[ScrollbarPainterControllerDelegate initWithScrollAnimator:WebCore::]):
+ (-[ScrollbarPainterControllerDelegate contentAreaRectForScrollerImpPair:]):
+ (-[ScrollbarPainterControllerDelegate inLiveResizeForScrollerImpPair:]):
+ (-[ScrollbarPainterControllerDelegate mouseLocationInContentAreaForScrollerImpPair:]):
+ (-[ScrollbarPainterControllerDelegate scrollerImpPair:convertContentPoint:toScrollerImp:]):
+ (-[ScrollbarPainterControllerDelegate scrollerImpPair:setContentAreaNeedsDisplayInRect:]):
+ (-[ScrollbarPainterControllerDelegate scrollerImpPair:updateScrollerStyleForNewRecommendedScrollerStyle:]):
+ (-[ScrollKnobAnimation initWithScrollbarPainter:forScrollAnimator:WebCore::animateKnobAlphaTo:duration:]):
+ (-[ScrollKnobAnimation setCurrentProgress:]):
+ (-[ScrollbarPainterDelegate initWithScrollAnimator:WebCore::]):
+ (-[ScrollbarPainterDelegate convertRectToBacking:]):
+ (-[ScrollbarPainterDelegate convertRectFromBacking:]):
+ (-[ScrollbarPainterDelegate layer]):
+ (-[ScrollbarPainterDelegate setUpAnimation:scrollerPainter:animateKnobAlphaTo:duration:]):
+ (-[ScrollbarPainterDelegate scrollerImp:animateKnobAlphaTo:duration:]):
+ (-[ScrollbarPainterDelegate scrollerImp:animateTrackAlphaTo:duration:]):
+ (-[ScrollbarPainterDelegate scrollerImp:overlayScrollerStateChangedTo:]):
+
+ Get the WKScrollbarPainterRefs to synch up with the
+ WKScrollbarPainterControllerRefs when appropriate
+ * platform/mac/ScrollbarThemeMac.h:
+ * platform/mac/ScrollbarThemeMac.mm:
+ (WebCore::ScrollbarThemeMac::registerScrollbar):
+ (WebCore::ScrollbarThemeMac::unregisterScrollbar):
+ (WebCore::ScrollbarThemeMac::setNewPainterForScrollbar):
+ (WebCore::ScrollbarThemeMac::usesOverlayScrollbars):
+
+ Implement ScrollableArea's virtual function contentsSize() for access
+ through the scrollAnimator.
+ * rendering/RenderLayer.h:
+ (WebCore::RenderLayer::contentsSize):
+
2011-02-01 Carol Szabo <carol.szabo at nokia.com>
Reviewed by David Hyatt.
diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in
index eac0c84..459cb83 100644
--- a/Source/WebCore/WebCore.exp.in
+++ b/Source/WebCore/WebCore.exp.in
@@ -1300,11 +1300,35 @@ _wkSignalCFReadStreamHasBytes
_wkCreateCTTypesetterWithUniCharProviderAndOptions
_wkIOSurfaceContextCreate
_wkIOSurfaceContextCreateImage
-_wkMakeScrollbarPainter
-_wkScrollbarPainterPaint
-_wkScrollbarThickness
_wkScrollbarMinimumThumbLength
_wkScrollbarMinimumTotalLengthNeededForThumb
+_wkScrollbarPainterIsHorizontal
+_wkScrollbarPainterKnobAlpha
+_wkScrollbarPainterPaint
+_wkScrollbarPainterSetDelegate
+_wkScrollbarPainterSetOverlayState
+_wkScrollbarPainterUsesOverlayScrollers
+_wkScrollbarThickness
+_wkSetScrollbarPainterKnobAlpha
+_wkMakeScrollbarPainter
+_wkMakeScrollbarReplacementPainter
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+_wkContentAreaDidHide
+_wkContentAreaDidShow
+_wkContentAreaResized
+_wkContentAreaScrolled
+_wkContentAreaWillPaint
+_wkHorizontalScrollbarPainterForController
+_wkMakeScrollbarPainterController
+_wkMouseEnteredContentArea
+_wkMouseExitedContentArea
+_wkMouseMovedInContentArea
+_wkSetPainterForPainterController
+_wkSetScrollbarPainterControllerStyle
+_wkVerticalScrollbarPainterForController
+_wkWillEndLiveResize
+_wkWillStartLiveResize
+#endif
#endif
#if ENABLE(3D_RENDERING)
diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp
index 2cda1e4..5734f93 100644
--- a/Source/WebCore/page/EventHandler.cpp
+++ b/Source/WebCore/page/EventHandler.cpp
@@ -65,6 +65,7 @@
#include "RenderTextControlSingleLine.h"
#include "RenderView.h"
#include "RenderWidget.h"
+#include "ScrollAnimator.h"
#include "Scrollbar.h"
#include "SelectionController.h"
#include "Settings.h"
@@ -1447,6 +1448,9 @@ bool EventHandler::mouseMoved(const PlatformMouseEvent& event)
if (!page)
return result;
+ if (FrameView* frameView = m_frame->view())
+ frameView->scrollAnimator()->mouseMovedInContentArea();
+
hoveredNode.setToNonShadowAncestor();
page->chrome()->mouseDidMoveOverElement(hoveredNode, event.modifierFlags());
page->chrome()->setToolTip(hoveredNode);
@@ -1854,6 +1858,23 @@ void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
// Fire mouseout/mouseover if the mouse has shifted to a different node.
if (fireMouseOverOut) {
+ // FIXME: This code will only correctly handle transitions between frames with scrollbars,
+ // not transitions between overflow regions, or transitions between two frames
+ // that don't have scrollbars contained within a frame that does.
+ if (m_lastNodeUnderMouse && (!m_nodeUnderMouse || m_nodeUnderMouse->document() != m_frame->document())) {
+ if (Frame* frame = m_lastNodeUnderMouse->document()->frame()) {
+ if (FrameView* frameView = frame->view())
+ frameView->scrollAnimator()->mouseExitedContentArea();
+ }
+ }
+
+ if (m_nodeUnderMouse && (!m_lastNodeUnderMouse || m_lastNodeUnderMouse->document() != m_frame->document())) {
+ if (Frame* frame = m_nodeUnderMouse->document()->frame()) {
+ if (FrameView* frameView = frame->view())
+ frameView->scrollAnimator()->mouseEnteredContentArea();
+ }
+ }
+
if (m_lastNodeUnderMouse && m_lastNodeUnderMouse->document() != m_frame->document()) {
m_lastNodeUnderMouse = 0;
m_lastScrollbarUnderMouse = 0;
diff --git a/Source/WebCore/page/FocusController.cpp b/Source/WebCore/page/FocusController.cpp
index eda1005..679288f 100644
--- a/Source/WebCore/page/FocusController.cpp
+++ b/Source/WebCore/page/FocusController.cpp
@@ -50,6 +50,7 @@
#include "RenderLayer.h"
#include "RenderObject.h"
#include "RenderWidget.h"
+#include "ScrollAnimator.h"
#include "SelectionController.h"
#include "Settings.h"
#include "SpatialNavigation.h"
@@ -407,6 +408,11 @@ void FocusController::setActive(bool active)
view->updateLayoutAndStyleIfNeededRecursive();
view->updateControlTints();
}
+ // FIXME: This should propogate to all ScrollableAreas.
+ if (!active)
+ view->scrollAnimator()->contentAreaDidHide();
+ else
+ view->scrollAnimator()->contentAreaDidShow();
}
focusedOrMainFrame()->selection()->pageActivationChanged();
diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp
index cc74899..bbadea6 100644
--- a/Source/WebCore/page/FrameView.cpp
+++ b/Source/WebCore/page/FrameView.cpp
@@ -56,6 +56,7 @@
#include "RenderScrollbarPart.h"
#include "RenderTheme.h"
#include "RenderView.h"
+#include "ScrollAnimator.h"
#include "Settings.h"
#include "TextResourceDecoder.h"
#include <wtf/CurrentTime.h>
@@ -431,7 +432,8 @@ void FrameView::setContentsSize(const IntSize& size)
m_deferSetNeedsLayouts++;
ScrollView::setContentsSize(size);
-
+ scrollAnimator()->contentsResized();
+
Page* page = frame() ? frame()->page() : 0;
if (!page)
return;
@@ -702,6 +704,7 @@ void FrameView::didMoveOnscreen()
RenderView* view = m_frame->contentRenderer();
if (view)
view->didMoveOnscreen();
+ scrollAnimator()->contentAreaDidShow();
}
void FrameView::willMoveOffscreen()
@@ -709,6 +712,7 @@ void FrameView::willMoveOffscreen()
RenderView* view = m_frame->contentRenderer();
if (view)
view->willMoveOffscreen();
+ scrollAnimator()->contentAreaDidHide();
}
RenderObject* FrameView::layoutRoot(bool onlyDuringLayout) const
@@ -1074,6 +1078,11 @@ void FrameView::removeFixedObject()
updateCanBlitOnScrollRecursively();
}
+IntPoint FrameView::currentMousePosition() const
+{
+ return m_frame ? m_frame->eventHandler()->currentMousePosition() : IntPoint();
+}
+
bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)
{
const size_t fixedObjectThreshold = 5;
@@ -1391,6 +1400,12 @@ void FrameView::repaintContentRectangle(const IntRect& r, bool immediate)
ScrollView::repaintContentRectangle(r, immediate);
}
+void FrameView::contentsResized()
+{
+ scrollAnimator()->contentsResized();
+ setNeedsLayout();
+}
+
void FrameView::visibleContentsResized()
{
// We check to make sure the view is attached to a frame() as this method can
diff --git a/Source/WebCore/page/FrameView.h b/Source/WebCore/page/FrameView.h
index 8586f77..b606f87 100644
--- a/Source/WebCore/page/FrameView.h
+++ b/Source/WebCore/page/FrameView.h
@@ -254,6 +254,8 @@ public:
// On each repaint the delay increses by this amount
static void setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(double p);
+ virtual IntPoint currentMousePosition() const;
+
protected:
virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
virtual void scrollContentsSlowPath(const IntRect& updateRect);
@@ -284,7 +286,7 @@ private:
void performPostLayoutTasks();
virtual void repaintContentRectangle(const IntRect&, bool immediate);
- virtual void contentsResized() { setNeedsLayout(); }
+ virtual void contentsResized();
virtual void visibleContentsResized();
// Override ScrollView methods to do point conversion via renderers, in order to
diff --git a/Source/WebCore/platform/ScrollAnimator.h b/Source/WebCore/platform/ScrollAnimator.h
index 679b13f..e14bb2c 100644
--- a/Source/WebCore/platform/ScrollAnimator.h
+++ b/Source/WebCore/platform/ScrollAnimator.h
@@ -58,6 +58,8 @@ public:
virtual void scrollToOffsetWithoutAnimation(const FloatPoint&);
+ ScrollableArea* scrollableArea() const { return m_scrollableArea; }
+
virtual void handleWheelEvent(PlatformWheelEvent&);
#if ENABLE(GESTURE_EVENTS)
virtual void handleGestureEvent(const PlatformGestureEvent&);
@@ -65,10 +67,20 @@ public:
FloatPoint currentPosition() const;
+ virtual void contentAreaWillPaint() const { }
+ virtual void mouseEnteredContentArea() const { }
+ virtual void mouseExitedContentArea() const { }
+ virtual void mouseMovedInContentArea() const { }
+ virtual void willStartLiveResize() { }
+ virtual void contentsResized() const { }
+ virtual void willEndLiveResize() { }
+ virtual void contentAreaDidShow() const { }
+ virtual void contentAreaDidHide() const { }
+
protected:
ScrollAnimator(ScrollableArea*);
- void notityPositionChanged();
+ virtual void notityPositionChanged();
ScrollableArea* m_scrollableArea;
float m_currentPosX; // We avoid using a FloatPoint in order to reduce
diff --git a/Source/WebCore/platform/ScrollView.cpp b/Source/WebCore/platform/ScrollView.cpp
index 6161090..caa3b45 100644
--- a/Source/WebCore/platform/ScrollView.cpp
+++ b/Source/WebCore/platform/ScrollView.cpp
@@ -31,6 +31,7 @@
#include "HostWindow.h"
#include "PlatformMouseEvent.h"
#include "PlatformWheelEvent.h"
+#include "ScrollAnimator.h"
#include "Scrollbar.h"
#include "ScrollbarTheme.h"
#include <wtf/StdLibExtras.h>
@@ -870,6 +871,8 @@ void ScrollView::paint(GraphicsContext* context, const IntRect& rect)
if (context->paintingDisabled() && !context->updatingControlTints())
return;
+ scrollAnimator()->contentAreaWillPaint();
+
IntRect documentDirtyRect = rect;
documentDirtyRect.intersect(frameRect());
diff --git a/Source/WebCore/platform/ScrollableArea.cpp b/Source/WebCore/platform/ScrollableArea.cpp
index 9c929ab..1dad741 100644
--- a/Source/WebCore/platform/ScrollableArea.cpp
+++ b/Source/WebCore/platform/ScrollableArea.cpp
@@ -42,6 +42,7 @@ namespace WebCore {
ScrollableArea::ScrollableArea()
: m_scrollAnimator(ScrollAnimator::create(this))
, m_constrainsScrollingToContentEdge(true)
+ , m_inLiveResize(false)
{
}
@@ -133,4 +134,20 @@ void ScrollableArea::setScrollOffsetFromAnimation(const IntPoint& offset)
verticalScrollbar->offsetDidChange();
}
+void ScrollableArea::willStartLiveResize()
+{
+ if (m_inLiveResize)
+ return;
+ m_inLiveResize = true;
+ scrollAnimator()->willStartLiveResize();
+}
+
+void ScrollableArea::willEndLiveResize()
+{
+ if (!m_inLiveResize)
+ return;
+ m_inLiveResize = false;
+ scrollAnimator()->willEndLiveResize();
+}
+
} // namespace WebCore
diff --git a/Source/WebCore/platform/ScrollableArea.h b/Source/WebCore/platform/ScrollableArea.h
index 178cfc6..192d82b 100644
--- a/Source/WebCore/platform/ScrollableArea.h
+++ b/Source/WebCore/platform/ScrollableArea.h
@@ -60,6 +60,8 @@ public:
bool constrainsScrollingToContentEdge() const { return m_constrainsScrollingToContentEdge; }
void setConstrainsScrollingToContentEdge(bool constrainsScrollingToContentEdge) { m_constrainsScrollingToContentEdge = constrainsScrollingToContentEdge; }
+ ScrollAnimator* scrollAnimator() const { return m_scrollAnimator.get(); }
+
virtual int scrollSize(ScrollbarOrientation) const = 0;
virtual int scrollPosition(Scrollbar*) const = 0;
virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) = 0;
@@ -104,9 +106,14 @@ public:
virtual int visibleWidth() const { ASSERT_NOT_REACHED(); return 0; }
virtual IntSize contentsSize() const { ASSERT_NOT_REACHED(); return IntSize(); }
-
virtual IntSize overhangAmount() const { ASSERT_NOT_REACHED(); return IntSize(); }
+ virtual IntPoint currentMousePosition() const { return IntPoint(); }
+
+ virtual bool inLiveResize() const { return m_inLiveResize; }
+ virtual void willStartLiveResize();
+ virtual void willEndLiveResize();
+
private:
// NOTE: Only called from the ScrollAnimator.
friend class ScrollAnimator;
@@ -114,6 +121,8 @@ private:
OwnPtr<ScrollAnimator> m_scrollAnimator;
bool m_constrainsScrollingToContentEdge;
+
+ bool m_inLiveResize;
};
} // namespace WebCore
diff --git a/Source/WebCore/platform/mac/ScrollAnimatorMac.h b/Source/WebCore/platform/mac/ScrollAnimatorMac.h
index e9cdc2f..c969aca 100644
--- a/Source/WebCore/platform/mac/ScrollAnimatorMac.h
+++ b/Source/WebCore/platform/mac/ScrollAnimatorMac.h
@@ -32,21 +32,35 @@
#include "FloatSize.h"
#include "ScrollAnimator.h"
#include "Timer.h"
+#include "WebCoreSystemInterface.h"
#include <wtf/RetainPtr.h>
#ifdef __OBJC__
@class ScrollAnimationHelperDelegate;
+ at class ScrollbarPainterDelegate;
+ at class ScrollbarPainterControllerDelegate;
+ at class ScrollbarPainterDelegate;
#else
class ScrollAnimationHelperDelegate;
+class ScrollbarPainterDelegate;
+class ScrollbarPainterControllerDelegate;
+class ScrollbarPainterDelegate;
#endif
namespace WebCore {
+class Scrollbar;
+
class ScrollAnimatorMac : public ScrollAnimator {
public:
ScrollAnimatorMac(ScrollableArea*);
virtual ~ScrollAnimatorMac();
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ void setPainterForPainterController(WKScrollbarPainterRef, bool isHorizontal);
+ void removePainterFromPainterController(ScrollbarOrientation orientation);
+#endif
+
virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier);
virtual void scrollToOffsetWithoutAnimation(const FloatPoint&);
@@ -61,10 +75,29 @@ public:
void immediateScrollByDeltaX(float deltaX);
void immediateScrollByDeltaY(float deltaY);
+ id scrollbarPainterDelegate();
+
private:
RetainPtr<id> m_scrollAnimationHelper;
RetainPtr<ScrollAnimationHelperDelegate> m_scrollAnimationHelperDelegate;
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ RetainPtr<WKScrollbarPainterControllerRef> m_scrollbarPainterController;
+ RetainPtr<ScrollbarPainterControllerDelegate> m_scrollbarPainterControllerDelegate;
+ RetainPtr<id> m_scrollbarPainterDelegate;
+#endif
+
+ virtual void notityPositionChanged();
+ virtual void contentAreaWillPaint() const;
+ virtual void mouseEnteredContentArea() const;
+ virtual void mouseExitedContentArea() const;
+ virtual void mouseMovedInContentArea() const;
+ virtual void willStartLiveResize();
+ virtual void contentsResized() const;
+ virtual void willEndLiveResize();
+ virtual void contentAreaDidShow() const;
+ virtual void contentAreaDidHide() const;
+
#if ENABLE(RUBBER_BANDING)
bool allowsVerticalStretching() const;
bool allowsHorizontalStretching() const;
diff --git a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
index e566016..47ade6e 100644
--- a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
+++ b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
@@ -30,10 +30,15 @@
#include "ScrollAnimatorMac.h"
#include "FloatPoint.h"
-#include "PlatformWheelEvent.h"
+#include "IntRect.h"
#include "PlatformGestureEvent.h"
+#include "PlatformWheelEvent.h"
+#include "ScrollView.h"
#include "ScrollableArea.h"
+#include "ScrollbarTheme.h"
+#include "ScrollbarThemeMac.h"
#include <wtf/PassOwnPtr.h>
+#include <wtf/UnusedParam.h>
@interface NSObject (NSScrollAnimationHelperDetails)
- (id)initWithDelegate:(id)delegate;
@@ -134,6 +139,232 @@ static NSSize abs(NSSize size)
@end
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ at interface ScrollbarPainterControllerDelegate : NSObject
+{
+ WebCore::ScrollAnimatorMac* _animator;
+}
+
+- (id)initWithScrollAnimator:(WebCore::ScrollAnimatorMac*)scrollAnimator;
+
+- (NSRect)contentAreaRectForScrollerImpPair:(id)scrollerImpPair;
+- (BOOL)inLiveResizeForScrollerImpPair:(id)scrollerImpPair;
+- (NSPoint)mouseLocationInContentAreaForScrollerImpPair:(id)scrollerImpPair;
+- (NSPoint)scrollerImpPair:(id)scrollerImpPair convertContentPoint:(NSPoint)pointInContentArea toScrollerImp:(id)scrollerImp;
+- (void)scrollerImpPair:(id)scrollerImpPair setContentAreaNeedsDisplayInRect:(NSRect)rect;
+- (void)scrollerImpPair:(id)scrollerImpPair updateScrollerStyleForNewRecommendedScrollerStyle:(NSScrollerStyle)newRecommendedScrollerStyle;
+
+ at end
+
+ at implementation ScrollbarPainterControllerDelegate
+
+- (id)initWithScrollAnimator:(WebCore::ScrollAnimatorMac*)scrollAnimator
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ _animator = scrollAnimator;
+ return self;
+}
+
+- (NSRect)contentAreaRectForScrollerImpPair:(id)scrollerImpPair
+{
+ UNUSED_PARAM(scrollerImpPair);
+ WebCore::IntSize contentsSize = _animator->scrollableArea()->contentsSize();
+ return CGRectMake(0, 0, contentsSize.width(), contentsSize.height());
+}
+
+- (BOOL)inLiveResizeForScrollerImpPair:(id)scrollerImpPair
+{
+ UNUSED_PARAM(scrollerImpPair);
+ return _animator->inLiveResize();
+}
+
+- (NSPoint)mouseLocationInContentAreaForScrollerImpPair:(id)scrollerImpPair
+{
+ UNUSED_PARAM(scrollerImpPair);
+ return _animator->scrollableArea()->currentMousePosition();
+}
+
+- (NSPoint)scrollerImpPair:(id)scrollerImpPair convertContentPoint:(NSPoint)pointInContentArea toScrollerImp:(id)scrollerImp
+{
+ UNUSED_PARAM(scrollerImpPair);
+ UNUSED_PARAM(scrollerImp);
+ return pointInContentArea;
+}
+
+- (void)scrollerImpPair:(id)scrollerImpPair setContentAreaNeedsDisplayInRect:(NSRect)rect
+{
+ UNUSED_PARAM(scrollerImpPair);
+ UNUSED_PARAM(rect);
+}
+
+- (void)scrollerImpPair:(id)scrollerImpPair updateScrollerStyleForNewRecommendedScrollerStyle:(NSScrollerStyle)newRecommendedScrollerStyle
+{
+ WKScrollbarPainterControllerRef painterController = (WKScrollbarPainterControllerRef)scrollerImpPair;
+ WebCore::ScrollbarThemeMac* macTheme = (WebCore::ScrollbarThemeMac*)WebCore::ScrollbarTheme::nativeTheme();
+
+ WKScrollbarPainterRef oldVerticalPainter = wkVerticalScrollbarPainterForController(painterController);
+ if (oldVerticalPainter) {
+ WebCore::Scrollbar* verticalScrollbar = _animator->scrollableArea()->verticalScrollbar();
+ WKScrollbarPainterRef newVerticalPainter = wkMakeScrollbarReplacementPainter(oldVerticalPainter,
+ newRecommendedScrollerStyle,
+ verticalScrollbar->controlSize(),
+ false);
+ macTheme->setNewPainterForScrollbar(verticalScrollbar, newVerticalPainter);
+ }
+
+ WKScrollbarPainterRef oldHorizontalPainter = wkHorizontalScrollbarPainterForController(painterController);
+ if (oldHorizontalPainter) {
+ WebCore::Scrollbar* horizontalScrollbar = _animator->scrollableArea()->horizontalScrollbar();
+ WKScrollbarPainterRef newHorizontalPainter = wkMakeScrollbarReplacementPainter(oldHorizontalPainter,
+ newRecommendedScrollerStyle,
+ horizontalScrollbar->controlSize(),
+ true);
+ macTheme->setNewPainterForScrollbar(horizontalScrollbar, newHorizontalPainter);
+ }
+
+ wkSetScrollbarPainterControllerStyle(painterController, newRecommendedScrollerStyle);
+}
+
+ at end
+
+ at interface ScrollKnobAnimation : NSAnimation
+{
+ RetainPtr<WKScrollbarPainterRef> _scrollerPainter;
+ WebCore::ScrollAnimatorMac* _animator;
+ CGFloat _initialKnobAlpha;
+ CGFloat _newKnobAlpha;
+}
+
+- (id)initWithScrollbarPainter:(WKScrollbarPainterRef)scrollerPainter forScrollAnimator:(WebCore::ScrollAnimatorMac*)scrollAnimator animateKnobAlphaTo:(CGFloat)newKnobAlpha duration:(NSTimeInterval)duration;
+
+ at end
+
+ at implementation ScrollKnobAnimation
+
+- (id)initWithScrollbarPainter:(WKScrollbarPainterRef)scrollerPainter forScrollAnimator:(WebCore::ScrollAnimatorMac*)scrollAnimator animateKnobAlphaTo:(CGFloat)newKnobAlpha duration:(NSTimeInterval)duration
+{
+ self = [super initWithDuration:duration animationCurve:NSAnimationEaseInOut];
+ if (!self)
+ return nil;
+
+ _scrollerPainter = scrollerPainter;
+ _animator = scrollAnimator;
+ _initialKnobAlpha = wkScrollbarPainterKnobAlpha(_scrollerPainter.get());
+ _newKnobAlpha = newKnobAlpha;
+
+ return self;
+}
+
+- (void)setCurrentProgress:(NSAnimationProgress)progress
+{
+ [super setCurrentProgress:progress];
+
+ CGFloat currentAlpha;
+ if (_initialKnobAlpha > _newKnobAlpha)
+ currentAlpha = 1 - progress;
+ else
+ currentAlpha = progress;
+ wkSetScrollbarPainterKnobAlpha(_scrollerPainter.get(), currentAlpha);
+
+ // Invalidate the scrollbars so that they paint the animation
+ if (WebCore::Scrollbar* verticalScrollbar = _animator->scrollableArea()->verticalScrollbar())
+ _animator->scrollableArea()->invalidateScrollbarRect(verticalScrollbar, WebCore::IntRect(0, 0, verticalScrollbar->width(), verticalScrollbar->height()));
+ if (WebCore::Scrollbar* horizontalScrollbar = _animator->scrollableArea()->horizontalScrollbar())
+ _animator->scrollableArea()->invalidateScrollbarRect(horizontalScrollbar, WebCore::IntRect(0, 0, horizontalScrollbar->width(), horizontalScrollbar->height()));
+}
+
+ at end
+
+ at interface ScrollbarPainterDelegate : NSObject<NSAnimationDelegate>
+{
+ WebCore::ScrollAnimatorMac* _animator;
+ RetainPtr<ScrollKnobAnimation> _verticalKnobAnimation;
+ RetainPtr<ScrollKnobAnimation> _horizontalKnobAnimation;
+}
+
+- (id)initWithScrollAnimator:(WebCore::ScrollAnimatorMac*)scrollAnimator;
+
+- (NSRect)convertRectToBacking:(NSRect)aRect;
+- (NSRect)convertRectFromBacking:(NSRect)aRect;
+- (CALayer *)layer;
+
+- (void)scrollerImp:(id)scrollerImp animateKnobAlphaTo:(CGFloat)newKnobAlpha duration:(NSTimeInterval)duration;
+- (void)scrollerImp:(id)scrollerImp animateTrackAlphaTo:(CGFloat)newTrackAlpha duration:(NSTimeInterval)duration;
+- (void)scrollerImp:(id)scrollerImp overlayScrollerStateChangedTo:(NSUInteger)newOverlayScrollerState;
+
+ at end
+
+ at implementation ScrollbarPainterDelegate
+
+- (id)initWithScrollAnimator:(WebCore::ScrollAnimatorMac*)scrollAnimator
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ _animator = scrollAnimator;
+ return self;
+}
+
+- (NSRect)convertRectToBacking:(NSRect)aRect
+{
+ return aRect;
+}
+
+- (NSRect)convertRectFromBacking:(NSRect)aRect
+{
+ return aRect;
+}
+
+- (CALayer *)layer
+{
+ return nil;
+}
+
+- (void)setUpAnimation:(RetainPtr<ScrollKnobAnimation>)scrollKnobAnimation scrollerPainter:(WKScrollbarPainterRef)scrollerPainter animateKnobAlphaTo:(CGFloat)newKnobAlpha duration:(NSTimeInterval)duration
+{
+ // If we are currently animating, stop
+ if (scrollKnobAnimation) {
+ [scrollKnobAnimation.get() stopAnimation];
+ scrollKnobAnimation = nil;
+ }
+
+ scrollKnobAnimation.adoptNS([[ScrollKnobAnimation alloc] initWithScrollbarPainter:scrollerPainter
+ forScrollAnimator:_animator
+ animateKnobAlphaTo:newKnobAlpha
+ duration:duration]);
+ [scrollKnobAnimation.get() setAnimationBlockingMode:NSAnimationNonblocking];
+ [scrollKnobAnimation.get() startAnimation];
+}
+
+- (void)scrollerImp:(id)scrollerImp animateKnobAlphaTo:(CGFloat)newKnobAlpha duration:(NSTimeInterval)duration
+{
+ WKScrollbarPainterRef scrollerPainter = (WKScrollbarPainterRef)scrollerImp;
+
+ if (wkScrollbarPainterIsHorizontal(scrollerPainter))
+ [self setUpAnimation:_horizontalKnobAnimation scrollerPainter:scrollerPainter animateKnobAlphaTo:newKnobAlpha duration:duration];
+ else
+ [self setUpAnimation:_verticalKnobAnimation scrollerPainter:scrollerPainter animateKnobAlphaTo:newKnobAlpha duration:duration];
+}
+
+- (void)scrollerImp:(id)scrollerImp animateTrackAlphaTo:(CGFloat)newTrackAlpha duration:(NSTimeInterval)duration
+{
+ // FIXME: Implement.
+ UNUSED_PARAM(scrollerImp);
+ UNUSED_PARAM(newTrackAlpha);
+ UNUSED_PARAM(duration);
+}
+
+- (void)scrollerImp:(id)scrollerImp overlayScrollerStateChangedTo:(NSUInteger)newOverlayScrollerState
+{
+ wkScrollbarPainterSetOverlayState((WKScrollbarPainterRef)scrollerImp, newOverlayScrollerState);
+}
+
+ at end
+#endif // #if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
namespace WebCore {
@@ -155,12 +386,39 @@ ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea)
{
m_scrollAnimationHelperDelegate.adoptNS([[ScrollAnimationHelperDelegate alloc] initWithScrollAnimator:this]);
m_scrollAnimationHelper.adoptNS([[NSClassFromString(@"NSScrollAnimationHelper") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]);
+
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ m_scrollbarPainterControllerDelegate.adoptNS([[ScrollbarPainterControllerDelegate alloc] initWithScrollAnimator:this]);
+ m_scrollbarPainterController = wkMakeScrollbarPainterController(m_scrollbarPainterControllerDelegate.get());
+ m_scrollbarPainterDelegate.adoptNS([[ScrollbarPainterDelegate alloc] initWithScrollAnimator:this]);
+#endif
}
ScrollAnimatorMac::~ScrollAnimatorMac()
{
}
+id ScrollAnimatorMac::scrollbarPainterDelegate()
+{
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ return m_scrollbarPainterDelegate.get();
+#else
+ return nil;
+#endif
+}
+
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+void ScrollAnimatorMac::setPainterForPainterController(WKScrollbarPainterRef painter, bool isHorizontal)
+{
+ wkSetPainterForPainterController(m_scrollbarPainterController.get(), painter, isHorizontal);
+}
+
+void ScrollAnimatorMac::removePainterFromPainterController(ScrollbarOrientation orientation)
+{
+ wkSetPainterForPainterController(m_scrollbarPainterController.get(), nil, orientation == HorizontalScrollbar);
+}
+#endif // #if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+
bool ScrollAnimatorMac::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier)
{
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"AppleScrollAnimationEnabled"])
@@ -210,6 +468,77 @@ void ScrollAnimatorMac::immediateScrollByDeltaY(float deltaY)
notityPositionChanged();
}
+void ScrollAnimatorMac::notityPositionChanged()
+{
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ wkContentAreaScrolled(m_scrollbarPainterController.get());
+#endif
+ ScrollAnimator::notityPositionChanged();
+}
+
+void ScrollAnimatorMac::contentAreaWillPaint() const
+{
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ wkContentAreaWillPaint(m_scrollbarPainterController.get());
+#endif
+}
+
+void ScrollAnimatorMac::mouseEnteredContentArea() const
+{
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ wkMouseEnteredContentArea(m_scrollbarPainterController.get());
+#endif
+}
+
+void ScrollAnimatorMac::mouseExitedContentArea() const
+{
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ wkMouseExitedContentArea(m_scrollbarPainterController.get());
+#endif
+}
+
+void ScrollAnimatorMac::mouseMovedInContentArea() const
+{
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ wkMouseMovedInContentArea(m_scrollbarPainterController.get());
+#endif
+}
+
+void ScrollAnimatorMac::willStartLiveResize()
+{
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ wkWillStartLiveResize(m_scrollbarPainterController.get());
+#endif
+}
+
+void ScrollAnimatorMac::contentsResized() const
+{
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ wkContentAreaResized(m_scrollbarPainterController.get());
+#endif
+}
+
+void ScrollAnimatorMac::willEndLiveResize()
+{
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ wkWillEndLiveResize(m_scrollbarPainterController.get());
+#endif
+}
+
+void ScrollAnimatorMac::contentAreaDidShow() const
+{
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ wkContentAreaDidShow(m_scrollbarPainterController.get());
+#endif
+}
+
+void ScrollAnimatorMac::contentAreaDidHide() const
+{
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ wkContentAreaDidHide(m_scrollbarPainterController.get());
+#endif
+}
+
#if ENABLE(RUBBER_BANDING)
static const float scrollVelocityZeroingTimeout = 0.10f;
diff --git a/Source/WebCore/platform/mac/ScrollbarThemeMac.h b/Source/WebCore/platform/mac/ScrollbarThemeMac.h
index 8b5412d..b9894cd 100644
--- a/Source/WebCore/platform/mac/ScrollbarThemeMac.h
+++ b/Source/WebCore/platform/mac/ScrollbarThemeMac.h
@@ -27,6 +27,7 @@
#define ScrollbarThemeMac_h
#include "ScrollbarThemeComposite.h"
+#include "WebCoreSystemInterface.h"
namespace WebCore {
@@ -50,6 +51,10 @@ public:
virtual void registerScrollbar(Scrollbar*);
virtual void unregisterScrollbar(Scrollbar*);
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ void setNewPainterForScrollbar(Scrollbar*, WKScrollbarPainterRef);
+#endif
+
protected:
virtual bool hasButtons(Scrollbar*);
virtual bool hasThumb(Scrollbar*);
diff --git a/Source/WebCore/platform/mac/ScrollbarThemeMac.mm b/Source/WebCore/platform/mac/ScrollbarThemeMac.mm
index e646a73..9125754 100644
--- a/Source/WebCore/platform/mac/ScrollbarThemeMac.mm
+++ b/Source/WebCore/platform/mac/ScrollbarThemeMac.mm
@@ -29,8 +29,8 @@
#include "ImageBuffer.h"
#include "LocalCurrentGraphicsContext.h"
#include "PlatformMouseEvent.h"
+#include "ScrollAnimatorMac.h"
#include "ScrollView.h"
-#include "WebCoreSystemInterface.h"
#include <Carbon/Carbon.h>
#include <wtf/HashMap.h>
#include <wtf/StdLibExtras.h>
@@ -161,9 +161,15 @@ static void updateArrowPlacement()
void ScrollbarThemeMac::registerScrollbar(Scrollbar* scrollbar)
{
#if defined(USE_WK_SCROLLBAR_PAINTER)
- WKScrollbarPainterRef scrollbarPainter = wkMakeScrollbarPainter(scrollbar->controlSize(),
- scrollbar->orientation() == HorizontalScrollbar);
+ bool isHorizontal = scrollbar->orientation() == HorizontalScrollbar;
+ WKScrollbarPainterRef scrollbarPainter = wkMakeScrollbarPainter(scrollbar->controlSize(), isHorizontal);
scrollbarMap()->add(scrollbar, scrollbarPainter);
+
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ ScrollAnimatorMac* animator = static_cast<ScrollAnimatorMac*>(scrollbar->scrollableArea()->scrollAnimator());
+ wkScrollbarPainterSetDelegate(scrollbarPainter, animator->scrollbarPainterDelegate());
+ animator->setPainterForPainterController(scrollbarPainter, isHorizontal);
+#endif
#else
scrollbarMap()->add(scrollbar);
#endif
@@ -171,9 +177,21 @@ void ScrollbarThemeMac::registerScrollbar(Scrollbar* scrollbar)
void ScrollbarThemeMac::unregisterScrollbar(Scrollbar* scrollbar)
{
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ ScrollAnimatorMac* animator = static_cast<ScrollAnimatorMac*>(scrollbar->scrollableArea()->scrollAnimator());
+ animator->removePainterFromPainterController(scrollbar->orientation());
+#endif
+
scrollbarMap()->remove(scrollbar);
}
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+void ScrollbarThemeMac::setNewPainterForScrollbar(Scrollbar* scrollbar, WKScrollbarPainterRef newPainter)
+{
+ scrollbarMap()->set(scrollbar, newPainter);
+}
+#endif
+
ScrollbarThemeMac::ScrollbarThemeMac()
{
static bool initialized;
@@ -209,8 +227,11 @@ int ScrollbarThemeMac::scrollbarThickness(ScrollbarControlSize controlSize)
bool ScrollbarThemeMac::usesOverlayScrollbars() const
{
- // FIXME: This should be enabled when <rdar://problem/8492788> is resolved.
+#if defined(USE_WK_SCROLLBAR_PAINTER)
+ return wkScrollbarPainterUsesOverlayScrollers();
+#else
return false;
+#endif
}
double ScrollbarThemeMac::initialAutoscrollTimerDelay()
diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.h b/Source/WebCore/platform/mac/WebCoreSystemInterface.h
index fdd38dc..a50a863 100644
--- a/Source/WebCore/platform/mac/WebCoreSystemInterface.h
+++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.h
@@ -191,10 +191,37 @@ extern CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context);
typedef struct __WKScrollbarPainter *WKScrollbarPainterRef;
extern WKScrollbarPainterRef (*wkMakeScrollbarPainter)(int controlSize, bool isHorizontal);
+extern WKScrollbarPainterRef (*wkMakeScrollbarReplacementPainter)(WKScrollbarPainterRef oldPainter, int newStyle, int controlSize, bool isHorizontal);
+extern void (*wkScrollbarPainterSetDelegate)(WKScrollbarPainterRef, id scrollbarPainterDelegate);
extern void (*wkScrollbarPainterPaint)(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect);
extern int (*wkScrollbarThickness)(int controlSize);
extern int (*wkScrollbarMinimumThumbLength)(WKScrollbarPainterRef);
extern int (*wkScrollbarMinimumTotalLengthNeededForThumb)(WKScrollbarPainterRef);
+extern CGFloat (*wkScrollbarPainterKnobAlpha)(WKScrollbarPainterRef);
+extern void (*wkSetScrollbarPainterKnobAlpha)(WKScrollbarPainterRef, CGFloat);
+extern bool (*wkScrollbarPainterIsHorizontal)(WKScrollbarPainterRef);
+extern void (*wkScrollbarPainterSetOverlayState)(WKScrollbarPainterRef, int overlayScrollerState);
+
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+typedef struct __WKScrollbarPainterController *WKScrollbarPainterControllerRef;
+extern WKScrollbarPainterControllerRef (*wkMakeScrollbarPainterController)(id painterControllerDelegate);
+extern void (*wkSetPainterForPainterController)(WKScrollbarPainterControllerRef, WKScrollbarPainterRef, bool isHorizontal);
+extern WKScrollbarPainterRef (*wkVerticalScrollbarPainterForController)(WKScrollbarPainterControllerRef);
+extern WKScrollbarPainterRef (*wkHorizontalScrollbarPainterForController)(WKScrollbarPainterControllerRef);
+extern void (*wkSetScrollbarPainterControllerStyle)(WKScrollbarPainterControllerRef, int newStyle);
+extern void (*wkContentAreaScrolled)(WKScrollbarPainterControllerRef);
+extern void (*wkContentAreaWillPaint)(WKScrollbarPainterControllerRef);
+extern void (*wkMouseEnteredContentArea)(WKScrollbarPainterControllerRef);
+extern void (*wkMouseExitedContentArea)(WKScrollbarPainterControllerRef);
+extern void (*wkMouseMovedInContentArea)(WKScrollbarPainterControllerRef);
+extern void (*wkWillStartLiveResize)(WKScrollbarPainterControllerRef);
+extern void (*wkContentAreaResized)(WKScrollbarPainterControllerRef);
+extern void (*wkWillEndLiveResize)(WKScrollbarPainterControllerRef);
+extern void (*wkContentAreaDidShow)(WKScrollbarPainterControllerRef);
+extern void (*wkContentAreaDidHide)(WKScrollbarPainterControllerRef);
+#endif
+
+extern bool (*wkScrollbarPainterUsesOverlayScrollers)(void);
#endif
}
diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
index e281767..01840d3 100644
--- a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
+++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
@@ -129,8 +129,34 @@ CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, u
CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context);
WKScrollbarPainterRef (*wkMakeScrollbarPainter)(int controlSize, bool isHorizontal);
+WKScrollbarPainterRef (*wkMakeScrollbarReplacementPainter)(WKScrollbarPainterRef oldPainter, int newStyle, int controlSize, bool isHorizontal);
+void (*wkScrollbarPainterSetDelegate)(WKScrollbarPainterRef, id scrollbarPainterDelegate);
void (*wkScrollbarPainterPaint)(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect);
int (*wkScrollbarThickness)(int controlSize);
int (*wkScrollbarMinimumThumbLength)(WKScrollbarPainterRef);
int (*wkScrollbarMinimumTotalLengthNeededForThumb)(WKScrollbarPainterRef);
+CGFloat (*wkScrollbarPainterKnobAlpha)(WKScrollbarPainterRef);
+void (*wkSetScrollbarPainterKnobAlpha)(WKScrollbarPainterRef, CGFloat);
+bool (*wkScrollbarPainterIsHorizontal)(WKScrollbarPainterRef);
+void (*wkScrollbarPainterSetOverlayState)(WKScrollbarPainterRef, int overlayScrollerState);
+
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+WKScrollbarPainterControllerRef (*wkMakeScrollbarPainterController)(id painterControllerDelegate);
+void (*wkSetPainterForPainterController)(WKScrollbarPainterControllerRef, WKScrollbarPainterRef, bool isHorizontal);
+WKScrollbarPainterRef (*wkVerticalScrollbarPainterForController)(WKScrollbarPainterControllerRef);
+WKScrollbarPainterRef (*wkHorizontalScrollbarPainterForController)(WKScrollbarPainterControllerRef);
+void (*wkSetScrollbarPainterControllerStyle)(WKScrollbarPainterControllerRef, int newStyle);
+void (*wkContentAreaScrolled)(WKScrollbarPainterControllerRef);
+void (*wkContentAreaWillPaint)(WKScrollbarPainterControllerRef);
+void (*wkMouseEnteredContentArea)(WKScrollbarPainterControllerRef);
+void (*wkMouseExitedContentArea)(WKScrollbarPainterControllerRef);
+void (*wkMouseMovedInContentArea)(WKScrollbarPainterControllerRef);
+void (*wkWillStartLiveResize)(WKScrollbarPainterControllerRef);
+void (*wkContentAreaResized)(WKScrollbarPainterControllerRef);
+void (*wkWillEndLiveResize)(WKScrollbarPainterControllerRef);
+void (*wkContentAreaDidShow)(WKScrollbarPainterControllerRef);
+void (*wkContentAreaDidHide)(WKScrollbarPainterControllerRef);
+#endif
+
+bool (*wkScrollbarPainterUsesOverlayScrollers)(void);
#endif
diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h
index a9a817b..dc0fcba 100644
--- a/Source/WebCore/rendering/RenderLayer.h
+++ b/Source/WebCore/rendering/RenderLayer.h
@@ -524,6 +524,7 @@ private:
virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const;
virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const;
virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const;
+ virtual IntSize contentsSize() const { return size(); }
// NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea.
void scrollTo(int x, int y);
diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog
index 97f5459..f3c4fa9 100644
--- a/Source/WebKit/mac/ChangeLog
+++ b/Source/WebKit/mac/ChangeLog
@@ -1,3 +1,12 @@
+2011-02-01 Beth Dakin <bdakin at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fix for <rdar://problem/8492788> Adopt WKScrollbarPainterController
+
+ * WebCoreSupport/WebSystemInterface.mm:
+ (InitWebCoreSystemInterface):
+
2011-02-01 Dave Hyatt <hyatt at apple.com>
Reviewed by Darin Adler.
diff --git a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
index e9bf1a9..ce32671 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
@@ -123,13 +123,35 @@ void InitWebCoreSystemInterface(void)
INIT(CreateCTLineWithUniCharProvider);
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
- INIT(IOSurfaceContextCreate);
- INIT(IOSurfaceContextCreateImage);
INIT(MakeScrollbarPainter);
+ INIT(ScrollbarPainterSetDelegate);
INIT(ScrollbarPainterPaint);
INIT(ScrollbarThickness);
INIT(ScrollbarMinimumThumbLength);
INIT(ScrollbarMinimumTotalLengthNeededForThumb);
+ INIT(ScrollbarPainterKnobAlpha);
+ INIT(SetScrollbarPainterKnobAlpha);
+ INIT(ScrollbarPainterIsHorizontal);
+ INIT(ScrollbarPainterSetOverlayState);
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ INIT(MakeScrollbarPainterController);
+ INIT(MakeScrollbarReplacementPainter);
+ INIT(SetPainterForPainterController);
+ INIT(VerticalScrollbarPainterForController);
+ INIT(HorizontalScrollbarPainterForController);
+ INIT(SetScrollbarPainterControllerStyle);
+ INIT(ContentAreaScrolled);
+ INIT(ContentAreaWillPaint);
+ INIT(MouseEnteredContentArea);
+ INIT(MouseExitedContentArea);
+ INIT(MouseMovedInContentArea);
+ INIT(WillStartLiveResize);
+ INIT(ContentAreaResized);
+ INIT(WillEndLiveResize);
+ INIT(ContentAreaDidShow);
+ INIT(ContentAreaDidHide);
+#endif
+ INIT(ScrollbarPainterUsesOverlayScrollers);
#endif
didInit = true;
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 9a06458..030e733 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,29 @@
+2011-02-01 Beth Dakin <bdakin at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fix for <rdar://problem/8492788> Adopt WKScrollbarPainterController
+
+ Implement NSView's viewWillStartLiveResize and
+ viewDidEndLiveResize and propagate the messages down
+ to WebCore.
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView viewWillStartLiveResize]):
+ (-[WKView viewDidEndLiveResize]):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::viewWillStartLiveResize):
+ (WebKit::WebPageProxy::viewWillEndLiveResize):
+ * UIProcess/WebPageProxy.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::viewWillStartLiveResize):
+ (WebKit::WebPage::viewWillEndLiveResize):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
+ A bunch of new WebKitSystemInterface functions.
+ * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+ (InitWebCoreSystemInterface):
+
2011-02-01 Dave Hyatt <hyatt at apple.com>
Reviewed by Darin Adler.
diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm
index a8c6cda..1395d14 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm
@@ -279,6 +279,16 @@ static bool useNewDrawingArea()
return YES;
}
+- (void)viewWillStartLiveResize
+{
+ _data->_page->viewWillStartLiveResize();
+}
+
+- (void)viewDidEndLiveResize
+{
+ _data->_page->viewWillEndLiveResize();
+}
+
- (BOOL)isFlipped
{
return YES;
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp
index 348be78..39f7d44 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp
@@ -481,6 +481,16 @@ void WebPageProxy::setDrawsTransparentBackground(bool drawsTransparentBackground
process()->send(Messages::WebPage::SetDrawsTransparentBackground(drawsTransparentBackground), m_pageID);
}
+void WebPageProxy::viewWillStartLiveResize()
+{
+ process()->send(Messages::WebPage::ViewWillStartLiveResize(), m_pageID);
+}
+
+void WebPageProxy::viewWillEndLiveResize()
+{
+ process()->send(Messages::WebPage::ViewWillEndLiveResize(), m_pageID);
+}
+
void WebPageProxy::setViewNeedsDisplay(const IntRect& rect)
{
m_pageClient->setViewNeedsDisplay(rect);
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h
index c52a39a..72e2bbc 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.h
+++ b/Source/WebKit2/UIProcess/WebPageProxy.h
@@ -172,6 +172,9 @@ public:
bool drawsTransparentBackground() const { return m_drawsTransparentBackground; }
void setDrawsTransparentBackground(bool);
+ void viewWillStartLiveResize();
+ void viewWillEndLiveResize();
+
void setInitialFocus(bool);
void setWindowResizerSize(const WebCore::IntSize&);
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
index d1efc36..8746cf7 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
@@ -97,10 +97,34 @@ void InitWebCoreSystemInterface(void)
#if !defined(BUILDING_ON_SNOW_LEOPARD)
INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
INIT(MakeScrollbarPainter);
+ INIT(ScrollbarPainterSetDelegate);
INIT(ScrollbarPainterPaint);
INIT(ScrollbarThickness);
INIT(ScrollbarMinimumThumbLength);
INIT(ScrollbarMinimumTotalLengthNeededForThumb);
+ INIT(ScrollbarPainterKnobAlpha);
+ INIT(SetScrollbarPainterKnobAlpha);
+ INIT(ScrollbarPainterIsHorizontal);
+ INIT(ScrollbarPainterSetOverlayState);
+ INIT(MakeScrollbarReplacementPainter);
+#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+ INIT(MakeScrollbarPainterController);
+ INIT(SetPainterForPainterController);
+ INIT(VerticalScrollbarPainterForController);
+ INIT(HorizontalScrollbarPainterForController);
+ INIT(SetScrollbarPainterControllerStyle);
+ INIT(ContentAreaScrolled);
+ INIT(ContentAreaWillPaint);
+ INIT(MouseEnteredContentArea);
+ INIT(MouseExitedContentArea);
+ INIT(MouseMovedInContentArea);
+ INIT(WillStartLiveResize);
+ INIT(ContentAreaResized);
+ INIT(WillEndLiveResize);
+ INIT(ContentAreaDidShow);
+ INIT(ContentAreaDidHide);
+#endif
+ INIT(ScrollbarPainterUsesOverlayScrollers);
#else
INIT(GetHyphenationLocationBeforeIndex);
#endif
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
index 0d9eb34..cadf192 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -1051,6 +1051,30 @@ void WebPage::setDrawsTransparentBackground(bool drawsTransparentBackground)
m_drawingArea->setNeedsDisplay(IntRect(IntPoint(0, 0), m_viewSize));
}
+void WebPage::viewWillStartLiveResize()
+{
+ if (!m_page)
+ return;
+
+ // FIXME: This should propagate to all ScrollableAreas.
+ if (Frame* frame = m_page->focusController()->focusedOrMainFrame()) {
+ if (FrameView* view = frame->view())
+ view->willStartLiveResize();
+ }
+}
+
+void WebPage::viewWillEndLiveResize()
+{
+ if (!m_page)
+ return;
+
+ // FIXME: This should propagate to all ScrollableAreas.
+ if (Frame* frame = m_page->focusController()->focusedOrMainFrame()) {
+ if (FrameView* view = frame->view())
+ view->willEndLiveResize();
+ }
+}
+
void WebPage::setFocused(bool isFocused)
{
m_page->focusController()->setFocused(isFocused);
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h
index b813011..1ac47c0 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h
@@ -378,6 +378,9 @@ private:
void setDrawsBackground(bool);
void setDrawsTransparentBackground(bool);
+ void viewWillStartLiveResize();
+ void viewWillEndLiveResize();
+
void getContentsAsString(uint64_t callbackID);
void getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID);
void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, uint64_t callbackID);
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
index 6ce4c31..fe7cd56 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -29,6 +29,9 @@ messages -> WebPage {
SetDrawsBackground(bool drawsBackground)
SetDrawsTransparentBackground(bool drawsTransparentBackground)
+ ViewWillStartLiveResize()
+ ViewWillEndLiveResize()
+
KeyEvent(WebKit::WebKeyboardEvent event)
MouseEvent(WebKit::WebMouseEvent event)
WheelEvent(WebKit::WebWheelEvent event)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list