OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 scrolledPaintRect.height() - borderTop() - borderBottom() - (include
Padding ? paddingTop() + paddingBottom() : LayoutUnit())); | 644 scrolledPaintRect.height() - borderTop() - borderBottom() - (include
Padding ? paddingTop() + paddingBottom() : LayoutUnit())); |
645 backgroundClipStateSaver.save(); | 645 backgroundClipStateSaver.save(); |
646 context->clip(clipRect); | 646 context->clip(clipRect); |
647 | 647 |
648 break; | 648 break; |
649 } | 649 } |
650 case TextFillBox: { | 650 case TextFillBox: { |
651 // First figure out how big the mask has to be. It should be no bigger
than what we need | 651 // First figure out how big the mask has to be. It should be no bigger
than what we need |
652 // to actually render, so we should intersect the dirty rect with the bo
rder box of the background. | 652 // to actually render, so we should intersect the dirty rect with the bo
rder box of the background. |
653 maskRect = pixelSnappedIntRect(rect); | 653 maskRect = pixelSnappedIntRect(rect); |
654 maskRect.intersect(paintInfo.rect); | 654 maskRect.intersect(paintInfo.rect()); |
655 | 655 |
656 // We draw the background into a separate layer, to be later masked with
yet another layer | 656 // We draw the background into a separate layer, to be later masked with
yet another layer |
657 // holding the text content. | 657 // holding the text content. |
658 backgroundClipStateSaver.save(); | 658 backgroundClipStateSaver.save(); |
659 context->clip(maskRect); | 659 context->clip(maskRect); |
660 context->beginTransparencyLayer(1); | 660 context->beginTransparencyLayer(1); |
661 | 661 |
662 break; | 662 break; |
663 } | 663 } |
664 case BorderFillBox: | 664 case BorderFillBox: |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 } | 697 } |
698 | 698 |
699 // Paint the color first underneath all images, culled if background image o
ccludes it. | 699 // Paint the color first underneath all images, culled if background image o
ccludes it. |
700 // FIXME: In the bgLayer->hasFiniteBounds() case, we could improve the culli
ng test | 700 // FIXME: In the bgLayer->hasFiniteBounds() case, we could improve the culli
ng test |
701 // by verifying whether the background image covers the entire layout rect. | 701 // by verifying whether the background image covers the entire layout rect. |
702 if (!bgLayer->next()) { | 702 if (!bgLayer->next()) { |
703 IntRect backgroundRect(pixelSnappedIntRect(scrolledPaintRect)); | 703 IntRect backgroundRect(pixelSnappedIntRect(scrolledPaintRect)); |
704 bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppli
edToBackground(bleedAvoidance, box); | 704 bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppli
edToBackground(bleedAvoidance, box); |
705 if (boxShadowShouldBeAppliedToBackground || !shouldPaintBackgroundImage
|| !bgLayer->hasOpaqueImage(this) || !bgLayer->hasRepeatXY()) { | 705 if (boxShadowShouldBeAppliedToBackground || !shouldPaintBackgroundImage
|| !bgLayer->hasOpaqueImage(this) || !bgLayer->hasRepeatXY()) { |
706 if (!boxShadowShouldBeAppliedToBackground) | 706 if (!boxShadowShouldBeAppliedToBackground) |
707 backgroundRect.intersect(paintInfo.rect); | 707 backgroundRect.intersect(paintInfo.rect()); |
708 | 708 |
709 // If we have an alpha and we are painting the root element, go ahea
d and blend with the base background color. | 709 // If we have an alpha and we are painting the root element, go ahea
d and blend with the base background color. |
710 Color baseColor; | 710 Color baseColor; |
711 bool shouldClearBackground = false; | 711 bool shouldClearBackground = false; |
712 if (isOpaqueRoot) { | 712 if (isOpaqueRoot) { |
713 baseColor = view()->frameView()->baseBackgroundColor(); | 713 baseColor = view()->frameView()->baseBackgroundColor(); |
714 if (!baseColor.alpha()) | 714 if (!baseColor.alpha()) |
715 shouldClearBackground = true; | 715 shouldClearBackground = true; |
716 } | 716 } |
717 | 717 |
(...skipping 11 matching lines...) Expand all Loading... |
729 context->fillRect(backgroundRect, bgColor, operation); | 729 context->fillRect(backgroundRect, bgColor, operation); |
730 } else if (shouldClearBackground) | 730 } else if (shouldClearBackground) |
731 context->clearRect(backgroundRect); | 731 context->clearRect(backgroundRect); |
732 } | 732 } |
733 } | 733 } |
734 | 734 |
735 // no progressive loading of the background image | 735 // no progressive loading of the background image |
736 if (shouldPaintBackgroundImage) { | 736 if (shouldPaintBackgroundImage) { |
737 BackgroundImageGeometry geometry; | 737 BackgroundImageGeometry geometry; |
738 calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, geometry, b
ackgroundObject); | 738 calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, geometry, b
ackgroundObject); |
739 geometry.clip(paintInfo.rect); | 739 geometry.clip(paintInfo.rect()); |
740 if (!geometry.destRect().isEmpty()) { | 740 if (!geometry.destRect().isEmpty()) { |
741 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer-
>composite() : op; | 741 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer-
>composite() : op; |
742 RenderObject* clientForBackgroundImage = backgroundObject ? backgrou
ndObject : this; | 742 RenderObject* clientForBackgroundImage = backgroundObject ? backgrou
ndObject : this; |
743 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geome
try.tileSize()); | 743 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geome
try.tileSize()); |
744 bool useLowQualityScaling = shouldPaintAtLowQuality(context, image.g
et(), bgLayer, geometry.tileSize()); | 744 bool useLowQualityScaling = shouldPaintAtLowQuality(context, image.g
et(), bgLayer, geometry.tileSize()); |
745 context->drawTiledImage(image.get(), geometry.destRect(), geometry.r
elativePhase(), geometry.tileSize(), | 745 context->drawTiledImage(image.get(), geometry.destRect(), geometry.r
elativePhase(), geometry.tileSize(), |
746 compositeOp, useLowQualityScaling, bgLayer->blendMode()); | 746 compositeOp, useLowQualityScaling, bgLayer->blendMode()); |
747 } | 747 } |
748 } | 748 } |
749 | 749 |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 | 1745 |
1746 if (currEdge.style != SOLID) | 1746 if (currEdge.style != SOLID) |
1747 haveAllSolidEdges = false; | 1747 haveAllSolidEdges = false; |
1748 | 1748 |
1749 if (currEdge.style != DOUBLE) | 1749 if (currEdge.style != DOUBLE) |
1750 haveAllDoubleEdges = false; | 1750 haveAllDoubleEdges = false; |
1751 } | 1751 } |
1752 | 1752 |
1753 // If no corner intersects the clip region, we can pretend outerBorder is | 1753 // If no corner intersects the clip region, we can pretend outerBorder is |
1754 // rectangular to improve performance. | 1754 // rectangular to improve performance. |
1755 if (haveAllSolidEdges && outerBorder.isRounded() && allCornersClippedOut(out
erBorder, info.rect)) | 1755 if (haveAllSolidEdges && outerBorder.isRounded() && allCornersClippedOut(out
erBorder, info.rect())) |
1756 outerBorder.setRadii(RoundedRect::Radii()); | 1756 outerBorder.setRadii(RoundedRect::Radii()); |
1757 | 1757 |
1758 // isRenderable() check avoids issue described in https://bugs.webkit.org/sh
ow_bug.cgi?id=38787 | 1758 // isRenderable() check avoids issue described in https://bugs.webkit.org/sh
ow_bug.cgi?id=38787 |
1759 if ((haveAllSolidEdges || haveAllDoubleEdges) && allEdgesShareColor && inner
Border.isRenderable()) { | 1759 if ((haveAllSolidEdges || haveAllDoubleEdges) && allEdgesShareColor && inner
Border.isRenderable()) { |
1760 // Fast path for drawing all solid edges and all unrounded double edges | 1760 // Fast path for drawing all solid edges and all unrounded double edges |
1761 if (numEdgesVisible == 4 && (outerBorder.isRounded() || haveAlphaColor) | 1761 if (numEdgesVisible == 4 && (outerBorder.isRounded() || haveAlphaColor) |
1762 && (haveAllSolidEdges || (!outerBorder.isRounded() && !innerBorder.i
sRounded()))) { | 1762 && (haveAllSolidEdges || (!outerBorder.isRounded() && !innerBorder.i
sRounded()))) { |
1763 Path path; | 1763 Path path; |
1764 | 1764 |
1765 if (outerBorder.isRounded() && bleedAvoidance != BackgroundBleedUseT
ransparencyLayer) | 1765 if (outerBorder.isRounded() && bleedAvoidance != BackgroundBleedUseT
ransparencyLayer) |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2514 | 2514 |
2515 // Draw only the shadow. | 2515 // Draw only the shadow. |
2516 RefPtr<DrawLooper> drawLooper = adoptRef(new DrawLooper); | 2516 RefPtr<DrawLooper> drawLooper = adoptRef(new DrawLooper); |
2517 drawLooper->addShadow(shadowOffset, shadowBlur, shadowColor, | 2517 drawLooper->addShadow(shadowOffset, shadowBlur, shadowColor, |
2518 DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowIgnoresA
lpha); | 2518 DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowIgnoresA
lpha); |
2519 context->setDrawLooper(drawLooper.release()); | 2519 context->setDrawLooper(drawLooper.release()); |
2520 | 2520 |
2521 if (hasBorderRadius) { | 2521 if (hasBorderRadius) { |
2522 RoundedRect influenceRect(shadowRect, border.radii()); | 2522 RoundedRect influenceRect(shadowRect, border.radii()); |
2523 influenceRect.expandRadii(2 * shadowBlur + shadowSpread); | 2523 influenceRect.expandRadii(2 * shadowBlur + shadowSpread); |
2524 if (allCornersClippedOut(influenceRect, info.rect)) | 2524 if (allCornersClippedOut(influenceRect, info.rect())) |
2525 context->fillRect(fillRect.rect(), Color::black); | 2525 context->fillRect(fillRect.rect(), Color::black); |
2526 else { | 2526 else { |
2527 fillRect.expandRadii(shadowSpread); | 2527 fillRect.expandRadii(shadowSpread); |
2528 if (!fillRect.isRenderable()) | 2528 if (!fillRect.isRenderable()) |
2529 fillRect.adjustRadii(); | 2529 fillRect.adjustRadii(); |
2530 context->fillRoundedRect(fillRect, Color::black); | 2530 context->fillRoundedRect(fillRect, Color::black); |
2531 } | 2531 } |
2532 } else { | 2532 } else { |
2533 context->fillRect(fillRect.rect(), Color::black); | 2533 context->fillRect(fillRect.rect(), Color::black); |
2534 } | 2534 } |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2786 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 2786 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
2787 for (RenderObject* child = startChild; child && child != endChild; ) { | 2787 for (RenderObject* child = startChild; child && child != endChild; ) { |
2788 // Save our next sibling as moveChildTo will clear it. | 2788 // Save our next sibling as moveChildTo will clear it. |
2789 RenderObject* nextSibling = child->nextSibling(); | 2789 RenderObject* nextSibling = child->nextSibling(); |
2790 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 2790 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
2791 child = nextSibling; | 2791 child = nextSibling; |
2792 } | 2792 } |
2793 } | 2793 } |
2794 | 2794 |
2795 } // namespace WebCore | 2795 } // namespace WebCore |
OLD | NEW |