Fix srcset related bugs
https://bugs.webkit.org/show_bug.cgi?id=129539

Source/WebCore:

Fixed a bug reported against Blink's srcset implementation at https://code.google.com/p/chromium/issues/detail?id=347998
When both src and srcset had only 1x descriptors and the DPR was higher than 1, the src's resource was picked.

Also fixed the invalid descriptor handling, which wasn't aligned with the spec, and therefore was not as forward compatible as it should be.
Invalid descriptors caused the entire resource to be ignored, rather than just the descriptors themselves.

Patch by Yoav Weiss <yoav@yoav.ws> on 2014-03-02
Reviewed by Andreas Kling.

Tests: fast/hidpi/image-srcset-invalid-descriptor.html
       fast/hidpi/image-srcset-src-selection-1x-both.html

* html/parser/HTMLParserIdioms.cpp:
(WebCore::parseDescriptors):
(WebCore::parseImagesWithScaleFromSrcsetAttribute):
(WebCore::bestFitSourceForImageAttributes):

LayoutTests:

These tests make sure that:
1. Invalid srcset descriptors are handled according to the spec. The invalid descriptors are ignored, but the resource is not.
2. When both src and srcset have only 1x descriptors and the DPR is higher than 1, the srcset's resource is picked.

I've also fixed the invalid inputs test, which was faulty.

Patch by Yoav Weiss <yoav@yoav.ws> on 2014-03-02
Reviewed by Andreas Kling.

* fast/hidpi/image-srcset-invalid-descriptor-expected.txt: Added.
* fast/hidpi/image-srcset-invalid-descriptor.html: Added.
* fast/hidpi/image-srcset-invalid-inputs-correct-src.html:
* fast/hidpi/image-srcset-src-selection-1x-both-expected.txt: Added.
* fast/hidpi/image-srcset-src-selection-1x-both.html: Added.
* fast/hidpi/resources/srcset-helper.js:
(runTest):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164949 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add protected casting to FilterOperation classes.
https://bugs.webkit.org/show_bug.cgi?id=124062

Reviewed by Sam Weinig.

Source/WebCore:

Use the type cast macro generators to produce some toFilterOperation-style
functions, and then use them in our PlatformCA filter code.

Test: css3/filters/animation-from-initial-values-with-color-matrix.html

* platform/graphics/ca/mac/PlatformCAFiltersMac.mm: Use the toFilterOperation methods, in
some cases removing the unnecessary double cast.
(PlatformCAFilters::filterValueForOperation):
(PlatformCAFilters::colorMatrixValueForFilter):
* platform/graphics/filters/FilterOperation.cpp:
(WebCore::BasicColorMatrixFilterOperation::blend):
(WebCore::BasicColorMatrixFilterOperation::operator==): Move this to the .cpp file so it can use the casting methods.
(WebCore::BasicComponentTransferFilterOperation::blend):
(WebCore::BasicComponentTransferFilterOperation::operator==): Ditto.
* platform/graphics/filters/FilterOperation.h: Add the casting macros.

LayoutTests:

* css3/filters/animation-from-initial-values-with-color-matrix-expected.html: Added.
* css3/filters/animation-from-initial-values-with-color-matrix.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164950 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sort Mac platform export files so they merge better
https://bugs.webkit.org/show_bug.cgi?id=129581

Reviewed by Sam Weinig.

Source/WebCore:

* WebCore.exp.in: Ran the new sort-export-file on this.

Source/WebKit/mac:

* WebKit.exp: Ran the new sort-export-file on this.

Tools:

* Scripts/sort-export-file: Added. Quickly whipped together script that sorts
Mac export files in a "canonical" order for this project.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164951 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS][WK2] Pages using tiled compositing layers allocate too many tiles on zoom
https://bugs.webkit.org/show_bug.cgi?id=129471

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-03-02
Reviewed by Simon Fraser.

Source/WebCore: 

A few issues with TileController were causing sublayers of the root layers
to tile incorrect surfaces on zoom.

First, the exposedRect API was not updating the sublayers. The layers go correctly
into tiling mode, but the tiles cover the full document instead of the visible area.

The other major issue was the margins being applied to the coverage size in document
coordinates. Since each margin is 512px, the total coverage size after zoom was
gigantic.

To solve this, this patch switch from the exposedRect API to the generic concept
of VisibleExtentContentRect introduced for iOS WebKit1.

* WebCore.exp.in:
* platform/ScrollView.h:
Define a VisibleExtentContentRect on the scrollview itself when there is no
platformWidget().
The case with inside frame is untested due to stability issues :(.
(see <rdar://problem/16199219>)

* platform/graphics/ca/mac/TileController.mm:
(WebCore::TileController::computeTileCoverageRect):
Remove the margin from the tile coverage.

On iOS, m_tileCoverage is always zero at the moment. Previously, the tile coverage
was artificially extended by the margins. With the margins removed, I temporarily added
a factor of 1.5.
ViewUpdateDispatcher has all the information to compute a great tile coverage, I will need
a follow up patch to fix that.

* platform/ios/ScrollViewIOS.mm:
(WebCore::ScrollView::visibleExtentContentRect):
(WebCore::ScrollView::setVisibleExtentContentRect):

Source/WebKit2: 

* WebProcess/WebPage/DrawingArea.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateVisibleContentRects):
A few interesting changes here:
-Now that we do not use setExposedRect, we can pass the exposed area directly
 to the drawing area since everything is now in content coordinates :)
-The scale is now converted to float before being compared to the Page's scaleFactor.
 The page's scalefactor being a float, the comparison was failing most of the time.

* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::setVisibleExtentContentRect):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164952 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Clean up use of Options::enableConcurrentJIT().
<https://webkit.org/b/129582>

Reviewed by Filip Pizlo.

DFG Driver was conditionally checking Options::enableConcurrentJIT()
only if ENABLE(CONCURRENT_JIT).  Otherwise, it bypasses it with a local
enableConcurrentJIT set to false.

Instead we should configure Options::enableConcurrentJIT() to be false
in Options.cpp if !ENABLE(CONCURRENT_JIT), and DFG Driver should always
check Options::enableConcurrentJIT().  This makes the code read a little
cleaner.

* dfg/DFGDriver.cpp:
(JSC::DFG::compileImpl):
* runtime/Options.cpp:
(JSC::recomputeDependentOptions):


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