OLD | NEW |
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 int WebRange::startOffset() const | 62 int WebRange::startOffset() const |
63 { | 63 { |
64 return m_private->startOffset(); | 64 return m_private->startOffset(); |
65 } | 65 } |
66 | 66 |
67 int WebRange::endOffset() const | 67 int WebRange::endOffset() const |
68 { | 68 { |
69 return m_private->endOffset(); | 69 return m_private->endOffset(); |
70 } | 70 } |
71 | 71 |
72 WebNode WebRange::startContainer(WebExceptionCode& exceptionCode) const | |
73 { | |
74 // FIXME: Create a wrapper class that just sets the internal int. | |
75 RefPtrWillBeRawPtr<Node> node(m_private->startContainer()); | |
76 exceptionCode = 0; | |
77 return node.release(); | |
78 } | |
79 | |
80 WebNode WebRange::endContainer(WebExceptionCode& exceptionCode) const | |
81 { | |
82 // FIXME: Create a wrapper class that just sets the internal int. | |
83 RefPtrWillBeRawPtr<Node> node(m_private->endContainer()); | |
84 exceptionCode = 0; | |
85 return node.release(); | |
86 } | |
87 | |
88 WebString WebRange::toHTMLText() const | |
89 { | |
90 return m_private->toHTML(); | |
91 } | |
92 | |
93 WebString WebRange::toPlainText() const | 72 WebString WebRange::toPlainText() const |
94 { | 73 { |
95 return m_private->text(); | 74 return m_private->text(); |
96 } | 75 } |
97 | 76 |
98 WebRange WebRange::expandedToParagraph() const | |
99 { | |
100 WebRange copy(*this); | |
101 copy.m_private->expand("block", IGNORE_EXCEPTION); | |
102 return copy; | |
103 } | |
104 | |
105 // static | 77 // static |
106 WebRange WebRange::fromDocumentRange(WebLocalFrame* frame, int start, int length
) | 78 WebRange WebRange::fromDocumentRange(WebLocalFrame* frame, int start, int length
) |
107 { | 79 { |
108 LocalFrame* webFrame = toWebLocalFrameImpl(frame)->frame(); | 80 LocalFrame* webFrame = toWebLocalFrameImpl(frame)->frame(); |
109 Element* selectionRoot = webFrame->selection().rootEditableElement(); | 81 Element* selectionRoot = webFrame->selection().rootEditableElement(); |
110 ContainerNode* scope = selectionRoot ? selectionRoot : webFrame->document()-
>documentElement(); | 82 ContainerNode* scope = selectionRoot ? selectionRoot : webFrame->document()-
>documentElement(); |
111 return PlainTextRange(start, start + length).createRange(*scope); | 83 return PlainTextRange(start, start + length).createRange(*scope); |
112 } | 84 } |
113 | 85 |
114 WebRange::WebRange(const PassRefPtrWillBeRawPtr<Range>& range) | 86 WebRange::WebRange(const PassRefPtrWillBeRawPtr<Range>& range) |
115 : m_private(range) | 87 : m_private(range) |
116 { | 88 { |
117 } | 89 } |
118 | 90 |
119 WebRange::operator PassRefPtrWillBeRawPtr<Range>() const | 91 WebRange::operator PassRefPtrWillBeRawPtr<Range>() const |
120 { | 92 { |
121 return m_private.get(); | 93 return m_private.get(); |
122 } | 94 } |
123 | 95 |
124 } // namespace blink | 96 } // namespace blink |
OLD | NEW |