Diff
Modified: trunk/LayoutTests/ChangeLog (179099 => 179100)
--- trunk/LayoutTests/ChangeLog 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/LayoutTests/ChangeLog 2015-01-26 02:11:14 UTC (rev 179100)
@@ -1,3 +1,30 @@
+2015-01-25 Chris Dumez <[email protected]>
+
+ Remove 'font' shorthand property special casing
+ https://bugs.webkit.org/show_bug.cgi?id=140577
+
+ Reviewed by Darin Adler.
+
+ * fast/css/CSSPrimitiveValue-font-family-primitiveType-expected.txt: Added.
+ * fast/css/CSSPrimitiveValue-font-family-primitiveType.html: Added.
+ Add layout test to make sure that the font-family is still exposed to the
+ Web as a CSSValueList of CSSPrimitiveValues whose primitiveType is
+ CSS_STRING. This is useful because we now use a slightly different
+ representation internally.
+
+ * fast/css/font-shorthand-line-height-expected.txt:
+ * fast/css/font-shorthand-line-height.html:
+ Rebaseline the test. This is a progression. Setting the 'font' property
+ to a system font ID is supposed to reset the line-height property to
+ 'normal'. It previously did not because system font IDs were not
+ expanded at parsing time. The new behavior is consistent with Chrome and
+ Firefox as well.
+
+ * fast/css/font-systemFontID-parsing-expected.txt: Added.
+ * fast/css/font-systemFontID-parsing.html: Added.
+ Add a layout test to make sure that the CSS parser is rejecting a 'font'
+ property with more than one system font id.
+
2015-01-25 Brent Fulgham <[email protected]>
[Win] Unreviewed gardening.
Added: trunk/LayoutTests/fast/css/CSSPrimitiveValue-font-family-primitiveType-expected.txt (0 => 179100)
--- trunk/LayoutTests/fast/css/CSSPrimitiveValue-font-family-primitiveType-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/CSSPrimitiveValue-font-family-primitiveType-expected.txt 2015-01-26 02:11:14 UTC (rev 179100)
@@ -0,0 +1,20 @@
+Test that the font-family CSSValue is a CSSValueList of CSSPrimitiveValues that are of primitive type CSS_STRING.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS fontFamilyCSSValue.__proto__ is CSSValueList.prototype
+PASS fontFamilyCSSValue.length is 3
+PASS fontFamilyCSSValue[0].__proto__ is CSSPrimitiveValue.prototype
+PASS fontFamilyCSSValue[0].primitiveType is CSSPrimitiveValue.CSS_STRING
+PASS fontFamilyCSSValue[0].getStringValue() is "times"
+PASS fontFamilyCSSValue[1].__proto__ is CSSPrimitiveValue.prototype
+PASS fontFamilyCSSValue[1].primitiveType is CSSPrimitiveValue.CSS_STRING
+PASS fontFamilyCSSValue[1].getStringValue() is "courier"
+PASS fontFamilyCSSValue[2].__proto__ is CSSPrimitiveValue.prototype
+PASS fontFamilyCSSValue[2].primitiveType is CSSPrimitiveValue.CSS_STRING
+PASS fontFamilyCSSValue[2].getStringValue() is "arial"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/css/CSSPrimitiveValue-font-family-primitiveType.html (0 => 179100)
--- trunk/LayoutTests/fast/css/CSSPrimitiveValue-font-family-primitiveType.html (rev 0)
+++ trunk/LayoutTests/fast/css/CSSPrimitiveValue-font-family-primitiveType.html 2015-01-26 02:11:14 UTC (rev 179100)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<div id="testDiv" style="font-family: times, courier, arial">
+<script>
+description("Test that the font-family CSSValue is a CSSValueList of CSSPrimitiveValues that are of primitive type CSS_STRING.");
+
+var testDiv = document.getElementById("testDiv");
+var fontFamilyCSSValue = testDiv.style.getPropertyCSSValue('font-family');
+
+shouldBe("fontFamilyCSSValue.__proto__", "CSSValueList.prototype");
+shouldBe("fontFamilyCSSValue.length", "3");
+
+shouldBe("fontFamilyCSSValue[0].__proto__", "CSSPrimitiveValue.prototype");
+shouldBe("fontFamilyCSSValue[0].primitiveType", "CSSPrimitiveValue.CSS_STRING");
+shouldBeEqualToString("fontFamilyCSSValue[0].getStringValue()", "times");
+
+shouldBe("fontFamilyCSSValue[1].__proto__", "CSSPrimitiveValue.prototype");
+shouldBe("fontFamilyCSSValue[1].primitiveType", "CSSPrimitiveValue.CSS_STRING");
+shouldBeEqualToString("fontFamilyCSSValue[1].getStringValue()", "courier");
+
+shouldBe("fontFamilyCSSValue[2].__proto__", "CSSPrimitiveValue.prototype");
+shouldBe("fontFamilyCSSValue[2].primitiveType", "CSSPrimitiveValue.CSS_STRING");
+shouldBeEqualToString("fontFamilyCSSValue[2].getStringValue()", "arial");
+
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/fast/css/font-shorthand-line-height-expected.txt (179099 => 179100)
--- trunk/LayoutTests/fast/css/font-shorthand-line-height-expected.txt 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/LayoutTests/fast/css/font-shorthand-line-height-expected.txt 2015-01-26 02:11:14 UTC (rev 179100)
@@ -4,7 +4,7 @@
PASS lineHeight(system_font_1) is '100px'
-PASS lineHeight(system_font_2) is '100px'
+PASS lineHeight(system_font_2) is 'normal'
PASS lineHeight(shorthand_normal_1) is '100px'
PASS lineHeight(shorthand_normal_2) is 'normal'
PASS lineHeight(shorthand_line_height_1) is '100px'
Modified: trunk/LayoutTests/fast/css/font-shorthand-line-height.html (179099 => 179100)
--- trunk/LayoutTests/fast/css/font-shorthand-line-height.html 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/LayoutTests/fast/css/font-shorthand-line-height.html 2015-01-26 02:11:14 UTC (rev 179100)
@@ -24,7 +24,7 @@
}
shouldBe("lineHeight(system_font_1)", "'100px'");
- shouldBe("lineHeight(system_font_2)", "'100px'");
+ shouldBe("lineHeight(system_font_2)", "'normal'");
shouldBe("lineHeight(shorthand_normal_1)", "'100px'");
shouldBe("lineHeight(shorthand_normal_2)", "'normal'");
shouldBe("lineHeight(shorthand_line_height_1)", "'100px'");
Added: trunk/LayoutTests/fast/css/font-systemFontID-parsing-expected.txt (0 => 179100)
--- trunk/LayoutTests/fast/css/font-systemFontID-parsing-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/font-systemFontID-parsing-expected.txt 2015-01-26 02:11:14 UTC (rev 179100)
@@ -0,0 +1,11 @@
+Tests 'font' CSS property parsing with system font values.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testDivInvalid.style.getPropertyCSSValue('font-family') is null
+PASS testDivValid.style.getPropertyCSSValue('font-family') is not null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/css/font-systemFontID-parsing.html (0 => 179100)
--- trunk/LayoutTests/fast/css/font-systemFontID-parsing.html (rev 0)
+++ trunk/LayoutTests/fast/css/font-systemFontID-parsing.html 2015-01-26 02:11:14 UTC (rev 179100)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<div id="testDivInvalid" style="font: caption icon"></div>
+<div id="testDivValid" style="font: caption"></div>
+<script>
+description("Tests 'font' CSS property parsing with system font values.");
+
+shouldBeNull("testDivInvalid.style.getPropertyCSSValue('font-family')");
+shouldNotBe("testDivValid.style.getPropertyCSSValue('font-family')", "null");
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (179099 => 179100)
--- trunk/Source/WebCore/ChangeLog 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/ChangeLog 2015-01-26 02:11:14 UTC (rev 179100)
@@ -1,3 +1,129 @@
+2015-01-25 Chris Dumez <[email protected]>
+
+ Remove 'font' shorthand property special casing
+ https://bugs.webkit.org/show_bug.cgi?id=140577
+
+ Reviewed by Darin Adler.
+
+ Expand system font values during 'font' property parsing. The 'font'
+ CSS property was the only shorthand that wasn't always expanded in
+ the CSS parser, so it needed a lot of special handling that we can
+ now get rid of.
+
+ This patch is inspired from the following Blink revision:
+ https://src.chromium.org/viewvc/blink?view=rev&revision=184449
+
+ Tests:
+ - fast/css/css2-system-fonts.html (existing)
+ - fast/css/CSSPrimitiveValue-font-family-primitiveType.html (new)
+ - fast/css/font-systemFontID-parsing.html (new)
+ - fast/css/font-shorthand-line-height.html (rebased)
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/CSSCalculationValue.cpp:
+ (WebCore::hasDoubleValue):
+ Handle CSS_FONT_FAMILY similarly to CSS_STRING in the switch.
+
+ * css/CSSFontFamily.h: Added.
+ Introduce new CSSFontFamily class to store font families inside
+ CSSPrimitive, instead of using a simple String as previously. We need
+ an additional 'fromSystemFontID' flag in addition to the font family
+ name now that system font ID are expanded during parsing. This
+ information is needed later on by the StyleBuilder (see comment below).
+
+ * css/CSSFontSelector.cpp:
+ (WebCore::CSSFontSelector::addFontFaceRule):
+ Update code dealing with font family CSSPrimitiveValues now that they
+ hold a CSSFontFamily internally instead of a String.
+
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseValue):
+ (WebCore::CSSParser::parseSystemFont):
+ Expand system font values for the 'font' property by asking the
+ RenderTheme for the system font and using it to set the 'font'
+ longhand properties.
+
+ * css/CSSParserValues.cpp:
+ (WebCore::CSSParserValue::createCSSValue):
+ Handle CSS_FONT_FAMILY value in the switch.
+
+ * css/CSSPrimitiveValue.cpp:
+ (WebCore::CSSPrimitiveValue::primitiveType):
+ Make sure we still expose font family CSSPrimitiveValues to the Web as
+ CSS_STRING, even though we are using a slightly different representation
+ internally. This is so that we don't change web-exposed behavior and I
+ added a new layout test to cover this.
+
+ (WebCore::isValidCSSUnitTypeForDoubleConversion):
+ (WebCore::CSSPrimitiveValue::cleanup):
+ (WebCore::CSSPrimitiveValue::getStringValue):
+ (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText):
+ (WebCore::CSSPrimitiveValue::cloneForCSSOM):
+ (WebCore::CSSPrimitiveValue::equals):
+ Handle CSS_FONT_FAMILY type in switches.
+
+ * css/CSSPrimitiveValue.h:
+ (WebCore::CSSPrimitiveValue::isFontFamily):
+ Add method to test if a CSSPrimitiveValue holds a CSSFontFamily
+ internally.
+
+ (WebCore::CSSPrimitiveValue::fontFamily):
+ Add a getter to retrieve the internal CSSFontFamily object if the
+ primitive type is CSS_FONT_FAMILY.
+
+ * css/CSSPropertyNames.in:
+ Treat 'font' as a regular shorthand property. Specify its longhand
+ properties so that makeprop.pl can generate the shorthand code for
+ us. Also demote 'font' to being a low-priority property as it is
+ now always expanded during parsing.
+
+ * css/CSSValuePool.cpp:
+ (WebCore::CSSValuePool::createFontFamilyValue):
+ * css/CSSValuePool.h:
+ * css/StyleBuilderCustom.h:
+ (WebCore::StyleBuilderCustom::applyValueFontFamily):
+ - Update the 'font-family' value setter in the StyleBuilder to reflect
+ the changes in the CSS parser. The CSSPrimitiveValues in the list now
+ have CSS_FONT_FAMILY type instead of CSS_STRING.
+ - We also set the 'isGenericFamily' flag if the font-family was expanded
+ from a system font ID (e.g. caption). The 'isGenericFamily' flag is
+ used later on to property set the 'isSpecifiedFont' flag on the
+ FontDescription object. If we don't do this, system font values will
+ be treated as specified fonts, which means that we will no longer use
+ the 'use backslash as Yen sign' hack for those. This is covered by the
+ following layout tests:
+ - fast/text/backslash-to-yen-sign-euc.html
+ - editing/selection/find-yensign-and-backslash.html
+
+ (WebCore::StyleBuilderCustom::applyInitialFont): Deleted.
+ (WebCore::StyleBuilderCustom::applyInheritFont): Deleted.
+ (WebCore::StyleBuilderCustom::applyValueFont): Deleted.
+ Remove StyleBuilder code dealing with the 'font' property. Now that
+ the 'font' property is always expanded during parsing, this code can
+ never be reached.
+
+ * css/StylePropertyShorthand.cpp:
+ (WebCore::isExpandedShorthand):
+ Stop returning false for 'font' as it is now expanded during parsing
+ as well. We should probably consider renaming this method to something
+ else now that all shorthands are expanded, maybe isCSSShorthand() or
+ isShorthandProperty().
+
+ (WebCore::fontShorthand): Deleted.
+ * css/StylePropertyShorthand.h:
+ (WebCore::matchingCustomShorthandsForLonghand): Deleted.
+ Remove custom shorthand code for the 'font' property as it is now
+ generated by makeprop.pl, like other shorthands.
+
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::applyFont): Deleted.
+ This is unused now that the StyleBuilder code for 'font' has been
+ removed.
+
+ * css/makeprop.pl:
+ Remove custom shorthand code for 'font' as it no longer requires any
+ special handling.
+
2015-01-25 Timothy Horton <[email protected]>
Long spins under Frame::rangeForPoint when doing Lookup on feedly.com
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (179099 => 179100)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-01-26 02:11:14 UTC (rev 179100)
@@ -2562,6 +2562,7 @@
82E3D8DF122EA0D1003AE5BC /* CSSPropertySourceData.h in Headers */ = {isa = PBXBuildFile; fileRef = 82E3D8DD122EA0D1003AE5BC /* CSSPropertySourceData.h */; settings = {ATTRIBUTES = (Private, ); }; };
832B843419D8E55100B26055 /* SVGAnimateElementBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 832B843319D8E55100B26055 /* SVGAnimateElementBase.h */; };
832B843619D8E57400B26055 /* SVGAnimateElementBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 832B843519D8E57400B26055 /* SVGAnimateElementBase.cpp */; };
+ 83520C7E1A71BFCC006BD2AA /* CSSFontFamily.h in Headers */ = {isa = PBXBuildFile; fileRef = 83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */; };
835D363719FF6193004C93AB /* StyleBuilderCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 835D363619FF6193004C93AB /* StyleBuilderCustom.h */; };
836FBCEA178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836FBCE9178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp */; };
836FBCEC178C117F00B21A15 /* SVGAnimatedProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836FBCEB178C117F00B21A15 /* SVGAnimatedProperty.cpp */; };
@@ -9758,6 +9759,7 @@
82E3D8DD122EA0D1003AE5BC /* CSSPropertySourceData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSPropertySourceData.h; sourceTree = "<group>"; };
832B843319D8E55100B26055 /* SVGAnimateElementBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimateElementBase.h; sourceTree = "<group>"; };
832B843519D8E57400B26055 /* SVGAnimateElementBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimateElementBase.cpp; sourceTree = "<group>"; };
+ 83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFontFamily.h; sourceTree = "<group>"; };
835D363619FF6193004C93AB /* StyleBuilderCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderCustom.h; sourceTree = "<group>"; };
836FBCE9178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedTypeAnimator.cpp; sourceTree = "<group>"; };
836FBCEB178C117F00B21A15 /* SVGAnimatedProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedProperty.cpp; sourceTree = "<group>"; };
@@ -22055,6 +22057,7 @@
F523D18402DE42E8018635CA /* css */ = {
isa = PBXGroup;
children = (
+ 83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */,
FBD6AF8415EF21D4008B7110 /* BasicShapeFunctions.cpp */,
FBD6AF8515EF21D4008B7110 /* BasicShapeFunctions.h */,
A80E6CDA0A1989CA007FB8C5 /* Counter.h */,
@@ -23543,6 +23546,7 @@
F59C96001255B23F000623C0 /* BaseDateAndTimeInputType.h in Headers */,
F55B3DAE1251F12D003EF269 /* BaseTextInputType.h in Headers */,
FBD6AF8A15EF25DF008B7110 /* BasicShapeFunctions.h in Headers */,
+ 83520C7E1A71BFCC006BD2AA /* CSSFontFamily.h in Headers */,
FBD6AF8C15EF2604008B7110 /* BasicShapes.h in Headers */,
BC9462D8107A7B4C00857193 /* BeforeLoadEvent.h in Headers */,
AB23A32809BBA7D00067CC53 /* BeforeTextInsertedEvent.h in Headers */,
Modified: trunk/Source/WebCore/css/CSSCalculationValue.cpp (179099 => 179100)
--- trunk/Source/WebCore/css/CSSCalculationValue.cpp 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/css/CSSCalculationValue.cpp 2015-01-26 02:11:14 UTC (rev 179100)
@@ -125,6 +125,7 @@
return true;
case CSSPrimitiveValue::CSS_UNKNOWN:
case CSSPrimitiveValue::CSS_STRING:
+ case CSSPrimitiveValue::CSS_FONT_FAMILY:
case CSSPrimitiveValue::CSS_URI:
case CSSPrimitiveValue::CSS_IDENT:
case CSSPrimitiveValue::CSS_ATTR:
Added: trunk/Source/WebCore/css/CSSFontFamily.h (0 => 179100)
--- trunk/Source/WebCore/css/CSSFontFamily.h (rev 0)
+++ trunk/Source/WebCore/css/CSSFontFamily.h 2015-01-26 02:11:14 UTC (rev 179100)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSFontFamily_h
+#define CSSFontFamily_h
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+// We use a CSSFontFamily instead of a String to store the font family inside CSSPrimitiveValue.
+// This is because require an extra bit to determine if the font family was resolved by the CSS
+// parser from a system font ID (caption | icon | menu | message-box | small-caption |
+// status-bar).
+//
+// This is needed by the StyleBuilder to correctly set the "isSpecifiedFont" flag on the
+// FontDescription. This flag is used to determine if we should do the "use backslash as Yen
+// sign" hack.
+
+enum FromSystemFontIDOrNot { NotFromSystemFontID, FromSystemFontID };
+
+struct CSSFontFamily {
+ String familyName;
+ FromSystemFontIDOrNot fromSystemFontID;
+};
+
+inline bool operator==(const CSSFontFamily& a, const CSSFontFamily& b)
+{
+ return a.familyName == b.familyName && a.fromSystemFontID == b.fromSystemFontID;
+}
+
+} // namespace WebCore
+
+#endif // CSSFontFamily_h
+
Modified: trunk/Source/WebCore/css/CSSFontSelector.cpp (179099 => 179100)
--- trunk/Source/WebCore/css/CSSFontSelector.cpp 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/css/CSSFontSelector.cpp 2015-01-26 02:11:14 UTC (rev 179100)
@@ -32,6 +32,7 @@
#include "CSSFontFaceRule.h"
#include "CSSFontFaceSource.h"
#include "CSSFontFaceSrcValue.h"
+#include "CSSFontFamily.h"
#include "CSSPrimitiveValue.h"
#include "CSSPropertyNames.h"
#include "CSSSegmentedFontFace.h"
@@ -256,16 +257,15 @@
}
// Hash under every single family name.
- int familyLength = familyList.length();
- for (int i = 0; i < familyLength; i++) {
- CSSPrimitiveValue* item = downcast<CSSPrimitiveValue>(familyList.itemWithoutBoundsCheck(i));
+ for (auto& item : familyList) {
+ auto& value = downcast<CSSPrimitiveValue>(item.get());
String familyName;
- if (item->isString()) {
- familyName = item->getStringValue();
- } else if (item->isValueID()) {
+ if (value.isFontFamily()) {
+ familyName = value.fontFamily().familyName;
+ } else if (value.isValueID()) {
// We need to use the raw text for all the generic family types, since @font-face is a way of actually
// defining what font to use for those types.
- switch (item->getValueID()) {
+ switch (value.getValueID()) {
case CSSValueSerif:
familyName = serifFamily;
break;
Modified: trunk/Source/WebCore/css/CSSParser.cpp (179099 => 179100)
--- trunk/Source/WebCore/css/CSSParser.cpp 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/css/CSSParser.cpp 2015-01-26 02:11:14 UTC (rev 179100)
@@ -1,12 +1,13 @@
/*
* Copyright (C) 2003 Lars Knoll ([email protected])
* Copyright (C) 2005 Allan Sandfeld Jensen ([email protected])
- * Copyright (C) 2004-2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2015 Apple Inc. All rights reserved.
* Copyright (C) 2007 Nicholas Shanks <[email protected]>
* Copyright (C) 2008 Eric Seidel <[email protected]>
* Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
* Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved.
* Copyright (C) 2012 Intel Corporation. All rights reserved.
+ * Copyright (C) 2014 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -49,6 +50,7 @@
#include "CSSMediaRule.h"
#include "CSSPageRule.h"
#include "CSSPrimitiveValue.h"
+#include "CSSPrimitiveValueMappings.h"
#include "CSSPropertySourceData.h"
#include "CSSReflectValue.h"
#include "CSSSelector.h"
@@ -2891,11 +2893,11 @@
case CSSPropertyFont:
// [ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-height' ]?
// 'font-family' ] | caption | icon | menu | message-box | small-caption | status-bar | inherit
- if (id >= CSSValueCaption && id <= CSSValueStatusBar)
- validPrimitive = true;
- else
- return parseFont(important);
- break;
+ if (num == 1 && id >= CSSValueCaption && id <= CSSValueStatusBar) {
+ parseSystemFont(important);
+ return true;
+ }
+ return parseFont(important);
case CSSPropertyListStyle:
return parseShorthand(propId, listStyleShorthand(), important);
case CSSPropertyColumns:
@@ -6269,6 +6271,29 @@
return true;
}
+void CSSParser::parseSystemFont(bool important)
+{
+ ASSERT(m_valueList->size() == 1);
+ CSSValueID systemFontID = m_valueList->valueAt(0)->id;
+ ASSERT(systemFontID >= CSSValueCaption && systemFontID <= CSSValueStatusBar);
+ m_valueList->next();
+
+ FontDescription fontDescription;
+ RenderTheme::defaultTheme()->systemFont(systemFontID, fontDescription);
+ if (!fontDescription.isAbsoluteSize())
+ return;
+
+ ShorthandScope scope(this, CSSPropertyFont);
+ addProperty(CSSPropertyFontStyle, cssValuePool().createIdentifierValue(fontDescription.italic() == FontItalicOn ? CSSValueItalic : CSSValueNormal), important);
+ addProperty(CSSPropertyFontWeight, cssValuePool().createValue(fontDescription.weight()), important);
+ addProperty(CSSPropertyFontSize, cssValuePool().createValue(fontDescription.specifiedSize(), CSSPrimitiveValue::CSS_PX), important);
+ Ref<CSSValueList> fontFamilyList = CSSValueList::createCommaSeparated();
+ fontFamilyList->append(cssValuePool().createFontFamilyValue(fontDescription.familyAt(0), FromSystemFontID));
+ addProperty(CSSPropertyFontFamily, WTF::move(fontFamilyList), important);
+ addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierValue(CSSValueNormal), important);
+ addProperty(CSSPropertyLineHeight, cssValuePool().createIdentifierValue(CSSValueNormal), important);
+}
+
class FontFamilyValueBuilder {
public:
FontFamilyValueBuilder(CSSValueList& list)
Modified: trunk/Source/WebCore/css/CSSParser.h (179099 => 179100)
--- trunk/Source/WebCore/css/CSSParser.h 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/css/CSSParser.h 2015-01-26 02:11:14 UTC (rev 179100)
@@ -215,6 +215,7 @@
PassRefPtr<CSSBasicShape> parseBasicShapeInset(CSSParserValueList&);
bool parseFont(bool important);
+ void parseSystemFont(bool important);
PassRefPtr<CSSValueList> parseFontFamily();
bool parseCounter(CSSPropertyID, int defaultValue, bool important);
Modified: trunk/Source/WebCore/css/CSSParserValues.cpp (179099 => 179100)
--- trunk/Source/WebCore/css/CSSParserValues.cpp 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/css/CSSParserValues.cpp 2015-01-26 02:11:14 UTC (rev 179100)
@@ -140,6 +140,7 @@
case CSSPrimitiveValue::CSS_PARSER_IDENTIFIER:
case CSSPrimitiveValue::CSS_COUNTER_NAME:
case CSSPrimitiveValue::CSS_SHAPE:
+ case CSSPrimitiveValue::CSS_FONT_FAMILY:
case CSSPrimitiveValue::CSS_QUAD:
#if ENABLE(CSS_SCROLL_SNAP)
case CSSPrimitiveValue::CSS_LENGTH_REPEAT:
Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (179099 => 179100)
--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp 2015-01-26 02:11:14 UTC (rev 179100)
@@ -23,8 +23,10 @@
#include "CSSBasicShapes.h"
#include "CSSCalculationValue.h"
+#include "CSSFontFamily.h"
#include "CSSHelper.h"
#include "CSSParser.h"
+#include "CSSPrimitiveValueMappings.h"
#include "CSSPropertyNames.h"
#include "CSSToLengthConversionData.h"
#include "CSSValueKeywords.h"
@@ -123,6 +125,7 @@
case CSSPrimitiveValue::CSS_RGBCOLOR:
case CSSPrimitiveValue::CSS_SHAPE:
case CSSPrimitiveValue::CSS_STRING:
+ case CSSPrimitiveValue::CSS_FONT_FAMILY:
case CSSPrimitiveValue::CSS_UNICODE_RANGE:
case CSSPrimitiveValue::CSS_UNKNOWN:
case CSSPrimitiveValue::CSS_URI:
@@ -183,6 +186,11 @@
if (m_primitiveUnitType == CSS_PROPERTY_ID || m_primitiveUnitType == CSS_VALUE_ID)
return CSS_IDENT;
+ // Web-exposed content expects font family values to have CSS_STRING primitive type
+ // so we need to map our internal CSS_FONT_FAMILY type here.
+ if (m_primitiveUnitType == CSS_FONT_FAMILY)
+ return CSS_STRING;
+
if (m_primitiveUnitType != CSSPrimitiveValue::CSS_CALC)
return m_primitiveUnitType;
@@ -485,6 +493,11 @@
case CSS_SHAPE:
m_value.shape->deref();
break;
+ case CSS_FONT_FAMILY:
+ ASSERT(m_value.fontFamily);
+ delete m_value.fontFamily;
+ m_value.fontFamily = nullptr;
+ break;
case CSS_NUMBER:
case CSS_PARSER_INTEGER:
case CSS_PERCENTAGE:
@@ -844,6 +857,8 @@
case CSS_ATTR:
case CSS_URI:
return m_value.string;
+ case CSS_FONT_FAMILY:
+ return m_value.fontFamily->familyName;
case CSS_VALUE_ID:
return valueName(m_value.valueID);
case CSS_PROPERTY_ID:
@@ -863,6 +878,8 @@
case CSS_ATTR:
case CSS_URI:
return m_value.string;
+ case CSS_FONT_FAMILY:
+ return m_value.fontFamily->familyName;
case CSS_VALUE_ID:
return valueName(m_value.valueID);
case CSS_PROPERTY_ID:
@@ -1026,6 +1043,8 @@
// the actual dimension, just the numeric value as a string.
case CSS_STRING:
return quoteCSSStringIfNeeded(m_value.string);
+ case CSS_FONT_FAMILY:
+ return quoteCSSStringIfNeeded(m_value.fontFamily->familyName);
case CSS_URI:
return "url(" + quoteCSSURLIfNeeded(m_value.string) + ')';
case CSS_VALUE_ID:
@@ -1203,6 +1222,9 @@
case CSS_COUNTER_NAME:
result = CSSPrimitiveValue::create(m_value.string, static_cast<UnitTypes>(m_primitiveUnitType));
break;
+ case CSS_FONT_FAMILY:
+ result = CSSPrimitiveValue::create(*m_value.fontFamily);
+ break;
case CSS_COUNTER:
result = CSSPrimitiveValue::create(m_value.counter->cloneForCSSOM());
break;
@@ -1365,6 +1387,8 @@
return m_value.calc && other.m_value.calc && m_value.calc->equals(*other.m_value.calc);
case CSS_SHAPE:
return m_value.shape && other.m_value.shape && m_value.shape->equals(*other.m_value.shape);
+ case CSS_FONT_FAMILY:
+ return fontFamily() == other.fontFamily();
}
return false;
}
Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.h (179099 => 179100)
--- trunk/Source/WebCore/css/CSSPrimitiveValue.h 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.h 2015-01-26 02:11:14 UTC (rev 179100)
@@ -48,6 +48,7 @@
class LengthRepeat;
#endif
+struct CSSFontFamily;
struct Length;
struct LengthSize;
@@ -149,6 +150,8 @@
CSS_CALC_PERCENTAGE_WITH_NUMBER = 114,
CSS_CALC_PERCENTAGE_WITH_LENGTH = 115,
+ CSS_FONT_FAMILY = 116,
+
CSS_PROPERTY_ID = 117,
CSS_VALUE_ID = 118
};
@@ -200,6 +203,7 @@
bool isRGBColor() const { return m_primitiveUnitType == CSS_RGBCOLOR; }
bool isShape() const { return m_primitiveUnitType == CSS_SHAPE; }
bool isString() const { return m_primitiveUnitType == CSS_STRING; }
+ bool isFontFamily() const { return m_primitiveUnitType == CSS_FONT_FAMILY; }
bool isTime() const { return m_primitiveUnitType == CSS_S || m_primitiveUnitType == CSS_MS; }
bool isURI() const { return m_primitiveUnitType == CSS_URI; }
bool isCalculated() const { return m_primitiveUnitType == CSS_CALC; }
@@ -333,16 +337,18 @@
RGBA32 getRGBA32Value() const { return m_primitiveUnitType != CSS_RGBCOLOR ? 0 : m_value.rgbcolor; }
Pair* getPairValue(ExceptionCode&) const;
- Pair* getPairValue() const { return m_primitiveUnitType != CSS_PAIR ? 0 : m_value.pair; }
+ Pair* getPairValue() const { return m_primitiveUnitType != CSS_PAIR ? nullptr : m_value.pair; }
#if ENABLE(DASHBOARD_SUPPORT)
- DashboardRegion* getDashboardRegionValue() const { return m_primitiveUnitType != CSS_DASHBOARD_REGION ? 0 : m_value.region; }
+ DashboardRegion* getDashboardRegionValue() const { return m_primitiveUnitType != CSS_DASHBOARD_REGION ? nullptr : m_value.region; }
#endif
- CSSBasicShape* getShapeValue() const { return m_primitiveUnitType != CSS_SHAPE ? 0 : m_value.shape; }
+ CSSBasicShape* getShapeValue() const { return m_primitiveUnitType != CSS_SHAPE ? nullptr : m_value.shape; }
- CSSCalcValue* cssCalcValue() const { return m_primitiveUnitType != CSS_CALC ? 0 : m_value.calc; }
+ const CSSFontFamily& fontFamily() const { ASSERT(m_primitiveUnitType == CSS_FONT_FAMILY); return *m_value.fontFamily; }
+ CSSCalcValue* cssCalcValue() const { return m_primitiveUnitType != CSS_CALC ? nullptr : m_value.calc; }
+
CSSPropertyID getPropertyID() const { return m_primitiveUnitType == CSS_PROPERTY_ID ? m_value.propertyID : CSSPropertyInvalid; }
CSSValueID getValueID() const { return m_primitiveUnitType == CSS_VALUE_ID ? m_value.valueID : CSSValueInvalid; }
@@ -435,6 +441,7 @@
DashboardRegion* region;
CSSBasicShape* shape;
CSSCalcValue* calc;
+ CSSFontFamily* fontFamily;
} m_value;
};
Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (179099 => 179100)
--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2015-01-26 02:11:14 UTC (rev 179100)
@@ -31,6 +31,7 @@
#define CSSPrimitiveValueMappings_h
#include "CSSCalculationValue.h"
+#include "CSSFontFamily.h"
#include "CSSPrimitiveValue.h"
#include "CSSReflectionDirection.h"
#include "CSSToLengthConversionData.h"
@@ -4918,6 +4919,13 @@
return WM_LRTB;
}
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CSSFontFamily fontFamily)
+ : CSSValue(PrimitiveClass)
+{
+ m_primitiveUnitType = CSS_FONT_FAMILY;
+ m_value.fontFamily = new CSSFontFamily(WTF::move(fontFamily));
+}
+
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVectorEffect e)
: CSSValue(PrimitiveClass)
{
Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (179099 => 179100)
--- trunk/Source/WebCore/css/CSSPropertyNames.in 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in 2015-01-26 02:11:14 UTC (rev 179100)
@@ -99,7 +99,6 @@
color [Inherited, VisitedLinkColorSupport, NoDefaultColor]
direction [Inherited, Custom=Value]
display [Custom=Inherit|Value]
-font [Inherited, Custom=All]
font-family [Inherited, Custom=All]
font-size [Inherited, Custom=All]
font-style [Inherited, FontProperty, NameForMethods=Italic]
@@ -229,6 +228,7 @@
float [NameForMethods=Floating]
flood-color [SVG, Converter=SVGColor]
flood-opacity [SVG, Converter=Opacity]
+font [Inherited, Longhands=font-family|font-size|font-style|font-variant|font-weight|line-height]
font-stretch [SkipBuilder]
glyph-orientation-horizontal [Inherited, SVG, Converter=GlyphOrientation]
glyph-orientation-vertical [Inherited, SVG, Converter=GlyphOrientationOrAuto]
Modified: trunk/Source/WebCore/css/CSSValuePool.cpp (179099 => 179100)
--- trunk/Source/WebCore/css/CSSValuePool.cpp 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/css/CSSValuePool.cpp 2015-01-26 02:11:14 UTC (rev 179100)
@@ -27,6 +27,7 @@
#include "CSSValuePool.h"
#include "CSSParser.h"
+#include "CSSPrimitiveValueMappings.h"
#include "CSSStyleSheet.h"
#include "CSSValueKeywords.h"
#include "CSSValueList.h"
@@ -118,11 +119,11 @@
return *cache[intValue];
}
-Ref<CSSPrimitiveValue> CSSValuePool::createFontFamilyValue(const String& familyName)
+Ref<CSSPrimitiveValue> CSSValuePool::createFontFamilyValue(const String& familyName, FromSystemFontIDOrNot fromSystemFontID)
{
- RefPtr<CSSPrimitiveValue>& value = m_fontFamilyValueCache.add(familyName, nullptr).iterator->value;
+ RefPtr<CSSPrimitiveValue>& value = m_fontFamilyValueCache.add({familyName, fromSystemFontID}, nullptr).iterator->value;
if (!value)
- value = CSSPrimitiveValue::create(familyName, CSSPrimitiveValue::CSS_STRING);
+ value = CSSPrimitiveValue::create(CSSFontFamily{familyName, fromSystemFontID});
return *value;
}
Modified: trunk/Source/WebCore/css/CSSValuePool.h (179099 => 179100)
--- trunk/Source/WebCore/css/CSSValuePool.h 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/css/CSSValuePool.h 2015-01-26 02:11:14 UTC (rev 179100)
@@ -26,6 +26,7 @@
#ifndef CSSValuePool_h
#define CSSValuePool_h
+#include "CSSFontFamily.h"
#include "CSSInheritedValue.h"
#include "CSSInitialValue.h"
#include "CSSPrimitiveValue.h"
@@ -44,7 +45,7 @@
WTF_MAKE_FAST_ALLOCATED;
public:
PassRefPtr<CSSValueList> createFontFaceValue(const AtomicString&);
- Ref<CSSPrimitiveValue> createFontFamilyValue(const String&);
+ Ref<CSSPrimitiveValue> createFontFamilyValue(const String&, FromSystemFontIDOrNot = NotFromSystemFontID);
Ref<CSSInheritedValue> createInheritedValue() { return m_inheritedValue.copyRef(); }
Ref<CSSInitialValue> createImplicitInitialValue() { return m_implicitInitialValue.copyRef(); }
Ref<CSSInitialValue> createExplicitInitialValue() { return m_explicitInitialValue.copyRef(); }
@@ -83,7 +84,7 @@
typedef HashMap<AtomicString, RefPtr<CSSValueList>> FontFaceValueCache;
FontFaceValueCache m_fontFaceValueCache;
- typedef HashMap<String, RefPtr<CSSPrimitiveValue>> FontFamilyValueCache;
+ typedef HashMap<std::pair<String, bool>, RefPtr<CSSPrimitiveValue>> FontFamilyValueCache;
FontFamilyValueCache m_fontFamilyValueCache;
friend class WTF::NeverDestroyed<CSSValuePool>;
Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (179099 => 179100)
--- trunk/Source/WebCore/css/StyleBuilderCustom.h 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h 2015-01-26 02:11:14 UTC (rev 179100)
@@ -29,6 +29,7 @@
#include "CSSAspectRatioValue.h"
#include "CSSCursorImageValue.h"
+#include "CSSFontFamily.h"
#include "CSSFontValue.h"
#include "CSSGradientValue.h"
#include "CSSShadowValue.h"
@@ -72,7 +73,6 @@
DECLARE_PROPERTY_CUSTOM_HANDLERS(CounterReset);
DECLARE_PROPERTY_CUSTOM_HANDLERS(Cursor);
DECLARE_PROPERTY_CUSTOM_HANDLERS(Fill);
- DECLARE_PROPERTY_CUSTOM_HANDLERS(Font);
DECLARE_PROPERTY_CUSTOM_HANDLERS(FontFamily);
DECLARE_PROPERTY_CUSTOM_HANDLERS(FontSize);
DECLARE_PROPERTY_CUSTOM_HANDLERS(FontWeight);
@@ -858,9 +858,12 @@
auto& contentValue = downcast<CSSPrimitiveValue>(item.get());
AtomicString family;
bool isGenericFamily = false;
- if (contentValue.isString())
- family = contentValue.getStringValue();
- else {
+ if (contentValue.isFontFamily()) {
+ const CSSFontFamily& fontFamily = contentValue.fontFamily();
+ family = fontFamily.familyName;
+ // If the family name was resolved by the CSS parser from a system font ID, then it is generic.
+ isGenericFamily = fontFamily.fromSystemFontID;
+ } else {
switch (contentValue.getValueID()) {
case CSSValueWebkitBody:
if (Settings* settings = styleResolver.document().settings())
@@ -1290,48 +1293,6 @@
styleResolver.style()->setColumnGap(StyleBuilderConverter::convertComputedLength<float>(styleResolver, value));
}
-inline void StyleBuilderCustom::applyInitialFont(StyleResolver& styleResolver)
-{
- Settings* settings = styleResolver.documentSettings();
- ASSERT(settings); // If we're doing style resolution, this document should always be in a frame and thus have settings
- styleResolver.initializeFontStyle(settings);
-}
-
-inline void StyleBuilderCustom::applyInheritFont(StyleResolver& styleResolver)
-{
- FontDescription fontDescription = styleResolver.parentStyle()->fontDescription();
- styleResolver.style()->setLineHeight(styleResolver.parentStyle()->specifiedLineHeight());
- styleResolver.state().setLineHeightValue(0);
- styleResolver.setFontDescription(fontDescription);
-}
-
-inline void StyleBuilderCustom::applyValueFont(StyleResolver& styleResolver, CSSValue& value)
-{
- if (is<CSSPrimitiveValue>(value)) {
- styleResolver.style()->setLineHeight(RenderStyle::initialLineHeight());
- styleResolver.state().setLineHeightValue(0);
-
- FontDescription fontDescription;
- RenderTheme::defaultTheme()->systemFont(downcast<CSSPrimitiveValue>(value).getValueID(), fontDescription);
-
- // Double-check and see if the theme did anything. If not, don't bother updating the font.
- if (fontDescription.isAbsoluteSize()) {
- // Make sure the rendering mode and printer font settings are updated.
- Settings* settings = styleResolver.documentSettings();
- ASSERT(settings); // If we're doing style resolution, this document should always be in a frame and thus have settings
- fontDescription.setRenderingMode(settings->fontRenderingMode());
- fontDescription.setUsePrinterFont(styleResolver.document().printing() || !settings->screenFontSubstitutionEnabled());
-
- // Handle the zoom factor.
- fontDescription.setComputedSize(Style::computedFontSizeFromSpecifiedSize(fontDescription.specifiedSize(), fontDescription.isAbsoluteSize(), styleResolver.useSVGZoomRules(), styleResolver.style(), styleResolver.document()));
- styleResolver.setFontDescription(fontDescription);
- }
- return;
- }
- if (is<CSSFontValue>(value))
- styleResolver.applyFont(downcast<CSSFontValue>(value));
-}
-
inline void StyleBuilderCustom::applyInitialContent(StyleResolver& styleResolver)
{
styleResolver.style()->clearContent();
Modified: trunk/Source/WebCore/css/StylePropertyShorthand.cpp (179099 => 179100)
--- trunk/Source/WebCore/css/StylePropertyShorthand.cpp 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/css/StylePropertyShorthand.cpp 2015-01-26 02:11:14 UTC (rev 179100)
@@ -33,19 +33,6 @@
return StylePropertyShorthand(CSSPropertyBorder, borderAbridgedProperties, propertiesForInitialization);
}
-StylePropertyShorthand fontShorthand()
-{
- static const CSSPropertyID fontProperties[] = {
- CSSPropertyFontFamily,
- CSSPropertyFontSize,
- CSSPropertyFontStyle,
- CSSPropertyFontVariant,
- CSSPropertyFontWeight,
- CSSPropertyLineHeight
- };
- return StylePropertyShorthand(CSSPropertyFont, fontProperties);
-}
-
StylePropertyShorthand animationShorthandForParsing(CSSPropertyID propId)
{
// When we parse the animation shorthand we need to look for animation-name
@@ -84,13 +71,6 @@
bool isExpandedShorthand(CSSPropertyID id)
{
- // The system fonts bypass the normal style resolution by using RenderTheme,
- // thus we need to special case it here. FIXME: This is a violation of CSS 3 Fonts
- // as we should still be able to change the longhands.
- // DON'T ADD ANY SHORTHAND HERE UNLESS IT ISN'T ALWAYS EXPANDED AT PARSE TIME (which is wrong).
- if (id == CSSPropertyFont)
- return false;
-
return shorthandForProperty(id).length();
}
Modified: trunk/Source/WebCore/css/StylePropertyShorthand.h (179099 => 179100)
--- trunk/Source/WebCore/css/StylePropertyShorthand.h 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/css/StylePropertyShorthand.h 2015-01-26 02:11:14 UTC (rev 179100)
@@ -62,7 +62,6 @@
// Custom StylePropertyShorthand functions.
StylePropertyShorthand animationShorthandForParsing(CSSPropertyID);
StylePropertyShorthand borderAbridgedShorthand();
-StylePropertyShorthand fontShorthand();
// Returns empty value if the property is not a shorthand.
// The implementation is generated in StylePropertyShorthandFunctions.cpp.
@@ -76,24 +75,6 @@
bool isExpandedShorthand(CSSPropertyID);
-// FIXME: This should try to get rid of this function and generate the rest of these shorthands.
-inline Vector<StylePropertyShorthand> matchingCustomShorthandsForLonghand(CSSPropertyID propertyID)
-{
- switch (propertyID) {
- case CSSPropertyFontFamily:
- case CSSPropertyFontSize:
- case CSSPropertyFontStyle:
- case CSSPropertyFontVariant:
- case CSSPropertyFontWeight:
- case CSSPropertyLineHeight:
- return Vector<StylePropertyShorthand>{fontShorthand()};
- default:
- break;
- }
-
- return Vector<StylePropertyShorthand>();
-}
-
} // namespace WebCore
#endif // StylePropertyShorthand_h
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (179099 => 179100)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2015-01-26 02:11:14 UTC (rev 179100)
@@ -1837,25 +1837,6 @@
applyProperty(id, value);
}
-void StyleResolver::applyFont(CSSFontValue& font)
-{
- if (!font.style || !font.variant || !font.weight || !font.size || !font.lineHeight || !font.family)
- return;
- applyProperty(CSSPropertyFontStyle, font.style.get());
- applyProperty(CSSPropertyFontVariant, font.variant.get());
- applyProperty(CSSPropertyFontWeight, font.weight.get());
- // The previous properties can dirty our font but they don't try to read the font's
- // properties back, which is safe. However if font-size is using the 'ex' unit, it will
- // need query the dirtied font's x-height to get the computed size. To be safe in this
- // case, let's just update the font now.
- updateFont();
- applyProperty(CSSPropertyFontSize, font.size.get());
-
- m_state.setLineHeightValue(font.lineHeight.get());
-
- applyProperty(CSSPropertyFontFamily, font.family.get());
-}
-
inline bool isValidVisitedLinkProperty(CSSPropertyID id)
{
switch (id) {
Modified: trunk/Source/WebCore/css/StyleResolver.h (179099 => 179100)
--- trunk/Source/WebCore/css/StyleResolver.h 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/css/StyleResolver.h 2015-01-26 02:11:14 UTC (rev 179100)
@@ -201,7 +201,6 @@
void applyPropertyToCurrentStyle(CSSPropertyID, CSSValue*);
- void applyFont(CSSFontValue&);
void updateFont();
void initializeFontStyle(Settings*);
Modified: trunk/Source/WebCore/css/makeprop.pl (179099 => 179100)
--- trunk/Source/WebCore/css/makeprop.pl 2015-01-26 00:14:35 UTC (rev 179099)
+++ trunk/Source/WebCore/css/makeprop.pl 2015-01-26 02:11:14 UTC (rev 179100)
@@ -977,11 +977,7 @@
print SHORTHANDS_CPP " return " . lcfirst($nameToId{$name}) . "Shorthand();\n";
}
-# FIXME: CSSPropertyFont is currently an exception. It is hard-coded here
-# because it is not marked as a shorthand in CSSPropertyNames.in.
print SHORTHANDS_CPP << "EOF";
- case CSSPropertyFont:
- return fontShorthand();
default:
return emptyShorthand;
}
@@ -1021,7 +1017,7 @@
print SHORTHANDS_CPP << "EOF";
default:
- return matchingCustomShorthandsForLonghand(propertyID);
+ return { };
}
}
EOF