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

Side by Side Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 2199523002: Convert WebRange to be a simple pair of numbers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forgot the exports. Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 } 1151 }
1152 1152
1153 void WebLocalFrameImpl::selectRange(const WebPoint& baseInViewport, const WebPoi nt& extentInViewport) 1153 void WebLocalFrameImpl::selectRange(const WebPoint& baseInViewport, const WebPoi nt& extentInViewport)
1154 { 1154 {
1155 moveRangeSelection(baseInViewport, extentInViewport); 1155 moveRangeSelection(baseInViewport, extentInViewport);
1156 } 1156 }
1157 1157
1158 void WebLocalFrameImpl::selectRange(const WebRange& webRange) 1158 void WebLocalFrameImpl::selectRange(const WebRange& webRange)
1159 { 1159 {
1160 TRACE_EVENT0("blink", "WebLocalFrameImpl::selectRange"); 1160 TRACE_EVENT0("blink", "WebLocalFrameImpl::selectRange");
1161 if (Range* range = static_cast<Range*>(webRange)) 1161
1162 // TODO(dglazkov): The use of updateStyleAndLayoutIgnorePendingStylesheets n eeds to be audited.
1163 // see http://crbug.com/590369 for more details.
1164 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
1165
1166 DocumentLifecycle::DisallowTransitionScope(frame()->document()->lifecycle()) ;
1167
1168 // TODO(dglazkov): Use EphemeralRange here.
1169 // See http://crbug.com/636216 for more details.
1170 if (Range* range = webRange.createRange(frame()))
1162 frame()->selection().setSelectedRange(range, VP_DEFAULT_AFFINITY, Select ionDirectionalMode::NonDirectional, NotUserTriggered); 1171 frame()->selection().setSelectedRange(range, VP_DEFAULT_AFFINITY, Select ionDirectionalMode::NonDirectional, NotUserTriggered);
1163 } 1172 }
1164 1173
1174 WebString WebLocalFrameImpl::rangeAsText(const WebRange& webRange)
1175 {
1176 // TODO(dglazkov): The use of updateStyleAndLayoutIgnorePendingStylesheets n eeds to be audited.
1177 // see http://crbug.com/590369 for more details.
1178 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
1179
1180 DocumentLifecycle::DisallowTransitionScope(frame()->document()->lifecycle()) ;
1181
1182 // TODO(dglazkov): Use EphemeralRange here.
1183 // See http://crbug.com/636216 for more details.
1184 if (Range* range = webRange.createRange(frame()))
1185 return range->text();
1186
1187 return WebString();
1188 }
1189
1165 void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point) 1190 void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point)
1166 { 1191 {
1167 TRACE_EVENT0("blink", "WebLocalFrameImpl::moveRangeSelectionExtent"); 1192 TRACE_EVENT0("blink", "WebLocalFrameImpl::moveRangeSelectionExtent");
1168 frame()->selection().moveRangeSelectionExtent(frame()->view()->viewportToCon tents(point)); 1193 frame()->selection().moveRangeSelectionExtent(frame()->view()->viewportToCon tents(point));
1169 } 1194 }
1170 1195
1171 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& baseInViewport, const WebPoint& extentInViewport, WebFrame::TextGranularity granularity) 1196 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& baseInViewport, const WebPoint& extentInViewport, WebFrame::TextGranularity granularity)
1172 { 1197 {
1173 TRACE_EVENT0("blink", "WebLocalFrameImpl::moveRangeSelection"); 1198 TRACE_EVENT0("blink", "WebLocalFrameImpl::moveRangeSelection");
1174 blink::TextGranularity blinkGranularity = blink::CharacterGranularity; 1199 blink::TextGranularity blinkGranularity = blink::CharacterGranularity;
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
2182 { 2207 {
2183 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); 2208 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags));
2184 } 2209 }
2185 2210
2186 void WebLocalFrameImpl::clearActiveFindMatch() 2211 void WebLocalFrameImpl::clearActiveFindMatch()
2187 { 2212 {
2188 ensureTextFinder().clearActiveFindMatch(); 2213 ensureTextFinder().clearActiveFindMatch();
2189 } 2214 }
2190 2215
2191 } // namespace blink 2216 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.h ('k') | third_party/WebKit/Source/web/WebRange.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698