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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 focusedFrame->document()->updateStyleAndLayoutTree(); | 440 focusedFrame->document()->updateStyleAndLayoutTree(); |
441 if (element->isTextFormControl()) { | 441 if (element->isTextFormControl()) { |
442 element->updateFocusAppearance(SelectionBehaviorOnFocus::Restore); | 442 element->updateFocusAppearance(SelectionBehaviorOnFocus::Restore); |
443 } else if (hasEditableStyle(*element)) { | 443 } else if (hasEditableStyle(*element)) { |
444 // updateFocusAppearance() selects all the text of | 444 // updateFocusAppearance() selects all the text of |
445 // contentseditable DIVs. So we set the selection explicitly | 445 // contentseditable DIVs. So we set the selection explicitly |
446 // instead. Note that this has the side effect of moving the | 446 // instead. Note that this has the side effect of moving the |
447 // caret back to the beginning of the text. | 447 // caret back to the beginning of the text. |
448 Position position(element, 0); | 448 Position position(element, 0); |
449 focusedFrame->selection().setSelection( | 449 focusedFrame->selection().setSelection( |
450 createVisibleSelection(position, SelDefaultAffinity)); | 450 SelectionInDOMTree::Builder().collapse(position).build()); |
451 } | 451 } |
452 } | 452 } |
453 } | 453 } |
454 } else { | 454 } else { |
455 LocalFrame* focusedFrame = focusedLocalFrameInWidget(); | 455 LocalFrame* focusedFrame = focusedLocalFrameInWidget(); |
456 if (focusedFrame) { | 456 if (focusedFrame) { |
457 // Finish an ongoing composition to delete the composition node. | 457 // Finish an ongoing composition to delete the composition node. |
458 if (focusedFrame->inputMethodController().hasComposition()) { | 458 if (focusedFrame->inputMethodController().hasComposition()) { |
459 WebAutofillClient* autofillClient = | 459 WebAutofillClient* autofillClient = |
460 WebLocalFrameImpl::fromFrame(focusedFrame)->autofillClient(); | 460 WebLocalFrameImpl::fromFrame(focusedFrame)->autofillClient(); |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 return nullptr; | 1326 return nullptr; |
1327 } | 1327 } |
1328 | 1328 |
1329 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const { | 1329 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const { |
1330 if (!m_imeAcceptEvents) | 1330 if (!m_imeAcceptEvents) |
1331 return nullptr; | 1331 return nullptr; |
1332 return focusedLocalFrameInWidget(); | 1332 return focusedLocalFrameInWidget(); |
1333 } | 1333 } |
1334 | 1334 |
1335 } // namespace blink | 1335 } // namespace blink |
OLD | NEW |