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 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 if (selectStartTarget) { | 997 if (selectStartTarget) { |
998 const Document& expectedDocument = document(); | 998 const Document& expectedDocument = document(); |
999 if (selectStartTarget->dispatchEvent(Event::createCancelableBubble( | 999 if (selectStartTarget->dispatchEvent(Event::createCancelableBubble( |
1000 EventTypeNames::selectstart)) != DispatchEventResult::NotCanceled) | 1000 EventTypeNames::selectstart)) != DispatchEventResult::NotCanceled) |
1001 return; | 1001 return; |
1002 // |root| may be detached due to selectstart event. | 1002 // |root| may be detached due to selectstart event. |
1003 if (!root->isConnected() || expectedDocument != root->document()) | 1003 if (!root->isConnected() || expectedDocument != root->document()) |
1004 return; | 1004 return; |
1005 } | 1005 } |
1006 | 1006 |
1007 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets | 1007 setSelection(SelectionInDOMTree::Builder().selectAllChildren(*root).build()); |
1008 // needs to be audited. See http://crbug.com/590369 for more details. | |
1009 document().updateStyleAndLayoutIgnorePendingStylesheets(); | |
1010 | |
1011 VisibleSelection newSelection( | |
1012 VisibleSelection::selectionFromContentsOfNode(root)); | |
1013 setSelection(newSelection); | |
1014 selectFrameElementInParentIfFullySelected(); | 1008 selectFrameElementInParentIfFullySelected(); |
1015 notifyLayoutObjectOfSelectionChange(UserTriggered); | 1009 notifyLayoutObjectOfSelectionChange(UserTriggered); |
1016 } | 1010 } |
1017 | 1011 |
1018 bool FrameSelection::setSelectedRange(const EphemeralRange& range, | 1012 bool FrameSelection::setSelectedRange(const EphemeralRange& range, |
1019 TextAffinity affinity, | 1013 TextAffinity affinity, |
1020 SelectionDirectionalMode directional, | 1014 SelectionDirectionalMode directional, |
1021 SetSelectionOptions options) { | 1015 SetSelectionOptions options) { |
1022 if (range.isNull()) | 1016 if (range.isNull()) |
1023 return false; | 1017 return false; |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 } | 1482 } |
1489 | 1483 |
1490 void showTree(const blink::FrameSelection* sel) { | 1484 void showTree(const blink::FrameSelection* sel) { |
1491 if (sel) | 1485 if (sel) |
1492 sel->showTreeForThis(); | 1486 sel->showTreeForThis(); |
1493 else | 1487 else |
1494 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; | 1488 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; |
1495 } | 1489 } |
1496 | 1490 |
1497 #endif | 1491 #endif |
OLD | NEW |