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

Unified Diff: ui/gfx/render_text_mac.mm

Issue 2348143003: MacViews: Implement Force Touch/Mac dictionary lookup for Textfields. (Closed)
Patch Set: --- Created 4 years, 3 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/gfx/render_text_mac.mm
diff --git a/ui/gfx/render_text_mac.mm b/ui/gfx/render_text_mac.mm
index e380333c8c88f471ac158b6c5f30bfc043d3d371..0fbc09a0e7cf86972e2906f3e10d1c4d9891d179 100644
--- a/ui/gfx/render_text_mac.mm
+++ b/ui/gfx/render_text_mac.mm
@@ -64,23 +64,6 @@
namespace gfx {
-namespace internal {
-
-// Note: this is only used by RenderTextHarfbuzz.
-sk_sp<SkTypeface> CreateSkiaTypeface(const Font& font,
- bool italic,
- Font::Weight weight) {
- const Font::FontStyle style = italic ? Font::ITALIC : Font::NORMAL;
- Font font_with_style = font.Derive(0, style, weight);
- if (!font_with_style.GetNativeFont())
- return nullptr;
-
- return sk_sp<SkTypeface>(SkCreateTypefaceFromCTFont(
- base::mac::NSToCFCast(font_with_style.GetNativeFont())));
-}
-
-} // namespace internal
-
RenderTextMac::RenderTextMac() : common_baseline_(0), runs_valid_(false) {}
RenderTextMac::~RenderTextMac() {}
@@ -448,4 +431,17 @@
runs_valid_ = false;
}
+bool RenderTextMac::GetStyledStringForRange(
+ const Range& range,
+ NSMutableAttributedString* str) const {
+ // TODO(karandeepb): This is not invoked on any codepath currently. Style the
+ // returned string if need be.
+ if (obscured())
+ return false;
+
+ [[str mutableString]
+ setString:base::SysUTF16ToNSString(GetTextFromRange(range))];
+ return true;
+}
+
} // namespace gfx

Powered by Google App Engine
This is Rietveld 408576698