| 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 | 325 |
| 326 SkPictureBuilder pictureBuilder(allPagesRect, &skia::GetMetaData(*canvas
)); | 326 SkPictureBuilder pictureBuilder(allPagesRect, &skia::GetMetaData(*canvas
)); |
| 327 pictureBuilder.context().setPrinting(true); | 327 pictureBuilder.context().setPrinting(true); |
| 328 | 328 |
| 329 { | 329 { |
| 330 GraphicsContext& context = pictureBuilder.context(); | 330 GraphicsContext& context = pictureBuilder.context(); |
| 331 DisplayItemCacheSkipper skipper(context); | 331 DisplayItemCacheSkipper skipper(context); |
| 332 | 332 |
| 333 // Fill the whole background by white. | 333 // Fill the whole background by white. |
| 334 { | 334 { |
| 335 DrawingRecorder backgroundRecorder(context, pictureBuilder, Disp
layItem::PrintedContentBackground, allPagesRect); | 335 DrawingRecorder backgroundRecorder(context, pictureBuilder, Disp
layItem::kPrintedContentBackground, allPagesRect); |
| 336 context.fillRect(FloatRect(0, 0, pageWidth, totalHeight), Color:
:white); | 336 context.fillRect(FloatRect(0, 0, pageWidth, totalHeight), Color:
:white); |
| 337 } | 337 } |
| 338 | 338 |
| 339 | 339 |
| 340 int currentHeight = 0; | 340 int currentHeight = 0; |
| 341 for (size_t pageIndex = 0; pageIndex < numPages; pageIndex++) { | 341 for (size_t pageIndex = 0; pageIndex < numPages; pageIndex++) { |
| 342 // Draw a line for a page boundary if this isn't the first page. | 342 // Draw a line for a page boundary if this isn't the first page. |
| 343 if (pageIndex > 0) { | 343 if (pageIndex > 0) { |
| 344 DrawingRecorder lineBoundaryRecorder(context, pictureBuilder
, DisplayItem::PrintedContentLineBoundary, allPagesRect); | 344 DrawingRecorder lineBoundaryRecorder(context, pictureBuilder
, DisplayItem::kPrintedContentLineBoundary, allPagesRect); |
| 345 context.save(); | 345 context.save(); |
| 346 context.setStrokeColor(Color(0, 0, 255)); | 346 context.setStrokeColor(Color(0, 0, 255)); |
| 347 context.setFillColor(Color(0, 0, 255)); | 347 context.setFillColor(Color(0, 0, 255)); |
| 348 context.drawLine(IntPoint(0, currentHeight), IntPoint(pageWi
dth, currentHeight)); | 348 context.drawLine(IntPoint(0, currentHeight), IntPoint(pageWi
dth, currentHeight)); |
| 349 context.restore(); | 349 context.restore(); |
| 350 } | 350 } |
| 351 | 351 |
| 352 AffineTransform transform; | 352 AffineTransform transform; |
| 353 transform.translate(0, currentHeight); | 353 transform.translate(0, currentHeight); |
| 354 #if OS(WIN) || OS(MACOSX) | 354 #if OS(WIN) || OS(MACOSX) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 378 float scale = m_printedPageWidth / pageRect.width(); | 378 float scale = m_printedPageWidth / pageRect.width(); |
| 379 GraphicsContext& context = pictureBuilder.context(); | 379 GraphicsContext& context = pictureBuilder.context(); |
| 380 | 380 |
| 381 AffineTransform transform; | 381 AffineTransform transform; |
| 382 #if OS(POSIX) && !OS(MACOSX) | 382 #if OS(POSIX) && !OS(MACOSX) |
| 383 transform.scale(scale); | 383 transform.scale(scale); |
| 384 #endif | 384 #endif |
| 385 transform.translate(static_cast<float>(-pageRect.x()), static_cast<float
>(-pageRect.y())); | 385 transform.translate(static_cast<float>(-pageRect.x()), static_cast<float
>(-pageRect.y())); |
| 386 TransformRecorder transformRecorder(context, pictureBuilder, transform); | 386 TransformRecorder transformRecorder(context, pictureBuilder, transform); |
| 387 | 387 |
| 388 ClipRecorder clipRecorder(context, pictureBuilder, DisplayItem::ClipPrin
tedPage, pageRect); | 388 ClipRecorder clipRecorder(context, pictureBuilder, DisplayItem::kClipPri
ntedPage, pageRect); |
| 389 | 389 |
| 390 frame()->view()->paintContents(context, GlobalPaintNormalPhase, pageRect
); | 390 frame()->view()->paintContents(context, GlobalPaintNormalPhase, pageRect
); |
| 391 | 391 |
| 392 { | 392 { |
| 393 DrawingRecorder lineBoundaryRecorder(context, pictureBuilder, Displa
yItem::PrintedContentDestinationLocations, pageRect); | 393 DrawingRecorder lineBoundaryRecorder(context, pictureBuilder, Displa
yItem::kPrintedContentDestinationLocations, pageRect); |
| 394 outputLinkedDestinations(context, pageRect); | 394 outputLinkedDestinations(context, pageRect); |
| 395 } | 395 } |
| 396 | 396 |
| 397 return scale; | 397 return scale; |
| 398 } | 398 } |
| 399 | 399 |
| 400 private: | 400 private: |
| 401 void dispatchEventsForPrintingOnAllFrames() | 401 void dispatchEventsForPrintingOnAllFrames() |
| 402 { | 402 { |
| 403 HeapVector<Member<Document>> documents; | 403 HeapVector<Member<Document>> documents; |
| (...skipping 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2202 feature = UseCounter::ChromeLoadTimesNpnNegotiatedProtocol; | 2202 feature = UseCounter::ChromeLoadTimesNpnNegotiatedProtocol; |
| 2203 } else if (metric == "wasAlternateProtocolAvailable") { | 2203 } else if (metric == "wasAlternateProtocolAvailable") { |
| 2204 feature = UseCounter::ChromeLoadTimesWasAlternateProtocolAvailable; | 2204 feature = UseCounter::ChromeLoadTimesWasAlternateProtocolAvailable; |
| 2205 } else if (metric == "connectionInfo") { | 2205 } else if (metric == "connectionInfo") { |
| 2206 feature = UseCounter::ChromeLoadTimesConnectionInfo; | 2206 feature = UseCounter::ChromeLoadTimesConnectionInfo; |
| 2207 } | 2207 } |
| 2208 UseCounter::count(frame(), feature); | 2208 UseCounter::count(frame(), feature); |
| 2209 } | 2209 } |
| 2210 | 2210 |
| 2211 } // namespace blink | 2211 } // namespace blink |
| OLD | NEW |