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

Unified Diff: ui/gfx/render_text_mac.mm

Issue 1927003004: Mac: Introduce "StaticCast" variants of base::mac::FooCastStrict, which do not typecheck in Release (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
« base/mac/foundation_util.mm ('K') | « base/mac/foundation_util.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text_mac.mm
diff --git a/ui/gfx/render_text_mac.mm b/ui/gfx/render_text_mac.mm
index 5a4e5b115b99aa6f1033438e549d602e954e9a76..c5438395a4f93907720e4fa87701b61a92cf7749 100644
--- a/ui/gfx/render_text_mac.mm
+++ b/ui/gfx/render_text_mac.mm
@@ -369,7 +369,7 @@ void RenderTextMac::ComputeRuns() {
const CFRange empty_cf_range = CFRangeMake(0, 0);
for (CFIndex i = 0; i < ct_runs_count; ++i) {
CTRunRef ct_run =
- base::mac::CFCast<CTRunRef>(CFArrayGetValueAtIndex(ct_runs, i));
+ base::mac::CFCastStrict<CTRunRef>(CFArrayGetValueAtIndex(ct_runs, i));
const size_t glyph_count = CTRunGetGlyphCount(ct_run);
const double run_width =
CTRunGetTypographicBounds(ct_run, empty_cf_range, NULL, NULL, NULL);
@@ -411,19 +411,18 @@ void RenderTextMac::ComputeRuns() {
// TODO(asvitkine): Style boundaries are not necessarily per-run. Handle
// this better. Also, support strike and diagonal_strike.
CFDictionaryRef attributes = CTRunGetAttributes(ct_run);
- CTFontRef ct_font = base::mac::GetValueFromDictionary<CTFontRef>(
- attributes, kCTFontAttributeName);
+ CTFontRef ct_font = base::mac::CFCastStrict<CTFontRef>(
+ CFDictionaryGetValue(attributes, kCTFontAttributeName));
run->ct_font.reset(ct_font, base::scoped_policy::RETAIN);
run->typeface.reset(SkCreateTypefaceFromCTFont(ct_font));
- const CGColorRef foreground = base::mac::GetValueFromDictionary<CGColorRef>(
- attributes, kCTForegroundColorAttributeName);
+ const CGColorRef foreground = base::mac::CFCastStrict<CGColorRef>(
+ CFDictionaryGetValue(attributes, kCTForegroundColorAttributeName));
if (foreground)
run->foreground = skia::CGColorRefToSkColor(foreground);
- const CFNumberRef underline =
- base::mac::GetValueFromDictionary<CFNumberRef>(
- attributes, kCTUnderlineStyleAttributeName);
+ const CFNumberRef underline = base::mac::CFCastStrict<CFNumberRef>(
+ CFDictionaryGetValue(attributes, kCTUnderlineStyleAttributeName));
CTUnderlineStyle value = kCTUnderlineStyleNone;
if (underline && CFNumberGetValue(underline, kCFNumberSInt32Type, &value))
run->underline = (value == kCTUnderlineStyleSingle);
« base/mac/foundation_util.mm ('K') | « base/mac/foundation_util.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698