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

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

Issue 2883083003: Prune ComputeVisibleSelectionInDOMTreeDeprecated from WebFrameWidgetImpl::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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 } 587 }
588 588
589 // TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This 589 // TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This
590 // code needs to be refactored (http://crbug.com/629721). 590 // code needs to be refactored (http://crbug.com/629721).
591 bool WebFrameWidgetImpl::SelectionBounds(WebRect& anchor, 591 bool WebFrameWidgetImpl::SelectionBounds(WebRect& anchor,
592 WebRect& focus) const { 592 WebRect& focus) const {
593 const LocalFrame* local_frame = FocusedLocalFrameInWidget(); 593 const LocalFrame* local_frame = FocusedLocalFrameInWidget();
594 if (!local_frame) 594 if (!local_frame)
595 return false; 595 return false;
596 596
597 FrameSelection& selection = local_frame->Selection();
598 if (selection.ComputeVisibleSelectionInDOMTreeDeprecated().IsNone())
599 return false;
600
601 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets 597 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets
602 // needs to be audited. See http://crbug.com/590369 for more details. 598 // needs to be audited. See http://crbug.com/590369 for more details.
603 local_frame->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); 599 local_frame->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
604 600
605 DocumentLifecycle::DisallowTransitionScope disallow_transition( 601 DocumentLifecycle::DisallowTransitionScope disallow_transition(
606 local_frame->GetDocument()->Lifecycle()); 602 local_frame->GetDocument()->Lifecycle());
607 603
608 if (selection.ComputeVisibleSelectionInDOMTreeDeprecated().IsCaret()) { 604 FrameSelection& selection = local_frame->Selection();
605 if (selection.ComputeVisibleSelectionInDOMTree().IsNone())
606 return false;
607
608 if (selection.ComputeVisibleSelectionInDOMTree().IsCaret()) {
609 anchor = focus = selection.AbsoluteCaretBounds(); 609 anchor = focus = selection.AbsoluteCaretBounds();
610 } else { 610 } else {
611 const EphemeralRange selected_range = 611 const EphemeralRange selected_range =
612 selection.ComputeVisibleSelectionInDOMTree() 612 selection.ComputeVisibleSelectionInDOMTree()
613 .ToNormalizedEphemeralRange(); 613 .ToNormalizedEphemeralRange();
614 if (selected_range.IsNull()) 614 if (selected_range.IsNull())
615 return false; 615 return false;
616 anchor = local_frame->GetEditor().FirstRectForRange( 616 anchor = local_frame->GetEditor().FirstRectForRange(
617 EphemeralRange(selected_range.StartPosition())); 617 EphemeralRange(selected_range.StartPosition()));
618 focus = local_frame->GetEditor().FirstRectForRange( 618 focus = local_frame->GetEditor().FirstRectForRange(
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 return nullptr; 1206 return nullptr;
1207 } 1207 }
1208 1208
1209 LocalFrame* WebFrameWidgetImpl::FocusedLocalFrameAvailableForIme() const { 1209 LocalFrame* WebFrameWidgetImpl::FocusedLocalFrameAvailableForIme() const {
1210 if (!ime_accept_events_) 1210 if (!ime_accept_events_)
1211 return nullptr; 1211 return nullptr;
1212 return FocusedLocalFrameInWidget(); 1212 return FocusedLocalFrameInWidget();
1213 } 1213 }
1214 1214
1215 } // namespace blink 1215 } // 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