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

Side by Side Diff: ui/gfx/render_text_mac.mm

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 unified diff | Download patch
« no previous file with comments | « ui/gfx/render_text_mac.h ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/render_text_mac.h" 5 #include "ui/gfx/render_text_mac.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 #include <ApplicationServices/ApplicationServices.h> 8 #include <ApplicationServices/ApplicationServices.h>
9 #include <CoreText/CoreText.h> 9 #include <CoreText/CoreText.h>
10 10
11 #include <algorithm> 11 #include <algorithm>
12 #include <cmath> 12 #include <cmath>
13 #include <utility> 13 #include <utility>
14 14
15 #include "base/mac/foundation_util.h" 15 #include "base/mac/foundation_util.h"
16 #include "base/mac/mac_util.h" 16 #include "base/mac/mac_util.h"
17 #include "base/mac/scoped_cftyperef.h" 17 #include "base/mac/scoped_cftyperef.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/ptr_util.h" 19 #include "base/memory/ptr_util.h"
20 #include "base/strings/sys_string_conversions.h" 20 #include "base/strings/sys_string_conversions.h"
21 #include "skia/ext/skia_utils_mac.h" 21 #include "skia/ext/skia_utils_mac.h"
22 #include "third_party/skia/include/ports/SkTypeface_mac.h" 22 #include "third_party/skia/include/ports/SkTypeface_mac.h"
23 #include "ui/gfx/decorated_text.h"
23 24
24 namespace { 25 namespace {
25 26
26 // This function makes a copy of |font| with the given symbolic traits. On OSX 27 // This function makes a copy of |font| with the given symbolic traits. On OSX
27 // 10.11, CTFontCreateCopyWithSymbolicTraits has the right behavior but 28 // 10.11, CTFontCreateCopyWithSymbolicTraits has the right behavior but
28 // CTFontCreateWithFontDescriptor does not. The opposite holds true for OSX 29 // CTFontCreateWithFontDescriptor does not. The opposite holds true for OSX
29 // 10.10. 30 // 10.10.
30 base::ScopedCFTypeRef<CTFontRef> CopyFontWithSymbolicTraits(CTFontRef font, 31 base::ScopedCFTypeRef<CTFontRef> CopyFontWithSymbolicTraits(CTFontRef font,
31 int sym_traits) { 32 int sym_traits) {
32 if (base::mac::IsAtLeastOS10_11()) { 33 if (base::mac::IsAtLeastOS10_11()) {
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 runs_valid_ = true; 442 runs_valid_ = true;
442 } 443 }
443 444
444 void RenderTextMac::InvalidateStyle() { 445 void RenderTextMac::InvalidateStyle() {
445 line_.reset(); 446 line_.reset();
446 attributes_.reset(); 447 attributes_.reset();
447 runs_.clear(); 448 runs_.clear();
448 runs_valid_ = false; 449 runs_valid_ = false;
449 } 450 }
450 451
452 bool RenderTextMac::GetDecoratedTextForRange(const Range& range,
453 DecoratedText* decorated_text) {
454 // TODO(karandeepb): This is not invoked on any codepath currently. Style the
455 // returned text if need be.
456 if (obscured())
457 return false;
458
459 decorated_text->text = GetTextFromRange(range);
460 return true;
461 }
462
451 } // namespace gfx 463 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text_mac.h ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698