Source/WebCore: [AX][ATK] Added support for sort and help attributes.
https://bugs.webkit.org/show_bug.cgi?id=120456

Patch by Krzysztof Czech <k.czech@samsung.com> on 2013-09-03
Reviewed by Chris Fleizach.

Added support for aria-sort and aria-help attributes.

Test: accessibility/aria-sort.html

* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(webkitAccessibleGetAttributes):

Tools: [AX][ATK] Added support for sort and help attributes
https://bugs.webkit.org/show_bug.cgi?id=120456

Patch by Krzysztof Czech <k.czech@samsung.com> on 2013-09-03
Reviewed by Chris Fleizach.

Added missing implementation to AccessibilityUIElement::helpText and support for
aria-sort attribute.

* DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
(coreAttributeToAtkAttribute):
* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::coreAttributeToAtkAttribute):
(WTR::AccessibilityUIElement::helpText):

LayoutTests: [AX][ATK] Added support for sort and help attributes
https://bugs.webkit.org/show_bug.cgi?id=120456

Patch by Krzysztof Czech <k.czech@samsung.com> on 2013-09-03
Reviewed by Chris Fleizach.

Sharing aria-sort.html specific mac test with efl and gtk.
Changing specific expectations of some accessibility tests.

* accessibility/aria-sort-expected.txt: Renamed from LayoutTests/platform/mac/accessibility/aria-sort-expected.txt.
* accessibility/aria-sort.html: Renamed from LayoutTests/platform/mac/accessibility/aria-sort.html.
* platform/efl-wk2/TestExpectations:
* platform/efl-wk2/accessibility/image-link-expected.txt:
* platform/efl-wk2/accessibility/image-map2-expected.txt:
* platform/efl-wk2/accessibility/table-cell-spans-expected.txt:
* platform/efl-wk2/accessibility/table-cells-expected.txt:
* platform/gtk/accessibility/image-link-expected.txt:
* platform/gtk/accessibility/image-map2-expected.txt:
* platform/gtk/accessibility/table-cell-spans-expected.txt:
* platform/gtk/accessibility/table-cells-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154976 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[gstreamer] Disable HTTP request "Accept-Encoding:" header field on gstreamer source element to avoid receiving the wrong size when retrieving data
https://bugs.webkit.org/show_bug.cgi?id=115354

Patch by Andre Moreira Magalhaes <andre.magalhaes@collabora.co.uk> on 2013-09-03
Reviewed by Philippe Normand.

Source/WebCore:

Also disable Accept-Encoding on ResourceRequest::toSoupMessage accordingly.

* platform/network/soup/ResourceRequestSoup.cpp:
(WebCore::ResourceRequest::toSoupMessage):
Call ResourceRequest::updateSoupMessage from ResourceRequest::toSoupMessage so that the
Accept-Encoding header is also respected.

LayoutTests:

Add test to check that video requests will send no "Accept-Encoding" header.

* http/tests/media/video-accept-encoding-expected.txt: Added.
* http/tests/media/video-accept-encoding.cgi: Added.
* http/tests/media/video-accept-encoding.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154977 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CMake] Fix detection of x86_64 platform with MSVC
https://bugs.webkit.org/show_bug.cgi?id=116662

Reviewed by Gyuyoung Kim.

Use ${MSVC_CXX_ARCHITECTURE_ID} instead of ${CMAKE_SYSTEM_PROCESSOR}, since
the later one just resolves to the host processor on Windows.

* CMakeLists.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154978 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] accessibility/aria-describedby-on-input.html is failing
https://bugs.webkit.org/show_bug.cgi?id=112027

Unreviewed EFL gardening.

accessibility/aria-describedby-on-input.html passes after r154976.

Patch by Krzysztof Czech <k.czech@samsung.com> on 2013-09-03

* platform/efl-wk2/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154979 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Unreviewed gardening. Skip some failing tests.

* platform/qt-wk1/TestExpectations:
* platform/qt/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154980 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r154967): http appcache tests crashing on WK1
https://bugs.webkit.org/show_bug.cgi?id=120620

Reviewed by Andreas Kling.

* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::cacheDestroyed): Reintroduce pre-r154967 behavior that returned early in
this method if the passed-in ApplicationCache object was not found in the ApplicationCacheGroup's HashSet
of all the caches. This is now done by checking that the HashSet<T>::remove(T) returns true (meaning the
object was found in the HashSet and removed from it) in addition to that HashSet being subsequently empty
before the method moves on to destroying its ApplicationCacheGroup instance.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154981 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSSRegions] Pseudo-elements as regions should not be exposed to JS
https://bugs.webkit.org/show_bug.cgi?id=120633

Reviewed by Andreas Kling.

Source/WebCore:

Until we properly implement the Region interface (http://dev.w3.org/csswg/css-regions/#the-region-interface)
for pseudo-elements, we should not return these as regions in JS.

Tests: fast/regions/get-regions-by-content-pseudo.html
       fast/regions/webkit-named-flow-get-regions-pseudo.html

* dom/WebKitNamedFlow.cpp:
(WebCore::WebKitNamedFlow::firstEmptyRegionIndex): Skip pseudo-elements as regions here too,
otherwise we may get an index that cannot be used with getRegions().
(WebCore::WebKitNamedFlow::getRegionsByContent):
(WebCore::WebKitNamedFlow::getRegions):

LayoutTests:

Add tests with pseudo-elements as regions checking the following API:
WebKitNamedFlow::getRegions(), WebKitNamedFlow::getRegionsByContent()
Because we do not return the pseudo-elements as regions in the region list,
i modified WebKitNamedFlow::firstEmptyRegionIndex to skip these regions too.

* fast/regions/get-regions-by-content-pseudo-expected.txt: Added.
* fast/regions/get-regions-by-content-pseudo.html: Added.
* fast/regions/webkit-named-flow-get-regions-pseudo-expected.txt: Added.
* fast/regions/webkit-named-flow-get-regions-pseudo.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154982 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Tiled-backing store not clipped to frame or visible rect
https://bugs.webkit.org/show_bug.cgi?id=120606

Reviewed by Jocelyn Turcotte.

Clip painting from the tiled-backing store to the frame rect.

* WebCoreSupport/QWebFrameAdapter.cpp:
(QWebFrameAdapter::renderFromTiledBackingStore):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154983 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WinCairo] Unneeded code in method GlyphPage::fill().
https://bugs.webkit.org/show_bug.cgi?id=120634

Patch by peavo@outlook.com <peavo@outlook.com> on 2013-09-03
Reviewed by Andreas Kling.

* platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp:
(WebCore::GlyphPage::fill): Remove unneeded call to GetTextMetrics() function.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154984 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Images scaled poorly on composited canvas
https://bugs.webkit.org/show_bug.cgi?id=120632

Reviewed by Jocelyn Turcotte.

Explicitly set a imageInterpolationQuality on the TextureMapper, because
InterpolationDefault may be interpreted differently by nested GraphicsContexts.

* WebCoreSupport/TextureMapperLayerClientQt.cpp:
(TextureMapperLayerClientQt::renderCompositedLayers):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154985 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CodeBlock::jettison() should be implicit
https://bugs.webkit.org/show_bug.cgi?id=120567

Reviewed by Oliver Hunt.
        
This is a risky change from a performance standpoint, but I believe it's
necessary. This makes all CodeBlocks get swept by GC. Nobody but the GC
can delete CodeBlocks because the GC always holds a reference to them.
Once a CodeBlock reaches just one reference (i.e. the one from the GC)
then the GC will free it only if it's not on the stack.
        
This allows me to get rid of the jettisoning logic. We need this for FTL
tier-up. Well; we don't need it, but it will help prevent a lot of bugs.
Previously, if you wanted to to replace one code block with another, you
had to remember to tell the GC that the previous code block is
"jettisoned". We would need to do this when tiering up from DFG to FTL
and when dealing with DFG-to-FTL OSR entry code blocks. There are a lot
of permutations here - tiering up to the FTL, OSR entering into the FTL,
deciding that an OSR entry code block is not relevant anymore - just to
name a few. In each of these cases we'd have to jettison the previous
code block. It smells like a huge source of future bugs.
        
So I made jettisoning implicit by making the GC always watch out for a
CodeBlock being owned solely by the GC.
        
This change is performance neutral.

* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::CodeBlock):
(JSC::CodeBlock::~CodeBlock):
(JSC::CodeBlock::visitAggregate):
(JSC::CodeBlock::jettison):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::setJITCode):
(JSC::CodeBlock::shouldImmediatelyAssumeLivenessDuringScan):
(JSC::CodeBlockSet::mark):
* dfg/DFGCommonData.h:
(JSC::DFG::CommonData::CommonData):
* heap/CodeBlockSet.cpp: Added.
(JSC::CodeBlockSet::CodeBlockSet):
(JSC::CodeBlockSet::~CodeBlockSet):
(JSC::CodeBlockSet::add):
(JSC::CodeBlockSet::clearMarks):
(JSC::CodeBlockSet::deleteUnmarkedAndUnreferenced):
(JSC::CodeBlockSet::traceMarked):
* heap/CodeBlockSet.h: Added.
* heap/ConservativeRoots.cpp:
(JSC::ConservativeRoots::add):
* heap/ConservativeRoots.h:
* heap/DFGCodeBlocks.cpp: Removed.
* heap/DFGCodeBlocks.h: Removed.
* heap/Heap.cpp:
(JSC::Heap::markRoots):
(JSC::Heap::deleteAllCompiledCode):
(JSC::Heap::deleteUnmarkedCompiledCode):
* heap/Heap.h:
* interpreter/JSStack.cpp:
(JSC::JSStack::gatherConservativeRoots):
* interpreter/JSStack.h:
* runtime/Executable.cpp:
(JSC::ScriptExecutable::installCode):
* runtime/Executable.h:
* runtime/VM.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] [WK2] TestContextMenu default-menu fails
https://bugs.webkit.org/show_bug.cgi?id=120459

Patch by Brian Holt <brian.holt@samsung.com> on 2013-09-03
Reviewed by Gustavo Noronha Silva.

Add context menu items for downloading media elements.

* UIProcess/API/gtk/WebKitContextMenuActions.cpp:
(webkitContextMenuActionGetActionTag):
(webkitContextMenuActionGetForContextMenuItem):
(webkitContextMenuActionGetLabel):
* UIProcess/API/gtk/WebKitContextMenuActions.h:
* UIProcess/API/gtk/tests/TestContextMenu.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154987 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GStreamer] Don't set state to NULL until element is destroyed
https://bugs.webkit.org/show_bug.cgi?id=117354

Patch by Andre Moreira Magalhaes <andre.magalhaes@collabora.co.uk> on 2013-09-03
Reviewed by Philippe Normand.

Don't set playbin to NULL until it is going to be destroyed or if we stay
for too long on the READY state. Instead only set the state to READY as this
allows much faster state changes to PAUSED/PLAYING again. playbin internally
caches some state that is destroyed when setting it to NULL.
This state is independent of the URI and it is even possible to change the
URI in READY state.

To avoid having resources (e.g. audio devices) open indefinitely,
when setting the state to READY we create a timeout and if the timeout
is reached we reset the pipeline state to NULL to free resources.

Also now all state changes use the changePipelineState method instead of setting
the playbin state directly with gst_element_set_state, so we have a better control
of when we are requesting state changes.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::mediaPlayerPrivateReadyStateTimeoutCallback):
(WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::commitLoad):
(WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
(WebCore::MediaPlayerPrivateGStreamer::setRate):
(WebCore::MediaPlayerPrivateGStreamer::handlePluginInstallerResult):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154988 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] gdk threads deprecated functions calls should be refactored
https://bugs.webkit.org/show_bug.cgi?id=120070

Patch by Anton Obzhirov <a.obzhirov@samsung.com> on 2013-09-03
Reviewed by Mario Sanchez Prada.

Removed deprecated functions gdk_threads_leave()/gdk_threads_enter() functions since
there is no more checks for threads lock in GTK 3.6.

* UIProcess/API/gtk/WebKitWebView.cpp:
(webkitWebViewRunAsModal):
* UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
(WebKit::WebPopupMenuProxyGtk::showPopupMenu):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154989 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Check WTF::VectorFiller template argument type size in compile time
https://bugs.webkit.org/show_bug.cgi?id=120631

Reviewed by Darin Adler.

The template argument's type size in WTF::VectorFiller 'memset' specialization
should be checked during compilation rather than in runtime.

* wtf/Vector.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154990 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r154881.
http://trac.webkit.org/changeset/154881
https://bugs.webkit.org/show_bug.cgi?id=120643

Crashes on macworld.com (Requested by kling on #webkit).

Source/WebCore:

* dom/Element.cpp:
(WebCore::Element::setAttributeInternal):

LayoutTests:

* fast/dom/Element/setAttributeNode-for-existing-attribute-expected.txt: Removed.
* fast/dom/Element/setAttributeNode-for-existing-attribute.html: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154991 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Support the "json" responseType and JSON response entity in XHR
https://bugs.webkit.org/show_bug.cgi?id=73648

Reviewed by Oliver Hunt.

Source/JavaScriptCore: 

Based on the patch written by Jarred Nicholls.

Add JSC::JSONParse. This function will be used in XMLHttpRequest.response of type 'json'.

* JavaScriptCore.xcodeproj/project.pbxproj:
* runtime/JSONObject.cpp:
(JSC::JSONParse):
* runtime/JSONObject.h:

Source/WebCore: 

Based on the patch written by Jarred Nicholls.

Implement 'json' type for XMLHttpRequest.response. We cache the result on JSC side as a cached attribute
unlike other response types like 'document' and 'blob' for which the parsed response object is cached
in XMLHttpRequest itself. In the long run, we should do the same for other types of response types.

Also refactored the various code to share the code.

Tests: fast/xmlhttprequest/xmlhttprequest-responsetype-json-invalid.html
       fast/xmlhttprequest/xmlhttprequest-responsetype-json-utf16.html
       fast/xmlhttprequest/xmlhttprequest-responsetype-json-valid.html

* ForwardingHeaders/runtime/JSONObject.h: Added.

* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::JSXMLHttpRequest::visitChildren):
(WebCore::JSXMLHttpRequest::response): Use JSONParse to parse the response text and cache the result.
Call didCacheResponseJSON to set the cache status and clear the original response buffer.

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::XMLHttpRequest): Added m_responseCacheIsValid to invalidate the cache of
a json response.
(WebCore::XMLHttpRequest::responseText):
(WebCore::XMLHttpRequest::didCacheResponseJSON): Added; Updates m_responseCacheIsValid and clears the
response buffer to save memory.
(WebCore::XMLHttpRequest::responseXML):
(WebCore::XMLHttpRequest::setResponseType):
(WebCore::XMLHttpRequest::responseType):
(WebCore::XMLHttpRequest::clearResponseBuffers):
(WebCore::XMLHttpRequest::didReceiveData):

* xml/XMLHttpRequest.h:
(WebCore::XMLHttpRequest::doneWithoutErrors): Extracted from responseXML.
(WebCore::XMLHttpRequest::responseTextIgnoringResponseType): Extracted from responseText.
(WebCore::XMLHttpRequest::responseCacheIsValid): Added.
(WebCore::XMLHttpRequest::shouldDecodeResponse): Extracted from didReceiveData.
Also modified to decode when the response type is ResponseTypeJSON.

* xml/XMLHttpRequest.idl: Added CachedAttribute IDL extention on response property. This cache is
used when the response type is 'json'.

LayoutTests: 

Add regression tests for XMLHttpRequest.response of type 'json'.

Two of these tests (valid & invalid) come from Jarred Nicholls's original patch.

* fast/xmlhttprequest/resources/xmlhttprequest-responsetype-json-utf-16.json: Added.
* fast/xmlhttprequest/resources/xmlhttprequest-responsetype-json.json: Added.
* fast/xmlhttprequest/xmlhttprequest-responsetype-json-invalid-expected.txt: Added.
* fast/xmlhttprequest/xmlhttprequest-responsetype-json-invalid.html: Added.
* fast/xmlhttprequest/xmlhttprequest-responsetype-json-utf16-expected.txt: Added.
* fast/xmlhttprequest/xmlhttprequest-responsetype-json-utf16.html: Added.
* fast/xmlhttprequest/xmlhttprequest-responsetype-json-valid-expected.txt: Added.
* fast/xmlhttprequest/xmlhttprequest-responsetype-json-valid.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154992 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Require layout when -webkit-overflow-scrolling changes
https://bugs.webkit.org/show_bug.cgi?id=120535

Reviewed by Darin Adler.

Source/WebCore:

Test: fast/repaint/overflow-scroll-touch-repaint.html

We want to require a layout when the value of -webkit-overflow-scrolling changes
since -webkit-overflow-scrolling creates a stacking context.

* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeRequiresLayout):

LayoutTests:

Add a test to ensure we perform a layout and repaint when the
value of -webkit-overflow-scrolling changes on an element.

At the time of writing, the iOS port enables ACCELERATED_OVERFLOW_SCROLLING.

* fast/repaint/overflow-scroll-touch-repaint-expected.txt: Added.
* fast/repaint/overflow-scroll-touch-repaint.html: Added.
* platform/efl/TestExpectations: Skip test fast/repaint/overflow-scroll-touch-repaint.html
since this platform doesn't enable ACCELERATED_OVERFLOW_SCROLLING.
* platform/gtk/TestExpectations: Ditto.
* platform/mac/TestExpectations: Ditto.
* platform/qt/TestExpectations: Ditto.
* platform/win/TestExpectations: Ditto.
* platform/wincairo/TestExpectations: Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154993 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK][EFL] include missing localized strings for subtitle auto track
https://bugs.webkit.org/show_bug.cgi?id=120629

those methods are necessary to show the "Auto" track on webkitgtk

Patch by Danilo Cesar Lemes de Paula <danilo.cesar@collabora.co.uk> on 2013-09-03
Reviewed by Gustavo Noronha Silva.

* platform/efl/LocalizedStringsEfl.cpp:
(WebCore::textTrackAutomaticMenuItemText):
* platform/gtk/LocalizedStringsGtk.cpp:
(WebCore::textTrackAutomaticMenuItemText):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154994 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        [Mac] Hyphenation respects regional format settings language instead of primary language
        https://bugs.webkit.org/show_bug.cgi?id=120641

        Reviewed by Dan Bernstein.

        Fixes hyphenation tests on my machine with non-English regional format settings.

        * platform/text/cf/HyphenationCF.cpp: (createValueForNullKey):
        Use primary UI language for hyphenation, not regional settings language.



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