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

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

Issue 2886613002: Prune ComputeVisibleSelectionInDOMTreeDeprecated from WebViewImpl::SelectionBounds (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | 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 2376 matching lines...) Expand 10 before | Expand all | Expand 10 after
2387 // needs to be audited. See http://crbug.com/590369 for more details. 2387 // needs to be audited. See http://crbug.com/590369 for more details.
2388 local_frame->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); 2388 local_frame->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
2389 if (selection.ComputeVisibleSelectionInDOMTree().IsNone()) { 2389 if (selection.ComputeVisibleSelectionInDOMTree().IsNone()) {
2390 // plugins/mouse-capture-inside-shadow.html reaches here. 2390 // plugins/mouse-capture-inside-shadow.html reaches here.
2391 return false; 2391 return false;
2392 } 2392 }
2393 2393
2394 DocumentLifecycle::DisallowTransitionScope disallow_transition( 2394 DocumentLifecycle::DisallowTransitionScope disallow_transition(
2395 local_frame->GetDocument()->Lifecycle()); 2395 local_frame->GetDocument()->Lifecycle());
2396 2396
2397 if (selection.ComputeVisibleSelectionInDOMTreeDeprecated().IsCaret()) { 2397 if (selection.ComputeVisibleSelectionInDOMTree().IsCaret()) {
2398 anchor = focus = selection.AbsoluteCaretBounds(); 2398 anchor = focus = selection.AbsoluteCaretBounds();
2399 } else { 2399 } else {
2400 const EphemeralRange selected_range = 2400 const EphemeralRange selected_range =
2401 selection.ComputeVisibleSelectionInDOMTreeDeprecated() 2401 selection.ComputeVisibleSelectionInDOMTree()
2402 .ToNormalizedEphemeralRange(); 2402 .ToNormalizedEphemeralRange();
2403 if (selected_range.IsNull()) 2403 if (selected_range.IsNull())
2404 return false; 2404 return false;
2405 anchor = local_frame->GetEditor().FirstRectForRange( 2405 anchor = local_frame->GetEditor().FirstRectForRange(
2406 EphemeralRange(selected_range.StartPosition())); 2406 EphemeralRange(selected_range.StartPosition()));
2407 focus = local_frame->GetEditor().FirstRectForRange( 2407 focus = local_frame->GetEditor().FirstRectForRange(
2408 EphemeralRange(selected_range.EndPosition())); 2408 EphemeralRange(selected_range.EndPosition()));
2409 } 2409 }
2410 2410
2411 anchor = local_frame->View()->ContentsToViewport(anchor); 2411 anchor = local_frame->View()->ContentsToViewport(anchor);
2412 focus = local_frame->View()->ContentsToViewport(focus); 2412 focus = local_frame->View()->ContentsToViewport(focus);
2413 2413
2414 if (!selection.ComputeVisibleSelectionInDOMTreeDeprecated().IsBaseFirst()) 2414 if (!selection.ComputeVisibleSelectionInDOMTree().IsBaseFirst())
2415 std::swap(anchor, focus); 2415 std::swap(anchor, focus);
2416 return true; 2416 return true;
2417 } 2417 }
2418 2418
2419 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as 2419 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
2420 // well. This code needs to be refactored (http://crbug.com/629721). 2420 // well. This code needs to be refactored (http://crbug.com/629721).
2421 WebPlugin* WebViewImpl::FocusedPluginIfInputMethodSupported(LocalFrame* frame) { 2421 WebPlugin* WebViewImpl::FocusedPluginIfInputMethodSupported(LocalFrame* frame) {
2422 WebPluginContainerImpl* container = 2422 WebPluginContainerImpl* container =
2423 WebLocalFrameImpl::CurrentPluginContainer(frame); 2423 WebLocalFrameImpl::CurrentPluginContainer(frame);
2424 if (container && container->SupportsInputMethod()) 2424 if (container && container->SupportsInputMethod())
(...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after
4151 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) 4151 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame())
4152 return nullptr; 4152 return nullptr;
4153 return focused_frame; 4153 return focused_frame;
4154 } 4154 }
4155 4155
4156 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { 4156 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const {
4157 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; 4157 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr;
4158 } 4158 }
4159 4159
4160 } // namespace blink 4160 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698