Changeset 207539 in webkit
- Timestamp:
- Oct 19, 2016 9:38:42 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r207537 r207539 1 2016-10-19 Dave Hyatt <hyatt@apple.com> 2 3 [CSS Parser] Fix named color parsing 4 https://bugs.webkit.org/show_bug.cgi?id=163662 5 6 Reviewed by Zalan Bujtas. 7 8 Named color parsing in the old parser for extended colors relied on constructing a Color with the 9 name and doing a lookup that way. 10 11 The new parser allows the back end to hold a primitive identifier value for extended colors. 12 13 StyleColor contains a helper function for looking up the correct color. 14 15 This patch switches both the old and the new parsers over to the new StyleColor function. 16 17 Also remove some asserts from the CSSSelectorList, since the new parser allows it to be empty and 18 detects parsing failure that way. 19 20 * css/CSSSelectorList.cpp: 21 (WebCore::CSSSelectorList::CSSSelectorList): 22 (WebCore::CSSSelectorList::operator=): 23 * css/StyleColor.cpp: 24 (WebCore::StyleColor::isColorKeyword): 25 * css/StyleResolver.cpp: 26 (WebCore::StyleResolver::colorFromPrimitiveValue): 27 (WebCore::colorForCSSValue): Deleted. 28 1 29 2016-10-19 Youenn Fablet <youenn@apple.com> 2 30 -
trunk/Source/WebCore/css/CSSSelectorList.cpp
r207536 r207539 46 46 : m_selectorArray(other.m_selectorArray) 47 47 { 48 ASSERT_WITH_SECURITY_IMPLICATION(componentCount());49 48 other.m_selectorArray = nullptr; 50 49 } … … 103 102 other.m_selectorArray = nullptr; 104 103 105 ASSERT_WITH_SECURITY_IMPLICATION(componentCount());106 104 return *this; 107 105 } -
trunk/Source/WebCore/css/StyleColor.cpp
r206007 r207539 49 49 bool StyleColor::isColorKeyword(CSSValueID id) 50 50 { 51 return (id >= CSSValueAlpha && id <= CSSValueWebkitText) || id == CSSValueMenu; 51 return (id >= CSSValueAlpha && id <= CSSValueWebkitText) 52 || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen) 53 || id == CSSValueMenu; 52 54 } 53 55 -
trunk/Source/WebCore/css/StyleResolver.cpp
r207396 r207539 121 121 #include "ShadowRoot.h" 122 122 #include "StyleBuilder.h" 123 #include "StyleColor.h" 123 124 #include "StyleCachedImage.h" 124 125 #include "StyleFontSizeFunctions.h" … … 1778 1779 } 1779 1780 1780 static Color colorForCSSValue(CSSValueID cssValueId)1781 {1782 struct ColorValue {1783 CSSValueID cssValueId;1784 RGBA32 color;1785 };1786 1787 static const ColorValue colorValues[] = {1788 { CSSValueAqua, 0xFF00FFFF },1789 { CSSValueBlack, 0xFF000000 },1790 { CSSValueBlue, 0xFF0000FF },1791 { CSSValueFuchsia, 0xFFFF00FF },1792 { CSSValueGray, 0xFF808080 },1793 { CSSValueGreen, 0xFF008000 },1794 { CSSValueGrey, 0xFF808080 },1795 { CSSValueLime, 0xFF00FF00 },1796 { CSSValueMaroon, 0xFF800000 },1797 { CSSValueNavy, 0xFF000080 },1798 { CSSValueOlive, 0xFF808000 },1799 { CSSValueOrange, 0xFFFFA500 },1800 { CSSValuePurple, 0xFF800080 },1801 { CSSValueRed, 0xFFFF0000 },1802 { CSSValueSilver, 0xFFC0C0C0 },1803 { CSSValueTeal, 0xFF008080 },1804 { CSSValueTransparent, 0x00000000 },1805 { CSSValueWhite, 0xFFFFFFFF },1806 { CSSValueYellow, 0xFFFFFF00 },1807 { CSSValueInvalid, CSSValueInvalid }1808 };1809 1810 for (const ColorValue* col = colorValues; col->cssValueId; ++col) {1811 if (col->cssValueId == cssValueId)1812 return col->color;1813 }1814 return RenderTheme::defaultTheme()->systemColor(cssValueId);1815 }1816 1817 1781 bool StyleResolver::colorFromPrimitiveValueIsDerivedFromElement(const CSSPrimitiveValue& value) 1818 1782 { … … 1849 1813 case CSSValueCurrentcolor: 1850 1814 return state.style()->color(); 1851 default: 1852 return colorForCSSValue(ident); 1815 default: { 1816 return StyleColor::colorFromKeyword(ident); 1817 } 1853 1818 } 1854 1819 }
Note: See TracChangeset
for help on using the changeset viewer.