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

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

Issue 2352763004: Prune CreateVisiblePositionDeprecated from Editor::firstRectForRange (Closed)
Patch Set: 201609231108 Created 4 years, 2 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) 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 2624 matching lines...) Expand 10 before | Expand all | Expand 10 after
2635 bool WebViewImpl::selectionBounds(WebRect& anchor, WebRect& focus) const 2635 bool WebViewImpl::selectionBounds(WebRect& anchor, WebRect& focus) const
2636 { 2636 {
2637 const Frame* frame = focusedCoreFrame(); 2637 const Frame* frame = focusedCoreFrame();
2638 if (!frame || !frame->isLocalFrame()) 2638 if (!frame || !frame->isLocalFrame())
2639 return false; 2639 return false;
2640 2640
2641 const LocalFrame* localFrame = toLocalFrame(frame); 2641 const LocalFrame* localFrame = toLocalFrame(frame);
2642 if (!localFrame) 2642 if (!localFrame)
2643 return false; 2643 return false;
2644 FrameSelection& selection = localFrame->selection(); 2644 FrameSelection& selection = localFrame->selection();
2645 if (!selection.isAvailable()) { 2645 if (!selection.isAvailable() || selection.isNone()) {
2646 // plugins/mouse-capture-inside-shadow.html reaches here. 2646 // plugins/mouse-capture-inside-shadow.html reaches here.
2647 return false; 2647 return false;
2648 } 2648 }
2649 2649
2650 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
2651 // needs to be audited. See http://crbug.com/590369 for more details.
2652 localFrame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
2653
2654 DocumentLifecycle::DisallowTransitionScope disallowTransition(localFrame->do cument()->lifecycle());
2655
2650 if (selection.isCaret()) { 2656 if (selection.isCaret()) {
2651 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesh eets
2652 // needs to be audited. See http://crbug.com/590369 for more details.
2653 localFrame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
2654
2655 anchor = focus = selection.absoluteCaretBounds(); 2657 anchor = focus = selection.absoluteCaretBounds();
2656 } else { 2658 } else {
2657 const EphemeralRange selectedRange = selection.selection().toNormalizedE phemeralRange(); 2659 const EphemeralRange selectedRange = selection.selection().toNormalizedE phemeralRange();
2658 if (selectedRange.isNull()) 2660 if (selectedRange.isNull())
2659 return false; 2661 return false;
2660 anchor = localFrame->editor().firstRectForRange(EphemeralRange(selectedR ange.startPosition())); 2662 anchor = localFrame->editor().firstRectForRange(EphemeralRange(selectedR ange.startPosition()));
2661 focus = localFrame->editor().firstRectForRange(EphemeralRange(selectedRa nge.endPosition())); 2663 focus = localFrame->editor().firstRectForRange(EphemeralRange(selectedRa nge.endPosition()));
2662 } 2664 }
2663 2665
2664 anchor = localFrame->view()->contentsToViewport(anchor); 2666 anchor = localFrame->view()->contentsToViewport(anchor);
(...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after
4589 return nullptr; 4591 return nullptr;
4590 return focusedFrame; 4592 return focusedFrame;
4591 } 4593 }
4592 4594
4593 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const 4595 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const
4594 { 4596 {
4595 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4597 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4596 } 4598 }
4597 4599
4598 } // namespace blink 4600 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698