Chromium Code Reviews| 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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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. | |
| 710 Color baseColor; | |
| 711 bool shouldClearBackground = false; | |
| 712 if (isOpaqueRoot) { | |
| 713 baseColor = view()->frameView()->baseBackgroundColor(); | |
| 714 if (!baseColor.alpha()) | |
| 715 shouldClearBackground = true; | |
| 716 } | |
| 717 | |
| 718 GraphicsContextStateSaver shadowStateSaver(*context, boxShadowShould BeAppliedToBackground); | 709 GraphicsContextStateSaver shadowStateSaver(*context, boxShadowShould BeAppliedToBackground); |
| 719 if (boxShadowShouldBeAppliedToBackground) | 710 if (boxShadowShouldBeAppliedToBackground) |
| 720 applyBoxShadowForBackground(context, this); | 711 applyBoxShadowForBackground(context, this); |
| 721 | 712 |
| 722 if (baseColor.alpha()) { | 713 if (isOpaqueRoot) { |
| 723 if (bgColor.alpha()) | 714 // If we have an alpha and we are painting the root element, go ahead and blend with the base background color. |
| 724 baseColor = baseColor.blend(bgColor); | 715 Color baseColor = view()->frameView()->baseBackgroundColor(); |
| 716 bool shouldBlendWithExistingContent = document().settings() && d ocument().settings()->shouldBlendWithExistingContent(); | |
|
enne (OOO)
2013/09/24 18:35:48
bikeshed: shouldBlendWithExistingContent is a litt
| |
| 717 CompositeOperator operation = shouldBlendWithExistingContent ? c ontext->compositeOperation() : CompositeCopy; | |
| 725 | 718 |
| 726 context->fillRect(backgroundRect, baseColor, CompositeCopy); | 719 if (baseColor.alpha()) { |
| 720 if (bgColor.alpha()) | |
| 721 baseColor = baseColor.blend(bgColor); | |
| 722 context->fillRect(backgroundRect, baseColor, operation); | |
| 723 } else if (bgColor.alpha()) { | |
| 724 context->fillRect(backgroundRect, bgColor, operation); | |
| 725 } else if (!shouldBlendWithExistingContent) { | |
| 726 context->clearRect(backgroundRect); | |
| 727 } | |
| 727 } else if (bgColor.alpha()) { | 728 } else if (bgColor.alpha()) { |
| 728 CompositeOperator operation = shouldClearBackground ? CompositeC opy : context->compositeOperation(); | 729 context->fillRect(backgroundRect, bgColor, context->compositeOpe ration()); |
| 729 context->fillRect(backgroundRect, bgColor, operation); | 730 } |
| 730 } else if (shouldClearBackground) | |
| 731 context->clearRect(backgroundRect); | |
| 732 } | 731 } |
| 733 } | 732 } |
| 734 | 733 |
| 735 // no progressive loading of the background image | 734 // no progressive loading of the background image |
| 736 if (shouldPaintBackgroundImage) { | 735 if (shouldPaintBackgroundImage) { |
| 737 BackgroundImageGeometry geometry; | 736 BackgroundImageGeometry geometry; |
| 738 calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, geometry, b ackgroundObject); | 737 calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, geometry, b ackgroundObject); |
| 739 geometry.clip(paintInfo.rect); | 738 geometry.clip(paintInfo.rect); |
| 740 if (!geometry.destRect().isEmpty()) { | 739 if (!geometry.destRect().isEmpty()) { |
| 741 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer- >composite() : op; | 740 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer- >composite() : op; |
| (...skipping 2043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2785 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 2784 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
| 2786 for (RenderObject* child = startChild; child && child != endChild; ) { | 2785 for (RenderObject* child = startChild; child && child != endChild; ) { |
| 2787 // Save our next sibling as moveChildTo will clear it. | 2786 // Save our next sibling as moveChildTo will clear it. |
| 2788 RenderObject* nextSibling = child->nextSibling(); | 2787 RenderObject* nextSibling = child->nextSibling(); |
| 2789 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 2788 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
| 2790 child = nextSibling; | 2789 child = nextSibling; |
| 2791 } | 2790 } |
| 2792 } | 2791 } |
| 2793 | 2792 |
| 2794 } // namespace WebCore | 2793 } // namespace WebCore |
| OLD | NEW |