Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: Source/web/mac/WebSubstringUtil.mm

Issue 23671002: Refactoring: Add toWebFrameImpl() interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Corrected as per review commments. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/CustomEventTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/CustomEventTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698