Changeset 92491 in webkit


Ignore:
Timestamp:
Aug 5, 2011 11:23:27 AM (13 years ago)
Author:
Darin Adler
Message:

Reviewed by Anders Carlsson.

[WebKit2] Fix code paths that can leave frame view paint behavior in the wrong state
https://bugs.webkit.org/show_bug.cgi?id=63779

  • WebProcess/Plugins/PluginView.cpp:

(WebKit::PluginView::handleEvent): Unrelated cleanup. Removed unneeded local variable.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::snapshotInViewCoordinates): Rearranged code so that the call to
setPaintBehavior is after the early exit. Also got rid of unneeded save/restore since
the function uses a graphics context that it then throws away.
(WebKit::WebPage::scaledSnapshotInDocumentCoordinates): Ditto.

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r92432 r92491  
     12011-08-05  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        [WebKit2] Fix code paths that can leave frame view paint behavior in the wrong state
     6        https://bugs.webkit.org/show_bug.cgi?id=63779
     7
     8        * WebProcess/Plugins/PluginView.cpp:
     9        (WebKit::PluginView::handleEvent): Unrelated cleanup. Removed unneeded local variable.
     10
     11        * WebProcess/WebPage/WebPage.cpp:
     12        (WebKit::WebPage::snapshotInViewCoordinates): Rearranged code so that the call to
     13        setPaintBehavior is after the early exit. Also got rid of unneeded save/restore since
     14        the function uses a graphics context that it then throws away.
     15        (WebKit::WebPage::scaledSnapshotInDocumentCoordinates): Ditto.
     16
    1172011-08-04  Mark Rowe  <mrowe@apple.com>
    218
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp

    r91998 r92491  
    591591       
    592592        // Adjust mouse coordinates to account for pageScaleFactor
    593         float scaleFactor = frame()->pageScaleFactor();
    594         WebMouseEvent eventWithScaledCoordinates(*(static_cast<const WebMouseEvent*>(currentEvent)), scaleFactor);
     593        WebMouseEvent eventWithScaledCoordinates(*static_cast<const WebMouseEvent*>(currentEvent), frame()->pageScaleFactor());
    595594        didHandleEvent = m_plugin->handleMouseEvent(eventWithScaledCoordinates);
    596595    } else if (event->type() == eventNames().mousewheelEvent && currentEvent->type() == WebEvent::Wheel) {
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r91266 r92491  
    870870        return 0;
    871871
    872     frameView->updateLayoutAndStyleIfNeededRecursive();
    873 
    874     PaintBehavior oldBehavior = frameView->paintBehavior();
    875     frameView->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers);
    876 
    877872    RefPtr<WebImage> snapshot = WebImage::create(rect.size(), options);
    878873    if (!snapshot->bitmap())
     
    880875   
    881876    OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext();
    882 
    883     graphicsContext->save();
    884877    graphicsContext->translate(-rect.x(), -rect.y());
     878
     879    frameView->updateLayoutAndStyleIfNeededRecursive();
     880
     881    PaintBehavior oldBehavior = frameView->paintBehavior();
     882    frameView->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers);
    885883    frameView->paint(graphicsContext.get(), rect);
    886     graphicsContext->restore();
    887 
    888884    frameView->setPaintBehavior(oldBehavior);
    889885
     
    897893        return 0;
    898894
    899     frameView->updateLayoutAndStyleIfNeededRecursive();
    900 
    901     PaintBehavior oldBehavior = frameView->paintBehavior();
    902     frameView->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers);
    903 
    904     bool scale = scaleFactor != 1;
    905     IntSize size = rect.size();
    906     if (scale)
    907         size = IntSize(ceil(rect.width() * scaleFactor), ceil(rect.height() * scaleFactor));
    908 
     895    IntSize size(ceil(rect.width() * scaleFactor), ceil(rect.height() * scaleFactor));
    909896    RefPtr<WebImage> snapshot = WebImage::create(size, options);
    910897    if (!snapshot->bitmap())
    911898        return 0;
    912    
     899
    913900    OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext();
    914     graphicsContext->save();
    915    
    916     if (scale)
    917         graphicsContext->scale(FloatSize(scaleFactor, scaleFactor));
    918    
     901    graphicsContext->scale(FloatSize(scaleFactor, scaleFactor));
    919902    graphicsContext->translate(-rect.x(), -rect.y());
     903
     904    frameView->updateLayoutAndStyleIfNeededRecursive();
     905
     906    PaintBehavior oldBehavior = frameView->paintBehavior();
     907    frameView->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers);
    920908    frameView->paintContents(graphicsContext.get(), rect);
    921     graphicsContext->restore();
    922 
    923909    frameView->setPaintBehavior(oldBehavior);
    924910
Note: See TracChangeset for help on using the changeset viewer.