| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 LayoutObject* layoutObject = focusedElement.layoutObject(); | 354 LayoutObject* layoutObject = focusedElement.layoutObject(); |
| 355 if (!layoutObject || !layoutObject->isLayoutPart()) | 355 if (!layoutObject || !layoutObject->isLayoutPart()) |
| 356 return 0; | 356 return 0; |
| 357 return toLayoutPart(layoutObject)->widget(); | 357 return toLayoutPart(layoutObject)->widget(); |
| 358 } | 358 } |
| 359 | 359 |
| 360 static bool acceptsEditingFocus(const Element& element) | 360 static bool acceptsEditingFocus(const Element& element) |
| 361 { | 361 { |
| 362 DCHECK(element.hasEditableStyle()); | 362 DCHECK(element.hasEditableStyle()); |
| 363 | 363 |
| 364 return element.document().frame() && element.rootEditableElement(); | 364 return element.document().frame() && rootEditableElement(element); |
| 365 } | 365 } |
| 366 | 366 |
| 367 uint64_t Document::s_globalTreeVersion = 0; | 367 uint64_t Document::s_globalTreeVersion = 0; |
| 368 | 368 |
| 369 static bool s_threadedParsingEnabledForTesting = true; | 369 static bool s_threadedParsingEnabledForTesting = true; |
| 370 | 370 |
| 371 // This doesn't work with non-Document ExecutionContext. | 371 // This doesn't work with non-Document ExecutionContext. |
| 372 static void runAutofocusTask(ExecutionContext* context) | 372 static void runAutofocusTask(ExecutionContext* context) |
| 373 { | 373 { |
| 374 Document* document = toDocument(context); | 374 Document* document = toDocument(context); |
| (...skipping 3183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3558 if (oldWidget) | 3558 if (oldWidget) |
| 3559 oldWidget->setFocus(false, params.type); | 3559 oldWidget->setFocus(false, params.type); |
| 3560 else | 3560 else |
| 3561 view()->setFocus(false, params.type); | 3561 view()->setFocus(false, params.type); |
| 3562 } | 3562 } |
| 3563 } | 3563 } |
| 3564 | 3564 |
| 3565 if (newFocusedElement) | 3565 if (newFocusedElement) |
| 3566 updateStyleAndLayoutTreeForNode(newFocusedElement); | 3566 updateStyleAndLayoutTreeForNode(newFocusedElement); |
| 3567 if (newFocusedElement && newFocusedElement->isFocusable()) { | 3567 if (newFocusedElement && newFocusedElement->isFocusable()) { |
| 3568 if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(*
newFocusedElement)) { | 3568 if (isRootEditableElement(*newFocusedElement) && !acceptsEditingFocus(*n
ewFocusedElement)) { |
| 3569 // delegate blocks focus change | 3569 // delegate blocks focus change |
| 3570 focusChangeBlocked = true; | 3570 focusChangeBlocked = true; |
| 3571 goto SetFocusedElementDone; | 3571 goto SetFocusedElementDone; |
| 3572 } | 3572 } |
| 3573 // Set focus on the new node | 3573 // Set focus on the new node |
| 3574 m_focusedElement = newFocusedElement; | 3574 m_focusedElement = newFocusedElement; |
| 3575 setSequentialFocusNavigationStartingPoint(m_focusedElement.get()); | 3575 setSequentialFocusNavigationStartingPoint(m_focusedElement.get()); |
| 3576 | 3576 |
| 3577 m_focusedElement->setFocus(true); | 3577 m_focusedElement->setFocus(true); |
| 3578 // Element::setFocus for frames can dispatch events. | 3578 // Element::setFocus for frames can dispatch events. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 3606 // on it, probably when <rdar://problem/8503958> is m. | 3606 // on it, probably when <rdar://problem/8503958> is m. |
| 3607 m_focusedElement->dispatchFocusInEvent(EventTypeNames::DOMFocusIn, o
ldFocusedElement, params.type, params.sourceCapabilities); // DOM level 2 for co
mpatibility. | 3607 m_focusedElement->dispatchFocusInEvent(EventTypeNames::DOMFocusIn, o
ldFocusedElement, params.type, params.sourceCapabilities); // DOM level 2 for co
mpatibility. |
| 3608 | 3608 |
| 3609 if (m_focusedElement != newFocusedElement) { | 3609 if (m_focusedElement != newFocusedElement) { |
| 3610 // handler shifted focus | 3610 // handler shifted focus |
| 3611 focusChangeBlocked = true; | 3611 focusChangeBlocked = true; |
| 3612 goto SetFocusedElementDone; | 3612 goto SetFocusedElementDone; |
| 3613 } | 3613 } |
| 3614 } | 3614 } |
| 3615 | 3615 |
| 3616 if (m_focusedElement->isRootEditableElement()) | 3616 if (isRootEditableElement(*m_focusedElement)) |
| 3617 frame()->spellChecker().didBeginEditing(m_focusedElement.get()); | 3617 frame()->spellChecker().didBeginEditing(m_focusedElement.get()); |
| 3618 | 3618 |
| 3619 // eww, I suck. set the qt focus correctly | 3619 // eww, I suck. set the qt focus correctly |
| 3620 // ### find a better place in the code for this | 3620 // ### find a better place in the code for this |
| 3621 if (view()) { | 3621 if (view()) { |
| 3622 Widget* focusWidget = widgetForElement(*m_focusedElement); | 3622 Widget* focusWidget = widgetForElement(*m_focusedElement); |
| 3623 if (focusWidget) { | 3623 if (focusWidget) { |
| 3624 // Make sure a widget has the right size before giving it focus. | 3624 // Make sure a widget has the right size before giving it focus. |
| 3625 // Otherwise, we are testing edge cases of the Widget code. | 3625 // Otherwise, we are testing edge cases of the Widget code. |
| 3626 // Specifically, in WebCore this does not work well for text fie
lds. | 3626 // Specifically, in WebCore this does not work well for text fie
lds. |
| (...skipping 2417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6044 } | 6044 } |
| 6045 | 6045 |
| 6046 void showLiveDocumentInstances() | 6046 void showLiveDocumentInstances() |
| 6047 { | 6047 { |
| 6048 WeakDocumentSet& set = liveDocumentSet(); | 6048 WeakDocumentSet& set = liveDocumentSet(); |
| 6049 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6049 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6050 for (Document* document : set) | 6050 for (Document* document : set) |
| 6051 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); | 6051 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); |
| 6052 } | 6052 } |
| 6053 #endif | 6053 #endif |
| OLD | NEW |