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

Unified Diff: third_party/WebKit/Source/core/layout/line/RootInlineBox.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/line/RootInlineBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp b/third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp
index 1fc5957e37eeea9caf5febd61acef00a710b64b0..82295b7c1bdec731c8f12b1da8186e5838694053 100644
--- a/third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp
+++ b/third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp
@@ -343,21 +343,26 @@ LayoutUnit RootInlineBox::BeforeAnnotationsAdjustment() const {
SelectionState RootInlineBox::GetSelectionState() const {
// Walk over all of the selected boxes.
- SelectionState state = SelectionNone;
+ SelectionState state = SelectionState::kNone;
for (InlineBox* box = FirstLeafChild(); box; box = box->NextLeafChild()) {
SelectionState box_state = box->GetSelectionState();
- if ((box_state == SelectionStart && state == SelectionEnd) ||
- (box_state == SelectionEnd && state == SelectionStart)) {
- state = SelectionBoth;
- } else if (state == SelectionNone ||
- ((box_state == SelectionStart || box_state == SelectionEnd) &&
- (state == SelectionNone || state == SelectionInside))) {
+ if ((box_state == SelectionState::kStart &&
+ state == SelectionState::kEnd) ||
+ (box_state == SelectionState::kEnd &&
+ state == SelectionState::kStart)) {
+ state = SelectionState::kStartAndEnd;
+ } else if (state == SelectionState::kNone ||
+ ((box_state == SelectionState::kStart ||
+ box_state == SelectionState::kEnd) &&
+ (state == SelectionState::kNone ||
+ state == SelectionState::kInside))) {
state = box_state;
- } else if (box_state == SelectionNone && state == SelectionStart) {
+ } else if (box_state == SelectionState::kNone &&
+ state == SelectionState::kStart) {
// We are past the end of the selection.
- state = SelectionBoth;
+ state = SelectionState::kStartAndEnd;
}
- if (state == SelectionBoth)
+ if (state == SelectionState::kStartAndEnd)
break;
}
@@ -366,7 +371,7 @@ SelectionState RootInlineBox::GetSelectionState() const {
InlineBox* RootInlineBox::FirstSelectedBox() const {
for (InlineBox* box = FirstLeafChild(); box; box = box->NextLeafChild()) {
- if (box->GetSelectionState() != SelectionNone)
+ if (box->GetSelectionState() != SelectionState::kNone)
return box;
}
@@ -375,7 +380,7 @@ InlineBox* RootInlineBox::FirstSelectedBox() const {
InlineBox* RootInlineBox::LastSelectedBox() const {
for (InlineBox* box = LastLeafChild(); box; box = box->PrevLeafChild()) {
- if (box->GetSelectionState() != SelectionNone)
+ if (box->GetSelectionState() != SelectionState::kNone)
return box;
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp ('k') | third_party/WebKit/Source/core/page/TouchAdjustment.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698