| 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 29 matching lines...) Expand all Loading... |
| 40 #include "core/editing/FrameSelection.h" | 40 #include "core/editing/FrameSelection.h" |
| 41 #include "core/editing/PlainTextRange.h" | 41 #include "core/editing/PlainTextRange.h" |
| 42 #include "core/frame/FrameView.h" | 42 #include "core/frame/FrameView.h" |
| 43 #include "core/frame/LocalFrame.h" | 43 #include "core/frame/LocalFrame.h" |
| 44 #include "public/platform/WebString.h" | 44 #include "public/platform/WebString.h" |
| 45 #include "public/web/WebExceptionCode.h" | 45 #include "public/web/WebExceptionCode.h" |
| 46 #include "public/web/WebNode.h" | 46 #include "public/web/WebNode.h" |
| 47 #include "web/WebLocalFrameImpl.h" | 47 #include "web/WebLocalFrameImpl.h" |
| 48 #include "wtf/PassRefPtr.h" | 48 #include "wtf/PassRefPtr.h" |
| 49 | 49 |
| 50 using namespace blink; | |
| 51 | |
| 52 namespace blink { | 50 namespace blink { |
| 53 | 51 |
| 54 void WebRange::reset() | 52 void WebRange::reset() |
| 55 { | 53 { |
| 56 m_private.reset(); | 54 m_private.reset(); |
| 57 } | 55 } |
| 58 | 56 |
| 59 void WebRange::assign(const WebRange& other) | 57 void WebRange::assign(const WebRange& other) |
| 60 { | 58 { |
| 61 m_private = other.m_private; | 59 m_private = other.m_private; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 WebRange WebRange::expandedToParagraph() const | 98 WebRange WebRange::expandedToParagraph() const |
| 101 { | 99 { |
| 102 WebRange copy(*this); | 100 WebRange copy(*this); |
| 103 copy.m_private->expand("block", IGNORE_EXCEPTION); | 101 copy.m_private->expand("block", IGNORE_EXCEPTION); |
| 104 return copy; | 102 return copy; |
| 105 } | 103 } |
| 106 | 104 |
| 107 // static | 105 // static |
| 108 WebRange WebRange::fromDocumentRange(WebLocalFrame* frame, int start, int length
) | 106 WebRange WebRange::fromDocumentRange(WebLocalFrame* frame, int start, int length
) |
| 109 { | 107 { |
| 110 blink::LocalFrame* webFrame = toWebLocalFrameImpl(frame)->frame(); | 108 LocalFrame* webFrame = toWebLocalFrameImpl(frame)->frame(); |
| 111 Element* selectionRoot = webFrame->selection().rootEditableElement(); | 109 Element* selectionRoot = webFrame->selection().rootEditableElement(); |
| 112 ContainerNode* scope = selectionRoot ? selectionRoot : webFrame->document()-
>documentElement(); | 110 ContainerNode* scope = selectionRoot ? selectionRoot : webFrame->document()-
>documentElement(); |
| 113 return PlainTextRange(start, start + length).createRange(*scope); | 111 return PlainTextRange(start, start + length).createRange(*scope); |
| 114 } | 112 } |
| 115 | 113 |
| 116 WebRange::WebRange(const PassRefPtrWillBeRawPtr<blink::Range>& range) | 114 WebRange::WebRange(const PassRefPtrWillBeRawPtr<Range>& range) |
| 117 : m_private(range) | 115 : m_private(range) |
| 118 { | 116 { |
| 119 } | 117 } |
| 120 | 118 |
| 121 WebRange::operator PassRefPtrWillBeRawPtr<blink::Range>() const | 119 WebRange::operator PassRefPtrWillBeRawPtr<Range>() const |
| 122 { | 120 { |
| 123 return m_private.get(); | 121 return m_private.get(); |
| 124 } | 122 } |
| 125 | 123 |
| 126 } // namespace blink | 124 } // namespace blink |
| OLD | NEW |