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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 info.includeLeftEdge, info.includeRightEdge); | 649 info.includeLeftEdge, info.includeRightEdge); |
650 } else if (bgLayer.clip() == PaddingFillBox) { | 650 } else if (bgLayer.clip() == PaddingFillBox) { |
651 border = obj.style()->getRoundedInnerBorderFor(LayoutRect(border.rect()), | 651 border = obj.style()->getRoundedInnerBorderFor(LayoutRect(border.rect()), |
652 info.includeLeftEdge, | 652 info.includeLeftEdge, |
653 info.includeRightEdge); | 653 info.includeRightEdge); |
654 } | 654 } |
655 | 655 |
656 clipToBorder.emplace(obj, paintInfo, rect, border, ApplyToContext); | 656 clipToBorder.emplace(obj, paintInfo, rect, border, ApplyToContext); |
657 } | 657 } |
658 | 658 |
659 int bLeft = info.includeLeftEdge ? obj.borderLeft() : 0; | 659 LayoutUnit bLeft = info.includeLeftEdge ? obj.borderLeft() : LayoutUnit(); |
660 int bRight = info.includeRightEdge ? obj.borderRight() : 0; | 660 LayoutUnit bRight = info.includeRightEdge ? obj.borderRight() : LayoutUnit(); |
661 LayoutUnit pLeft = info.includeLeftEdge ? obj.paddingLeft() : LayoutUnit(); | 661 LayoutUnit pLeft = info.includeLeftEdge ? obj.paddingLeft() : LayoutUnit(); |
662 LayoutUnit pRight = info.includeRightEdge ? obj.paddingRight() : LayoutUnit(); | 662 LayoutUnit pRight = info.includeRightEdge ? obj.paddingRight() : LayoutUnit(); |
663 | 663 |
664 GraphicsContextStateSaver clipWithScrollingStateSaver( | 664 GraphicsContextStateSaver clipWithScrollingStateSaver( |
665 context, info.isClippedWithLocalScrolling); | 665 context, info.isClippedWithLocalScrolling); |
666 LayoutRect scrolledPaintRect = rect; | 666 LayoutRect scrolledPaintRect = rect; |
667 if (info.isClippedWithLocalScrolling && | 667 if (info.isClippedWithLocalScrolling && |
668 !isPaintingBackgroundOfPaintContainerIntoScrollingContentsLayer( | 668 !isPaintingBackgroundOfPaintContainerIntoScrollingContentsLayer( |
669 &obj, paintInfo)) { | 669 &obj, paintInfo)) { |
670 // Clip to the overflow area. | 670 // Clip to the overflow area. |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy( | 1079 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy( |
1080 const ComputedStyle& style, | 1080 const ComputedStyle& style, |
1081 const Document& document) { | 1081 const Document& document) { |
1082 return document.printing() && | 1082 return document.printing() && |
1083 style.printColorAdjust() == EPrintColorAdjust::kEconomy && | 1083 style.printColorAdjust() == EPrintColorAdjust::kEconomy && |
1084 (!document.settings() || | 1084 (!document.settings() || |
1085 !document.settings()->getShouldPrintBackgrounds()); | 1085 !document.settings()->getShouldPrintBackgrounds()); |
1086 } | 1086 } |
1087 | 1087 |
1088 } // namespace blink | 1088 } // namespace blink |
OLD | NEW |