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

Unified Diff: ui/views/examples/multiline_elision_example.cc

Issue 1953133002: [WIP: not for review] Reduce re-layout Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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: ui/views/examples/multiline_elision_example.cc
diff --git a/ui/views/examples/multiline_elision_example.cc b/ui/views/examples/multiline_elision_example.cc
new file mode 100644
index 0000000000000000000000000000000000000000..35d3043dac9f7077a39e7ed4d6415d83d0e4c098
--- /dev/null
+++ b/ui/views/examples/multiline_elision_example.cc
@@ -0,0 +1,36 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/views/examples/multiline_elision_example.h"
+
+#include "ui/gfx/render_text.h"
+
+namespace views {
+namespace examples {
+
+class MultilineElisionExample::ElidedRenderTextView
+ : public RenderTextView {
+ public:
+ ElidedRenderTextView() {
+ render_text()->SetElideBehavior(gfx::ELIDE_TAIL);
+ render_text()->SetMaxLines(2);
+ }
+
+ gfx::Size GetPreferredSize() const override { return gfx::Size(500, 40); }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ElidedRenderTextView);
+};
+
+MultilineElisionExample::MultilineElisionExample()
+ : MultilineExample("Multiline Elision Example") {}
+
+MultilineElisionExample::~MultilineElisionExample() {}
+
+MultilineExample::RenderTextView* MultilineElisionExample::CreateTextView() {
+ return new ElidedRenderTextView();
+}
+
+} // namespace examples
+} // namespace views

Powered by Google App Engine
This is Rietveld 408576698