Title: [162730] trunk/Source/WebKit2
Revision
162730
Author
simon.fra...@apple.com
Date
2014-01-24 15:29:26 -0800 (Fri, 24 Jan 2014)

Log Message

Push a custom fixed position rect down to the WebProcess in iOS WK2
https://bugs.webkit.org/show_bug.cgi?id=127573

Reviewed by Tim Horton.

Make it possible for WKContentView to specify a custom rect
used to layout fixed position elements on iOS.

This is computed in WKContentView, and pushed down
through the RemoteLayerTreeDrawingArea, and eventually
pushed onto FrameView.

* UIProcess/API/ios/WKContentView.mm:
(-[WKContentView fixedPositionRectFromExposedRect:scale:]):
(-[WKContentView _updateFixedPositionRect]):
(-[WKContentView didFinishScrollTo:]):
(-[WKContentView didZoomToScale:]):
* UIProcess/DrawingAreaProxy.cpp:
(WebKit::DrawingAreaProxy::setCustomFixedPositionRect):
* UIProcess/DrawingAreaProxy.h:
* WebProcess/WebPage/DrawingArea.h:
* WebProcess/WebPage/DrawingArea.messages.in:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::setCustomFixedPositionRect):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (162729 => 162730)


--- trunk/Source/WebKit2/ChangeLog	2014-01-24 23:20:08 UTC (rev 162729)
+++ trunk/Source/WebKit2/ChangeLog	2014-01-24 23:29:26 UTC (rev 162730)
@@ -1,3 +1,31 @@
+2014-01-24  Simon Fraser  <simon.fra...@apple.com>
+
+        Push a custom fixed position rect down to the WebProcess in iOS WK2
+        https://bugs.webkit.org/show_bug.cgi?id=127573
+
+        Reviewed by Tim Horton.
+        
+        Make it possible for WKContentView to specify a custom rect
+        used to layout fixed position elements on iOS.
+        
+        This is computed in WKContentView, and pushed down
+        through the RemoteLayerTreeDrawingArea, and eventually
+        pushed onto FrameView.
+
+        * UIProcess/API/ios/WKContentView.mm:
+        (-[WKContentView fixedPositionRectFromExposedRect:scale:]):
+        (-[WKContentView _updateFixedPositionRect]):
+        (-[WKContentView didFinishScrollTo:]):
+        (-[WKContentView didZoomToScale:]):
+        * UIProcess/DrawingAreaProxy.cpp:
+        (WebKit::DrawingAreaProxy::setCustomFixedPositionRect):
+        * UIProcess/DrawingAreaProxy.h:
+        * WebProcess/WebPage/DrawingArea.h:
+        * WebProcess/WebPage/DrawingArea.messages.in:
+        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
+        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
+        (WebKit::RemoteLayerTreeDrawingArea::setCustomFixedPositionRect):
+
 2014-01-24  Anders Carlsson  <ander...@apple.com>
 
         Get rid of WebLoaderClient

Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm (162729 => 162730)


--- trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm	2014-01-24 23:20:08 UTC (rev 162729)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm	2014-01-24 23:29:26 UTC (rev 162730)
@@ -150,6 +150,13 @@
     _page->drawingArea()->setSize(IntSize(size), IntSize(), IntSize());
 }
 
+- (FloatRect)fixedPositionRectFromExposedRect:(FloatRect)exposedRect scale:(float)scale
+{
+    // FIXME: This should modify the rect based on the scale.
+    UNUSED_PARAM(scale);
+    return exposedRect;
+}
+
 - (void)_updateViewExposedRect
 {
     FloatPoint exposedRectPosition = _currentExposedRectPosition;
@@ -159,6 +166,15 @@
         drawingArea->setExposedRect(FloatRect(exposedRectPosition, _page->drawingArea()->size()));
 }
 
+- (void)_updateFixedPositionRect
+{
+    FloatRect exposedRect(_currentExposedRectPosition, _page->drawingArea()->size());
+    FloatRect fixedPosRect = [self fixedPositionRectFromExposedRect:exposedRect scale:_page->pageScaleFactor()];
+
+    if (auto drawingArea = _page->drawingArea())
+        drawingArea->setCustomFixedPositionRect(fixedPosRect);
+}
+
 - (void)setViewportSize:(CGSize)size
 {
     _page->setFixedLayoutSize(IntSize(size));
@@ -170,6 +186,7 @@
     _currentExposedRectPosition = contentOffset;
     _page->didFinishScrolling(contentOffset);
     [self _updateViewExposedRect];
+    [self _updateFixedPositionRect];
 }
 
 - (void)didScrollTo:(CGPoint)contentOffset
@@ -182,6 +199,7 @@
 {
     _page->didFinishZooming(scale);
     [self _updateViewExposedRect];
+    [self _updateFixedPositionRect];
 }
 
 #pragma mark Internal

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp (162729 => 162730)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp	2014-01-24 23:20:08 UTC (rev 162729)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp	2014-01-24 23:29:26 UTC (rev 162730)
@@ -85,6 +85,14 @@
     m_webPageProxy->process().send(Messages::DrawingArea::SetExposedRect(m_exposedRect), m_webPageProxy->pageID());
     m_lastSentExposedRect = m_exposedRect;
 }
+
+void DrawingAreaProxy::setCustomFixedPositionRect(const FloatRect& fixedPositionRect)
+{
+    if (!m_webPageProxy->isValid())
+        return;
+
+    m_webPageProxy->process().send(Messages::DrawingArea::SetCustomFixedPositionRect(fixedPositionRect), m_webPageProxy->pageID());
+}
 #endif
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h (162729 => 162730)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h	2014-01-24 23:20:08 UTC (rev 162729)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h	2014-01-24 23:29:26 UTC (rev 162730)
@@ -77,6 +77,8 @@
     void setExposedRect(const WebCore::FloatRect&);
     WebCore::FloatRect exposedRect() const { return m_exposedRect; }
     void exposedRectChangedTimerFired(WebCore::Timer<DrawingAreaProxy>*);
+    
+    void setCustomFixedPositionRect(const WebCore::FloatRect&);
 #endif
 
 protected:

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (162729 => 162730)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2014-01-24 23:20:08 UTC (rev 162729)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2014-01-24 23:29:26 UTC (rev 162730)
@@ -91,6 +91,7 @@
 #if PLATFORM(MAC)
     virtual void setExposedRect(const WebCore::FloatRect&) = 0;
     virtual WebCore::FloatRect exposedRect() const = 0;
+    virtual void setCustomFixedPositionRect(const WebCore::FloatRect&) = 0;
 #endif
     virtual void mainFrameScrollabilityChanged(bool) { }
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in (162729 => 162730)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in	2014-01-24 23:20:08 UTC (rev 162729)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in	2014-01-24 23:29:26 UTC (rev 162730)
@@ -30,6 +30,7 @@
     SetDeviceScaleFactor(float deviceScaleFactor)
     SetColorSpace(WebKit::ColorSpaceData colorSpace)
     SetExposedRect(WebCore::FloatRect exposedRect)
+    SetCustomFixedPositionRect(WebCore::FloatRect fixedPositionRect)
 
     AdjustTransientZoom(double scale, WebCore::FloatPoint origin)
     CommitTransientZoom(double scale, WebCore::FloatPoint origin)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h (162729 => 162730)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h	2014-01-24 23:20:08 UTC (rev 162729)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h	2014-01-24 23:29:26 UTC (rev 162730)
@@ -75,6 +75,8 @@
     virtual void setExposedRect(const WebCore::FloatRect&) override;
     virtual WebCore::FloatRect exposedRect() const override { return m_scrolledExposedRect; }
 
+    virtual void setCustomFixedPositionRect(const WebCore::FloatRect&) override;
+
     // WebCore::GraphicsLayerClient
     virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) override { }
     virtual void notifyFlushRequired(const WebCore::GraphicsLayer*) override { }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm (162729 => 162730)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm	2014-01-24 23:20:08 UTC (rev 162729)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm	2014-01-24 23:29:26 UTC (rev 162730)
@@ -271,6 +271,17 @@
     frameView->adjustTiledBackingCoverage();
 }
 
+void RemoteLayerTreeDrawingArea::setCustomFixedPositionRect(const FloatRect& fixedPositionRect)
+{
+#if PLATFORM(IOS)
+    FrameView* frameView = m_webPage->corePage()->mainFrame().view();
+    if (!frameView)
+        return;
+
+    frameView->setCustomFixedPositionLayoutRect(enclosingIntRect(fixedPositionRect));
+#endif
+}
+
 TiledBacking* RemoteLayerTreeDrawingArea::mainFrameTiledBacking() const
 {
     FrameView* frameView = m_webPage->corePage()->mainFrame().view();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h (162729 => 162730)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h	2014-01-24 23:20:08 UTC (rev 162729)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h	2014-01-24 23:29:26 UTC (rev 162730)
@@ -81,6 +81,8 @@
     virtual void setExposedRect(const WebCore::FloatRect&) override;
     virtual WebCore::FloatRect exposedRect() const override { return m_scrolledExposedRect; }
 
+    virtual void setCustomFixedPositionRect(const WebCore::FloatRect&) override { }
+
     virtual bool supportsAsyncScrolling() override { return true; }
 
     virtual void didChangeScrollOffsetForAnyFrame() override;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to