summaryrefslogtreecommitdiffstats
path: root/ui/base
diff options
context:
space:
mode:
authorjdduke <jdduke@chromium.org>2015-04-14 17:08:41 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-15 00:09:26 +0000
commit3628fb3825e9119a4f96b0d425ffdf2c608bd6b7 (patch)
tree40571701e4e4fc2d8c95dc1ed41b9fc9ad4e2cda /ui/base
parentca8dd4aa03e5edb6432d0decbd283467bc3b0b1f (diff)
downloadchromium_src-3628fb3825e9119a4f96b0d425ffdf2c608bd6b7.zip
chromium_src-3628fb3825e9119a4f96b0d425ffdf2c608bd6b7.tar.gz
chromium_src-3628fb3825e9119a4f96b0d425ffdf2c608bd6b7.tar.bz2
[Android] Allow custom ActionMode creation via ContentViewClient
Use the ContentViewClient to create the selection ActionMode. This allows the embedder to completely control the style and behavior of the ActionMode popup. BUG=389153 NOTRY=true Review URL: https://codereview.chromium.org/1066053002 Cr-Commit-Position: refs/heads/master@{#325154}
Diffstat (limited to 'ui/base')
-rw-r--r--ui/base/touch/selection_bound.cc16
-rw-r--r--ui/base/touch/selection_bound.h4
2 files changed, 20 insertions, 0 deletions
diff --git a/ui/base/touch/selection_bound.cc b/ui/base/touch/selection_bound.cc
index bd5b3c9..6aa472c 100644
--- a/ui/base/touch/selection_bound.cc
+++ b/ui/base/touch/selection_bound.cc
@@ -65,4 +65,20 @@ gfx::Rect RectBetweenSelectionBounds(const SelectionBound& b1,
return gfx::Rect(top_left, gfx::Size(diff.x(), diff.y()));
}
+gfx::RectF RectFBetweenSelectionBounds(const SelectionBound& b1,
+ const SelectionBound& b2) {
+ gfx::PointF top_left(b1.edge_top());
+ top_left.SetToMin(b1.edge_bottom());
+ top_left.SetToMin(b2.edge_top());
+ top_left.SetToMin(b2.edge_bottom());
+
+ gfx::PointF bottom_right(b1.edge_top());
+ bottom_right.SetToMax(b1.edge_bottom());
+ bottom_right.SetToMax(b2.edge_top());
+ bottom_right.SetToMax(b2.edge_bottom());
+
+ gfx::Vector2dF diff = bottom_right - top_left;
+ return gfx::RectF(top_left, gfx::SizeF(diff.x(), diff.y()));
+}
+
} // namespace ui
diff --git a/ui/base/touch/selection_bound.h b/ui/base/touch/selection_bound.h
index 52491f0..4636ce1 100644
--- a/ui/base/touch/selection_bound.h
+++ b/ui/base/touch/selection_bound.h
@@ -11,6 +11,7 @@
namespace gfx {
class Rect;
+class RectF;
}
namespace ui {
@@ -66,6 +67,9 @@ UI_BASE_EXPORT bool operator!=(const SelectionBound& lhs,
UI_BASE_EXPORT gfx::Rect RectBetweenSelectionBounds(const SelectionBound& b1,
const SelectionBound& b2);
+UI_BASE_EXPORT gfx::RectF RectFBetweenSelectionBounds(const SelectionBound& b1,
+ const SelectionBound& b2);
+
} // namespace ui
#endif // UI_BASE_TOUCH_SELECTION_BOUND_H_