Title: [141937] trunk/Source/WebCore
- Revision
- 141937
- Author
- [email protected]
- Date
- 2013-02-05 14:37:18 -0800 (Tue, 05 Feb 2013)
Log Message
Make baseWritingDirectionForSelectionStart available to all platforms in the Editor class.
https://bugs.webkit.org/show_bug.cgi?id=108977.
Reviewed by Ryosuke Niwa.
Now that baseWritingDirectionForSelectionStart doesn't use
platform specific type anymore, we can make it available for
all platforms. This way it can be used for iOS as well.
No new tests, no functionality change.
* editing/Editor.cpp:
(WebCore::Editor::baseWritingDirectionForSelectionStart): Added.
* editing/Editor.h: Moved from PLATFORM(MAC).
* editing/mac/EditorMac.mm: baseWritingDirectionForSelectionStart removed.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (141936 => 141937)
--- trunk/Source/WebCore/ChangeLog 2013-02-05 22:35:39 UTC (rev 141936)
+++ trunk/Source/WebCore/ChangeLog 2013-02-05 22:37:18 UTC (rev 141937)
@@ -1,3 +1,21 @@
+2013-02-05 Enrica Casucci <[email protected]>
+
+ Make baseWritingDirectionForSelectionStart available to all platforms in the Editor class.
+ https://bugs.webkit.org/show_bug.cgi?id=108977.
+
+ Reviewed by Ryosuke Niwa.
+
+ Now that baseWritingDirectionForSelectionStart doesn't use
+ platform specific type anymore, we can make it available for
+ all platforms. This way it can be used for iOS as well.
+
+ No new tests, no functionality change.
+
+ * editing/Editor.cpp:
+ (WebCore::Editor::baseWritingDirectionForSelectionStart): Added.
+ * editing/Editor.h: Moved from PLATFORM(MAC).
+ * editing/mac/EditorMac.mm: baseWritingDirectionForSelectionStart removed.
+
2013-02-05 Benjamin Poulain <[email protected]>
Avoid String->AtomicString conversion in Attr::childrenChanged()
Modified: trunk/Source/WebCore/editing/Editor.cpp (141936 => 141937)
--- trunk/Source/WebCore/editing/Editor.cpp 2013-02-05 22:35:39 UTC (rev 141936)
+++ trunk/Source/WebCore/editing/Editor.cpp 2013-02-05 22:37:18 UTC (rev 141937)
@@ -1316,6 +1316,39 @@
applyParagraphStyleToSelection(style.get(), EditActionSetWritingDirection);
}
+WritingDirection Editor::baseWritingDirectionForSelectionStart() const
+{
+ WritingDirection result = LeftToRightWritingDirection;
+
+ Position pos = m_frame->selection()->selection().visibleStart().deepEquivalent();
+ Node* node = pos.deprecatedNode();
+ if (!node)
+ return result;
+
+ RenderObject* renderer = node->renderer();
+ if (!renderer)
+ return result;
+
+ if (!renderer->isBlockFlow()) {
+ renderer = renderer->containingBlock();
+ if (!renderer)
+ return result;
+ }
+
+ RenderStyle* style = renderer->style();
+ if (!style)
+ return result;
+
+ switch (style->direction()) {
+ case LTR:
+ return LeftToRightWritingDirection;
+ case RTL:
+ return RightToLeftWritingDirection;
+ }
+
+ return result;
+}
+
void Editor::selectComposition()
{
RefPtr<Range> range = compositionRange();
Modified: trunk/Source/WebCore/editing/Editor.h (141936 => 141937)
--- trunk/Source/WebCore/editing/Editor.h 2013-02-05 22:35:39 UTC (rev 141936)
+++ trunk/Source/WebCore/editing/Editor.h 2013-02-05 22:37:18 UTC (rev 141937)
@@ -373,11 +373,11 @@
bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*);
void textWillBeDeletedInTextField(Element* input);
void textDidChangeInTextArea(Element*);
+ WritingDirection baseWritingDirectionForSelectionStart() const;
#if PLATFORM(MAC)
const SimpleFontData* fontForSelection(bool&) const;
NSDictionary* fontAttributesForSelectionStart() const;
- WritingDirection baseWritingDirectionForSelectionStart() const;
bool canCopyExcludingStandaloneImages();
void takeFindStringFromSelection();
void writeSelectionToPasteboard(const String& pasteboardName, const Vector<String>& pasteboardTypes);
Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (141936 => 141937)
--- trunk/Source/WebCore/editing/mac/EditorMac.mm 2013-02-05 22:35:39 UTC (rev 141936)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm 2013-02-05 22:37:18 UTC (rev 141937)
@@ -251,41 +251,6 @@
return result;
}
-WritingDirection Editor::baseWritingDirectionForSelectionStart() const
-{
- WritingDirection result = LeftToRightWritingDirection;
-
- Position pos = m_frame->selection()->selection().visibleStart().deepEquivalent();
- Node* node = pos.deprecatedNode();
- if (!node)
- return result;
-
- RenderObject* renderer = node->renderer();
- if (!renderer)
- return result;
-
- if (!renderer->isBlockFlow()) {
- renderer = renderer->containingBlock();
- if (!renderer)
- return result;
- }
-
- RenderStyle* style = renderer->style();
- if (!style)
- return result;
-
- switch (style->direction()) {
- case LTR:
- result = LeftToRightWritingDirection;
- break;
- case RTL:
- result = RightToLeftWritingDirection;
- break;
- }
-
- return result;
-}
-
bool Editor::canCopyExcludingStandaloneImages()
{
FrameSelection* selection = m_frame->selection();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes