[GStreamer][Soup] Let GStreamer provide the buffer data is downloaded to, to avoid copying
https://bugs.webkit.org/show_bug.cgi?id=105552

Patch by Gustavo Noronha Silva <gustavo.noronha@collabora.com> on 2013-01-15
Reviewed by Philippe Normand.

Makes it possible for the GStreamer media backend to provide the buffer to which
the Soup networking backend will use to download data to. This makes copying
memory unnecessary when ResourceHandle hands data over to the media player's
StreamingClient. Thanks to Dan Winship for help designing the interface.

No behaviour change, covered by existing tests.

* platform/graphics/gstreamer/GStreamerVersioning.cpp:
(getGstBufferSize): Abstract obtaining the size of the buffer, so the code
is cleaner while still working for both GST 0.10 and 1.0.
(setGstBufferSize): Ditto, but for setting the size.
(getGstBufferDataPointer): Ditto, but for grabbing the data pointer.
(mapGstBuffer): Convenience method to take care of mapping the buffer so that
we can provide the data pointer to ResourceHandle.
(unmapGstBuffer): Convenience method which takes care of unmapping the buffer
and properly freeing the GstMapInfo.
* platform/graphics/gstreamer/GStreamerVersioning.h:
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(StreamingClient): New methods.
(_WebKitWebSrcPrivate): We now store the GstBuffer we provided the data pointer from
so we can later unmap it and push it to the pipeline.
(webKitWebSrcDispose): Deal with the GstBuffer in case it exists when the source is
destroyed.
(webKitWebSrcStop): Also clear the GstBuffer in this case.
(StreamingClient::didReceiveData): Handle the hand-over of the buffer.
(StreamingClient::getBuffer): Provide ResourceHandle with a new GstBuffer's data pointer.
* platform/network/ResourceHandleClient.h:
(ResourceHandleClient):
(WebCore::ResourceHandleClient::ResourceHandleClient): Constructor to initialize the buffer
member variable to 0.
(WebCore::ResourceHandleClient::~ResourceHandleClient): Destructor to free the buffer if it
has been allocated.
(WebCore::ResourceHandleClient::getBuffer): Default implementation which returns a
newly allocated char pointer.
* platform/network/ResourceHandleInternal.h:
(WebCore::ResourceHandleInternal::ResourceHandleInternal):
(ResourceHandleInternal): Store actual buffer size, which is no longer a constant.
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::cleanupSoupRequestOperation): Clear the buffer pointer, the life-cycle of the
buffer is handled by the ResourceHandleClient.
(WebCore::nextMultipartResponsePartCallback): Get a new buffer from the client before reading.
(WebCore::sendRequestCallback): Ditto.
(WebCore::readCallback): Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139877 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Use the shared HistoryItem serialization for QWebHistory
https://bugs.webkit.org/show_bug.cgi?id=106671

Reviewed by Allan Sandfeld Jensen.

Source/WebCore:

This allows a few things missing from the previous serialization code
to function while using commonly maintained code:
- The itemSequenceNumber and documentSequenceNumber that were needed
  to properly restore same-document navigations
- The form data
- The navigation hierarchy mapping the frame tree

* history/HistoryItem.h:
(HistoryItem):
* history/qt/HistoryItemQt.cpp:
(QDataStreamCoder):
(WebCore):
(WebCore::QDataStreamCoder::QDataStreamCoder):
(WebCore::QDataStreamCoder::encodeBytes):
(WebCore::QDataStreamCoder::encodeBool):
(WebCore::QDataStreamCoder::encodeUInt32):
(WebCore::QDataStreamCoder::encodeUInt64):
(WebCore::QDataStreamCoder::encodeInt32):
(WebCore::QDataStreamCoder::encodeInt64):
(WebCore::QDataStreamCoder::encodeFloat):
(WebCore::QDataStreamCoder::encodeDouble):
(WebCore::QDataStreamCoder::encodeString):
(WebCore::QDataStreamCoder::decodeBytes):
(WebCore::QDataStreamCoder::decodeBool):
(WebCore::QDataStreamCoder::decodeUInt32):
(WebCore::QDataStreamCoder::decodeUInt64):
(WebCore::QDataStreamCoder::decodeInt32):
(WebCore::QDataStreamCoder::decodeInt64):
(WebCore::QDataStreamCoder::decodeFloat):
(WebCore::QDataStreamCoder::decodeDouble):
(WebCore::QDataStreamCoder::decodeString):
(WebCore::HistoryItem::restoreState):
(WebCore::WebCore::HistoryItem::saveState):

Source/WebKit/qt:

Bump the serialization version and change the code to abort the
restore of a previous stream version rather than trying to keep the
support of restoring previous versions. This is mainly to simplify
things given that HistoryItem itself aborts in that case.

* Api/qwebhistory.cpp:
(operator<<):
(operator>>):
* tests/qwebhistory/tst_qwebhistory.cpp:
(tst_QWebHistory::serialize_2): Modify the test to cover same-document navigations.
(tst_QWebHistory::restoreIncompatibleVersion1): Add a previous version
hard-coded stream to verify that the deserialization doesn't hang or
crash.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: fix text-editor-highlight-regexp test
https://bugs.webkit.org/show_bug.cgi?id=107006

Patch by Andrey Lushnikov <lushnikov@chromium.org> on 2013-01-16
Reviewed by Vsevolod Vlasov.

Source/WebCore:

Use 'height: 100%' instead of pixel values on highlight spans to bring in some platform independency in test expectations.

No new tests: no changes in behaviour.

* inspector/front-end/DefaultTextEditor.js:
(WebInspector.TextEditorMainPanel.prototype._measureRegex):
(WebInspector.TextEditorMainPanel.prototype._appendOverlayHighlight):
* inspector/front-end/textEditor.css:
(.text-editor-overlay-highlight):
(.webkit-line-content):

LayoutTests:

Fixing test expectations: no more height style.

* inspector/editor/text-editor-highlight-regexp-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: [Extensions API] remove inspectedWindow.onReset event
https://bugs.webkit.org/show_bug.cgi?id=107009

Reviewed by Vsevolod Vlasov.

Source/WebCore:

* inspector/front-end/ExtensionAPI.js:
(defineCommonExtensionSymbols):
(injectedExtensionAPI.InspectorExtensionAPI):
* inspector/front-end/ExtensionServer.js:
(WebInspector.ExtensionServer.prototype.initExtensions):

LayoutTests:

* inspector/extensions/extensions-api-expected.txt: removed webInspector.onReset.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139880 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: create helper InspectorTest method to dump editor HTML
https://bugs.webkit.org/show_bug.cgi?id=107007

Patch by Andrey Lushnikov <lushnikov@chromium.org> on 2013-01-16
Reviewed by Pavel Feldman.

Add helper method to dump textEditor HTML.

* inspector/editor/editor-test.js:
(initialize_EditorTests.InspectorTest.dumpEditorHTML): Added.
* inspector/editor/text-editor-highlight-regexp.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139881 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed EFL build fix after r139877.

* platform/graphics/gstreamer/GStreamerVersioning.cpp:
(getGstBufferDataPointer): Add const modifier to webkitGstMapInfoQuarkString.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139882 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: cookies with empty value are parsed incorrectly
https://bugs.webkit.org/show_bug.cgi?id=107012

Reviewed by Pavel Feldman.

Source/WebCore:

Require cookie value to be a string, not a non-empty string, before
employing legacy compatibility hack of treating bare token as value
for the cookie with an empty name.

* inspector/front-end/CookieParser.js:
(WebInspector.CookieParser.prototype._addCookie):

LayoutTests:

* inspector/cookie-parser-expected.txt:
* inspector/cookie-parser.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GStreamer][Soup] Let GStreamer provide the buffer data is downloaded to, to avoid copying
https://bugs.webkit.org/show_bug.cgi?id=105552

Reverting 139877. It made a couple of API tests fail.

* platform/graphics/gstreamer/GStreamerVersioning.cpp:
* platform/graphics/gstreamer/GStreamerVersioning.h:
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(StreamingClient):
(_WebKitWebSrcPrivate):
(webKitWebSrcFinalize):
(webKitWebSrcStop):
(StreamingClient::didReceiveData):
* platform/network/ResourceHandleClient.h:
(ResourceHandleClient):
* platform/network/ResourceHandleInternal.h:
(WebCore::ResourceHandleInternal::ResourceHandleInternal):
(ResourceHandleInternal):
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::cleanupSoupRequestOperation):
(WebCore::nextMultipartResponsePartCallback):
(WebCore::sendRequestCallback):
(WebCore::readCallback):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139884 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: UISourceCode scriptFile / styleFile should be reset on navigation (debugger or css model reset).
https://bugs.webkit.org/show_bug.cgi?id=107008

Reviewed by Pavel Feldman.

ScriptFiles and styleFiles are now reset and disposed on UISourceCodes on corresponding models reset.
StyleSourceMapping now tries to setup mapping for newly added resource as well as for uiSourceCodes previously.

* inspector/front-end/CSSStyleModel.js:
(WebInspector.CSSStyleModel):
(WebInspector.CSSStyleModel.prototype._mainFrameCreatedOrNavigated):
* inspector/front-end/ResourceScriptMapping.js:
(WebInspector.ResourceScriptMapping):
(WebInspector.ResourceScriptMapping.prototype._unbindUISourceCodeFromScripts):
(WebInspector.ResourceScriptMapping.prototype._initialize):
(WebInspector.ResourceScriptMapping.prototype._debuggerReset):
(WebInspector.ResourceScriptFile.prototype.dispose):
* inspector/front-end/ResourceTreeModel.js:
(WebInspector.ResourceTreeModel.prototype._addFrame):
(WebInspector.ResourceTreeModel.prototype._frameNavigated):
* inspector/front-end/ScriptSnippetModel.js:
(WebInspector.ScriptSnippetModel):
(WebInspector.ScriptSnippetModel.prototype._debuggerReset):
* inspector/front-end/StylesSourceMapping.js:
(WebInspector.StylesSourceMapping):
(WebInspector.StylesSourceMapping.prototype._resourceAdded):
(WebInspector.StylesSourceMapping.prototype._uiSourceCodeAddedToWorkspace):
(WebInspector.StylesSourceMapping.prototype._bindUISourceCode):
(WebInspector.StylesSourceMapping.prototype._projectWillReset):
(WebInspector.StylesSourceMapping.prototype._initialize):
(WebInspector.StylesSourceMapping.prototype._mainFrameCreatedOrNavigated):
(WebInspector.StyleFile.prototype.dispose):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Show formatted content of JSON request
https://bugs.webkit.org/show_bug.cgi?id=106900

Patch by Sergey Ryazanov <serya@chromium.org> on 2013-01-16
Reviewed by Vsevolod Vlasov.

"Request payload" section showed raw content for POST requests.
This change show it in structured format if it's JSON parsable.
Raw format is also available.

* inspector/front-end/RequestHeadersView.js:
(WebInspector.RequestHeadersView.prototype._refreshQueryString):
(WebInspector.RequestHeadersView.prototype._refreshFormData):
(WebInspector.RequestHeadersView.prototype.toggleViewSource):
(WebInspector.RequestHeadersView.prototype._refreshParams):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: array grouping does not work for float number keys
https://bugs.webkit.org/show_bug.cgi?id=106998

Reviewed by Pavel Feldman.

Source/WebCore:

Now we do the array index check according to the ECMAScript 5, section 15.4:
"A property name P (in the form of a String value) is an array index if and only if ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal to 2^32-1."

* inspector/front-end/ObjectPropertiesSection.js:
(.buildObjectFragment):

LayoutTests:

* inspector/console/console-big-array-expected.txt:
* inspector/console/console-big-array.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139887 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Groundwork to enable process suppression by default on Mac
https://bugs.webkit.org/show_bug.cgi?id=106513

Patch by Kiran Muppala <cmuppala@apple.com> on 2013-01-16
Reviewed by Alexey Proskuryakov.

Process suppression has so far been controlled by a user default and
disabled by default.  This patch provides the groundwork to enable it by
default and adds a private API to enable/disable it on a per-context
basis.

* Shared/mac/ChildProcessMac.mm:
(WebKit::ChildProcess::platformInitialize): Add comment about
initilization of application occlusion state.
* UIProcess/API/C/mac/WKContextPrivateMac.cpp: Added.
(WKContextGetProcessSuppressionEnabled):
(WKContextSetProcessSuppressionEnabled):
Add private API to enable/disable process suppression on a per-context
basis.
* UIProcess/API/C/mac/WKContextPrivateMac.h: Added.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didFinishLaunching): Check if owning
context has process suppression enabled before updating application
occlusion state.
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didFinishLaunching): Ditto.
* UIProcess/Plugins/PluginProcessProxy.cpp:
(WebKit::PluginProcessProxy::didFinishLaunching): Check if
process suppression is enabled for global child processes before
updating application occlusion state.
* UIProcess/SharedWorkers/SharedWorkerProcessProxy.cpp:
(WebKit::SharedWorkerProcessProxy::didFinishLaunching): Ditto.
* UIProcess/WebContext.cpp:
(WebKit::WebContext::create): Remove call to
initializeProcessSuppressionSupport, since platformInitialize has been
modified to perform initialization.
(WebKit::WebContext::WebContext): Initialize new member variable
m_processSuppressionEnabled to false.
* UIProcess/WebContext.h:
(WebKit::WebContext::processSuppressionEnabled): Remove "Support"
from the method name.
* UIProcess/mac/WebContextMac.mm:
(WebKit::updateGlobalChildProcessesApplicationOcclusionState):
(WebKit::applicationOcclusionStateChanged): Update the application
occlusion state of child processes having process suppresion enabled.
(WebKit::applicationBecameVisible):
(WebKit::applicationBecameOccluded):
Simplify by moving code to applicationOcclusionStateChanged.
(WebKit::registerOcclusionNotificationHandlers): Fix typos.
(WebKit::unregisterOcclusionNotificationHandlers): Add
method to unregister occlusion notification handlers when no context
has process suppression enabled.
(WebKit::enableOcclusionNotifications):
(WebKit::disableOcclusionNotifications):
(WebKit::enableProcessSuppressionForGlobalChildProcesses):
(WebKit::disableProcessSuppressionForGlobalChildProcesses):
(WebKit::processSuppressionIsEnabledForAnyContext):
(WebKit::processSuppressionIsEnabledForAllContexts):
(WebKit::WebContext::platformInitialize): Disable process suppression
for global child processes since process suppression is disabled for a
context on construction.
(WebKit::WebContext::setProcessSuppressionEnabled):
(WebKit::WebContext::updateChildProcessesApplicationOcclusionState):
(WebKit::WebContext::applicationIsOccluded):
(WebKit::WebContext::processSuppressionEnabledForGlobalChildProcesses):
(WebKit::WebContext::processSuppressionEnabledChanged): Update child
processes application occlusion state, enable/disable occlusion
notifications and enable/disable process suppression for global child
processes.
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139888 268f45cc-cd09-0410-ab3c-d52691b4dbfc
West-panning cursor does not match resize cursor, unlike all other directions
https://bugs.webkit.org/show_bug.cgi?id=89405

Patch by Avi Drissman <avi@google.com> on 2013-01-16
Reviewed by Alexey Proskuryakov.

Existing manual tests.

* platform/mac/CursorMac.mm:
(WebCore::Cursor::ensurePlatformCursor):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139889 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Safeguard against possible NULL-dereference
https://bugs.webkit.org/show_bug.cgi?id=104931

Patch by Claudio Saavedra <csaavedra@igalia.com> on 2013-01-16
Reviewed by Martin Robinson.

* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(webkitAccessibleGetIndexInParent): Move the NULL-safeguard to a
place where it actually makes sense.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139890 268f45cc-cd09-0410-ab3c-d52691b4dbfc
RenderListMarker::computePreferredLogicalWidth should not be public
https://bugs.webkit.org/show_bug.cgi?id=106956

Reviewed by Tony Chang.

RenderListItem was calling computePreferredLogicalWidths for the side
effects of updating the marker content and margins. Instead, call
updateMarginsAndContent directly.

* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::updateMarkerLocation):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::layout):
The isImage() codepath never calls computePreferredLogicalWidths, so we need to make
sure the content and margins are updated.

(WebCore::RenderListMarker::updateContent):
(WebCore::RenderListMarker::computePreferredLogicalWidths):
(WebCore::RenderListMarker::updateMarginsAndContent):
* rendering/RenderListMarker.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139891 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreveiwed gardening. Updating expectations following r139865.

* platform/chromium-linux/fast/forms/time/time-appearance-basic-expected.png:
* platform/chromium-mac-lion/fast/forms/time/time-appearance-basic-expected.png:
* platform/chromium-mac-snowleopard/fast/forms/time/time-appearance-basic-expected.png:
* platform/chromium-mac/fast/forms/time/time-appearance-basic-expected.png:
* platform/chromium-win/fast/forms/time/time-appearance-basic-expected.png:
* platform/chromium/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139892 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed gardening. Marking several tests as crashing on Debug builds following
r139853.

* platform/chromium/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Use SkMatrix::I() when we need to pass identity, rather than constructing a new matrix.
https://bugs.webkit.org/show_bug.cgi?id=107016

Reviewed by James Robinson.

No new tests. existing tests exercise this code.

The default constructor is being deprecated, so this change is also part of that effort,
though it is a perf-improvement regardless, since we avoid making a new (temp) matrix.

* platform/graphics/chromium/GraphicsLayerChromium.cpp:
(WebCore::GraphicsLayerChromium::updateLayerPreserves3D):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139894 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] Remove hardcoded chromium_*.jar in gyp files
https://bugs.webkit.org/show_bug.cgi?id=104049

Patch by Chris Hopman <cjhopman@chromium.org> on 2013-01-16
Reviewed by Eric Seidel.

Targets with dependencies (direct/indirect) on a java target receive
the chromium_*.jar paths in the variable input_jars_paths. Targets
should use that rather than hardcoding where they think the jar will
be. These can be passed directly to ant as INPUT_JARS_PATHS rather
than as --jars to generate_native_test.py.

Source/WebKit/chromium:

* WebKitUnitTests.gyp:

Tools:

* DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp:
* TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139895 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[gstreamer] Some media tests occasionally crash with gstreamer 1.0 backend
https://bugs.webkit.org/show_bug.cgi?id=106551

Reviewed by Philippe Normand.

ImageGStreamerCairo was passing mapped memory to
cairo_image_surface_create_for_data() and then unmapping it straight
away even though the cairo_surface_t is still used. The cairo
documentation states:
"The output buffer must be kept around until the cairo_surface_t is
destroyed or cairo_surface_finish() is called on the surface."

This patch keeps the GstBuffer memory mapped until the ImageGStreamer
is destroyed so that the internal cairo_surface_t stays valid while
avoiding copying the image data.

No new tests, already covered by existing tests.

* platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
(WTF::adoptGRef):
(WTF):
(WTF::GstBuffer):
* platform/graphics/gstreamer/GRefPtrGStreamer.h:
(WTF): Add support for using GRefPtr with GstBuffer.
* platform/graphics/gstreamer/ImageGStreamer.h:
(ImageGStreamer):
* platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
(ImageGStreamer::ImageGStreamer):
(ImageGStreamer::~ImageGStreamer):


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