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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutText.cpp

Issue 2916493002: Make SelectionState enum class (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutText.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.cpp b/third_party/WebKit/Source/core/layout/LayoutText.cpp
index ced8ba292537473964df40d35a68c073bc72b135..961c32aa315b265a623098b5d9ed4a5dc99456b3 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp
@@ -1444,17 +1444,17 @@ void LayoutText::SetSelectionState(SelectionState state) {
LayoutObject::SetSelectionState(state);
if (CanUpdateSelectionOnRootLineBoxes()) {
- if (state == SelectionStart || state == SelectionEnd ||
- state == SelectionBoth) {
+ if (state == SelectionState::kStart || state == SelectionState::kEnd ||
+ state == SelectionState::kStartAndEnd) {
int start_pos, end_pos;
std::tie(start_pos, end_pos) = SelectionStartEnd();
- if (GetSelectionState() == SelectionStart) {
+ if (GetSelectionState() == SelectionState::kStart) {
end_pos = TextLength();
// to handle selection from end of text to end of line
if (start_pos && start_pos == end_pos)
start_pos = end_pos - 1;
- } else if (GetSelectionState() == SelectionEnd) {
+ } else if (GetSelectionState() == SelectionState::kEnd) {
start_pos = 0;
}
@@ -1465,7 +1465,7 @@ void LayoutText::SetSelectionState(SelectionState state) {
}
} else {
for (InlineTextBox* box = FirstTextBox(); box; box = box->NextTextBox()) {
- box->Root().SetHasSelectedChildren(state == SelectionInside);
+ box->Root().SetHasSelectedChildren(state == SelectionState::kInside);
}
}
}
@@ -1899,7 +1899,7 @@ LayoutRect LayoutText::LocalVisualRect() const {
LayoutRect LayoutText::LocalSelectionRect() const {
DCHECK(!NeedsLayout());
- if (GetSelectionState() == SelectionNone)
+ if (GetSelectionState() == SelectionState::kNone)
return LayoutRect();
LayoutBlock* cb = ContainingBlock();
if (!cb)
@@ -1908,15 +1908,15 @@ LayoutRect LayoutText::LocalSelectionRect() const {
// Now calculate startPos and endPos for painting selection.
// We include a selection while endPos > 0
int start_pos, end_pos;
- if (GetSelectionState() == SelectionInside) {
+ if (GetSelectionState() == SelectionState::kInside) {
// We are fully selected.
start_pos = 0;
end_pos = TextLength();
} else {
std::tie(start_pos, end_pos) = SelectionStartEnd();
- if (GetSelectionState() == SelectionStart)
+ if (GetSelectionState() == SelectionState::kStart)
end_pos = TextLength();
- else if (GetSelectionState() == SelectionEnd)
+ else if (GetSelectionState() == SelectionState::kEnd)
start_pos = 0;
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutReplaced.cpp ('k') | third_party/WebKit/Source/core/layout/api/SelectionState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698