| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // For the case where we are painting the background into the scrolling | 70 // For the case where we are painting the background into the scrolling |
| 71 // contents layer of a composited scroller we need to include the entire | 71 // contents layer of a composited scroller we need to include the entire |
| 72 // overflow rect. | 72 // overflow rect. |
| 73 paintRect = m_layoutBox.layoutOverflowRect(); | 73 paintRect = m_layoutBox.layoutOverflowRect(); |
| 74 scrollRecorder.emplace(paintInfo.context, m_layoutBox, paintInfo.phase, | 74 scrollRecorder.emplace(paintInfo.context, m_layoutBox, paintInfo.phase, |
| 75 m_layoutBox.scrolledContentOffset()); | 75 m_layoutBox.scrolledContentOffset()); |
| 76 | 76 |
| 77 // The background painting code assumes that the borders are part of the | 77 // The background painting code assumes that the borders are part of the |
| 78 // paintRect so we expand the paintRect by the border size when painting the | 78 // paintRect so we expand the paintRect by the border size when painting the |
| 79 // background into the scrolling contents layer. | 79 // background into the scrolling contents layer. |
| 80 paintRect.expandEdges(LayoutUnit(m_layoutBox.borderTop()), | 80 paintRect.expandEdges(m_layoutBox.borderTop(), m_layoutBox.borderRight(), |
| 81 LayoutUnit(m_layoutBox.borderRight()), | 81 m_layoutBox.borderBottom(), m_layoutBox.borderLeft()); |
| 82 LayoutUnit(m_layoutBox.borderBottom()), | |
| 83 LayoutUnit(m_layoutBox.borderLeft())); | |
| 84 } else { | 82 } else { |
| 85 paintRect = m_layoutBox.borderBoxRect(); | 83 paintRect = m_layoutBox.borderBoxRect(); |
| 86 } | 84 } |
| 87 | 85 |
| 88 paintRect.moveBy(paintOffset); | 86 paintRect.moveBy(paintOffset); |
| 89 paintBoxDecorationBackgroundWithRect(paintInfo, paintOffset, paintRect); | 87 paintBoxDecorationBackgroundWithRect(paintInfo, paintOffset, paintRect); |
| 90 } | 88 } |
| 91 | 89 |
| 92 LayoutRect BoxPainter::boundsForDrawingRecorder( | 90 LayoutRect BoxPainter::boundsForDrawingRecorder( |
| 93 const PaintInfo& paintInfo, | 91 const PaintInfo& paintInfo, |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 361 |
| 364 // Use the most conservative inset to avoid mixed-style corner issues. | 362 // Use the most conservative inset to avoid mixed-style corner issues. |
| 365 float fractionalInset = 1.0f / 2; | 363 float fractionalInset = 1.0f / 2; |
| 366 for (auto& edge : edges) { | 364 for (auto& edge : edges) { |
| 367 if (edge.borderStyle() == BorderStyleDouble) { | 365 if (edge.borderStyle() == BorderStyleDouble) { |
| 368 fractionalInset = 1.0f / 6; | 366 fractionalInset = 1.0f / 6; |
| 369 break; | 367 break; |
| 370 } | 368 } |
| 371 } | 369 } |
| 372 | 370 |
| 373 FloatRectOutsets insets(-fractionalInset * edges[BSTop].width, | 371 FloatRectOutsets insets(-fractionalInset * edges[BSTop].width(), |
| 374 -fractionalInset * edges[BSRight].width, | 372 -fractionalInset * edges[BSRight].width(), |
| 375 -fractionalInset * edges[BSBottom].width, | 373 -fractionalInset * edges[BSBottom].width(), |
| 376 -fractionalInset * edges[BSLeft].width); | 374 -fractionalInset * edges[BSLeft].width()); |
| 377 | 375 |
| 378 FloatRoundedRect backgroundRoundedRect = getBackgroundRoundedRect( | 376 FloatRoundedRect backgroundRoundedRect = getBackgroundRoundedRect( |
| 379 obj, borderRect, box, boxSize.width(), boxSize.height(), | 377 obj, borderRect, box, boxSize.width(), boxSize.height(), |
| 380 includeLogicalLeftEdge, includeLogicalRightEdge); | 378 includeLogicalLeftEdge, includeLogicalRightEdge); |
| 381 FloatRect insetRect(backgroundRoundedRect.rect()); | 379 FloatRect insetRect(backgroundRoundedRect.rect()); |
| 382 insetRect.expand(insets); | 380 insetRect.expand(insets); |
| 383 FloatRoundedRect::Radii insetRadii(backgroundRoundedRect.getRadii()); | 381 FloatRoundedRect::Radii insetRadii(backgroundRoundedRect.getRadii()); |
| 384 insetRadii.shrink(-insets.top(), -insets.bottom(), -insets.left(), | 382 insetRadii.shrink(-insets.top(), -insets.bottom(), -insets.left(), |
| 385 -insets.right()); | 383 -insets.right()); |
| 386 return FloatRoundedRect(insetRect, insetRadii); | 384 return FloatRoundedRect(insetRect, insetRadii); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 info.includeLeftEdge, info.includeRightEdge); | 650 info.includeLeftEdge, info.includeRightEdge); |
| 653 } else if (bgLayer.clip() == PaddingFillBox) { | 651 } else if (bgLayer.clip() == PaddingFillBox) { |
| 654 border = obj.style()->getRoundedInnerBorderFor(LayoutRect(border.rect()), | 652 border = obj.style()->getRoundedInnerBorderFor(LayoutRect(border.rect()), |
| 655 info.includeLeftEdge, | 653 info.includeLeftEdge, |
| 656 info.includeRightEdge); | 654 info.includeRightEdge); |
| 657 } | 655 } |
| 658 | 656 |
| 659 clipToBorder.emplace(obj, paintInfo, rect, border, ApplyToContext); | 657 clipToBorder.emplace(obj, paintInfo, rect, border, ApplyToContext); |
| 660 } | 658 } |
| 661 | 659 |
| 662 int bLeft = info.includeLeftEdge ? obj.borderLeft() : 0; | 660 LayoutUnit bLeft = info.includeLeftEdge ? obj.borderLeft() : LayoutUnit(); |
| 663 int bRight = info.includeRightEdge ? obj.borderRight() : 0; | 661 LayoutUnit bRight = info.includeRightEdge ? obj.borderRight() : LayoutUnit(); |
| 664 LayoutUnit pLeft = info.includeLeftEdge ? obj.paddingLeft() : LayoutUnit(); | 662 LayoutUnit pLeft = info.includeLeftEdge ? obj.paddingLeft() : LayoutUnit(); |
| 665 LayoutUnit pRight = info.includeRightEdge ? obj.paddingRight() : LayoutUnit(); | 663 LayoutUnit pRight = info.includeRightEdge ? obj.paddingRight() : LayoutUnit(); |
| 666 | 664 |
| 667 GraphicsContextStateSaver clipWithScrollingStateSaver( | 665 GraphicsContextStateSaver clipWithScrollingStateSaver( |
| 668 context, info.isClippedWithLocalScrolling); | 666 context, info.isClippedWithLocalScrolling); |
| 669 LayoutRect scrolledPaintRect = rect; | 667 LayoutRect scrolledPaintRect = rect; |
| 670 if (info.isClippedWithLocalScrolling && | 668 if (info.isClippedWithLocalScrolling && |
| 671 !isPaintingBackgroundOfPaintContainerIntoScrollingContentsLayer( | 669 !isPaintingBackgroundOfPaintContainerIntoScrollingContentsLayer( |
| 672 &obj, paintInfo)) { | 670 &obj, paintInfo)) { |
| 673 // Clip to the overflow area. | 671 // Clip to the overflow area. |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy( | 1080 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy( |
| 1083 const ComputedStyle& style, | 1081 const ComputedStyle& style, |
| 1084 const Document& document) { | 1082 const Document& document) { |
| 1085 return document.printing() && | 1083 return document.printing() && |
| 1086 style.printColorAdjust() == EPrintColorAdjust::kEconomy && | 1084 style.printColorAdjust() == EPrintColorAdjust::kEconomy && |
| 1087 (!document.settings() || | 1085 (!document.settings() || |
| 1088 !document.settings()->getShouldPrintBackgrounds()); | 1086 !document.settings()->getShouldPrintBackgrounds()); |
| 1089 } | 1087 } |
| 1090 | 1088 |
| 1091 } // namespace blink | 1089 } // namespace blink |
| OLD | NEW |