Chromium Code Reviews| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 return m_private->text(); | 74 return m_private->text(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 // static | 77 // static |
| 78 WebRange WebRange::fromDocumentRange(WebLocalFrame* frame, int start, int length ) | 78 WebRange WebRange::fromDocumentRange(WebLocalFrame* frame, int start, int length ) |
| 79 { | 79 { |
| 80 LocalFrame* webFrame = toWebLocalFrameImpl(frame)->frame(); | 80 LocalFrame* webFrame = toWebLocalFrameImpl(frame)->frame(); |
| 81 Element* selectionRoot = webFrame->selection().rootEditableElement(); | 81 Element* selectionRoot = webFrame->selection().rootEditableElement(); |
| 82 ContainerNode* scope = selectionRoot ? selectionRoot : webFrame->document()- >documentElement(); | 82 ContainerNode* scope = selectionRoot ? selectionRoot : webFrame->document()- >documentElement(); |
| 83 const EphemeralRange range = PlainTextRange(start, start + length).createRan ge(*scope); | 83 const EphemeralRange range = PlainTextRange(start, start + length).createRan ge(*scope); |
| 84 if (range.isNull()) | 84 if (range.isNull()) |
|
tkent
2015/08/24 09:38:06
We can remove these two lines.
yosin_UTC9
2015/08/24 13:19:22
Done
| |
| 85 return WebRange(); | 85 return WebRange(); |
| 86 return Range::create(range.document(), range.startPosition(), range.endPosit ion()); | 86 return createRange(range); |
| 87 } | 87 } |
| 88 | 88 |
| 89 WebRange::WebRange(const PassRefPtrWillBeRawPtr<Range>& range) | 89 WebRange::WebRange(const PassRefPtrWillBeRawPtr<Range>& range) |
| 90 : m_private(range) | 90 : m_private(range) |
| 91 { | 91 { |
| 92 } | 92 } |
| 93 | 93 |
| 94 WebRange::operator PassRefPtrWillBeRawPtr<Range>() const | 94 WebRange::operator PassRefPtrWillBeRawPtr<Range>() const |
| 95 { | 95 { |
| 96 return m_private.get(); | 96 return m_private.get(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace blink | 99 } // namespace blink |
| OLD | NEW |