OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 3437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3448 | 3448 |
3449 if (newFocusedElement && newFocusedElement->isFocusable()) { | 3449 if (newFocusedElement && newFocusedElement->isFocusable()) { |
3450 if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(*
newFocusedElement)) { | 3450 if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(*
newFocusedElement)) { |
3451 // delegate blocks focus change | 3451 // delegate blocks focus change |
3452 focusChangeBlocked = true; | 3452 focusChangeBlocked = true; |
3453 goto SetFocusedElementDone; | 3453 goto SetFocusedElementDone; |
3454 } | 3454 } |
3455 // Set focus on the new node | 3455 // Set focus on the new node |
3456 m_focusedElement = newFocusedElement; | 3456 m_focusedElement = newFocusedElement; |
3457 | 3457 |
| 3458 m_focusedElement->setFocus(true); |
| 3459 |
3458 // Dispatch the focus event and let the node do any other focus related
activities (important for text fields) | 3460 // Dispatch the focus event and let the node do any other focus related
activities (important for text fields) |
3459 // If page lost focus, event will be dispatched on page focus, don't dup
licate | 3461 // If page lost focus, event will be dispatched on page focus, don't dup
licate |
3460 if (page() && (page()->focusController().isFocused())) { | 3462 if (page() && (page()->focusController().isFocused())) { |
3461 m_focusedElement->dispatchFocusEvent(oldFocusedElement.get(), type,
sourceCapabilities); | 3463 m_focusedElement->dispatchFocusEvent(oldFocusedElement.get(), type,
sourceCapabilities); |
3462 | 3464 |
3463 | 3465 |
3464 if (m_focusedElement != newFocusedElement) { | 3466 if (m_focusedElement != newFocusedElement) { |
3465 // handler shifted focus | 3467 // handler shifted focus |
3466 focusChangeBlocked = true; | 3468 focusChangeBlocked = true; |
3467 goto SetFocusedElementDone; | 3469 goto SetFocusedElementDone; |
(...skipping 10 matching lines...) Expand all Loading... |
3478 // on it, probably when <rdar://problem/8503958> is m. | 3480 // on it, probably when <rdar://problem/8503958> is m. |
3479 m_focusedElement->dispatchFocusInEvent(EventTypeNames::DOMFocusIn, o
ldFocusedElement.get(), type, sourceCapabilities); // DOM level 2 for compatibil
ity. | 3481 m_focusedElement->dispatchFocusInEvent(EventTypeNames::DOMFocusIn, o
ldFocusedElement.get(), type, sourceCapabilities); // DOM level 2 for compatibil
ity. |
3480 | 3482 |
3481 if (m_focusedElement != newFocusedElement) { | 3483 if (m_focusedElement != newFocusedElement) { |
3482 // handler shifted focus | 3484 // handler shifted focus |
3483 focusChangeBlocked = true; | 3485 focusChangeBlocked = true; |
3484 goto SetFocusedElementDone; | 3486 goto SetFocusedElementDone; |
3485 } | 3487 } |
3486 } | 3488 } |
3487 | 3489 |
3488 m_focusedElement->setFocus(true); | |
3489 | |
3490 if (m_focusedElement->isRootEditableElement()) | 3490 if (m_focusedElement->isRootEditableElement()) |
3491 frame()->spellChecker().didBeginEditing(m_focusedElement.get()); | 3491 frame()->spellChecker().didBeginEditing(m_focusedElement.get()); |
3492 | 3492 |
3493 // eww, I suck. set the qt focus correctly | 3493 // eww, I suck. set the qt focus correctly |
3494 // ### find a better place in the code for this | 3494 // ### find a better place in the code for this |
3495 if (view()) { | 3495 if (view()) { |
3496 Widget* focusWidget = widgetForElement(*m_focusedElement); | 3496 Widget* focusWidget = widgetForElement(*m_focusedElement); |
3497 if (focusWidget) { | 3497 if (focusWidget) { |
3498 // Make sure a widget has the right size before giving it focus. | 3498 // Make sure a widget has the right size before giving it focus. |
3499 // Otherwise, we are testing edge cases of the Widget code. | 3499 // Otherwise, we are testing edge cases of the Widget code. |
(...skipping 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5718 #ifndef NDEBUG | 5718 #ifndef NDEBUG |
5719 using namespace blink; | 5719 using namespace blink; |
5720 void showLiveDocumentInstances() | 5720 void showLiveDocumentInstances() |
5721 { | 5721 { |
5722 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 5722 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
5723 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5723 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5724 for (Document* document : set) | 5724 for (Document* document : set) |
5725 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5725 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
5726 } | 5726 } |
5727 #endif | 5727 #endif |
OLD | NEW |