Chromium Code Reviews| 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" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 } // anonymous namespace | 99 } // anonymous namespace |
| 100 | 100 |
| 101 void BoxPainter::paintBoxDecorationBackgroundWithRect(const PaintInfo& paintInfo , const LayoutPoint& paintOffset, const LayoutRect& paintRect) | 101 void BoxPainter::paintBoxDecorationBackgroundWithRect(const PaintInfo& paintInfo , const LayoutPoint& paintOffset, const LayoutRect& paintRect) |
| 102 { | 102 { |
| 103 bool paintingOverflowContents = isPaintingBackgroundOfPaintContainerIntoScro llingContentsLayer(&m_layoutBox, paintInfo); | 103 bool paintingOverflowContents = isPaintingBackgroundOfPaintContainerIntoScro llingContentsLayer(&m_layoutBox, paintInfo); |
| 104 const ComputedStyle& style = m_layoutBox.styleRef(); | 104 const ComputedStyle& style = m_layoutBox.styleRef(); |
| 105 | 105 |
| 106 // FIXME: For now we don't have notification on media buffered range change from media player | 106 // FIXME: For now we don't have notification on media buffered range change from media player |
| 107 // and miss paint invalidation on buffered range change. crbug.com/484288. | 107 // and miss paint invalidation on buffered range change. crbug.com/484288. |
| 108 Optional<DisplayItemCacheSkipper> cacheSkipper; | 108 Optional<DisplayItemCacheSkipper> cacheSkipper; |
| 109 if (style.appearance() == MediaSliderPart) | 109 if (style.appearance() == MediaSliderPart |
| 110 // We may paint a delayed-invalidation object before it's actually inval idated. Note this would be handled for | |
|
chrishtr
2016/08/22 17:34:54
Really? Which test failed without line 113?
wkorman
2016/08/22 17:42:27
paint/invalidation/animated-gif-background-offscre
chrishtr
2016/08/22 17:46:33
ok.
| |
| 111 // us by LayoutObjectDrawingRecorder but we have to use DrawingRecorder as we may use the scrolling contents | |
| 112 // layer as DisplayItemClient below. | |
| 113 || m_layoutBox.fullPaintInvalidationReason() == PaintInvalidationDelayed Full) { | |
| 110 cacheSkipper.emplace(paintInfo.context); | 114 cacheSkipper.emplace(paintInfo.context); |
| 115 } | |
| 111 | 116 |
| 112 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutBox, DisplayItem::BoxDecorationBackground)) | 117 const DisplayItemClient& displayItemClient = paintingOverflowContents ? stat ic_cast<const DisplayItemClient&>(*m_layoutBox.layer()->compositedLayerMapping() ->scrollingContentsLayer()) : m_layoutBox; |
| 118 if (DrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, displayIt emClient, DisplayItem::BoxDecorationBackground)) | |
| 113 return; | 119 return; |
| 114 | 120 |
| 115 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutBox, Display Item::BoxDecorationBackground, boundsForDrawingRecorder(paintInfo, paintOffset)) ; | 121 DrawingRecorder recorder(paintInfo.context, displayItemClient, DisplayItem:: BoxDecorationBackground, FloatRect(boundsForDrawingRecorder(paintInfo, paintOffs et))); |
| 116 | |
| 117 BoxDecorationData boxDecorationData(m_layoutBox); | 122 BoxDecorationData boxDecorationData(m_layoutBox); |
| 118 GraphicsContextStateSaver stateSaver(paintInfo.context, false); | 123 GraphicsContextStateSaver stateSaver(paintInfo.context, false); |
| 119 | 124 |
| 120 if (!paintingOverflowContents) { | 125 if (!paintingOverflowContents) { |
| 121 // FIXME: Should eventually give the theme control over whether the box shadow should paint, since controls could have | 126 // FIXME: Should eventually give the theme control over whether the box shadow should paint, since controls could have |
| 122 // custom shadows of their own. | 127 // custom shadows of their own. |
| 123 if (!m_layoutBox.boxShadowShouldBeAppliedToBackground(boxDecorationData. bleedAvoidance)) { | 128 if (!m_layoutBox.boxShadowShouldBeAppliedToBackground(boxDecorationData. bleedAvoidance)) { |
| 124 paintBoxShadow(paintInfo, paintRect, style, Normal); | 129 paintBoxShadow(paintInfo, paintRect, style, Normal); |
| 125 } | 130 } |
| 126 | 131 |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 862 } | 867 } |
| 863 } | 868 } |
| 864 | 869 |
| 865 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle& style, const Document& document) | 870 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle& style, const Document& document) |
| 866 { | 871 { |
| 867 return document.printing() && style.getPrintColorAdjust() == PrintColorAdjus tEconomy | 872 return document.printing() && style.getPrintColorAdjust() == PrintColorAdjus tEconomy |
| 868 && (!document.settings() || !document.settings()->shouldPrintBackgrounds ()); | 873 && (!document.settings() || !document.settings()->shouldPrintBackgrounds ()); |
| 869 } | 874 } |
| 870 | 875 |
| 871 } // namespace blink | 876 } // namespace blink |
| OLD | NEW |