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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 NSFont* font = style->font().primaryFont()->getNSFont(); | 84 NSFont* font = style->font().primaryFont()->getNSFont(); |
85 // If the platform font can't be loaded, it's likely that the site is | 85 // If the platform font can't be loaded, it's likely that the site is |
86 // using a web font. For now, just use the default font instead. | 86 // using a web font. For now, just use the default font instead. |
87 // TODO(rsesek): Change the font activation flags to allow other process
es | 87 // TODO(rsesek): Change the font activation flags to allow other process
es |
88 // to use the font. | 88 // to use the font. |
89 if (!font) | 89 if (!font) |
90 font = [NSFont systemFontOfSize:style->font().size()]; | 90 font = [NSFont systemFontOfSize:style->font().size()]; |
91 [attrs setObject:font forKey:NSFontAttributeName]; | 91 [attrs setObject:font forKey:NSFontAttributeName]; |
92 | 92 |
93 if (style->visitedDependentColor(CSSPropertyColor).alpha()) | 93 if (style->visitedDependentColor(CSSPropertyColor).alpha()) |
94 [attrs setObject:nsColor(style->visitedDependentColor(CSSPropertyCol
or)) forKey:NSForegroundColorAttributeName]; | 94 [attrs setObject:nsColor(renderer->resolveColor(CSSPropertyColor)) f
orKey:NSForegroundColorAttributeName]; |
95 else | 95 else |
96 [attrs removeObjectForKey:NSForegroundColorAttributeName]; | 96 [attrs removeObjectForKey:NSForegroundColorAttributeName]; |
97 if (style->visitedDependentColor(CSSPropertyBackgroundColor).alpha()) | 97 if (style->visitedDependentColor(CSSPropertyBackgroundColor).alpha()) |
98 [attrs setObject:nsColor(style->visitedDependentColor(CSSPropertyBac
kgroundColor)) forKey:NSBackgroundColorAttributeName]; | 98 [attrs setObject:nsColor(renderer->resolveColor(CSSPropertyBackgroun
dColor)) forKey:NSBackgroundColorAttributeName]; |
99 else | 99 else |
100 [attrs removeObjectForKey:NSBackgroundColorAttributeName]; | 100 [attrs removeObjectForKey:NSBackgroundColorAttributeName]; |
101 | 101 |
102 Vector<UChar> characters; | 102 Vector<UChar> characters; |
103 it.appendTextTo(characters); | 103 it.appendTextTo(characters); |
104 NSString* substring = | 104 NSString* substring = |
105 [[[NSString alloc] initWithCharacters:characters.data() | 105 [[[NSString alloc] initWithCharacters:characters.data() |
106 length:characters.size()] autorelease
]; | 106 length:characters.size()] autorelease
]; |
107 [string replaceCharactersInRange:NSMakeRange(position, 0) | 107 [string replaceCharactersInRange:NSMakeRange(position, 0) |
108 withString:substring]; | 108 withString:substring]; |
109 [string setAttributes:attrs range:NSMakeRange(position, numCharacters)]; | 109 [string setAttributes:attrs range:NSMakeRange(position, numCharacters)]; |
110 position += numCharacters; | 110 position += numCharacters; |
111 } | 111 } |
112 return [string autorelease]; | 112 return [string autorelease]; |
113 } | 113 } |
114 | 114 |
115 } // namespace WebKit | 115 } // namespace WebKit |
OLD | NEW |