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

Side by Side Diff: Source/core/page/PrintContext.cpp

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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
« no previous file with comments | « Source/core/page/PageSerializer.cpp ('k') | Source/core/page/SpatialNavigation.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 2 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
3 * Copyright (C) 2007 Apple Inc. 3 * Copyright (C) 2007 Apple Inc.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 return nullptr; 190 return nullptr;
191 return toLayoutBoxModelObject(object); 191 return toLayoutBoxModelObject(object);
192 } 192 }
193 193
194 int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSi zeInPixels) 194 int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSi zeInPixels)
195 { 195 {
196 // Make sure the element is not freed during the layout. 196 // Make sure the element is not freed during the layout.
197 RefPtrWillBeRawPtr<Element> protect(element); 197 RefPtrWillBeRawPtr<Element> protect(element);
198 element->document().updateLayout(); 198 element->document().updateLayout();
199 199
200 LayoutBoxModelObject* box = enclosingBoxModelObject(element->renderer()); 200 LayoutBoxModelObject* box = enclosingBoxModelObject(element->layoutObject()) ;
201 if (!box) 201 if (!box)
202 return -1; 202 return -1;
203 203
204 LocalFrame* frame = element->document().frame(); 204 LocalFrame* frame = element->document().frame();
205 FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels); 205 FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels);
206 PrintContext printContext(frame); 206 PrintContext printContext(frame);
207 printContext.begin(pageRect.width(), pageRect.height()); 207 printContext.begin(pageRect.width(), pageRect.height());
208 FloatSize scaledPageSize = pageSizeInPixels; 208 FloatSize scaledPageSize = pageSizeInPixels;
209 scaledPageSize.scale(frame->view()->contentsSize().width() / pageRect.width( )); 209 scaledPageSize.scale(frame->view()->contentsSize().width() / pageRect.width( ));
210 printContext.computePageRectsWithPageSize(scaledPageSize, false); 210 printContext.computePageRectsWithPageSize(scaledPageSize, false);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 { 257 {
258 if (!m_linkAndLinkedDestinationsValid) { 258 if (!m_linkAndLinkedDestinationsValid) {
259 for (Frame* currentFrame = frame(); currentFrame; currentFrame = current Frame->tree().traverseNext(frame())) { 259 for (Frame* currentFrame = frame(); currentFrame; currentFrame = current Frame->tree().traverseNext(frame())) {
260 if (currentFrame->isLocalFrame()) 260 if (currentFrame->isLocalFrame())
261 collectLinkAndLinkedDestinations(toLocalFrame(currentFrame)->doc ument()); 261 collectLinkAndLinkedDestinations(toLocalFrame(currentFrame)->doc ument());
262 } 262 }
263 m_linkAndLinkedDestinationsValid = true; 263 m_linkAndLinkedDestinationsValid = true;
264 } 264 }
265 265
266 for (const auto& entry : m_linkDestinations) { 266 for (const auto& entry : m_linkDestinations) {
267 LayoutObject* renderer = entry.key->renderer(); 267 LayoutObject* renderer = entry.key->layoutObject();
268 if (!renderer) 268 if (!renderer)
269 continue; 269 continue;
270 KURL url = entry.value; 270 KURL url = entry.value;
271 IntRect boundingBox = renderer->absoluteBoundingBoxRect(); 271 IntRect boundingBox = renderer->absoluteBoundingBoxRect();
272 if (!pageRect.intersects(boundingBox)) 272 if (!pageRect.intersects(boundingBox))
273 continue; 273 continue;
274 if (url.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(url, renderer->document().baseURL())) { 274 if (url.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(url, renderer->document().baseURL())) {
275 String name = url.fragmentIdentifier(); 275 String name = url.fragmentIdentifier();
276 ASSERT(renderer->document().findAnchor(name)); 276 ASSERT(renderer->document().findAnchor(name));
277 graphicsContext.setURLFragmentForRect(name, boundingBox); 277 graphicsContext.setURLFragmentForRect(name, boundingBox);
278 } else { 278 } else {
279 graphicsContext.setURLForRect(url, boundingBox); 279 graphicsContext.setURLForRect(url, boundingBox);
280 } 280 }
281 } 281 }
282 282
283 for (const auto& entry : m_linkedDestinations) { 283 for (const auto& entry : m_linkedDestinations) {
284 LayoutObject* renderer = entry.value->renderer(); 284 LayoutObject* renderer = entry.value->layoutObject();
285 if (!renderer) 285 if (!renderer)
286 continue; 286 continue;
287 IntRect boundingBox = renderer->absoluteBoundingBoxRect(); 287 IntRect boundingBox = renderer->absoluteBoundingBoxRect();
288 if (!pageRect.intersects(boundingBox)) 288 if (!pageRect.intersects(boundingBox))
289 continue; 289 continue;
290 IntPoint point = boundingBox.minXMinYCorner(); 290 IntPoint point = boundingBox.minXMinYCorner();
291 point.clampNegativeToZero(); 291 point.clampNegativeToZero();
292 graphicsContext.addURLTargetAtPoint(entry.key, point); 292 graphicsContext.addURLTargetAtPoint(entry.key, point);
293 } 293 }
294 } 294 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 DEFINE_TRACE(PrintContext) 350 DEFINE_TRACE(PrintContext)
351 { 351 {
352 #if ENABLE(OILPAN) 352 #if ENABLE(OILPAN)
353 visitor->trace(m_frame); 353 visitor->trace(m_frame);
354 visitor->trace(m_linkDestinations); 354 visitor->trace(m_linkDestinations);
355 visitor->trace(m_linkedDestinations); 355 visitor->trace(m_linkedDestinations);
356 #endif 356 #endif
357 } 357 }
358 358
359 } 359 }
OLDNEW
« no previous file with comments | « Source/core/page/PageSerializer.cpp ('k') | Source/core/page/SpatialNavigation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698