Source/WebCore:
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Apr 2015 18:36:59 +0000 (18:36 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Apr 2015 18:36:59 +0000 (18:36 +0000)
commit48478c4d652cca2c7d903799c1bdf51128ba9f3a
tree004129dd93b26e1fa83428a3dd7d3a94e8cf30a3
parentda8b8de6f91df85e2940ec67ea4e553141dce974
Source/WebCore:
[Mac] [iOS] Implement font-synthesis CSS property
https://bugs.webkit.org/show_bug.cgi?id=144305

Reviewed by Andreas Kling.

This patch is fairly straightforward, though there are some particular pieces to the patch listed below.

The implementation of this font-synthesis CSS property lives inside FontCacheIOS and FontCacheMac. We already
determine if we should synthesize bold and italics, this CSS property simply guards that decision.

Because FontCache interacts with FontDescriptions and not RenderStyles, this patch moves the source of truth
regarding font-synthesis into FontDescription (from RenderStyle).

Test: fast/css3-text/font-synthesis.html

* css/CSSPropertyNames.in: Mark font-synthesis as a FontProperty, which means that the relevant state is kept
inside FontDescription. This also means that the property must be marked as a "high priority" property, which
is enforced by it existing at the top of CSSPropertyNames.in. The move to FontDescription must be done so that
FontCacheIOS and FontCacheMac have access to the saved state.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::fontSynthesisFromStyle): Update to look for state in FontDescription instead of RenderStyle.
* css/CSSSegmentedFontFace.cpp:
(WebCore::CSSSegmentedFontFace::fontRanges): Guard the synthetic bold and synthic italic decision on the new
FontSynthesis state inside FontDescription.
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertFontSynthesis): Moved from
StyleBuilderCustom::applyValueFontSynthesis(). This is because of the updated options inside of
CSSPropertyNames.in
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyValueFontSynthesis): Deleted.
* platform/graphics/FontDescription.h:
(WebCore::FontDescription::FontDescription): Moved from RenderStyle.
(WebCore::FontDescription::fontSynthesis): Ditto.
(WebCore::FontDescription::setFontSynthesis): Ditto.
(WebCore::FontDescription::initialFontSynthesis): Ditto.
(WebCore::FontDescription::operator==): Update to include new state.
* platform/graphics/FontCache.h:
(WebCore::FontDescriptionFontDataCacheKey::makeFlagKey): Make FontDescription hashes sensitive to the new
state inside FontDescription.
* platform/graphics/ios/FontCacheIOS.mm:
(WebCore::FontCache::createFontPlatformData): Guard the synthetic bold and synthetic italic decision on the
new FontSynthesis state inside FontDescription.
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::FontCache::createFontPlatformData): Ditto.
* platform/text/TextFlags.h: Move FontSynthesis type from RenderStyleConstants.
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::fontSynthesis): Moved to FontDescription.
(WebCore::RenderStyle::setFontSynthesis): Ditto.
(WebCore::RenderStyle::initialFontSynthesis): Ditto.
* rendering/style/RenderStyleConstants.h: Moved FontSynthesis type to TextFlags.
* rendering/style/StyleRareInheritedData.h: Remove state regarding font synthesis (moved to FontDescription)

LayoutTests:
Implement font-synthesis CSS property
https://bugs.webkit.org/show_bug.cgi?id=144305

Reviewed by Andreas Kling.

Test all combinations of font-weight, font-style, and font-synthesis.

* fast/css3-text/font-synthesis-expected.html: Added.
* fast/css3-text/font-synthesis.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183494 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css3-text/font-synthesis-expected.html [new file with mode: 0644]
LayoutTests/fast/css3-text/font-synthesis-parse-expected.txt
LayoutTests/fast/css3-text/font-synthesis-parse.html
LayoutTests/fast/css3-text/font-synthesis.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/CSSSegmentedFontFace.cpp
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/css/StyleBuilderCustom.h
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/platform/graphics/FontCache.h
Source/WebCore/platform/graphics/FontDescription.h
Source/WebCore/platform/graphics/ios/FontCacheIOS.mm
Source/WebCore/platform/graphics/mac/FontCacheMac.mm
Source/WebCore/platform/text/TextFlags.h
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/RenderStyleConstants.h
Source/WebCore/rendering/style/StyleRareInheritedData.h