| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 using namespace blink; | 59 using namespace blink; |
| 60 | 60 |
| 61 static NSAttributedString* attributedSubstringFromRange(const EphemeralRange& ra
nge) | 61 static NSAttributedString* attributedSubstringFromRange(const EphemeralRange& ra
nge) |
| 62 { | 62 { |
| 63 NSMutableAttributedString* string = [[NSMutableAttributedString alloc] init]
; | 63 NSMutableAttributedString* string = [[NSMutableAttributedString alloc] init]
; |
| 64 NSMutableDictionary* attrs = [NSMutableDictionary dictionary]; | 64 NSMutableDictionary* attrs = [NSMutableDictionary dictionary]; |
| 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 |
| 69 // TODO(dglazkov): The use of updateLayoutIgnorePendingStylesheets needs to
be audited. |
| 70 // see http://crbug.com/590369 for more details. |
| 71 range.startPosition().document()->updateLayoutIgnorePendingStylesheets(); |
| 72 |
| 68 for (TextIterator it(range.startPosition(), range.endPosition()); !it.atEnd(
) && [string length] < length; it.advance()) { | 73 for (TextIterator it(range.startPosition(), range.endPosition()); !it.atEnd(
) && [string length] < length; it.advance()) { |
| 69 unsigned numCharacters = it.length(); | 74 unsigned numCharacters = it.length(); |
| 70 if (!numCharacters) | 75 if (!numCharacters) |
| 71 continue; | 76 continue; |
| 72 | 77 |
| 73 Node* container = it.currentContainer(); | 78 Node* container = it.currentContainer(); |
| 74 LayoutObject* layoutObject = container->layoutObject(); | 79 LayoutObject* layoutObject = container->layoutObject(); |
| 75 DCHECK(layoutObject); | 80 DCHECK(layoutObject); |
| 76 if (!layoutObject) | 81 if (!layoutObject) |
| 77 continue; | 82 continue; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 if (ephemeralRange.isNull()) | 175 if (ephemeralRange.isNull()) |
| 171 return nil; | 176 return nil; |
| 172 | 177 |
| 173 NSAttributedString* result = attributedSubstringFromRange(ephemeralRange); | 178 NSAttributedString* result = attributedSubstringFromRange(ephemeralRange); |
| 174 if (baselinePoint) | 179 if (baselinePoint) |
| 175 *baselinePoint = getBaselinePoint(frame->view(), ephemeralRange, result)
; | 180 *baselinePoint = getBaselinePoint(frame->view(), ephemeralRange, result)
; |
| 176 return result; | 181 return result; |
| 177 } | 182 } |
| 178 | 183 |
| 179 } // namespace blink | 184 } // namespace blink |
| OLD | NEW |