Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: Source/web/WebRange.cpp

Issue 23467007: Have Range constructor take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 Element* selectionRoot = webFrame->selection().rootEditableElement(); 120 Element* selectionRoot = webFrame->selection().rootEditableElement();
121 ContainerNode* scope = selectionRoot ? selectionRoot : webFrame->document()- >documentElement(); 121 ContainerNode* scope = selectionRoot ? selectionRoot : webFrame->document()- >documentElement();
122 return TextIterator::rangeFromLocationAndLength(scope, start, length); 122 return TextIterator::rangeFromLocationAndLength(scope, start, length);
123 } 123 }
124 124
125 WebVector<WebFloatQuad> WebRange::textQuads() const 125 WebVector<WebFloatQuad> WebRange::textQuads() const
126 { 126 {
127 if (isNull()) 127 if (isNull())
128 return WebVector<WebFloatQuad>(); 128 return WebVector<WebFloatQuad>();
129 129
130 Frame* frame = m_private->ownerDocument() ? m_private->ownerDocument()->fram e() : 0; 130 Frame* frame = m_private->ownerDocument().frame();
131 if (!frame) 131 if (!frame)
132 return WebVector<WebFloatQuad>(); 132 return WebVector<WebFloatQuad>();
133 133
134 Vector<FloatQuad> quads; 134 Vector<FloatQuad> quads;
135 m_private->textQuads(quads); 135 m_private->textQuads(quads);
136 for (unsigned i = 0; i < quads.size(); ++i) { 136 for (unsigned i = 0; i < quads.size(); ++i) {
137 quads[i].setP1(frame->view()->contentsToWindow(roundedIntPoint(quads[i]. p1()))); 137 quads[i].setP1(frame->view()->contentsToWindow(roundedIntPoint(quads[i]. p1())));
138 quads[i].setP2(frame->view()->contentsToWindow(roundedIntPoint(quads[i]. p2()))); 138 quads[i].setP2(frame->view()->contentsToWindow(roundedIntPoint(quads[i]. p2())));
139 quads[i].setP3(frame->view()->contentsToWindow(roundedIntPoint(quads[i]. p3()))); 139 quads[i].setP3(frame->view()->contentsToWindow(roundedIntPoint(quads[i]. p3())));
140 quads[i].setP4(frame->view()->contentsToWindow(roundedIntPoint(quads[i]. p4()))); 140 quads[i].setP4(frame->view()->contentsToWindow(roundedIntPoint(quads[i]. p4())));
(...skipping 20 matching lines...) Expand all
161 161
162 void WebRange::assign(WebRangePrivate* p) 162 void WebRange::assign(WebRangePrivate* p)
163 { 163 {
164 // p is already ref'd for us by the caller 164 // p is already ref'd for us by the caller
165 if (m_private) 165 if (m_private)
166 m_private->deref(); 166 m_private->deref();
167 m_private = p; 167 m_private = p;
168 } 168 }
169 169
170 } // namespace WebKit 170 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698