⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 98664 in webkit


Ignore:
Timestamp:
Oct 27, 2011, 5:18:55 PM (15 years ago)
Author:
andersca@apple.com
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.

Location:
trunk/Source
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r98661 r98664  
     12011-10-27  Anders Carlsson  <andersca@apple.com>
     2
     3        Add a Plugin::geometryDidChange that will work with transforms
     4        https://bugs.webkit.org/show_bug.cgi?id=71072
     5
     6        Reviewed by Simon Fraser.
     7
     8        Export symbols needed by WebKit2.
     9
     10        * WebCore.exp.in:
     11
    1122011-10-27  Adam Barth  <abarth@webkit.org>
    213
  • trunk/Source/WebCore/WebCore.exp.in

    r98650 r98664  
    402402__ZN7WebCore14StorageTracker32syncFileSystemAndTrackerDatabaseEv
    403403__ZN7WebCore14endOfParagraphERKNS_15VisiblePositionENS_27EditingBoundaryCrossingRuleE
     404__ZN7WebCore15AffineTransformC1Edddddd
    404405__ZN7WebCore15ArchiveResource6createEN3WTF10PassRefPtrINS_12SharedBufferEEERKNS_4KURLERKNS1_6StringESA_SA_RKNS_16ResourceResponseE
    405406__ZN7WebCore15DOMWrapperWorld13clearWrappersEv
     
    11221123__ZNK7WebCore10ScrollView18visibleContentRectEb
    11231124__ZNK7WebCore10ScrollView18contentsToRootViewERKNS_7IntRectE
     1125__ZNK7WebCore10ScrollView18contentsToRootViewERKNS_8IntPointE
    11241126__ZN7WebCore11CachedImage5imageEv
    11251127__ZNK7WebCore11FrameLoader10isCompleteEv
  • trunk/Source/WebKit2/ChangeLog

    r98652 r98664  
     12011-10-27  Anders Carlsson  <andersca@apple.com>
     2
     3        Add a Plugin::geometryDidChange that will work with transforms
     4        https://bugs.webkit.org/show_bug.cgi?id=71072
     5
     6        Reviewed by Simon Fraser.
     7
     8        Add a new Plugin::geometryDidChange pure virtual member function, that takes
     9        the size of the plug-in, the clip rect (in plug-in coordinates), and a matrix that makes
     10        it possible to convert between root view coordinates and plug-in coordinates.
     11
     12        PluginView only calls this new geometryDidChange member function if
     13        Plugin::wantsWindowRelativeCoordinates returns false, which is only true for BuiltInPDFView right now.
     14
     15        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
     16        (WebKit::NetscapePlugin::geometryDidChange):
     17        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
     18        Add stub.
     19
     20        * WebProcess/Plugins/PDF/BuiltInPDFView.cpp:
     21        (WebKit::BuiltInPDFView::updateScrollbars):
     22        (WebKit::BuiltInPDFView::pdfDocumentDidLoad):
     23        (WebKit::BuiltInPDFView::paintContent):
     24        (WebKit::BuiltInPDFView::deprecatedGeometryDidChange):
     25        (WebKit::BuiltInPDFView::geometryDidChange):
     26        (WebKit::BuiltInPDFView::setScrollOffset):
     27        (WebKit::BuiltInPDFView::maximumScrollPosition):
     28        (WebKit::BuiltInPDFView::visibleHeight):
     29        (WebKit::BuiltInPDFView::visibleWidth):
     30        * WebProcess/Plugins/PDF/BuiltInPDFView.h:
     31        There's no need to keep track of the plug-in rect anymore.
     32
     33        * WebProcess/Plugins/Plugin.h:
     34        Add and document geometryDidChange.
     35
     36        * WebProcess/Plugins/PluginProxy.cpp:
     37        (WebKit::PluginProxy::geometryDidChange):
     38        * WebProcess/Plugins/PluginProxy.h:
     39        Add stub.
     40
     41        * WebProcess/Plugins/PluginView.cpp:
     42        (WebKit::PluginView::viewGeometryDidChange):
     43        Call geometryDidChange.
     44
    1452011-10-27  Joseph Pecoraro  <pecoraro@apple.com>
    246
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp

    r98646 r98664  
    677677}
    678678
     679void NetscapePlugin::geometryDidChange(const IntSize& pluginSize, const IntRect& clipRect, const AffineTransform& pluginToRootViewTransform)
     680{
     681    // FIXME: This isn't called yet.
     682    ASSERT_NOT_REACHED();
     683}
     684
    679685void NetscapePlugin::visibilityDidChange()
    680686{
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h

    r98646 r98664  
    170170    virtual bool isTransparent();
    171171    virtual void deprecatedGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect);
     172    virtual void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform);
    172173    virtual void visibilityDidChange();
    173174    virtual void frameDidFinishLoading(uint64_t requestID);
  • trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp

    r98646 r98664  
    9898{
    9999    if (m_horizontalScrollbar) {
    100         if (m_frameRect.width() >= m_pdfDocumentSize.width())
     100        if (m_pluginSize.width() >= m_pdfDocumentSize.width())
    101101            destroyScrollbar(HorizontalScrollbar);
    102     } else if (m_frameRect.width() < m_pdfDocumentSize.width())
     102    } else if (m_pluginSize.width() < m_pdfDocumentSize.width())
    103103        m_horizontalScrollbar = createScrollbar(HorizontalScrollbar);
    104104
    105105    if (m_verticalScrollbar) {
    106         if (m_frameRect.height() >= m_pdfDocumentSize.height())
     106        if (m_pluginSize.height() >= m_pdfDocumentSize.height())
    107107            destroyScrollbar(VerticalScrollbar);
    108     } else if (m_frameRect.height() < m_pdfDocumentSize.height())
     108    } else if (m_pluginSize.height() < m_pdfDocumentSize.height())
    109109        m_verticalScrollbar = createScrollbar(VerticalScrollbar);
    110110
     
    116116    if (m_horizontalScrollbar) {
    117117        m_horizontalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
    118         m_horizontalScrollbar->setProportion(m_frameRect.width() - verticalScrollbarWidth, m_pdfDocumentSize.width());
    119         IntRect scrollbarRect(pluginView()->x(), pluginView()->y() + m_frameRect.height() - m_horizontalScrollbar->height(), m_frameRect.width(), m_horizontalScrollbar->height());
     118        m_horizontalScrollbar->setProportion(m_pluginSize.width() - verticalScrollbarWidth, m_pdfDocumentSize.width());
     119        IntRect scrollbarRect(pluginView()->x(), pluginView()->y() + m_pluginSize.height() - m_horizontalScrollbar->height(), m_pluginSize.width(), m_horizontalScrollbar->height());
    120120        if (m_verticalScrollbar)
    121121            scrollbarRect.contract(m_verticalScrollbar->width(), 0);
     
    124124    if (m_verticalScrollbar) {
    125125        m_verticalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
    126         m_verticalScrollbar->setProportion(m_frameRect.height() - horizontalScrollbarHeight, m_pdfDocumentSize.height());
    127         IntRect scrollbarRect(IntRect(pluginView()->x() + m_frameRect.width() - m_verticalScrollbar->width(), pluginView()->y(), m_verticalScrollbar->width(), m_frameRect.height()));
     126        m_verticalScrollbar->setProportion(m_pluginSize.height() - horizontalScrollbarHeight, m_pdfDocumentSize.height());
     127        IntRect scrollbarRect(IntRect(pluginView()->x() + m_pluginSize.width() - m_verticalScrollbar->width(), pluginView()->y(), m_verticalScrollbar->width(), m_pluginSize.height()));
    128128        if (m_horizontalScrollbar)
    129129            scrollbarRect.contract(0, m_horizontalScrollbar->height());
     
    212212    updateScrollbars();
    213213
    214     controller()->invalidate(IntRect(0, 0, m_frameRect.width(), m_frameRect.height()));
     214    controller()->invalidate(IntRect(0, 0, m_pluginSize.width(), m_pluginSize.height()));
    215215}
    216216
     
    293293    for (size_t i = 0; i < m_pageBoxes.size(); ++i) {
    294294        IntRect pageBox = m_pageBoxes[i];
    295         float extraOffsetForCenteringX = max(roundf((m_frameRect.width() - pageBox.width()) / 2.0f), 0.0f);
    296         float extraOffsetForCenteringY = (m_pageBoxes.size() == 1) ? max(roundf((m_frameRect.height() - pageBox.height() + shadowOffsetY) / 2.0f), 0.0f) : 0;
     295        float extraOffsetForCenteringX = max(roundf((m_pluginSize.width() - pageBox.width()) / 2.0f), 0.0f);
     296        float extraOffsetForCenteringY = (m_pageBoxes.size() == 1) ? max(roundf((m_pluginSize.height() - pageBox.height() + shadowOffsetY) / 2.0f), 0.0f) : 0;
    297297
    298298        if (pageTop > contentRect.maxY())
     
    370370void BuiltInPDFView::deprecatedGeometryDidChange(const IntRect& frameRect, const IntRect& clipRect)
    371371{
    372     if (m_frameRect == frameRect) {
     372    ASSERT_NOT_REACHED();
     373}
     374
     375void BuiltInPDFView::geometryDidChange(const IntSize& pluginSize, const IntRect& clipRect, const AffineTransform& pluginToRootViewTransform)
     376{
     377    if (m_pluginSize == pluginSize) {
    373378        // Nothing to do.
    374379        return;
    375380    }
    376381
    377     m_frameRect = frameRect;
     382    m_pluginSize = pluginSize;
    378383    updateScrollbars();
    379384}
     
    595600    m_scrollOffset = IntSize(offset.x(), offset.y());
    596601    // FIXME: It would be better for performance to blit parts that remain visible.
    597     controller()->invalidate(IntRect(0, 0, m_frameRect.width(), m_frameRect.height()));
     602    controller()->invalidate(IntRect(0, 0, m_pluginSize.width(), m_pluginSize.height()));
    598603}
    599604
     
    652657    int verticalScrollbarWidth = (m_verticalScrollbar && !m_verticalScrollbar->isOverlayScrollbar()) ? m_verticalScrollbar->width() : 0;
    653658
    654     IntPoint maximumOffset(m_pdfDocumentSize.width() - m_frameRect.width() + verticalScrollbarWidth, m_pdfDocumentSize.height() - m_frameRect.height() + horizontalScrollbarHeight);
     659    IntPoint maximumOffset(m_pdfDocumentSize.width() - m_pluginSize.width() + verticalScrollbarWidth, m_pdfDocumentSize.height() - m_pluginSize.height() + horizontalScrollbarHeight);
    655660    maximumOffset.clampNegativeToZero();
    656661    return maximumOffset;
     
    659664LayoutUnit BuiltInPDFView::visibleHeight() const
    660665{
    661     return m_frameRect.height();
     666    return m_pluginSize.height();
    662667}
    663668
    664669LayoutUnit BuiltInPDFView::visibleWidth() const
    665670{
    666     return m_frameRect.width();
     671    return m_pluginSize.width();
    667672}
    668673
  • trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h

    r98646 r98664  
    7979    virtual bool isTransparent();
    8080    virtual void deprecatedGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect);
     81    virtual void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform);
    8182    virtual void visibilityDidChange();
    8283    virtual void frameDidFinishLoading(uint64_t requestID);
     
    144145    virtual WebCore::IntPoint convertFromContainingViewToScrollbar(const WebCore::Scrollbar*, const WebCore::IntPoint& parentPoint) const;
    145146
    146     // In window coordinates.
    147     WebCore::IntRect m_frameRect;
     147    WebCore::IntSize m_pluginSize;
    148148
    149149    WebCore::KURL m_sourceURL;
  • trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h

    r98646 r98664  
    4141
    4242namespace WebCore {
     43    class AffineTransform;
    4344    class GraphicsContext;
    4445    class IntRect;
     
    119120    virtual void deprecatedGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect) = 0;
    120121
     122    // Tells the plug-in that its geometry has changed. The clip rect is in plug-in coordinates, and the affine transform can be used
     123    // to convert from root view coordinates to plug-in coordinates.
     124    virtual void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform) = 0;
     125
    121126    // 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.)
    122127    virtual void visibilityDidChange() = 0;
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp

    r98646 r98664  
    242242}
    243243
     244void PluginProxy::geometryDidChange(const IntSize& pluginSize, const IntRect& clipRect, const AffineTransform& pluginToRootViewTransform)
     245{
     246    // FIXME: This isn't called yet.
     247    ASSERT_NOT_REACHED();
     248}
     249
    244250void PluginProxy::visibilityDidChange()
    245251{
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h

    r98646 r98664  
    7373    virtual bool isTransparent();
    7474    virtual void deprecatedGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect);
     75    virtual void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform);
    7576    virtual void visibilityDidChange();
    7677    virtual void frameDidFinishLoading(uint64_t requestID);
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp

    r98646 r98664  
    717717        return;
    718718
    719     IntRect rect;
    720 
    721719    if (m_plugin->wantsWindowRelativeCoordinates()) {
    722720        // Get the frame rect in window coordinates.
    723         rect = parent()->contentsToWindow(frameRect());
    724     } else {
    725         // FIXME: The plug-in shouldn't know its location relative to its parent frame.
    726         rect = frameRect();
    727     }
    728 
    729     m_plugin->deprecatedGeometryDidChange(rect, clipRectInWindowCoordinates());
     721        IntRect rect = parent()->contentsToWindow(frameRect());
     722        m_plugin->deprecatedGeometryDidChange(rect, clipRectInWindowCoordinates());
     723        return;
     724    }
     725
     726    // FIXME: Just passing a translation matrix isn't good enough.
     727    IntPoint locationInWindowCoordinates = parent()->contentsToRootView(frameRect().location());
     728    AffineTransform transform = AffineTransform::translation(locationInWindowCoordinates.x(), locationInWindowCoordinates.y());
     729
     730    // FIXME: The clip rect isn't correct.
     731    IntRect clipRect = boundsRect();
     732    m_plugin->geometryDidChange(size(), clipRect, transform);
     733
    730734}
    731735
Note: See TracChangeset for help on using the changeset viewer.