Title: [102197] branches/safari-534.53-branch/Source/WebKit2

Diff

Modified: branches/safari-534.53-branch/Source/WebKit2/ChangeLog (102196 => 102197)


--- branches/safari-534.53-branch/Source/WebKit2/ChangeLog	2011-12-07 01:17:49 UTC (rev 102196)
+++ branches/safari-534.53-branch/Source/WebKit2/ChangeLog	2011-12-07 01:22:20 UTC (rev 102197)
@@ -1,3 +1,23 @@
+2011-12-06  Lucas Forschler  <lforsch...@apple.com>
+
+    Merge 92491
+
+    2011-08-05  Darin Adler  <da...@apple.com>
+
+            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.
+
 2011-12-02  Lucas Forschler  <lforsch...@apple.com>
 
     Merge 93377

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (102196 => 102197)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2011-12-07 01:17:49 UTC (rev 102196)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2011-12-07 01:22:20 UTC (rev 102197)
@@ -635,8 +635,7 @@
             focusPluginElement();
         
         // Adjust mouse coordinates to account for pageScaleFactor
-        float scaleFactor = frame()->pageScaleFactor();
-        WebMouseEvent eventWithScaledCoordinates(*(static_cast<const WebMouseEvent*>(currentEvent)), scaleFactor);
+        WebMouseEvent eventWithScaledCoordinates(*static_cast<const WebMouseEvent*>(currentEvent), frame()->pageScaleFactor());
         didHandleEvent = m_plugin->handleMouseEvent(eventWithScaledCoordinates);
     } else if (event->type() == eventNames().mousewheelEvent && currentEvent->type() == WebEvent::Wheel) {
         // We have a wheel event.

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (102196 => 102197)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-12-07 01:17:49 UTC (rev 102196)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-12-07 01:22:20 UTC (rev 102197)
@@ -870,22 +870,18 @@
     if (!frameView)
         return 0;
 
-    frameView->updateLayoutAndStyleIfNeededRecursive();
-
-    PaintBehavior oldBehavior = frameView->paintBehavior();
-    frameView->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers);
-
     RefPtr<WebImage> snapshot = WebImage::create(rect.size(), options);
     if (!snapshot->bitmap())
         return 0;
     
     OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext();
-
-    graphicsContext->save();
     graphicsContext->translate(-rect.x(), -rect.y());
-    frameView->paint(graphicsContext.get(), rect);
-    graphicsContext->restore();
 
+    frameView->updateLayoutAndStyleIfNeededRecursive();
+
+    PaintBehavior oldBehavior = frameView->paintBehavior();
+    frameView->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers);
+    frameView->paint(graphicsContext.get(), rect);
     frameView->setPaintBehavior(oldBehavior);
 
     return snapshot.release();
@@ -897,30 +893,20 @@
     if (!frameView)
         return 0;
 
-    frameView->updateLayoutAndStyleIfNeededRecursive();
-
-    PaintBehavior oldBehavior = frameView->paintBehavior();
-    frameView->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers);
-
-    bool scale = scaleFactor != 1;
-    IntSize size = rect.size();
-    if (scale) 
-        size = IntSize(ceil(rect.width() * scaleFactor), ceil(rect.height() * scaleFactor));
-
+    IntSize size(ceil(rect.width() * scaleFactor), ceil(rect.height() * scaleFactor));
     RefPtr<WebImage> snapshot = WebImage::create(size, options);
     if (!snapshot->bitmap())
         return 0;
-    
+
     OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext();
-    graphicsContext->save();
-    
-    if (scale)
-        graphicsContext->scale(FloatSize(scaleFactor, scaleFactor));
-    
+    graphicsContext->scale(FloatSize(scaleFactor, scaleFactor));
     graphicsContext->translate(-rect.x(), -rect.y());
-    frameView->paintContents(graphicsContext.get(), rect);
-    graphicsContext->restore();
 
+    frameView->updateLayoutAndStyleIfNeededRecursive();
+
+    PaintBehavior oldBehavior = frameView->paintBehavior();
+    frameView->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers);
+    frameView->paintContents(graphicsContext.get(), rect);
     frameView->setPaintBehavior(oldBehavior);
 
     return snapshot.release();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to