| 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 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 if (RuntimeEnabledFeatures::selectionForComposedTreeEnabled()) | 1111 if (RuntimeEnabledFeatures::selectionForComposedTreeEnabled()) |
| 1112 return extractSelectedTextAlgorithm<EditingInComposedTreeStrategy>(selec
tion, behavior); | 1112 return extractSelectedTextAlgorithm<EditingInComposedTreeStrategy>(selec
tion, behavior); |
| 1113 return extractSelectedTextAlgorithm<EditingStrategy>(selection, behavior); | 1113 return extractSelectedTextAlgorithm<EditingStrategy>(selection, behavior); |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 template <typename Strategy> | 1116 template <typename Strategy> |
| 1117 static String extractSelectedHTMLAlgorithm(const FrameSelection& selection) | 1117 static String extractSelectedHTMLAlgorithm(const FrameSelection& selection) |
| 1118 { | 1118 { |
| 1119 const VisibleSelectionTemplate<Strategy> visibleSelection = selection.visibl
eSelection<Strategy>(); | 1119 const VisibleSelectionTemplate<Strategy> visibleSelection = selection.visibl
eSelection<Strategy>(); |
| 1120 const EphemeralRangeTemplate<Strategy> range = visibleSelection.toNormalized
EphemeralRange(); | 1120 const EphemeralRangeTemplate<Strategy> range = visibleSelection.toNormalized
EphemeralRange(); |
| 1121 if (range.isNull()) |
| 1122 return String(); |
| 1121 return createMarkup(range.startPosition(), range.endPosition(), AnnotateForI
nterchange, ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 1123 return createMarkup(range.startPosition(), range.endPosition(), AnnotateForI
nterchange, ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
| 1122 } | 1124 } |
| 1123 | 1125 |
| 1124 String FrameSelection::selectedHTMLForClipboard() const | 1126 String FrameSelection::selectedHTMLForClipboard() const |
| 1125 { | 1127 { |
| 1126 if (!RuntimeEnabledFeatures::selectionForComposedTreeEnabled()) | 1128 if (!RuntimeEnabledFeatures::selectionForComposedTreeEnabled()) |
| 1127 return extractSelectedHTMLAlgorithm<EditingStrategy>(*this); | 1129 return extractSelectedHTMLAlgorithm<EditingStrategy>(*this); |
| 1128 return extractSelectedHTMLAlgorithm<EditingInComposedTreeStrategy>(*this); | 1130 return extractSelectedHTMLAlgorithm<EditingInComposedTreeStrategy>(*this); |
| 1129 } | 1131 } |
| 1130 | 1132 |
| 1131 String FrameSelection::selectedText() const | 1133 String FrameSelection::selectedText(TextIteratorBehavior behavior) const |
| 1132 { | 1134 { |
| 1133 return extractSelectedText(*this, TextIteratorDefaultBehavior); | 1135 return extractSelectedText(*this, behavior); |
| 1134 } | 1136 } |
| 1135 | 1137 |
| 1136 String FrameSelection::selectedTextForClipboard() const | 1138 String FrameSelection::selectedTextForClipboard() const |
| 1137 { | 1139 { |
| 1138 if (m_frame->settings() && m_frame->settings()->selectionIncludesAltImageTex
t()) | 1140 if (m_frame->settings() && m_frame->settings()->selectionIncludesAltImageTex
t()) |
| 1139 return extractSelectedText(*this, TextIteratorEmitsImageAltText); | 1141 return extractSelectedText(*this, TextIteratorEmitsImageAltText); |
| 1140 return selectedText(); | 1142 return selectedText(); |
| 1141 } | 1143 } |
| 1142 | 1144 |
| 1143 LayoutRect FrameSelection::bounds() const | 1145 LayoutRect FrameSelection::bounds() const |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1393 | 1395 |
| 1394 void showTree(const blink::FrameSelection* sel) | 1396 void showTree(const blink::FrameSelection* sel) |
| 1395 { | 1397 { |
| 1396 if (sel) | 1398 if (sel) |
| 1397 sel->showTreeForThis(); | 1399 sel->showTreeForThis(); |
| 1398 else | 1400 else |
| 1399 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); | 1401 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); |
| 1400 } | 1402 } |
| 1401 | 1403 |
| 1402 #endif | 1404 #endif |
| OLD | NEW |