Changeset 67170 in webkit
- Timestamp:
- Sep 9, 2010 10:39:16 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r67169 r67170 1 2010-09-09 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 REGRESSION: applying new font size causes font-size outside selection to change 6 https://bugs.webkit.org/show_bug.cgi?id=45026 7 8 Added a test to apply font-size and font-family on various markups. 9 10 * editing/deleting/delete-br-012-expected.txt: Conflicting font and span elements are merged into one font element. 11 * editing/inserting/5994480-2-expected.txt: Removed redundant size attribute from font element. 12 * editing/deleting/delete-select-all-001-expected.txt: Style spans are replaced by font elements. 13 * editing/style/block-style-004-expected.txt: Ditto. 14 * editing/style/block-style-005-expected.txt: Ditto. 15 * editing/style/block-style-006-expected.txt: Ditto. 16 * editing/style/fontsize-1-expected.txt: Ditto. 17 * editing/execCommand/query-font-size-expected.txt: Ditto; also fixed the test not to add extraneous spans. 18 * editing/style/push-down-font-styles-expected.txt: Added. 19 * editing/style/push-down-font-styles.html: Added. 20 * editing/style/script-tests/push-down-font-styles.js: Added. 21 (testSingleToggle): 22 (selectAll): 23 (selectTest): 24 (selectFirstWord): 25 (selectSecondWord): 26 (selectLastTwoWords): 27 * platform/chromium-win/editing/inserting/5994480-2-expected.txt: Removed extraneous span. 28 1 29 2010-09-09 James Kozianski <koz@chromium.org> 2 30 -
trunk/LayoutTests/editing/deleting/delete-br-012-expected.txt
r67154 r67170 18 18 | <font> 19 19 | class="Apple-style-span" 20 | size="6" 21 | <span> 22 | class="Apple-style-span" 23 | style="font-size: 24px;" 24 | <#selection-caret> 25 | <br> 20 | size="5" 21 | <#selection-caret> 22 | <br> 26 23 | " 27 24 " -
trunk/LayoutTests/editing/deleting/delete-select-all-001-expected.txt
r67154 r67170 1 1 2 execDeleteCommand: < span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-size: medium;"><br></span>2 execDeleteCommand: <font class="Apple-style-span" size="3"><span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;"><br></span></font> -
trunk/LayoutTests/editing/execCommand/query-font-size-expected.txt
r67154 r67170 1 1 test html queryCommandValue result 2 execCommand('FontSize', -2) < span class="Apple-style-span" style="font-size: x-small;">test</span> 13 execCommand('FontSize', -1) < span class="Apple-style-span" style="font-size: small;">test</span> 24 execCommand('FontSize', 0) <span>test</span>35 execCommand('FontSize', 1) < span class="Apple-style-span" style="font-size: x-small;">test</span> 16 execCommand('FontSize', 2) < span class="Apple-style-span" style="font-size: small;">test</span> 27 execCommand('FontSize', 3) <span>test</span>38 execCommand('FontSize', 4) < span class="Apple-style-span" style="font-size: large;">test</span> 49 execCommand('FontSize', 5) < span class="Apple-style-span" style="font-size: x-large;">test</span> 510 execCommand('FontSize', 6) < span class="Apple-style-span" style="font-size: xx-large;">test</span> 611 execCommand('FontSize', 7) < span class="Apple-style-span" style="font-size: -webkit-xxx-large;">test</span> 712 execCommand('FontSize', '8px') < span class="Apple-style-span" style="font-size: -webkit-xxx-large;">test</span> 713 execCommand('FontSize', '2px') < span class="Apple-style-span" style="font-size: small;">test</span> 22 execCommand('FontSize', -2) <font class="Apple-style-span" size="1">test</font> 1 3 execCommand('FontSize', -1) <font class="Apple-style-span" size="2">test</font> 2 4 execCommand('FontSize', 0) test 3 5 execCommand('FontSize', 1) <font class="Apple-style-span" size="1">test</font> 1 6 execCommand('FontSize', 2) <font class="Apple-style-span" size="2">test</font> 2 7 execCommand('FontSize', 3) test 3 8 execCommand('FontSize', 4) <font class="Apple-style-span" size="4">test</font> 4 9 execCommand('FontSize', 5) <font class="Apple-style-span" size="5">test</font> 5 10 execCommand('FontSize', 6) <font class="Apple-style-span" size="6">test</font> 6 11 execCommand('FontSize', 7) <font class="Apple-style-span" size="7">test</font> 7 12 execCommand('FontSize', '8px') <font class="Apple-style-span" size="7">test</font> 7 13 execCommand('FontSize', '2px') <font class="Apple-style-span" size="2">test</font> 2 14 14 manual CSS font-size: 3px <span style="font-size: 3px">test</span> 1 15 15 manual CSS font-size: 0.2em <span style="font-size: 0.2em">test</span> 1 … … 20 20 manual CSS font-size: 10px <span style="font-size: 10px">test</span> 1 21 21 monospace tests to ensure the bug 19161 does not affect queryCommandValue's values 22 execCommand('FontSize', -2) < span class="Apple-style-span" style="font-size: x-small;"><font class="Apple-style-span" face="monospace">test</font></span> 123 execCommand('FontSize', -1) < span class="Apple-style-span" style="font-size: small;"><font class="Apple-style-span" face="monospace">test</font></span> 224 execCommand('FontSize', 0) < span><font class="Apple-style-span" face="monospace">test</font></span> 325 execCommand('FontSize', 1) < span class="Apple-style-span" style="font-size: x-small;"><font class="Apple-style-span" face="monospace">test</font></span> 126 execCommand('FontSize', 2) < span class="Apple-style-span" style="font-size: small;"><font class="Apple-style-span" face="monospace">test</font></span> 227 execCommand('FontSize', 3) < span><font class="Apple-style-span" face="monospace">test</font></span> 328 execCommand('FontSize', 4) < span class="Apple-style-span" style="font-size: large;"><font class="Apple-style-span" face="monospace">test</font></span> 429 execCommand('FontSize', 5) < span class="Apple-style-span" style="font-size: x-large;"><font class="Apple-style-span" face="monospace">test</font></span> 530 execCommand('FontSize', 6) < span class="Apple-style-span" style="font-size: xx-large;"><font class="Apple-style-span" face="monospace">test</font></span> 631 execCommand('FontSize', 7) < span class="Apple-style-span" style="font-size: -webkit-xxx-large;"><font class="Apple-style-span" face="monospace">test</font></span> 722 execCommand('FontSize', -2) <font class="Apple-style-span" size="1"><font class="Apple-style-span" face="monospace">test</font></font> 1 23 execCommand('FontSize', -1) <font class="Apple-style-span" size="2"><font class="Apple-style-span" face="monospace">test</font></font> 2 24 execCommand('FontSize', 0) <font class="Apple-style-span" face="monospace">test</font> 3 25 execCommand('FontSize', 1) <font class="Apple-style-span" size="1"><font class="Apple-style-span" face="monospace">test</font></font> 1 26 execCommand('FontSize', 2) <font class="Apple-style-span" size="2"><font class="Apple-style-span" face="monospace">test</font></font> 2 27 execCommand('FontSize', 3) <font class="Apple-style-span" face="monospace">test</font> 3 28 execCommand('FontSize', 4) <font class="Apple-style-span" size="4"><font class="Apple-style-span" face="monospace">test</font></font> 4 29 execCommand('FontSize', 5) <font class="Apple-style-span" size="5"><font class="Apple-style-span" face="monospace">test</font></font> 5 30 execCommand('FontSize', 6) <font class="Apple-style-span" size="6"><font class="Apple-style-span" face="monospace">test</font></font> 6 31 execCommand('FontSize', 7) <font class="Apple-style-span" size="7"><font class="Apple-style-span" face="monospace">test</font></font> 7 -
trunk/LayoutTests/editing/execCommand/query-font-size.html
r67154 r67170 44 44 } 45 45 46 function wrapInSpanIfNeeded(shouldBeSpan)47 {48 // Sometimes the result of the ExecCommand will not have a wrapping <span>49 if (!shouldBeSpan.localName || shouldBeSpan.localName.toLowerCase() != "span") {50 shouldBeSpan = document.createElement("span");51 shouldBeSpan.appendChild(editableDiv.firstChild);52 editableDiv.appendChild(shouldBeSpan);53 }54 return shouldBeSpan;55 }56 57 46 function reportSizeForSpan(span, comment) 58 47 { … … 68 57 editableDiv.innerHTML = "test"; 69 58 var sizedContent = setFontSizeOnContent(size); 70 sizedContent = wrapInSpanIfNeeded(sizedContent);71 59 if (fontFamily) 72 60 sizedContent = setFontFamilyOnContent(fontFamily); -
trunk/LayoutTests/editing/inserting/5994480-2-expected.txt
r67154 r67170 1 <font class="Apple-style-span" face="'Lucida Grande'" size="3"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font>1 <font class="Apple-style-span" face="'Lucida Grande'"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font> -
trunk/LayoutTests/editing/style/block-style-004-expected.txt
r67154 r67170 7 7 execInsertParagraphCommand: <div id="test" class="editing">x</div><div id="test" class="editing"><br></div><div id="test" class="editing"><br></div> 8 8 execTypeCharacterCommand: <div id="test" class="editing">x</div><div id="test" class="editing"><br></div><div id="test" class="editing">x</div> 9 execFontSizeCommand: <div id="test" class="editing">< span class="Apple-style-span" style="font-size: -webkit-xxx-large;">x</span></div><div id="test" class="editing"><span class="Apple-style-span" style="font-size: -webkit-xxx-large;"><br></span></div><div id="test" class="editing"><span class="Apple-style-span" style="font-size: -webkit-xxx-large;">x</span></div>10 execInsertParagraphCommand: <div id="test" class="editing">< span class="Apple-style-span" style="font-size: -webkit-xxx-large;">x</span></div><div id="test" class="editing"><span class="Apple-style-span" style="font-size: -webkit-xxx-large;"><br></span></div><div id="test" class="editing"><span class="Apple-style-span" style="font-size: -webkit-xxx-large;"><br></span></div><div id="test" class="editing"><span class="Apple-style-span" style="font-size: -webkit-xxx-large;">x</span></div>9 execFontSizeCommand: <div id="test" class="editing"><font class="Apple-style-span" size="7">x</font></div><div id="test" class="editing"><font class="Apple-style-span" size="7"><br></font></div><div id="test" class="editing"><font class="Apple-style-span" size="7">x</font></div> 10 execInsertParagraphCommand: <div id="test" class="editing"><font class="Apple-style-span" size="7">x</font></div><div id="test" class="editing"><font class="Apple-style-span" size="7"><br></font></div><div id="test" class="editing"><font class="Apple-style-span" size="7"><br></font></div><div id="test" class="editing"><font class="Apple-style-span" size="7">x</font></div> -
trunk/LayoutTests/editing/style/block-style-005-expected.txt
r67154 r67170 6 6 execInsertParagraphCommand: <div id="test" class="editing">x</div><div id="test" class="editing"><br></div><div id="test" class="editing"><br></div> 7 7 execTypeCharacterCommand: <div id="test" class="editing">x</div><div id="test" class="editing"><br></div><div id="test" class="editing">x</div> 8 execFontSizeCommand: <div id="test" class="editing">< span class="Apple-style-span" style="font-size: -webkit-xxx-large;">x</span></div><div id="test" class="editing"><span class="Apple-style-span" style="font-size: -webkit-xxx-large;"><br></span></div><div id="test" class="editing"><span class="Apple-style-span" style="font-size: -webkit-xxx-large;">x</span></div>9 execDeleteCommand: <div id="test" class="editing">< span class="Apple-style-span" style="font-size: -webkit-xxx-large;">x</span></div><div id="test" class="editing"><span class="Apple-style-span" style="font-size: -webkit-xxx-large;"><br></span></div><div id="test" class="editing"><span class="Apple-style-span" style="font-size: -webkit-xxx-large;"><br></span></div>8 execFontSizeCommand: <div id="test" class="editing"><font class="Apple-style-span" size="7">x</font></div><div id="test" class="editing"><font class="Apple-style-span" size="7"><br></font></div><div id="test" class="editing"><font class="Apple-style-span" size="7">x</font></div> 9 execDeleteCommand: <div id="test" class="editing"><font class="Apple-style-span" size="7">x</font></div><div id="test" class="editing"><font class="Apple-style-span" size="7"><br></font></div><div id="test" class="editing"><font class="Apple-style-span" size="7"><br></font></div> -
trunk/LayoutTests/editing/style/block-style-006-expected.txt
r67154 r67170 7 7 execInsertParagraphCommand: <div id="test" class="editing">x</div><div id="test" class="editing"><br></div><div id="test" class="editing"><br></div> 8 8 execTypeCharacterCommand: <div id="test" class="editing">x</div><div id="test" class="editing"><br></div><div id="test" class="editing">x</div> 9 execFontSizeCommand: <div id="test" class="editing">< span class="Apple-style-span" style="font-size: -webkit-xxx-large;">x</span></div><div id="test" class="editing"><span class="Apple-style-span" style="font-size: -webkit-xxx-large;"><br></span></div><div id="test" class="editing"><span class="Apple-style-span" style="font-size: -webkit-xxx-large;">x</span></div>10 execInsertParagraphCommand: <div id="test" class="editing">< span class="Apple-style-span" style="font-size: -webkit-xxx-large;">x</span></div><div id="test" class="editing"><span class="Apple-style-span" style="font-size: -webkit-xxx-large;"><br></span></div><div id="test" class="editing"><span class="Apple-style-span" style="font-size: -webkit-xxx-large;"><br></span></div><div id="test" class="editing"><span class="Apple-style-span" style="font-size: -webkit-xxx-large;">x</span></div>9 execFontSizeCommand: <div id="test" class="editing"><font class="Apple-style-span" size="7">x</font></div><div id="test" class="editing"><font class="Apple-style-span" size="7"><br></font></div><div id="test" class="editing"><font class="Apple-style-span" size="7">x</font></div> 10 execInsertParagraphCommand: <div id="test" class="editing"><font class="Apple-style-span" size="7">x</font></div><div id="test" class="editing"><font class="Apple-style-span" size="7"><br></font></div><div id="test" class="editing"><font class="Apple-style-span" size="7"><br></font></div><div id="test" class="editing"><font class="Apple-style-span" size="7">x</font></div> -
trunk/LayoutTests/editing/style/fontsize-1-expected.txt
r67154 r67170 8 8 9 9 type small: 10 | < span>10 | <font> 11 11 | class="Apple-style-span" 12 | s tyle="font-size: small;"12 | size="2" 13 13 | "small<#selection-caret>" 14 14 15 15 fontsize 4: 16 | < span>16 | <font> 17 17 | class="Apple-style-span" 18 | s tyle="font-size: small;"18 | size="2" 19 19 | "small<#selection-caret>" 20 20 21 21 type medium: 22 | < span>22 | <font> 23 23 | class="Apple-style-span" 24 | s tyle="font-size: small;"24 | size="2" 25 25 | "small" 26 | < span>26 | <font> 27 27 | class="Apple-style-span" 28 | s tyle="font-size: large;"28 | size="4" 29 29 | "medium<#selection-caret>" 30 30 31 31 fontsize 6: 32 | < span>32 | <font> 33 33 | class="Apple-style-span" 34 | s tyle="font-size: small;"34 | size="2" 35 35 | "small" 36 | < span>36 | <font> 37 37 | class="Apple-style-span" 38 | s tyle="font-size: large;"38 | size="4" 39 39 | "medium<#selection-caret>" 40 40 41 41 type large: 42 | < span>42 | <font> 43 43 | class="Apple-style-span" 44 | s tyle="font-size: small;"44 | size="2" 45 45 | "small" 46 | < span>46 | <font> 47 47 | class="Apple-style-span" 48 | s tyle="font-size: large;"48 | size="4" 49 49 | "medium" 50 | < span>50 | <font> 51 51 | class="Apple-style-span" 52 | s tyle="font-size: xx-large;"52 | size="6" 53 53 | "large<#selection-caret>" 54 54 -
trunk/LayoutTests/platform/chromium-win/editing/inserting/5994480-2-expected.txt
r56271 r67170 1 <font class="Apple-style-span" face="Arial" size=" 3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font>1 <font class="Apple-style-span" face="Arial" size="2"><br></font> -
trunk/WebCore/ChangeLog
r67168 r67170 1 2010-09-09 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 REGRESSION: applying new font size causes font-size outside selection to change 6 https://bugs.webkit.org/show_bug.cgi?id=45026 7 8 The regression was caused by removeImplicitlyStyledElement not converting font size to CSS value properly. 9 Namely, it was treating font size as a pixel value for font-size property. Fixed this by adding fontSizeToCSSValue 10 which uses HTMLFontElement::cssValueFromFontSizeNumber and deployed it in removeImplicitlyStyledElement 11 12 Also fixed a bug in StyleChange::extractTextStyles that it ignores font-size property when the values were 13 relative terms such as x-small and -webkit-xxx-large. And replaced the logic to convert from pixel font size 14 to legacy font size by CSSStyleSelector::legacyFontSize. 15 16 Test: editing/style/push-down-font-styles.html 17 18 * editing/ApplyStyleCommand.cpp: 19 (WebCore::StyleChange::extractTextStyles): Fixed a bug. See above. 20 (WebCore::stringToCSSValue): Converts string to CSSValue. 21 (WebCore::fontSizeToCSSValue): Converts font size number (String) to CSSPrimitiveValue. 22 (WebCore::ApplyStyleCommand::removeImplicitlyStyledElement): Calls stringToCSSValue and fontSizeToCSSValue. 23 * css/CSSStyleSelector.h: Made fontSizeForKeyword public. 24 1 25 2010-09-09 Kent Tamura <tkent@chromium.org> 2 26 -
trunk/WebCore/css/CSSStyleSelector.h
r67154 r67170 123 123 PassRefPtr<CSSRuleList> pseudoStyleRulesForElement(Element*, PseudoId, bool authorOnly); 124 124 125 // Given a font size in pixel, this function will return legacy font size between 1 and 7.126 static int legacyFontSize(Document*, int pixelFontSize, bool shouldUseFixedDefaultSize);127 128 private:129 125 // Given a CSS keyword in the range (xx-small to -webkit-xxx-large), this function will return 130 126 // the correct font size scaled relative to the user's default (medium). 131 127 static float fontSizeForKeyword(Document*, int keyword, bool shouldUseFixedDefaultSize); 128 129 // Given a font size in pixel, this function will return legacy font size between 1 and 7. 130 static int legacyFontSize(Document*, int pixelFontSize, bool shouldUseFixedDefaultSize); 131 132 private: 132 133 133 134 // When the CSS keyword "larger" is used, this function will attempt to match within the keyword -
trunk/WebCore/editing/ApplyStyleCommand.cpp
r67154 r67170 32 32 #include "CSSProperty.h" 33 33 #include "CSSPropertyNames.h" 34 #include "CSSStyleSelector.h" 34 35 #include "CSSValueKeywords.h" 35 36 #include "Document.h" … … 37 38 #include "Frame.h" 38 39 #include "HTMLElement.h" 40 #include "HTMLFontElement.h" 39 41 #include "HTMLInterchange.h" 40 42 #include "HTMLNames.h" … … 111 113 void init(PassRefPtr<CSSStyleDeclaration>, const Position&); 112 114 void reconcileTextDecorationProperties(CSSMutableStyleDeclaration*); 113 void extractTextStyles( CSSMutableStyleDeclaration*);115 void extractTextStyles(Document*, CSSMutableStyleDeclaration*, bool shouldUseFixedFontDefautlSize); 114 116 115 117 String m_cssStyle; … … 148 150 reconcileTextDecorationProperties(mutableStyle.get()); 149 151 if (!document->frame()->editor()->shouldStyleWithCSS()) 150 extractTextStyles( mutableStyle.get());152 extractTextStyles(document, mutableStyle.get(), computedStyle->useFixedFontDefaultSize()); 151 153 152 154 // Changing the whitespace style in a tab span would collapse the tab into a space. … … 203 205 } 204 206 205 void StyleChange::extractTextStyles( CSSMutableStyleDeclaration* style)207 void StyleChange::extractTextStyles(Document* document, CSSMutableStyleDeclaration* style, bool shouldUseFixedFontDefautlSize) 206 208 { 207 209 ASSERT(style); … … 260 262 else { 261 263 CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(fontSize.get()); 262 263 // Only accept absolute scale264 264 if (value->primitiveType() >= CSSPrimitiveValue::CSS_PX && value->primitiveType() <= CSSPrimitiveValue::CSS_PC) { 265 float number = value->getFloatValue(CSSPrimitiveValue::CSS_PX); 266 if (number <= 9) 267 m_applyFontSize = "1"; 268 else if (number <= 10) 269 m_applyFontSize = "2"; 270 else if (number <= 13) 271 m_applyFontSize = "3"; 272 else if (number <= 16) 273 m_applyFontSize = "4"; 274 else if (number <= 18) 275 m_applyFontSize = "5"; 276 else if (number <= 24) 277 m_applyFontSize = "6"; 278 else 279 m_applyFontSize = "7"; 265 int pixelFontSize = value->getFloatValue(CSSPrimitiveValue::CSS_PX); 266 int legacyFontSize = CSSStyleSelector::legacyFontSize(document, pixelFontSize, shouldUseFixedFontDefautlSize); 267 // Use legacy font size only if pixel value matches exactly to that of legacy font size. 268 if (CSSStyleSelector::fontSizeForKeyword(document, legacyFontSize - 1 + CSSValueXSmall, shouldUseFixedFontDefautlSize) == pixelFontSize) { 269 m_applyFontSize = String::number(legacyFontSize); 270 style->removeProperty(CSSPropertyFontSize); 271 } 272 } else if (CSSValueXSmall <= value->getIdent() && value->getIdent() <= CSSValueWebkitXxxLarge) { 273 m_applyFontSize = String::number(value->getIdent() - CSSValueXSmall + 1); 274 style->removeProperty(CSSPropertyFontSize); 280 275 } 281 // Huge quirk in Microsoft Entourage is that they understand CSS font-size, but also write282 // out legacy 1-7 values in font tags (I guess for mailers that are not CSS-savvy at all,283 // like Eudora). Yes, they write out *both*. We need to write out both as well.284 276 } 285 277 } … … 1159 1151 const QualifiedName* element; 1160 1152 const QualifiedName* attribute; 1153 PassRefPtr<CSSValue> (*attributeToCSSValue)(int propertyID, const String&); 1161 1154 EPushDownType pushDownType; 1162 1155 }; 1163 1156 1157 static PassRefPtr<CSSValue> stringToCSSValue(int propertyID, const String& value) 1158 { 1159 RefPtr<CSSMutableStyleDeclaration> dummyStyle; 1160 dummyStyle = CSSMutableStyleDeclaration::create(); 1161 dummyStyle->setProperty(propertyID, value); 1162 return dummyStyle->getPropertyCSSValue(propertyID); 1163 } 1164 1165 static PassRefPtr<CSSValue> fontSizeToCSSValue(int propertyID, const String& value) 1166 { 1167 UNUSED_PARAM(propertyID); 1168 ASSERT(propertyID == CSSPropertyFontSize); 1169 int size; 1170 if (!HTMLFontElement::cssValueFromFontSizeNumber(value, size)) 1171 return 0; 1172 return CSSPrimitiveValue::createIdentifier(size); 1173 } 1174 1164 1175 static const HTMLEquivalent HTMLEquivalents[] = { 1165 { CSSPropertyFontWeight, false, CSSValueBold, &bTag, 0, ShouldBePushedDown },1166 { CSSPropertyFontWeight, false, CSSValueBold, &strongTag, 0, ShouldBePushedDown },1167 { CSSPropertyVerticalAlign, false, CSSValueSub, &subTag, 0, ShouldBePushedDown },1168 { CSSPropertyVerticalAlign, false, CSSValueSuper, &supTag, 0, ShouldBePushedDown },1169 { CSSPropertyFontStyle, false, CSSValueItalic, &iTag, 0, ShouldBePushedDown },1170 { CSSPropertyFontStyle, false, CSSValueItalic, &emTag, 0, ShouldBePushedDown },1176 { CSSPropertyFontWeight, false, CSSValueBold, &bTag, 0, 0, ShouldBePushedDown }, 1177 { CSSPropertyFontWeight, false, CSSValueBold, &strongTag, 0, 0, ShouldBePushedDown }, 1178 { CSSPropertyVerticalAlign, false, CSSValueSub, &subTag, 0, 0, ShouldBePushedDown }, 1179 { CSSPropertyVerticalAlign, false, CSSValueSuper, &supTag, 0, 0, ShouldBePushedDown }, 1180 { CSSPropertyFontStyle, false, CSSValueItalic, &iTag, 0, 0, ShouldBePushedDown }, 1181 { CSSPropertyFontStyle, false, CSSValueItalic, &emTag, 0, 0, ShouldBePushedDown }, 1171 1182 1172 1183 // text-decorations should be CSSValueList 1173 { CSSPropertyTextDecoration, true, CSSValueUnderline, &uTag, 0, ShouldBePushedDown },1174 { CSSPropertyTextDecoration, true, CSSValueLineThrough, &sTag, 0, ShouldBePushedDown },1175 { CSSPropertyTextDecoration, true, CSSValueLineThrough, &strikeTag, 0, ShouldBePushedDown },1176 { CSSPropertyWebkitTextDecorationsInEffect, true, CSSValueUnderline, &uTag, 0, ShouldBePushedDown },1177 { CSSPropertyWebkitTextDecorationsInEffect, true, CSSValueLineThrough, &sTag, 0, ShouldBePushedDown },1178 { CSSPropertyWebkitTextDecorationsInEffect, true, CSSValueLineThrough, &strikeTag, 0, ShouldBePushedDown },1184 { CSSPropertyTextDecoration, true, CSSValueUnderline, &uTag, 0, 0, ShouldBePushedDown }, 1185 { CSSPropertyTextDecoration, true, CSSValueLineThrough, &sTag, 0, 0, ShouldBePushedDown }, 1186 { CSSPropertyTextDecoration, true, CSSValueLineThrough, &strikeTag, 0, 0, ShouldBePushedDown }, 1187 { CSSPropertyWebkitTextDecorationsInEffect, true, CSSValueUnderline, &uTag, 0, 0, ShouldBePushedDown }, 1188 { CSSPropertyWebkitTextDecorationsInEffect, true, CSSValueLineThrough, &sTag, 0, 0, ShouldBePushedDown }, 1189 { CSSPropertyWebkitTextDecorationsInEffect, true, CSSValueLineThrough, &strikeTag, 0, 0, ShouldBePushedDown }, 1179 1190 1180 1191 // FIXME: font attributes should only be removed if values were different 1181 { CSSPropertyColor, false, CSSValueInvalid, &fontTag, &colorAttr, ShouldBePushedDown },1182 { CSSPropertyFontFamily, false, CSSValueInvalid, &fontTag, &faceAttr, ShouldBePushedDown },1183 { CSSPropertyFontSize, false, CSSValueInvalid, &fontTag, &sizeAttr, ShouldBePushedDown },1192 { CSSPropertyColor, false, CSSValueInvalid, &fontTag, &colorAttr, stringToCSSValue, ShouldBePushedDown }, 1193 { CSSPropertyFontFamily, false, CSSValueInvalid, &fontTag, &faceAttr, stringToCSSValue, ShouldBePushedDown }, 1194 { CSSPropertyFontSize, false, CSSValueInvalid, &fontTag, &sizeAttr, fontSizeToCSSValue, ShouldBePushedDown }, 1184 1195 1185 1196 // unicode-bidi and direction are pushed down separately so don't push down with other styles. 1186 { CSSProperty UnicodeBidi, false, CSSValueInvalid, 0, &dirAttr, ShouldNotBePushedDown },1187 { CSSProperty Direction, false, CSSValueInvalid, 0, &dirAttr, ShouldNotBePushedDown },1197 { CSSPropertyDirection, false, CSSValueInvalid, 0, &dirAttr, stringToCSSValue, ShouldNotBePushedDown }, 1198 { CSSPropertyUnicodeBidi, false, CSSValueInvalid, 0, &dirAttr, stringToCSSValue, ShouldNotBePushedDown }, 1188 1199 }; 1189 1200 … … 1204 1215 if (!styleValue) 1205 1216 continue; 1206 RefPtr<CSSPrimitiveValue> mapValue = CSSPrimitiveValue::createIdentifier(equivalent.primitiveId); 1217 RefPtr<CSSValue> mapValue; 1218 if (equivalent.attribute) 1219 mapValue = equivalent.attributeToCSSValue(equivalent.propertyID, element->getAttribute(*equivalent.attribute)); 1220 else 1221 mapValue = CSSPrimitiveValue::createIdentifier(equivalent.primitiveId).get(); 1207 1222 1208 1223 if (equivalent.isValueList && styleValue->isValueList() && static_cast<CSSValueList*>(styleValue.get())->hasValue(mapValue.get())) 1209 1224 continue; // If CSS value assumes CSSValueList, then only skip if the value was present in style to apply. 1210 else if ( styleValue->cssText() == mapValue->cssText())1225 else if (mapValue && styleValue->cssText() == mapValue->cssText()) 1211 1226 continue; // If CSS value is primitive, then skip if they are equal. 1212 1227 1213 if (extractedStyle) { 1214 if (equivalent.primitiveId == CSSValueInvalid) 1215 extractedStyle->setProperty(equivalent.propertyID, element->getAttribute(*equivalent.attribute)); 1216 else 1217 extractedStyle->setProperty(equivalent.propertyID, mapValue->cssText()); 1218 } 1228 if (extractedStyle) 1229 extractedStyle->setProperty(equivalent.propertyID, mapValue->cssText()); 1219 1230 1220 1231 if (mode == RemoveNone)
Note: See TracChangeset
for help on using the changeset viewer.