| OLD | NEW |
| 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" |
| 11 #include "core/layout/LayoutBox.h" | 11 #include "core/layout/LayoutBox.h" |
| 12 #include "core/layout/LayoutBoxModelObject.h" | 12 #include "core/layout/LayoutBoxModelObject.h" |
| 13 #include "core/layout/LayoutObject.h" | 13 #include "core/layout/LayoutObject.h" |
| 14 #include "core/layout/LayoutTable.h" | 14 #include "core/layout/LayoutTable.h" |
| 15 #include "core/layout/LayoutTheme.h" | 15 #include "core/layout/LayoutTheme.h" |
| 16 #include "core/layout/compositing/CompositedLayerMapping.h" | 16 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 17 #include "core/layout/line/RootInlineBox.h" | 17 #include "core/layout/line/RootInlineBox.h" |
| 18 #include "core/style/BorderEdge.h" | 18 #include "core/style/BorderEdge.h" |
| 19 #include "core/style/ShadowList.h" | 19 #include "core/style/ShadowList.h" |
| 20 #include "core/paint/BackgroundImageGeometry.h" | 20 #include "core/paint/BackgroundImageGeometry.h" |
| 21 #include "core/paint/BoxBorderPainter.h" | 21 #include "core/paint/BoxBorderPainter.h" |
| 22 #include "core/paint/BoxDecorationData.h" | 22 #include "core/paint/BoxDecorationData.h" |
| 23 #include "core/paint/LayoutObjectDrawingRecorder.h" | 23 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 24 #include "core/paint/NinePieceImagePainter.h" | 24 #include "core/paint/NinePieceImagePainter.h" |
| 25 #include "core/paint/PaintInfo.h" | 25 #include "core/paint/PaintInfo.h" |
| 26 #include "core/paint/PaintLayer.h" | 26 #include "core/paint/PaintLayer.h" |
| 27 #include "core/paint/RoundedInnerRectClipper.h" | 27 #include "core/paint/RoundedInnerRectClipper.h" |
| 28 #include "core/paint/ScrollRecorder.h" |
| 28 #include "core/paint/ThemePainter.h" | 29 #include "core/paint/ThemePainter.h" |
| 29 #include "platform/LengthFunctions.h" | 30 #include "platform/LengthFunctions.h" |
| 30 #include "platform/geometry/LayoutPoint.h" | 31 #include "platform/geometry/LayoutPoint.h" |
| 31 #include "platform/geometry/LayoutRectOutsets.h" | 32 #include "platform/geometry/LayoutRectOutsets.h" |
| 32 #include "platform/graphics/GraphicsContextStateSaver.h" | 33 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 33 #include "platform/graphics/paint/CompositingDisplayItem.h" | 34 #include "platform/graphics/paint/CompositingDisplayItem.h" |
| 34 #include "wtf/Optional.h" | 35 #include "wtf/Optional.h" |
| 35 | 36 |
| 36 namespace blink { | 37 namespace blink { |
| 37 | 38 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 51 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBox.location(); | 52 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBox.location(); |
| 52 // Default implementation. Just pass paint through to the children. | 53 // Default implementation. Just pass paint through to the children. |
| 53 PaintInfo childInfo(paintInfo); | 54 PaintInfo childInfo(paintInfo); |
| 54 for (LayoutObject* child = m_layoutBox.slowFirstChild(); child; child = chil
d->nextSibling()) | 55 for (LayoutObject* child = m_layoutBox.slowFirstChild(); child; child = chil
d->nextSibling()) |
| 55 child->paint(childInfo, adjustedPaintOffset); | 56 child->paint(childInfo, adjustedPaintOffset); |
| 56 } | 57 } |
| 57 | 58 |
| 58 void BoxPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const
LayoutPoint& paintOffset) | 59 void BoxPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const
LayoutPoint& paintOffset) |
| 59 { | 60 { |
| 60 LayoutRect paintRect; | 61 LayoutRect paintRect; |
| 62 Optional<ScrollRecorder> scrollRecorder; |
| 61 if (isPaintingBackgroundOfPaintContainerIntoScrollingContentsLayer(&m_layout
Box, paintInfo)) { | 63 if (isPaintingBackgroundOfPaintContainerIntoScrollingContentsLayer(&m_layout
Box, paintInfo)) { |
| 62 // For the case where we are painting the background into the scrolling
contents layer | 64 // For the case where we are painting the background into the scrolling
contents layer |
| 63 // of a composited scroller we need to include the entire overflow rect. | 65 // of a composited scroller we need to include the entire overflow rect. |
| 64 paintRect = m_layoutBox.layoutOverflowRect(); | 66 paintRect = m_layoutBox.layoutOverflowRect(); |
| 65 paintRect.move(-m_layoutBox.scrolledContentOffset()); | 67 scrollRecorder.emplace(paintInfo.context, m_layoutBox, paintInfo.phase,
m_layoutBox.scrolledContentOffset()); |
| 66 | 68 |
| 67 // The background painting code assumes that the borders are part of the
paintRect so we | 69 // The background painting code assumes that the borders are part of the
paintRect so we |
| 68 // expand the paintRect by the border size when painting the background
into the | 70 // expand the paintRect by the border size when painting the background
into the |
| 69 // scrolling contents layer. | 71 // scrolling contents layer. |
| 70 paintRect.expandEdges( | 72 paintRect.expandEdges( |
| 71 LayoutUnit(m_layoutBox.borderTop()), | 73 LayoutUnit(m_layoutBox.borderTop()), |
| 72 LayoutUnit(m_layoutBox.borderRight()), | 74 LayoutUnit(m_layoutBox.borderRight()), |
| 73 LayoutUnit(m_layoutBox.borderBottom()), | 75 LayoutUnit(m_layoutBox.borderBottom()), |
| 74 LayoutUnit(m_layoutBox.borderLeft())); | 76 LayoutUnit(m_layoutBox.borderLeft())); |
| 75 } else { | 77 } else { |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 } | 869 } |
| 868 } | 870 } |
| 869 | 871 |
| 870 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle&
style, const Document& document) | 872 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle&
style, const Document& document) |
| 871 { | 873 { |
| 872 return document.printing() && style.getPrintColorAdjust() == PrintColorAdjus
tEconomy | 874 return document.printing() && style.getPrintColorAdjust() == PrintColorAdjus
tEconomy |
| 873 && (!document.settings() || !document.settings()->shouldPrintBackgrounds
()); | 875 && (!document.settings() || !document.settings()->shouldPrintBackgrounds
()); |
| 874 } | 876 } |
| 875 | 877 |
| 876 } // namespace blink | 878 } // namespace blink |
| OLD | NEW |