The style resolution cache applies properties incorrectly whenever direction != ltr
https://bugs.webkit.org/show_bug.cgi?id=137052

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-09-23
Reviewed by Andreas Kling.

Source/WebCore:

The optimization r135021 introduced a bug whenever the direction of subtree is not
uniform in the whole page.

When StyleResolver::applyMatchedProperties() resolves the style, some properties are
resolved differently based on the writing-mode and the direction.

In isCacheableInMatchedPropertiesCache(), the cases for writing-mode are already handled
by not caching any style with anything else than the default.
The direction was ignored, causing the bugs solved here.

Tests: css3/flexbox/flex-flow-2.html
       fast/css/style-resolver-cache-direction-1.html
       fast/css/style-resolver-cache-direction-2.html
       fast/css/style-resolver-cache-direction-3.html

* css/StyleResolver.cpp:
(WebCore::isCacheableInMatchedPropertiesCache):

LayoutTests:

* css3/flexbox/flex-flow-2-expected.txt: Added.
* css3/flexbox/flex-flow-2.html: Added.
The test flex-flow.html should have uncovered the bug. It did not because it uses
:nth-child(), which disable style optimizations.

flex-flow-2.html is a copy of flex-flow.html using classes instead of :nth-child().
This would have caught the bug.

* fast/css/style-resolver-cache-direction-1-expected.html: Added.
* fast/css/style-resolver-cache-direction-1.html: Added.
* fast/css/style-resolver-cache-direction-2-expected.html: Added.
* fast/css/style-resolver-cache-direction-2.html: Added.
* fast/css/style-resolver-cache-direction-3-expected.html: Added.
* fast/css/style-resolver-cache-direction-3.html: Added.
New basic tests for the fix.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@173906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add support for is<HTML*Element>() for type checking
https://bugs.webkit.org/show_bug.cgi?id=137015

Reviewed by Benjamin Poulain.

Add support for is<HTML*Element>() for type checking while keeping
support for the legacy toHTML*Element() form until the code base is
ported.

toHTML*Element() helpers are now macros to the new is<HTML*Element>()
type checking helpers.

No new tests, no behavior change.

* dom/Document.cpp:
(WebCore::Document::setTitle):
* dom/Element.cpp:
(WebCore::Element::childShouldCreateRenderer):
* dom/Element.h:
(WebCore::is):
(WebCore::downcast):
(WebCore::isElementOfType): Deleted.
* dom/ElementAncestorIterator.h:
(WebCore::lineageOfType):
* dom/ElementIterator.h:
(WebCore::findElementAncestorOfType):
* dom/ElementTraversal.h:
(WebCore::Traversal<ElementType>::firstChildTemplate):
(WebCore::Traversal<ElementType>::lastChildTemplate):
(WebCore::Traversal<ElementType>::firstWithinTemplate):
(WebCore::Traversal<ElementType>::lastWithinTemplate):
(WebCore::Traversal<ElementType>::nextTemplate):
(WebCore::Traversal<ElementType>::previous):
(WebCore::Traversal<ElementType>::nextSibling):
(WebCore::Traversal<ElementType>::previousSibling):
(WebCore::Traversal<ElementType>::nextSkippingChildren):
* dom/TypedElementDescendantIterator.h:
(WebCore::TypedElementDescendantIteratorAdapter<ElementType>::from):
(WebCore::TypedElementDescendantConstIteratorAdapter<ElementType>::from):
* dom/make_names.pl:
(printTypeHelpers):


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