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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 size_t numPages = pageRects().size(); | 388 size_t numPages = pageRects().size(); |
389 int totalHeight = numPages * (pageSizeInPixels.height() + 1) - 1; | 389 int totalHeight = numPages * (pageSizeInPixels.height() + 1) - 1; |
390 IntRect allPagesRect(0, 0, pageWidth, totalHeight); | 390 IntRect allPagesRect(0, 0, pageWidth, totalHeight); |
391 | 391 |
392 SkPictureBuilder pictureBuilder(allPagesRect, &skia::getMetaData(*canvas
)); | 392 SkPictureBuilder pictureBuilder(allPagesRect, &skia::getMetaData(*canvas
)); |
393 pictureBuilder.context().setPrinting(true); | 393 pictureBuilder.context().setPrinting(true); |
394 | 394 |
395 GraphicsContext& context = pictureBuilder.context(); | 395 GraphicsContext& context = pictureBuilder.context(); |
396 | 396 |
397 // Fill the whole background by white. | 397 // Fill the whole background by white. |
398 { | 398 if (!DrawingRecorder::useCachedDrawingIfPossible(context, *this, Display
Item::PrintedContentBackground)) { |
399 DrawingRecorder backgroundRecorder(context, *this, DisplayItem::Prin
tedContentBackground, allPagesRect); | 399 DrawingRecorder backgroundRecorder(context, *this, DisplayItem::Prin
tedContentBackground, allPagesRect); |
400 if (!backgroundRecorder.canUseCachedDrawing()) | 400 context.fillRect(FloatRect(0, 0, pageWidth, totalHeight), Color::whi
te); |
401 context.fillRect(FloatRect(0, 0, pageWidth, totalHeight), Color:
:white); | |
402 } | 401 } |
403 | 402 |
404 int currentHeight = 0; | 403 int currentHeight = 0; |
405 for (size_t pageIndex = 0; pageIndex < numPages; pageIndex++) { | 404 for (size_t pageIndex = 0; pageIndex < numPages; pageIndex++) { |
406 ScopeRecorder scopeRecorder(context, *this); | 405 ScopeRecorder scopeRecorder(context, *this); |
407 // Draw a line for a page boundary if this isn't the first page. | 406 // Draw a line for a page boundary if this isn't the first page. |
408 if (pageIndex > 0) { | 407 if (pageIndex > 0 && !DrawingRecorder::useCachedDrawingIfPossible(co
ntext, *this, DisplayItem::PrintedContentLineBoundary)) { |
409 DrawingRecorder lineBoundaryRecorder(context, *this, DisplayItem
::PrintedContentLineBoundary, allPagesRect); | 408 DrawingRecorder lineBoundaryRecorder(context, *this, DisplayItem
::PrintedContentLineBoundary, allPagesRect); |
410 if (!lineBoundaryRecorder.canUseCachedDrawing()) { | 409 context.save(); |
411 context.save(); | 410 context.setStrokeColor(Color(0, 0, 255)); |
412 context.setStrokeColor(Color(0, 0, 255)); | 411 context.setFillColor(Color(0, 0, 255)); |
413 context.setFillColor(Color(0, 0, 255)); | 412 context.drawLine(IntPoint(0, currentHeight), IntPoint(pageWidth,
currentHeight)); |
414 context.drawLine(IntPoint(0, currentHeight), IntPoint(pageWi
dth, currentHeight)); | 413 context.restore(); |
415 context.restore(); | |
416 } | |
417 } | 414 } |
418 | 415 |
419 AffineTransform transform; | 416 AffineTransform transform; |
420 transform.translate(0, currentHeight); | 417 transform.translate(0, currentHeight); |
421 #if OS(WIN) || OS(MACOSX) | 418 #if OS(WIN) || OS(MACOSX) |
422 // Account for the disabling of scaling in spoolPage. In the context | 419 // Account for the disabling of scaling in spoolPage. In the context |
423 // of spoolAllPagesWithBoundaries the scale HAS NOT been pre-applied
. | 420 // of spoolAllPagesWithBoundaries the scale HAS NOT been pre-applied
. |
424 float scale = getPageShrink(pageIndex); | 421 float scale = getPageShrink(pageIndex); |
425 transform.scale(scale, scale); | 422 transform.scale(scale, scale); |
426 #endif | 423 #endif |
(...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2191 } | 2188 } |
2192 | 2189 |
2193 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const | 2190 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const |
2194 { | 2191 { |
2195 if (!frame()) | 2192 if (!frame()) |
2196 return WebSandboxFlags::None; | 2193 return WebSandboxFlags::None; |
2197 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); | 2194 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); |
2198 } | 2195 } |
2199 | 2196 |
2200 } // namespace blink | 2197 } // namespace blink |
OLD | NEW |