JSNPObject doesn't always protect its data when calling into plugin code
https://bugs.webkit.org/show_bug.cgi?id=95394

Reviewed by Brady Eidson.

We need to use NPRuntimeObjectMap::PluginProtector when calling into plugin code since 
there's no telling what the plugin will do, including destroying itself.

* WebProcess/Plugins/Netscape/JSNPObject.cpp:
(WebKit::JSNPObject::getOwnPropertySlot):
(WebKit::JSNPObject::getOwnPropertyDescriptor):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127158 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium-Android] Upstream layout test rebaselined expectations
https://bugs.webkit.org/show_bug.cgi?id=94885

Reviewed by Adam Barth.

We rebaselined tests that
- expect different behaviors on Android (but normally don't show FAIL)
- have different layout because of precision, font size, etc.
- have different layout because of different shadow DOM of the media player

We don't rebaseline tests that would expect to output FAIL.

* platform/chromium-android/compositing/layer-creation/overflow-scrolling-touch-expected.txt: Added.
* platform/chromium-android/compositing/layer-creation/overflow-scrolling-touch.html: Added.
* platform/chromium-android/fast/block/positioning/047-expected.txt: Added.
* platform/chromium-android/fast/css/font-family-pictograph-expected.txt: Added.
* platform/chromium-android/fast/css/line-height-determined-by-primary-font-expected.txt: Added.
* platform/chromium-android/fast/css/text-transform-select-expected.txt: Added.
* platform/chromium-android/fast/dom/Orientation/create-event-orientationchange-expected.txt: Added.
* platform/chromium-android/fast/dom/Window/window-lookup-precedence-expected.txt: Added.
* platform/chromium-android/fast/events/context-onmousedown-event-expected.txt: Added.
* platform/chromium-android/fast/events/mouseup-from-button2-expected.txt: Added.
* platform/chromium-android/fast/font-boosting/various-tricky-cases-expected.txt: Added.
* platform/chromium-android/fast/font-boosting/various-tricky-cases.html: Added.
* platform/chromium-android/fast/forms/HTMLOptionElement_label05-expected.txt: Added.
* platform/chromium-android/fast/forms/disabled-select-change-index-expected.txt: Added.
* platform/chromium-android/fast/forms/form-element-geometry-expected.txt: Added.
* platform/chromium-android/fast/forms/hidden-listbox-expected.txt: Added.
* platform/chromium-android/fast/forms/implicit-submission-expected.txt: Added.
* platform/chromium-android/fast/forms/label/labelable-elements-expected.txt: Added.
* platform/chromium-android/fast/forms/listbox-bidi-align-expected.txt: Added.
* platform/chromium-android/fast/forms/listbox-scrollbar-incremental-load-expected.txt: Added.
* platform/chromium-android/fast/forms/listbox-width-change-expected.txt: Added.
* platform/chromium-android/fast/forms/option-strip-whitespace-expected.txt: Added.
* platform/chromium-android/fast/forms/select-block-background-expected.txt: Added.
* platform/chromium-android/fast/forms/select-change-listbox-size-expected.txt: Added.
* platform/chromium-android/fast/forms/select-change-popup-to-listbox-expected.txt: Added.
* platform/chromium-android/fast/forms/select-initial-position-expected.txt: Added.
* platform/chromium-android/fast/forms/select-list-box-with-height-expected.txt: Added.
* platform/chromium-android/fast/forms/select-overflow-scroll-expected.txt: Added.
* platform/chromium-android/fast/forms/select-overflow-scroll-inherited-expected.txt: Added.
* platform/chromium-android/fast/hidpi/video-controls-in-hidpi-expected.txt: Added.
* platform/chromium-android/fast/layers/video-layer-expected.txt: Added.
* platform/chromium-android/fast/preloader/script-expected.txt: Added.
* platform/chromium-android/fast/repaint/moving-shadow-on-container-expected.txt: Added.
* platform/chromium-android/fast/repaint/moving-shadow-on-path-expected.txt: Added.
* platform/chromium-android/fast/replaced/replaced-breaking-expected.txt: Added.
* platform/chromium-android/fast/text/capitalize-boundaries-expected.txt: Added.
* platform/chromium-android/fast/text/cg-fallback-bolding-expected.txt: Added.
* platform/chromium-android/fast/text/complex-text-opacity-expected.txt: Added.
* platform/chromium-android/fast/text/drawBidiText-expected.txt: Added.
* platform/chromium-android/fast/text/international/bidi-listbox-atsui-expected.txt: Added.
* platform/chromium-android/fast/text/international/bidi-listbox-expected.txt: Added.
* platform/chromium-android/fast/text/international/hindi-spacing-expected.txt: Added.
* platform/chromium-android/fast/text/international/thai-line-breaks-expected.txt: Added.
* platform/chromium-android/fast/text/updateNewFont-expected.txt: Added.
* platform/chromium-android/http/tests/security/contentSecurityPolicy/media-src-blocked-expected.txt: Added.
* platform/chromium-android/media/W3C/audio/canPlayType/canPlayType_supported_but_no_codecs_parameter_2-expected.txt: Added.
* platform/chromium-android/media/W3C/video/canPlayType/canPlayType_codecs_order_2-expected.txt: Added.
* platform/chromium-android/media/W3C/video/canPlayType/canPlayType_codecs_order_3-expected.txt: Added.
* platform/chromium-android/media/W3C/video/canPlayType/canPlayType_supported_but_no_codecs_parameter_2-expected.txt: Added.
* platform/chromium-android/media/W3C/video/canPlayType/canPlayType_supported_but_no_codecs_parameter_3-expected.txt: Added.
* platform/chromium-android/media/W3C/video/canPlayType/canPlayType_two_implies_one_3-expected.txt: Added.
* platform/chromium-android/media/W3C/video/canPlayType/canPlayType_two_implies_one_4-expected.txt: Added.
* platform/chromium-android/media/audio-controls-rendering-expected.txt: Added.
* platform/chromium-android/media/controls-after-reload-expected.txt: Added.
* platform/chromium-android/media/controls-strict-expected.txt: Added.
* platform/chromium-android/media/controls-styling-expected.txt: Added.
* platform/chromium-android/media/controls-styling-strict-expected.txt: Added.
* platform/chromium-android/media/controls-without-preload-expected.txt: Added.
* platform/chromium-android/media/csp-blocks-video-expected.txt: Added.
* platform/chromium-android/media/encrypted-media/encrypted-media-can-play-type-expected.txt: Added.
* platform/chromium-android/media/media-can-play-mpeg-audio-expected.txt: Added.
* platform/chromium-android/media/media-can-play-mpeg4-video-expected.txt: Added.
* platform/chromium-android/media/media-can-play-ogg-expected.txt: Added.
* platform/chromium-android/media/media-controls-clone-expected.txt: Added.
* platform/chromium-android/media/media-document-audio-repaint-expected.txt: Added.
* platform/chromium-android/media/track/track-cue-rendering-horizontal-expected.txt: Added.
* platform/chromium-android/media/track/track-cue-rendering-vertical-expected.txt: Added.
* platform/chromium-android/media/video-controls-rendering-expected.txt: Added.
* platform/chromium-android/media/video-currentTime-set-expected.txt: Added.
* platform/chromium-android/media/video-display-toggle-expected.txt: Added.
* platform/chromium-android/media/video-empty-source-expected.txt: Added.
* platform/chromium-android/media/video-no-audio-expected.txt: Added.
* platform/chromium-android/media/video-playing-and-pause-expected.txt: Added.
* platform/chromium-android/media/video-source-error-expected.txt: Added.
* platform/chromium-android/media/video-zoom-controls-expected.txt: Added.
* platform/chromium-android/svg/W3C-SVG-1.1/paths-data-03-f-expected.txt: Added.
* platform/chromium-android/svg/W3C-SVG-1.1/paths-data-12-t-expected.txt: Added.
* platform/chromium-android/svg/css/composite-shadow-example-expected.txt: Added.
* platform/chromium-android/svg/css/composite-shadow-with-opacity-expected.txt: Added.
* platform/chromium-android/svg/css/stars-with-shadow-expected.txt: Added.
* platform/chromium-android/svg/custom/scrolling-embedded-svg-file-image-repaint-problem-expected.txt: Added.
* platform/chromium-android/svg/custom/use-on-symbol-inside-pattern-expected.txt: Added.
* platform/chromium-android/transforms/2d/hindi-rotated-expected.txt: Added.
* platform/chromium/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127159 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Remove unneeded force-immediate-repaint from InRegionScroller::setLayerScrollPosition
https://bugs.webkit.org/show_bug.cgi?id=95476
PR #200704

Reviewed by Yong Li.
Patch by Antonio Gomes <agomes@rim.com>

This code is not needed at this point for neither the fast nor slow in-region
scroll codepaths, and it a huge performance beast as it forces all
containers to get full-repainted per scroll call (in webkit thread).

Patch also take this opportunity to remove an early-return we
have in the {i}frame slow scrolling code path so that we can
adjust the selection handles in this case as well.

* Api/InRegionScroller.cpp:
(BlackBerry::WebKit::InRegionScrollerPrivate::setLayerScrollPosition):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127160 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Mac] Registering web views for notifications is unbalanced
https://bugs.webkit.org/show_bug.cgi?id=95465
<rdar://problem/12206765>

Reviewed by Darin Adler.

Setting the notification provider for a WK1 WebView registers that web view to the
provider. When the WebView is closed, WebCore is essentially responsible for
unregistering the web view. This leads to an imbalance on Lion since notifications are
not supported, and the NotificationController responsible for making the unregistration
call doesn't exist.

Instead, the unregisterWebView method should be called when the web view is closed.

* WebView/WebViewPrivate.h: Remove _notificationControllerDestroyed, since it is
unneeded.

* WebCoreSupport/WebNotificationClient.mm:
(WebNotificationClient::notificationControllerDestroyed):
* WebView/WebView.mm:
(-[WebView _close]): Unregister the web view from the assigned provider here.
(-[WebView _setNotificationProvider:]): Only allow setting the provider once, to avoid
registering the web view to multiple providers.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127161 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add support for blendmode to webkit rendering engine
https://bugs.webkit.org/show_bug.cgi?id=95258

Patch by Rik Cabanier <cabanier@adobe.com> on 2012-08-30
Reviewed by Simon Fraser.

Source/WebCore:

This code adds support for blendmodes to the WebCore engine. The CSS parser already
supported this keyword but didn't pass it along. Support for rendering blending will
be provided in subsequent patches

Test: css3/compositing/should-have-compositing-layer.html

* css/StyleBuilder.cpp:
(WebCore::StyleBuilder::StyleBuilder):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::collectMatchingRulesForList):
* rendering/RenderBox.h:
* rendering/RenderBoxModelObject.h:
(RenderBoxModelObject):
(WebCore::RenderBoxModelObject::requiresLayer):
* rendering/RenderInline.h:
(WebCore::RenderInline::requiresLayer):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):
(WebCore):
(WebCore::RenderLayer::updateBlendMode):
(WebCore::RenderLayer::ensureBacking):
(WebCore::RenderLayer::shouldBeNormalFlowOnly):
(WebCore::RenderLayer::styleChanged):
* rendering/RenderLayer.h:
(RenderLayer):
(WebCore::RenderLayer::hasBlendMode):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingLayer):
(WebCore::RenderLayerCompositor::requiresOwnBackingStore):
(WebCore::RenderLayerCompositor::reasonForCompositing):
(WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason):
(WebCore::RenderLayerCompositor::requiresCompositingForBlending):
(WebCore):
* rendering/RenderLayerCompositor.h:
(RenderLayerCompositor):
* rendering/RenderObject.h:
(RenderObject):
(WebCore::RenderObject::hasBlendMode):
(WebCore::RenderObject::createsGroup):
* rendering/RenderTableRow.h:
* rendering/style/RenderStyle.h:

LayoutTests:

Enable test to verify that blending modes introduce a new compositing layer

* css3/compositing/resources: Added.
* css3/compositing/resources/reference.png: Added.
* css3/compositing/should-have-compositing-layer-expected.txt: Added.
* css3/compositing/should-have-compositing-layer.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127162 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CSS 2.1 failure: margin-collapse-clear-012 fails
https://bugs.webkit.org/show_bug.cgi?id=80394

Reviewed by David Hyatt.

Source/WebCore:

CSS2.1 states: "If the top and bottom margins of an element with clearance are adjoining, its margins collapse with
the adjoining margins of following siblings but that resulting margin does not collapse with the bottom margin of the parent block."
This is a change in the spec since http://trac.webkit.org/changeset/47678, so prevent the margins of collapsed blocks from collapsing
with parent margins.

Also, in the case of self-collapsing blocks adjust the clearance so that it is equal to [height of float to clear] - margin-top of the
self-collapsing block. (See the 'Explanation' section near the end of http://www.w3.org/TR/CSS21/visuren.html#clearance). This allows
the correct value of any margins collapsed with subsequent siblings to contribute to the height of the parent. For example if a block
with margin-top of 40px has to clear a float of 100px, the clearance is now 60px so set that as the height of the parent. If a subsequent
sibling has a collapsed margin value of 140px (e.g. from a margin-top of 80px and a margin-bottom of 140px) then the height of the parent
becomes 200px by adding on that collapsed margin.

Tests: css2.1/20110323/margin-collapse-clear-012.htm
       css2.1/20110323/margin-collapse-clear-013.htm
       css2.1/20110323/margin-collapse-027.htm
       fast/css/margin-collapse-013-reduction.html
       fast/css/margin-collapse-top-margin-clearance.html
       fast/css/margin-collapse-top-margin-clearance-with-sibling.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::clearFloatsIfNeeded):
(WebCore::RenderBlock::handleAfterSideOfBlock): Without this margin-collapse/block-inside-inline/025.html adds in the margin to
  an anonymous block containing a block child. FF does this, Opera does not. The spec is not crystal-clear but Opera's behaviour
  seems correct - it's totally unintuitive to think the margins of an anonymous block and its block-flow child should be considered adjoining.
  Maybe this is a FIXME pending clarification in the spec?
* rendering/RenderBlock.h:
(WebCore::RenderBlock::MarginInfo::setCanCollapseMarginAfterWithChildren):

LayoutTests:

* css2.1/20110323/margin-collapse-027-expected.html: Added.
* css2.1/20110323/margin-collapse-027.htm: Added.
* css2.1/20110323/margin-collapse-clear-012-expected.html: Added.
* css2.1/20110323/margin-collapse-clear-012.htm: Added.
* css2.1/20110323/margin-collapse-clear-013-expected.html: Added.
* css2.1/20110323/margin-collapse-clear-013.htm: Added.
* css2.1/20110323/margin-collapse-clear-014-expected.html: Added.
* css2.1/20110323/margin-collapse-clear-014.htm: Added.
* css2.1/20110323/margin-collapse-clear-015-expected.html: Added.
* css2.1/20110323/margin-collapse-clear-015.htm: Added.
* css2.1/20110323/margin-collapse-clear-016-expected.html: Added.
* css2.1/20110323/margin-collapse-clear-016.htm: Added.
* css2.1/20110323/margin-collapse-clear-017-expected.html: Added.
* css2.1/20110323/margin-collapse-clear-017.htm: Added.
* fast/block/margin-collapse/empty-clear-blocks.html:
  Modified the test to reflect the new expected result. The text in the third paragraph avoids
  the float rather than sitting underneath it. The text in the third last paragraph is 20 px below
  the float rather than immediately beneath it. Both of these are a consequence of the revised treatment
  of clearance when margin collapsing. This is consistent with the spec and FF and Opera.
* fast/css/margin-collapse-013-reduction.html: Added.
   Sourced from https://bugzilla.mozilla.org/show_bug.cgi?id=493380
* fast/css/margin-collapse-top-margin-clearance-with-sibling-expected.html: Added.
* fast/css/margin-collapse-top-margin-clearance-with-sibling.html: Added.
    Ensure we only avoid collapsing the margins of a self-collapsing block with the parent if we don't
    have a subsequent sibling with height.
* fast/css/margin-collapse-top-margin-clearance.html: Added.

* platform/chromium-linux/fast/block/float/024-expected.png:
* platform/chromium-linux/fast/block/margin-collapse/empty-clear-blocks-expected.png:
  These two progress to the same rendering used by FF and Opera. It is a consequence of calculating
  clearance as "clearance = [height of float] - margin-top" when margin-top is a negative value.

* platform/chromium-win/fast/block/float/024-expected.txt:
* platform/chromium-win/fast/block/margin-collapse/025-expected.txt:
* platform/chromium-win/fast/block/margin-collapse/block-inside-inline/025-expected.txt:
    The change in result for these three is a consequence of self-collapsing blocks with clearance moving their top up past the float by the value
    of their top margin. Unlike the block-inside-inline case the 'clear' has no intrinsic height so the uncollapsed margin value has
    no effect on its height.

* platform/chromium-win/fast/block/margin-collapse/empty-clear-blocks-expected.txt: See the png result above for comment.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127163 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fixing two inspector tests that fail on Mac WK1.

* inspector/timeline/timeline-animation-frame-expected.txt:
* inspector/timeline/timeline-paint-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127164 268f45cc-cd09-0410-ab3c-d52691b4dbfc
MediaStream API: Introduce MediaConstraints
https://bugs.webkit.org/show_bug.cgi?id=95198

Reviewed by Adam Barth.

Source/Platform:

Adds WebMediaConstraints.

* Platform.gypi:
* chromium/public/WebMediaConstraints.h: Copied from Source/Platform/chromium/public/WebRTCPeerConnectionHandler.h.
(WebCore):
(WebKit):
(WebMediaConstraints):
(WebKit::WebMediaConstraints::WebMediaConstraints):
(WebKit::WebMediaConstraints::~WebMediaConstraints):
(WebKit::WebMediaConstraints::operator=):
* chromium/public/WebRTCPeerConnectionHandler.h:
(WebKit):
(WebRTCPeerConnectionHandler):

Source/WebCore:

This introduces MediaConstraints together with relevant infrastructure, a chromium mock and LayoutTests.

Patch covered by expanded existing tests.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Modules/mediastream/MediaConstraintsImpl.cpp: Added.
(WebCore):
(WebCore::MediaConstraintsImpl::create):
(WebCore::MediaConstraintsImpl::initialize):
(WebCore::MediaConstraintsImpl::~MediaConstraintsImpl):
(WebCore::MediaConstraintsImpl::getMandatoryConstraintNames):
(WebCore::MediaConstraintsImpl::getOptionalConstraintNames):
(WebCore::MediaConstraintsImpl::getMandatoryConstraintValue):
(WebCore::MediaConstraintsImpl::getOptionalConstraintValue):
* Modules/mediastream/MediaConstraintsImpl.h: Copied from Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.h.
(WebCore):
(MediaConstraintsImpl):
(WebCore::MediaConstraintsImpl::MediaConstraintsImpl):
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::create):
(WebCore::RTCPeerConnection::RTCPeerConnection):
* Modules/mediastream/RTCPeerConnection.h:
(WebCore):
(RTCPeerConnection):
* WebCore.gypi:
* bindings/js/Dictionary.cpp:
(WebCore::Dictionary::getOwnPropertyNames):
(WebCore):
* bindings/js/Dictionary.h:
(Dictionary):
* bindings/v8/Dictionary.cpp:
(WebCore::Dictionary::getOwnPropertyNames):
(WebCore):
* bindings/v8/Dictionary.h:
(Dictionary):
* platform/chromium/support/WebMediaConstraints.cpp: Copied from Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.cpp.
(WebKit):
(WebKit::WebMediaConstraints::WebMediaConstraints):
(WebKit::WebMediaConstraints::assign):
(WebKit::WebMediaConstraints::reset):
(WebKit::WebMediaConstraints::isNull):
(WebKit::WebMediaConstraints::getMandatoryConstraintNames):
(WebKit::WebMediaConstraints::getOptionalConstraintNames):
(WebKit::WebMediaConstraints::getMandatoryConstraintValue):
(WebKit::WebMediaConstraints::getOptionalConstraintValue):
* platform/mediastream/MediaConstraints.h: Copied from Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.h.
(WebCore):
(MediaConstraints):
(WebCore::MediaConstraints::~MediaConstraints):
(WebCore::MediaConstraints::MediaConstraints):
* platform/mediastream/RTCPeerConnectionHandler.cpp:
(RTCPeerConnectionHandlerDummy):
(WebCore::RTCPeerConnectionHandlerDummy::initialize):
* platform/mediastream/RTCPeerConnectionHandler.h:
(WebCore):
(RTCPeerConnectionHandler):
* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp:
(WebCore::RTCPeerConnectionHandlerChromium::initialize):
* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.h:
(RTCPeerConnectionHandlerChromium):

Tools:

Extending the MockWebRTCPeerConnectionHandler with MediaConstraints functionality.

* DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp:
(MockWebRTCPeerConnectionHandler::MockWebRTCPeerConnectionHandler):
(isSupportedConstraint):
(isValidConstraint):
(MockWebRTCPeerConnectionHandler::initialize):
* DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h:
(MockWebRTCPeerConnectionHandler):

LayoutTests:

* fast/mediastream/RTCPeerConnection-expected.txt:
* fast/mediastream/RTCPeerConnection.html:


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