Changeset 73416 in webkit
- Timestamp:
- Dec 6, 2010 5:00:23 PM (13 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r73411 r73416 1 2010-12-06 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Tony Chang. 4 5 ApplyStyleCommand should take EditingStyle instead of CSSStyleDeclaration 6 https://bugs.webkit.org/show_bug.cgi?id=49938 7 8 Modified ApplyStyleCommand::ApplyStyleCommand and ApplyStyleCommand::create to take EditingStyle* 9 instead of CSSStyleDeclaration*. Also replaced much of code in Editor::computeAndSetTypingStyle 10 by calls to EditingStyle's member functions and extracted EditingStyle::overrideWith and 11 EditingStyle::extractAndRemoveBlockProperties. 12 13 No new tests are added since this is a refactoring. 14 15 * WebCore.exp.in: Added SelectionController::copyTypingStyle and EditingStyle::~EditingStyle. 16 * css/CSSMutableStyleDeclaration.cpp: Made CSSMutableStyleDeclaration* in the argument list const. 17 (WebCore::CSSMutableStyleDeclaration::merge): 18 * css/CSSMutableStyleDeclaration.h: 19 * editing/ApplyStyleCommand.cpp: 20 (WebCore::ApplyStyleCommand::ApplyStyleCommand): Takes EditingStyle* instead of CSSStyleDeclaration*. 21 (WebCore::ApplyStyleCommand::doApply): Uses EditingStyle. 22 * editing/ApplyStyleCommand.h: m_style is now a ref-pointer to EditingStyle instead of CSSMutableStyleDeclaration. 23 (WebCore::ApplyStyleCommand::create): Takes EditingStyle* instead of CSSStyleDeclaration*. 24 * editing/CompositeEditCommand.cpp: 25 (WebCore::CompositeEditCommand::applyStyle): Ditto. 26 (WebCore::CompositeEditCommand::moveParagraphs): Calls applyStyle. 27 (WebCore::CompositeEditCommand::breakOutOfEmptyListItem): Ditto. 28 * editing/CompositeEditCommand.h: 29 * editing/DeleteSelectionCommand.cpp: 30 (WebCore::DeleteSelectionCommand::calculateTypingStyleAfterDelete): Ditto. 31 * editing/EditCommand.cpp: 32 * editing/EditCommand.h: 33 * editing/EditingStyle.cpp: 34 (WebCore::EditingStyle::~EditingStyle): Added. 35 (WebCore::EditingStyle::overrideWithStyle): Extracted from Editor::calculateTypingStyleAfterDelete. 36 (WebCore::EditingStyle::copy): Added. 37 (WebCore::EditingStyle::extractAndRemoveBlockProperties): Extracted from Editor::calculateTypingStyleAfterDelete. 38 * editing/EditingStyle.h: 39 * editing/Editor.cpp: 40 (WebCore::Editor::applyStyle): Calls ApplyStyleCommand::create. 41 (WebCore::Editor::applyParagraphStyle): Ditto. 42 (WebCore::Editor::computeAndSetTypingStyle): Ditto. 43 * editing/InsertLineBreakCommand.cpp: 44 (WebCore::InsertLineBreakCommand::doApply): Calls applyStyle. 45 * editing/InsertParagraphSeparatorCommand.cpp: 46 (WebCore::InsertParagraphSeparatorCommand::applyStyleAfterInsertion): Ditto. 47 * editing/InsertTextCommand.cpp: 48 (WebCore::InsertTextCommand::input): Ditto. 49 * editing/RemoveFormatCommand.cpp: 50 (WebCore::RemoveFormatCommand::doApply): Calls ApplyStyleCommand::create. 51 * editing/ReplaceSelectionCommand.cpp: 52 (WebCore::ReplaceSelectionCommand::completeHTMLReplacement): Calls applyStyle. 53 * editing/SelectionController.cpp: 54 (WebCore::SelectionController::copyTypingStyle): Moved from SelectionController.h 55 * editing/SelectionController.h: 56 1 57 2010-12-05 Ryosuke Niwa <rniwa@webkit.org> 2 58 -
trunk/WebCore/WebCore.exp.in
r73337 r73416 211 211 __ZN7WebCore12ChromeClient20paintCustomScrollbarEPNS_15GraphicsContextERKNS_9FloatRectENS_20ScrollbarControlSizeEjNS_13ScrollbarPartEbffj 212 212 __ZN7WebCore12ChromeClient23paintCustomScrollCornerEPNS_15GraphicsContextERKNS_9FloatRectE 213 __ZN7WebCore12EditingStyleD1Ev 213 214 __ZN7WebCore12EventHandler10mouseMovedEP7NSEvent 214 215 __ZN7WebCore12EventHandler10mouseMovedERKNS_18PlatformMouseEventE … … 1032 1033 __ZNK7WebCore19ResourceRequestBase7isEmptyEv 1033 1034 __ZNK7WebCore19SelectionController11currentFormEv 1035 __ZNK7WebCore19SelectionController15copyTypingStyleEv 1034 1036 __ZNK7WebCore19SelectionController17isInPasswordFieldEv 1035 1037 __ZNK7WebCore19SelectionController18isFocusedAndActiveEv -
trunk/WebCore/css/CSSMutableStyleDeclaration.cpp
r72500 r73416 709 709 } 710 710 711 void CSSMutableStyleDeclaration::merge( CSSMutableStyleDeclaration* other, bool argOverridesOnConflict)711 void CSSMutableStyleDeclaration::merge(const CSSMutableStyleDeclaration* other, bool argOverridesOnConflict) 712 712 { 713 713 ASSERT(!m_iteratorCount); … … 715 715 unsigned size = other->m_properties.size(); 716 716 for (unsigned n = 0; n < size; ++n) { 717 CSSProperty& toMerge = other->m_properties[n];717 const CSSProperty& toMerge = other->m_properties[n]; 718 718 CSSProperty* old = findPropertyWithId(toMerge.id()); 719 719 if (old) { -
trunk/WebCore/css/CSSMutableStyleDeclaration.h
r72116 r73416 130 130 void removePropertiesInSet(const int* set, unsigned length, bool notifyChanged = true); 131 131 132 void merge( CSSMutableStyleDeclaration*, bool argOverridesOnConflict = true);132 void merge(const CSSMutableStyleDeclaration*, bool argOverridesOnConflict = true); 133 133 134 134 void setStrictParsing(bool b) { m_strictParsing = b; } -
trunk/WebCore/editing/ApplyStyleCommand.cpp
r72500 r73416 35 35 #include "CSSValueKeywords.h" 36 36 #include "Document.h" 37 #include "EditingStyle.h" 37 38 #include "Editor.h" 38 39 #include "Frame.h" … … 430 431 } 431 432 432 ApplyStyleCommand::ApplyStyleCommand(Document* document, CSSStyleDeclaration* style, EditAction editingAction, EPropertyLevel propertyLevel)433 ApplyStyleCommand::ApplyStyleCommand(Document* document, const EditingStyle* style, EditAction editingAction, EPropertyLevel propertyLevel) 433 434 : CompositeEditCommand(document) 434 , m_style(style-> makeMutable())435 , m_style(style->copy()) 435 436 , m_editingAction(editingAction) 436 437 , m_propertyLevel(propertyLevel) … … 444 445 } 445 446 446 ApplyStyleCommand::ApplyStyleCommand(Document* document, CSSStyleDeclaration* style, const Position& start, const Position& end, EditAction editingAction, EPropertyLevel propertyLevel)447 ApplyStyleCommand::ApplyStyleCommand(Document* document, const EditingStyle* style, const Position& start, const Position& end, EditAction editingAction, EPropertyLevel propertyLevel) 447 448 : CompositeEditCommand(document) 448 , m_style(style-> makeMutable())449 , m_style(style->copy()) 449 450 , m_editingAction(editingAction) 450 451 , m_propertyLevel(propertyLevel) … … 460 461 ApplyStyleCommand::ApplyStyleCommand(PassRefPtr<Element> element, bool removeOnly, EditAction editingAction) 461 462 : CompositeEditCommand(element->document()) 462 , m_style( CSSMutableStyleDeclaration::create())463 , m_style(EditingStyle::create()) 463 464 , m_editingAction(editingAction) 464 465 , m_propertyLevel(PropertyDefault) … … 472 473 } 473 474 474 ApplyStyleCommand::ApplyStyleCommand(Document* document, CSSStyleDeclaration* style, IsInlineElementToRemoveFunction isInlineElementToRemoveFunction, EditAction editingAction)475 ApplyStyleCommand::ApplyStyleCommand(Document* document, const EditingStyle* style, IsInlineElementToRemoveFunction isInlineElementToRemoveFunction, EditAction editingAction) 475 476 : CompositeEditCommand(document) 476 , m_style(style-> makeMutable())477 , m_style(style->copy()) 477 478 , m_editingAction(editingAction) 478 479 , m_propertyLevel(PropertyDefault) … … 517 518 { 518 519 switch (m_propertyLevel) { 519 case PropertyDefault: { 520 // apply the block-centric properties of the style 521 RefPtr<CSSMutableStyleDeclaration> blockStyle = m_style->copyBlockProperties(); 522 if (blockStyle->length()) 523 applyBlockStyle(blockStyle.get()); 524 // apply any remaining styles to the inline elements 525 // NOTE: hopefully, this string comparison is the same as checking for a non-null diff 526 if (blockStyle->length() < m_style->length() || m_styledInlineElement || m_isInlineElementToRemoveFunction) { 527 RefPtr<CSSMutableStyleDeclaration> inlineStyle = m_style->copy(); 528 applyRelativeFontStyleChange(inlineStyle.get()); 529 blockStyle->diff(inlineStyle.get()); 530 applyInlineStyle(inlineStyle.get()); 531 } 532 break; 533 } 534 case ForceBlockProperties: 535 // Force all properties to be applied as block styles. 536 applyBlockStyle(m_style.get()); 537 break; 520 case PropertyDefault: { 521 // Apply the block-centric properties of the style. 522 RefPtr<EditingStyle> blockStyle = m_style->extractAndRemoveBlockProperties(); 523 if (!blockStyle->isEmpty()) 524 applyBlockStyle(blockStyle->style()); 525 // Apply any remaining styles to the inline elements. 526 if (!m_style->isEmpty() || m_styledInlineElement || m_isInlineElementToRemoveFunction) { 527 RefPtr<CSSMutableStyleDeclaration> style = m_style->style() ? m_style->style() : CSSMutableStyleDeclaration::create(); 528 applyRelativeFontStyleChange(style.get()); 529 applyInlineStyle(style.get()); 530 } 531 break; 532 } 533 case ForceBlockProperties: 534 // Force all properties to be applied as block styles. 535 applyBlockStyle(m_style->style()); 536 break; 538 537 } 539 538 } -
trunk/WebCore/editing/ApplyStyleCommand.h
r71556 r73416 33 33 34 34 class CSSPrimitiveValue; 35 class EditingStyle; 35 36 class HTMLElement; 36 37 class StyleChange; … … 48 49 typedef bool (*IsInlineElementToRemoveFunction)(const Element*); 49 50 50 static PassRefPtr<ApplyStyleCommand> create(Document* document, CSSStyleDeclaration* style, EditAction action = EditActionChangeAttributes, EPropertyLevel level = PropertyDefault)51 static PassRefPtr<ApplyStyleCommand> create(Document* document, const EditingStyle* style, EditAction action = EditActionChangeAttributes, EPropertyLevel level = PropertyDefault) 51 52 { 52 53 return adoptRef(new ApplyStyleCommand(document, style, action, level)); 53 54 } 54 static PassRefPtr<ApplyStyleCommand> create(Document* document, CSSStyleDeclaration* style, const Position& start, const Position& end, EditAction action = EditActionChangeAttributes, EPropertyLevel level = PropertyDefault)55 static PassRefPtr<ApplyStyleCommand> create(Document* document, const EditingStyle* style, const Position& start, const Position& end, EditAction action = EditActionChangeAttributes, EPropertyLevel level = PropertyDefault) 55 56 { 56 57 return adoptRef(new ApplyStyleCommand(document, style, start, end, action, level)); … … 60 61 return adoptRef(new ApplyStyleCommand(element, removeOnly, action)); 61 62 } 62 static PassRefPtr<ApplyStyleCommand> create(Document* document, CSSStyleDeclaration* style, IsInlineElementToRemoveFunction isInlineElementToRemoveFunction, EditAction action = EditActionChangeAttributes)63 static PassRefPtr<ApplyStyleCommand> create(Document* document, const EditingStyle* style, IsInlineElementToRemoveFunction isInlineElementToRemoveFunction, EditAction action = EditActionChangeAttributes) 63 64 { 64 65 return adoptRef(new ApplyStyleCommand(document, style, isInlineElementToRemoveFunction, action)); … … 66 67 67 68 private: 68 ApplyStyleCommand(Document*, CSSStyleDeclaration*, EditAction, EPropertyLevel);69 ApplyStyleCommand(Document*, CSSStyleDeclaration*, const Position& start, const Position& end, EditAction, EPropertyLevel);69 ApplyStyleCommand(Document*, const EditingStyle*, EditAction, EPropertyLevel); 70 ApplyStyleCommand(Document*, const EditingStyle*, const Position& start, const Position& end, EditAction, EPropertyLevel); 70 71 ApplyStyleCommand(PassRefPtr<Element>, bool removeOnly, EditAction); 71 ApplyStyleCommand(Document*, CSSStyleDeclaration*, bool (*isInlineElementToRemove)(const Element*), EditAction);72 ApplyStyleCommand(Document*, const EditingStyle*, bool (*isInlineElementToRemove)(const Element*), EditAction); 72 73 73 74 virtual void doApply(); 74 75 virtual EditAction editingAction() const; 75 76 CSSMutableStyleDeclaration* style() const { return m_style.get(); }77 76 78 77 // style-removal helpers … … 120 119 Position endPosition(); 121 120 122 RefPtr< CSSMutableStyleDeclaration> m_style;121 RefPtr<EditingStyle> m_style; 123 122 EditAction m_editingAction; 124 123 EPropertyLevel m_propertyLevel; -
trunk/WebCore/editing/CompositeEditCommand.cpp
r73052 r73416 29 29 #include "AppendNodeCommand.h" 30 30 #include "ApplyStyleCommand.h" 31 #include "CSSComputedStyleDeclaration.h"32 #include "CSSMutableStyleDeclaration.h"33 31 #include "CharacterNames.h" 34 32 #include "DeleteFromTextNodeCommand.h" … … 106 104 } 107 105 108 void CompositeEditCommand::applyStyle( CSSStyleDeclaration* style, EditAction editingAction)106 void CompositeEditCommand::applyStyle(const EditingStyle* style, EditAction editingAction) 109 107 { 110 108 applyCommandToComposite(ApplyStyleCommand::create(document(), style, editingAction)); 111 109 } 112 110 113 void CompositeEditCommand::applyStyle( CSSStyleDeclaration* style, const Position& start, const Position& end, EditAction editingAction)111 void CompositeEditCommand::applyStyle(const EditingStyle* style, const Position& start, const Position& end, EditAction editingAction) 114 112 { 115 113 applyCommandToComposite(ApplyStyleCommand::create(document(), style, start, end, editingAction)); … … 984 982 bool selectionIsEmptyParagraph = endingSelection().isCaret() && isStartOfParagraph(endingSelection().visibleStart()) && isEndOfParagraph(endingSelection().visibleStart()); 985 983 if (styleInEmptyParagraph && selectionIsEmptyParagraph) 986 applyStyle(styleInEmptyParagraph ->style());984 applyStyle(styleInEmptyParagraph.get()); 987 985 988 986 if (preserveSelection && startIndex != -1) { … … 1057 1055 style->prepareToApplyAt(endingSelection().start()); 1058 1056 if (!style->isEmpty()) 1059 applyStyle(style ->style());1057 applyStyle(style.get()); 1060 1058 1061 1059 return true; -
trunk/WebCore/editing/CompositeEditCommand.h
r69868 r73416 34 34 35 35 class CSSStyleDeclaration; 36 class EditingStyle; 36 37 class HTMLElement; 37 38 class StyledElement; … … 52 53 void appendNode(PassRefPtr<Node>, PassRefPtr<Element> parent); 53 54 void applyCommandToComposite(PassRefPtr<EditCommand>); 54 void applyStyle( CSSStyleDeclaration*, EditAction = EditActionChangeAttributes);55 void applyStyle( CSSStyleDeclaration*, const Position& start, const Position& end, EditAction = EditActionChangeAttributes);55 void applyStyle(const EditingStyle*, EditAction = EditActionChangeAttributes); 56 void applyStyle(const EditingStyle*, const Position& start, const Position& end, EditAction = EditActionChangeAttributes); 56 57 void applyStyledElement(PassRefPtr<Element>); 57 58 void removeStyledElement(PassRefPtr<Element>); -
trunk/WebCore/editing/DeleteSelectionCommand.cpp
r72777 r73416 692 692 693 693 setEndingSelection(visibleEnd); 694 applyStyle(m_typingStyle ->style(), EditActionUnspecified);694 applyStyle(m_typingStyle.get(), EditActionUnspecified); 695 695 // applyStyle can destroy the placeholder that was at m_endingPosition if it needs to 696 696 // move it, but it will set an endingSelection() at [movedPlaceholder, 0] if it does so. -
trunk/WebCore/editing/EditCommand.cpp
r58551 r73416 28 28 29 29 #include "CompositeEditCommand.h" 30 #include "CSSComputedStyleDeclaration.h"31 #include "CSSMutableStyleDeclaration.h"32 30 #include "DeleteButtonController.h" 33 31 #include "Document.h" -
trunk/WebCore/editing/EditCommand.h
r58551 r73416 34 34 35 35 class CompositeEditCommand; 36 class CSSMutableStyleDeclaration;37 36 38 37 class EditCommand : public RefCounted<EditCommand> { -
trunk/WebCore/editing/EditingStyle.cpp
r72573 r73416 104 104 } 105 105 106 EditingStyle::~EditingStyle() 107 { 108 } 109 106 110 void EditingStyle::init(Node* node) 107 111 { … … 178 182 } 179 183 184 void EditingStyle::overrideWithStyle(const CSSMutableStyleDeclaration* style) 185 { 186 if (!style || !style->length()) 187 return; 188 if (!m_mutableStyle) 189 m_mutableStyle = CSSMutableStyleDeclaration::create(); 190 m_mutableStyle->merge(style); 191 } 192 180 193 void EditingStyle::clear() 181 194 { 182 195 m_mutableStyle.clear(); 183 196 m_shouldUseFixedDefaultFontSize = false; 197 } 198 199 PassRefPtr<EditingStyle> EditingStyle::copy() const 200 { 201 RefPtr<EditingStyle> copy = EditingStyle::create(); 202 if (m_mutableStyle) 203 copy->m_mutableStyle = m_mutableStyle->copy(); 204 copy->m_shouldUseFixedDefaultFontSize = m_shouldUseFixedDefaultFontSize; 205 return copy; 206 } 207 208 PassRefPtr<EditingStyle> EditingStyle::extractAndRemoveBlockProperties() 209 { 210 RefPtr<EditingStyle> blockProperties = EditingStyle::create(); 211 if (!m_mutableStyle) 212 return blockProperties; 213 214 blockProperties->m_mutableStyle = m_mutableStyle->copyBlockProperties(); 215 m_mutableStyle->removeBlockProperties(); 216 217 return blockProperties; 184 218 } 185 219 -
trunk/WebCore/editing/EditingStyle.h
r72573 r73416 32 32 #define EditingStyle_h 33 33 34 #include "CSSMutableStyleDeclaration.h"35 34 #include "Document.h" 36 35 #include "Position.h" … … 40 39 class CSSStyleDeclaration; 41 40 class CSSComputedStyleDeclaration; 41 class CSSMutableStyleDeclaration; 42 42 43 43 enum WritingDirection { NaturalWritingDirection, LeftToRightWritingDirection, RightToLeftWritingDirection }; … … 68 68 } 69 69 70 ~EditingStyle(); 71 70 72 CSSMutableStyleDeclaration* style() { return m_mutableStyle.get(); } 71 73 bool textDirection(WritingDirection&) const; 72 74 bool isEmpty() const; 73 75 void setStyle(PassRefPtr<CSSMutableStyleDeclaration>); 76 void overrideWithStyle(const CSSMutableStyleDeclaration*); 74 77 void clear(); 78 PassRefPtr<EditingStyle> copy() const; 79 PassRefPtr<EditingStyle> extractAndRemoveBlockProperties(); 75 80 void removeBlockProperties(); 76 void removeStyleAddedByNode(Node* node);77 void removeStyleConflictingWithStyleOfNode(Node* node);81 void removeStyleAddedByNode(Node*); 82 void removeStyleConflictingWithStyleOfNode(Node*); 78 83 void removeNonEditingProperties(); 79 84 void prepareToApplyAt(const Position&, ShouldPreserveWritingDirection = DoNotPreserveWritingDirection); -
trunk/WebCore/editing/Editor.cpp
r73337 r73416 893 893 case VisibleSelection::RangeSelection: 894 894 if (style) 895 applyCommand(ApplyStyleCommand::create(m_frame->document(), style, editingAction));895 applyCommand(ApplyStyleCommand::create(m_frame->document(), EditingStyle::create(style).get(), editingAction)); 896 896 break; 897 897 } … … 912 912 case VisibleSelection::RangeSelection: 913 913 if (style) 914 applyCommand(ApplyStyleCommand::create(m_frame->document(), style, editingAction, ApplyStyleCommand::ForceBlockProperties));914 applyCommand(ApplyStyleCommand::create(m_frame->document(), EditingStyle::create(style).get(), editingAction, ApplyStyleCommand::ForceBlockProperties)); 915 915 break; 916 916 } … … 3087 3087 3088 3088 // Calculate the current typing style. 3089 RefPtr<CSSMutableStyleDeclaration> mutableStyle = style->makeMutable(); 3090 RefPtr<EditingStyle> typingStyle = m_frame->selection()->typingStyle(); 3091 if (typingStyle && typingStyle->style()) { 3092 typingStyle->style()->merge(mutableStyle.get()); 3093 mutableStyle = typingStyle->style(); 3094 } 3095 3096 RefPtr<CSSValue> unicodeBidi; 3097 RefPtr<CSSValue> direction; 3098 if (editingAction == EditActionSetWritingDirection) { 3099 unicodeBidi = mutableStyle->getPropertyCSSValue(CSSPropertyUnicodeBidi); 3100 direction = mutableStyle->getPropertyCSSValue(CSSPropertyDirection); 3101 } 3102 3103 Node* node = m_frame->selection()->selection().visibleStart().deepEquivalent().node(); 3104 computedStyle(node)->diff(mutableStyle.get()); 3105 3106 if (editingAction == EditActionSetWritingDirection && unicodeBidi) { 3107 ASSERT(unicodeBidi->isPrimitiveValue()); 3108 mutableStyle->setProperty(CSSPropertyUnicodeBidi, static_cast<CSSPrimitiveValue*>(unicodeBidi.get())->getIdent()); 3109 if (direction) { 3110 ASSERT(direction->isPrimitiveValue()); 3111 mutableStyle->setProperty(CSSPropertyDirection, static_cast<CSSPrimitiveValue*>(direction.get())->getIdent()); 3112 } 3113 } 3089 RefPtr<EditingStyle> typingStyle; 3090 if (m_frame->selection()->typingStyle()) { 3091 typingStyle = m_frame->selection()->typingStyle()->copy(); 3092 typingStyle->overrideWithStyle(style->makeMutable().get()); 3093 } else 3094 typingStyle = EditingStyle::create(style); 3095 3096 typingStyle->prepareToApplyAt(m_frame->selection()->selection().visibleStart().deepEquivalent(), EditingStyle::PreserveWritingDirection); 3114 3097 3115 3098 // Handle block styles, substracting these from the typing style. 3116 RefPtr<CSSMutableStyleDeclaration> blockStyle = mutableStyle->copyBlockProperties(); 3117 blockStyle->diff(mutableStyle.get()); 3118 if (blockStyle->length() > 0) 3099 RefPtr<EditingStyle> blockStyle = typingStyle->extractAndRemoveBlockProperties(); 3100 if (!blockStyle->isEmpty()) 3119 3101 applyCommand(ApplyStyleCommand::create(m_frame->document(), blockStyle.get(), editingAction)); 3120 3102 3121 3103 // Set the remaining style as the typing style. 3122 m_frame->selection()->setTypingStyle( EditingStyle::create(mutableStyle.get()));3104 m_frame->selection()->setTypingStyle(typingStyle); 3123 3105 } 3124 3106 -
trunk/WebCore/editing/InsertLineBreakCommand.cpp
r72573 r73416 173 173 // FIXME: We shouldn't always apply the typing style to the line break here, 174 174 // see <rdar://problem/5794462>. 175 applyStyle(typingStyle ->style(), firstDeepEditingPositionForNode(nodeToInsert.get()), lastDeepEditingPositionForNode(nodeToInsert.get()));175 applyStyle(typingStyle.get(), firstDeepEditingPositionForNode(nodeToInsert.get()), lastDeepEditingPositionForNode(nodeToInsert.get())); 176 176 // Even though this applyStyle operates on a Range, it still sets an endingSelection(). 177 177 // It tries to set a VisibleSelection around the content it operated on. So, that VisibleSelection -
trunk/WebCore/editing/InsertParagraphSeparatorCommand.cpp
r71556 r73416 99 99 m_style->prepareToApplyAt(endingSelection().start()); 100 100 if (!m_style->isEmpty()) 101 applyStyle(m_style ->style());101 applyStyle(m_style.get()); 102 102 } 103 103 -
trunk/WebCore/editing/InsertTextCommand.cpp
r72573 r73416 194 194 typingStyle->prepareToApplyAt(endPosition, EditingStyle::PreserveWritingDirection); 195 195 if (!typingStyle->isEmpty()) 196 applyStyle(typingStyle ->style());196 applyStyle(typingStyle.get()); 197 197 } 198 198 -
trunk/WebCore/editing/RemoveFormatCommand.cpp
r71556 r73416 88 88 RefPtr<EditingStyle> defaultStyle = EditingStyle::create(root); 89 89 90 applyCommandToComposite(ApplyStyleCommand::create(document(), defaultStyle ->style(), isElementForRemoveFormatCommand, editingAction()));90 applyCommandToComposite(ApplyStyleCommand::create(document(), defaultStyle.get(), isElementForRemoveFormatCommand, editingAction())); 91 91 } 92 92 -
trunk/WebCore/editing/ReplaceSelectionCommand.cpp
r71556 r73416 1144 1144 if (m_matchStyle) { 1145 1145 ASSERT(m_insertionStyle); 1146 applyStyle(m_insertionStyle ->style(), start, end);1146 applyStyle(m_insertionStyle.get(), start, end); 1147 1147 } 1148 1148 -
trunk/WebCore/editing/SelectionController.cpp
r72796 r73416 1591 1591 } 1592 1592 1593 PassRefPtr<CSSMutableStyleDeclaration> SelectionController::copyTypingStyle() const 1594 { 1595 if (!m_typingStyle || !m_typingStyle->style()) 1596 return 0; 1597 return m_typingStyle->style()->copy(); 1598 } 1599 1593 1600 bool SelectionController::shouldDeleteSelection(const VisibleSelection& selection) const 1594 1601 { -
trunk/WebCore/editing/SelectionController.h
r72573 r73416 37 37 namespace WebCore { 38 38 39 class CSSMutableStyleDeclaration; 39 40 class Frame; 40 class CSSMutableStyleDeclaration;41 41 class GraphicsContext; 42 42 class HTMLFormElement; … … 240 240 } 241 241 242 inline PassRefPtr<CSSMutableStyleDeclaration> SelectionController::copyTypingStyle() const243 {244 if (!m_typingStyle || !m_typingStyle->style())245 return 0;246 return m_typingStyle->style()->copy();247 }248 249 242 inline void SelectionController::clearTypingStyle() 250 243 {
Note: See TracChangeset
for help on using the changeset viewer.