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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 #include "core/inspector/ScriptCallStack.h" | 144 #include "core/inspector/ScriptCallStack.h" |
145 #include "core/loader/CookieJar.h" | 145 #include "core/loader/CookieJar.h" |
146 #include "core/loader/DocumentLoader.h" | 146 #include "core/loader/DocumentLoader.h" |
147 #include "core/loader/FrameLoader.h" | 147 #include "core/loader/FrameLoader.h" |
148 #include "core/loader/FrameLoaderClient.h" | 148 #include "core/loader/FrameLoaderClient.h" |
149 #include "core/loader/ImageLoader.h" | 149 #include "core/loader/ImageLoader.h" |
150 #include "core/loader/appcache/ApplicationCacheHost.h" | 150 #include "core/loader/appcache/ApplicationCacheHost.h" |
151 #include "core/page/Chrome.h" | 151 #include "core/page/Chrome.h" |
152 #include "core/page/ChromeClient.h" | 152 #include "core/page/ChromeClient.h" |
153 #include "core/page/EventHandler.h" | 153 #include "core/page/EventHandler.h" |
| 154 #include "core/page/FocusController.h" |
154 #include "core/page/FrameTree.h" | 155 #include "core/page/FrameTree.h" |
155 #include "core/page/MouseEventWithHitTestResults.h" | 156 #include "core/page/MouseEventWithHitTestResults.h" |
156 #include "core/page/Page.h" | 157 #include "core/page/Page.h" |
157 #include "core/page/PageConsole.h" | 158 #include "core/page/PageConsole.h" |
158 #include "core/page/PointerLockController.h" | 159 #include "core/page/PointerLockController.h" |
159 #include "core/page/Settings.h" | 160 #include "core/page/Settings.h" |
160 #include "core/page/scrolling/ScrollingCoordinator.h" | 161 #include "core/page/scrolling/ScrollingCoordinator.h" |
161 #include "core/platform/ScrollbarTheme.h" | 162 #include "core/platform/ScrollbarTheme.h" |
162 #include "core/rendering/HitTestRequest.h" | 163 #include "core/rendering/HitTestRequest.h" |
163 #include "core/rendering/HitTestResult.h" | 164 #include "core/rendering/HitTestResult.h" |
(...skipping 3163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3327 if (oldFocusedElement->active()) | 3328 if (oldFocusedElement->active()) |
3328 oldFocusedElement->setActive(false); | 3329 oldFocusedElement->setActive(false); |
3329 | 3330 |
3330 oldFocusedElement->setFocus(false); | 3331 oldFocusedElement->setFocus(false); |
3331 | 3332 |
3332 // Dispatch a change event for text fields or textareas that have been e
dited | 3333 // Dispatch a change event for text fields or textareas that have been e
dited |
3333 if (oldFocusedElement->wasChangedSinceLastFormControlChangeEvent()) | 3334 if (oldFocusedElement->wasChangedSinceLastFormControlChangeEvent()) |
3334 oldFocusedElement->dispatchFormControlChangeEvent(); | 3335 oldFocusedElement->dispatchFormControlChangeEvent(); |
3335 | 3336 |
3336 // Dispatch the blur event and let the node do any other blur related ac
tivities (important for text fields) | 3337 // Dispatch the blur event and let the node do any other blur related ac
tivities (important for text fields) |
3337 oldFocusedElement->dispatchBlurEvent(newFocusedElement.get()); | 3338 // If page lost focus, blur event will have already been dispatched |
| 3339 if (page() && (page()->focusController().isFocused())) { |
| 3340 oldFocusedElement->dispatchBlurEvent(newFocusedElement.get()); |
3338 | 3341 |
3339 if (m_focusedElement) { | 3342 if (m_focusedElement) { |
3340 // handler shifted focus | 3343 // handler shifted focus |
3341 focusChangeBlocked = true; | 3344 focusChangeBlocked = true; |
3342 newFocusedElement = 0; | 3345 newFocusedElement = 0; |
3343 } | 3346 } |
3344 | 3347 |
3345 oldFocusedElement->dispatchFocusOutEvent(EventTypeNames::focusout, newFo
cusedElement.get()); // DOM level 3 name for the bubbling blur event. | 3348 oldFocusedElement->dispatchFocusOutEvent(EventTypeNames::focusout, n
ewFocusedElement.get()); // DOM level 3 name for the bubbling blur event. |
3346 // FIXME: We should remove firing DOMFocusOutEvent event when we are sur
e no content depends | 3349 // FIXME: We should remove firing DOMFocusOutEvent event when we are
sure no content depends |
3347 // on it, probably when <rdar://problem/8503958> is resolved. | 3350 // on it, probably when <rdar://problem/8503958> is resolved. |
3348 oldFocusedElement->dispatchFocusOutEvent(EventTypeNames::DOMFocusOut, ne
wFocusedElement.get()); // DOM level 2 name for compatibility. | 3351 oldFocusedElement->dispatchFocusOutEvent(EventTypeNames::DOMFocusOut
, newFocusedElement.get()); // DOM level 2 name for compatibility. |
3349 | 3352 |
3350 if (m_focusedElement) { | 3353 if (m_focusedElement) { |
3351 // handler shifted focus | 3354 // handler shifted focus |
3352 focusChangeBlocked = true; | 3355 focusChangeBlocked = true; |
3353 newFocusedElement = 0; | 3356 newFocusedElement = 0; |
| 3357 } |
3354 } | 3358 } |
3355 | 3359 |
3356 if (view()) { | 3360 if (view()) { |
3357 Widget* oldWidget = widgetForElement(oldFocusedElement.get()); | 3361 Widget* oldWidget = widgetForElement(oldFocusedElement.get()); |
3358 if (oldWidget) | 3362 if (oldWidget) |
3359 oldWidget->setFocus(false); | 3363 oldWidget->setFocus(false); |
3360 else | 3364 else |
3361 view()->setFocus(false); | 3365 view()->setFocus(false); |
3362 } | 3366 } |
3363 | 3367 |
3364 // Autofill client may have modified the value of newFocusedElement, thu
s require | 3368 // Autofill client may have modified the value of newFocusedElement, thu
s require |
3365 // a layout update here, otherwise it will assert at newFocusedElement->
isFocusable(). | 3369 // a layout update here, otherwise it will assert at newFocusedElement->
isFocusable(). |
3366 // See crbug.com/251163. | 3370 // See crbug.com/251163. |
3367 updateLayoutIgnorePendingStylesheets(); | 3371 updateLayoutIgnorePendingStylesheets(); |
3368 } | 3372 } |
3369 | 3373 |
3370 if (newFocusedElement && newFocusedElement->isFocusable()) { | 3374 if (newFocusedElement && newFocusedElement->isFocusable()) { |
3371 if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(n
ewFocusedElement.get())) { | 3375 if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(n
ewFocusedElement.get())) { |
3372 // delegate blocks focus change | 3376 // delegate blocks focus change |
3373 focusChangeBlocked = true; | 3377 focusChangeBlocked = true; |
3374 goto SetFocusedElementDone; | 3378 goto SetFocusedElementDone; |
3375 } | 3379 } |
3376 // Set focus on the new node | 3380 // Set focus on the new node |
3377 m_focusedElement = newFocusedElement; | 3381 m_focusedElement = newFocusedElement; |
3378 | 3382 |
3379 // Dispatch the focus event and let the node do any other focus related
activities (important for text fields) | 3383 // Dispatch the focus event and let the node do any other focus related
activities (important for text fields) |
3380 m_focusedElement->dispatchFocusEvent(oldFocusedElement.get(), direction)
; | 3384 // If page lost focus, event will be dispatched on page focus, don't dup
licate |
| 3385 if (page() && (page()->focusController().isFocused())) { |
| 3386 m_focusedElement->dispatchFocusEvent(oldFocusedElement.get(), direct
ion); |
3381 | 3387 |
3382 if (m_focusedElement != newFocusedElement) { | 3388 if (m_focusedElement != newFocusedElement) { |
3383 // handler shifted focus | 3389 // handler shifted focus |
3384 focusChangeBlocked = true; | 3390 focusChangeBlocked = true; |
3385 goto SetFocusedElementDone; | 3391 goto SetFocusedElementDone; |
| 3392 } |
| 3393 |
| 3394 m_focusedElement->dispatchFocusInEvent(EventTypeNames::focusin, oldF
ocusedElement.get()); // DOM level 3 bubbling focus event. |
| 3395 |
| 3396 if (m_focusedElement != newFocusedElement) { |
| 3397 // handler shifted focus |
| 3398 focusChangeBlocked = true; |
| 3399 goto SetFocusedElementDone; |
| 3400 } |
| 3401 |
| 3402 // FIXME: We should remove firing DOMFocusInEvent event when we are
sure no content depends |
| 3403 // on it, probably when <rdar://problem/8503958> is m. |
| 3404 m_focusedElement->dispatchFocusInEvent(EventTypeNames::DOMFocusIn, o
ldFocusedElement.get()); // DOM level 2 for compatibility. |
| 3405 |
| 3406 if (m_focusedElement != newFocusedElement) { |
| 3407 // handler shifted focus |
| 3408 focusChangeBlocked = true; |
| 3409 goto SetFocusedElementDone; |
| 3410 } |
3386 } | 3411 } |
3387 | 3412 |
3388 m_focusedElement->dispatchFocusInEvent(EventTypeNames::focusin, oldFocus
edElement.get()); // DOM level 3 bubbling focus event. | |
3389 | |
3390 if (m_focusedElement != newFocusedElement) { | |
3391 // handler shifted focus | |
3392 focusChangeBlocked = true; | |
3393 goto SetFocusedElementDone; | |
3394 } | |
3395 | |
3396 // FIXME: We should remove firing DOMFocusInEvent event when we are sure
no content depends | |
3397 // on it, probably when <rdar://problem/8503958> is m. | |
3398 m_focusedElement->dispatchFocusInEvent(EventTypeNames::DOMFocusIn, oldFo
cusedElement.get()); // DOM level 2 for compatibility. | |
3399 | |
3400 if (m_focusedElement != newFocusedElement) { | |
3401 // handler shifted focus | |
3402 focusChangeBlocked = true; | |
3403 goto SetFocusedElementDone; | |
3404 } | |
3405 m_focusedElement->setFocus(true); | 3413 m_focusedElement->setFocus(true); |
3406 | 3414 |
3407 if (m_focusedElement->isRootEditableElement()) | 3415 if (m_focusedElement->isRootEditableElement()) |
3408 frame()->editor().didBeginEditing(m_focusedElement.get()); | 3416 frame()->editor().didBeginEditing(m_focusedElement.get()); |
3409 | 3417 |
3410 // eww, I suck. set the qt focus correctly | 3418 // eww, I suck. set the qt focus correctly |
3411 // ### find a better place in the code for this | 3419 // ### find a better place in the code for this |
3412 if (view()) { | 3420 if (view()) { |
3413 Widget* focusWidget = widgetForElement(m_focusedElement.get()); | 3421 Widget* focusWidget = widgetForElement(m_focusedElement.get()); |
3414 if (focusWidget) { | 3422 if (focusWidget) { |
(...skipping 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5348 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style
ResolverUpdateMode updateMode) | 5356 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style
ResolverUpdateMode updateMode) |
5349 { | 5357 { |
5350 if (!isActive()) | 5358 if (!isActive()) |
5351 return; | 5359 return; |
5352 | 5360 |
5353 styleEngine()->modifiedStyleSheet(sheet); | 5361 styleEngine()->modifiedStyleSheet(sheet); |
5354 styleResolverChanged(when, updateMode); | 5362 styleResolverChanged(when, updateMode); |
5355 } | 5363 } |
5356 | 5364 |
5357 } // namespace WebCore | 5365 } // namespace WebCore |
OLD | NEW |