Title: [99230] trunk/Source/WebKit2
- Revision
- 99230
- Author
- [email protected]
- Date
- 2011-11-03 13:19:11 -0700 (Thu, 03 Nov 2011)
Log Message
NetscapePlugin should use plug-in relative coordinates on Mac
https://bugs.webkit.org/show_bug.cgi?id=71486
Reviewed by Adam Roben.
* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::paint):
Don't translate the graphics context when the plug-in doesn't want window relative coordinates.
This also fixed a bug I introduced in my previous commit where we'd always pass the dirty rect in
plug-in coordinates even if the plug-in wants window relative coordinates.
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::snapshot):
Don't do the whole translate dance if the plug-in doesn't want window relative coordinates.
(WebKit::NetscapePlugin::wantsWindowRelativeCoordinates):
Return false for PLATFORM_ARCHITECTURE(MAC).
* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
(WebKit::NetscapePlugin::platformPaint):
Simplify code now that we know that the we're always given plug-in relative coordinates.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (99229 => 99230)
--- trunk/Source/WebKit2/ChangeLog 2011-11-03 19:41:31 UTC (rev 99229)
+++ trunk/Source/WebKit2/ChangeLog 2011-11-03 20:19:11 UTC (rev 99230)
@@ -1,5 +1,29 @@
2011-11-03 Anders Carlsson <[email protected]>
+ NetscapePlugin should use plug-in relative coordinates on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=71486
+
+ Reviewed by Adam Roben.
+
+ * PluginProcess/PluginControllerProxy.cpp:
+ (WebKit::PluginControllerProxy::paint):
+ Don't translate the graphics context when the plug-in doesn't want window relative coordinates.
+ This also fixed a bug I introduced in my previous commit where we'd always pass the dirty rect in
+ plug-in coordinates even if the plug-in wants window relative coordinates.
+
+ * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+ (WebKit::NetscapePlugin::snapshot):
+ Don't do the whole translate dance if the plug-in doesn't want window relative coordinates.
+
+ (WebKit::NetscapePlugin::wantsWindowRelativeCoordinates):
+ Return false for PLATFORM_ARCHITECTURE(MAC).
+
+ * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+ (WebKit::NetscapePlugin::platformPaint):
+ Simplify code now that we know that the we're always given plug-in relative coordinates.
+
+2011-11-03 Anders Carlsson <[email protected]>
+
PluginControllerProxy's dirty rect should be in plug-in coordinates
https://bugs.webkit.org/show_bug.cgi?id=71481
Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp (99229 => 99230)
--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp 2011-11-03 19:41:31 UTC (rev 99229)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp 2011-11-03 20:19:11 UTC (rev 99230)
@@ -172,11 +172,14 @@
if (m_plugin->isTransparent())
graphicsContext->clearRect(dirtyRect);
- IntRect dirtyRectInWindowCoordinates = dirtyRect;
- dirtyRectInWindowCoordinates.move(m_frameRectInWindowCoordinates.x(), m_frameRectInWindowCoordinates.y());
- graphicsContext->translate(-m_frameRectInWindowCoordinates.x(), -m_frameRectInWindowCoordinates.y());
+ if (m_plugin->wantsWindowRelativeCoordinates()) {
+ IntRect dirtyRectInWindowCoordinates = dirtyRect;
+ dirtyRectInWindowCoordinates.move(m_frameRectInWindowCoordinates.x(), m_frameRectInWindowCoordinates.y());
+ graphicsContext->translate(-m_frameRectInWindowCoordinates.x(), -m_frameRectInWindowCoordinates.y());
- m_plugin->paint(graphicsContext.get(), dirtyRect);
+ m_plugin->paint(graphicsContext.get(), dirtyRectInWindowCoordinates);
+ } else
+ m_plugin->paint(graphicsContext.get(), dirtyRect);
m_connection->connection()->send(Messages::PluginProxy::Update(dirtyRect), m_pluginInstanceID);
}
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (99229 => 99230)
--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp 2011-11-03 19:41:31 UTC (rev 99229)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp 2011-11-03 20:19:11 UTC (rev 99230)
@@ -661,9 +661,12 @@
// which we currently don't have initiated in the plug-in process.
context->scale(FloatSize(contentsScaleFactor(), contentsScaleFactor()));
- context->translate(-m_frameRectInWindowCoordinates.x(), -m_frameRectInWindowCoordinates.y());
- platformPaint(context.get(), m_frameRectInWindowCoordinates, true);
-
+ if (wantsWindowRelativeCoordinates()) {
+ context->translate(-m_frameRectInWindowCoordinates.x(), -m_frameRectInWindowCoordinates.y());
+ platformPaint(context.get(), m_frameRectInWindowCoordinates, true);
+ } else
+ platformPaint(context.get(), IntRect(IntPoint(), m_pluginSize), true);
+
return bitmap.release();
}
@@ -932,7 +935,11 @@
bool NetscapePlugin::wantsWindowRelativeCoordinates()
{
+#if PLUGIN_ARCHITECTURE(MAC)
+ return false;
+#else
return true;
+#endif
}
Scrollbar* NetscapePlugin::horizontalScrollbar()
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm (99229 => 99230)
--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm 2011-11-03 19:41:31 UTC (rev 99229)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm 2011-11-03 20:19:11 UTC (rev 99230)
@@ -403,9 +403,6 @@
{
CGContextRef platformContext = context->platformContext();
- // Translate the context so that the origin is at the top left corner of the plug-in view.
- context->translate(m_frameRectInWindowCoordinates.x(), m_frameRectInWindowCoordinates.y());
-
switch (m_eventModel) {
case NPEventModelCocoa: {
// Don't send draw events when we're using the Core Animation drawing model.
@@ -415,8 +412,8 @@
NPCocoaEvent event = initializeEvent(NPCocoaEventDrawRect);
event.data.draw.context = platformContext;
- event.data.draw.x = dirtyRect.x() - m_frameRectInWindowCoordinates.x();
- event.data.draw.y = dirtyRect.y() - m_frameRectInWindowCoordinates.y();
+ event.data.draw.x = dirtyRect.x();
+ event.data.draw.y = dirtyRect.y();
event.data.draw.width = dirtyRect.width();
event.data.draw.height = dirtyRect.height();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes