[WinCairo] Incorrect position for windowless plugins.
authorpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Sep 2015 19:13:49 +0000 (19:13 +0000)
committerpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Sep 2015 19:13:49 +0000 (19:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149524

Reviewed by Alex Christensen.

Source/WebCore:

Added method to get graphics context HDC.

* platform/graphics/GraphicsContext.h:
* platform/graphics/win/GraphicsContextWin.cpp:
(WebCore::GraphicsContext::getWindowsContext):
(WebCore::GraphicsContext::hdc):
(WebCore::GraphicsContextPlatformPrivate::save):

Source/WebKit/win:

Only perform the device context transformation if the plugin is painting
directly into the GraphicsContext HDC. The previous check was not correct
in all cases.

* Plugins/PluginViewWin.cpp:
(WebCore::PluginView::paint):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190249 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/Plugins/PluginViewWin.cpp

index bf885e3..5ff9846 100644 (file)
@@ -1,3 +1,18 @@
+2015-09-25  Per Arne Vollan  <peavo@outlook.com>
+
+        [WinCairo] Incorrect position for windowless plugins.
+        https://bugs.webkit.org/show_bug.cgi?id=149524
+
+        Reviewed by Alex Christensen.
+
+        Added method to get graphics context HDC.
+
+        * platform/graphics/GraphicsContext.h:
+        * platform/graphics/win/GraphicsContextWin.cpp:
+        (WebCore::GraphicsContext::getWindowsContext):
+        (WebCore::GraphicsContext::hdc):
+        (WebCore::GraphicsContextPlatformPrivate::save):
+
 2015-09-25  Youenn Fablet  <youenn.fablet@crf.canon.fr>
 
         Fix the broken !ENABLE(STREAM_API) build
index a80bc5e..ea9b7b2 100644 (file)
@@ -452,6 +452,7 @@ namespace WebCore {
 #if OS(WINDOWS)
         HDC getWindowsContext(const IntRect&, bool supportAlphaBlend, bool mayCreateBitmap); // The passed in rect is used to create a bitmap for compositing inside transparency layers.
         void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend, bool mayCreateBitmap); // The passed in HDC should be the one handed back by getWindowsContext.
+        HDC hdc() const;
 #if PLATFORM(WIN)
 #if USE(WINGDI)
         void setBitmap(PassRefPtr<SharedBitmap>);
index e81134d..54cba34 100644 (file)
@@ -136,6 +136,14 @@ HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool supportAlpha
     return m_data->m_hdc;
 }
 
+HDC GraphicsContext::hdc() const
+{
+    if (!m_data)
+        return nullptr;
+
+    return m_data->m_hdc;
+}
+
 #if PLATFORM(WIN)
 void GraphicsContextPlatformPrivate::save()
 {
index 50fe69b..293ea20 100644 (file)
@@ -1,3 +1,17 @@
+2015-09-25  Per Arne Vollan  <peavo@outlook.com>
+
+        [WinCairo] Incorrect position for windowless plugins.
+        https://bugs.webkit.org/show_bug.cgi?id=149524
+
+        Reviewed by Alex Christensen.
+
+        Only perform the device context transformation if the plugin is painting
+        directly into the GraphicsContext HDC. The previous check was not correct
+        in all cases.
+
+        * Plugins/PluginViewWin.cpp:
+        (WebCore::PluginView::paint):
+
 2015-09-24  Brent Fulgham  <bfulgham@apple.com>
 
         [Win] Support composited content in WebView render-to-context methods
index 04a0c51..25eaf55 100644 (file)
@@ -564,7 +564,7 @@ void PluginView::paint(GraphicsContext& context, const IntRect& rect)
 
     // On Safari/Windows without transparency layers the GraphicsContext returns the HDC
     // of the window and the plugin expects that the passed in DC has window coordinates.
-    if (!context.isInTransparencyLayer()) {
+    if (context.hdc() == windowsContext.hdc()) {
         XFORM transform;
         GetWorldTransform(windowsContext.hdc(), &transform);
         transform.eDx = 0;