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

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

Issue 2910223003: [refactor] - Rename and Move WebWidget::CaretOrSelectionRange to WebInputMethodController::GetSelec… (Closed)
Patch Set: Fixed some comments Created 3 years, 6 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) 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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 // code needs to be refactored (http://crbug.com/629721). 662 // code needs to be refactored (http://crbug.com/629721).
663 bool WebFrameWidgetImpl::IsSelectionAnchorFirst() const { 663 bool WebFrameWidgetImpl::IsSelectionAnchorFirst() const {
664 if (const LocalFrame* frame = FocusedLocalFrameInWidget()) { 664 if (const LocalFrame* frame = FocusedLocalFrameInWidget()) {
665 return frame->Selection() 665 return frame->Selection()
666 .ComputeVisibleSelectionInDOMTreeDeprecated() 666 .ComputeVisibleSelectionInDOMTreeDeprecated()
667 .IsBaseFirst(); 667 .IsBaseFirst();
668 } 668 }
669 return false; 669 return false;
670 } 670 }
671 671
672 // TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This
673 // code needs to be refactored (http://crbug.com/629721).
674 WebRange WebFrameWidgetImpl::CaretOrSelectionRange() {
675 LocalFrame* focused = FocusedLocalFrameInWidget();
676 if (!focused)
677 return WebRange();
678
679 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets
680 // needs to be audited. See http://crbug.com/590369 for more details.
681 focused->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
682
683 return focused->GetInputMethodController().GetSelectionOffsets();
684 }
685
686 void WebFrameWidgetImpl::SetTextDirection(WebTextDirection direction) { 672 void WebFrameWidgetImpl::SetTextDirection(WebTextDirection direction) {
687 // The Editor::setBaseWritingDirection() function checks if we can change 673 // The Editor::setBaseWritingDirection() function checks if we can change
688 // the text direction of the selected node and updates its DOM "dir" 674 // the text direction of the selected node and updates its DOM "dir"
689 // attribute and its CSS "direction" property. 675 // attribute and its CSS "direction" property.
690 // So, we just call the function as Safari does. 676 // So, we just call the function as Safari does.
691 const LocalFrame* focused = FocusedLocalFrameInWidget(); 677 const LocalFrame* focused = FocusedLocalFrameInWidget();
692 if (!focused) 678 if (!focused)
693 return; 679 return;
694 680
695 Editor& editor = focused->GetEditor(); 681 Editor& editor = focused->GetEditor();
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 : nullptr; 1181 : nullptr;
1196 } 1182 }
1197 1183
1198 LocalFrame* WebFrameWidgetImpl::FocusedLocalFrameAvailableForIme() const { 1184 LocalFrame* WebFrameWidgetImpl::FocusedLocalFrameAvailableForIme() const {
1199 if (!ime_accept_events_) 1185 if (!ime_accept_events_)
1200 return nullptr; 1186 return nullptr;
1201 return FocusedLocalFrameInWidget(); 1187 return FocusedLocalFrameInWidget();
1202 } 1188 }
1203 1189
1204 } // namespace blink 1190 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698