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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "core/rendering/RenderObject.h" | 50 #include "core/rendering/RenderObject.h" |
51 #include "core/rendering/style/RenderStyle.h" | 51 #include "core/rendering/style/RenderStyle.h" |
52 #include "public/platform/WebRect.h" | 52 #include "public/platform/WebRect.h" |
53 | 53 |
54 using namespace WebCore; | 54 using namespace WebCore; |
55 | 55 |
56 namespace WebKit { | 56 namespace WebKit { |
57 | 57 |
58 NSAttributedString* WebSubstringUtil::attributedSubstringInRange(WebFrame* webFr
ame, size_t location, size_t length) | 58 NSAttributedString* WebSubstringUtil::attributedSubstringInRange(WebFrame* webFr
ame, size_t location, size_t length) |
59 { | 59 { |
60 Frame* frame = static_cast<WebFrameImpl*>(webFrame)->frame(); | 60 Frame* frame = toWebFrameImpl(webFrame)->frame(); |
61 if (frame->view()->needsLayout()) | 61 if (frame->view()->needsLayout()) |
62 frame->view()->layout(); | 62 frame->view()->layout(); |
63 | 63 |
64 RefPtr<Range> range(TextIterator::rangeFromLocationAndLength(frame->selectio
n()->rootEditableElementOrDocumentElement(), location, length)); | 64 RefPtr<Range> range(TextIterator::rangeFromLocationAndLength(frame->selectio
n()->rootEditableElementOrDocumentElement(), location, length)); |
65 if (!range) | 65 if (!range) |
66 return nil; | 66 return nil; |
67 | 67 |
68 NSMutableAttributedString* string = [[NSMutableAttributedString alloc] init]
; | 68 NSMutableAttributedString* string = [[NSMutableAttributedString alloc] init]
; |
69 NSMutableDictionary* attrs = [NSMutableDictionary dictionary]; | 69 NSMutableDictionary* attrs = [NSMutableDictionary dictionary]; |
70 | 70 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |