OLD | NEW |
1 /** | 1 /** |
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
3 * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 3 * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // "-webkit-user-select: none" style attribute is specified. | 255 // "-webkit-user-select: none" style attribute is specified. |
256 if (startPosition.isNotNull() && endPosition.isNotNull()) { | 256 if (startPosition.isNotNull() && endPosition.isNotNull()) { |
257 ASSERT(startPosition.deepEquivalent().node()->shadowAncestorNode() == no
de() && endPosition.deepEquivalent().node()->shadowAncestorNode() == node()); | 257 ASSERT(startPosition.deepEquivalent().node()->shadowAncestorNode() == no
de() && endPosition.deepEquivalent().node()->shadowAncestorNode() == node()); |
258 } | 258 } |
259 VisibleSelection newSelection = VisibleSelection(startPosition, endPosition)
; | 259 VisibleSelection newSelection = VisibleSelection(startPosition, endPosition)
; |
260 | 260 |
261 if (Frame* frame = this->frame()) | 261 if (Frame* frame = this->frame()) |
262 frame->selection()->setSelection(newSelection); | 262 frame->selection()->setSelection(newSelection); |
263 } | 263 } |
264 | 264 |
265 VisibleSelection RenderTextControl::selection(int start, int end) const | 265 PassRefPtr<Range> RenderTextControl::selection(int start, int end) const |
266 { | 266 { |
267 return VisibleSelection(VisiblePosition(m_innerText.get(), start, VP_DEFAULT
_AFFINITY), | 267 if (!m_innerText) |
268 VisiblePosition(m_innerText.get(), end, VP_DEFAULT_A
FFINITY)); | 268 return 0; |
| 269 |
| 270 return Range::create(document(), m_innerText, start, m_innerText, end); |
269 } | 271 } |
270 | 272 |
271 VisiblePosition RenderTextControl::visiblePositionForIndex(int index) | 273 VisiblePosition RenderTextControl::visiblePositionForIndex(int index) |
272 { | 274 { |
273 if (index <= 0) | 275 if (index <= 0) |
274 return VisiblePosition(m_innerText.get(), 0, DOWNSTREAM); | 276 return VisiblePosition(m_innerText.get(), 0, DOWNSTREAM); |
275 ExceptionCode ec = 0; | 277 ExceptionCode ec = 0; |
276 RefPtr<Range> range = Range::create(document()); | 278 RefPtr<Range> range = Range::create(document()); |
277 range->selectNodeContents(m_innerText.get(), ec); | 279 range->selectNodeContents(m_innerText.get(), ec); |
278 ASSERT(!ec); | 280 ASSERT(!ec); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 // Sets the inner text style to the normal style or :placeholder style. | 571 // Sets the inner text style to the normal style or :placeholder style. |
570 setInnerTextStyle(createInnerTextStyle(textBaseStyle())); | 572 setInnerTextStyle(createInnerTextStyle(textBaseStyle())); |
571 | 573 |
572 // updateFromElement() of the subclasses updates the text content | 574 // updateFromElement() of the subclasses updates the text content |
573 // to the element's value(), placeholder(), or the empty string. | 575 // to the element's value(), placeholder(), or the empty string. |
574 updateFromElement(); | 576 updateFromElement(); |
575 } | 577 } |
576 } | 578 } |
577 | 579 |
578 } // namespace WebCore | 580 } // namespace WebCore |
OLD | NEW |