OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1350 Document* document = m_frame->document(); | 1350 Document* document = m_frame->document(); |
1351 | 1351 |
1352 if (document->focusedElement() && document->focusedElement()->hasTagName(sel
ectTag)) { | 1352 if (document->focusedElement() && document->focusedElement()->hasTagName(sel
ectTag)) { |
1353 HTMLSelectElement* selectElement = toHTMLSelectElement(document->focused
Element()); | 1353 HTMLSelectElement* selectElement = toHTMLSelectElement(document->focused
Element()); |
1354 if (selectElement->canSelectAll()) { | 1354 if (selectElement->canSelectAll()) { |
1355 selectElement->selectAll(); | 1355 selectElement->selectAll(); |
1356 return; | 1356 return; |
1357 } | 1357 } |
1358 } | 1358 } |
1359 | 1359 |
1360 RefPtr<Node> root = 0; | 1360 RefPtr<Node> root = nullptr; |
1361 Node* selectStartTarget = 0; | 1361 Node* selectStartTarget = 0; |
1362 if (isContentEditable()) { | 1362 if (isContentEditable()) { |
1363 root = highestEditableRoot(m_selection.start()); | 1363 root = highestEditableRoot(m_selection.start()); |
1364 if (Node* shadowRoot = m_selection.nonBoundaryShadowTreeRootNode()) | 1364 if (Node* shadowRoot = m_selection.nonBoundaryShadowTreeRootNode()) |
1365 selectStartTarget = shadowRoot->shadowHost(); | 1365 selectStartTarget = shadowRoot->shadowHost(); |
1366 else | 1366 else |
1367 selectStartTarget = root.get(); | 1367 selectStartTarget = root.get(); |
1368 } else { | 1368 } else { |
1369 root = m_selection.nonBoundaryShadowTreeRootNode(); | 1369 root = m_selection.nonBoundaryShadowTreeRootNode(); |
1370 if (root) | 1370 if (root) |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1647 while (target) { | 1647 while (target) { |
1648 // We don't want to set focus on a subframe when selecting in a pare
nt frame, | 1648 // We don't want to set focus on a subframe when selecting in a pare
nt frame, |
1649 // so add the !isFrameElement check here. There's probably a better
way to make this | 1649 // so add the !isFrameElement check here. There's probably a better
way to make this |
1650 // work in the long term, but this is the safest fix at this time. | 1650 // work in the long term, but this is the safest fix at this time. |
1651 if (target->isMouseFocusable() && !isFrameElement(target)) { | 1651 if (target->isMouseFocusable() && !isFrameElement(target)) { |
1652 m_frame->page()->focusController().setFocusedElement(target, m_f
rame); | 1652 m_frame->page()->focusController().setFocusedElement(target, m_f
rame); |
1653 return; | 1653 return; |
1654 } | 1654 } |
1655 target = target->parentOrShadowHostElement(); | 1655 target = target->parentOrShadowHostElement(); |
1656 } | 1656 } |
1657 m_frame->document()->setFocusedElement(0); | 1657 m_frame->document()->setFocusedElement(nullptr); |
1658 } | 1658 } |
1659 | 1659 |
1660 if (caretBrowsing) | 1660 if (caretBrowsing) |
1661 m_frame->page()->focusController().setFocusedElement(0, m_frame); | 1661 m_frame->page()->focusController().setFocusedElement(0, m_frame); |
1662 } | 1662 } |
1663 | 1663 |
1664 static String extractSelectedText(const FrameSelection& selection, TextIteratorB
ehavior behavior) | 1664 static String extractSelectedText(const FrameSelection& selection, TextIteratorB
ehavior behavior) |
1665 { | 1665 { |
1666 // We remove '\0' characters because they are not visibly rendered to the us
er. | 1666 // We remove '\0' characters because they are not visibly rendered to the us
er. |
1667 return plainText(selection.toNormalizedRange().get(), behavior).replace(0, "
"); | 1667 return plainText(selection.toNormalizedRange().get(), behavior).replace(0, "
"); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1824 sel.showTreeForThis(); | 1824 sel.showTreeForThis(); |
1825 } | 1825 } |
1826 | 1826 |
1827 void showTree(const WebCore::FrameSelection* sel) | 1827 void showTree(const WebCore::FrameSelection* sel) |
1828 { | 1828 { |
1829 if (sel) | 1829 if (sel) |
1830 sel->showTreeForThis(); | 1830 sel->showTreeForThis(); |
1831 } | 1831 } |
1832 | 1832 |
1833 #endif | 1833 #endif |
OLD | NEW |