Diff
Modified: trunk/Source/WebCore/ChangeLog (152381 => 152382)
--- trunk/Source/WebCore/ChangeLog 2013-07-03 23:38:27 UTC (rev 152381)
+++ trunk/Source/WebCore/ChangeLog 2013-07-03 23:56:23 UTC (rev 152382)
@@ -1,3 +1,22 @@
+2013-07-03 Gordon Sheridan <[email protected]>
+
+ Implement mechanism to detect (partially) hidden blocked plugins.
+ https://bugs.webkit.org/show_bug.cgi?id=117998
+
+ Reviewed by Dean Jackson.
+
+ * rendering/RenderEmbeddedObject.cpp:
+ (WebCore::RenderEmbeddedObject::replacementTextRect):
+ Added private method for calculating the size of the replacement text for blocked plugins.
+
+ (WebCore::RenderEmbeddedObject::isReplacementObscured):
+ Added public method to determine if the EMBED element used for a blocked plugin is inaccessible to the user.
+ * rendering/RenderEmbeddedObject.h:
+ Declare the two new methods mentioned above.
+
+ * WebCore.exp.in:
+ Export RenderEmbeddedObject::isReplacementObscured().
+
2013-07-03 Jessie Berlin <[email protected]>
Speculative build fix after r152340.
Modified: trunk/Source/WebCore/WebCore.exp.in (152381 => 152382)
--- trunk/Source/WebCore/WebCore.exp.in 2013-07-03 23:38:27 UTC (rev 152381)
+++ trunk/Source/WebCore/WebCore.exp.in 2013-07-03 23:56:23 UTC (rev 152382)
@@ -666,6 +666,7 @@
__ZN7WebCore20NodeRenderingContextC1EPNS_4NodeE
__ZN7WebCore20NodeRenderingContextD1Ev
__ZN7WebCore20RenderEmbeddedObject29setPluginUnavailabilityReasonENS0_26PluginUnavailabilityReasonE
+__ZNK7WebCore20RenderEmbeddedObject21isReplacementObscuredEv
__ZN7WebCore20ResourceHandleClient16didReceiveBufferEPNS_14ResourceHandleEN3WTF10PassRefPtrINS_12SharedBufferEEEi
__ZN7WebCore20ResourceHandleClient20willSendRequestAsyncEPNS_14ResourceHandleERKNS_15ResourceRequestERKNS_16ResourceResponseE
__ZN7WebCore20ResourceHandleClient22willCacheResponseAsyncEPNS_14ResourceHandleEP19NSCachedURLResponse
Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (152381 => 152382)
--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2013-07-03 23:38:27 UTC (rev 152381)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2013-07-03 23:56:23 UTC (rev 152382)
@@ -49,6 +49,7 @@
#include "Path.h"
#include "PlatformMouseEvent.h"
#include "PluginViewBase.h"
+#include "RenderLayer.h"
#include "RenderTheme.h"
#include "RenderView.h"
#include "RenderWidgetProtector.h"
@@ -277,6 +278,86 @@
return true;
}
+LayoutRect RenderEmbeddedObject::replacementTextRect(const LayoutPoint& accumulatedOffset) const
+{
+ FloatRect contentRect;
+ Path path;
+ FloatRect replacementTextRect;
+ Font font;
+ TextRun run("", 0);
+ float textWidth;
+ if (getReplacementTextGeometry(accumulatedOffset, contentRect, path, replacementTextRect, font, run, textWidth))
+ return LayoutRect(replacementTextRect);
+
+ return LayoutRect();
+}
+
+bool RenderEmbeddedObject::isReplacementObscured() const
+{
+ // Return whether or not the replacement content for blocked plugins is accessible to the user.
+
+ // Check the opacity of each layer containing the element or its ancestors.
+ float opacity = 1.0;
+ for (RenderLayer* layer = enclosingLayer(); layer; layer = layer->parent()) {
+ RenderLayerModelObject* renderer = layer->renderer();
+ RenderStyle* style = renderer->style();
+ opacity *= style->opacity();
+ if (opacity < 0.1)
+ return true;
+ }
+
+ // Calculate the absolute rect for the blocked plugin replacement text.
+ IntRect absoluteBoundingBox = absoluteBoundingBoxRect();
+ LayoutPoint absoluteLocation(absoluteBoundingBox.location());
+ LayoutRect rect = replacementTextRect(absoluteLocation);
+ if (rect.isEmpty())
+ return true;
+
+ RenderView* docRenderer = document()->renderView();
+ ASSERT(docRenderer);
+ if (!docRenderer)
+ return true;
+
+ HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent);
+ HitTestResult result;
+ HitTestLocation location;
+
+ LayoutUnit x = rect.x();
+ LayoutUnit y = rect.y();
+ LayoutUnit width = rect.width();
+ LayoutUnit height = rect.height();
+
+ // Hit test the center and near the corners of the replacement text to ensure
+ // it is visible and is not masked by other elements.
+ bool hit = false;
+ location = LayoutPoint(x + width / 2, y + height / 2);
+ hit = docRenderer->hitTest(request, location, result);
+ if (!hit || result.innerNode() != node())
+ return true;
+
+ location = LayoutPoint(x, y);
+ hit = docRenderer->hitTest(request, location, result);
+ if (!hit || result.innerNode() != node())
+ return true;
+
+ location = LayoutPoint(x + width, y);
+ hit = docRenderer->hitTest(request, location, result);
+ if (!hit || result.innerNode() != node())
+ return true;
+
+ location = LayoutPoint(x + width, y + height);
+ hit = docRenderer->hitTest(request, location, result);
+ if (!hit || result.innerNode() != node())
+ return true;
+
+ location = LayoutPoint(x, y + height);
+ hit = docRenderer->hitTest(request, location, result);
+ if (!hit || result.innerNode() != node())
+ return true;
+
+ return false;
+}
+
void RenderEmbeddedObject::layout()
{
StackStats::LayoutCheckPoint layoutCheckPoint;
Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.h (152381 => 152382)
--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.h 2013-07-03 23:38:27 UTC (rev 152381)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.h 2013-07-03 23:56:23 UTC (rev 152382)
@@ -52,6 +52,8 @@
void handleUnavailablePluginIndicatorEvent(Event*);
+ bool isReplacementObscured() const;
+
#if USE(ACCELERATED_COMPOSITING)
virtual bool allowsAcceleratedCompositing() const;
#endif
@@ -90,6 +92,7 @@
bool isInUnavailablePluginIndicator(MouseEvent*) const;
bool isInUnavailablePluginIndicator(const LayoutPoint&) const;
bool getReplacementTextGeometry(const LayoutPoint& accumulatedOffset, FloatRect& contentRect, Path&, FloatRect& replacementTextRect, Font&, TextRun&, float& textWidth) const;
+ LayoutRect replacementTextRect(const LayoutPoint&) const;
virtual bool canHaveChildren() const;
virtual RenderObjectChildList* virtualChildren() { return children(); }
Modified: trunk/Source/WebKit2/ChangeLog (152381 => 152382)
--- trunk/Source/WebKit2/ChangeLog 2013-07-03 23:38:27 UTC (rev 152381)
+++ trunk/Source/WebKit2/ChangeLog 2013-07-03 23:56:23 UTC (rev 152382)
@@ -1,3 +1,35 @@
+2013-07-03 Gordon Sheridan <[email protected]>
+
+ Implement mechanism to detect (partially) hidden blocked plugins.
+ https://bugs.webkit.org/show_bug.cgi?id=117998
+
+ Reviewed by Dean Jackson.
+
+ * Shared/Plugins/Netscape/PluginInformation.h:
+ * Shared/Plugins/Netscape/PluginInformation.cpp:
+ (WebKit::plugInInformationReplacementObscuredKey):
+ Add key for plugInInformation dictionaries.
+
+ (WebKit::createPluginInformationDictionary):
+ Add boolean parameter identifying whether the replacement for a blocked plugin is obscured, and add it to the dictionary.
+
+ * Shared/API/c/WKPluginInformation.h:
+ * Shared/API/c/WKPluginInformation.cpp:
+ (WKPluginInformationReplacementObscuredKey):
+ Provide the C API for the plugInInformationReplacementObscuredKey().
+
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::didBlockInsecurePluginVersion):
+ Add bool replacementObscured parameter to pass on argument to createPluginInformationDictionary().
+
+ * UIProcess/WebPageProxy.messages.in:
+ Add bool replacementObscured parameter to DidBlockInsecurePluginVersion() message.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::createPlugin):
+ Invoke isReplacementObscured() method for blocked plugins.
+
2013-07-03 Alexey Proskuryakov <[email protected]>
<rdar://problem/14271105> Flash Player: deny ipc-posix-sem 59918130
@@ -36,6 +68,7 @@
(WebKit::WebTextCheckerClient::checkSpellingOfString):
(WebKit::WebTextCheckerClient::checkGrammarOfString):
+
2013-07-03 Sergio Villar Senin <[email protected]>
[GTK][WK2] SIGSEV in WebKit::WebPageContextMenuClient::customContextMenuItemSelected
Modified: trunk/Source/WebKit2/Shared/API/c/WKPluginInformation.cpp (152381 => 152382)
--- trunk/Source/WebKit2/Shared/API/c/WKPluginInformation.cpp 2013-07-03 23:38:27 UTC (rev 152381)
+++ trunk/Source/WebKit2/Shared/API/c/WKPluginInformation.cpp 2013-07-03 23:56:23 UTC (rev 152382)
@@ -115,3 +115,9 @@
static WebString* key = WebString::create(plugInInformationPageContainsNonPlayingInstanceOfPlugInKey()).leakRef();
return toAPI(key);
}
+
+WKStringRef WKPlugInInformationReplacementObscuredKey()
+{
+ static WebString* key = WebString::create(plugInInformationReplacementObscuredKey()).leakRef();
+ return toAPI(key);
+}
Modified: trunk/Source/WebKit2/Shared/API/c/WKPluginInformation.h (152381 => 152382)
--- trunk/Source/WebKit2/Shared/API/c/WKPluginInformation.h 2013-07-03 23:38:27 UTC (rev 152381)
+++ trunk/Source/WebKit2/Shared/API/c/WKPluginInformation.h 2013-07-03 23:56:23 UTC (rev 152382)
@@ -79,6 +79,9 @@
/* Value type: WKBooleanRef */
WK_EXPORT WKStringRef WKPlugInInformationPageContainsNonPlayingInstanceOfPlugInKey();
+/* Value type: WKBooleanRef */
+WK_EXPORT WKStringRef WKPlugInInformationReplacementObscuredKey();
+
#ifdef __cplusplus
}
#endif
Modified: trunk/Source/WebKit2/Shared/Plugins/Netscape/PluginInformation.cpp (152381 => 152382)
--- trunk/Source/WebKit2/Shared/Plugins/Netscape/PluginInformation.cpp 2013-07-03 23:38:27 UTC (rev 152381)
+++ trunk/Source/WebKit2/Shared/Plugins/Netscape/PluginInformation.cpp 2013-07-03 23:56:23 UTC (rev 152382)
@@ -106,6 +106,11 @@
return ASCIILiteral("PlugInInformationPageContainsNonPlayingInstanceOfPlugIn");
}
+String plugInInformationReplacementObscuredKey()
+{
+ return ASCIILiteral("PlugInInformationReplacementObscured");
+}
+
void getPluginModuleInformation(const PluginModuleInfo& plugin, ImmutableDictionary::MapType& map)
{
#if ENABLE(NETSCAPE_PLUGIN_API)
@@ -135,7 +140,7 @@
return ImmutableDictionary::adopt(map);
}
-PassRefPtr<ImmutableDictionary> createPluginInformationDictionary(const PluginModuleInfo& plugin, const String& frameURLString, const String& mimeType, const String& pageURLString, const String& pluginspageAttributeURLString, const String& pluginURLString)
+PassRefPtr<ImmutableDictionary> createPluginInformationDictionary(const PluginModuleInfo& plugin, const String& frameURLString, const String& mimeType, const String& pageURLString, const String& pluginspageAttributeURLString, const String& pluginURLString, bool replacementObscured)
{
ImmutableDictionary::MapType map;
getPluginModuleInformation(plugin, map);
@@ -150,6 +155,7 @@
map.set(pluginInformationPluginspageAttributeURLKey(), WebURL::create(pluginspageAttributeURLString));
if (!pluginURLString.isEmpty())
map.set(pluginInformationPluginURLKey(), WebURL::create(pluginURLString));
+ map.set(plugInInformationReplacementObscuredKey(), WebBoolean::create(replacementObscured));
return ImmutableDictionary::adopt(map);
}
Modified: trunk/Source/WebKit2/Shared/Plugins/Netscape/PluginInformation.h (152381 => 152382)
--- trunk/Source/WebKit2/Shared/Plugins/Netscape/PluginInformation.h 2013-07-03 23:38:27 UTC (rev 152381)
+++ trunk/Source/WebKit2/Shared/Plugins/Netscape/PluginInformation.h 2013-07-03 23:56:23 UTC (rev 152382)
@@ -50,9 +50,10 @@
String pluginInformationPluginspageAttributeURLKey();
String pluginInformationPluginURLKey();
String plugInInformationPageContainsNonPlayingInstanceOfPlugInKey();
+String plugInInformationReplacementObscuredKey();
PassRefPtr<ImmutableDictionary> createPluginInformationDictionary(const PluginModuleInfo&);
-PassRefPtr<ImmutableDictionary> createPluginInformationDictionary(const PluginModuleInfo&, const String& frameURLString, const String& mimeType, const String& pageURLString, const String& pluginspageAttributeURLString, const String& pluginURLString);
+PassRefPtr<ImmutableDictionary> createPluginInformationDictionary(const PluginModuleInfo&, const String& frameURLString, const String& mimeType, const String& pageURLString, const String& pluginspageAttributeURLString, const String& pluginURLString, bool replacementObscured = false);
PassRefPtr<ImmutableDictionary> createPluginInformationDictionary(const String& mimeType, const String& frameURLString, const String& pageURLString);
PassRefPtr<ImmutableDictionary> createPlugInInformationDictionary(const PluginModuleInfo&, bool pageContainsNonPlayingInstanceOfPlugIn);
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (152381 => 152382)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2013-07-03 23:38:27 UTC (rev 152381)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2013-07-03 23:56:23 UTC (rev 152382)
@@ -4207,14 +4207,14 @@
m_loaderClient.didFailToInitializePlugin(this, createPluginInformationDictionary(mimeType, frameURLString, pageURLString).get());
}
-void WebPageProxy::didBlockInsecurePluginVersion(const String& mimeType, const String& pluginURLString, const String& frameURLString, const String& pageURLString)
+void WebPageProxy::didBlockInsecurePluginVersion(const String& mimeType, const String& pluginURLString, const String& frameURLString, const String& pageURLString, bool replacementObscured)
{
RefPtr<ImmutableDictionary> pluginInformation;
#if PLATFORM(MAC) && ENABLE(NETSCAPE_PLUGIN_API)
String newMimeType = mimeType;
PluginModuleInfo plugin = m_process->context()->pluginInfoStore().findPlugin(newMimeType, KURL(KURL(), pluginURLString));
- pluginInformation = createPluginInformationDictionary(plugin, frameURLString, mimeType, pageURLString, String(), String());
+ pluginInformation = createPluginInformationDictionary(plugin, frameURLString, mimeType, pageURLString, String(), String(), replacementObscured);
#else
UNUSED_PARAM(pluginURLString);
#endif
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (152381 => 152382)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2013-07-03 23:38:27 UTC (rev 152381)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2013-07-03 23:56:23 UTC (rev 152382)
@@ -868,7 +868,7 @@
void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide, bool pinnedToTopSide, bool pinnedToBottomSide);
void didChangePageCount(unsigned);
void didFailToInitializePlugin(const String& mimeType, const String& frameURLString, const String& pageURLString);
- void didBlockInsecurePluginVersion(const String& mimeType, const String& pluginURLString, const String& frameURLString, const String& pageURLString);
+ void didBlockInsecurePluginVersion(const String& mimeType, const String& pluginURLString, const String& frameURLString, const String& pageURLString, bool replacementObscured);
void setCanShortCircuitHorizontalWheelEvents(bool canShortCircuitHorizontalWheelEvents) { m_canShortCircuitHorizontalWheelEvents = canShortCircuitHorizontalWheelEvents; }
void reattachToWebProcess();
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (152381 => 152382)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2013-07-03 23:38:27 UTC (rev 152381)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2013-07-03 23:56:23 UTC (rev 152382)
@@ -66,7 +66,7 @@
DidChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide, bool pinnedToTopSide, bool pinnedToBottomSide)
DidChangePageCount(unsigned pageCount);
DidFailToInitializePlugin(WTF::String mimeType, WTF::String frameURLString, WTF::String pageURLString)
- DidBlockInsecurePluginVersion(WTF::String mimeType, WTF::String pluginURLString, WTF::String frameURLString, WTF::String pageURLString)
+ DidBlockInsecurePluginVersion(WTF::String mimeType, WTF::String pluginURLString, WTF::String frameURLString, WTF::String pageURLString, bool replacementObscured)
SetCanShortCircuitHorizontalWheelEvents(bool canShortCircuitHorizontalWheelEvents)
#if PLATFORM(EFL)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (152381 => 152382)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2013-07-03 23:38:27 UTC (rev 152381)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2013-07-03 23:56:23 UTC (rev 152382)
@@ -549,10 +549,14 @@
break;
case PluginModuleBlocked:
- if (pluginElement->renderer()->isEmbeddedObject())
- toRenderEmbeddedObject(pluginElement->renderer())->setPluginUnavailabilityReason(RenderEmbeddedObject::InsecurePluginVersion);
+ bool replacementObscured = false;
+ if (pluginElement->renderer()->isEmbeddedObject()) {
+ RenderEmbeddedObject* renderObject = toRenderEmbeddedObject(pluginElement->renderer());
+ renderObject->setPluginUnavailabilityReason(RenderEmbeddedObject::InsecurePluginVersion);
+ replacementObscured = renderObject->isReplacementObscured();
+ }
- send(Messages::WebPageProxy::DidBlockInsecurePluginVersion(parameters.mimeType, parameters.url.string(), frameURLString, pageURLString));
+ send(Messages::WebPageProxy::DidBlockInsecurePluginVersion(parameters.mimeType, parameters.url.string(), frameURLString, pageURLString, replacementObscured));
return 0;
}