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

Side by Side Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 2923343005: Move printing-related methods from WebFrame to WebLocalFrame. (Closed)
Patch Set: Rebasing... Created 3 years, 6 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) 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 // print content area here as the recording rect. 283 // print content area here as the recording rect.
284 IntRect bounds(0, 0, printed_page_height_, printed_page_width_); 284 IntRect bounds(0, 0, printed_page_height_, printed_page_width_);
285 PaintRecordBuilder builder(bounds, &canvas->getMetaData()); 285 PaintRecordBuilder builder(bounds, &canvas->getMetaData());
286 builder.Context().SetPrinting(true); 286 builder.Context().SetPrinting(true);
287 builder.Context().BeginRecording(bounds); 287 builder.Context().BeginRecording(bounds);
288 float scale = SpoolPage(builder.Context(), page_number, bounds); 288 float scale = SpoolPage(builder.Context(), page_number, bounds);
289 canvas->drawPicture(builder.Context().EndRecording()); 289 canvas->drawPicture(builder.Context().EndRecording());
290 return scale; 290 return scale;
291 } 291 }
292 292
293 void SpoolAllPagesWithBoundaries(WebCanvas* canvas, 293 void SpoolAllPagesWithBoundariesForTesting(
294 const FloatSize& page_size_in_pixels) { 294 WebCanvas* canvas,
295 const FloatSize& page_size_in_pixels) {
295 DispatchEventsForPrintingOnAllFrames(); 296 DispatchEventsForPrintingOnAllFrames();
296 if (!GetFrame()->GetDocument() || 297 if (!GetFrame()->GetDocument() ||
297 GetFrame()->GetDocument()->GetLayoutViewItem().IsNull()) 298 GetFrame()->GetDocument()->GetLayoutViewItem().IsNull())
298 return; 299 return;
299 300
300 GetFrame()->View()->UpdateAllLifecyclePhasesExceptPaint(); 301 GetFrame()->View()->UpdateAllLifecyclePhasesExceptPaint();
301 if (!GetFrame()->GetDocument() || 302 if (!GetFrame()->GetDocument() ||
302 GetFrame()->GetDocument()->GetLayoutViewItem().IsNull()) 303 GetFrame()->GetDocument()->GetLayoutViewItem().IsNull())
303 return; 304 return;
304 305
(...skipping 20 matching lines...) Expand all
325 context.SetStrokeColor(Color(0, 0, 255)); 326 context.SetStrokeColor(Color(0, 0, 255));
326 context.SetFillColor(Color(0, 0, 255)); 327 context.SetFillColor(Color(0, 0, 255));
327 context.DrawLine(IntPoint(0, current_height), 328 context.DrawLine(IntPoint(0, current_height),
328 IntPoint(page_width, current_height)); 329 IntPoint(page_width, current_height));
329 context.Restore(); 330 context.Restore();
330 } 331 }
331 332
332 AffineTransform transform; 333 AffineTransform transform;
333 transform.Translate(0, current_height); 334 transform.Translate(0, current_height);
334 #if OS(WIN) || OS(MACOSX) 335 #if OS(WIN) || OS(MACOSX)
335 // Account for the disabling of scaling in spoolPage. In the context 336 // Account for the disabling of scaling in spoolPage. In the context of
336 // of spoolAllPagesWithBoundaries the scale HAS NOT been pre-applied. 337 // SpoolAllPagesWithBoundariesForTesting the scale HAS NOT been
338 // pre-applied.
337 float scale = GetPageShrink(page_index); 339 float scale = GetPageShrink(page_index);
338 transform.Scale(scale, scale); 340 transform.Scale(scale, scale);
339 #endif 341 #endif
340 context.Save(); 342 context.Save();
341 context.ConcatCTM(transform); 343 context.ConcatCTM(transform);
342 344
343 SpoolPage(context, page_index, all_pages_rect); 345 SpoolPage(context, page_index, all_pages_rect);
344 346
345 context.Restore(); 347 context.Restore();
346 348
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 page_size = size; 1471 page_size = size;
1470 } 1472 }
1471 1473
1472 WebString WebLocalFrameImpl::PageProperty(const WebString& property_name, 1474 WebString WebLocalFrameImpl::PageProperty(const WebString& property_name,
1473 int page_index) { 1475 int page_index) {
1474 DCHECK(print_context_); 1476 DCHECK(print_context_);
1475 return print_context_->PageProperty(GetFrame(), property_name.Utf8().data(), 1477 return print_context_->PageProperty(GetFrame(), property_name.Utf8().data(),
1476 page_index); 1478 page_index);
1477 } 1479 }
1478 1480
1479 void WebLocalFrameImpl::PrintPagesWithBoundaries( 1481 void WebLocalFrameImpl::PrintPagesForTesting(
1480 WebCanvas* canvas, 1482 WebCanvas* canvas,
1481 const WebSize& page_size_in_pixels) { 1483 const WebSize& page_size_in_pixels) {
1482 DCHECK(print_context_); 1484 DCHECK(print_context_);
1483 1485
1484 print_context_->SpoolAllPagesWithBoundaries( 1486 print_context_->SpoolAllPagesWithBoundariesForTesting(
1485 canvas, FloatSize(page_size_in_pixels.width, page_size_in_pixels.height)); 1487 canvas, FloatSize(page_size_in_pixels.width, page_size_in_pixels.height));
1486 } 1488 }
1487 1489
1488 WebRect WebLocalFrameImpl::SelectionBoundsRect() const { 1490 WebRect WebLocalFrameImpl::GetSelectionBoundsRectForTesting() const {
1489 return HasSelection() ? WebRect(IntRect(GetFrame()->Selection().Bounds())) 1491 return HasSelection() ? WebRect(IntRect(GetFrame()->Selection().Bounds()))
1490 : WebRect(); 1492 : WebRect();
1491 } 1493 }
1492 1494
1493 WebString WebLocalFrameImpl::GetLayerTreeAsTextForTesting( 1495 WebString WebLocalFrameImpl::GetLayerTreeAsTextForTesting(
1494 bool show_debug_info) const { 1496 bool show_debug_info) const {
1495 if (!GetFrame()) 1497 if (!GetFrame())
1496 return WebString(); 1498 return WebString();
1497 1499
1498 return WebString(GetFrame()->GetLayerTreeAsTextForTesting( 1500 return WebString(GetFrame()->GetLayerTreeAsTextForTesting(
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2607 TextCheckerClient& WebLocalFrameImpl::GetTextCheckerClient() const { 2609 TextCheckerClient& WebLocalFrameImpl::GetTextCheckerClient() const {
2608 return *text_checker_client_; 2610 return *text_checker_client_;
2609 } 2611 }
2610 2612
2611 void WebLocalFrameImpl::SetTextCheckClient( 2613 void WebLocalFrameImpl::SetTextCheckClient(
2612 WebTextCheckClient* text_check_client) { 2614 WebTextCheckClient* text_check_client) {
2613 text_check_client_ = text_check_client; 2615 text_check_client_ = text_check_client;
2614 } 2616 }
2615 2617
2616 } // namespace blink 2618 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.h ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698