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

Side by Side Diff: webkit/api/src/WebRange.cpp

Issue 243032: First implementation of PlainTextController. (Closed)
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « webkit/api/src/WebBindings.cpp ('k') | webkit/tools/layout_tests/test_expectations.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "WebRange.h" 32 #include "WebRange.h"
33 33
34 #include "WebNode.h" 34 #include "WebNode.h"
35 #include "WebString.h"
35 36
36 #include "Range.h" 37 #include "Range.h"
37 #include <wtf/PassRefPtr.h> 38 #include <wtf/PassRefPtr.h>
38 39
39 using namespace WebCore; 40 using namespace WebCore;
40 41
41 namespace WebKit { 42 namespace WebKit {
42 43
43 class WebRangePrivate : public Range { 44 class WebRangePrivate : public Range {
44 }; 45 };
(...skipping 24 matching lines...) Expand all
69 WebNode WebRange::startContainer(int& exceptionCode) const 70 WebNode WebRange::startContainer(int& exceptionCode) const
70 { 71 {
71 return PassRefPtr<Node>(m_private->startContainer(exceptionCode)); 72 return PassRefPtr<Node>(m_private->startContainer(exceptionCode));
72 } 73 }
73 74
74 WebNode WebRange::endContainer(int& exceptionCode) const 75 WebNode WebRange::endContainer(int& exceptionCode) const
75 { 76 {
76 return PassRefPtr<Node>(m_private->endContainer(exceptionCode)); 77 return PassRefPtr<Node>(m_private->endContainer(exceptionCode));
77 } 78 }
78 79
80 WebString WebRange::toHTMLText() const
81 {
82 return m_private->toHTML();
83 }
84
85 WebString WebRange::toPlainText() const
86 {
87 return m_private->text();
88 }
89
79 WebRange::WebRange(const WTF::PassRefPtr<WebCore::Range>& range) 90 WebRange::WebRange(const WTF::PassRefPtr<WebCore::Range>& range)
80 : m_private(static_cast<WebRangePrivate*>(range.releaseRef())) 91 : m_private(static_cast<WebRangePrivate*>(range.releaseRef()))
81 { 92 {
82 } 93 }
83 94
84 WebRange& WebRange::operator=(const WTF::PassRefPtr<WebCore::Range>& range) 95 WebRange& WebRange::operator=(const WTF::PassRefPtr<WebCore::Range>& range)
85 { 96 {
86 assign(static_cast<WebRangePrivate*>(range.releaseRef())); 97 assign(static_cast<WebRangePrivate*>(range.releaseRef()));
87 return *this; 98 return *this;
88 } 99 }
89 100
90 WebRange::operator WTF::PassRefPtr<WebCore::Range>() const 101 WebRange::operator WTF::PassRefPtr<WebCore::Range>() const
91 { 102 {
92 return PassRefPtr<Range>(const_cast<WebRangePrivate*>(m_private)); 103 return PassRefPtr<Range>(const_cast<WebRangePrivate*>(m_private));
93 } 104 }
94 105
95 void WebRange::assign(WebRangePrivate* p) 106 void WebRange::assign(WebRangePrivate* p)
96 { 107 {
97 // p is already ref'd for us by the caller 108 // p is already ref'd for us by the caller
98 if (m_private) 109 if (m_private)
99 m_private->deref(); 110 m_private->deref();
100 m_private = p; 111 m_private = p;
101 } 112 }
102 113
103 } // namespace WebKit 114 } // namespace WebKit
OLDNEW
« no previous file with comments | « webkit/api/src/WebBindings.cpp ('k') | webkit/tools/layout_tests/test_expectations.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698