OLD | NEW |
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 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2371 focusedFrame->document()->updateStyleAndLayoutTree(); | 2371 focusedFrame->document()->updateStyleAndLayoutTree(); |
2372 if (element->isTextFormControl()) { | 2372 if (element->isTextFormControl()) { |
2373 element->updateFocusAppearance(SelectionBehaviorOnFocus::Restore); | 2373 element->updateFocusAppearance(SelectionBehaviorOnFocus::Restore); |
2374 } else if (hasEditableStyle(*element)) { | 2374 } else if (hasEditableStyle(*element)) { |
2375 // updateFocusAppearance() selects all the text of | 2375 // updateFocusAppearance() selects all the text of |
2376 // contentseditable DIVs. So we set the selection explicitly | 2376 // contentseditable DIVs. So we set the selection explicitly |
2377 // instead. Note that this has the side effect of moving the | 2377 // instead. Note that this has the side effect of moving the |
2378 // caret back to the beginning of the text. | 2378 // caret back to the beginning of the text. |
2379 Position position(element, 0); | 2379 Position position(element, 0); |
2380 focusedFrame->selection().setSelection( | 2380 focusedFrame->selection().setSelection( |
2381 createVisibleSelection(position, SelDefaultAffinity)); | 2381 SelectionInDOMTree::Builder().collapse(position).build()); |
2382 } | 2382 } |
2383 } | 2383 } |
2384 } | 2384 } |
2385 m_imeAcceptEvents = true; | 2385 m_imeAcceptEvents = true; |
2386 } else { | 2386 } else { |
2387 hidePopups(); | 2387 hidePopups(); |
2388 | 2388 |
2389 // Clear focus on the currently focused frame if any. | 2389 // Clear focus on the currently focused frame if any. |
2390 if (!m_page) | 2390 if (!m_page) |
2391 return; | 2391 return; |
(...skipping 2159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4551 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4551 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
4552 return nullptr; | 4552 return nullptr; |
4553 return focusedFrame; | 4553 return focusedFrame; |
4554 } | 4554 } |
4555 | 4555 |
4556 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4556 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
4557 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4557 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
4558 } | 4558 } |
4559 | 4559 |
4560 } // namespace blink | 4560 } // namespace blink |
OLD | NEW |