| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "public/web/WebSelection.h" | 5 #include "public/web/WebSelection.h" |
| 6 | 6 |
| 7 #include "core/editing/SelectionType.h" | 7 #include "core/editing/SelectionType.h" |
| 8 #include "core/layout/compositing/CompositedSelection.h" | 8 #include "core/layout/compositing/CompositedSelection.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 static WebSelectionBound getWebSelectionBound(const CompositedSelection& selecti
on, bool isStart) | 12 static WebSelectionBound getWebSelectionBound(const CompositedSelection& selecti
on, bool isStart) |
| 13 { | 13 { |
| 14 ASSERT(selection.type != NoSelection); | 14 DCHECK_NE(selection.type, NoSelection); |
| 15 const CompositedSelectionBound& bound = isStart ? selection.start : selectio
n.end; | 15 const CompositedSelectionBound& bound = isStart ? selection.start : selectio
n.end; |
| 16 ASSERT(bound.layer); | 16 DCHECK(bound.layer); |
| 17 | 17 |
| 18 WebSelectionBound::Type type = WebSelectionBound::Caret; | 18 WebSelectionBound::Type type = WebSelectionBound::Caret; |
| 19 if (selection.type == RangeSelection) { | 19 if (selection.type == RangeSelection) { |
| 20 if (isStart) | 20 if (isStart) |
| 21 type = bound.isTextDirectionRTL ? WebSelectionBound::SelectionRight
: WebSelectionBound::SelectionLeft; | 21 type = bound.isTextDirectionRTL ? WebSelectionBound::SelectionRight
: WebSelectionBound::SelectionLeft; |
| 22 else | 22 else |
| 23 type = bound.isTextDirectionRTL ? WebSelectionBound::SelectionLeft :
WebSelectionBound::SelectionRight; | 23 type = bound.isTextDirectionRTL ? WebSelectionBound::SelectionLeft :
WebSelectionBound::SelectionRight; |
| 24 } | 24 } |
| 25 | 25 |
| 26 WebSelectionBound result(type); | 26 WebSelectionBound result(type); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 44 WebSelection::WebSelection(const WebSelection& other) | 44 WebSelection::WebSelection(const WebSelection& other) |
| 45 : m_selectionType(other.m_selectionType) | 45 : m_selectionType(other.m_selectionType) |
| 46 , m_start(other.m_start) | 46 , m_start(other.m_start) |
| 47 , m_end(other.m_end) | 47 , m_end(other.m_end) |
| 48 , m_isEditable(other.m_isEditable) | 48 , m_isEditable(other.m_isEditable) |
| 49 , m_isEmptyTextFormControl(other.m_isEmptyTextFormControl) | 49 , m_isEmptyTextFormControl(other.m_isEmptyTextFormControl) |
| 50 { | 50 { |
| 51 } | 51 } |
| 52 | 52 |
| 53 } // namespace blink | 53 } // namespace blink |
| OLD | NEW |