| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 size_t length = range.endPosition().computeOffsetInContainerNode() - range.s
tartPosition().computeOffsetInContainerNode(); | 65 size_t length = range.endPosition().computeOffsetInContainerNode() - range.s
tartPosition().computeOffsetInContainerNode(); |
| 66 | 66 |
| 67 unsigned position = 0; | 67 unsigned position = 0; |
| 68 for (TextIterator it(range.startPosition(), range.endPosition()); !it.atEnd(
) && [string length] < length; it.advance()) { | 68 for (TextIterator it(range.startPosition(), range.endPosition()); !it.atEnd(
) && [string length] < length; it.advance()) { |
| 69 unsigned numCharacters = it.length(); | 69 unsigned numCharacters = it.length(); |
| 70 if (!numCharacters) | 70 if (!numCharacters) |
| 71 continue; | 71 continue; |
| 72 | 72 |
| 73 Node* container = it.currentContainer(); | 73 Node* container = it.currentContainer(); |
| 74 LayoutObject* layoutObject = container->layoutObject(); | 74 LayoutObject* layoutObject = container->layoutObject(); |
| 75 ASSERT(layoutObject); | 75 DCHECK(layoutObject); |
| 76 if (!layoutObject) | 76 if (!layoutObject) |
| 77 continue; | 77 continue; |
| 78 | 78 |
| 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 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |