Line ending conversion should be able to handle strings with null chars
https://bugs.webkit.org/show_bug.cgi?id=126202

This is a merge from Blink.

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Test: http/tests/local/formdata/send-form-data-with-string-containing-null.html

* platform/text/LineEnding.cpp: (WebCore::normalizeToCROrLF): Do it right.

LayoutTests:

* http/tests/local/formdata/send-form-data-with-string-containing-null-expected.txt: Added.
* http/tests/local/formdata/send-form-data-with-string-containing-null.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161269 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore: Refactor NSActivity handling code from ChildProcess to UserActivity
https://bugs.webkit.org/show_bug.cgi?id=126330

Reviewed by Sam Weinig.

UserActivity is a mechanism to express to the operating system (where appropriate)
that a user initiated activity is taking place, and as such that resources should be
made available to the process accordingly.

Currently we hold a single NSActivity, at the WebKit layer. This refactoring allows us
to hold different activity tokens for different user actions (which simplifies the
handling, and aides debugging since the token can more accurately express the activity
taking place), and also will allow us to avoid the layering difficulty of calling back
up the stack to WebKit to register that an activity is taking place.

* WebCore.xcodeproj/project.pbxproj:
    - added new files.
* platform/UserActivity.cpp: Added.
(WebCore::UserActivity::UserActivity):
    - nop implementation - ignore description.
(WebCore::UserActivity::beginActivity):
(WebCore::UserActivity::endActivity):
    - nop implementation - just inc/dec m_count.
* platform/UserActivity.h: Added.
(WebCore::UserActivity::isActive):
    - returns true if one or more instance of this activity is in progress.
* platform/mac/UserActivityMac.mm: Added.
(WebCore::UserActivity::UserActivity):
    - constructor accepts one argument, a description string.
(WebCore::UserActivity::isValid):
    - used by assertions.
(WebCore::UserActivity::beginActivity):
(WebCore::UserActivity::endActivity):
    - track start/end of an activity - calls to these methods should be balanced.
(WebCore::UserActivity::hysteresisTimerFired):
      - used to implement hysteresis in releasing  NSActivity.

Source/WebKit2: VibrationPattern should allocate an single vector instance for single integer input
https://bugs.webkit.org/show_bug.cgi?id=126417

Patch by Jinwoo Song <jinwoo7.song@samsung.com> on 2014-01-03
Reviewed by Gyuyoung Kim.

Fix a vibration unit test regression after r161139. Also remove unnecessary test cases. 

* UIProcess/API/efl/tests/test_ewk2_view.cpp:
(EWK2ViewTest::loadVibrationHTMLString):
(TEST_F):

Source/WTF: Refactor NSActivity handling code from ChildProcess to UserActivity
https://bugs.webkit.org/show_bug.cgi?id=126330

Reviewed by Sam Weinig.

UserActivity is a mechanism to express to the operating system (where appropriate)
that a user initiated activity is taking place, and as such that resources should be
made available to the process accordingly.

Currently we hold a single NSActivity, at the WebKit layer. This refactoring allows us
to hold different activity tokens for different user actions (which simplifies the
handling, and aides debugging since the token can more accurately express the activity
taking place), and also will allow us to avoid the layering difficulty of calling back
up the stack to WebKit to register that an activity is taking place.

* wtf/Platform.h:
    - added HAVE_NS_ACTIVITY.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161271 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Define WebProcess::usesNetworkProcess unconditionally
https://bugs.webkit.org/show_bug.cgi?id=126208

Reviewed by Martin Robinson.

Returning false when network process is not enabled like
WebContext does. This way we reduce the amount of ifdefs used when
checking whether network process is in use.

* UIProcess/gtk/WebContextGtk.cpp:
(WebKit::WebContext::platformInitializeWebProcess): Remove #ifdef
and only setup network features when not using network process.
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::isAvailable): Remove #ifdef.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::downloadManager):
(WebKit::WebProcess::shouldTerminate):
(WebKit::WebProcess::usesNetworkProcess):
* WebProcess/WebProcess.h:
* WebProcess/mac/WebProcessMac.mm:
(WebKit::WebProcess::platformSetCacheModel): Remove #ifdef.
(WebKit::WebProcess::platformInitializeWebProcess): Ditto.
* WebProcess/soup/WebProcessSoup.cpp:
(WebKit::WebProcess::platformSetCacheModel): Ditto.
(WebKit::WebProcess::platformClearResourceCaches): Ditto.
(WebKit::WebProcess::platformInitializeWebProcess): Ditto.
(WebKit::WebProcess::platformTerminate): Only remove the language
observer when not using network process.
(WebKit::WebProcess::setIgnoreTLSErrors): Assert when this is
called with network process enabled.
(WebKit::WebProcess::allowSpecificHTTPSCertificateForHost): Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161272 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Please add a way to quick peek at failing tests at build.webkit.org/dashboard
https://bugs.webkit.org/show_bug.cgi?id=122181

Reviewed by Timothy Hatcher and Timothy Horton.

Detailed results are saved by run-webkit-tests to full_results.json (which is actually
JSONP). Dashboard will load them on demand.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Buildbot.js:
(Buildbot.prototype.layoutTestResultsURLForIteration): Moved from WebKitBuildbot.js
and made it use a function from WebKitBuildbot that builds results directory path.
(Buildbot.prototype.layoutTestFullResultsURLForIteration): Added a function that builds
a URL for full_results.json.
(Buildbot.prototype.layoutTestCrashLogForIteration): Added a function that builds
a URL for a crash log.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js:
(BuildbotIteration.prototype.loadLayoutTestResults): Load and cache layout test results for
the iteration.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js:        
(BuildbotQueueView.prototype._presentPopoverForPendingCommits): Updated for changed
popover API (see below).
(BuildbotQueueView.prototype._presentPopoverForRevisionRange): Ditto.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotTesterQueueView.js:
(BuildbotTesterQueueView.prototype.update.appendBuilderQueueStatus): Added a check
for iterations that were interrupted (previously, they were displayed incorrectly,
often as passes). Install popover trackers for failure bubbles for which we can currently
display something useful.
(BuildbotTesterQueueView.prototype._popoverContentForLayoutTestRegressions): Build
a popover for layout test regressions when we have the data loaded on demand.
We have test paths, special indicators for crashes/timeouts, and links to test history
at flakiness dashboard.
(BuildbotTesterQueueView.prototype._presentPopoverForLayoutTestRegressions): Show
the popover for layout test regressions. Just shows "Loading..." until the data is
loaded.
(BuildbotTesterQueueView.prototype._presentPopoverForMultipleFailureKinds): List
types of failures if there are multiple. There is a lot of similarity with
appendBuilderQueueStatus(), but I couldn't find a good way to share the code.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Initialization.js:
Create a global test history object, which is used for links in layout test popover.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Popover.js:
Changed the API to be more like WebInspector again, allowing for changing content
of an existing popover. As the size of a popover can change, making the mouse pointer
enter it without a mousenter event, install a handler for mousewheel instead, and block
document scrolling from this event handler when needed.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/StatusLineView.js:
(StatusLineView.prototype.get statusBubbleElement): Added an accessor for status
bubble element, making it possible to install a popover on it.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Utilities.js:
(JSON.load): Added the ability to load JSONP by providing an optional callback name.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/WebKitBuildbot.js:
(WebKitBuildbot.prototype.layoutTestResultsDirectoryURLForIteration): Switched from
building a complete results URL to only building one for root results path. This is
the part that depends on specific buildbot installation, everything relative to it
is the same.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/WebKitTestHistory.js: Added.
Build a path to test history page. In the future, we may consider adding code to
load the data and display it inline.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/QueueView.css:
Added styles for this new popover.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/index.html: Added
a new file, WebKitTestHistory.js.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161273 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Revise WebGL DataView test to match ECMAScript Draft Specification
https://bugs.webkit.org/show_bug.cgi?id=126032

Based on the ECMAScript specification, we believe that the current test is wrong. We are working to get this
fixed upstream. 

Reviewed by Dean Jackson.

* webgl/1.0.2/resources/webgl_test_files/conformance/typedarrays/data-view-test.html: Do not
prohibit using DataView as a function.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Refactor NSActivity handling code from ChildProcess to UserActivity
https://bugs.webkit.org/show_bug.cgi?id=126330

Unreviewed build fix.

* platform/UserActivity.h:
    - case fix.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Allow different types of ScrollingTrees to have different types of ScrollingTreeNode subclasses
https://bugs.webkit.org/show_bug.cgi?id=126445

Reviewed by Tim Horton.

Make it possible to have ScrollingTree subclasses with different subclasses of ScrollingTreeNodes,
by giving ScrollingTree a pure virtual createNode() function. ThreadedScrollingTree implements
this, and then delegates node creation to its AsyncScrollingCoordinator (since we have
a ScrollingCoordinatorMac but no real need for a ThreadedScrollingTreeMac).

Also made ThreadedScrollingTree's m_scrollingCoordinator an AsyncScrollingCoordinator,
since by definition a threaded scrolling tree uses an async coordinator.

* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::updateTreeFromStateNode):
* page/scrolling/ScrollingTree.h:
* page/scrolling/ScrollingTreeScrollingNode.h:
* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::create):
(WebCore::ThreadedScrollingTree::ThreadedScrollingTree):
(WebCore::ThreadedScrollingTree::createNode):
* page/scrolling/ThreadedScrollingTree.h:
* page/scrolling/mac/ScrollingCoordinatorMac.h:
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::createScrollingTreeNode):
* page/scrolling/mac/ScrollingTreeScrollingNodeMac.h:
* page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
(WebCore::ScrollingTreeScrollingNodeMac::create):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161276 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Please add a way to quick peek at failing tests at build.webkit.org/dashboard
https://bugs.webkit.org/show_bug.cgi?id=122181

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js:
(BuildbotQueueView.prototype._presentNoChangePopover): Update one more place for
popover.present signature change.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161277 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Deploy more child renderer iterators in RenderBlockFlow.
<https://webkit.org/b/126434>

Reviewed by Sam Weinig.

* rendering/RenderBlockFlow.cpp:
(WebCore::shouldCheckLines):

    Make this helper take a RenderBlockFlow instead of a RenderObject
    and simplified it a bit. RenderDeprecatedFlexibleBox does not
    derive from RenderBlockFlow so those checks can be omitted.

(WebCore::RenderBlockFlow::layoutBlock):
(WebCore::RenderBlockFlow::markAllDescendantsWithFloatsForLayout):
(WebCore::RenderBlockFlow::lineAtIndex):
(WebCore::RenderBlockFlow::lineCount):
(WebCore::RenderBlockFlow::clearTruncation):

    Use childrenOfType to iterate over block and block-flow children.
    Tweaked some early return/continue to reduce nesting.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161278 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Allow the ChromeClient to provide a custom ScrollingCoordinator
https://bugs.webkit.org/show_bug.cgi?id=126450

Reviewed by Tim Horton.

Some platforms will want to provide a custom ScrollingCoordinator, so let
them do so by asking ChromeClient first for one.

* page/ChromeClient.h:
(WebCore::ChromeClient::createScrollingCoordinator):
* page/Page.cpp:
(WebCore::Page::scrollingCoordinator):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161279 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[MediaControls][iOS] Enable JavaScript Media Controls on iOS.
https://bugs.webkit.org/show_bug.cgi?id=126440

Reviewed by Eric Carlson.

Drive-by misspelling fix, and add a convenience function to check if the
controls are currently hidden:
* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.handleWrapperMouseMove):
(Controller.prototype.handleWrapperMouseOut):
(Controller.prototype.updatePlaying):
(Controller.prototype.controlsAreHidden): Added.

Add a new subclass of Controller for iOS and a matching CSS:
* Modules/mediacontrols/mediaControlsiOS.css: Added.
* Modules/mediacontrols/mediaControlsiOS.js: Added.
(createControls): Override the createControls() in mediaControlsApple.js.
(ControllerIOS): Define a new class.
(ControllerIOS.prototype.inheritFrom): Convenience method to mixin parent
    prototype methods.
(ControllerIOS.prototype.createBase): Override, listen for touches instead of mouse events.
(ControllerIOS.prototype.createControls): Ditto.
(ControllerIOS.prototype.configureInlineControls): Override, only add play, timeline, and full
    screen butttons.
(ControllerIOS.prototype.configureFullScreenControls): Override, and add no buttons.
(ControllerIOS.prototype.handlePlayButtonTouchStart): Activate.
(ControllerIOS.prototype.handlePlayButtonTouchEnd): De-activate and do action.
(ControllerIOS.prototype.handlePlayButtonTouchCancel): De-activate and cancel.
(ControllerIOS.prototype.handleWrapperTouchStart): Show controls.
(ControllerIOS.prototype.handlePanelTouchStart): Disable video selection.
(ControllerIOS.prototype.handlePanelTouchEnd): Re-enable video selection.
(ControllerIOS.prototype.handlePanelTouchCancel): Ditto.

Drive-by fix to enable the JavaScript controls when the plugin is disabled:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute):

Add the iOS JavaScript by appending it to the generic (Apple) JavaScript:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::mediaControlsScript):

Add new files to project:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161280 268f45cc-cd09-0410-ab3c-d52691b4dbfc
It feels too hard to get rid of a popover at build.webkit.org/dashboard
https://bugs.webkit.org/show_bug.cgi?id=126451

Reviewed by Simon Fraser.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/Popover.css:
(.popover.fade-out): Reduced the timeout - 200 ms is enough to not have flicker
when moving the mouse from an element to its popover.



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