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 2175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2186 m_page->focusController().setActive(true); | 2186 m_page->focusController().setActive(true); |
2187 RefPtrWillBeRawPtr<Frame> focusedFrame = m_page->focusController().focus
edFrame(); | 2187 RefPtrWillBeRawPtr<Frame> focusedFrame = m_page->focusController().focus
edFrame(); |
2188 if (focusedFrame && focusedFrame->isLocalFrame()) { | 2188 if (focusedFrame && focusedFrame->isLocalFrame()) { |
2189 LocalFrame* localFrame = toLocalFrame(focusedFrame.get()); | 2189 LocalFrame* localFrame = toLocalFrame(focusedFrame.get()); |
2190 Element* element = localFrame->document()->focusedElement(); | 2190 Element* element = localFrame->document()->focusedElement(); |
2191 if (element && localFrame->selection().selection().isNone()) { | 2191 if (element && localFrame->selection().selection().isNone()) { |
2192 // If the selection was cleared while the WebView was not | 2192 // If the selection was cleared while the WebView was not |
2193 // focused, then the focus element shows with a focus ring but | 2193 // focused, then the focus element shows with a focus ring but |
2194 // no caret and does respond to keyboard inputs. | 2194 // no caret and does respond to keyboard inputs. |
2195 if (element->isTextFormControl()) { | 2195 if (element->isTextFormControl()) { |
2196 element->updateFocusAppearance(true); | 2196 element->updateFocusAppearance(SelectionBehaviorOnFocus::Res
tore); |
2197 } else if (element->isContentEditable()) { | 2197 } else if (element->isContentEditable()) { |
2198 // updateFocusAppearance() selects all the text of | 2198 // updateFocusAppearance() selects all the text of |
2199 // contentseditable DIVs. So we set the selection explicitly | 2199 // contentseditable DIVs. So we set the selection explicitly |
2200 // instead. Note that this has the side effect of moving the | 2200 // instead. Note that this has the side effect of moving the |
2201 // caret back to the beginning of the text. | 2201 // caret back to the beginning of the text. |
2202 Position position(element, 0); | 2202 Position position(element, 0); |
2203 localFrame->selection().setSelection(VisibleSelection(positi
on, SEL_DEFAULT_AFFINITY)); | 2203 localFrame->selection().setSelection(VisibleSelection(positi
on, SEL_DEFAULT_AFFINITY)); |
2204 } | 2204 } |
2205 } | 2205 } |
2206 } | 2206 } |
(...skipping 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4466 if (m_pageColorOverlay) | 4466 if (m_pageColorOverlay) |
4467 m_pageColorOverlay->update(); | 4467 m_pageColorOverlay->update(); |
4468 if (InspectorOverlay* overlay = inspectorOverlay()) { | 4468 if (InspectorOverlay* overlay = inspectorOverlay()) { |
4469 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); | 4469 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); |
4470 if (inspectorPageOverlay) | 4470 if (inspectorPageOverlay) |
4471 inspectorPageOverlay->update(); | 4471 inspectorPageOverlay->update(); |
4472 } | 4472 } |
4473 } | 4473 } |
4474 | 4474 |
4475 } // namespace blink | 4475 } // namespace blink |
OLD | NEW |