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

Side by Side Diff: third_party/WebKit/Source/core/editing/CompositionUnderline.cpp

Issue 2650113004: [WIP] Add support for Android SuggestionSpans when editing text (Closed)
Patch Set: Uploading the latest version from my repo so I can reference it Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/editing/CompositionUnderline.h" 5 #include "core/editing/CompositionUnderline.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 CompositionUnderline::CompositionUnderline(unsigned startOffset, 9 CompositionUnderline::CompositionUnderline(unsigned startOffset,
10 unsigned endOffset, 10 unsigned endOffset,
11 const Color& color, 11 const Color& color,
12 bool thick, 12 bool thick,
13 const Color& backgroundColor) 13 const Color& backgroundColor)
14 : m_color(color), m_thick(thick), m_backgroundColor(backgroundColor) { 14 : CompositionUnderline(startOffset,
15 endOffset,
16 color,
17 thick,
18 backgroundColor,
19 Vector<String>()) {}
20
21 CompositionUnderline::CompositionUnderline(unsigned startOffset,
22 unsigned endOffset,
23 const Color& color,
24 bool thick,
25 const Color& backgroundColor,
26 const Vector<String>& suggestions)
27 : m_color(color),
28 m_thick(thick),
29 m_backgroundColor(backgroundColor),
30 m_suggestions(suggestions) {
15 // Sanitize offsets by ensuring a valid range corresponding to the last 31 // Sanitize offsets by ensuring a valid range corresponding to the last
16 // possible position. 32 // possible position.
17 // TODO(wkorman): Consider replacing with DCHECK_LT(startOffset, endOffset). 33 // TODO(wkorman): Consider replacing with DCHECK_LT(startOffset, endOffset).
18 m_startOffset = 34 m_startOffset =
19 std::min(startOffset, std::numeric_limits<unsigned>::max() - 1u); 35 std::min(startOffset, std::numeric_limits<unsigned>::max() - 1u);
20 m_endOffset = std::max(m_startOffset + 1u, endOffset); 36 m_endOffset = std::max(m_startOffset + 1u, endOffset);
21 } 37 }
22 38
23 } // namespace blink 39 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/CompositionUnderline.h ('k') | third_party/WebKit/Source/core/editing/Editor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698