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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
414 return false; | 414 return false; |
415 } | 415 } |
416 } | 416 } |
417 | 417 |
418 // At this point we're committed to the fast path: the destination (r)rect f its within a single | 418 // At this point we're committed to the fast path: the destination (r)rect f its within a single |
419 // tile, and we can paint it using direct draw(R)Rect() calls. | 419 // tile, and we can paint it using direct draw(R)Rect() calls. |
420 GraphicsContext& context = paintInfo.context; | 420 GraphicsContext& context = paintInfo.context; |
421 FloatRoundedRect border = info.isRoundedFill | 421 FloatRoundedRect border = info.isRoundedFill |
422 ? backgroundRoundedRectAdjustedForBleedAvoidance(obj, rect, bleedAvoidan ce, box, boxSize, info.includeLeftEdge, info.includeRightEdge) | 422 ? backgroundRoundedRectAdjustedForBleedAvoidance(obj, rect, bleedAvoidan ce, box, boxSize, info.includeLeftEdge, info.includeRightEdge) |
423 : FloatRoundedRect(pixelSnappedIntRect(rect)); | 423 : FloatRoundedRect(pixelSnappedIntRect(rect)); |
424 // We only take this path for BorderFillBox. https://www.w3.org/TR/css3-back ground/#corner-overlap | 424 |
425 // should ensure that the border rrect is renderable. | 425 Optional<RoundedInnerRectClipper> clipper; |
426 DCHECK(border.isRenderable()); | 426 if (info.isRoundedFill && !border.isRenderable()) { |
chrishtr
2016/06/30 00:48:14
Why not ensure the border is renderable at the tim
f(malita)
2016/06/30 13:53:38
Yeah, that was my first thought also, but it turns
| |
427 // When the rrect is not renderable, we resort to clipping. | |
428 // RoundedInnerRectClipper handles this case via discrete, corner-wise c lipping. | |
429 clipper.emplace(obj, paintInfo, rect, border, ApplyToContext); | |
430 border.setRadii(FloatRoundedRect::Radii()); | |
431 } | |
427 | 432 |
428 // Paint the color + shadow if needed. | 433 // Paint the color + shadow if needed. |
429 if (info.shouldPaintColor) { | 434 if (info.shouldPaintColor) { |
430 const ShadowContext shadowContext(context, obj, info.shouldPaintShadow); | 435 const ShadowContext shadowContext(context, obj, info.shouldPaintShadow); |
431 context.fillRoundedRect(border, info.color); | 436 context.fillRoundedRect(border, info.color); |
432 } | 437 } |
433 | 438 |
434 // Paint the image + shadow if needed. | 439 // Paint the image + shadow if needed. |
435 if (!info.shouldPaintImage || imageTile.isEmpty()) | 440 if (!info.shouldPaintImage || imageTile.isEmpty()) |
436 return true; | 441 return true; |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
815 } | 820 } |
816 } | 821 } |
817 | 822 |
818 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle& style, const Document& document) | 823 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle& style, const Document& document) |
819 { | 824 { |
820 return document.printing() && style.getPrintColorAdjust() == PrintColorAdjus tEconomy | 825 return document.printing() && style.getPrintColorAdjust() == PrintColorAdjus tEconomy |
821 && (!document.settings() || !document.settings()->shouldPrintBackgrounds ()); | 826 && (!document.settings() || !document.settings()->shouldPrintBackgrounds ()); |
822 } | 827 } |
823 | 828 |
824 } // namespace blink | 829 } // namespace blink |
OLD | NEW |