Title: [98664] trunk/Source
Revision
98664
Author
[email protected]
Date
2011-10-27 17:18:55 -0700 (Thu, 27 Oct 2011)

Log Message

Add a Plugin::geometryDidChange that will work with transforms
https://bugs.webkit.org/show_bug.cgi?id=71072

Reviewed by Simon Fraser.

Source/WebCore:

Export symbols needed by WebKit2.

* WebCore.exp.in:

Source/WebKit2:

Add a new Plugin::geometryDidChange pure virtual member function, that takes
the size of the plug-in, the clip rect (in plug-in coordinates), and a matrix that makes
it possible to convert between root view coordinates and plug-in coordinates.

PluginView only calls this new geometryDidChange member function if
Plugin::wantsWindowRelativeCoordinates returns false, which is only true for BuiltInPDFView right now.

* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::geometryDidChange):
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
Add stub.

* WebProcess/Plugins/PDF/BuiltInPDFView.cpp:
(WebKit::BuiltInPDFView::updateScrollbars):
(WebKit::BuiltInPDFView::pdfDocumentDidLoad):
(WebKit::BuiltInPDFView::paintContent):
(WebKit::BuiltInPDFView::deprecatedGeometryDidChange):
(WebKit::BuiltInPDFView::geometryDidChange):
(WebKit::BuiltInPDFView::setScrollOffset):
(WebKit::BuiltInPDFView::maximumScrollPosition):
(WebKit::BuiltInPDFView::visibleHeight):
(WebKit::BuiltInPDFView::visibleWidth):
* WebProcess/Plugins/PDF/BuiltInPDFView.h:
There's no need to keep track of the plug-in rect anymore.

* WebProcess/Plugins/Plugin.h:
Add and document geometryDidChange.

* WebProcess/Plugins/PluginProxy.cpp:
(WebKit::PluginProxy::geometryDidChange):
* WebProcess/Plugins/PluginProxy.h:
Add stub.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::viewGeometryDidChange):
Call geometryDidChange.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (98663 => 98664)


--- trunk/Source/WebCore/ChangeLog	2011-10-28 00:01:45 UTC (rev 98663)
+++ trunk/Source/WebCore/ChangeLog	2011-10-28 00:18:55 UTC (rev 98664)
@@ -1,3 +1,14 @@
+2011-10-27  Anders Carlsson  <[email protected]>
+
+        Add a Plugin::geometryDidChange that will work with transforms
+        https://bugs.webkit.org/show_bug.cgi?id=71072
+
+        Reviewed by Simon Fraser.
+
+        Export symbols needed by WebKit2.
+
+        * WebCore.exp.in:
+
 2011-10-27  Adam Barth  <[email protected]>
 
         Exception subtypes have incorrect namespace indentation

Modified: trunk/Source/WebCore/WebCore.exp.in (98663 => 98664)


--- trunk/Source/WebCore/WebCore.exp.in	2011-10-28 00:01:45 UTC (rev 98663)
+++ trunk/Source/WebCore/WebCore.exp.in	2011-10-28 00:18:55 UTC (rev 98664)
@@ -401,6 +401,7 @@
 __ZN7WebCore14StorageTracker18diskUsageForOriginEPNS_14SecurityOriginE
 __ZN7WebCore14StorageTracker32syncFileSystemAndTrackerDatabaseEv
 __ZN7WebCore14endOfParagraphERKNS_15VisiblePositionENS_27EditingBoundaryCrossingRuleE
+__ZN7WebCore15AffineTransformC1Edddddd
 __ZN7WebCore15ArchiveResource6createEN3WTF10PassRefPtrINS_12SharedBufferEEERKNS_4KURLERKNS1_6StringESA_SA_RKNS_16ResourceResponseE
 __ZN7WebCore15DOMWrapperWorld13clearWrappersEv
 __ZN7WebCore15DOMWrapperWorldD1Ev
@@ -1121,6 +1122,7 @@
 __ZNK7WebCore10ScrollView16windowToContentsERKNS_8IntPointE
 __ZNK7WebCore10ScrollView18visibleContentRectEb
 __ZNK7WebCore10ScrollView18contentsToRootViewERKNS_7IntRectE
+__ZNK7WebCore10ScrollView18contentsToRootViewERKNS_8IntPointE
 __ZN7WebCore11CachedImage5imageEv
 __ZNK7WebCore11FrameLoader10isCompleteEv
 __ZNK7WebCore11FrameLoader14cancelledErrorERKNS_15ResourceRequestE

Modified: trunk/Source/WebKit2/ChangeLog (98663 => 98664)


--- trunk/Source/WebKit2/ChangeLog	2011-10-28 00:01:45 UTC (rev 98663)
+++ trunk/Source/WebKit2/ChangeLog	2011-10-28 00:18:55 UTC (rev 98664)
@@ -1,3 +1,47 @@
+2011-10-27  Anders Carlsson  <[email protected]>
+
+        Add a Plugin::geometryDidChange that will work with transforms
+        https://bugs.webkit.org/show_bug.cgi?id=71072
+
+        Reviewed by Simon Fraser.
+
+        Add a new Plugin::geometryDidChange pure virtual member function, that takes
+        the size of the plug-in, the clip rect (in plug-in coordinates), and a matrix that makes
+        it possible to convert between root view coordinates and plug-in coordinates.
+
+        PluginView only calls this new geometryDidChange member function if 
+        Plugin::wantsWindowRelativeCoordinates returns false, which is only true for BuiltInPDFView right now.
+
+        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+        (WebKit::NetscapePlugin::geometryDidChange):
+        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+        Add stub.
+
+        * WebProcess/Plugins/PDF/BuiltInPDFView.cpp:
+        (WebKit::BuiltInPDFView::updateScrollbars):
+        (WebKit::BuiltInPDFView::pdfDocumentDidLoad):
+        (WebKit::BuiltInPDFView::paintContent):
+        (WebKit::BuiltInPDFView::deprecatedGeometryDidChange):
+        (WebKit::BuiltInPDFView::geometryDidChange):
+        (WebKit::BuiltInPDFView::setScrollOffset):
+        (WebKit::BuiltInPDFView::maximumScrollPosition):
+        (WebKit::BuiltInPDFView::visibleHeight):
+        (WebKit::BuiltInPDFView::visibleWidth):
+        * WebProcess/Plugins/PDF/BuiltInPDFView.h:
+        There's no need to keep track of the plug-in rect anymore.
+
+        * WebProcess/Plugins/Plugin.h:
+        Add and document geometryDidChange.
+
+        * WebProcess/Plugins/PluginProxy.cpp:
+        (WebKit::PluginProxy::geometryDidChange):
+        * WebProcess/Plugins/PluginProxy.h:
+        Add stub.
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::viewGeometryDidChange):
+        Call geometryDidChange.
+
 2011-10-27  Joseph Pecoraro  <[email protected]>
 
         Reviewed by David Kilzer.

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (98663 => 98664)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2011-10-28 00:01:45 UTC (rev 98663)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2011-10-28 00:18:55 UTC (rev 98664)
@@ -676,6 +676,12 @@
     callSetWindow();
 }
 
+void NetscapePlugin::geometryDidChange(const IntSize& pluginSize, const IntRect& clipRect, const AffineTransform& pluginToRootViewTransform)
+{
+    // FIXME: This isn't called yet.
+    ASSERT_NOT_REACHED();
+}
+
 void NetscapePlugin::visibilityDidChange()
 {
     ASSERT(m_isStarted);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (98663 => 98664)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-10-28 00:01:45 UTC (rev 98663)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-10-28 00:18:55 UTC (rev 98664)
@@ -169,6 +169,7 @@
 #endif
     virtual bool isTransparent();
     virtual void deprecatedGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect);
+    virtual void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform);
     virtual void visibilityDidChange();
     virtual void frameDidFinishLoading(uint64_t requestID);
     virtual void frameDidFail(uint64_t requestID, bool wasCancelled);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp (98663 => 98664)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp	2011-10-28 00:01:45 UTC (rev 98663)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp	2011-10-28 00:18:55 UTC (rev 98664)
@@ -97,15 +97,15 @@
 void BuiltInPDFView::updateScrollbars()
 {
     if (m_horizontalScrollbar) {
-        if (m_frameRect.width() >= m_pdfDocumentSize.width())
+        if (m_pluginSize.width() >= m_pdfDocumentSize.width())
             destroyScrollbar(HorizontalScrollbar);
-    } else if (m_frameRect.width() < m_pdfDocumentSize.width())
+    } else if (m_pluginSize.width() < m_pdfDocumentSize.width())
         m_horizontalScrollbar = createScrollbar(HorizontalScrollbar);
 
     if (m_verticalScrollbar) {
-        if (m_frameRect.height() >= m_pdfDocumentSize.height())
+        if (m_pluginSize.height() >= m_pdfDocumentSize.height())
             destroyScrollbar(VerticalScrollbar);
-    } else if (m_frameRect.height() < m_pdfDocumentSize.height())
+    } else if (m_pluginSize.height() < m_pdfDocumentSize.height())
         m_verticalScrollbar = createScrollbar(VerticalScrollbar);
 
     int horizontalScrollbarHeight = (m_horizontalScrollbar && !m_horizontalScrollbar->isOverlayScrollbar()) ? m_horizontalScrollbar->height() : 0;
@@ -115,16 +115,16 @@
 
     if (m_horizontalScrollbar) {
         m_horizontalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
-        m_horizontalScrollbar->setProportion(m_frameRect.width() - verticalScrollbarWidth, m_pdfDocumentSize.width());
-        IntRect scrollbarRect(pluginView()->x(), pluginView()->y() + m_frameRect.height() - m_horizontalScrollbar->height(), m_frameRect.width(), m_horizontalScrollbar->height());
+        m_horizontalScrollbar->setProportion(m_pluginSize.width() - verticalScrollbarWidth, m_pdfDocumentSize.width());
+        IntRect scrollbarRect(pluginView()->x(), pluginView()->y() + m_pluginSize.height() - m_horizontalScrollbar->height(), m_pluginSize.width(), m_horizontalScrollbar->height());
         if (m_verticalScrollbar)
             scrollbarRect.contract(m_verticalScrollbar->width(), 0);
         m_horizontalScrollbar->setFrameRect(scrollbarRect);
     }
     if (m_verticalScrollbar) {
         m_verticalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
-        m_verticalScrollbar->setProportion(m_frameRect.height() - horizontalScrollbarHeight, m_pdfDocumentSize.height());
-        IntRect scrollbarRect(IntRect(pluginView()->x() + m_frameRect.width() - m_verticalScrollbar->width(), pluginView()->y(), m_verticalScrollbar->width(), m_frameRect.height()));
+        m_verticalScrollbar->setProportion(m_pluginSize.height() - horizontalScrollbarHeight, m_pdfDocumentSize.height());
+        IntRect scrollbarRect(IntRect(pluginView()->x() + m_pluginSize.width() - m_verticalScrollbar->width(), pluginView()->y(), m_verticalScrollbar->width(), m_pluginSize.height()));
         if (m_horizontalScrollbar)
             scrollbarRect.contract(0, m_horizontalScrollbar->height());
         m_verticalScrollbar->setFrameRect(scrollbarRect);
@@ -211,7 +211,7 @@
     calculateSizes();
     updateScrollbars();
 
-    controller()->invalidate(IntRect(0, 0, m_frameRect.width(), m_frameRect.height()));
+    controller()->invalidate(IntRect(0, 0, m_pluginSize.width(), m_pluginSize.height()));
 }
 
 void BuiltInPDFView::calculateSizes()
@@ -292,8 +292,8 @@
     int pageTop = 0;
     for (size_t i = 0; i < m_pageBoxes.size(); ++i) {
         IntRect pageBox = m_pageBoxes[i];
-        float extraOffsetForCenteringX = max(roundf((m_frameRect.width() - pageBox.width()) / 2.0f), 0.0f);
-        float extraOffsetForCenteringY = (m_pageBoxes.size() == 1) ? max(roundf((m_frameRect.height() - pageBox.height() + shadowOffsetY) / 2.0f), 0.0f) : 0;
+        float extraOffsetForCenteringX = max(roundf((m_pluginSize.width() - pageBox.width()) / 2.0f), 0.0f);
+        float extraOffsetForCenteringY = (m_pageBoxes.size() == 1) ? max(roundf((m_pluginSize.height() - pageBox.height() + shadowOffsetY) / 2.0f), 0.0f) : 0;
 
         if (pageTop > contentRect.maxY())
             break;
@@ -369,12 +369,17 @@
 
 void BuiltInPDFView::deprecatedGeometryDidChange(const IntRect& frameRect, const IntRect& clipRect)
 {
-    if (m_frameRect == frameRect) {
+    ASSERT_NOT_REACHED();
+}
+
+void BuiltInPDFView::geometryDidChange(const IntSize& pluginSize, const IntRect& clipRect, const AffineTransform& pluginToRootViewTransform)
+{
+    if (m_pluginSize == pluginSize) {
         // Nothing to do.
         return;
     }
 
-    m_frameRect = frameRect;
+    m_pluginSize = pluginSize;
     updateScrollbars();
 }
 
@@ -594,7 +599,7 @@
 {
     m_scrollOffset = IntSize(offset.x(), offset.y());
     // FIXME: It would be better for performance to blit parts that remain visible.
-    controller()->invalidate(IntRect(0, 0, m_frameRect.width(), m_frameRect.height()));
+    controller()->invalidate(IntRect(0, 0, m_pluginSize.width(), m_pluginSize.height()));
 }
 
 int BuiltInPDFView::scrollSize(ScrollbarOrientation orientation) const
@@ -651,19 +656,19 @@
     int horizontalScrollbarHeight = (m_horizontalScrollbar && !m_horizontalScrollbar->isOverlayScrollbar()) ? m_horizontalScrollbar->height() : 0;
     int verticalScrollbarWidth = (m_verticalScrollbar && !m_verticalScrollbar->isOverlayScrollbar()) ? m_verticalScrollbar->width() : 0;
 
-    IntPoint maximumOffset(m_pdfDocumentSize.width() - m_frameRect.width() + verticalScrollbarWidth, m_pdfDocumentSize.height() - m_frameRect.height() + horizontalScrollbarHeight);
+    IntPoint maximumOffset(m_pdfDocumentSize.width() - m_pluginSize.width() + verticalScrollbarWidth, m_pdfDocumentSize.height() - m_pluginSize.height() + horizontalScrollbarHeight);
     maximumOffset.clampNegativeToZero();
     return maximumOffset;
 }
 
 LayoutUnit BuiltInPDFView::visibleHeight() const
 {
-    return m_frameRect.height();
+    return m_pluginSize.height();
 }
 
 LayoutUnit BuiltInPDFView::visibleWidth() const
 {
-    return m_frameRect.width();
+    return m_pluginSize.width();
 }
 
 IntSize BuiltInPDFView::contentsSize() const

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h (98663 => 98664)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2011-10-28 00:01:45 UTC (rev 98663)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2011-10-28 00:18:55 UTC (rev 98664)
@@ -78,6 +78,7 @@
 #endif
     virtual bool isTransparent();
     virtual void deprecatedGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect);
+    virtual void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform);
     virtual void visibilityDidChange();
     virtual void frameDidFinishLoading(uint64_t requestID);
     virtual void frameDidFail(uint64_t requestID, bool wasCancelled);
@@ -143,8 +144,7 @@
     // 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;
 
-    // In window coordinates.
-    WebCore::IntRect m_frameRect;
+    WebCore::IntSize m_pluginSize;
 
     WebCore::KURL m_sourceURL;
 

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h (98663 => 98664)


--- trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h	2011-10-28 00:01:45 UTC (rev 98663)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h	2011-10-28 00:18:55 UTC (rev 98664)
@@ -40,6 +40,7 @@
 }
 
 namespace WebCore {
+    class AffineTransform;
     class GraphicsContext;
     class IntRect;
     class Scrollbar;
@@ -118,6 +119,10 @@
     // Tells the plug-in that either the plug-ins frame rect or its clip rect has changed. Both rects are in window coordinates.
     virtual void deprecatedGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect) = 0;
 
+    // Tells the plug-in that its geometry has changed. The clip rect is in plug-in coordinates, and the affine transform can be used
+    // to convert from root view coordinates to plug-in coordinates.
+    virtual void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform) = 0;
+
     // Tells the plug-in that it has been explicitly hidden or shown. (Note that this is not called when the plug-in becomes obscured from view on screen.)
     virtual void visibilityDidChange() = 0;
 

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp (98663 => 98664)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-10-28 00:01:45 UTC (rev 98663)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-10-28 00:18:55 UTC (rev 98664)
@@ -241,6 +241,12 @@
     geometryDidChange();
 }
 
+void PluginProxy::geometryDidChange(const IntSize& pluginSize, const IntRect& clipRect, const AffineTransform& pluginToRootViewTransform)
+{
+    // FIXME: This isn't called yet.
+    ASSERT_NOT_REACHED();
+}
+
 void PluginProxy::visibilityDidChange()
 {
     ASSERT(m_isStarted);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h (98663 => 98664)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2011-10-28 00:01:45 UTC (rev 98663)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2011-10-28 00:18:55 UTC (rev 98664)
@@ -72,6 +72,7 @@
 #endif
     virtual bool isTransparent();
     virtual void deprecatedGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect);
+    virtual void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform);
     virtual void visibilityDidChange();
     virtual void frameDidFinishLoading(uint64_t requestID);
     virtual void frameDidFail(uint64_t requestID, bool wasCancelled);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (98663 => 98664)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2011-10-28 00:01:45 UTC (rev 98663)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2011-10-28 00:18:55 UTC (rev 98664)
@@ -716,17 +716,21 @@
     if (!m_isInitialized || !m_plugin || !parent())
         return;
 
-    IntRect rect;
-
     if (m_plugin->wantsWindowRelativeCoordinates()) {
         // Get the frame rect in window coordinates.
-        rect = parent()->contentsToWindow(frameRect());
-    } else {
-        // FIXME: The plug-in shouldn't know its location relative to its parent frame.
-        rect = frameRect();
+        IntRect rect = parent()->contentsToWindow(frameRect());
+        m_plugin->deprecatedGeometryDidChange(rect, clipRectInWindowCoordinates());
+        return;
     }
 
-    m_plugin->deprecatedGeometryDidChange(rect, clipRectInWindowCoordinates());
+    // FIXME: Just passing a translation matrix isn't good enough.
+    IntPoint locationInWindowCoordinates = parent()->contentsToRootView(frameRect().location());
+    AffineTransform transform = AffineTransform::translation(locationInWindowCoordinates.x(), locationInWindowCoordinates.y());
+
+    // FIXME: The clip rect isn't correct.
+    IntRect clipRect = boundsRect();
+    m_plugin->geometryDidChange(size(), clipRect, transform);
+
 }
 
 void PluginView::viewVisibilityDidChange()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to