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 2277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2288 // focused, then the focus element shows with a focus ring but | 2288 // focused, then the focus element shows with a focus ring but |
2289 // no caret and does respond to keyboard inputs. | 2289 // no caret and does respond to keyboard inputs. |
2290 if (element->isTextFormControl()) { | 2290 if (element->isTextFormControl()) { |
2291 element->updateFocusAppearance(SelectionBehaviorOnFocus::Res
tore); | 2291 element->updateFocusAppearance(SelectionBehaviorOnFocus::Res
tore); |
2292 } else if (element->isContentEditable()) { | 2292 } else if (element->isContentEditable()) { |
2293 // updateFocusAppearance() selects all the text of | 2293 // updateFocusAppearance() selects all the text of |
2294 // contentseditable DIVs. So we set the selection explicitly | 2294 // contentseditable DIVs. So we set the selection explicitly |
2295 // instead. Note that this has the side effect of moving the | 2295 // instead. Note that this has the side effect of moving the |
2296 // caret back to the beginning of the text. | 2296 // caret back to the beginning of the text. |
2297 Position position(element, 0); | 2297 Position position(element, 0); |
2298 focusedFrame->selection().setSelection(VisibleSelection(posi
tion, SEL_DEFAULT_AFFINITY)); | 2298 focusedFrame->selection().setSelection(VisibleSelection(posi
tion, SelDefaultAffinity)); |
2299 } | 2299 } |
2300 } | 2300 } |
2301 } | 2301 } |
2302 m_imeAcceptEvents = true; | 2302 m_imeAcceptEvents = true; |
2303 } else { | 2303 } else { |
2304 hidePopups(); | 2304 hidePopups(); |
2305 | 2305 |
2306 // Clear focus on the currently focused frame if any. | 2306 // Clear focus on the currently focused frame if any. |
2307 if (!m_page) | 2307 if (!m_page) |
2308 return; | 2308 return; |
(...skipping 2325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4634 { | 4634 { |
4635 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than | 4635 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than |
4636 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4636 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
4637 if (!page()) | 4637 if (!page()) |
4638 return 1; | 4638 return 1; |
4639 | 4639 |
4640 return page()->deviceScaleFactor(); | 4640 return page()->deviceScaleFactor(); |
4641 } | 4641 } |
4642 | 4642 |
4643 } // namespace blink | 4643 } // namespace blink |
OLD | NEW |