Hide HOST_RULE behind SHADOW_DOM flag.
https://bugs.webkit.org/show_bug.cgi?id=102321

Reviewed by Dimitri Glazkov.

@host @-rules are only available when the rules are declared in styles
in shadow dom trees. So if SHADOW_DOM is disabled, we don't need
@host @-rules.

No new tests. Just hide HOST_RULE behind SHADOW_DOM flag.

* css/StyleResolver.h:
Hide "class ShadowRuleHost".
* css/StyleRule.cpp:
(WebCore::StyleRuleBase::reportMemoryUsage):
(WebCore::StyleRuleBase::destroy):
(WebCore::StyleRuleBase::copy):
(WebCore::StyleRuleBase::createCSSOMWrapper):
* css/StyleRule.h:
(StyleRuleBase):
Hide "Host" type and isHostRule.
(StyleRuleHost):
Hide "class StyleRuleHost".
* css/StyleSheetContents.cpp:
(WebCore::childRulesHaveFailedOrCanceledSubresources):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@137417 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Text nodes in shadow roots don't inherit style properly
https://bugs.webkit.org/show_bug.cgi?id=101116

Reviewed by Hajime Morita.

Source/WebCore:

Use NodeRenderingContext to resolve styles of text nodes.
If text nodes are direct children of shadow roots, the text nodes
should be inherited styles from their shadow hosts.
But if reset-style-inheritance flag is true, the text nodes should
not be inherited. And if text nodes are distributed nodes,
we have to check whether their insertion point's
reset-style-inheritance.
c.f. shadow dom spec is:
http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#styles

Test: fast/dom/shadow/text-node-in-shadow.html

* css/StyleResolver.cpp:
(WebCore::StyleResolver::styleForElement):
Modified to use defaultStyleForElement if the given element has
no parent style.
(WebCore::StyleResolver::initForStyleResolve):
Removed shouldResetStyleInheritance, because now NodeRenderingContext
resetStyleInheritance() takes care of reset-style-inheritance of
both shadow roots and insertion points.
(WebCore::StyleResolver::defaultStyleForElement):
Added to create a default style for elements.
(WebCore):
(WebCore::StyleResolver::styleForText):
Use NodeRenderingContext to find the parent node for style from the
given text node. If no parent node is found or reset-style-inheritance
is true, returns a default style (i.e. empty render style).
Otherwise, just returns the found node's style.
* css/StyleResolver.h:
(StyleResolver):
* dom/ComposedShadowTreeWalker.cpp:
(WebCore::ComposedShadowTreeWalker::ParentTraversalDetails::didTraverseInsertionPoint):
Modify to consider insertion point's resetStyleInheritance.
* dom/NodeRenderingContext.cpp:
(WebCore::NodeRenderingContext::createRendererForTextIfNeeded):
Since NodeRenderingContext has already found a parent node for
rendering and style and a parentRenderer is just the found node's
renderer, we have to only check reset-style-inheritance.
If reset, use default style. Otherwise, the parentRenderer's style.
* dom/Text.cpp:
(WebCore::Text::recalcTextStyle):
Use styleForText instead of parentRenderer's styles if the given text
node is a direct child of a shadow root or a direct child of a shadow
host.

LayoutTests:

* fast/dom/shadow/text-node-in-shadow-expected.html: Added.
* fast/dom/shadow/text-node-in-shadow.html: Added.


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