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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 | 744 |
745 // TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This | 745 // TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This |
746 // code needs to be refactored (http://crbug.com/629721). | 746 // code needs to be refactored (http://crbug.com/629721). |
747 bool WebFrameWidgetImpl::selectionBounds(WebRect& anchor, WebRect& focus) const | 747 bool WebFrameWidgetImpl::selectionBounds(WebRect& anchor, WebRect& focus) const |
748 { | 748 { |
749 const LocalFrame* localFrame = focusedLocalFrameInWidget(); | 749 const LocalFrame* localFrame = focusedLocalFrameInWidget(); |
750 if (!localFrame) | 750 if (!localFrame) |
751 return false; | 751 return false; |
752 | 752 |
753 FrameSelection& selection = localFrame->selection(); | 753 FrameSelection& selection = localFrame->selection(); |
| 754 if (selection.isNone()) |
| 755 return false; |
| 756 |
| 757 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| 758 // needs to be audited. See http://crbug.com/590369 for more details. |
| 759 localFrame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 760 |
| 761 DocumentLifecycle::DisallowTransitionScope disallowTransition(localFrame->do
cument()->lifecycle()); |
754 | 762 |
755 if (selection.isCaret()) { | 763 if (selection.isCaret()) { |
756 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesh
eets | |
757 // needs to be audited. See http://crbug.com/590369 for more details. | |
758 localFrame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); | |
759 | |
760 anchor = focus = selection.absoluteCaretBounds(); | 764 anchor = focus = selection.absoluteCaretBounds(); |
761 } else { | 765 } else { |
762 const EphemeralRange selectedRange = selection.selection().toNormalizedE
phemeralRange(); | 766 const EphemeralRange selectedRange = selection.selection().toNormalizedE
phemeralRange(); |
763 if (selectedRange.isNull()) | 767 if (selectedRange.isNull()) |
764 return false; | 768 return false; |
765 anchor = localFrame->editor().firstRectForRange(EphemeralRange(selectedR
ange.startPosition())); | 769 anchor = localFrame->editor().firstRectForRange(EphemeralRange(selectedR
ange.startPosition())); |
766 focus = localFrame->editor().firstRectForRange(EphemeralRange(selectedRa
nge.endPosition())); | 770 focus = localFrame->editor().firstRectForRange(EphemeralRange(selectedRa
nge.endPosition())); |
767 } | 771 } |
768 | 772 |
769 // FIXME: This doesn't apply page scale. This should probably be contents to
viewport. crbug.com/459293. | 773 // FIXME: This doesn't apply page scale. This should probably be contents to
viewport. crbug.com/459293. |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 } | 1497 } |
1494 | 1498 |
1495 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const | 1499 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const |
1496 { | 1500 { |
1497 if (!m_imeAcceptEvents) | 1501 if (!m_imeAcceptEvents) |
1498 return nullptr; | 1502 return nullptr; |
1499 return focusedLocalFrameInWidget(); | 1503 return focusedLocalFrameInWidget(); |
1500 } | 1504 } |
1501 | 1505 |
1502 } // namespace blink | 1506 } // namespace blink |
OLD | NEW |