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

Unified Diff: ui/gfx/decorated_text.h

Issue 2348143003: MacViews: Implement Force Touch/Mac dictionary lookup for Textfields. (Closed)
Patch Set: Address nits. Created 4 years, 2 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
« no previous file with comments | « ui/gfx/BUILD.gn ('k') | ui/gfx/decorated_text.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/decorated_text.h
diff --git a/ui/gfx/decorated_text.h b/ui/gfx/decorated_text.h
new file mode 100644
index 0000000000000000000000000000000000000000..2b80e54fbf945b7d3ae0a0598abb1af6db354f03
--- /dev/null
+++ b/ui/gfx/decorated_text.h
@@ -0,0 +1,46 @@
+// 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.
+
+#ifndef UI_GFX_DECORATED_TEXT_H_
+#define UI_GFX_DECORATED_TEXT_H_
+
+#include <vector>
+
+#include "base/strings/string16.h"
+#include "ui/gfx/font.h"
+#include "ui/gfx/gfx_export.h"
+#include "ui/gfx/range/range.h"
+
+namespace gfx {
+
+// Encapsulates styling information for some given text.
+struct GFX_EXPORT DecoratedText {
+ // Describes the various text decoration attributes applicable to a given
+ // range of text.
+ struct GFX_EXPORT RangedAttribute {
+ // Disallow default construction of Font, since that's slow.
+ RangedAttribute() = delete;
+ RangedAttribute(const Range& range, const Font& font);
+
+ // The range in |text|, this RangedAttribute corresponds to. Should not be
+ // reversed and should lie within the bounds of |text|.
+ Range range;
+ Font font;
+ bool strike;
+ bool diagonal_strike;
+ };
+
+ DecoratedText();
+ ~DecoratedText();
+
+ base::string16 text;
+
+ // Vector of RangedAttribute describing styling of non-overlapping ranges
+ // in |text|.
+ std::vector<RangedAttribute> attributes;
+};
+
+}; // namespace gfx
+
+#endif // UI_GFX_DECORATED_TEXT_H_
« no previous file with comments | « ui/gfx/BUILD.gn ('k') | ui/gfx/decorated_text.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698