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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 if (!renderer || !renderer->isWidget()) | 297 if (!renderer || !renderer->isWidget()) |
298 return 0; | 298 return 0; |
299 return toRenderWidget(renderer)->widget(); | 299 return toRenderWidget(renderer)->widget(); |
300 } | 300 } |
301 | 301 |
302 static bool acceptsEditingFocus(Element* element) | 302 static bool acceptsEditingFocus(Element* element) |
303 { | 303 { |
304 ASSERT(element); | 304 ASSERT(element); |
305 ASSERT(element->rendererIsEditable()); | 305 ASSERT(element->rendererIsEditable()); |
306 | 306 |
307 Element* root = element->rootEditableElement(); | 307 return element->document().frame() && element->rootEditableElement(); |
308 Frame* frame = element->document().frame(); | |
309 if (!frame || !root) | |
310 return false; | |
311 | |
312 return frame->editor().shouldBeginEditing(rangeOfContents(root).get()); | |
313 } | 308 } |
314 | 309 |
315 static bool canAccessAncestor(const SecurityOrigin* activeSecurityOrigin, Frame*
targetFrame) | 310 static bool canAccessAncestor(const SecurityOrigin* activeSecurityOrigin, Frame*
targetFrame) |
316 { | 311 { |
317 // targetFrame can be 0 when we're trying to navigate a top-level frame | 312 // targetFrame can be 0 when we're trying to navigate a top-level frame |
318 // that has a 0 opener. | 313 // that has a 0 opener. |
319 if (!targetFrame) | 314 if (!targetFrame) |
320 return false; | 315 return false; |
321 | 316 |
322 const bool isLocalActiveOrigin = activeSecurityOrigin->isLocal(); | 317 const bool isLocalActiveOrigin = activeSecurityOrigin->isLocal(); |
(...skipping 2982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3305 // FIXME: We should remove firing DOMFocusOutEvent event when we are sur
e no content depends | 3300 // FIXME: We should remove firing DOMFocusOutEvent event when we are sur
e no content depends |
3306 // on it, probably when <rdar://problem/8503958> is resolved. | 3301 // on it, probably when <rdar://problem/8503958> is resolved. |
3307 oldFocusedElement->dispatchFocusOutEvent(EventNames::DOMFocusOut, newFoc
usedElement.get()); // DOM level 2 name for compatibility. | 3302 oldFocusedElement->dispatchFocusOutEvent(EventNames::DOMFocusOut, newFoc
usedElement.get()); // DOM level 2 name for compatibility. |
3308 | 3303 |
3309 if (m_focusedElement) { | 3304 if (m_focusedElement) { |
3310 // handler shifted focus | 3305 // handler shifted focus |
3311 focusChangeBlocked = true; | 3306 focusChangeBlocked = true; |
3312 newFocusedElement = 0; | 3307 newFocusedElement = 0; |
3313 } | 3308 } |
3314 | 3309 |
3315 if (oldFocusedElement->isRootEditableElement()) | |
3316 frame()->editor().didEndEditing(); | |
3317 | |
3318 if (view()) { | 3310 if (view()) { |
3319 Widget* oldWidget = widgetForElement(oldFocusedElement.get()); | 3311 Widget* oldWidget = widgetForElement(oldFocusedElement.get()); |
3320 if (oldWidget) | 3312 if (oldWidget) |
3321 oldWidget->setFocus(false); | 3313 oldWidget->setFocus(false); |
3322 else | 3314 else |
3323 view()->setFocus(false); | 3315 view()->setFocus(false); |
3324 } | 3316 } |
3325 | 3317 |
3326 // Autofill client may have modified the value of newFocusedElement, thu
s require | 3318 // Autofill client may have modified the value of newFocusedElement, thu
s require |
3327 // a layout update here, otherwise it will assert at newFocusedElement->
isFocusable(). | 3319 // a layout update here, otherwise it will assert at newFocusedElement->
isFocusable(). |
(...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5301 { | 5293 { |
5302 return DocumentLifecycleNotifier::create(this); | 5294 return DocumentLifecycleNotifier::create(this); |
5303 } | 5295 } |
5304 | 5296 |
5305 DocumentLifecycleNotifier* Document::lifecycleNotifier() | 5297 DocumentLifecycleNotifier* Document::lifecycleNotifier() |
5306 { | 5298 { |
5307 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec
ycleNotifier()); | 5299 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec
ycleNotifier()); |
5308 } | 5300 } |
5309 | 5301 |
5310 } // namespace WebCore | 5302 } // namespace WebCore |
OLD | NEW |