Changeset 46286 in webkit
- Timestamp:
- Jul 23, 2009 2:17:00 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r46285 r46286 1 2009-07-22 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 execCommand('underline') can't remove <U> underlines 6 https://bugs.webkit.org/show_bug.cgi?id=20215 7 8 This patch rebaselines toggle-styles.html because WebKit now passes three tests it used to fail. 9 toggle-style-2.html is added to test cases in which multiple styles are specified with tags. 10 We still fail some tests because WebKit doesn't properly support non-CSS mode but they are visually correct. 11 12 * editing/execCommand/resources/toggle-style-2.js: Added. 13 (testSingleToggle): 14 (testDoubleToggle): 15 * editing/execCommand/toggle-style-2-expected.txt: Added. 16 * editing/execCommand/toggle-style-2.html: Added. 17 * editing/execCommand/toggle-styles-expected.txt: Passes all the tests 18 1 19 2009-07-23 Jessie Berlin <jberlin@apple.com> 2 20 -
trunk/LayoutTests/editing/execCommand/toggle-styles-expected.txt
r40384 r46286 20 20 PASS superscript removing vertical-align: super 21 21 PASS strikethrough toggle 22 FAIL strikethrough removing strike -- <strike><span class="Apple-style-span" style="text-decoration: none;">test</span></strike> 22 PASS strikethrough removing strike 23 23 PASS strikethrough removing text-decoration: line-through 24 FAIL strikethrough removing s -- <s><span class="Apple-style-span" style="text-decoration: none;">test</span></s> 24 PASS strikethrough removing s 25 25 PASS underline toggle 26 FAIL underline removing u -- <u><span class="Apple-style-span" style="text-decoration: none;">test</span></u> 26 PASS underline removing u 27 27 PASS underline removing text-decoration: underline 28 28 PASS successfullyParsed is true -
trunk/WebCore/ChangeLog
r46285 r46286 1 2009-07-22 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 execCommand('underline') can't remove <U> underlines 6 https://bugs.webkit.org/show_bug.cgi?id=20215 7 8 This patch adds support for u, s, and strike to implicitlyStyledElementShouldBeRemovedWhenApplyingStyle so that 9 WebKit can remove those presentational tags when necessary. 10 It also modifies StyleChange::init not to add "text-decoration: none". Not only is this style meaningless 11 (does not override inherited styles) but it was also causing WebKit to generate extra spans with this style. 12 13 * css/CSSValueList.cpp: 14 (WebCore::CSSValueList::hasValue): True if the property contains the specified value 15 * css/CSSValueList.h: Updated prototype 16 * editing/ApplyStyleCommand.cpp: 17 (WebCore::StyleChange::init): No longer adds "text-decoration: none" 18 (WebCore::ApplyStyleCommand::implicitlyStyledElementShouldBeRemovedWhenApplyingStyle): Supports text-decoration-related elements 19 1 20 2009-07-23 Jessie Berlin <jberlin@apple.com> 2 21 -
trunk/WebCore/css/CSSValueList.cpp
r46251 r46286 85 85 return found; 86 86 } 87 88 bool CSSValueList::hasValue(CSSValue* val) 89 { 90 // FIXME: we should be implementing operator== to CSSValue and its derived classes 91 // to make comparison more flexible and fast. 92 for (size_t index = 0; index < m_values.size(); index++) { 93 if (m_values.at(index)->cssText() == val->cssText()) 94 return true; 95 } 96 return false; 97 } 87 98 88 99 String CSSValueList::cssText() const -
trunk/WebCore/css/CSSValueList.h
r46251 r46286 54 54 void prepend(PassRefPtr<CSSValue>); 55 55 bool removeAll(CSSValue*); 56 bool hasValue(CSSValue*); 56 57 57 58 virtual String cssText() const; -
trunk/WebCore/editing/ApplyStyleCommand.cpp
r46238 r46286 99 99 if (!document || !document->frame()) 100 100 return; 101 101 102 102 bool useHTMLFormattingTags = !document->frame()->editor()->shouldStyleWithCSS(); 103 104 103 RefPtr<CSSMutableStyleDeclaration> mutableStyle = style->makeMutable(); 105 104 // We shouldn't have both text-decoration and -webkit-text-decorations-in-effect because that wouldn't make sense. 105 ASSERT(!mutableStyle->getPropertyCSSValue(CSSPropertyTextDecoration) || !mutableStyle->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect)); 106 106 String styleText(""); 107 108 107 bool addedDirection = false; 109 108 CSSMutableStyleDeclaration::const_iterator end = mutableStyle->end(); … … 131 130 132 131 // Add this property 133 134 if (property->id() == CSSPropertyWebkitTextDecorationsInEffect) { 135 // we have to special-case text decorations 136 // FIXME: Why? 132 if (property->id() == CSSPropertyTextDecoration || property->id() == CSSPropertyWebkitTextDecorationsInEffect) { 133 // Always use text-decoration because -webkit-text-decoration-in-effect is internal. 137 134 CSSProperty alteredProperty(CSSPropertyTextDecoration, property->value(), property->isImportant()); 138 styleText += alteredProperty.cssText(); 135 // We don't add "text-decoration: none" because it doesn't override the existing text decorations; i.e. redundant 136 if (alteredProperty.cssText() != "none") 137 styleText += alteredProperty.cssText(); 139 138 } else 140 139 styleText += property->cssText(); … … 963 962 return true; 964 963 break; 964 case CSSPropertyTextDecoration: 965 case CSSPropertyWebkitTextDecorationsInEffect: 966 ASSERT(property.value()); 967 if (property.value()->isValueList()) { 968 CSSValueList* valueList = static_cast<CSSValueList*>(property.value()); 969 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, underline, (CSSPrimitiveValue::createIdentifier(CSSValueUnderline))); 970 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, lineThrough, (CSSPrimitiveValue::createIdentifier(CSSValueLineThrough))); 971 // Because style is new style to be applied, we delete element only if the element is not used in style. 972 if (!valueList->hasValue(underline.get()) && elem->hasLocalName(uTag)) 973 return true; 974 if (!valueList->hasValue(lineThrough.get()) && (elem->hasLocalName(strikeTag) || elem->hasLocalName(sTag))) 975 return true; 976 } else { 977 // If the value is NOT a list, then it must be "none", in which case we should remove all text decorations. 978 ASSERT(property.value()->cssText() == "none"); 979 if (elem->hasLocalName(uTag) || elem->hasLocalName(strikeTag) || elem->hasLocalName(sTag)) 980 return true; 981 } 982 break; 965 983 } 966 984 }
Note: See TracChangeset
for help on using the changeset viewer.