Changeset 79040 in webkit


Ignore:
Timestamp:
Feb 18, 2011 3:27:55 PM (13 years ago)
Author:
Simon Fraser
Message:

2011-02-18 Simon Fraser <Simon Fraser>

Reviewed by Dan Bernstein.

Plugin snapshot location is wrong for subframes
https://bugs.webkit.org/show_bug.cgi?id=54776

Only change the CTM to the way that the plugin expects it
when painting the plugin, not when drawing the snapshot.
This fixes the snapshot location when painting flattened
frames.

  • WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::paint):
Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r79030 r79040  
     12011-02-18  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Plugin snapshot location is wrong for subframes
     6        https://bugs.webkit.org/show_bug.cgi?id=54776
     7       
     8        Only change the CTM to the way that the plugin expects it
     9        when painting the plugin, not when drawing the snapshot.
     10        This fixes the snapshot location when painting flattened
     11        frames.
     12
     13        * WebProcess/Plugins/PluginView.cpp:
     14        (WebKit::PluginView::paint):
     15
    1162011-02-18  Anders Carlsson  <andersca@apple.com>
    217
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp

    r78956 r79040  
    513513
    514514    IntRect dirtyRectInWindowCoordinates = parent()->contentsToWindow(dirtyRect);
    515    
    516515    IntRect paintRectInWindowCoordinates = intersection(dirtyRectInWindowCoordinates, clipRectInWindowCoordinates());
    517516    if (paintRectInWindowCoordinates.isEmpty())
    518517        return;
    519518
    520     // context is in document coordinates. Translate it to window coordinates.
    521     IntPoint documentOriginInWindowCoordinates = parent()->contentsToWindow(IntPoint());
    522     context->save();
    523     context->translate(-documentOriginInWindowCoordinates.x(), -documentOriginInWindowCoordinates.y());
    524 
    525519    if (m_snapshot)
    526         m_snapshot->paint(*context, paintRectInWindowCoordinates.location(), m_snapshot->bounds());
    527     else
    528         m_plugin->paint(context, paintRectInWindowCoordinates);
    529 
    530     context->restore();
     520        m_snapshot->paint(*context, frameRect().location(), m_snapshot->bounds());
     521    else {
     522        // The plugin is given a frame rect which is parent()->contentsToWindow(frameRect()),
     523        // and un-translates by the its origin when painting. The current CTM reflects
     524        // this widget's frame is its parent (the document), so we have to offset the CTM by
     525        // the document's window coordinates.
     526        IntPoint documentOriginInWindowCoordinates = parent()->contentsToWindow(IntPoint());
     527        context->save();
     528        context->translate(-documentOriginInWindowCoordinates.x(), -documentOriginInWindowCoordinates.y());
     529        m_plugin->paint(context, dirtyRect);
     530        context->restore();
     531    }
    531532}
    532533
Note: See TracChangeset for help on using the changeset viewer.