Update html5lib test data to latest version
https://bugs.webkit.org/show_bug.cgi?id=131588

Patch by Koji Ishii <kojishi@gmail.com> on 2014-04-14
Reviewed by Darin Adler.

This patch imports the latest version of the "dat" files from
https://github.com/html5lib/html5lib-tests
Also updated expected files for failures of new tests.

* html5lib/generated/run-adoption01-data-expected.txt: Passes now as a bug in the test was fixed.
* html5lib/generated/run-adoption01-write-expected.txt: Supressed new failures.
* html5lib/generated/run-inbody01-data-expected.txt: Added.
* html5lib/generated/run-inbody01-data.html: Added.
* html5lib/generated/run-inbody01-write-expected.txt: Added.
* html5lib/generated/run-inbody01-write.html: Added.
* html5lib/generated/run-main-element-data-expected.txt: Added.
* html5lib/generated/run-main-element-data.html: Added.
* html5lib/generated/run-main-element-write-expected.txt: Added.
* html5lib/generated/run-main-element-write.html: Added.
* html5lib/generated/run-template-data-expected.txt: Supressed new failures.
* html5lib/generated/run-template-write-expected.txt: Supressed new failures.
* html5lib/generated/run-tests21-data-expected.txt: Supressed new failures.
* html5lib/generated/run-tests21-write-expected.txt: Supressed new failures.
* html5lib/generated/run-tests25-data-expected.txt: Supressed new failures.
* html5lib/generated/run-tests25-write-expected.txt: Supressed new failures.
* html5lib/resources/adoption01.dat:
* html5lib/resources/adoption02.dat:
* html5lib/resources/comments01.dat:
* html5lib/resources/doctype01.dat:
* html5lib/resources/domjs-unsafe.dat:
* html5lib/resources/entities01.dat:
* html5lib/resources/entities02.dat:
* html5lib/resources/html5test-com.dat:
* html5lib/resources/inbody01.dat:
* html5lib/resources/isindex.dat:
* html5lib/resources/main-element.dat: Added.
* html5lib/resources/pending-spec-changes-plain-text-unsafe.dat:
* html5lib/resources/pending-spec-changes.dat:
* html5lib/resources/plain-text-unsafe.dat:
* html5lib/resources/scriptdata01.dat:
* html5lib/resources/tables01.dat:
* html5lib/resources/template.dat:
* html5lib/resources/tests1.dat:
* html5lib/resources/tests10.dat:
* html5lib/resources/tests14.dat:
* html5lib/resources/tests15.dat:
* html5lib/resources/tests16.dat:
* html5lib/resources/tests17.dat:
* html5lib/resources/tests18.dat:
* html5lib/resources/tests19.dat:
* html5lib/resources/tests2.dat:
* html5lib/resources/tests20.dat:
* html5lib/resources/tests21.dat:
* html5lib/resources/tests22.dat:
* html5lib/resources/tests23.dat:
* html5lib/resources/tests25.dat:
* html5lib/resources/tests26.dat:
* html5lib/resources/tests3.dat:
* html5lib/resources/tests4.dat:
* html5lib/resources/tests5.dat:
* html5lib/resources/tests6.dat:
* html5lib/resources/tests7.dat:
* html5lib/resources/tests8.dat:
* html5lib/resources/tests9.dat:
* html5lib/resources/tests_innerHTML_1.dat:
* html5lib/resources/tricky01.dat:
* html5lib/resources/webkit01.dat:
* html5lib/resources/webkit02.dat:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167213 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Regions] Hit testing doesn't work in video
https://bugs.webkit.org/show_bug.cgi?id=131485

Reviewed by Andrei Bucur.

Source/WebCore:

When hit testing flow thread layer through the region layer,
we have to pass the depth sorting information and take that
into account for the situation in which an ancestor of the region
has preserve-3d transform style.

Test: fast/regions/hit-test-region-preserve3d-container.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hitTestLayer):
(WebCore::RenderLayer::hitTestFlowThreadIfRegionForFragments):
* rendering/RenderLayer.h:

LayoutTests:

* fast/regions/hit-test-region-preserve3d-container-expected.txt: Added.
* fast/regions/hit-test-region-preserve3d-container.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167215 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Support setting a background color on page overlays
https://bugs.webkit.org/show_bug.cgi?id=131600

Reviewed by Darin Adler.

* WebProcess/WebPage/PageOverlay.cpp:
(WebKit::PageOverlay::PageOverlay):
(WebKit::PageOverlay::bounds):
(WebKit::PageOverlay::startFadeInAnimation):
(WebKit::PageOverlay::startFadeOutAnimation):
(WebKit::PageOverlay::startFadeAnimation):
(WebKit::PageOverlay::fadeAnimationTimerFired):
Minor style adjustments.
Use more references everywhere.

(WebKit::PageOverlay::setBackgroundColor):
(WebKit::PageOverlay::setNeedsDisplay):
* WebProcess/WebPage/PageOverlay.h:
(WebKit::PageOverlay::backgroundColor):
Keep track of our background color, and push it down to the page overlay controller if we have one.

* WebProcess/WebPage/PageOverlayController.cpp:
(WebKit::updateOverlayGeometry):
(WebKit::PageOverlayController::clearPageOverlay):
Page overlays will always have the right size, and just use drawsContents to determine
whether or not they should tile/have backing store/etc.

(WebKit::PageOverlayController::installPageOverlay):
(WebKit::PageOverlayController::didChangeOverlayBackgroundColor):
Set the background color of the layer.

* WebProcess/WebPage/PageOverlayController.h:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
References!

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::setDocumentOverlayRootLayer):
Mark the compositing tree as needing a rebuild when we get a new document-relative
overlay layer; otherwise we were depending on something else coming along and
requiring a rebuild, which didn't always happen.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CSS JIT: compile the :nth-child() pseudo class
https://bugs.webkit.org/show_bug.cgi?id=131602

Reviewed by Andreas Kling.

Source/WebCore:

Tests: fast/selectors/nth-child-bounds.html
       fast/selectors/nth-child-with-backtracking.html

Compile the :nth-child() pseudo class function + some related clean up.

* css/CSSSelector.cpp:
(WebCore::CSSSelector::nthA):
(WebCore::CSSSelector::nthB):
Expose the parsed value of an+b filters. Those values are used to compile
the selector.

(WebCore::CSSSelector::RareData::parseNth):
While working on the patch, I discovered some severe issues with the parsing of large
values of a and/or b. The problem comes from the way the CSS parser handle the values:
the values are parsed as a double then converted to an AtomicString for CSSSelector.

There are many problems related to large values but we never got bug reports because
they are very uncommon. Fixing those problem would require changing the parser.

Here, CSSSelector::RareData::parseNth() is hardened a little bit to avoid absurd values
of a and b.

* css/CSSSelector.h:
* cssjit/RegisterAllocator.h:
It looks like I forgot RDX in the list of register. Add it now since it is required
for SelectorCodeGenerator::modulo().

* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoType):
(WebCore::SelectorCompiler::SelectorCodeGenerator::SelectorCodeGenerator):
(WebCore::SelectorCompiler::SelectorCodeGenerator::modulo):
(WebCore::SelectorCompiler::SelectorCodeGenerator::moduloIsZero):
There is no modulo() operation exposed on the macro assemblers. This is a basic
implementation on top of idiv for x86_64.

Since idiv works exclusively with RAX and RDX, most of the code is about getting
those registers efficiently.

(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatching):
(WebCore::SelectorCompiler::setElementChildIndex):
(WebCore::SelectorCompiler::setElementChildIndexAndUpdateStyle):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChild):
This is pretty much a straightforward implementation of :nth-child().
The first part counts the number of previous elements.
The second part updates the tree if this is style resolution.
The last part compares the number of previous siblings to an+b to find if the filter matches.

The only part that diverges from SelectorChecker is how childIndex is used. Instead of testing it
at every iteration, only the first iteration handle the cache.

* dom/ElementRareData.h:
(WebCore::ElementRareData::childIndexMemoryOffset):
* dom/Node.h:
(WebCore::Node::rareDataMemoryOffset):
(WebCore::Node::flagHasRareData):
* rendering/style/RenderStyle.h:

LayoutTests:

Add a couple of test for the new code:
-nth-child-with-backtracking tests the register pressure with backtracking.
-nth-child-bounds tests invalid selectors do not cause problems.

* fast/selectors/nth-child-bounds-expected.txt: Added.
* fast/selectors/nth-child-bounds.html: Added.
* fast/selectors/nth-child-with-backtracking-expected.txt: Added.
* fast/selectors/nth-child-with-backtracking.html: Added.

* http/tests/security/video-poster-cross-origin-crash.html:
Now that CSSSelector filters out ridiculously bad values, the pseudo class in this test
was no longer executed.
The particular value of nth-child is irrelevant for this test, all it needs it the tree marking
while not matching.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167218 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Merge MemoryPressureHandler{Mac,IOS}.mm
<https://webkit.org/b/131603>

Join the iOS and Mac platform implementations of MemoryPressureHandler
under the shared Cocoa banner. Each platform still has its own quirky
behavior, but this puts them in the same file so we can start sharing.

Reviewed by Darin Adler.

* WebCore.xcodeproj/project.pbxproj:
* platform/cocoa/MemoryPressureHandlerCocoa.mm: Renamed from Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm.
(WebCore::MemoryPressureHandler::platformReleaseMemory):
(WebCore::MemoryPressureHandler::install):
(WebCore::MemoryPressureHandler::uninstall):
(WebCore::MemoryPressureHandler::holdOff):
(WebCore::MemoryPressureHandler::respondToMemoryPressure):
(WebCore::respondToMemoryPressureCallback):
(WebCore::MemoryPressureHandler::installMemoryReleaseBlock):
(WebCore::MemoryPressureHandler::setReceivedMemoryPressure):
(WebCore::MemoryPressureHandler::hasReceivedMemoryPressure):
(WebCore::MemoryPressureHandler::clearMemoryPressure):
(WebCore::MemoryPressureHandler::shouldWaitForMemoryClearMessage):
(WebCore::MemoryPressureHandler::respondToMemoryPressureIfNeeded):
* platform/ios/MemoryPressureHandlerIOS.mm: Removed.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167219 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[JSC] Improve the call site of string comparison in some hot path
https://bugs.webkit.org/show_bug.cgi?id=131605

Reviewed by Darin Adler.

Source/JavaScriptCore:

When resolved, the String of a JSString is never null. It can be empty but not null.
The null value is reserved for ropes but those would be resolved when getting the value.

Consequently, we should use the equal() operation that do not handle null values.
Using the StringImpl directly is already common in StringPrototype but it was not used here for some reason.

* jit/JITOperations.cpp:
* runtime/JSCJSValueInlines.h:
(JSC::JSValue::equalSlowCaseInline):
(JSC::JSValue::strictEqualSlowCaseInline):
(JSC::JSValue::pureStrictEqual):

Source/WebCore:

* dom/NodeRareData.h:
(WebCore::NodeListsNodeData::NodeListCacheMapEntryHash::equal):
We should use the right comparison operation depending on the Hash Traits.

Source/WTF:

* wtf/text/StringImpl.cpp:
(WTF::stringImplContentEqual):
Inline that function to reduce the call overhead for JSC.
This is only inlined twice, it is not catastrophic for our binary.


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