Change Page, FocusController to use ViewState
https://bugs.webkit.org/show_bug.cgi?id=126533

Reviewed by Tim Horton.

These classes currently maintain a set of separate fields to represent the view state;
combine these into a single field, and allow WebPage to send the combined update rather
than individual changes.

Maintain existing interface for WebKit1 clients.

Source/WebCore: 

* WebCore.exp.in:
    - Added WebCore::setViewState, removed WebCore::setIsVisuallyIdle.
* page/FocusController.cpp:
(WebCore::FocusController::FocusController):
    - Initialize combined m_viewState.
(WebCore::FocusController::setFocused):
    - Calls setViewState.
(WebCore::FocusController::setFocusedInternal):
    - setFocused -> setFocusedInternal.
(WebCore::FocusController::setViewState):
    - Added, update all ViewState flags.
(WebCore::FocusController::setActive):
    - Calls setViewState.
(WebCore::FocusController::setActiveInternal):
    - setActive -> setActiveInternal.
(WebCore::FocusController::setContentIsVisible):
    - Calls setViewState.
(WebCore::FocusController::setContentIsVisibleInternal):
    - setContentIsVisible -> setContentIsVisibleInternal.
* page/FocusController.h:
(WebCore::FocusController::isActive):
(WebCore::FocusController::isFocused):
(WebCore::FocusController::contentIsVisible):
    - Implemented in terms of ViewState.
* page/Page.cpp:
(WebCore::Page::Page):
    - Initialize using PageInitialViewState.
(WebCore::Page::setIsInWindow):
    - Calls setViewState.
(WebCore::Page::setIsInWindowInternal):
    - setIsInWindow -> setIsInWindowInternal.
(WebCore::Page::setIsVisuallyIdleInternal):
    - setIsVisuallyIdle -> setIsVisuallyIdleInternal.
(WebCore::Page::setViewState):
    - Added, update all ViewState flags, including FocusController.
(WebCore::Page::setIsVisible):
    - Calls setViewState.
(WebCore::Page::setIsVisibleInternal):
    - setIsVisible -> setIsVisibleInternal.
(WebCore::Page::visibilityState):
    - m_isVisible -> isVisible()
(WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged):
    - m_isVisible -> isVisible()
* page/Page.h:
(WebCore::Page::isVisible):
(WebCore::Page::isInWindow):
    - Implemented in terms of ViewState.
(WebCore::Page::scriptedAnimationsSuspended):
    - Combined member fields into ViewState::Flags.

Source/WebKit/mac: 

* WebView/WebView.mm:
(-[WebView _windowWillOrderOnScreen:]):
(-[WebView _windowWillOrderOffScreen:]):
    - remove calls to FocusController::setContentIsVisible, these are redundant
      (this is handled when page visibility is set).

Source/WebKit2: 

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
    - Combined separate calls to Page::setViewState.
(WebKit::WebPage::updateIsInWindow):
    - Simplied from setIsInWindow.
(WebKit::WebPage::setViewState):
    - Combined separate calls to Page::setViewState.
* WebProcess/WebPage/WebPage.h:
    - Declare updateIsInWindow.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163524 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed fix after r163520, remove Andrei from committers list, because
he is reviewer now, and webkit-patch doesn't like duplicated entries.

* Scripts/webkitpy/common/config/contributors.json:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163525 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix the build after r163516 for !ENABLE(ASYNC_SCROLLING) platforms
https://bugs.webkit.org/show_bug.cgi?id=128299

Reviewed by Antti Koivisto.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleTouchEvent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163526 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[XHR] Ensure response return null when error flag is set for blob and arraybuffer
https://bugs.webkit.org/show_bug.cgi?id=127050

Patch by Youenn Fablet <youennf@gmail.com> on 2014-02-06
Reviewed by Alexey Proskuryakov.

Source/WebCore:

Added a check in JSXMLHttpRequest::response to ensure response return null when error flag is set for blob and arraybuffer
This check also applies to document and json response types (no change in behavior for those types but code path change)
Added assertions in the related XMLHttpRequest blob and array buffer getters
Minor code clean-up.
The test cases check all four response types in case of timeout and abort

Tests: http/tests/xmlhttprequest/onabort-response-getters.html
       http/tests/xmlhttprequest/ontimeout-response-getters.html

* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::JSXMLHttpRequest::response):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::didCacheResponseJSON):
(WebCore::XMLHttpRequest::responseXML):
(WebCore::XMLHttpRequest::responseBlob):
(WebCore::XMLHttpRequest::responseArrayBuffer):

LayoutTests:

Added test cases that check XHR response in case of timeout and abort for arraybuffer, blob, document and json.

* fast/files/script-tests/xhr-response-blob.js: updated to expect null for blob response in case of XHR requesting a file that does not exist
(.xhr.onreadystatechange):
(.xhr.onerror):
(.xhr.onload):
(.xhr.onloadend):
(testBlob):
* fast/files/xhr-response-blob-expected.txt:
* http/tests/resources/load-then-wait.cgi: Added (similar to load-and-stall except that it sends the whole document and then wait for some time before completing the response).
* http/tests/xmlhttprequest/onabort-response-getters-expected.txt: Added.
* http/tests/xmlhttprequest/onabort-response-getters.html: Added.
* http/tests/xmlhttprequest/ontimeout-response-getters-expected.txt: Added.
* http/tests/xmlhttprequest/ontimeout-response-getters.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163527 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Create a HTMLUnknownElement when using createElement('image')
https://bugs.webkit.org/show_bug.cgi?id=125896

Patch by László Langó <llango.u-szeged@partner.samsung.com> on 2014-02-06
Reviewed by Antti Koivisto.

Source/WebCore:

Backported from Blink: https://chromium.googlesource.com/chromium/blink/+/fd8a7b65f3300fb9245db24d5ed240c80b7f76ad

* html/HTMLTagNames.in:

LayoutTests:

* fast/dom/wrapper-classes-expected.txt:
* fast/dom/wrapper-classes.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163528 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Verify copy/paste of misspellings asynchronously
https://bugs.webkit.org/show_bug.cgi?id=128246

Reviewed by Ryosuke Niwa.

Refactoring two spelling tests that use copy/paste to be able to
verify spelling markers asynchronously.
Additionally, use evalAndLog() to make test expectation more readable.
Fix the description according to the tests.

Start off verifying whether spelling marker is available when continuous spell
checking (spellcheck attribute, respectively) is on.
Without this test case, the tests passed even spellchecking
or copy/paste were not implemented (EFL).

* editing/spelling/spellcheck-paste-continuous-disabled-expected.txt:
* editing/spelling/spellcheck-paste-continuous-disabled.html:
Remove unnecessary spellcheck=true attribute. It's default value and we
do not manipulate it at all.
Add destination element where paste operation is performed.

* editing/spelling/spellcheck-paste-disabled-expected.txt:
* editing/spelling/spellcheck-paste-disabled.html:

* platform/efl/TestExpectations:
Mark spellcheck-paste-continuous-disabled.html as failing since EFL does not
implement copy/paste feature.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163529 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Extract common parts from jhbuildrc files.
https://bugs.webkit.org/show_bug.cgi?id=125986

Patch by Peter Szanka <h868064@stud.u-szeged.hu> on 2014-02-06
Reviewed by Csaba Osztrogonác.

* efl/common.py: Removed.
* efl/jhbuildrc:
* gtk/common.py:
(binary_build_path):
* gtk/find-make-dist-errors:
(get_missing_headers):
* gtk/generate-gtkdoc:
(get_webkit2_options):
(get_webkit1_options.src_path):
(get_webkit1_options):
(get_webkitdom_options.src_path):
(get_webkitdom_options):
* gtk/generate-inspector-gresource-manifest.py:
* gtk/jhbuildrc:
* jhbuild/jhbuildrc_common.py: Added.
(script_path):
(top_level_path):
(init):
* nix/common.py: Removed.
* nix/jhbuildrc:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163530 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Regions] Null dereference applying animation with CSS regions
https://bugs.webkit.org/show_bug.cgi?id=128218

Reviewed by Andrei Bucur.

Source/WebCore:

The first issue (the null dereference) was caused by the checkForZoomChange method
not guarding against a null parentStyle parameter, as the checkForGenericFamilyChange
method does, which in the crashing scenario is called just before the faulty
checkForZoomChange method.
The second issue was an assert which was caused by the fact that detaching is performed
in a certain situation if the element has a renderer or if it's inside a named flow.
However, when reattaching and asserting the element has no renderer, the
"inside named flow" condition was no longer considered.

Test: fast/regions/animation-element-in-region-flowed-to-other-thread.html

* css/StyleResolver.cpp:
(WebCore::StyleResolver::checkForZoomChange):
* style/StyleResolveTree.cpp:
(WebCore::Style::attachChildren):

LayoutTests:

Added test for crash caused by using animations with DOM children of regions flowed
into another flow thread.

* fast/regions/animation-element-in-region-flowed-to-other-thread-expected.html: Added.
* fast/regions/animation-element-in-region-flowed-to-other-thread.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163531 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Add myself as a committer.

* Scripts/webkitpy/common/config/contributors.json:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163532 268f45cc-cd09-0410-ab3c-d52691b4dbfc
No need to enterFullscreen() when already in fullscreen
https://bugs.webkit.org/show_bug.cgi?id=128276

Reviewed by Jer Noble.

No new tests, this is just cleanup.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::updatePlayState): Don't call enterFullscreen() if already there.
(WebCore::HTMLMediaElement::enterFullscreen): Return early if m_isFullscreen is already true.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163533 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Use system default compiler instead of gcc, as final fall through.
https://bugs.webkit.org/show_bug.cgi?id=126773

Patch by Koop Mast <kwm@FreeBSD.org> on 2014-02-06
Reviewed by Alexey Proskuryakov.

* dom/make_names.pl:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163534 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed EFL gardening

Add test expectations for tests crashing after r162816.

* platform/efl-wk2/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163535 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Use std::chrono functions in dispatchFunctionsFromMainThread()
https://bugs.webkit.org/show_bug.cgi?id=128308

Reviewed by Antti Koivisto.

* wtf/MainThread.cpp:
(WTF::dispatchFunctionsFromMainThread):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163536 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Re-enable simple line layout on non-Mac platforms
https://bugs.webkit.org/show_bug.cgi?id=123338

Reviewed by Anders Carlsson.

* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseFor):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163537 268f45cc-cd09-0410-ab3c-d52691b4dbfc
IDB: storage/indexeddb/mozilla/clear.html fails
<rdar://problem/15997155> and https://bugs.webkit.org/show_bug.cgi?id=128282

Reviewed by David Kilzer.

Source/WebCore:

Covered by storage/indexeddb/mozilla/clear.html (and probably others)

Update the value deserializer to take into account whether or not there was an IDBKey:
* bindings/js/IDBBindingUtilities.cpp:
(WebCore::deserializeIDBValueBuffer):
* bindings/js/IDBBindingUtilities.h:

* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::onSuccess): Call the new form of deserializeIDBValueBuffer.

* Modules/indexeddb/IDBDatabaseBackend.cpp:
(WebCore::IDBDatabaseBackend::clearObjectStore): Update logging.

* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::setActive): Update logging.

* Modules/indexeddb/IDBTransactionBackend.cpp:
(WebCore::IDBTransactionBackend::commit): Fix ASSERTs to reflect multi-process worlds.

Source/WebKit2:

* DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.cpp:
(WebKit::DatabaseProcessIDBConnection::openTransaction): Update logging.

* DatabaseProcess/IndexedDB/sqlite/SQLiteIDBTransaction.cpp:
(WebKit::SQLiteIDBTransaction::commit): Update ASSERT.

LayoutTests:

* platform/mac-wk2/TestExpectations: Enable this test.

Update the test for (what I can only assume are) changes in the spec:
* storage/indexeddb/mozilla/clear-expected.txt:
* storage/indexeddb/mozilla/resources/clear.js:
(areWeClearYet):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163538 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r163530.
http://trac.webkit.org/changeset/163530
https://bugs.webkit.org/show_bug.cgi?id=128311

It broke run-gtk-tests (Requested by Ossy on #webkit).

* efl/common.py: Copied from Tools/gtk/jhbuildrc.
(script_path):
(top_level_path):
* efl/jhbuildrc:
* gtk/common.py:
(script_path):
(top_level_path):
* gtk/find-make-dist-errors:
(get_missing_headers):
* gtk/generate-gtkdoc:
(get_webkit2_options):
(get_webkit1_options.src_path):
(get_webkit1_options):
(get_webkitdom_options.src_path):
(get_webkitdom_options):
* gtk/generate-inspector-gresource-manifest.py:
* gtk/jhbuildrc:
* jhbuild/jhbuildrc_common.py: Removed.
* nix/common.py: Copied from Tools/nix/jhbuildrc.
(script_path):
(top_level_path):
* nix/jhbuildrc:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163539 268f45cc-cd09-0410-ab3c-d52691b4dbfc
media/video-load-preload-metadata.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=128312

* platform/mac/TestExpectations: Marked it as such.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163541 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Heap::writeBarrier shouldn't be static
https://bugs.webkit.org/show_bug.cgi?id=127807

Reviewed by Geoffrey Garen.

Currently it looks up the Heap in which to fire the write barrier by using 
the cell passed to it. Almost every call site already has a reference to the 
VM or the Heap itself. It seems wasteful to look it up all over again.

Source/JavaScriptCore: 

* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
* heap/CopyWriteBarrier.h:
(JSC::CopyWriteBarrier::set):
* heap/Heap.cpp:
(JSC::Heap::writeBarrier):
* heap/Heap.h:
(JSC::Heap::writeBarrier):
* jit/JITOperations.cpp:
* jit/JITWriteBarrier.h:
(JSC::JITWriteBarrierBase::set):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::llint_write_barrier_slow):
* runtime/Arguments.h:
* runtime/JSWeakMap.cpp:
* runtime/MapData.cpp:
(JSC::MapData::ensureSpaceForAppend):
* runtime/PropertyTable.cpp:
(JSC::PropertyTable::PropertyTable):
* runtime/Structure.h:
* runtime/WriteBarrier.h:
* runtime/WriteBarrierInlines.h: Added.

Source/WebCore: 

* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::JSEventListener):
* bindings/js/JSEventListener.h:
(WebCore::JSEventListener::jsFunction):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163542 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Menclose with no notation attribute does not display anything.
https://bugs.webkit.org/show_bug.cgi?id=127889

Patch by Gurpreet Kaur <k.gurpreet@samsung.com> on 2014-02-06
Reviewed by Chris Fleizach.

Source/WebCore:

Menclose with no notation attribute should behave same as menclose with
notation attribute with value as longdiv. By default the division
symbol should be displayed. For empty and invalid notation attribute
nothing should be displayed.

Tests: mathml/presentation/menclose-notation-default-longdiv.html
       mathml/presentation/menclose-notation-invalid-empty.html

* mathml/MathMLMencloseElement.h:
* rendering/mathml/RenderMathMLMenclose.cpp:
(WebCore::RenderMathMLMenclose::computePreferredLogicalWidths):
(WebCore::RenderMathMLMenclose::paint):
Added style for menclose with no notation attribute and handled this
condition in paint also where for longdiv we are explicitly drawing
the division symbol.

LayoutTests:

* mathml/presentation/menclose-notation-default-longdiv.html: Added.
* mathml/presentation/menclose-notation-invalid-empty-expected.html: Added.
* mathml/presentation/menclose-notation-invalid-empty.html: Added.
* platform/efl/mathml/presentation/menclose-notation-default-longdiv-expected.png: Added.
* platform/efl/mathml/presentation/menclose-notation-default-longdiv-expected.txt: Added.
* platform/gtk/mathml/presentation/menclose-notation-default-longdiv-expected.png: Added.
* platform/gtk/mathml/presentation/menclose-notation-default-longdiv-expected.txt: Added.
* platform/mac/mathml/presentation/menclose-notation-default-longdiv-expected.png: Added.
* platform/mac/mathml/presentation/menclose-notation-default-longdiv-expected.txt: Added.
Added new test cases to test the functionality of menclose with no
notation attribute, invalid and empty notation attribute.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163543 268f45cc-cd09-0410-ab3c-d52691b4dbfc
editing/caret/caret-color.html is flaky on WK2
https://bugs.webkit.org/show_bug.cgi?id=128315

* platform/mac-wk2/TestExpectations: Marked it as such.



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