Commit 4441dd83 authored by Shimi Zhang's avatar Shimi Zhang Committed by Commit Bot

add should_shrink_next_tap_ to SetSelectionOptions

This is for http://crrev.com/c/653432 [Smart Selection] Shrinking
selection after Smart Selection expansion.

Bug: 703884
Change-Id: Id32c5214f60de42bc3c9fd5abe5582c0f0aff7fa
Reviewed-on: https://chromium-review.googlesource.com/701422
Commit-Queue: Shimi Zhang <ctzsm@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506872}
parent fcc2a89e
......@@ -68,4 +68,10 @@ SetSelectionOptions::Builder& SetSelectionOptions::Builder::SetShouldShowHandle(
return *this;
}
SetSelectionOptions::Builder&
SetSelectionOptions::Builder::SetShouldShrinkNextTap(bool new_value) {
data_.should_shrink_next_tap_ = new_value;
return *this;
}
} // namespace blink
......@@ -34,6 +34,7 @@ class CORE_EXPORT SetSelectionOptions final {
bool ShouldClearTypingStyle() const { return should_clear_typing_style_; }
bool ShouldCloseTyping() const { return should_close_typing_; }
bool ShouldShowHandle() const { return should_show_handle_; }
bool ShouldShrinkNextTap() const { return should_shrink_next_tap_; }
private:
CursorAlignOnScroll cursor_align_on_scroll_ = CursorAlignOnScroll::kIfNeeded;
......@@ -44,6 +45,7 @@ class CORE_EXPORT SetSelectionOptions final {
bool should_clear_typing_style_ = false;
bool should_close_typing_ = false;
bool should_show_handle_ = false;
bool should_shrink_next_tap_ = false;
};
// This class is used for building |SelectionData| object.
......@@ -64,6 +66,7 @@ class CORE_EXPORT SetSelectionOptions::Builder final {
Builder& SetShouldClearTypingStyle(bool);
Builder& SetShouldCloseTyping(bool);
Builder& SetShouldShowHandle(bool);
Builder& SetShouldShrinkNextTap(bool);
private:
SetSelectionOptions data_;
......
......@@ -22,6 +22,7 @@ TEST_F(SetSelectionOptionsTest, DefaultValues) {
EXPECT_FALSE(options.ShouldClearTypingStyle());
EXPECT_FALSE(options.ShouldCloseTyping());
EXPECT_FALSE(options.ShouldShowHandle());
EXPECT_FALSE(options.ShouldShrinkNextTap());
}
TEST_F(SetSelectionOptionsTest, Setter) {
......@@ -34,7 +35,8 @@ TEST_F(SetSelectionOptionsTest, Setter) {
.SetSetSelectionBy(SetSelectionBy::kUser)
.SetShouldClearTypingStyle(true)
.SetShouldCloseTyping(true)
.SetShouldShowHandle(true);
.SetShouldShowHandle(true)
.SetShouldShrinkNextTap(true);
SetSelectionOptions options = builder.Build();
......@@ -46,6 +48,7 @@ TEST_F(SetSelectionOptionsTest, Setter) {
EXPECT_TRUE(options.ShouldClearTypingStyle());
EXPECT_TRUE(options.ShouldCloseTyping());
EXPECT_TRUE(options.ShouldShowHandle());
EXPECT_TRUE(options.ShouldShrinkNextTap());
}
} // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment