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 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 Document* document = m_frame->document(); | 1448 Document* document = m_frame->document(); |
1449 | 1449 |
1450 if (document->focusedNode() && document->focusedNode()->hasTagName(selectTag
)) { | 1450 if (document->focusedNode() && document->focusedNode()->hasTagName(selectTag
)) { |
1451 HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>(docum
ent->focusedNode()); | 1451 HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>(docum
ent->focusedNode()); |
1452 if (selectElement->canSelectAll()) { | 1452 if (selectElement->canSelectAll()) { |
1453 selectElement->selectAll(); | 1453 selectElement->selectAll(); |
1454 return; | 1454 return; |
1455 } | 1455 } |
1456 } | 1456 } |
1457 | 1457 |
1458 Node* root = 0; | 1458 RefPtr<Node> root = 0; |
1459 Node* selectStartTarget = 0; | 1459 Node* selectStartTarget = 0; |
1460 if (isContentEditable()) { | 1460 if (isContentEditable()) { |
1461 root = highestEditableRoot(m_selection.start()); | 1461 root = highestEditableRoot(m_selection.start()); |
1462 if (Node* shadowRoot = m_selection.nonBoundaryShadowTreeRootNode()) | 1462 if (Node* shadowRoot = m_selection.nonBoundaryShadowTreeRootNode()) |
1463 selectStartTarget = shadowRoot->shadowAncestorNode(); | 1463 selectStartTarget = shadowRoot->shadowAncestorNode(); |
1464 else | 1464 else |
1465 selectStartTarget = root; | 1465 selectStartTarget = root.get(); |
1466 } else { | 1466 } else { |
1467 root = m_selection.nonBoundaryShadowTreeRootNode(); | 1467 root = m_selection.nonBoundaryShadowTreeRootNode(); |
1468 if (root) | 1468 if (root) |
1469 selectStartTarget = root->shadowAncestorNode(); | 1469 selectStartTarget = root->shadowAncestorNode(); |
1470 else { | 1470 else { |
1471 root = document->documentElement(); | 1471 root = document->documentElement(); |
1472 selectStartTarget = document->body(); | 1472 selectStartTarget = document->body(); |
1473 } | 1473 } |
1474 } | 1474 } |
1475 if (!root) | 1475 if (!root) |
1476 return; | 1476 return; |
1477 | 1477 |
1478 if (selectStartTarget && !selectStartTarget->dispatchEvent(Event::create(eve
ntNames().selectstartEvent, true, true))) | 1478 if (selectStartTarget && !selectStartTarget->dispatchEvent(Event::create(eve
ntNames().selectstartEvent, true, true))) |
1479 return; | 1479 return; |
1480 | 1480 |
1481 VisibleSelection newSelection(VisibleSelection::selectionFromContentsOfNode(
root)); | 1481 VisibleSelection newSelection(VisibleSelection::selectionFromContentsOfNode(
root.get())); |
1482 | 1482 |
1483 if (shouldChangeSelection(newSelection)) | 1483 if (shouldChangeSelection(newSelection)) |
1484 setSelection(newSelection); | 1484 setSelection(newSelection); |
1485 | 1485 |
1486 selectFrameElementInParentIfFullySelected(); | 1486 selectFrameElementInParentIfFullySelected(); |
1487 notifyRendererOfSelectionChange(true); | 1487 notifyRendererOfSelectionChange(true); |
1488 } | 1488 } |
1489 | 1489 |
1490 bool FrameSelection::setSelectedRange(Range* range, EAffinity affinity, bool clo
seTyping) | 1490 bool FrameSelection::setSelectedRange(Range* range, EAffinity affinity, bool clo
seTyping) |
1491 { | 1491 { |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 sel.showTreeForThis(); | 1934 sel.showTreeForThis(); |
1935 } | 1935 } |
1936 | 1936 |
1937 void showTree(const WebCore::FrameSelection* sel) | 1937 void showTree(const WebCore::FrameSelection* sel) |
1938 { | 1938 { |
1939 if (sel) | 1939 if (sel) |
1940 sel->showTreeForThis(); | 1940 sel->showTreeForThis(); |
1941 } | 1941 } |
1942 | 1942 |
1943 #endif | 1943 #endif |
OLD | NEW |