OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 } | 1416 } |
1417 | 1417 |
1418 void WebViewImpl::mouseCaptureLost() | 1418 void WebViewImpl::mouseCaptureLost() |
1419 { | 1419 { |
1420 m_mouseCaptureNode = 0; | 1420 m_mouseCaptureNode = 0; |
1421 } | 1421 } |
1422 | 1422 |
1423 void WebViewImpl::setFocus(bool enable) | 1423 void WebViewImpl::setFocus(bool enable) |
1424 { | 1424 { |
1425 m_page->focusController()->setFocused(enable); | 1425 m_page->focusController()->setFocused(enable); |
1426 m_page->focusController()->setActive(enable); | |
1427 if (enable) { | 1426 if (enable) { |
| 1427 // Note that we don't call setActive() when disabled as this cause extra |
| 1428 // focus/blur events to be dispatched. |
| 1429 m_page->focusController()->setActive(true); |
1428 RefPtr<Frame> focusedFrame = m_page->focusController()->focusedFrame(); | 1430 RefPtr<Frame> focusedFrame = m_page->focusController()->focusedFrame(); |
1429 if (focusedFrame) { | 1431 if (focusedFrame) { |
1430 Node* focusedNode = focusedFrame->document()->focusedNode(); | 1432 Node* focusedNode = focusedFrame->document()->focusedNode(); |
1431 if (focusedNode && focusedNode->isElementNode() | 1433 if (focusedNode && focusedNode->isElementNode() |
1432 && focusedFrame->selection()->selection().isNone()) { | 1434 && focusedFrame->selection()->selection().isNone()) { |
1433 // If the selection was cleared while the WebView was not | 1435 // If the selection was cleared while the WebView was not |
1434 // focused, then the focus element shows with a focus ring but | 1436 // focused, then the focus element shows with a focus ring but |
1435 // no caret and does respond to keyboard inputs. | 1437 // no caret and does respond to keyboard inputs. |
1436 Element* element = static_cast<Element*>(focusedNode); | 1438 Element* element = static_cast<Element*>(focusedNode); |
1437 if (element->isTextFormControl()) | 1439 if (element->isTextFormControl()) |
(...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3066 } | 3068 } |
3067 | 3069 |
3068 #if ENABLE(GESTURE_RECOGNIZER) | 3070 #if ENABLE(GESTURE_RECOGNIZER) |
3069 void WebViewImpl::resetGestureRecognizer() | 3071 void WebViewImpl::resetGestureRecognizer() |
3070 { | 3072 { |
3071 m_gestureRecognizer->reset(); | 3073 m_gestureRecognizer->reset(); |
3072 } | 3074 } |
3073 #endif | 3075 #endif |
3074 | 3076 |
3075 } // namespace WebKit | 3077 } // namespace WebKit |
OLD | NEW |