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 68 matching lines...) Loading... |
79 const ComputedStyle* style = layoutObject->style(); | 79 const ComputedStyle* style = layoutObject->style(); |
80 const FontPlatformData& fontPlatformData = style->font().primaryFont()->
platformData(); | 80 const FontPlatformData& fontPlatformData = style->font().primaryFont()->
platformData(); |
81 NSFont* font = toNSFont(fontPlatformData.ctFont()); | 81 NSFont* font = toNSFont(fontPlatformData.ctFont()); |
82 // If the platform font can't be loaded, or the size is incorrect compar
ing | 82 // If the platform font can't be loaded, or the size is incorrect compar
ing |
83 // to the computed style, it's likely that the site is using a web font. | 83 // to the computed style, it's likely that the site is using a web font. |
84 // For now, just use the default font instead. | 84 // For now, just use the default font instead. |
85 // TODO(rsesek): Change the font activation flags to allow other process
es | 85 // TODO(rsesek): Change the font activation flags to allow other process
es |
86 // to use the font. | 86 // to use the font. |
87 // TODO(shuchen): Support scaling the font as necessary according to CSS
transforms. | 87 // TODO(shuchen): Support scaling the font as necessary according to CSS
transforms. |
88 if (!font || floor(fontPlatformData.size()) != floor([[font fontDescript
or] pointSize])) | 88 if (!font || floor(fontPlatformData.size()) != floor([[font fontDescript
or] pointSize])) |
89 font = [NSFont systemFontOfSize:style->font().fontDescription().comp
utedSize()]; | 89 font = [NSFont systemFontOfSize:style->font().getFontDescription().c
omputedSize()]; |
90 [attrs setObject:font forKey:NSFontAttributeName]; | 90 [attrs setObject:font forKey:NSFontAttributeName]; |
91 | 91 |
92 if (style->visitedDependentColor(CSSPropertyColor).alpha()) | 92 if (style->visitedDependentColor(CSSPropertyColor).alpha()) |
93 [attrs setObject:nsColor(style->visitedDependentColor(CSSPropertyCol
or)) forKey:NSForegroundColorAttributeName]; | 93 [attrs setObject:nsColor(style->visitedDependentColor(CSSPropertyCol
or)) forKey:NSForegroundColorAttributeName]; |
94 else | 94 else |
95 [attrs removeObjectForKey:NSForegroundColorAttributeName]; | 95 [attrs removeObjectForKey:NSForegroundColorAttributeName]; |
96 if (style->visitedDependentColor(CSSPropertyBackgroundColor).alpha()) | 96 if (style->visitedDependentColor(CSSPropertyBackgroundColor).alpha()) |
97 [attrs setObject:nsColor(style->visitedDependentColor(CSSPropertyBac
kgroundColor)) forKey:NSBackgroundColorAttributeName]; | 97 [attrs setObject:nsColor(style->visitedDependentColor(CSSPropertyBac
kgroundColor)) forKey:NSBackgroundColorAttributeName]; |
98 else | 98 else |
99 [attrs removeObjectForKey:NSBackgroundColorAttributeName]; | 99 [attrs removeObjectForKey:NSBackgroundColorAttributeName]; |
(...skipping 70 matching lines...) Loading... |
170 if (ephemeralRange.isNull()) | 170 if (ephemeralRange.isNull()) |
171 return nil; | 171 return nil; |
172 | 172 |
173 NSAttributedString* result = attributedSubstringFromRange(ephemeralRange); | 173 NSAttributedString* result = attributedSubstringFromRange(ephemeralRange); |
174 if (baselinePoint) | 174 if (baselinePoint) |
175 *baselinePoint = getBaselinePoint(frame->view(), ephemeralRange, result)
; | 175 *baselinePoint = getBaselinePoint(frame->view(), ephemeralRange, result)
; |
176 return result; | 176 return result; |
177 } | 177 } |
178 | 178 |
179 } // namespace blink | 179 } // namespace blink |
OLD | NEW |