Remotely hosted plugins don’t work in window-server-hosted WebKit1 views
https://bugs.webkit.org/show_bug.cgi?id=119709
<rdar://problem/14717572>

Reviewed by Anders Carlsson.

* Plugins/Hosted/NetscapePluginHostManager.h:
Add hostLayersInWindowServer argument to instantiatePlugin.

* Plugins/Hosted/NetscapePluginHostManager.mm:
(WebKit::NetscapePluginHostManager::instantiatePlugin):
Add hostLayersInWindowServer argument to instantiatePlugin, and pass it through to WebKitPluginHost.

* Plugins/Hosted/NetscapePluginHostProxy.mm:
(WKPCLayerHostingModeChanged):
Forward the notification that the plugin host changed its layer hosting mode
to the instance proxy.

* Plugins/Hosted/NetscapePluginInstanceProxy.h:
* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::setShouldHostLayersInWindowServer):
Ask the plugin host to re-host its layers when the layer hosting mode changes.

(WebKit::NetscapePluginInstanceProxy::layerHostingModeChanged):
Inform the WebHostedNetscapePluginView of the new layer hosting mode
when it changes. Also, store the new CAContext ID.

* Plugins/Hosted/WebHostedNetscapePluginView.h:
* Plugins/Hosted/WebHostedNetscapePluginView.mm:
(-[WebHostedNetscapePluginView windowHostsLayersInWindowServer]):
Determine whether the WebView's current window uses window-server hosting for its layers.

(-[WebHostedNetscapePluginView createPlugin]):
Drive-by spelling fix.
Factor _pluginLayer initialization out into createPluginLayer.
Instantiate the plugin with the appropriate layer hosting mode.

(-[WebHostedNetscapePluginView createPluginLayer]):

(-[WebHostedNetscapePluginView setHostsLayersInWindowServer:]):
Create a new _pluginLayer if the layer hosting mode changes.
Attach the new _pluginLayer to our parent layer.

(-[WebHostedNetscapePluginView updateAndSetWindow]):
Inform the NetscapePluginInstanceProxy if the layer hosting mode changes,
so it can inform the plugin host. We will asynchronously receive a reply
with the new hosting mode and renderContextID and switch to the new CAContext,
in setHostsLayersInWindowServer:.

* Plugins/Hosted/WebKitPluginClient.defs:
* Plugins/Hosted/WebKitPluginHost.defs:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154078 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Exclusions] Minimal support for using an image to define a shape
https://bugs.webkit.org/show_bug.cgi?id=116643

Source/WebCore:

Reviewed by Alexandru Chiculita.

This is a first small step towards supporting CSS shapes defined by an
image URL and a alpha channel threshold. To keep the patch as small as
possible, there are many limitations and remaining work items. For
example images are currently restricted to same-origin, although CORS
should be supported. See https://bugs.webkit.org/show_bug.cgi?id=116348
for the current list.

Test: fast/exclusions/shape-inside/shape-inside-image-001.html
Test: fast/exclusions/shape-inside/shape-inside-image-002.html

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.xcodeproj/project.pbxproj:
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::imageChanged): When the image has finished loading, request a layout.
* rendering/RenderBlock.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::setStyle): Add notify clients for shape images.
(WebCore::RenderObject::updateShapeImage):
(WebCore::removeShapeImageClient):
(WebCore::RenderObject::arenaDelete): Remove notify clients for shape images.
* rendering/RenderObject.h:
* rendering/shapes/RasterShape.cpp: Added. A Shape defined by thresholding an image's alpha channel.
(WebCore::RasterShapeIntervals::bounds):
(WebCore::RasterShapeIntervals::addInterval): Add a single run to the shape.
(WebCore::alignedRect):
(WebCore::RasterShapeIntervals::getIntervals): Return the shape's runs that fall within a horizonal box.
(WebCore::RasterShape::marginIntervals): Internal representation of the shape with shape-margin factored in.  Currently only a stub.
(WebCore::RasterShape::paddingIntervals): Internal representation of the shape with shape-padding factored in.  Currently only a stub.
(WebCore::RasterShape::getExcludedIntervals):
(WebCore::RasterShape::getIncludedIntervals):
(WebCore::RasterShape::firstIncludedIntervalLogicalTop):
* rendering/shapes/RasterShape.h:
(WebCore::RasterShapeIntervals::RasterShapeIntervals): Internal run length encoded representation of a RasterShape.
(WebCore::RasterShapeIntervals::isEmpty):
(WebCore::RasterShape::RasterShape):
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createShape): Support for creating a Shape based on a RasterShapeIntervals object.
* rendering/shapes/Shape.h:
* rendering/shapes/ShapeInfo.cpp:
(WebCore::::computedShape): Added support for the Image ShapeValue type.
* rendering/shapes/ShapeInsideInfo.cpp:
(WebCore::ShapeInsideInfo::isEnabledFor): Added support for the Image ShapeValue type.
* rendering/shapes/ShapeOutsideInfo.cpp:
(WebCore::ShapeOutsideInfo::isEnabledFor): Added support for the Image ShapeValue type.
* rendering/style/ShapeValue.h:
(WebCore::ShapeValue::isImageValid): True if the shape's image is ready to be be processed.

LayoutTests:

Two tests to verify that the initial implementation of shape valued images is working
for shape-inside.

Reviewed by Alexandru Chiculita.

* fast/exclusions/shape-inside/shape-inside-image-001-expected.html: Added.
* fast/exclusions/shape-inside/shape-inside-image-001.html: Added.
* fast/exclusions/shape-inside/shape-inside-image-002-expected.html: Added.
* fast/exclusions/shape-inside/shape-inside-image-002.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
<https://webkit.org/b/119817> AX: Integrate layout tests from overflow bounding boxes are way too big; prevents VoiceOver taps from activating the right elements

Reviewed by Simon Fraser.

Add a layout test to ensure that transformed elements do not get offset twice when calculating their accessibility bounds.

* accessibility/transformed-bounds-expected.txt: Added.
* accessibility/transformed-bounds.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
<https://webkit.org/b/119824> AX: WKView does not become first responder when the voiceover cursor lands on it

Reviewed by Tim Horton.

VoiceOver lands on Scroll views by default. It expects that the scroll view will be able to handle the focus calls. 
We should forward scroll view focus requests to the web area to handle, which will trigger a becomeFirstResponder on WKView.

There's not a great way to test this unfortunately, since it requires having focus comes from outside the webview into the webview.

* accessibility/AccessibilityScrollView.cpp:
(WebCore::AccessibilityScrollView::canSetFocusAttribute):
(WebCore::AccessibilityScrollView::isFocused):
(WebCore::AccessibilityScrollView::setFocused):
* accessibility/AccessibilityScrollView.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154083 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Un-inline dataLog dumpers for IntSize and IntPoint
https://bugs.webkit.org/show_bug.cgi?id=119697

Reviewed by Sam Weinig.

.:

Avoid regressing build performance by moving IntSize::dump and IntPoint::dump elsewhere.

* Source/autotools/symbols.filter:

Source/WebCore:

Avoid regressing build performance by moving IntSize::dump and IntPoint::dump elsewhere.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/IntPoint.cpp: Added.
(WebCore::IntPoint::dump):
* platform/graphics/IntPoint.h:
* platform/graphics/IntSize.cpp: Added.
(WebCore::IntSize::dump):
* platform/graphics/IntSize.h:

Tools:

* TestWebKitAPI/GNUmakefile.am:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154084 268f45cc-cd09-0410-ab3c-d52691b4dbfc
<https://webkit.org/b/119827> Allow primary plug-in detection to run more than once if necessary

Reviewed by Tim Horton.

We occasionally see cases where the primary plug-in detection runs before the plugins have been added
to the page, especially if they do so in response to a load event. Tweak the algorithm so that it can
run an arbitrary number of times if it fails.

While here, also have the detection run if there has ever been a plugin in the page as opposed to any
current views. We may have snapshotted a plugin by now and deleted its view.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): initialise new members.
(WebKit::WebPage::addPluginView): Mark that we've seen a plugin.
(WebKit::WebPage::resetPrimarySnapshottedPlugIn): Reset new members.
(WebKit::WebPage::determinePrimarySnapshottedPlugIn): Exit early if we've never
seen a plugin, rather than if we don't have any active views. Also, if we didn't find anything set
a timer to run again (maximum of two attempts at the moment).
* WebProcess/WebPage/WebPage.h: New members - m_numberOfPrimarySnapshotDetectionAttempts
and m_hasSeenPlugin.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154085 268f45cc-cd09-0410-ab3c-d52691b4dbfc
<https://webkit.org/b/119810> [Mac] No AutoreleasePool leaks when dragging image out of WebView

Reviewed by Dan Bernstein.

This code was just running a block of code asynchronously using a
pthread. Convert this to use a dispatch block, which does provide
an autorelease pool so there are no leaks and ends up much simpler.

* platform/mac/FileSystemMac.mm:
(WebCore::setMetadataURL):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154086 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Update binding test results.  Follow up fix for <https://webkit.org/b/119664>

* bindings/scripts/test/JS/JSTestCallback.cpp:
(WebCore::JSTestCallback::JSTestCallback):
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
(WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod):



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