Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(952)

Unified Diff: Source/core/editing/InputMethodController.h

Issue 1325563002: Avoid style clobbering in setCompositionFromExistingText. (2nd land) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix end to refer to endPosition Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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&);
« no previous file with comments | « no previous file | Source/core/editing/InputMethodController.cpp » ('j') | Source/core/editing/InputMethodController.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698