Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 if (!numCharacters) | 71 if (!numCharacters) |
| 72 continue; | 72 continue; |
| 73 | 73 |
| 74 Node* container = it.startContainer(); | 74 Node* container = it.startContainer(); |
| 75 LayoutObject* renderer = container->layoutObject(); | 75 LayoutObject* renderer = container->layoutObject(); |
| 76 ASSERT(renderer); | 76 ASSERT(renderer); |
| 77 if (!renderer) | 77 if (!renderer) |
| 78 continue; | 78 continue; |
| 79 | 79 |
| 80 LayoutStyle* style = renderer->style(); | 80 LayoutStyle* style = renderer->style(); |
| 81 NSFont* font = style->font().primaryFont()->getNSFont(); | 81 const FontPlatformData& fontPlatformData = style->font().primaryFont()-> platformData(); |
| 82 // Toll-free bridge types CTFont and NSFont. | |
| 83 NSFont* font = const_cast<NSFont*>(reinterpret_cast<const NSFont*>((font PlatformData.ctFont()))); | |
|
Ken Russell (switch to Gerrit)
2015/03/23 18:58:59
Can this use the toNSFont helper from platform/fon
| |
| 82 // If the platform font can't be loaded, it's likely that the site is | 84 // If the platform font can't be loaded, it's likely that the site is |
| 83 // using a web font. For now, just use the default font instead. | 85 // using a web font. For now, just use the default font instead. |
| 84 // TODO(rsesek): Change the font activation flags to allow other process es | 86 // TODO(rsesek): Change the font activation flags to allow other process es |
| 85 // to use the font. | 87 // to use the font. |
| 86 if (!font) | 88 if (!font) |
| 87 font = [NSFont systemFontOfSize:style->font().fontDescription().comput edSize()]; | 89 font = [NSFont systemFontOfSize:style->font().fontDescription().comput edSize()]; |
| 88 [attrs setObject:font forKey:NSFontAttributeName]; | 90 [attrs setObject:font forKey:NSFontAttributeName]; |
| 89 | 91 |
| 90 if (style->visitedDependentColor(CSSPropertyColor).alpha()) | 92 if (style->visitedDependentColor(CSSPropertyColor).alpha()) |
| 91 [attrs setObject:nsColor(style->visitedDependentColor(CSSPropertyCol or)) forKey:NSForegroundColorAttributeName]; | 93 [attrs setObject:nsColor(style->visitedDependentColor(CSSPropertyCol or)) forKey:NSForegroundColorAttributeName]; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 if (!editable) | 160 if (!editable) |
| 159 return nil; | 161 return nil; |
| 160 RefPtrWillBeRawPtr<Range> range(PlainTextRange(location, location + length). createRange(*editable)); | 162 RefPtrWillBeRawPtr<Range> range(PlainTextRange(location, location + length). createRange(*editable)); |
| 161 if (!range) | 163 if (!range) |
| 162 return nil; | 164 return nil; |
| 163 | 165 |
| 164 return attributedSubstringFromRange(range.get()); | 166 return attributedSubstringFromRange(range.get()); |
| 165 } | 167 } |
| 166 | 168 |
| 167 } // namespace blink | 169 } // namespace blink |
| OLD | NEW |