Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Side by Side Diff: Source/WebCore/editing/FrameSelection.cpp

Issue 7635022: Merge 92966 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 Document* document = m_frame->document(); 1424 Document* document = m_frame->document();
1425 1425
1426 if (document->focusedNode() && document->focusedNode()->hasTagName(selectTag )) { 1426 if (document->focusedNode() && document->focusedNode()->hasTagName(selectTag )) {
1427 HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>(docum ent->focusedNode()); 1427 HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>(docum ent->focusedNode());
1428 if (selectElement->canSelectAll()) { 1428 if (selectElement->canSelectAll()) {
1429 selectElement->selectAll(); 1429 selectElement->selectAll();
1430 return; 1430 return;
1431 } 1431 }
1432 } 1432 }
1433 1433
1434 Node* root = 0; 1434 RefPtr<Node> root = 0;
1435 Node* selectStartTarget = 0; 1435 Node* selectStartTarget = 0;
1436 if (isContentEditable()) { 1436 if (isContentEditable()) {
1437 root = highestEditableRoot(m_selection.start()); 1437 root = highestEditableRoot(m_selection.start());
1438 if (Node* shadowRoot = m_selection.nonBoundaryShadowTreeRootNode()) 1438 if (Node* shadowRoot = m_selection.nonBoundaryShadowTreeRootNode())
1439 selectStartTarget = shadowRoot->shadowAncestorNode(); 1439 selectStartTarget = shadowRoot->shadowAncestorNode();
1440 else 1440 else
1441 selectStartTarget = root; 1441 selectStartTarget = root.get();
1442 } else { 1442 } else {
1443 root = m_selection.nonBoundaryShadowTreeRootNode(); 1443 root = m_selection.nonBoundaryShadowTreeRootNode();
1444 if (root) 1444 if (root)
1445 selectStartTarget = root->shadowAncestorNode(); 1445 selectStartTarget = root->shadowAncestorNode();
1446 else { 1446 else {
1447 root = document->documentElement(); 1447 root = document->documentElement();
1448 selectStartTarget = document->body(); 1448 selectStartTarget = document->body();
1449 } 1449 }
1450 } 1450 }
1451 if (!root) 1451 if (!root)
1452 return; 1452 return;
1453 1453
1454 if (selectStartTarget && !selectStartTarget->dispatchEvent(Event::create(eve ntNames().selectstartEvent, true, true))) 1454 if (selectStartTarget && !selectStartTarget->dispatchEvent(Event::create(eve ntNames().selectstartEvent, true, true)))
1455 return; 1455 return;
1456 1456
1457 VisibleSelection newSelection(VisibleSelection::selectionFromContentsOfNode( root)); 1457 VisibleSelection newSelection(VisibleSelection::selectionFromContentsOfNode( root.get()));
1458 1458
1459 if (shouldChangeSelection(newSelection)) 1459 if (shouldChangeSelection(newSelection))
1460 setSelection(newSelection); 1460 setSelection(newSelection);
1461 1461
1462 selectFrameElementInParentIfFullySelected(); 1462 selectFrameElementInParentIfFullySelected();
1463 notifyRendererOfSelectionChange(UserTriggered); 1463 notifyRendererOfSelectionChange(UserTriggered);
1464 } 1464 }
1465 1465
1466 bool FrameSelection::setSelectedRange(Range* range, EAffinity affinity, bool clo seTyping) 1466 bool FrameSelection::setSelectedRange(Range* range, EAffinity affinity, bool clo seTyping)
1467 { 1467 {
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 sel.showTreeForThis(); 1873 sel.showTreeForThis();
1874 } 1874 }
1875 1875
1876 void showTree(const WebCore::FrameSelection* sel) 1876 void showTree(const WebCore::FrameSelection* sel)
1877 { 1877 {
1878 if (sel) 1878 if (sel)
1879 sel->showTreeForThis(); 1879 sel->showTreeForThis();
1880 } 1880 }
1881 1881
1882 #endif 1882 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698