Changeset 104678 in webkit
- Timestamp:
- Jan 11, 2012, 12:38:29 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r104673 r104678 1 2012-01-11 Dan Bernstein <mitz@apple.com> 2 3 <rdar://problem/10674686> Implement the font-kerning CSS property 4 https://bugs.webkit.org/show_bug.cgi?id=76033 5 6 Reviewed by Darin Adler. 7 8 * fast/css/getComputedStyle/computed-style-expected.txt: 9 * fast/text/font-kerning-expected.html: Added. 10 * fast/text/font-kerning.html: Added. 11 * platform/chromium-win/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: 12 * platform/chromium-win/svg/css/getComputedStyle-basic-expected.txt: 13 * platform/gtk/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: 14 * platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: 15 * platform/qt/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: 16 * svg/css/getComputedStyle-basic-expected.txt: 17 1 18 2012-01-10 Sheriff Bot <webkit.review.bot@gmail.com> 2 19 -
trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
r104625 r104678 149 149 -webkit-flex-flow: row nowrap; 150 150 -webkit-flex-wrap: nowrap; 151 -webkit-font-kerning: auto; 151 152 -webkit-font-smoothing: auto; 152 153 -webkit-highlight: none; -
trunk/LayoutTests/platform/chromium-win/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
r104642 r104678 148 148 -webkit-flex-flow: row nowrap 149 149 -webkit-flex-wrap: nowrap 150 -webkit-font-kerning: auto 150 151 -webkit-font-smoothing: auto 151 152 -webkit-highlight: none -
trunk/LayoutTests/platform/chromium-win/svg/css/getComputedStyle-basic-expected.txt
r104642 r104678 295 295 rect: style.getPropertyValue(-webkit-flex-wrap) : nowrap 296 296 rect: style.getPropertyCSSValue(-webkit-flex-wrap) : [object CSSPrimitiveValue] 297 rect: style.getPropertyValue(-webkit-font-kerning) : auto 298 rect: style.getPropertyCSSValue(-webkit-font-kerning) : [object CSSPrimitiveValue] 297 299 rect: style.getPropertyValue(-webkit-font-smoothing) : auto 298 300 rect: style.getPropertyCSSValue(-webkit-font-smoothing) : [object CSSPrimitiveValue] … … 803 805 g: style.getPropertyValue(-webkit-flex-wrap) : nowrap 804 806 g: style.getPropertyCSSValue(-webkit-flex-wrap) : [object CSSPrimitiveValue] 807 g: style.getPropertyValue(-webkit-font-kerning) : auto 808 g: style.getPropertyCSSValue(-webkit-font-kerning) : [object CSSPrimitiveValue] 805 809 g: style.getPropertyValue(-webkit-font-smoothing) : auto 806 810 g: style.getPropertyCSSValue(-webkit-font-smoothing) : [object CSSPrimitiveValue] -
trunk/LayoutTests/platform/gtk/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
r102897 r104678 148 148 -webkit-flex-flow: row nowrap 149 149 -webkit-flex-wrap: nowrap 150 -webkit-font-kerning: auto 150 151 -webkit-font-smoothing: auto 151 152 -webkit-highlight: none -
trunk/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
r104625 r104678 148 148 -webkit-flex-flow: row nowrap 149 149 -webkit-flex-wrap: nowrap 150 -webkit-font-kerning: auto 150 151 -webkit-font-smoothing: auto 151 152 -webkit-highlight: none -
trunk/LayoutTests/platform/qt/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
r104640 r104678 148 148 -webkit-flex-flow: row nowrap 149 149 -webkit-flex-wrap: nowrap 150 -webkit-font-kerning: auto 150 151 -webkit-font-smoothing: auto 151 152 -webkit-highlight: none -
trunk/Source/WebCore/ChangeLog
r104675 r104678 1 2012-01-11 Dan Bernstein <mitz@apple.com> 2 3 <rdar://problem/10674686> Implement the font-kerning CSS property 4 https://bugs.webkit.org/show_bug.cgi?id=76033 5 6 Reviewed by Darin Adler. 7 8 Tests: fast/text/font-kerning-expected.html 9 fast/text/font-kerning.html 10 11 * css/CSSComputedStyleDeclaration.cpp: 12 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Added code to handle 13 font-kerning. 14 * css/CSSParser.cpp: 15 (WebCore::CSSParser::parseValue): Ditto. 16 * css/CSSPrimitiveValueMappings.h: 17 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Added mapping from FontDescription::Kerning. 18 (WebCore::CSSPrimitiveValue::operator FontDescription::Kerning): Added mapping to 19 FontDescription::Kerning. 20 * css/CSSProperty.cpp: 21 (WebCore::CSSProperty::isInheritedProperty): Added font-kerning to the set of inherited 22 properties. 23 * css/CSSPropertyNames.in: Added -webkit-font-kerning. 24 * css/CSSStyleApplyProperty.cpp: 25 (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty): Added a handler for font-kerning. 26 * css/CSSStyleSelector.cpp: 27 (WebCore::CSSStyleSelector::applyDeclaration): Updated for the number of properties that 28 affect the font. 29 * platform/graphics/Font.h: 30 (WebCore::Font::typesettingFeatures): Changed to enable kerning if font-kerning is set to 31 normal, disable it if font-kerning is set to none, and leave it to the default (determined 32 by the text-rendering property) if font-kerning is set to auto. 33 * platform/graphics/FontDescription.h: 34 (WebCore::FontDescription::FontDescription): Added a Kerning enum. 35 (WebCore::FontDescription::kerning): Added this getter. 36 (WebCore::FontDescription::setKerning): Added this setter. 37 (WebCore::FontDescription::operator==): Updated to compare the m_kerning member. 38 1 39 2012-01-10 Ryosuke Niwa <rniwa@webkit.org> 2 40 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r104625 r104678 222 222 CSSPropertyWebkitFlexFlow, 223 223 CSSPropertyWebkitFlexWrap, 224 CSSPropertyWebkitFontKerning, 224 225 CSSPropertyWebkitFontSmoothing, 225 226 #if ENABLE(CSS_GRID_LAYOUT) … … 1867 1868 case CSSPropertyResize: 1868 1869 return cssValuePool->createValue(style->resize()); 1870 case CSSPropertyWebkitFontKerning: 1871 return cssValuePool->createValue(style->fontDescription().kerning()); 1869 1872 case CSSPropertyWebkitFontSmoothing: 1870 1873 return cssValuePool->createValue(style->fontDescription().fontSmoothing()); -
trunk/Source/WebCore/css/CSSParser.cpp
r104625 r104678 2227 2227 else 2228 2228 return parseFontFeatureSettings(important); 2229 break; 2230 2231 case CSSPropertyWebkitFontKerning: 2232 if (id == CSSValueAuto || id == CSSValueNormal || id == CSSValueNone) 2233 validPrimitive = true; 2229 2234 break; 2230 2235 -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r104625 r104678 2827 2827 } 2828 2828 2829 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontDescription::Kerning kerning) 2830 : CSSValue(PrimitiveClass) 2831 { 2832 m_primitiveUnitType = CSS_IDENT; 2833 switch (kerning) { 2834 case FontDescription::AutoKerning: 2835 m_value.ident = CSSValueAuto; 2836 return; 2837 case FontDescription::NormalKerning: 2838 m_value.ident = CSSValueNormal; 2839 return; 2840 case FontDescription::NoneKerning: 2841 m_value.ident = CSSValueNone; 2842 return; 2843 } 2844 2845 ASSERT_NOT_REACHED(); 2846 m_value.ident = CSSValueAuto; 2847 } 2848 2849 template<> inline CSSPrimitiveValue::operator FontDescription::Kerning() const 2850 { 2851 switch (m_value.ident) { 2852 case CSSValueAuto: 2853 return FontDescription::AutoKerning; 2854 case CSSValueNormal: 2855 return FontDescription::NormalKerning; 2856 case CSSValueNone: 2857 return FontDescription::NoneKerning; 2858 } 2859 2860 ASSERT_NOT_REACHED(); 2861 return FontDescription::AutoKerning; 2862 } 2863 2829 2864 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmoothingMode smoothing) 2830 2865 : CSSValue(PrimitiveClass) -
trunk/Source/WebCore/css/CSSProperty.cpp
r104625 r104678 319 319 case CSSPropertyWebkitColorCorrection: 320 320 case CSSPropertyWebkitFontFeatureSettings: 321 case CSSPropertyWebkitFontKerning: 321 322 case CSSPropertyWebkitFontSmoothing: 322 323 case CSSPropertyWebkitLocale: -
trunk/Source/WebCore/css/CSSPropertyNames.in
r104625 r104678 22 22 text-rendering 23 23 -webkit-font-feature-settings 24 -webkit-font-kerning 24 25 -webkit-font-smoothing 25 26 -webkit-locale -
trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp
r104625 r104678 1682 1682 setPropertyHandler(CSSPropertyFontVariant, ApplyPropertyFont<FontSmallCaps, &FontDescription::smallCaps, &FontDescription::setSmallCaps, FontSmallCapsOff>::createHandler()); 1683 1683 setPropertyHandler(CSSPropertyTextRendering, ApplyPropertyFont<TextRenderingMode, &FontDescription::textRenderingMode, &FontDescription::setTextRenderingMode, AutoTextRendering>::createHandler()); 1684 setPropertyHandler(CSSPropertyWebkitFontKerning, ApplyPropertyFont<FontDescription::Kerning, &FontDescription::kerning, &FontDescription::setKerning, FontDescription::AutoKerning>::createHandler()); 1684 1685 setPropertyHandler(CSSPropertyWebkitFontSmoothing, ApplyPropertyFont<FontSmoothingMode, &FontDescription::fontSmoothing, &FontDescription::setFontSmoothing, AutoSmoothing>::createHandler()); 1685 1686 setPropertyHandler(CSSPropertyWebkitTextOrientation, ApplyPropertyFont<TextOrientation, &FontDescription::textOrientation, &FontDescription::setTextOrientation, TextOrientationVerticalRight>::createHandler()); -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r104625 r104678 2228 2228 if (applyFirst) { 2229 2229 COMPILE_ASSERT(firstCSSProperty == CSSPropertyColor, CSS_color_is_first_property); 2230 COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 1 6, CSS_zoom_is_end_of_first_prop_range);2230 COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 17, CSS_zoom_is_end_of_first_prop_range); 2231 2231 COMPILE_ASSERT(CSSPropertyLineHeight == CSSPropertyZoom + 1, CSS_line_height_is_after_zoom); 2232 2232 // give special priority to font-xxx, color properties, etc -
trunk/Source/WebCore/platform/graphics/Font.h
r95394 r104678 117 117 { 118 118 TextRenderingMode textRenderingMode = m_fontDescription.textRenderingMode(); 119 return textRenderingMode == OptimizeLegibility || textRenderingMode == GeometricPrecision ? Kerning | Ligatures : 0; 119 TypesettingFeatures features = textRenderingMode == OptimizeLegibility || textRenderingMode == GeometricPrecision ? Kerning | Ligatures : 0; 120 121 switch (m_fontDescription.kerning()) { 122 case FontDescription::NoneKerning: 123 features &= ~Kerning; 124 break; 125 case FontDescription::NormalKerning: 126 features |= Kerning; 127 break; 128 case FontDescription::AutoKerning: 129 break; 130 } 131 132 return features; 120 133 } 121 134 -
trunk/Source/WebCore/platform/graphics/FontDescription.h
r96705 r104678 72 72 enum GenericFamilyType { NoFamily, StandardFamily, SerifFamily, SansSerifFamily, 73 73 MonospaceFamily, CursiveFamily, FantasyFamily, PictographFamily }; 74 75 enum Kerning { AutoKerning, NormalKerning, NoneKerning }; 74 76 75 77 FontDescription() … … 86 88 , m_usePrinterFont(false) 87 89 , m_renderingMode(NormalRenderingMode) 90 , m_kerning(AutoKerning) 88 91 , m_keywordSize(0) 89 92 , m_fontSmoothing(AutoSmoothing) … … 113 116 bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily && !family().next() && family().family() == monospaceFamily; } 114 117 FontRenderingMode renderingMode() const { return static_cast<FontRenderingMode>(m_renderingMode); } 118 Kerning kerning() const { return static_cast<Kerning>(m_kerning); } 115 119 unsigned keywordSize() const { return m_keywordSize; } 116 120 FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMode>(m_fontSmoothing); } … … 142 146 #endif 143 147 void setRenderingMode(FontRenderingMode mode) { m_renderingMode = mode; } 148 void setKerning(Kerning kerning) { m_kerning = kerning; } 144 149 void setKeywordSize(unsigned s) { m_keywordSize = s; } 145 150 void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoothing; } … … 174 179 175 180 unsigned m_renderingMode : 1; // Used to switch between CG and GDI text on Windows. 181 unsigned m_kerning : 2; // Kerning 176 182 177 183 unsigned m_keywordSize : 4; // We cache whether or not a font is currently represented by a CSS keyword (e.g., medium). If so, … … 197 203 && m_usePrinterFont == other.m_usePrinterFont 198 204 && m_renderingMode == other.m_renderingMode 205 && m_kerning == other.m_kerning 199 206 && m_keywordSize == other.m_keywordSize 200 207 && m_fontSmoothing == other.m_fontSmoothing
Note:
See TracChangeset
for help on using the changeset viewer.