Changeset 151772 in webkit
- Timestamp:
- Jun 20, 2013 12:39:43 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r151766 r151772 1 2013-06-20 Grzegorz Czajkowski <g.czajkowski@samsung.com> 2 3 background-color and text-decoration are not preserved when merging paragraphs 4 https://bugs.webkit.org/show_bug.cgi?id=116215 5 6 Reviewed by Ryosuke Niwa. 7 8 Added tests for verifying merge of paragraph/div from span with non-inline styles. 9 10 * editing/deleting/merge-div-from-span-with-style-expected.txt: Added. 11 * editing/deleting/merge-div-from-span-with-style.html: Added. 12 * editing/deleting/merge-paragraph-from-span-with-multiple-text-decoration-expected.txt: Added. 13 * editing/deleting/merge-paragraph-from-span-with-multiple-text-decoration.html: Added. 14 * editing/deleting/merge-paragraph-from-span-with-style-expected.txt: Added. 15 * editing/deleting/merge-paragraph-from-span-with-style.html: Added. 16 1 17 2013-06-19 Beth Dakin <bdakin@apple.com> 2 18 -
trunk/Source/WebCore/ChangeLog
r151771 r151772 1 2013-06-20 Grzegorz Czajkowski <g.czajkowski@samsung.com> 2 3 background-color and text-decoration are not preserved when merging paragraphs 4 https://bugs.webkit.org/show_bug.cgi?id=116215 5 6 Reviewed by Ryosuke Niwa. 7 8 In mergeInlineAndImplicitStyleOfElement(), style from matched rules are retrieved. 9 If they contain either background-color or text-decoration they will be removed 10 by removeNonEditingProperties() due to copyEditingProperties() implicit 11 'OnlyInheritableEditingProperties' parameter. 12 We have already had similar issue at https://bugs.webkit.org/show_bug.cgi?id=53196 13 14 Tests: editing/deleting/merge-div-from-span-with-style.html 15 editing/deleting/merge-paragraph-from-span-with-multiple-text-decoration.html 16 editing/deleting/merge-paragraph-from-span-with-style.html 17 18 * editing/EditingStyle.cpp: 19 (WebCore::copyEditingProperties): 20 (WebCore::editingStyleFromComputedStyle): 21 Add EditingStyle:: due to move EditingPropertiesToInclude to EditingStyle.h. 22 23 (WebCore::toEditingProperties): 24 Add a helper to easy convert PropertiesToInclude to EditingPropertiesToInclude, 25 needed in mergeInlineAndImplicitStyleOfElement(). 26 27 (WebCore::EditingStyle::removeAllButEditingProperties): 28 Add a parameter to choose which editing properties should be preserved while 29 removing all properties (OnlyInheritableEditingProperties implicite). 30 31 (WebCore::EditingStyle::mergeInlineAndImplicitStyleOfElement): 32 Call removeAllButEditingProperties with parameter. 33 34 * editing/EditingStyle.h: 35 Move EditingPropertiesType to the header as it's needed by removeAllButEditingProperties(). 36 Change EditingPropertiesType to EditingPropertiesToInclude to be consistent with 37 PropertiesToInclude. 38 Change removeNonEditingProperties() to removeAllButEditingProperties(). 39 1 40 2013-06-19 Christophe Dumez <ch.dumez@sisa.samsung.com> 2 41 -
trunk/Source/WebCore/editing/EditingStyle.cpp
r151754 r151772 84 84 }; 85 85 86 enum EditingPropertiesType { OnlyInheritableEditingProperties, AllEditingProperties };87 88 86 template <class StyleDeclarationType> 89 static PassRefPtr<MutableStylePropertySet> copyEditingProperties(StyleDeclarationType* style, Editing PropertiesType type =OnlyInheritableEditingProperties)90 { 91 if (type == AllEditingProperties)87 static PassRefPtr<MutableStylePropertySet> copyEditingProperties(StyleDeclarationType* style, EditingStyle::EditingPropertiesToInclude type = EditingStyle::OnlyInheritableEditingProperties) 88 { 89 if (type == EditingStyle::AllEditingProperties) 92 90 return style->copyPropertiesInSet(editingProperties, WTF_ARRAY_LENGTH(editingProperties)); 93 91 return style->copyPropertiesInSet(editingProperties + 2, WTF_ARRAY_LENGTH(editingProperties) - 2); … … 103 101 } 104 102 105 static PassRefPtr<MutableStylePropertySet> editingStyleFromComputedStyle(PassRefPtr<Node> node, Editing PropertiesType type =OnlyInheritableEditingProperties)103 static PassRefPtr<MutableStylePropertySet> editingStyleFromComputedStyle(PassRefPtr<Node> node, EditingStyle::EditingPropertiesToInclude type = EditingStyle::OnlyInheritableEditingProperties) 106 104 { 107 105 ComputedStyleExtractor computedStyle(node); … … 117 115 { 118 116 return computedStyle->propertyValue(propertyID); 117 } 118 119 static inline EditingStyle::EditingPropertiesToInclude toEditingProperties(EditingStyle::PropertiesToInclude properties) 120 { 121 switch (properties) { 122 case EditingStyle::AllProperties: 123 case EditingStyle::EditingPropertiesInEffect: 124 return EditingStyle::AllEditingProperties; 125 case EditingStyle::OnlyEditingInheritableProperties: 126 return EditingStyle::OnlyInheritableEditingProperties; 127 } 128 129 ASSERT_NOT_REACHED(); 130 return EditingStyle::OnlyInheritableEditingProperties; 119 131 } 120 132 … … 609 621 } 610 622 611 void EditingStyle::remove NonEditingProperties()623 void EditingStyle::removeAllButEditingProperties(EditingPropertiesToInclude propertiesToInclude) 612 624 { 613 625 if (m_mutableStyle) 614 m_mutableStyle = copyEditingProperties(m_mutableStyle.get() );626 m_mutableStyle = copyEditingProperties(m_mutableStyle.get(), propertiesToInclude); 615 627 } 616 628 … … 975 987 RefPtr<EditingStyle> styleFromRules = EditingStyle::create(); 976 988 styleFromRules->mergeStyleFromRulesForSerialization(element); 977 styleFromRules->remove NonEditingProperties();989 styleFromRules->removeAllButEditingProperties(toEditingProperties(propertiesToInclude)); 978 990 mergeStyle(styleFromRules->m_mutableStyle.get(), mode); 979 991 -
trunk/Source/WebCore/editing/EditingStyle.h
r150960 r151772 64 64 65 65 enum PropertiesToInclude { AllProperties, OnlyEditingInheritableProperties, EditingPropertiesInEffect }; 66 enum EditingPropertiesToInclude { OnlyInheritableEditingProperties, AllEditingProperties }; 67 66 68 enum ShouldPreserveWritingDirection { PreserveWritingDirection, DoNotPreserveWritingDirection }; 67 69 enum ShouldExtractMatchingStyle { ExtractMatchingStyle, DoNotExtractMatchingStyle }; … … 107 109 void removeStyleAddedByNode(Node*); 108 110 void removeStyleConflictingWithStyleOfNode(Node*); 109 void remove NonEditingProperties();111 void removeAllButEditingProperties(EditingPropertiesToInclude = OnlyInheritableEditingProperties); 110 112 void collapseTextDecorationProperties(); 111 113 enum ShouldIgnoreTextOnlyProperties { IgnoreTextOnlyProperties, DoNotIgnoreTextOnlyProperties };
Note: See TracChangeset
for help on using the changeset viewer.