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

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

Issue 1896793002: Rename (updateLayout/updateStyle).*.() to updateStyleAndLayout.*.() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 while (object && !object->isBoxModelObject()) 182 while (object && !object->isBoxModelObject())
183 object = object->parent(); 183 object = object->parent();
184 if (!object) 184 if (!object)
185 return nullptr; 185 return nullptr;
186 return toLayoutBoxModelObject(object); 186 return toLayoutBoxModelObject(object);
187 } 187 }
188 188
189 int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSi zeInPixels) 189 int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSi zeInPixels)
190 { 190 {
191 element->document().updateLayout(); 191 element->document().updateStyleAndLayout();
192 192
193 LocalFrame* frame = element->document().frame(); 193 LocalFrame* frame = element->document().frame();
194 FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels); 194 FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels);
195 PrintContext printContext(frame); 195 PrintContext printContext(frame);
196 printContext.begin(pageRect.width(), pageRect.height()); 196 printContext.begin(pageRect.width(), pageRect.height());
197 197
198 LayoutBoxModelObject* box = enclosingBoxModelObject(element->layoutObject()) ; 198 LayoutBoxModelObject* box = enclosingBoxModelObject(element->layoutObject()) ;
199 if (!box) 199 if (!box)
200 return -1; 200 return -1;
201 201
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 { 296 {
297 IntSize pageSize(width, height); 297 IntSize pageSize(width, height);
298 frame->document()->pageSizeAndMarginsInPixels(pageNumber, pageSize, marginTo p, marginRight, marginBottom, marginLeft); 298 frame->document()->pageSizeAndMarginsInPixels(pageNumber, pageSize, marginTo p, marginRight, marginBottom, marginLeft);
299 299
300 return "(" + String::number(pageSize.width()) + ", " + String::number(pageSi ze.height()) + ") " + 300 return "(" + String::number(pageSize.width()) + ", " + String::number(pageSi ze.height()) + ") " +
301 String::number(marginTop) + ' ' + String::number(marginRight) + ' ' + St ring::number(marginBottom) + ' ' + String::number(marginLeft); 301 String::number(marginTop) + ' ' + String::number(marginRight) + ' ' + St ring::number(marginBottom) + ' ' + String::number(marginLeft);
302 } 302 }
303 303
304 int PrintContext::numberOfPages(LocalFrame* frame, const FloatSize& pageSizeInPi xels) 304 int PrintContext::numberOfPages(LocalFrame* frame, const FloatSize& pageSizeInPi xels)
305 { 305 {
306 frame->document()->updateLayout(); 306 frame->document()->updateStyleAndLayout();
307 307
308 FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels); 308 FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels);
309 PrintContext printContext(frame); 309 PrintContext printContext(frame);
310 printContext.begin(pageRect.width(), pageRect.height()); 310 printContext.begin(pageRect.width(), pageRect.height());
311 // Account for shrink-to-fit. 311 // Account for shrink-to-fit.
312 FloatSize scaledPageSize = pageSizeInPixels; 312 FloatSize scaledPageSize = pageSizeInPixels;
313 scaledPageSize.scale(frame->view()->contentsSize().width() / pageRect.width( )); 313 scaledPageSize.scale(frame->view()->contentsSize().width() / pageRect.width( ));
314 printContext.computePageRectsWithPageSize(scaledPageSize); 314 printContext.computePageRectsWithPageSize(scaledPageSize);
315 return printContext.pageCount(); 315 return printContext.pageCount();
316 } 316 }
317 317
318 DEFINE_TRACE(PrintContext) 318 DEFINE_TRACE(PrintContext)
319 { 319 {
320 visitor->trace(m_frame); 320 visitor->trace(m_frame);
321 visitor->trace(m_linkedDestinations); 321 visitor->trace(m_linkedDestinations);
322 } 322 }
323 323
324 } // namespace blink 324 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698