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

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

Issue 2826373002: Move CompositionUnderlineVectorBuilder.* from web/ -> core/editing/. (Closed)
Patch Set: Change CompositionUnderlineVectorBuilder to have an explicit method to build a Vector, rather than … Created 3 years, 7 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 #include "public/web/WebCompositionUnderline.h"
8
7 namespace blink { 9 namespace blink {
8 10
9 CompositionUnderline::CompositionUnderline(unsigned start_offset, 11 CompositionUnderline::CompositionUnderline(unsigned start_offset,
10 unsigned end_offset, 12 unsigned end_offset,
11 const Color& color, 13 const Color& color,
12 bool thick, 14 bool thick,
13 const Color& background_color) 15 const Color& background_color)
14 : color_(color), thick_(thick), background_color_(background_color) { 16 : color_(color), thick_(thick), background_color_(background_color) {
15 // Sanitize offsets by ensuring a valid range corresponding to the last 17 // Sanitize offsets by ensuring a valid range corresponding to the last
16 // possible position. 18 // possible position.
17 // TODO(wkorman): Consider replacing with DCHECK_LT(startOffset, endOffset). 19 // TODO(wkorman): Consider replacing with DCHECK_LT(startOffset, endOffset).
18 start_offset_ = 20 start_offset_ =
19 std::min(start_offset, std::numeric_limits<unsigned>::max() - 1u); 21 std::min(start_offset, std::numeric_limits<unsigned>::max() - 1u);
20 end_offset_ = std::max(start_offset_ + 1u, end_offset); 22 end_offset_ = std::max(start_offset_ + 1u, end_offset);
21 } 23 }
22 24
25 CompositionUnderline::CompositionUnderline(
26 const WebCompositionUnderline& underline)
27 : CompositionUnderline(underline.start_offset,
28 underline.end_offset,
29 Color(underline.color),
30 underline.thick,
31 Color(underline.background_color)) {}
23 } // namespace blink 32 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698