| 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 // made virtual so that they can be overridden by ChromePluginPrintContext. | 329 // made virtual so that they can be overridden by ChromePluginPrintContext. |
| 330 class ChromePrintContext : public PrintContext { | 330 class ChromePrintContext : public PrintContext { |
| 331 WTF_MAKE_NONCOPYABLE(ChromePrintContext); | 331 WTF_MAKE_NONCOPYABLE(ChromePrintContext); |
| 332 public: | 332 public: |
| 333 ChromePrintContext(LocalFrame* frame) | 333 ChromePrintContext(LocalFrame* frame) |
| 334 : PrintContext(frame) | 334 : PrintContext(frame) |
| 335 , m_printedPageWidth(0) | 335 , m_printedPageWidth(0) |
| 336 { | 336 { |
| 337 } | 337 } |
| 338 | 338 |
| 339 virtual ~ChromePrintContext() { } | 339 ~ChromePrintContext() override {} |
| 340 | 340 |
| 341 virtual void begin(float width, float height) | 341 virtual void begin(float width, float height) |
| 342 { | 342 { |
| 343 ASSERT(!m_printedPageWidth); | 343 ASSERT(!m_printedPageWidth); |
| 344 m_printedPageWidth = width; | 344 m_printedPageWidth = width; |
| 345 PrintContext::begin(m_printedPageWidth, height); | 345 PrintContext::begin(m_printedPageWidth, height); |
| 346 } | 346 } |
| 347 | 347 |
| 348 virtual float getPageShrink(int pageNumber) const | 348 virtual float getPageShrink(int pageNumber) const |
| 349 { | 349 { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 // Simple class to override some of PrintContext behavior. This is used when | 479 // Simple class to override some of PrintContext behavior. This is used when |
| 480 // the frame hosts a plugin that supports custom printing. In this case, we | 480 // the frame hosts a plugin that supports custom printing. In this case, we |
| 481 // want to delegate all printing related calls to the plugin. | 481 // want to delegate all printing related calls to the plugin. |
| 482 class ChromePluginPrintContext final : public ChromePrintContext { | 482 class ChromePluginPrintContext final : public ChromePrintContext { |
| 483 public: | 483 public: |
| 484 ChromePluginPrintContext(LocalFrame* frame, WebPluginContainerImpl* plugin,
const WebPrintParams& printParams) | 484 ChromePluginPrintContext(LocalFrame* frame, WebPluginContainerImpl* plugin,
const WebPrintParams& printParams) |
| 485 : ChromePrintContext(frame), m_plugin(plugin), m_printParams(printParams
) | 485 : ChromePrintContext(frame), m_plugin(plugin), m_printParams(printParams
) |
| 486 { | 486 { |
| 487 } | 487 } |
| 488 | 488 |
| 489 virtual ~ChromePluginPrintContext() { } | 489 ~ChromePluginPrintContext() override {} |
| 490 | 490 |
| 491 virtual void begin(float width, float height) override | 491 void begin(float width, float height) override |
| 492 { | 492 { |
| 493 } | 493 } |
| 494 | 494 |
| 495 virtual void end() override | 495 void end() override |
| 496 { | 496 { |
| 497 m_plugin->printEnd(); | 497 m_plugin->printEnd(); |
| 498 } | 498 } |
| 499 | 499 |
| 500 virtual float getPageShrink(int pageNumber) const override | 500 float getPageShrink(int pageNumber) const override |
| 501 { | 501 { |
| 502 // We don't shrink the page (maybe we should ask the widget ??) | 502 // We don't shrink the page (maybe we should ask the widget ??) |
| 503 return 1.0; | 503 return 1.0; |
| 504 } | 504 } |
| 505 | 505 |
| 506 virtual void computePageRects(const FloatRect& printRect, float headerHeight
, float footerHeight, float userScaleFactor, float& outPageHeight) override | 506 void computePageRects(const FloatRect& printRect, float headerHeight, float
footerHeight, float userScaleFactor, float& outPageHeight) override |
| 507 { | 507 { |
| 508 m_printParams.printContentArea = IntRect(printRect); | 508 m_printParams.printContentArea = IntRect(printRect); |
| 509 m_pageRects.fill(IntRect(printRect), m_plugin->printBegin(m_printParams)
); | 509 m_pageRects.fill(IntRect(printRect), m_plugin->printBegin(m_printParams)
); |
| 510 } | 510 } |
| 511 | 511 |
| 512 virtual void computePageRectsWithPageSize(const FloatSize& pageSizeInPixels)
override | 512 void computePageRectsWithPageSize(const FloatSize& pageSizeInPixels) overrid
e |
| 513 { | 513 { |
| 514 ASSERT_NOT_REACHED(); | 514 ASSERT_NOT_REACHED(); |
| 515 } | 515 } |
| 516 | 516 |
| 517 protected: | 517 protected: |
| 518 // Spools the printed page, a subrect of frame(). Skip the scale step. | 518 // Spools the printed page, a subrect of frame(). Skip the scale step. |
| 519 // NativeTheme doesn't play well with scaling. Scaling is done browser side | 519 // NativeTheme doesn't play well with scaling. Scaling is done browser side |
| 520 // instead. Returns the scale to be applied. | 520 // instead. Returns the scale to be applied. |
| 521 virtual float spoolPage(GraphicsContext& context, int pageNumber) override | 521 float spoolPage(GraphicsContext& context, int pageNumber) override |
| 522 { | 522 { |
| 523 IntRect pageRect = m_pageRects[pageNumber]; | 523 IntRect pageRect = m_pageRects[pageNumber]; |
| 524 m_plugin->printPage(pageNumber, &context, pageRect); | 524 m_plugin->printPage(pageNumber, &context, pageRect); |
| 525 | 525 |
| 526 return 1.0; | 526 return 1.0; |
| 527 } | 527 } |
| 528 | 528 |
| 529 private: | 529 private: |
| 530 // Set when printing. | 530 // Set when printing. |
| 531 WebPluginContainerImpl* m_plugin; | 531 WebPluginContainerImpl* m_plugin; |
| (...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2193 } | 2193 } |
| 2194 | 2194 |
| 2195 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const | 2195 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const |
| 2196 { | 2196 { |
| 2197 if (!frame()) | 2197 if (!frame()) |
| 2198 return WebSandboxFlags::None; | 2198 return WebSandboxFlags::None; |
| 2199 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); | 2199 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); |
| 2200 } | 2200 } |
| 2201 | 2201 |
| 2202 } // namespace blink | 2202 } // namespace blink |
| OLD | NEW |