Title: [170296] trunk/Source/WebCore
- Revision
- 170296
- Author
- [email protected]
- Date
- 2014-06-23 10:02:27 -0700 (Mon, 23 Jun 2014)
Log Message
REGRESSION (r160908): Unable to unset bold while entering text
https://bugs.webkit.org/show_bug.cgi?id=134196
<rdar://problem/17051653>
Reviewed by Andreas Kling.
No test, this code path is used by some WK1 API clients only.
* editing/Editor.cpp:
(WebCore::Editor::styleForSelectionStart):
This needs to update the style before requesting the renderer.
* editing/Editor.h:
* editing/ios/EditorIOS.mm:
(WebCore::styleForSelectionStart): Deleted.
* editing/mac/EditorMac.mm:
(WebCore::styleForSelectionStart): Deleted.
Removed the duplicated functions, moved to Editor.cpp.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (170295 => 170296)
--- trunk/Source/WebCore/ChangeLog 2014-06-23 16:39:13 UTC (rev 170295)
+++ trunk/Source/WebCore/ChangeLog 2014-06-23 17:02:27 UTC (rev 170296)
@@ -1,3 +1,26 @@
+2014-06-23 Antti Koivisto <[email protected]>
+
+ REGRESSION (r160908): Unable to unset bold while entering text
+ https://bugs.webkit.org/show_bug.cgi?id=134196
+ <rdar://problem/17051653>
+
+ Reviewed by Andreas Kling.
+
+ No test, this code path is used by some WK1 API clients only.
+
+ * editing/Editor.cpp:
+ (WebCore::Editor::styleForSelectionStart):
+
+ This needs to update the style before requesting the renderer.
+
+ * editing/Editor.h:
+ * editing/ios/EditorIOS.mm:
+ (WebCore::styleForSelectionStart): Deleted.
+ * editing/mac/EditorMac.mm:
+ (WebCore::styleForSelectionStart): Deleted.
+
+ Removed the duplicated functions, moved to Editor.cpp.
+
2014-06-23 Alex Christensen <[email protected]>
[iOS] Fix video in WebGL.
Modified: trunk/Source/WebCore/editing/Editor.cpp (170295 => 170296)
--- trunk/Source/WebCore/editing/Editor.cpp 2014-06-23 16:39:13 UTC (rev 170295)
+++ trunk/Source/WebCore/editing/Editor.cpp 2014-06-23 17:02:27 UTC (rev 170296)
@@ -3644,4 +3644,37 @@
return *m_frame.document();
}
+#if PLATFORM(COCOA)
+// FIXME: This figures out the current style by inserting a <span>!
+RenderStyle* Editor::styleForSelectionStart(Frame* frame, Node *&nodeToRemove)
+{
+ nodeToRemove = nullptr;
+
+ if (frame->selection().isNone())
+ return nullptr;
+
+ Position position = frame->selection().selection().visibleStart().deepEquivalent();
+ if (!position.isCandidate() || position.isNull())
+ return nullptr;
+
+ RefPtr<EditingStyle> typingStyle = frame->selection().typingStyle();
+ if (!typingStyle || !typingStyle->style())
+ return &position.deprecatedNode()->renderer()->style();
+
+ RefPtr<Element> styleElement = frame->document()->createElement(spanTag, false);
+
+ String styleText = typingStyle->style()->asText() + " display: inline";
+ styleElement->setAttribute(styleAttr, styleText);
+
+ styleElement->appendChild(frame->document()->createEditingTextNode(""), ASSERT_NO_EXCEPTION);
+
+ position.deprecatedNode()->parentNode()->appendChild(styleElement, ASSERT_NO_EXCEPTION);
+
+ nodeToRemove = styleElement.get();
+
+ frame->document()->updateStyleIfNeeded();
+ return styleElement->renderer() ? &styleElement->renderer()->style() : nullptr;
+}
+#endif
+
} // namespace WebCore
Modified: trunk/Source/WebCore/editing/Editor.h (170295 => 170296)
--- trunk/Source/WebCore/editing/Editor.h 2014-06-23 16:39:13 UTC (rev 170295)
+++ trunk/Source/WebCore/editing/Editor.h 2014-06-23 17:02:27 UTC (rev 170296)
@@ -489,6 +489,8 @@
PassRefPtr<DocumentFragment> createFragmentForImageResourceAndAddResource(PassRefPtr<ArchiveResource>);
PassRefPtr<DocumentFragment> createFragmentAndAddResources(NSAttributedString *);
void fillInUserVisibleForm(PasteboardURL&);
+
+ static RenderStyle* styleForSelectionStart(Frame* , Node *&nodeToRemove);
#endif
Frame& m_frame;
Modified: trunk/Source/WebCore/editing/ios/EditorIOS.mm (170295 => 170296)
--- trunk/Source/WebCore/editing/ios/EditorIOS.mm 2014-06-23 16:39:13 UTC (rev 170295)
+++ trunk/Source/WebCore/editing/ios/EditorIOS.mm 2014-06-23 17:02:27 UTC (rev 170296)
@@ -185,39 +185,6 @@
return true;
}
-// FIXME: Copied from EditorMac. This should be shared between the two so that
-// the implementation does not differ.
-static RenderStyle* styleForSelectionStart(Frame* frame, Node *&nodeToRemove)
-{
- nodeToRemove = 0;
-
- if (frame->selection().isNone())
- return 0;
-
- Position position = frame->selection().selection().visibleStart().deepEquivalent();
- if (!position.isCandidate() || position.isNull())
- return 0;
-
- RefPtr<EditingStyle> typingStyle = frame->selection().typingStyle();
- if (!typingStyle || !typingStyle->style())
- return &position.deprecatedNode()->renderer()->style();
-
- RefPtr<Element> styleElement = frame->document()->createElement(spanTag, false);
-
- String styleText = typingStyle->style()->asText() + " display: inline";
- styleElement->setAttribute(styleAttr, styleText.impl());
-
- ExceptionCode ec = 0;
- styleElement->appendChild(frame->document()->createEditingTextNode(""), ec);
- ASSERT(!ec);
-
- position.deprecatedNode()->parentNode()->appendChild(styleElement, ec);
- ASSERT(!ec);
-
- nodeToRemove = styleElement.get();
- return styleElement->renderer() ? &styleElement->renderer()->style() : 0;
-}
-
const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const
{
hasMultipleFonts = false;
Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (170295 => 170296)
--- trunk/Source/WebCore/editing/mac/EditorMac.mm 2014-06-23 16:39:13 UTC (rev 170295)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm 2014-06-23 17:02:27 UTC (rev 170296)
@@ -106,34 +106,6 @@
return true;
}
-static RenderStyle* styleForSelectionStart(Frame* frame, Node *&nodeToRemove)
-{
- nodeToRemove = 0;
-
- if (frame->selection().isNone())
- return 0;
-
- Position position = frame->selection().selection().visibleStart().deepEquivalent();
- if (!position.isCandidate() || position.isNull())
- return 0;
-
- RefPtr<EditingStyle> typingStyle = frame->selection().typingStyle();
- if (!typingStyle || !typingStyle->style())
- return &position.deprecatedNode()->renderer()->style();
-
- RefPtr<Element> styleElement = frame->document()->createElement(spanTag, false);
-
- String styleText = typingStyle->style()->asText() + " display: inline";
- styleElement->setAttribute(styleAttr, styleText);
-
- styleElement->appendChild(frame->document()->createEditingTextNode(""), ASSERT_NO_EXCEPTION);
-
- position.deprecatedNode()->parentNode()->appendChild(styleElement, ASSERT_NO_EXCEPTION);
-
- nodeToRemove = styleElement.get();
- return styleElement->renderer() ? &styleElement->renderer()->style() : 0;
-}
-
const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const
{
hasMultipleFonts = false;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes