Chromium Code Reviews| OLD | NEW |
|---|---|
| 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(const WebCompositionUnderline& u) | |
|
haraken
2017/04/20 07:25:50
Nit: u => underline
Blink prefers a fully qualifi
slangley
2017/04/21 00:07:15
Done
| |
| 26 : CompositionUnderline(u.start_offset, | |
| 27 u.end_offset, | |
| 28 Color(u.color), | |
| 29 u.thick, | |
| 30 Color(u.background_color)) {} | |
| 23 } // namespace blink | 31 } // namespace blink |
| OLD | NEW |