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

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 430843002: Use tighter typing in editing: PlainTextRange / ReplaceNodeWithSpanCommand (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/editing/ReplaceSelectionCommand.cpp ('k') | no next file » | 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2151 2151
2152 Frame* focusedFrame = focusedWebCoreFrame(); 2152 Frame* focusedFrame = focusedWebCoreFrame();
2153 if (!focusedFrame->isLocalFrame()) 2153 if (!focusedFrame->isLocalFrame())
2154 return info; 2154 return info;
2155 2155
2156 LocalFrame* focused = toLocalFrame(focusedFrame); 2156 LocalFrame* focused = toLocalFrame(focusedFrame);
2157 if (!focused) 2157 if (!focused)
2158 return info; 2158 return info;
2159 2159
2160 FrameSelection& selection = focused->selection(); 2160 FrameSelection& selection = focused->selection();
2161 Node* node = selection.selection().rootEditableElement(); 2161 Element* element = selection.selection().rootEditableElement();
2162 if (!node) 2162 if (!element)
2163 return info; 2163 return info;
2164 2164
2165 info.inputMode = inputModeOfFocusedElement(); 2165 info.inputMode = inputModeOfFocusedElement();
2166 2166
2167 info.type = textInputType(); 2167 info.type = textInputType();
2168 if (info.type == WebTextInputTypeNone) 2168 if (info.type == WebTextInputTypeNone)
2169 return info; 2169 return info;
2170 2170
2171 if (!focused->editor().canEdit()) 2171 if (!focused->editor().canEdit())
2172 return info; 2172 return info;
2173 2173
2174 // Emits an object replacement character for each replaced element so that 2174 // Emits an object replacement character for each replaced element so that
2175 // it is exposed to IME and thus could be deleted by IME on android. 2175 // it is exposed to IME and thus could be deleted by IME on android.
2176 info.value = plainText(rangeOfContents(node).get(), TextIteratorEmitsObjectR eplacementCharacter); 2176 info.value = plainText(rangeOfContents(element).get(), TextIteratorEmitsObje ctReplacementCharacter);
2177 2177
2178 if (info.value.isEmpty()) 2178 if (info.value.isEmpty())
2179 return info; 2179 return info;
2180 2180
2181 if (RefPtrWillBeRawPtr<Range> range = selection.selection().firstRange()) { 2181 if (RefPtrWillBeRawPtr<Range> range = selection.selection().firstRange()) {
2182 PlainTextRange plainTextRange(PlainTextRange::create(*node, *range.get() )); 2182 PlainTextRange plainTextRange(PlainTextRange::create(*element, *range.ge t()));
2183 if (plainTextRange.isNotNull()) { 2183 if (plainTextRange.isNotNull()) {
2184 info.selectionStart = plainTextRange.start(); 2184 info.selectionStart = plainTextRange.start();
2185 info.selectionEnd = plainTextRange.end(); 2185 info.selectionEnd = plainTextRange.end();
2186 } 2186 }
2187 } 2187 }
2188 2188
2189 if (RefPtrWillBeRawPtr<Range> range = focused->inputMethodController().compo sitionRange()) { 2189 if (RefPtrWillBeRawPtr<Range> range = focused->inputMethodController().compo sitionRange()) {
2190 PlainTextRange plainTextRange(PlainTextRange::create(*node, *range.get() )); 2190 PlainTextRange plainTextRange(PlainTextRange::create(*element, *range.ge t()));
2191 if (plainTextRange.isNotNull()) { 2191 if (plainTextRange.isNotNull()) {
2192 info.compositionStart = plainTextRange.start(); 2192 info.compositionStart = plainTextRange.start();
2193 info.compositionEnd = plainTextRange.end(); 2193 info.compositionEnd = plainTextRange.end();
2194 } 2194 }
2195 } 2195 }
2196 2196
2197 return info; 2197 return info;
2198 } 2198 }
2199 2199
2200 WebTextInputType WebViewImpl::textInputType() 2200 WebTextInputType WebViewImpl::textInputType()
(...skipping 2031 matching lines...) Expand 10 before | Expand all | Expand 10 after
4232 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4232 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4233 4233
4234 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4234 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4235 return false; 4235 return false;
4236 4236
4237 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4237 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4238 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4238 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4239 } 4239 }
4240 4240
4241 } // namespace blink 4241 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/ReplaceSelectionCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698