| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "core/frame/FrameView.h" | 45 #include "core/frame/FrameView.h" |
| 46 #include "core/frame/LocalFrame.h" | 46 #include "core/frame/LocalFrame.h" |
| 47 #include "public/platform/WebFloatQuad.h" | 47 #include "public/platform/WebFloatQuad.h" |
| 48 #include "public/platform/WebString.h" | 48 #include "public/platform/WebString.h" |
| 49 #include "wtf/PassRefPtr.h" | 49 #include "wtf/PassRefPtr.h" |
| 50 | 50 |
| 51 using namespace WebCore; | 51 using namespace WebCore; |
| 52 | 52 |
| 53 namespace blink { | 53 namespace blink { |
| 54 | 54 |
| 55 class WebRangePrivate : public Range { | |
| 56 }; | |
| 57 | |
| 58 void WebRange::reset() | 55 void WebRange::reset() |
| 59 { | 56 { |
| 60 assign(0); | 57 m_private.reset(); |
| 61 } | 58 } |
| 62 | 59 |
| 63 void WebRange::assign(const WebRange& other) | 60 void WebRange::assign(const WebRange& other) |
| 64 { | 61 { |
| 65 WebRangePrivate* p = const_cast<WebRangePrivate*>(other.m_private); | 62 m_private = other.m_private; |
| 66 if (p) | |
| 67 p->ref(); | |
| 68 assign(p); | |
| 69 } | 63 } |
| 70 | 64 |
| 71 int WebRange::startOffset() const | 65 int WebRange::startOffset() const |
| 72 { | 66 { |
| 73 return m_private->startOffset(); | 67 return m_private->startOffset(); |
| 74 } | 68 } |
| 75 | 69 |
| 76 int WebRange::endOffset() const | 70 int WebRange::endOffset() const |
| 77 { | 71 { |
| 78 return m_private->endOffset(); | 72 return m_private->endOffset(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 for (unsigned i = 0; i < quads.size(); ++i) { | 130 for (unsigned i = 0; i < quads.size(); ++i) { |
| 137 quads[i].setP1(frame->view()->contentsToWindow(roundedIntPoint(quads[i].
p1()))); | 131 quads[i].setP1(frame->view()->contentsToWindow(roundedIntPoint(quads[i].
p1()))); |
| 138 quads[i].setP2(frame->view()->contentsToWindow(roundedIntPoint(quads[i].
p2()))); | 132 quads[i].setP2(frame->view()->contentsToWindow(roundedIntPoint(quads[i].
p2()))); |
| 139 quads[i].setP3(frame->view()->contentsToWindow(roundedIntPoint(quads[i].
p3()))); | 133 quads[i].setP3(frame->view()->contentsToWindow(roundedIntPoint(quads[i].
p3()))); |
| 140 quads[i].setP4(frame->view()->contentsToWindow(roundedIntPoint(quads[i].
p4()))); | 134 quads[i].setP4(frame->view()->contentsToWindow(roundedIntPoint(quads[i].
p4()))); |
| 141 } | 135 } |
| 142 | 136 |
| 143 return quads; | 137 return quads; |
| 144 } | 138 } |
| 145 | 139 |
| 146 WebRange::WebRange(const WTF::PassRefPtr<WebCore::Range>& range) | 140 WebRange::WebRange(const PassRefPtrWillBeRawPtr<WebCore::Range>& range) |
| 147 : m_private(static_cast<WebRangePrivate*>(range.leakRef())) | 141 : m_private(range) |
| 148 { | 142 { |
| 149 } | 143 } |
| 150 | 144 |
| 151 WebRange& WebRange::operator=(const WTF::PassRefPtr<WebCore::Range>& range) | 145 WebRange::operator PassRefPtrWillBeRawPtr<WebCore::Range>() const |
| 152 { | 146 { |
| 153 assign(static_cast<WebRangePrivate*>(range.leakRef())); | 147 return m_private.get(); |
| 154 return *this; | |
| 155 } | |
| 156 | |
| 157 WebRange::operator WTF::PassRefPtr<WebCore::Range>() const | |
| 158 { | |
| 159 return PassRefPtr<Range>(const_cast<WebRangePrivate*>(m_private)); | |
| 160 } | |
| 161 | |
| 162 void WebRange::assign(WebRangePrivate* p) | |
| 163 { | |
| 164 // p is already ref'd for us by the caller | |
| 165 if (m_private) | |
| 166 m_private->deref(); | |
| 167 m_private = p; | |
| 168 } | 148 } |
| 169 | 149 |
| 170 } // namespace blink | 150 } // namespace blink |
| OLD | NEW |