Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 if (!m_frame) | 200 if (!m_frame) |
| 201 return; | 201 return; |
| 202 | 202 |
| 203 if (offset < 0) { | 203 if (offset < 0) { |
| 204 exceptionState.throwDOMException(IndexSizeError, String::number(offset) + " is not a valid offset."); | 204 exceptionState.throwDOMException(IndexSizeError, String::number(offset) + " is not a valid offset."); |
| 205 return; | 205 return; |
| 206 } | 206 } |
| 207 | 207 |
| 208 if (!isValidForPosition(node)) | 208 if (!isValidForPosition(node)) |
| 209 return; | 209 return; |
| 210 | 210 if (!node) |
|
yosin_UTC9
2014/06/05 03:43:36
nit: Can we merge this if-statement to L208?
yoichio
2014/06/06 07:54:49
Oh, |node| is asserted at L199 so this line is no
| |
| 211 // FIXME: Eliminate legacy editing positions | 211 return; |
| 212 m_frame->selection().moveTo(VisiblePosition(createLegacyEditingPosition(node , offset), DOWNSTREAM)); | 212 RefPtr<Range> range = Range::create(node->document()); |
|
yosin_UTC9
2014/06/05 03:43:36
nit: Please use RefPtrWillbeRawPtr<Range>
yoichio
2014/06/06 07:54:49
Done.
| |
| 213 range->setStart(node, offset, exceptionState); | |
| 214 if (exceptionState.hadException()) | |
| 215 return; | |
| 216 range->setEnd(node, offset, exceptionState); | |
| 217 if (exceptionState.hadException()) | |
| 218 return; | |
| 219 m_frame->selection().setSelectedRange(range.get(), DOWNSTREAM); | |
| 213 } | 220 } |
| 214 | 221 |
| 215 void DOMSelection::collapse(Node* node, ExceptionState& exceptionState) | 222 void DOMSelection::collapse(Node* node, ExceptionState& exceptionState) |
| 216 { | 223 { |
| 217 collapse(node, 0, exceptionState); | 224 collapse(node, 0, exceptionState); |
| 218 } | 225 } |
| 219 | 226 |
| 220 void DOMSelection::collapseToEnd(ExceptionState& exceptionState) | 227 void DOMSelection::collapseToEnd(ExceptionState& exceptionState) |
| 221 { | 228 { |
| 222 if (!m_frame) | 229 if (!m_frame) |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 550 return node->document() == m_frame->document(); | 557 return node->document() == m_frame->document(); |
| 551 } | 558 } |
| 552 | 559 |
| 553 void DOMSelection::addConsoleError(const String& message) | 560 void DOMSelection::addConsoleError(const String& message) |
| 554 { | 561 { |
| 555 if (m_treeScope) | 562 if (m_treeScope) |
| 556 m_treeScope->document().addConsoleMessage(JSMessageSource, ErrorMessageL evel, message); | 563 m_treeScope->document().addConsoleMessage(JSMessageSource, ErrorMessageL evel, message); |
| 557 } | 564 } |
| 558 | 565 |
| 559 } // namespace WebCore | 566 } // namespace WebCore |
| OLD | NEW |