| OLD | NEW |
| 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 // code needs to be refactored (http://crbug.com/629721). | 670 // code needs to be refactored (http://crbug.com/629721). |
| 671 bool WebFrameWidgetImpl::IsSelectionAnchorFirst() const { | 671 bool WebFrameWidgetImpl::IsSelectionAnchorFirst() const { |
| 672 if (const LocalFrame* frame = FocusedLocalFrameInWidget()) { | 672 if (const LocalFrame* frame = FocusedLocalFrameInWidget()) { |
| 673 FrameSelection& selection = frame->Selection(); | 673 FrameSelection& selection = frame->Selection(); |
| 674 return selection.IsAvailable() && | 674 return selection.IsAvailable() && |
| 675 selection.ComputeVisibleSelectionInDOMTreeDeprecated().IsBaseFirst(); | 675 selection.ComputeVisibleSelectionInDOMTreeDeprecated().IsBaseFirst(); |
| 676 } | 676 } |
| 677 return false; | 677 return false; |
| 678 } | 678 } |
| 679 | 679 |
| 680 // TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This | |
| 681 // code needs to be refactored (http://crbug.com/629721). | |
| 682 WebRange WebFrameWidgetImpl::CaretOrSelectionRange() { | |
| 683 LocalFrame* focused = FocusedLocalFrameInWidget(); | |
| 684 if (!focused) | |
| 685 return WebRange(); | |
| 686 | |
| 687 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets | |
| 688 // needs to be audited. See http://crbug.com/590369 for more details. | |
| 689 focused->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); | |
| 690 | |
| 691 return focused->GetInputMethodController().GetSelectionOffsets(); | |
| 692 } | |
| 693 | |
| 694 void WebFrameWidgetImpl::SetTextDirection(WebTextDirection direction) { | 680 void WebFrameWidgetImpl::SetTextDirection(WebTextDirection direction) { |
| 695 // The Editor::setBaseWritingDirection() function checks if we can change | 681 // The Editor::setBaseWritingDirection() function checks if we can change |
| 696 // the text direction of the selected node and updates its DOM "dir" | 682 // the text direction of the selected node and updates its DOM "dir" |
| 697 // attribute and its CSS "direction" property. | 683 // attribute and its CSS "direction" property. |
| 698 // So, we just call the function as Safari does. | 684 // So, we just call the function as Safari does. |
| 699 const LocalFrame* focused = FocusedLocalFrameInWidget(); | 685 const LocalFrame* focused = FocusedLocalFrameInWidget(); |
| 700 if (!focused) | 686 if (!focused) |
| 701 return; | 687 return; |
| 702 | 688 |
| 703 Editor& editor = focused->GetEditor(); | 689 Editor& editor = focused->GetEditor(); |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 : nullptr; | 1198 : nullptr; |
| 1213 } | 1199 } |
| 1214 | 1200 |
| 1215 LocalFrame* WebFrameWidgetImpl::FocusedLocalFrameAvailableForIme() const { | 1201 LocalFrame* WebFrameWidgetImpl::FocusedLocalFrameAvailableForIme() const { |
| 1216 if (!ime_accept_events_) | 1202 if (!ime_accept_events_) |
| 1217 return nullptr; | 1203 return nullptr; |
| 1218 return FocusedLocalFrameInWidget(); | 1204 return FocusedLocalFrameInWidget(); |
| 1219 } | 1205 } |
| 1220 | 1206 |
| 1221 } // namespace blink | 1207 } // namespace blink |
| OLD | NEW |