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

Side by Side Diff: third_party/WebKit/Source/core/paint/BoxPainter.cpp

Issue 1610063002: Revert of Remove PaintInfo's paintingRoot (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/BoxPainter.h" 5 #include "core/paint/BoxPainter.h"
6 6
7 #include "core/HTMLNames.h" 7 #include "core/HTMLNames.h"
8 #include "core/frame/Settings.h" 8 #include "core/frame/Settings.h"
9 #include "core/html/HTMLFrameOwnerElement.h" 9 #include "core/html/HTMLFrameOwnerElement.h"
10 #include "core/layout/ImageQualityController.h" 10 #include "core/layout/ImageQualityController.h"
(...skipping 20 matching lines...) Expand all
31 #include "platform/geometry/LayoutRectOutsets.h" 31 #include "platform/geometry/LayoutRectOutsets.h"
32 #include "platform/graphics/GraphicsContextStateSaver.h" 32 #include "platform/graphics/GraphicsContextStateSaver.h"
33 #include "platform/graphics/paint/CompositingDisplayItem.h" 33 #include "platform/graphics/paint/CompositingDisplayItem.h"
34 #include "wtf/Optional.h" 34 #include "wtf/Optional.h"
35 35
36 namespace blink { 36 namespace blink {
37 37
38 void BoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffse t) 38 void BoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffse t)
39 { 39 {
40 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBox.location(); 40 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBox.location();
41 // Default implementation. Just pass paint through to the children. 41 // default implementation. Just pass paint through to the children
42 PaintInfo childInfo(paintInfo); 42 PaintInfo childInfo(paintInfo);
43 childInfo.updatePaintingRootForChildren(&m_layoutBox);
43 for (LayoutObject* child = m_layoutBox.slowFirstChild(); child; child = chil d->nextSibling()) 44 for (LayoutObject* child = m_layoutBox.slowFirstChild(); child; child = chil d->nextSibling())
44 child->paint(childInfo, adjustedPaintOffset); 45 child->paint(childInfo, adjustedPaintOffset);
45 } 46 }
46 47
47 void BoxPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) 48 void BoxPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
48 { 49 {
50 if (!paintInfo.shouldPaintWithinRoot(&m_layoutBox))
51 return;
52
49 LayoutRect paintRect = m_layoutBox.borderBoxRect(); 53 LayoutRect paintRect = m_layoutBox.borderBoxRect();
50 paintRect.moveBy(paintOffset); 54 paintRect.moveBy(paintOffset);
51 paintBoxDecorationBackgroundWithRect(paintInfo, paintOffset, paintRect); 55 paintBoxDecorationBackgroundWithRect(paintInfo, paintOffset, paintRect);
52 } 56 }
53 57
54 LayoutRect BoxPainter::boundsForDrawingRecorder(const LayoutPoint& paintOffset) 58 LayoutRect BoxPainter::boundsForDrawingRecorder(const LayoutPoint& paintOffset)
55 { 59 {
56 // Use the visual overflow rect here, because it will include overflow intro duced by the theme. 60 // Use the visual overflow rect here, because it will include overflow intro duced by the theme.
57 LayoutRect bounds = m_layoutBox.visualOverflowRect(); 61 LayoutRect bounds = m_layoutBox.visualOverflowRect();
58 bounds.moveBy(paintOffset); 62 bounds.moveBy(paintOffset);
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 obj.paint(info, scrolledPaintRect.location() - localOffset); 483 obj.paint(info, scrolledPaintRect.location() - localOffset);
480 } 484 }
481 485
482 context.endLayer(); 486 context.endLayer();
483 context.endLayer(); 487 context.endLayer();
484 } 488 }
485 } 489 }
486 490
487 void BoxPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoint& paintO ffset) 491 void BoxPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoint& paintO ffset)
488 { 492 {
489 if (m_layoutBox.style()->visibility() != VISIBLE || paintInfo.phase != Paint PhaseMask) 493 if (!paintInfo.shouldPaintWithinRoot(&m_layoutBox) || m_layoutBox.style()->v isibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
490 return; 494 return;
491 495
492 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutBox, paintInfo.phase, paintOffset)) 496 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutBox, paintInfo.phase, paintOffset))
493 return; 497 return;
494 498
495 LayoutRect visualOverflowRect(m_layoutBox.visualOverflowRect()); 499 LayoutRect visualOverflowRect(m_layoutBox.visualOverflowRect());
496 visualOverflowRect.moveBy(paintOffset); 500 visualOverflowRect.moveBy(paintOffset);
497 501
498 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutBox, paintIn fo.phase, visualOverflowRect, paintOffset); 502 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutBox, paintIn fo.phase, visualOverflowRect, paintOffset);
499 LayoutRect paintRect = LayoutRect(paintOffset, m_layoutBox.size()); 503 LayoutRect paintRect = LayoutRect(paintOffset, m_layoutBox.size());
(...skipping 29 matching lines...) Expand all
529 } 533 }
530 534
531 if (pushTransparencyLayer) 535 if (pushTransparencyLayer)
532 paintInfo.context.endLayer(); 536 paintInfo.context.endLayer();
533 } 537 }
534 538
535 void BoxPainter::paintClippingMask(const PaintInfo& paintInfo, const LayoutPoint & paintOffset) 539 void BoxPainter::paintClippingMask(const PaintInfo& paintInfo, const LayoutPoint & paintOffset)
536 { 540 {
537 ASSERT(paintInfo.phase == PaintPhaseClippingMask); 541 ASSERT(paintInfo.phase == PaintPhaseClippingMask);
538 542
539 if (m_layoutBox.style()->visibility() != VISIBLE) 543 if (!paintInfo.shouldPaintWithinRoot(&m_layoutBox) || m_layoutBox.style()->v isibility() != VISIBLE)
540 return; 544 return;
541 545
542 if (!m_layoutBox.layer() || m_layoutBox.layer()->compositingState() != Paint sIntoOwnBacking) 546 if (!m_layoutBox.layer() || m_layoutBox.layer()->compositingState() != Paint sIntoOwnBacking)
543 return; 547 return;
544 548
545 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutBox, paintInfo.phase, paintOffset)) 549 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutBox, paintInfo.phase, paintOffset))
546 return; 550 return;
547 551
548 IntRect paintRect = pixelSnappedIntRect(LayoutRect(paintOffset, m_layoutBox. size())); 552 IntRect paintRect = pixelSnappedIntRect(LayoutRect(paintOffset, m_layoutBox. size()));
549 LayoutObjectDrawingRecorder drawingRecorder(paintInfo.context, m_layoutBox, paintInfo.phase, paintRect, paintOffset); 553 LayoutObjectDrawingRecorder drawingRecorder(paintInfo.context, m_layoutBox, paintInfo.phase, paintRect, paintOffset);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 } 695 }
692 } 696 }
693 697
694 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle& style, const Document& document) 698 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle& style, const Document& document)
695 { 699 {
696 return document.printing() && style.printColorAdjust() == PrintColorAdjustEc onomy 700 return document.printing() && style.printColorAdjust() == PrintColorAdjustEc onomy
697 && (!document.settings() || !document.settings()->shouldPrintBackgrounds ()); 701 && (!document.settings() || !document.settings()->shouldPrintBackgrounds ());
698 } 702 }
699 703
700 } // namespace blink 704 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/BlockPainter.cpp ('k') | third_party/WebKit/Source/core/paint/FieldsetPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698