Chromium Code Reviews| Index: Source/core/editing/InputMethodController.h |
| diff --git a/Source/core/editing/InputMethodController.h b/Source/core/editing/InputMethodController.h |
| index 571bd41c01fa7c92c76d9913332f32406b047976..8a8f8f0677ff59bc32b295c230b20bf18cb90fab 100644 |
| --- a/Source/core/editing/InputMethodController.h |
| +++ b/Source/core/editing/InputMethodController.h |
| @@ -27,6 +27,7 @@ |
| #define InputMethodController_h |
| #include "core/CoreExport.h" |
| +#include "core/dom/Range.h" |
| #include "core/editing/CompositionUnderline.h" |
| #include "core/editing/EphemeralRange.h" |
| #include "core/editing/PlainTextRange.h" |
| @@ -73,11 +74,20 @@ public: |
| PassRefPtrWillBeRawPtr<Range> compositionRange() const; |
| // getting international text input composition state (for use by InlineTextBox) |
| - Text* compositionNode() const { return m_compositionNode.get(); } |
| - unsigned compositionStart() const { return m_compositionStart; } |
| - unsigned compositionEnd() const { return m_compositionEnd; } |
| - bool compositionUsesCustomUnderlines() const { return !m_customCompositionUnderlines.isEmpty(); } |
| - const Vector<CompositionUnderline>& customCompositionUnderlines() const { return m_customCompositionUnderlines; } |
| + bool isCompositionNode(const Node*); |
| + unsigned compositionStart() const { return m_compositionRange.get() ? m_compositionRange->startOffset() : 0; } |
| + unsigned compositionEnd() const { return m_compositionRange.get() ? m_compositionRange->endOffset() : 0; } |
| + bool compositionUsesCustomUnderlines() const { return !m_customCompositionUnderlines.empty(); } |
| + // TODO: This method is called only by WebViewImpl::compositionUnderlines(). |
|
yosin_UTC9
2015/08/31 01:35:40
nit: s/TODO/TODO(aelias)/
|
| + // WebViewImpl::compositionUnderlines() is called only by tests. |
| + // Underlines are associated with a specific node, and composition |
| + // region can cover multiple nodes now. This method does not really |
| + // make sense since it does not specify a node explicitly. To be |
| + // compatible with current tests this method just returns the underlines |
| + // for the start node. This method and WebViewImpl::compositionUnderlines() |
| + // should be removed once we re-write relevant tests. |
| + const Vector<CompositionUnderline>& customCompositionUnderlines() const; |
| + const Vector<CompositionUnderline>* customCompositionUnderlines(const Node*) const; |
| void clear(); |
| @@ -100,13 +110,10 @@ private: |
| friend class SelectionOffsetsScope; |
| RawPtrWillBeMember<LocalFrame> m_frame; |
| - RefPtrWillBeMember<Text> m_compositionNode; |
| - // We don't use PlainTextRange which is immutable, for composition range. |
| - unsigned m_compositionStart; |
| - unsigned m_compositionEnd; |
| - // startOffset and endOffset of CompositionUnderline are based on |
| - // m_compositionNode. |
| - Vector<CompositionUnderline> m_customCompositionUnderlines; |
| + RefPtrWillBeMember<Range> m_compositionRange; |
| + typedef std::map<const Node*, std::pair<RefPtrWillBeMember<Node>, Vector<CompositionUnderline>>> NodeUnderlinesMap; |
|
yosin_UTC9
2015/08/31 01:35:40
nit: We should use WTF::HashMap. Both, key(const N
yosin_UTC9
2015/08/31 01:35:40
I think we should have struct with DEFINE_TRACE()
|
| + mutable NodeUnderlinesMap m_customCompositionUnderlines; |
| + bool m_isExistingText; |
| explicit InputMethodController(LocalFrame&); |