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 1725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1736 } | 1736 } |
1737 | 1737 |
1738 if (caretBrowsing) | 1738 if (caretBrowsing) |
1739 m_frame->page()->focusController().setFocusedElement(0, m_frame); | 1739 m_frame->page()->focusController().setFocusedElement(0, m_frame); |
1740 } | 1740 } |
1741 | 1741 |
1742 template <typename SelectionType> | 1742 template <typename SelectionType> |
1743 String extractSelectedTextAlgorithm(const FrameSelection& selection, TextIterato
rBehavior behavior) | 1743 String extractSelectedTextAlgorithm(const FrameSelection& selection, TextIterato
rBehavior behavior) |
1744 { | 1744 { |
1745 VisibleSelection visibleSelection = selection.selection(); | 1745 VisibleSelection visibleSelection = selection.selection(); |
1746 EphemeralRangeTemplate<typename SelectionType::Strategy> range = VisibleSele
ction::normalizeRange(SelectionType::asRange(visibleSelection)); | 1746 EphemeralRangeTemplate<typename SelectionType::Strategy> range = normalizeRa
nge(SelectionType::asRange(visibleSelection)); |
1747 // We remove '\0' characters because they are not visibly rendered to the us
er. | 1747 // We remove '\0' characters because they are not visibly rendered to the us
er. |
1748 return plainText(range, behavior).replace(0, ""); | 1748 return plainText(range, behavior).replace(0, ""); |
1749 } | 1749 } |
1750 | 1750 |
1751 static String extractSelectedText(const FrameSelection& selection, TextIteratorB
ehavior behavior) | 1751 static String extractSelectedText(const FrameSelection& selection, TextIteratorB
ehavior behavior) |
1752 { | 1752 { |
1753 if (RuntimeEnabledFeatures::selectionForComposedTreeEnabled()) | 1753 if (RuntimeEnabledFeatures::selectionForComposedTreeEnabled()) |
1754 return extractSelectedTextAlgorithm<VisibleSelection::InComposedTree>(se
lection, behavior); | 1754 return extractSelectedTextAlgorithm<VisibleSelection::InComposedTree>(se
lection, behavior); |
1755 return extractSelectedTextAlgorithm<VisibleSelection::InDOMTree>(selection,
behavior); | 1755 return extractSelectedTextAlgorithm<VisibleSelection::InDOMTree>(selection,
behavior); |
1756 } | 1756 } |
1757 | 1757 |
1758 template <typename SelectionType> | 1758 template <typename SelectionType> |
1759 static String extractSelectedHTMLAlgorithm(const FrameSelection& selection) | 1759 static String extractSelectedHTMLAlgorithm(const FrameSelection& selection) |
1760 { | 1760 { |
1761 VisibleSelection visibleSelection = selection.selection(); | 1761 VisibleSelection visibleSelection = selection.selection(); |
1762 EphemeralRangeTemplate<typename SelectionType::Strategy> range = VisibleSele
ction::normalizeRange(SelectionType::asRange(visibleSelection)); | 1762 EphemeralRangeTemplate<typename SelectionType::Strategy> range = normalizeRa
nge(SelectionType::asRange(visibleSelection)); |
1763 return createMarkup(range.startPosition(), range.endPosition(), AnnotateForI
nterchange, ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 1763 return createMarkup(range.startPosition(), range.endPosition(), AnnotateForI
nterchange, ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
1764 } | 1764 } |
1765 | 1765 |
1766 String FrameSelection::selectedHTMLForClipboard() const | 1766 String FrameSelection::selectedHTMLForClipboard() const |
1767 { | 1767 { |
1768 if (!RuntimeEnabledFeatures::selectionForComposedTreeEnabled()) | 1768 if (!RuntimeEnabledFeatures::selectionForComposedTreeEnabled()) |
1769 return extractSelectedHTMLAlgorithm<VisibleSelection::InDOMTree>(*this); | 1769 return extractSelectedHTMLAlgorithm<VisibleSelection::InDOMTree>(*this); |
1770 return extractSelectedHTMLAlgorithm<VisibleSelection::InComposedTree>(*this)
; | 1770 return extractSelectedHTMLAlgorithm<VisibleSelection::InComposedTree>(*this)
; |
1771 } | 1771 } |
1772 | 1772 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2069 | 2069 |
2070 void showTree(const blink::FrameSelection* sel) | 2070 void showTree(const blink::FrameSelection* sel) |
2071 { | 2071 { |
2072 if (sel) | 2072 if (sel) |
2073 sel->showTreeForThis(); | 2073 sel->showTreeForThis(); |
2074 else | 2074 else |
2075 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); | 2075 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); |
2076 } | 2076 } |
2077 | 2077 |
2078 #endif | 2078 #endif |
OLD | NEW |