Title: [102273] branches/safari-534.53-branch/Source

Diff

Modified: branches/safari-534.53-branch/Source/WebCore/ChangeLog (102272 => 102273)


--- branches/safari-534.53-branch/Source/WebCore/ChangeLog	2011-12-07 22:37:06 UTC (rev 102272)
+++ branches/safari-534.53-branch/Source/WebCore/ChangeLog	2011-12-07 22:43:50 UTC (rev 102273)
@@ -1,5 +1,20 @@
 2011-12-07  Lucas Forschler  <[email protected]>
 
+    Merge 98664
+
+    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-12-07  Lucas Forschler  <[email protected]>
+
     Merge 97514
 
     2011-10-14  Jeff Miller  <[email protected]>

Modified: branches/safari-534.53-branch/Source/WebCore/WebCore.exp.in (102272 => 102273)


--- branches/safari-534.53-branch/Source/WebCore/WebCore.exp.in	2011-12-07 22:37:06 UTC (rev 102272)
+++ branches/safari-534.53-branch/Source/WebCore/WebCore.exp.in	2011-12-07 22:43:50 UTC (rev 102273)
@@ -393,6 +393,7 @@
 __ZN7WebCore14SecurityOrigin6createERKN3WTF6StringES4_i
 __ZN7WebCore14SecurityOrigin6createERKNS_4KURLEi
 __ZN7WebCore14endOfParagraphERKNS_15VisiblePositionENS_27EditingBoundaryCrossingRuleE
+__ZN7WebCore15AffineTransformC1Edddddd
 __ZN7WebCore15ArchiveResource6createEN3WTF10PassRefPtrINS_12SharedBufferEEERKNS_4KURLERKNS1_6StringESA_SA_RKNS_16ResourceResponseE
 __ZN7WebCore15DOMWrapperWorld13clearWrappersEv
 __ZN7WebCore15DOMWrapperWorldD1Ev
@@ -1078,6 +1079,7 @@
 __ZNK7WebCore10ScrollView16windowToContentsERKNS_8IntPointE
 __ZNK7WebCore10ScrollView18visibleContentRectEb
 __ZNK7WebCore10ScrollView18contentsToRootViewERKNS_7IntRectE
+__ZNK7WebCore10ScrollView18contentsToRootViewERKNS_8IntPointE
 __ZNK7WebCore11CachedImage5imageEv
 __ZNK7WebCore11FrameLoader10isCompleteEv
 __ZNK7WebCore11FrameLoader12blockedErrorERKNS_15ResourceRequestE

Modified: branches/safari-534.53-branch/Source/WebKit2/ChangeLog (102272 => 102273)


--- branches/safari-534.53-branch/Source/WebKit2/ChangeLog	2011-12-07 22:37:06 UTC (rev 102272)
+++ branches/safari-534.53-branch/Source/WebKit2/ChangeLog	2011-12-07 22:43:50 UTC (rev 102273)
@@ -1,5 +1,53 @@
 2011-12-07  Lucas Forschler  <[email protected]>
 
+    Merge 98664
+
+    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-12-07  Lucas Forschler  <[email protected]>
+
     Merge 97514
 
     2011-10-14  Jeff Miller  <[email protected]>

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (102272 => 102273)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2011-12-07 22:37:06 UTC (rev 102272)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2011-12-07 22:43:50 UTC (rev 102273)
@@ -575,6 +575,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: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (102272 => 102273)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-12-07 22:37:06 UTC (rev 102272)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-12-07 22:43:50 UTC (rev 102273)
@@ -156,6 +156,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: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp (102272 => 102273)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp	2011-12-07 22:37:06 UTC (rev 102272)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp	2011-12-07 22:43:50 UTC (rev 102273)
@@ -103,15 +103,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;
@@ -121,16 +121,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);
@@ -217,7 +217,7 @@
     calculateSizes();
     updateScrollbars();
 
-    m_pluginController->invalidate(IntRect(0, 0, m_frameRect.width(), m_frameRect.height()));
+    m_pluginController->invalidate(IntRect(0, 0, m_pluginSize.width(), m_pluginSize.height()));
 }
 
 void BuiltInPDFView::calculateSizes()
@@ -302,8 +302,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;
@@ -379,12 +379,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();
 }
 
@@ -605,7 +610,7 @@
 {
     m_scrollOffset = IntSize(offset.x(), offset.y());
     // FIXME: It would be better for performance to blit parts that remain visible.
-    m_pluginController->invalidate(IntRect(0, 0, m_frameRect.width(), m_frameRect.height()));
+    m_pluginController->invalidate(IntRect(0, 0, m_pluginSize.width(), m_pluginSize.height()));
 }
 
 int BuiltInPDFView::scrollSize(ScrollbarOrientation orientation) const
@@ -662,19 +667,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;
 }
 
 int BuiltInPDFView::visibleHeight() const
 {
-    return m_frameRect.height();
+    return m_pluginSize.height();
 }
 
 int BuiltInPDFView::visibleWidth() const
 {
-    return m_frameRect.width();
+    return m_pluginSize.width();
 }
 
 IntSize BuiltInPDFView::contentsSize() const

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


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2011-12-07 22:37:06 UTC (rev 102272)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2011-12-07 22:43:50 UTC (rev 102273)
@@ -80,6 +80,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);
@@ -145,8 +146,7 @@
 
     PluginController* m_pluginController;
 
-    // In window coordinates.
-    WebCore::IntRect m_frameRect;
+    WebCore::IntSize m_pluginSize;
 
     WebCore::KURL m_sourceURL;
 

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Plugin.h (102272 => 102273)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Plugin.h	2011-12-07 22:37:06 UTC (rev 102272)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Plugin.h	2011-12-07 22:43:50 UTC (rev 102273)
@@ -40,6 +40,7 @@
 }
 
 namespace WebCore {
+    class AffineTransform;
     class GraphicsContext;
     class IntRect;
     class Scrollbar;
@@ -103,6 +104,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: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp (102272 => 102273)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-12-07 22:37:06 UTC (rev 102272)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-12-07 22:43:50 UTC (rev 102273)
@@ -249,6 +249,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: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.h (102272 => 102273)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2011-12-07 22:37:06 UTC (rev 102272)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2011-12-07 22:43:50 UTC (rev 102273)
@@ -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: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (102272 => 102273)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2011-12-07 22:37:06 UTC (rev 102272)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2011-12-07 22:43:50 UTC (rev 102273)
@@ -714,17 +714,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(); 
-    } 
- 
-    m_plugin->deprecatedGeometryDidChange(rect, clipRectInWindowCoordinates());
+    if (m_plugin->wantsWindowRelativeCoordinates()) {
+        // Get the frame rect in window coordinates.
+        IntRect rect = parent()->contentsToWindow(frameRect());
+        m_plugin->deprecatedGeometryDidChange(rect, clipRectInWindowCoordinates());
+        return;
+    }
+
+    // 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