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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 363 |
364 // Use the most conservative inset to avoid mixed-style corner issues. | 364 // Use the most conservative inset to avoid mixed-style corner issues. |
365 float fractionalInset = 1.0f / 2; | 365 float fractionalInset = 1.0f / 2; |
366 for (auto& edge : edges) { | 366 for (auto& edge : edges) { |
367 if (edge.borderStyle() == BorderStyleDouble) { | 367 if (edge.borderStyle() == BorderStyleDouble) { |
368 fractionalInset = 1.0f / 6; | 368 fractionalInset = 1.0f / 6; |
369 break; | 369 break; |
370 } | 370 } |
371 } | 371 } |
372 | 372 |
373 FloatRectOutsets insets(-fractionalInset * edges[BSTop].width, | 373 FloatRectOutsets insets(-fractionalInset * edges[BSTop].width(), |
374 -fractionalInset * edges[BSRight].width, | 374 -fractionalInset * edges[BSRight].width(), |
375 -fractionalInset * edges[BSBottom].width, | 375 -fractionalInset * edges[BSBottom].width(), |
376 -fractionalInset * edges[BSLeft].width); | 376 -fractionalInset * edges[BSLeft].width()); |
377 | 377 |
378 FloatRoundedRect backgroundRoundedRect = getBackgroundRoundedRect( | 378 FloatRoundedRect backgroundRoundedRect = getBackgroundRoundedRect( |
379 obj, borderRect, box, boxSize.width(), boxSize.height(), | 379 obj, borderRect, box, boxSize.width(), boxSize.height(), |
380 includeLogicalLeftEdge, includeLogicalRightEdge); | 380 includeLogicalLeftEdge, includeLogicalRightEdge); |
381 FloatRect insetRect(backgroundRoundedRect.rect()); | 381 FloatRect insetRect(backgroundRoundedRect.rect()); |
382 insetRect.expand(insets); | 382 insetRect.expand(insets); |
383 FloatRoundedRect::Radii insetRadii(backgroundRoundedRect.getRadii()); | 383 FloatRoundedRect::Radii insetRadii(backgroundRoundedRect.getRadii()); |
384 insetRadii.shrink(-insets.top(), -insets.bottom(), -insets.left(), | 384 insetRadii.shrink(-insets.top(), -insets.bottom(), -insets.left(), |
385 -insets.right()); | 385 -insets.right()); |
386 return FloatRoundedRect(insetRect, insetRadii); | 386 return FloatRoundedRect(insetRect, insetRadii); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 info.includeLeftEdge, info.includeRightEdge); | 652 info.includeLeftEdge, info.includeRightEdge); |
653 } else if (bgLayer.clip() == PaddingFillBox) { | 653 } else if (bgLayer.clip() == PaddingFillBox) { |
654 border = obj.style()->getRoundedInnerBorderFor(LayoutRect(border.rect()), | 654 border = obj.style()->getRoundedInnerBorderFor(LayoutRect(border.rect()), |
655 info.includeLeftEdge, | 655 info.includeLeftEdge, |
656 info.includeRightEdge); | 656 info.includeRightEdge); |
657 } | 657 } |
658 | 658 |
659 clipToBorder.emplace(obj, paintInfo, rect, border, ApplyToContext); | 659 clipToBorder.emplace(obj, paintInfo, rect, border, ApplyToContext); |
660 } | 660 } |
661 | 661 |
662 int bLeft = info.includeLeftEdge ? obj.borderLeft() : 0; | 662 LayoutUnit bLeft = info.includeLeftEdge ? obj.borderLeft() : LayoutUnit(); |
663 int bRight = info.includeRightEdge ? obj.borderRight() : 0; | 663 LayoutUnit bRight = info.includeRightEdge ? obj.borderRight() : LayoutUnit(); |
664 LayoutUnit pLeft = info.includeLeftEdge ? obj.paddingLeft() : LayoutUnit(); | 664 LayoutUnit pLeft = info.includeLeftEdge ? obj.paddingLeft() : LayoutUnit(); |
665 LayoutUnit pRight = info.includeRightEdge ? obj.paddingRight() : LayoutUnit(); | 665 LayoutUnit pRight = info.includeRightEdge ? obj.paddingRight() : LayoutUnit(); |
666 | 666 |
667 GraphicsContextStateSaver clipWithScrollingStateSaver( | 667 GraphicsContextStateSaver clipWithScrollingStateSaver( |
668 context, info.isClippedWithLocalScrolling); | 668 context, info.isClippedWithLocalScrolling); |
669 LayoutRect scrolledPaintRect = rect; | 669 LayoutRect scrolledPaintRect = rect; |
670 if (info.isClippedWithLocalScrolling && | 670 if (info.isClippedWithLocalScrolling && |
671 !isPaintingBackgroundOfPaintContainerIntoScrollingContentsLayer( | 671 !isPaintingBackgroundOfPaintContainerIntoScrollingContentsLayer( |
672 &obj, paintInfo)) { | 672 &obj, paintInfo)) { |
673 // Clip to the overflow area. | 673 // Clip to the overflow area. |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy( | 1082 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy( |
1083 const ComputedStyle& style, | 1083 const ComputedStyle& style, |
1084 const Document& document) { | 1084 const Document& document) { |
1085 return document.printing() && | 1085 return document.printing() && |
1086 style.printColorAdjust() == EPrintColorAdjust::kEconomy && | 1086 style.printColorAdjust() == EPrintColorAdjust::kEconomy && |
1087 (!document.settings() || | 1087 (!document.settings() || |
1088 !document.settings()->getShouldPrintBackgrounds()); | 1088 !document.settings()->getShouldPrintBackgrounds()); |
1089 } | 1089 } |
1090 | 1090 |
1091 } // namespace blink | 1091 } // namespace blink |
OLD | NEW |