| 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 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 if (selectStartTarget) { | 989 if (selectStartTarget) { |
| 990 const Document& expectedDocument = document(); | 990 const Document& expectedDocument = document(); |
| 991 if (selectStartTarget->dispatchEvent(Event::createCancelableBubble( | 991 if (selectStartTarget->dispatchEvent(Event::createCancelableBubble( |
| 992 EventTypeNames::selectstart)) != DispatchEventResult::NotCanceled) | 992 EventTypeNames::selectstart)) != DispatchEventResult::NotCanceled) |
| 993 return; | 993 return; |
| 994 // |root| may be detached due to selectstart event. | 994 // |root| may be detached due to selectstart event. |
| 995 if (!root->isConnected() || expectedDocument != root->document()) | 995 if (!root->isConnected() || expectedDocument != root->document()) |
| 996 return; | 996 return; |
| 997 } | 997 } |
| 998 | 998 |
| 999 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets | 999 setSelection(SelectionInDOMTree::Builder().selectAllChildren(*root).build()); |
| 1000 // needs to be audited. See http://crbug.com/590369 for more details. | |
| 1001 document().updateStyleAndLayoutIgnorePendingStylesheets(); | |
| 1002 | |
| 1003 VisibleSelection newSelection( | |
| 1004 VisibleSelection::selectionFromContentsOfNode(root)); | |
| 1005 setSelection(newSelection); | |
| 1006 selectFrameElementInParentIfFullySelected(); | 1000 selectFrameElementInParentIfFullySelected(); |
| 1007 notifyLayoutObjectOfSelectionChange(UserTriggered); | 1001 notifyLayoutObjectOfSelectionChange(UserTriggered); |
| 1008 } | 1002 } |
| 1009 | 1003 |
| 1010 bool FrameSelection::setSelectedRange(const EphemeralRange& range, | 1004 bool FrameSelection::setSelectedRange(const EphemeralRange& range, |
| 1011 TextAffinity affinity, | 1005 TextAffinity affinity, |
| 1012 SelectionDirectionalMode directional, | 1006 SelectionDirectionalMode directional, |
| 1013 SetSelectionOptions options) { | 1007 SetSelectionOptions options) { |
| 1014 if (range.isNull()) | 1008 if (range.isNull()) |
| 1015 return false; | 1009 return false; |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 } | 1474 } |
| 1481 | 1475 |
| 1482 void showTree(const blink::FrameSelection* sel) { | 1476 void showTree(const blink::FrameSelection* sel) { |
| 1483 if (sel) | 1477 if (sel) |
| 1484 sel->showTreeForThis(); | 1478 sel->showTreeForThis(); |
| 1485 else | 1479 else |
| 1486 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; | 1480 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; |
| 1487 } | 1481 } |
| 1488 | 1482 |
| 1489 #endif | 1483 #endif |
| OLD | NEW |