#include "Chrome.h"
#include "ChromeClientImpl.h"
+#include "PluginLayerChromium.h"
#include "WebClipboard.h"
#include "WebCursorInfo.h"
#include "WebDataSourceImpl.h"
#include "WebURLError.h"
#include "WebURLRequest.h"
#include "WebVector.h"
+#include "WebViewImpl.h"
#include "WrappedResourceResponse.h"
#include "EventNames.h"
invalidateRect(static_cast<IntRect>(rect));
}
+void WebPluginContainerImpl::scrollRect(int dx, int dy, const WebRect& rect)
+{
+ Widget* parentWidget = parent();
+ if (parentWidget->isFrameView()) {
+ FrameView* parentFrameView = static_cast<FrameView*>(parentWidget);
+ if (!parentFrameView->isOverlapped()) {
+ IntRect damageRect = convertToContainingWindow(static_cast<IntRect>(rect));
+ IntSize scrollDelta(dx, dy);
+ // scroll() only uses the second rectangle, clipRect, and ignores the first
+ // rectangle.
+ parent()->hostWindow()->scroll(scrollDelta, damageRect, damageRect);
+ return;
+ }
+ }
+
+ // Use slow scrolling instead.
+ invalidateRect(rect);
+}
+
void WebPluginContainerImpl::reportGeometry()
{
if (!parent())
m_webPlugin->updateGeometry(windowRect, clipRect, cutOutRects, isVisible());
}
+void WebPluginContainerImpl::commitBackingTexture()
+{
+#if USE(ACCELERATED_COMPOSITING)
+ if (platformLayer())
+ platformLayer()->setNeedsDisplay();
+#endif
+}
+
void WebPluginContainerImpl::clearScriptObjects()
{
Frame* frame = m_element->document()->frame();
SendReferrer);
}
+void WebPluginContainerImpl::zoomLevelChanged(double zoomLevel)
+{
+ WebViewImpl* view = WebViewImpl::fromPage(m_element->document()->frame()->page());
+ view->fullFramePluginZoomLevelChanged(zoomLevel);
+}
+
void WebPluginContainerImpl::didReceiveResponse(const ResourceResponse& response)
{
// Make sure that the plugin receives window geometry before data, or else
m_pluginLoadObservers.remove(pos);
}
+#if USE(ACCELERATED_COMPOSITING)
+WebCore::LayerChromium* WebPluginContainerImpl::platformLayer() const
+{
+ // FIXME: In the event of a context lost, the texture needs to be recreated on the compositor's
+ // context and rebound to the platform layer here.
+ unsigned backingTextureId = m_webPlugin->getBackingTextureId();
+ if (!backingTextureId)
+ return 0;
+
+ m_platformLayer->setTextureId(backingTextureId);
+
+ return m_platformLayer.get();
+}
+#endif
+
// Private methods -------------------------------------------------------------
+WebPluginContainerImpl::WebPluginContainerImpl(WebCore::HTMLPlugInElement* element, WebPlugin* webPlugin)
+ : WebCore::PluginViewBase(0)
+ , m_element(element)
+ , m_webPlugin(webPlugin)
+#if USE(ACCELERATED_COMPOSITING)
+ , m_platformLayer(PluginLayerChromium::create(0))
+#endif
+{
+}
+
WebPluginContainerImpl::~WebPluginContainerImpl()
{
for (size_t i = 0; i < m_pluginLoadObservers.size(); ++i)
}
}
+ const WebInputEvent* currentInputEvent = WebViewImpl::currentInputEvent();
+
+ // Copy stashed info over, and only copy here in order not to interfere
+ // the ctrl-c logic above.
+ if (currentInputEvent
+ && WebInputEvent::isKeyboardEventType(currentInputEvent->type)) {
+ webEvent.modifiers |= currentInputEvent->modifiers &
+ (WebInputEvent::CapsLockOn | WebInputEvent::NumLockOn);
+ }
+
WebCursorInfo cursorInfo;
if (m_webPlugin->handleInputEvent(webEvent, cursorInfo))
event->setDefaultHandled();
return false;
}
- // For compatibility with IE: when the plugin is not positioned,
- // it stacks behind the iframe, even if it's later in the
- // document order.
- if (ro2->style()->position() == StaticPosition)
+ // If the plugin does not have an explicit z-index it stacks behind the iframe.
+ // This is for maintaining compatibility with IE.
+ if (ro2->style()->position() == StaticPosition) {
+ // The 0'th elements of these RenderObject arrays represent the plugin node and
+ // the iframe.
+ const RenderObject* pluginRenderObject = pluginZstack[0];
+ const RenderObject* iframeRenderObject = iframeZstack[0];
+
+ if (pluginRenderObject->style() && iframeRenderObject->style()) {
+ if (pluginRenderObject->style()->zIndex() > iframeRenderObject->style()->zIndex())
+ return false;
+ }
return true;
+ }
// Inspect the document order. Later order means higher
// stacking.