| 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 3711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3722 | 3722 |
| 3723 void Document::setSequentialFocusNavigationStartingPoint(Node* node) | 3723 void Document::setSequentialFocusNavigationStartingPoint(Node* node) |
| 3724 { | 3724 { |
| 3725 if (!node) { | 3725 if (!node) { |
| 3726 m_sequentialFocusNavigationStartingPoint = nullptr; | 3726 m_sequentialFocusNavigationStartingPoint = nullptr; |
| 3727 return; | 3727 return; |
| 3728 } | 3728 } |
| 3729 ASSERT(node->document() == this); | 3729 ASSERT(node->document() == this); |
| 3730 if (!m_sequentialFocusNavigationStartingPoint) | 3730 if (!m_sequentialFocusNavigationStartingPoint) |
| 3731 m_sequentialFocusNavigationStartingPoint = Range::create(*this); | 3731 m_sequentialFocusNavigationStartingPoint = Range::create(*this); |
| 3732 m_sequentialFocusNavigationStartingPoint->selectNodeContents(node->isElement
Node() ? node : node->parentOrShadowHostElement(), ASSERT_NO_EXCEPTION); | 3732 m_sequentialFocusNavigationStartingPoint->selectNodeContents(node, ASSERT_NO
_EXCEPTION); |
| 3733 } | 3733 } |
| 3734 | 3734 |
| 3735 Element* Document::sequentialFocusNavigationStartingPoint(WebFocusType type) con
st | 3735 Element* Document::sequentialFocusNavigationStartingPoint(WebFocusType type) con
st |
| 3736 { | 3736 { |
| 3737 if (m_focusedElement) | 3737 if (m_focusedElement) |
| 3738 return m_focusedElement.get(); | 3738 return m_focusedElement.get(); |
| 3739 if (!m_sequentialFocusNavigationStartingPoint) | 3739 if (!m_sequentialFocusNavigationStartingPoint) |
| 3740 return nullptr; | 3740 return nullptr; |
| 3741 if (!m_sequentialFocusNavigationStartingPoint->collapsed()) { | 3741 if (!m_sequentialFocusNavigationStartingPoint->collapsed()) { |
| 3742 Node* node = m_sequentialFocusNavigationStartingPoint->startContainer(); | 3742 Node* node = m_sequentialFocusNavigationStartingPoint->startContainer(); |
| 3743 ASSERT(node == m_sequentialFocusNavigationStartingPoint->endContainer())
; | 3743 ASSERT(node == m_sequentialFocusNavigationStartingPoint->endContainer())
; |
| 3744 return node->isElementNode() ? toElement(node) : node->parentOrShadowHos
tElement(); | 3744 if (node->isElementNode()) |
| 3745 return toElement(node); |
| 3746 if (Element* neighborElement = type == WebFocusTypeForward ? ElementTrav
ersal::previous(*node) : ElementTraversal::next(*node)) |
| 3747 return neighborElement; |
| 3748 return node->parentOrShadowHostElement(); |
| 3745 } | 3749 } |
| 3746 | 3750 |
| 3747 // Range::selectNodeContents didn't select contents because the element had | 3751 // Range::selectNodeContents didn't select contents because the element had |
| 3748 // no children. | 3752 // no children. |
| 3749 if (m_sequentialFocusNavigationStartingPoint->startContainer()->isElementNod
e() | 3753 if (m_sequentialFocusNavigationStartingPoint->startContainer()->isElementNod
e() |
| 3750 && !m_sequentialFocusNavigationStartingPoint->startContainer()->hasChild
ren() | 3754 && !m_sequentialFocusNavigationStartingPoint->startContainer()->hasChild
ren() |
| 3751 && m_sequentialFocusNavigationStartingPoint->startOffset() == 0) | 3755 && m_sequentialFocusNavigationStartingPoint->startOffset() == 0) |
| 3752 return toElement(m_sequentialFocusNavigationStartingPoint->startContaine
r()); | 3756 return toElement(m_sequentialFocusNavigationStartingPoint->startContaine
r()); |
| 3753 | 3757 |
| 3754 // A node selected by Range::selectNodeContents was removed from the | 3758 // A node selected by Range::selectNodeContents was removed from the |
| (...skipping 2239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5994 #ifndef NDEBUG | 5998 #ifndef NDEBUG |
| 5995 using namespace blink; | 5999 using namespace blink; |
| 5996 void showLiveDocumentInstances() | 6000 void showLiveDocumentInstances() |
| 5997 { | 6001 { |
| 5998 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 6002 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
| 5999 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6003 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6000 for (Document* document : set) | 6004 for (Document* document : set) |
| 6001 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 6005 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
| 6002 } | 6006 } |
| 6003 #endif | 6007 #endif |
| OLD | NEW |