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 28 matching lines...) Expand all Loading... | |
| 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 for (LayoutObject* child = m_layoutBox.slowFirstChild(); child; child = chil d->nextSibling()) | 43 for (LayoutObject* child = m_layoutBox.slowFirstChild(); child; child = chil d->nextSibling()) |
| 44 child->paint(childInfo, adjustedPaintOffset); | 44 child->paint(childInfo, adjustedPaintOffset); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void BoxPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) | 47 void BoxPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
| 48 { | 48 { |
| 49 LayoutRect paintRect = m_layoutBox.borderBoxRect(); | 49 LayoutRect paintRect; |
| 50 if ((paintInfo.paintFlags() & PaintLayerPaintingCompositingBackgroundPhase) | |
| 51 || !m_layoutBox.scrollsOverflow()) { | |
| 52 paintRect = m_layoutBox.borderBoxRect(); | |
| 53 } else { | |
| 54 // Need to include overflow when drawing into the scrolling contents lay er. | |
| 55 paintRect = m_layoutBox.layoutOverflowRect(); | |
| 56 paintRect.move(-m_layoutBox.scrolledContentOffset()); | |
| 57 } | |
| 58 | |
| 50 paintRect.moveBy(paintOffset); | 59 paintRect.moveBy(paintOffset); |
| 51 paintBoxDecorationBackgroundWithRect(paintInfo, paintOffset, paintRect); | 60 paintBoxDecorationBackgroundWithRect(paintInfo, paintOffset, paintRect); |
| 52 } | 61 } |
| 53 | 62 |
| 54 LayoutRect BoxPainter::boundsForDrawingRecorder(const LayoutPoint& adjustedPaint Offset) | 63 LayoutRect BoxPainter::boundsForDrawingRecorder(const PaintInfo& paintInfo, cons t LayoutPoint& adjustedPaintOffset) |
| 55 { | 64 { |
| 56 LayoutRect bounds = m_layoutBox.selfVisualOverflowRect(); | 65 LayoutRect bounds = paintInfo.paintFlags() & PaintLayerPaintingCompositingBa ckgroundPhase |
| 66 ? m_layoutBox.selfVisualOverflowRect() | |
| 67 : m_layoutBox.layoutOverflowRect(); | |
| 57 bounds.moveBy(adjustedPaintOffset); | 68 bounds.moveBy(adjustedPaintOffset); |
| 58 return bounds; | 69 return bounds; |
| 59 } | 70 } |
| 60 | 71 |
| 61 namespace { | 72 namespace { |
| 62 | 73 |
| 63 bool bleedAvoidanceIsClipping(BackgroundBleedAvoidance bleedAvoidance) | 74 bool bleedAvoidanceIsClipping(BackgroundBleedAvoidance bleedAvoidance) |
| 64 { | 75 { |
| 65 return bleedAvoidance == BackgroundBleedClipOnly || bleedAvoidance == Backgr oundBleedClipLayer; | 76 return bleedAvoidance == BackgroundBleedClipOnly || bleedAvoidance == Backgr oundBleedClipLayer; |
| 66 } | 77 } |
| 67 | 78 |
| 68 } // anonymous namespace | 79 } // anonymous namespace |
| 69 | 80 |
| 70 void BoxPainter::paintBoxDecorationBackgroundWithRect(const PaintInfo& paintInfo , const LayoutPoint& paintOffset, const LayoutRect& paintRect) | 81 void BoxPainter::paintBoxDecorationBackgroundWithRect(const PaintInfo& paintInfo , const LayoutPoint& paintOffset, const LayoutRect& paintRect) |
| 71 { | 82 { |
| 83 bool paintBackgroundOnly = !(paintInfo.paintFlags() & PaintLayerPaintingComp ositingBackgroundPhase) | |
| 84 && (paintInfo.paintFlags() & PaintLayerPaintingBackgroundOntoForeground) ; | |
| 72 const ComputedStyle& style = m_layoutBox.styleRef(); | 85 const ComputedStyle& style = m_layoutBox.styleRef(); |
| 73 | 86 |
| 74 // FIXME: For now we don't have notification on media buffered range change from media player | 87 // FIXME: For now we don't have notification on media buffered range change from media player |
| 75 // and miss paint invalidation on buffered range change. crbug.com/484288. | 88 // and miss paint invalidation on buffered range change. crbug.com/484288. |
| 76 Optional<DisplayItemCacheSkipper> cacheSkipper; | 89 Optional<DisplayItemCacheSkipper> cacheSkipper; |
| 77 if (style.appearance() == MediaSliderPart) | 90 if (style.appearance() == MediaSliderPart) |
| 78 cacheSkipper.emplace(paintInfo.context); | 91 cacheSkipper.emplace(paintInfo.context); |
| 79 | 92 |
| 80 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutBox, DisplayItem::BoxDecorationBackground)) | 93 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutBox, DisplayItem::BoxDecorationBackground)) |
| 81 return; | 94 return; |
| 82 | 95 |
| 83 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutBox, Display Item::BoxDecorationBackground, boundsForDrawingRecorder(paintOffset)); | 96 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutBox, Display Item::BoxDecorationBackground, boundsForDrawingRecorder(paintInfo, paintOffset)) ; |
| 84 | 97 |
| 85 BoxDecorationData boxDecorationData(m_layoutBox); | 98 BoxDecorationData boxDecorationData(m_layoutBox); |
| 86 | 99 |
| 87 // FIXME: Should eventually give the theme control over whether the box shad ow should paint, since controls could have | 100 // FIXME: Should eventually give the theme control over whether the box shad ow should paint, since controls could have |
| 88 // custom shadows of their own. | 101 // custom shadows of their own. |
| 89 if (!m_layoutBox.boxShadowShouldBeAppliedToBackground(boxDecorationData.blee dAvoidance)) | 102 if (!paintBackgroundOnly |
|
Stephen Chennney
2016/07/27 22:33:36
You can have 1 if and put both of the remaining bl
flackr
2016/07/28 14:39:20
Done.
| |
| 103 && !m_layoutBox.boxShadowShouldBeAppliedToBackground(boxDecorationData.b leedAvoidance)) { | |
| 90 paintBoxShadow(paintInfo, paintRect, style, Normal); | 104 paintBoxShadow(paintInfo, paintRect, style, Normal); |
| 105 } | |
| 91 | 106 |
| 92 GraphicsContextStateSaver stateSaver(paintInfo.context, false); | 107 GraphicsContextStateSaver stateSaver(paintInfo.context, false); |
| 93 if (bleedAvoidanceIsClipping(boxDecorationData.bleedAvoidance)) { | 108 if (!paintBackgroundOnly |
|
Stephen Chennney
2016/07/27 22:33:36
i.e unify this if with the one above.
flackr
2016/07/28 14:39:20
Done.
| |
| 109 && bleedAvoidanceIsClipping(boxDecorationData.bleedAvoidance)) { | |
| 94 stateSaver.save(); | 110 stateSaver.save(); |
| 95 FloatRoundedRect border = style.getRoundedBorderFor(paintRect); | 111 FloatRoundedRect border = style.getRoundedBorderFor(paintRect); |
| 96 paintInfo.context.clipRoundedRect(border); | 112 paintInfo.context.clipRoundedRect(border); |
| 97 | 113 |
| 98 if (boxDecorationData.bleedAvoidance == BackgroundBleedClipLayer) | 114 if (boxDecorationData.bleedAvoidance == BackgroundBleedClipLayer) |
| 99 paintInfo.context.beginLayer(); | 115 paintInfo.context.beginLayer(); |
| 100 } | 116 } |
| 101 | 117 |
| 102 // If we have a native theme appearance, paint that before painting our back ground. | 118 // If we have a native theme appearance, paint that before painting our back ground. |
| 103 // The theme will tell us whether or not we should also paint the CSS backgr ound. | 119 // The theme will tell us whether or not we should also paint the CSS backgr ound. |
| 104 IntRect snappedPaintRect(pixelSnappedIntRect(paintRect)); | 120 IntRect snappedPaintRect(pixelSnappedIntRect(paintRect)); |
| 105 ThemePainter& themePainter = LayoutTheme::theme().painter(); | 121 ThemePainter& themePainter = LayoutTheme::theme().painter(); |
| 106 bool themePainted = boxDecorationData.hasAppearance && !themePainter.paint(m _layoutBox, paintInfo, snappedPaintRect); | 122 bool themePainted = boxDecorationData.hasAppearance && !themePainter.paint(m _layoutBox, paintInfo, snappedPaintRect); |
| 107 if (!themePainted) { | 123 bool shouldPaintBackground = !themePainted |
| 124 && (paintInfo.paintFlags() & PaintLayerPaintingCompositingForegroundPhas e | |
| 125 || !(paintInfo.paintFlags() & PaintLayerPaintingBackgroundOntoForegr ound)); | |
| 126 if (shouldPaintBackground) { | |
| 108 paintBackground(paintInfo, paintRect, boxDecorationData.backgroundColor, boxDecorationData.bleedAvoidance); | 127 paintBackground(paintInfo, paintRect, boxDecorationData.backgroundColor, boxDecorationData.bleedAvoidance); |
| 109 | 128 |
| 110 if (boxDecorationData.hasAppearance) | 129 if (boxDecorationData.hasAppearance) |
| 111 themePainter.paintDecorations(m_layoutBox, paintInfo, snappedPaintRe ct); | 130 themePainter.paintDecorations(m_layoutBox, paintInfo, snappedPaintRe ct); |
| 112 } | 131 } |
| 113 paintBoxShadow(paintInfo, paintRect, style, Inset); | 132 |
| 133 if (!paintBackgroundOnly) | |
|
Stephen Chennney
2016/07/27 22:33:36
And here too.
flackr
2016/07/28 14:39:20
Done.
| |
| 134 paintBoxShadow(paintInfo, paintRect, style, Inset); | |
| 114 | 135 |
| 115 // The theme will tell us whether or not we should also paint the CSS border . | 136 // The theme will tell us whether or not we should also paint the CSS border . |
| 116 if (boxDecorationData.hasBorderDecoration | 137 if (!paintBackgroundOnly |
| 138 && boxDecorationData.hasBorderDecoration | |
| 117 && (!boxDecorationData.hasAppearance || (!themePainted && LayoutTheme::t heme().painter().paintBorderOnly(m_layoutBox, paintInfo, snappedPaintRect))) | 139 && (!boxDecorationData.hasAppearance || (!themePainted && LayoutTheme::t heme().painter().paintBorderOnly(m_layoutBox, paintInfo, snappedPaintRect))) |
| 118 && !(m_layoutBox.isTable() && toLayoutTable(&m_layoutBox)->collapseBorde rs())) | 140 && !(m_layoutBox.isTable() && toLayoutTable(&m_layoutBox)->collapseBorde rs())) { |
| 119 paintBorder(m_layoutBox, paintInfo, paintRect, style, boxDecorationData. bleedAvoidance); | 141 paintBorder(m_layoutBox, paintInfo, paintRect, style, boxDecorationData. bleedAvoidance); |
| 142 } | |
| 120 | 143 |
| 121 if (boxDecorationData.bleedAvoidance == BackgroundBleedClipLayer) | 144 if (boxDecorationData.bleedAvoidance == BackgroundBleedClipLayer) |
| 122 paintInfo.context.endLayer(); | 145 paintInfo.context.endLayer(); |
| 123 } | 146 } |
| 124 | 147 |
| 125 void BoxPainter::paintBackground(const PaintInfo& paintInfo, const LayoutRect& p aintRect, const Color& backgroundColor, BackgroundBleedAvoidance bleedAvoidance) | 148 void BoxPainter::paintBackground(const PaintInfo& paintInfo, const LayoutRect& p aintRect, const Color& backgroundColor, BackgroundBleedAvoidance bleedAvoidance) |
| 126 { | 149 { |
| 127 if (m_layoutBox.isDocumentElement()) | 150 if (m_layoutBox.isDocumentElement()) |
| 128 return; | 151 return; |
| 129 if (m_layoutBox.backgroundStolenForBeingBody()) | 152 if (m_layoutBox.backgroundStolenForBeingBody()) |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 470 | 493 |
| 471 const FillLayerInfo info(obj, color, bgLayer, bleedAvoidance, box); | 494 const FillLayerInfo info(obj, color, bgLayer, bleedAvoidance, box); |
| 472 Optional<BackgroundImageGeometry> geometry; | 495 Optional<BackgroundImageGeometry> geometry; |
| 473 | 496 |
| 474 // Fast path for drawing simple color backgrounds. | 497 // Fast path for drawing simple color backgrounds. |
| 475 if (paintFastBottomLayer(obj, paintInfo, info, bgLayer, rect, bleedAvoidance , box, boxSize, op, | 498 if (paintFastBottomLayer(obj, paintInfo, info, bgLayer, rect, bleedAvoidance , box, boxSize, op, |
| 476 backgroundObject, geometry)) { | 499 backgroundObject, geometry)) { |
| 477 return; | 500 return; |
| 478 } | 501 } |
| 479 | 502 |
| 503 bool avoidBorder = paintInfo.paintFlags() & PaintLayerPaintingCompositingBac kgroundPhase; | |
| 480 Optional<RoundedInnerRectClipper> clipToBorder; | 504 Optional<RoundedInnerRectClipper> clipToBorder; |
| 481 if (info.isRoundedFill) { | 505 if (info.isRoundedFill) { |
| 482 FloatRoundedRect border = info.isBorderFill | 506 FloatRoundedRect border = info.isBorderFill |
| 483 ? backgroundRoundedRectAdjustedForBleedAvoidance(obj, rect, bleedAvo idance, box, boxSize, info.includeLeftEdge, info.includeRightEdge) | 507 ? backgroundRoundedRectAdjustedForBleedAvoidance(obj, rect, bleedAvo idance, box, boxSize, info.includeLeftEdge, info.includeRightEdge) |
| 484 : getBackgroundRoundedRect(obj, rect, box, boxSize.width(), boxSize. height(), info.includeLeftEdge, info.includeRightEdge); | 508 : getBackgroundRoundedRect(obj, rect, box, boxSize.width(), boxSize. height(), info.includeLeftEdge, info.includeRightEdge); |
| 485 | 509 |
| 486 // Clip to the padding or content boxes as necessary. | 510 // Clip to the padding or content boxes as necessary. |
| 487 if (bgLayer.clip() == ContentFillBox) { | 511 if (bgLayer.clip() == ContentFillBox) { |
| 488 border = obj.style()->getRoundedInnerBorderFor(LayoutRect(border.rec t()), | 512 border = obj.style()->getRoundedInnerBorderFor(LayoutRect(border.rec t()), |
| 489 LayoutRectOutsets( | 513 LayoutRectOutsets( |
| 490 -(obj.paddingTop() + obj.borderTop()), | 514 -(obj.paddingTop() + (avoidBorder ? obj.borderTop() : 0)), |
| 491 -(obj.paddingRight() + obj.borderRight()), | 515 -(obj.paddingRight() + (avoidBorder ? obj.borderRight() : 0) ), |
| 492 -(obj.paddingBottom() + obj.borderBottom()), | 516 -(obj.paddingBottom() + (avoidBorder ? obj.borderBottom() : 0)), |
| 493 -(obj.paddingLeft() + obj.borderLeft())), | 517 -(obj.paddingLeft() + (avoidBorder ? obj.borderLeft() : 0))) , |
| 494 info.includeLeftEdge, info.includeRightEdge); | 518 info.includeLeftEdge, info.includeRightEdge); |
| 495 } else if (bgLayer.clip() == PaddingFillBox) { | 519 } else if (bgLayer.clip() == PaddingFillBox) { |
| 496 border = obj.style()->getRoundedInnerBorderFor(LayoutRect(border.rec t()), info.includeLeftEdge, info.includeRightEdge); | 520 border = obj.style()->getRoundedInnerBorderFor(LayoutRect(border.rec t()), info.includeLeftEdge, info.includeRightEdge); |
| 497 } | 521 } |
| 498 | 522 |
| 499 clipToBorder.emplace(obj, paintInfo, rect, border, ApplyToContext); | 523 clipToBorder.emplace(obj, paintInfo, rect, border, ApplyToContext); |
| 500 } | 524 } |
| 501 | 525 |
| 502 int bLeft = info.includeLeftEdge ? obj.borderLeft() : 0; | 526 int bLeft = info.includeLeftEdge && avoidBorder ? obj.borderLeft() : 0; |
| 503 int bRight = info.includeRightEdge ? obj.borderRight() : 0; | 527 int bRight = info.includeRightEdge && avoidBorder ? obj.borderRight() : 0; |
| 504 LayoutUnit pLeft = info.includeLeftEdge ? obj.paddingLeft() : LayoutUnit(); | 528 LayoutUnit pLeft = info.includeLeftEdge ? obj.paddingLeft() : LayoutUnit(); |
| 505 LayoutUnit pRight = info.includeRightEdge ? obj.paddingRight() : LayoutUnit( ); | 529 LayoutUnit pRight = info.includeRightEdge ? obj.paddingRight() : LayoutUnit( ); |
| 506 | 530 |
| 507 GraphicsContextStateSaver clipWithScrollingStateSaver(context, info.isClippe dWithLocalScrolling); | 531 GraphicsContextStateSaver clipWithScrollingStateSaver(context, info.isClippe dWithLocalScrolling); |
| 508 LayoutRect scrolledPaintRect = rect; | 532 LayoutRect scrolledPaintRect = rect; |
| 509 if (info.isClippedWithLocalScrolling) { | 533 if (info.isClippedWithLocalScrolling && paintInfo.paintFlags() & PaintLayerP aintingCompositingBackgroundPhase) { |
| 510 // Clip to the overflow area. | 534 // Clip to the overflow area. |
| 511 const LayoutBox& thisBox = toLayoutBox(obj); | 535 const LayoutBox& thisBox = toLayoutBox(obj); |
| 512 // TODO(chrishtr): this should be pixel-snapped. | 536 // TODO(chrishtr): this should be pixel-snapped. |
| 513 context.clip(FloatRect(thisBox.overflowClipRect(rect.location()))); | 537 context.clip(FloatRect(thisBox.overflowClipRect(rect.location()))); |
| 514 | 538 |
| 515 // Adjust the paint rect to reflect a scrolled content box with borders at the ends. | 539 // Adjust the paint rect to reflect a scrolled content box with borders at the ends. |
| 516 IntSize offset = thisBox.scrolledContentOffset(); | 540 IntSize offset = thisBox.scrolledContentOffset(); |
| 517 scrolledPaintRect.move(-offset); | 541 scrolledPaintRect.move(-offset); |
| 518 scrolledPaintRect.setWidth(bLeft + thisBox.scrollWidth() + bRight); | 542 scrolledPaintRect.setWidth(bLeft + thisBox.scrollWidth() + bRight); |
| 519 scrolledPaintRect.setHeight(thisBox.borderTop() + thisBox.scrollHeight() + thisBox.borderBottom()); | 543 scrolledPaintRect.setHeight((avoidBorder ? thisBox.borderTop() : 0) + th isBox.scrollHeight() + (avoidBorder ? thisBox.borderBottom() : 0)); |
| 520 } | 544 } |
| 521 | 545 |
| 522 GraphicsContextStateSaver backgroundClipStateSaver(context, false); | 546 GraphicsContextStateSaver backgroundClipStateSaver(context, false); |
| 523 IntRect maskRect; | 547 IntRect maskRect; |
| 524 | 548 |
| 525 switch (bgLayer.clip()) { | 549 switch (bgLayer.clip()) { |
| 526 case PaddingFillBox: | 550 case PaddingFillBox: |
| 527 case ContentFillBox: { | 551 case ContentFillBox: { |
| 528 if (info.isRoundedFill) | 552 if (info.isRoundedFill) |
| 529 break; | 553 break; |
| 530 | 554 |
| 531 // Clip to the padding or content boxes as necessary. | 555 // Clip to the padding or content boxes as necessary. |
| 532 bool includePadding = bgLayer.clip() == ContentFillBox; | 556 bool includePadding = bgLayer.clip() == ContentFillBox; |
| 533 LayoutRect clipRect(scrolledPaintRect.x() + bLeft + (includePadding ? pL eft : LayoutUnit()), | 557 LayoutRect clipRect(scrolledPaintRect.x() + bLeft + (includePadding ? pL eft : LayoutUnit()), |
| 534 scrolledPaintRect.y() + obj.borderTop() + (includePadding ? obj.padd ingTop() : LayoutUnit()), | 558 scrolledPaintRect.y() + (avoidBorder ? obj.borderTop() : 0) + (inclu dePadding ? obj.paddingTop() : LayoutUnit()), |
| 535 scrolledPaintRect.width() - bLeft - bRight - (includePadding ? pLeft + pRight : LayoutUnit()), | 559 scrolledPaintRect.width() - bLeft - bRight - (includePadding ? pLeft + pRight : LayoutUnit()), |
| 536 scrolledPaintRect.height() - obj.borderTop() - obj.borderBottom() - (includePadding ? obj.paddingTop() + obj.paddingBottom() : LayoutUnit())); | 560 scrolledPaintRect.height() - (avoidBorder ? obj.borderTop() + obj.bo rderBottom() : 0) - (includePadding ? obj.paddingTop() + obj.paddingBottom() : L ayoutUnit())); |
| 537 backgroundClipStateSaver.save(); | 561 backgroundClipStateSaver.save(); |
| 538 // TODO(chrishtr): this should be pixel-snapped. | 562 // TODO(chrishtr): this should be pixel-snapped. |
| 539 context.clip(FloatRect(clipRect)); | 563 context.clip(FloatRect(clipRect)); |
| 540 | 564 |
| 541 break; | 565 break; |
| 542 } | 566 } |
| 543 case TextFillBox: { | 567 case TextFillBox: { |
| 544 // First figure out how big the mask has to be. It should be no bigger t han what we need | 568 // First figure out how big the mask has to be. It should be no bigger t han what we need |
| 545 // to actually render, so we should intersect the dirty rect with the bo rder box of the background. | 569 // to actually render, so we should intersect the dirty rect with the bo rder box of the background. |
| 546 maskRect = pixelSnappedIntRect(rect); | 570 maskRect = pixelSnappedIntRect(rect); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 568 if (info.shouldPaintColor || info.shouldPaintShadow) { | 592 if (info.shouldPaintColor || info.shouldPaintShadow) { |
| 569 const ShadowContext shadowContext(context, obj, info.shouldPaintShad ow); | 593 const ShadowContext shadowContext(context, obj, info.shouldPaintShad ow); |
| 570 context.fillRect(backgroundRect, info.color); | 594 context.fillRect(backgroundRect, info.color); |
| 571 } | 595 } |
| 572 } | 596 } |
| 573 | 597 |
| 574 // no progressive loading of the background image | 598 // no progressive loading of the background image |
| 575 if (info.shouldPaintImage) { | 599 if (info.shouldPaintImage) { |
| 576 if (!geometry) { | 600 if (!geometry) { |
| 577 geometry.emplace(); | 601 geometry.emplace(); |
| 578 geometry->calculate(obj, paintInfo.paintContainer(), paintInfo.getGl obalPaintFlags(), bgLayer, scrolledPaintRect); | 602 geometry->calculate(obj, paintInfo.paintContainer(), paintInfo.getGl obalPaintFlags(), bgLayer, scrolledPaintRect, paintInfo.paintFlags() & PaintLaye rPaintingCompositingBackgroundPhase); |
| 579 } else { | 603 } else { |
| 580 // The geometry was calculated in paintFastBottomLayer(). | 604 // The geometry was calculated in paintFastBottomLayer(). |
| 581 DCHECK(info.isBottomLayer && info.isBorderFill && !info.isClippedWit hLocalScrolling); | 605 DCHECK(info.isBottomLayer && info.isBorderFill && !info.isClippedWit hLocalScrolling); |
| 582 } | 606 } |
| 583 | 607 |
| 584 if (!geometry->destRect().isEmpty()) { | 608 if (!geometry->destRect().isEmpty()) { |
| 585 const ImagePaintContext imageContext(obj, context, bgLayer, *info.im age, op, | 609 const ImagePaintContext imageContext(obj, context, bgLayer, *info.im age, op, |
| 586 backgroundObject, geometry->tileSize()); | 610 backgroundObject, geometry->tileSize()); |
| 587 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintI mage", "data", | 611 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintI mage", "data", |
| 588 InspectorPaintImageEvent::data(obj, *info.image)); | 612 InspectorPaintImageEvent::data(obj, *info.image)); |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 820 } | 844 } |
| 821 } | 845 } |
| 822 | 846 |
| 823 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle& style, const Document& document) | 847 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle& style, const Document& document) |
| 824 { | 848 { |
| 825 return document.printing() && style.getPrintColorAdjust() == PrintColorAdjus tEconomy | 849 return document.printing() && style.getPrintColorAdjust() == PrintColorAdjus tEconomy |
| 826 && (!document.settings() || !document.settings()->shouldPrintBackgrounds ()); | 850 && (!document.settings() || !document.settings()->shouldPrintBackgrounds ()); |
| 827 } | 851 } |
| 828 | 852 |
| 829 } // namespace blink | 853 } // namespace blink |
| OLD | NEW |