Changeset 170296 in webkit
- Timestamp:
- Jun 23, 2014, 10:02:27 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r170295 r170296 1 2014-06-23 Antti Koivisto <antti@apple.com> 2 3 REGRESSION (r160908): Unable to unset bold while entering text 4 https://bugs.webkit.org/show_bug.cgi?id=134196 5 <rdar://problem/17051653> 6 7 Reviewed by Andreas Kling. 8 9 No test, this code path is used by some WK1 API clients only. 10 11 * editing/Editor.cpp: 12 (WebCore::Editor::styleForSelectionStart): 13 14 This needs to update the style before requesting the renderer. 15 16 * editing/Editor.h: 17 * editing/ios/EditorIOS.mm: 18 (WebCore::styleForSelectionStart): Deleted. 19 * editing/mac/EditorMac.mm: 20 (WebCore::styleForSelectionStart): Deleted. 21 22 Removed the duplicated functions, moved to Editor.cpp. 23 1 24 2014-06-23 Alex Christensen <achristensen@webkit.org> 2 25 -
trunk/Source/WebCore/editing/Editor.cpp
r169750 r170296 3645 3645 } 3646 3646 3647 #if PLATFORM(COCOA) 3648 // FIXME: This figures out the current style by inserting a <span>! 3649 RenderStyle* Editor::styleForSelectionStart(Frame* frame, Node *&nodeToRemove) 3650 { 3651 nodeToRemove = nullptr; 3652 3653 if (frame->selection().isNone()) 3654 return nullptr; 3655 3656 Position position = frame->selection().selection().visibleStart().deepEquivalent(); 3657 if (!position.isCandidate() || position.isNull()) 3658 return nullptr; 3659 3660 RefPtr<EditingStyle> typingStyle = frame->selection().typingStyle(); 3661 if (!typingStyle || !typingStyle->style()) 3662 return &position.deprecatedNode()->renderer()->style(); 3663 3664 RefPtr<Element> styleElement = frame->document()->createElement(spanTag, false); 3665 3666 String styleText = typingStyle->style()->asText() + " display: inline"; 3667 styleElement->setAttribute(styleAttr, styleText); 3668 3669 styleElement->appendChild(frame->document()->createEditingTextNode(""), ASSERT_NO_EXCEPTION); 3670 3671 position.deprecatedNode()->parentNode()->appendChild(styleElement, ASSERT_NO_EXCEPTION); 3672 3673 nodeToRemove = styleElement.get(); 3674 3675 frame->document()->updateStyleIfNeeded(); 3676 return styleElement->renderer() ? &styleElement->renderer()->style() : nullptr; 3677 } 3678 #endif 3679 3647 3680 } // namespace WebCore -
trunk/Source/WebCore/editing/Editor.h
r168664 r170296 490 490 PassRefPtr<DocumentFragment> createFragmentAndAddResources(NSAttributedString *); 491 491 void fillInUserVisibleForm(PasteboardURL&); 492 493 static RenderStyle* styleForSelectionStart(Frame* , Node *&nodeToRemove); 492 494 #endif 493 495 -
trunk/Source/WebCore/editing/ios/EditorIOS.mm
r169660 r170296 186 186 } 187 187 188 // FIXME: Copied from EditorMac. This should be shared between the two so that189 // the implementation does not differ.190 static RenderStyle* styleForSelectionStart(Frame* frame, Node *&nodeToRemove)191 {192 nodeToRemove = 0;193 194 if (frame->selection().isNone())195 return 0;196 197 Position position = frame->selection().selection().visibleStart().deepEquivalent();198 if (!position.isCandidate() || position.isNull())199 return 0;200 201 RefPtr<EditingStyle> typingStyle = frame->selection().typingStyle();202 if (!typingStyle || !typingStyle->style())203 return &position.deprecatedNode()->renderer()->style();204 205 RefPtr<Element> styleElement = frame->document()->createElement(spanTag, false);206 207 String styleText = typingStyle->style()->asText() + " display: inline";208 styleElement->setAttribute(styleAttr, styleText.impl());209 210 ExceptionCode ec = 0;211 styleElement->appendChild(frame->document()->createEditingTextNode(""), ec);212 ASSERT(!ec);213 214 position.deprecatedNode()->parentNode()->appendChild(styleElement, ec);215 ASSERT(!ec);216 217 nodeToRemove = styleElement.get();218 return styleElement->renderer() ? &styleElement->renderer()->style() : 0;219 }220 221 188 const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const 222 189 { -
trunk/Source/WebCore/editing/mac/EditorMac.mm
r168658 r170296 107 107 } 108 108 109 static RenderStyle* styleForSelectionStart(Frame* frame, Node *&nodeToRemove)110 {111 nodeToRemove = 0;112 113 if (frame->selection().isNone())114 return 0;115 116 Position position = frame->selection().selection().visibleStart().deepEquivalent();117 if (!position.isCandidate() || position.isNull())118 return 0;119 120 RefPtr<EditingStyle> typingStyle = frame->selection().typingStyle();121 if (!typingStyle || !typingStyle->style())122 return &position.deprecatedNode()->renderer()->style();123 124 RefPtr<Element> styleElement = frame->document()->createElement(spanTag, false);125 126 String styleText = typingStyle->style()->asText() + " display: inline";127 styleElement->setAttribute(styleAttr, styleText);128 129 styleElement->appendChild(frame->document()->createEditingTextNode(""), ASSERT_NO_EXCEPTION);130 131 position.deprecatedNode()->parentNode()->appendChild(styleElement, ASSERT_NO_EXCEPTION);132 133 nodeToRemove = styleElement.get();134 return styleElement->renderer() ? &styleElement->renderer()->style() : 0;135 }136 137 109 const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const 138 110 {
Note:
See TracChangeset
for help on using the changeset viewer.