[Shadow DOM] Needs @host rule for ShadowDOM styling
https://bugs.webkit.org/show_bug.cgi?id=88606

Reviewed by Hajime Morita.

Source/WebCore:

Implemented @host-@rules according to the shadow dom spec:
http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#host-at-rule
The design doc is:
https://docs.google.com/document/d/1P2yorchF8lci2sccr-mVSRf2dtvjKeiuyQWzCB2bEA8/edit

Test: fast/dom/shadow/athost-atrules.html

* css/CSSGrammar.y.in:
Added rules for parsing @host @-rules.
* css/CSSParser.cpp:
(WebCore::CSSParser::detectAtToken):
Added a new token "@host".
(WebCore::CSSParser::createHostRule):
Added a new method to create an @host @-rule, which is invoked from
(WebCore):
* css/CSSParser.h:
Added a declaration of the above new method: createHostRule.
* css/CSSPropertySourceData.h:
Added HOST_RULE to enum Type.
* css/RuleSet.cpp:
(WebCore::RuleData::RuleData):
Modified multiple bool arguments into one argument. Now it
uses combinations of values from enum AddRuleFlags.
(WebCore::RuleSet::addRule):
(WebCore::RuleSet::addRegionRule):
(WebCore::RuleSet::addStyleRule):
Updated according to the RuleData's change.
Modified to Invoke increaseSpecificity if the given rule is @host
@-rule.
(WebCore::RuleSet::addRulesFromSheet):
Invoked addHostRule if the given rule is @host @-rule.
* css/RuleSet.h:
(RuleData):
(WebCore::RuleData::increaseSpecificity):
Added a new method to increase selector's specificity. This method is
used to make @host @-rules' specificity larger than normal author
rules' specificity.
(RuleSet):
* css/StyleResolver.cpp:
(WebCore::makeRuleSet):
(WebCore::StyleResolver::addHostRule):
A wrapper method to invoke StyleScopeResolver::addHostRule. The method
is used to make only StyleResolver know an implementation detail about
class StyleScopeResolver.
(WebCore::StyleResolver::appendAuthorStylesheets):
Updated according to the RuleData's change.
(WebCore::StyleResolver::styleSharingCandidateMatchesHostRules):
A new method to find matched host rules when an element is given.
This method invokes
StyleScopeResolver::styleSharingCandidateMatchesHostRules to find
matched host rules.
(WebCore):
(WebCore::StyleResolver::matchHostRules):
A new method to find matched host rules when an element is given.
This method invokes StyleScopeResolver::matchHostRules to find
matched host rules.
(WebCore::StyleResolver::matchScopedAuthorRules):
Modified to invoke matchHostRules.
(WebCore::StyleResolver::locateSharedStyle):
Disable sibling style cache if the given element is a shadow host and
any @host @-rules are applied to the element.
* css/StyleResolver.h:
(WebCore::StyleResolver::ensureScopeResolver):
If no scopeResolver is created, create and return the instance.
If created, just return the instance.
(StyleResolver):
* css/StyleRule.cpp:
(WebCore::StyleRuleBase::reportMemoryUsage):
(WebCore::StyleRuleBase::destroy):
(WebCore::StyleRuleBase::copy):
(WebCore::StyleRuleBase::createCSSOMWrapper):
(WebCore::StyleRuleHost::StyleRuleHost):
Implemented class StyleRuleHost. The class is almost the same as
StyleRuleBlock except type.
(WebCore):
* css/StyleRule.h:
(WebCore::StyleRuleBase::isHostRule):
(StyleRuleHost):
(WebCore::StyleRuleHost::create):
(WebCore::StyleRuleHost::copy):
(WebCore):
* css/StyleScopeResolver.cpp:
(WebCore::StyleScopeResolver::ensureAtHostRuleSetFor):
A new method to create a new RuleSet for the given shadow root.
(WebCore):
(WebCore::StyleScopeResolver::atHostRuleSetFor):
A new private inline method to obtain @host @-rules declared in
the given shadow root.
(WebCore::StyleScopeResolver::addHostRule):
Added a new method to register @host @-rules with shadow roots.
(WebCore::StyleScopeResolver::styleSharingCandidateMatchesHostRules):
A new method to find whether any @host @-rules are applied to
the given host element.
(WebCore::StyleScopeResolver::matchHostRules):
A new method to find matched rules for the given host element.
(WebCore::StyleScopeResolver::reportMemoryUsage):
* css/StyleScopeResolver.h:
(WebCore):
(StyleScopeResolver):
* css/StyleSheetContents.cpp:
(WebCore::childRulesHaveFailedOrCanceledSubresources):

LayoutTests:

* fast/dom/shadow/athost-atrules-expected.txt: Added.
* fast/dom/shadow/athost-atrules.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132303 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Remove duplicate platform/mac entries
https://bugs.webkit.org/show_bug.cgi?id=100167

Reviewed by Dirk Pranke.

We intentionally don't run platform/mac tests in Chromium.  Remove lines
that duplicate the directory WontFix.

* platform/chromium/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132304 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Unreviewed nightly gardening, skip new failing tests.

* platform/qt/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] Rebaseline for r132291
https://bugs.webkit.org/show_bug.cgi?id=100088

* platform/chromium-linux/fast/forms/date-multiple-fields/date-multiple-fields-appearance-basic-expected.png:
* platform/chromium-linux/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n-expected.png:
* platform/chromium-linux/fast/forms/date-multiple-fields/date-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-linux/fast/forms/date-multiple-fields/date-multiple-fields-appearance-style-expected.png:
* platform/chromium-linux/fast/forms/month-multiple-fields/month-multiple-fields-appearance-basic-expected.png:
* platform/chromium-linux/fast/forms/month-multiple-fields/month-multiple-fields-appearance-l10n-expected.png: Added.
* platform/chromium-linux/fast/forms/month-multiple-fields/month-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-linux/fast/forms/month-multiple-fields/month-multiple-fields-appearance-style-expected.png:
* platform/chromium-linux/fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic-expected.png:
* platform/chromium-linux/fast/forms/time-multiple-fields/time-multiple-fields-appearance-disabled-readonly-expected.png:
* platform/chromium-linux/fast/forms/time-multiple-fields/time-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-linux/fast/forms/time-multiple-fields/time-multiple-fields-appearance-style-expected.png:
* platform/chromium-linux/fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic-expected.png:
* platform/chromium-linux/fast/forms/week-multiple-fields/week-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-linux/fast/forms/week-multiple-fields/week-multiple-fields-appearance-style-expected.png:
* platform/chromium-mac-lion/fast/forms/date-multiple-fields/date-multiple-fields-appearance-basic-expected.png:
* platform/chromium-mac-lion/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n-expected.png:
* platform/chromium-mac-lion/fast/forms/date-multiple-fields/date-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-mac-lion/fast/forms/date-multiple-fields/date-multiple-fields-appearance-style-expected.png:
* platform/chromium-mac-lion/fast/forms/month-multiple-fields/month-multiple-fields-appearance-basic-expected.png: Added.
* platform/chromium-mac-lion/fast/forms/month-multiple-fields/month-multiple-fields-appearance-l10n-expected.png: Added.
* platform/chromium-mac-lion/fast/forms/month-multiple-fields/month-multiple-fields-appearance-pseudo-classes-expected.png: Added.
* platform/chromium-mac-lion/fast/forms/month-multiple-fields/month-multiple-fields-appearance-style-expected.png: Added.
* platform/chromium-mac-lion/fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic-expected.png:
* platform/chromium-mac-lion/fast/forms/time-multiple-fields/time-multiple-fields-appearance-disabled-readonly-expected.png:
* platform/chromium-mac-lion/fast/forms/time-multiple-fields/time-multiple-fields-appearance-pseudo-classes-expected.png: Added.
* platform/chromium-mac-lion/fast/forms/time-multiple-fields/time-multiple-fields-appearance-style-expected.png:
* platform/chromium-mac-lion/fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic-expected.png:
* platform/chromium-mac-lion/fast/forms/week-multiple-fields/week-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-mac-lion/fast/forms/week-multiple-fields/week-multiple-fields-appearance-style-expected.png:
* platform/chromium-mac-snowleopard/fast/forms/date-multiple-fields/date-multiple-fields-appearance-basic-expected.png:
* platform/chromium-mac-snowleopard/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n-expected.png:
* platform/chromium-mac-snowleopard/fast/forms/date-multiple-fields/date-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-mac-snowleopard/fast/forms/date-multiple-fields/date-multiple-fields-appearance-style-expected.png:
* platform/chromium-mac-snowleopard/fast/forms/month-multiple-fields/month-multiple-fields-appearance-basic-expected.png:
* platform/chromium-mac-snowleopard/fast/forms/month-multiple-fields/month-multiple-fields-appearance-l10n-expected.png: Added.
* platform/chromium-mac-snowleopard/fast/forms/month-multiple-fields/month-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-mac-snowleopard/fast/forms/month-multiple-fields/month-multiple-fields-appearance-style-expected.png:
* platform/chromium-mac-snowleopard/fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic-expected.png:
* platform/chromium-mac-snowleopard/fast/forms/time-multiple-fields/time-multiple-fields-appearance-disabled-readonly-expected.png:
* platform/chromium-mac-snowleopard/fast/forms/time-multiple-fields/time-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-mac-snowleopard/fast/forms/time-multiple-fields/time-multiple-fields-appearance-style-expected.png:
* platform/chromium-mac-snowleopard/fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic-expected.png:
* platform/chromium-mac-snowleopard/fast/forms/week-multiple-fields/week-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-mac-snowleopard/fast/forms/week-multiple-fields/week-multiple-fields-appearance-style-expected.png:
* platform/chromium-mac/fast/forms/date-multiple-fields/date-multiple-fields-appearance-basic-expected.png:
* platform/chromium-mac/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n-expected.png:
* platform/chromium-mac/fast/forms/date-multiple-fields/date-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-mac/fast/forms/date-multiple-fields/date-multiple-fields-appearance-style-expected.png:
* platform/chromium-mac/fast/forms/month-multiple-fields/month-multiple-fields-appearance-basic-expected.png:
* platform/chromium-mac/fast/forms/month-multiple-fields/month-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-mac/fast/forms/month-multiple-fields/month-multiple-fields-appearance-style-expected.png:
* platform/chromium-mac/fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic-expected.png:
* platform/chromium-mac/fast/forms/time-multiple-fields/time-multiple-fields-appearance-disabled-readonly-expected.png:
* platform/chromium-mac/fast/forms/time-multiple-fields/time-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-mac/fast/forms/time-multiple-fields/time-multiple-fields-appearance-style-expected.png:
* platform/chromium-mac/fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic-expected.png:
* platform/chromium-mac/fast/forms/week-multiple-fields/week-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-mac/fast/forms/week-multiple-fields/week-multiple-fields-appearance-style-expected.png:
* platform/chromium-win-xp/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n-expected.png:
* platform/chromium-win-xp/fast/forms/month-multiple-fields/month-multiple-fields-appearance-l10n-expected.png: Added.
* platform/chromium-win/fast/forms/date-multiple-fields/date-multiple-fields-appearance-basic-expected.png:
* platform/chromium-win/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n-expected.png:
* platform/chromium-win/fast/forms/date-multiple-fields/date-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-win/fast/forms/date-multiple-fields/date-multiple-fields-appearance-style-expected.png:
* platform/chromium-win/fast/forms/month-multiple-fields/month-multiple-fields-appearance-basic-expected.png:
* platform/chromium-win/fast/forms/month-multiple-fields/month-multiple-fields-appearance-l10n-expected.png: Added.
* platform/chromium-win/fast/forms/month-multiple-fields/month-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-win/fast/forms/month-multiple-fields/month-multiple-fields-appearance-style-expected.png:
* platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic-expected.png:
* platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-disabled-readonly-expected.png:
* platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-win/fast/forms/time-multiple-fields/time-multiple-fields-appearance-style-expected.png:
* platform/chromium-win/fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic-expected.png:
* platform/chromium-win/fast/forms/week-multiple-fields/week-multiple-fields-appearance-pseudo-classes-expected.png:
* platform/chromium-win/fast/forms/week-multiple-fields/week-multiple-fields-appearance-style-expected.png:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132306 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CodeBlock: Give m_putToBaseOperations an inline capacity.
<http://webkit.org/b/100190>
<rdar://problem/12562466>

Reviewed by Oliver Hunt.

Since the CodeBlock constructor always inserts a single PutToBaseOperation, but there's no
guarantee that more will follow, give the m_putToBaseOperations vector an inline capacity of 1.
There are 4009 of these Vectors on Membuster3, and only 126 of them have more than a single entry.

This change yields a 1.90MB reduction in memory usage.

* bytecode/CodeBlock.h:
(CodeBlock):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132307 268f45cc-cd09-0410-ab3c-d52691b4dbfc
The font cache evicts inactive font data too aggressively when not under memory pressure
https://bugs.webkit.org/show_bug.cgi?id=100194

Reviewed by Sam Weinig.

Increasing the number of inactive font data objects the cache may hold increases the hit
rate, leading to improved page load performance. When memory pressure is detected,
MemoryPressureHandler evicts all inactive objects, regardless of the limits we are
increasing here.

* platform/graphics/FontCache.cpp:
(WebCore): Increased the maximum number of inactive font data objects in the cache from 50
to 225, and the number of objects to evict once the limit is met from 20 to 25.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132308 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/mac: WebKit/mac part of <rdar://problem/2966974> [mac] Kerning and ligatures are not enabled by default
https://bugs.webkit.org/show_bug.cgi?id=100188

Reviewed by Sam Weinig.

* WebView/WebView.mm:
(+[WebView initialize]): Added a local variable to hold the standard user defaults. Added
code to register a value of YES for the WebKitKerningAndLigaturesEnabledByDefault user
default. Changed to refer to that default key by name.

Source/WebKit2: WebKit2 part of <rdar://problem/2966974> [mac] Kerning and ligatures are not enabled by default
https://bugs.webkit.org/show_bug.cgi?id=100188

Reviewed by Sam Weinig.

* UIProcess/mac/WebContextMac.mm:
(WebKit::registerUserDefaultsIfNeeded): Added. Registers a value of YES for the
WebKitKerningAndLigaturesEnabledByDefault user default if it has not been registered yet.
(WebKit::WebContext::platformInitializeWebProcess): Added a call to
registerUserDefaultsIfNeeded, and changed to refer to the defaults key by name.

Tools: Tools changes for <rdar://problem/2966974> [mac] Kerning and ligatures are not enabled by default
https://bugs.webkit.org/show_bug.cgi?id=100188

Reviewed by Sam Weinig.

Disable kerning and ligatures by default when running the tests.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetDefaultsToConsistentValues): Set a value of NO for the
WebKitKerningAndLigaturesEnabledByDefault user default.
* WebKitTestRunner/mac/main.mm:
(main): Register a value of NO for the WebKitKerningAndLigaturesEnabledByDefault user
default.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132309 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Multiple fields input UI: Don't use CSS properties for physical direction
https://bugs.webkit.org/show_bug.cgi?id=100195

Reviewed by Kentaro Hara.

Source/WebCore:

CSS declarations such as "padding: 0 0 0 1px;" "margin-left: 0.2em;" are
not direction-neutral, and makes unexpected appearance in RTL. We should
use -webkit-padding-start or -webkit-margin-start.

No new tests. Covered by date-multiple-fields-appearance-l10n.html and
month-multiple-fields-appearance-l10n.html

* css/html.css:
(input[type="date"]): Use padding:0 and -webkit-padding-start:1px;
(input[type="datetime"]): Ditto.
(input[type="datetime-local"]): Ditto.
(input[type="month"]): Ditto.
(input[type="time"]): Ditto.
(input[type="week"]): Ditto.
(input[type="week"]::-webkit-inner-spin-button):
Use -webkit-margin-start. Also use an integral pixel size instead of
avoid a fractional relative size to avoid subpixel layout rounding.

LayoutTests:

* platform/chromium-mac/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n-expected.png:
* platform/chromium-mac/fast/forms/month-multiple-fields/month-multiple-fields-appearance-l10n-expected.png:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132310 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove specialized hash traits for GlyphPages.
<http://webkit.org/b/100185>

Reviewed by Dan Bernstein.

Now that the default minimum table size has been lowered for all tables, there's no need
for this specialization anymore.

* platform/graphics/FontFallbackList.h:
(FontFallbackList):


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