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 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 } | 905 } |
906 } else | 906 } else |
907 isOpaqueRoot = !view()->frameView()->isTransparent(); | 907 isOpaqueRoot = !view()->frameView()->isTransparent(); |
908 } | 908 } |
909 view()->frameView()->setContentIsOpaque(isOpaqueRoot); | 909 view()->frameView()->setContentIsOpaque(isOpaqueRoot); |
910 } | 910 } |
911 | 911 |
912 // Paint the color first underneath all images, culled if background image o
ccludes it. | 912 // Paint the color first underneath all images, culled if background image o
ccludes it. |
913 // FIXME: In the bgLayer->hasFiniteBounds() case, we could improve the culli
ng test | 913 // FIXME: In the bgLayer->hasFiniteBounds() case, we could improve the culli
ng test |
914 // by verifying whether the background image covers the entire layout rect. | 914 // by verifying whether the background image covers the entire layout rect. |
915 if (!bgLayer->next() && !(shouldPaintBackgroundImage && bgLayer->hasOpaqueIm
age(this) && bgLayer->hasRepeatXY())) { | 915 if (!bgLayer->next()) { |
916 IntRect backgroundRect(pixelSnappedIntRect(scrolledPaintRect)); | 916 IntRect backgroundRect(pixelSnappedIntRect(scrolledPaintRect)); |
917 bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppli
edToBackground(bleedAvoidance, box); | 917 bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppli
edToBackground(bleedAvoidance, box); |
918 if (!boxShadowShouldBeAppliedToBackground) | 918 if (boxShadowShouldBeAppliedToBackground || !shouldPaintBackgroundImage
|| !bgLayer->hasOpaqueImage(this) || !bgLayer->hasRepeatXY()) { |
919 backgroundRect.intersect(paintInfo.rect); | 919 if (!boxShadowShouldBeAppliedToBackground) |
| 920 backgroundRect.intersect(paintInfo.rect); |
920 | 921 |
921 // If we have an alpha and we are painting the root element, go ahead an
d blend with the base background color. | 922 // If we have an alpha and we are painting the root element, go ahea
d and blend with the base background color. |
922 Color baseColor; | 923 Color baseColor; |
923 bool shouldClearBackground = false; | 924 bool shouldClearBackground = false; |
924 if (isOpaqueRoot) { | 925 if (isOpaqueRoot) { |
925 baseColor = view()->frameView()->baseBackgroundColor(); | 926 baseColor = view()->frameView()->baseBackgroundColor(); |
926 if (!baseColor.alpha()) | 927 if (!baseColor.alpha()) |
927 shouldClearBackground = true; | 928 shouldClearBackground = true; |
| 929 } |
| 930 |
| 931 GraphicsContextStateSaver shadowStateSaver(*context, boxShadowShould
BeAppliedToBackground); |
| 932 if (boxShadowShouldBeAppliedToBackground) |
| 933 applyBoxShadowForBackground(context, style()); |
| 934 |
| 935 if (baseColor.alpha()) { |
| 936 if (bgColor.alpha()) |
| 937 baseColor = baseColor.blend(bgColor); |
| 938 |
| 939 context->fillRect(backgroundRect, baseColor, style()->colorSpace
(), CompositeCopy); |
| 940 } else if (bgColor.alpha()) { |
| 941 CompositeOperator operation = shouldClearBackground ? CompositeC
opy : context->compositeOperation(); |
| 942 context->fillRect(backgroundRect, bgColor, style()->colorSpace()
, operation); |
| 943 } else if (shouldClearBackground) |
| 944 context->clearRect(backgroundRect); |
928 } | 945 } |
929 | |
930 GraphicsContextStateSaver shadowStateSaver(*context, boxShadowShouldBeAp
pliedToBackground); | |
931 if (boxShadowShouldBeAppliedToBackground) | |
932 applyBoxShadowForBackground(context, style()); | |
933 | |
934 if (baseColor.alpha()) { | |
935 if (bgColor.alpha()) | |
936 baseColor = baseColor.blend(bgColor); | |
937 | |
938 context->fillRect(backgroundRect, baseColor, style()->colorSpace(),
CompositeCopy); | |
939 } else if (bgColor.alpha()) { | |
940 CompositeOperator operation = shouldClearBackground ? CompositeCopy
: context->compositeOperation(); | |
941 context->fillRect(backgroundRect, bgColor, style()->colorSpace(), op
eration); | |
942 } else if (shouldClearBackground) | |
943 context->clearRect(backgroundRect); | |
944 } | 946 } |
945 | 947 |
946 // no progressive loading of the background image | 948 // no progressive loading of the background image |
947 if (shouldPaintBackgroundImage) { | 949 if (shouldPaintBackgroundImage) { |
948 BackgroundImageGeometry geometry; | 950 BackgroundImageGeometry geometry; |
949 calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, geometry); | 951 calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, geometry); |
950 geometry.clip(paintInfo.rect); | 952 geometry.clip(paintInfo.rect); |
951 if (!geometry.destRect().isEmpty()) { | 953 if (!geometry.destRect().isEmpty()) { |
952 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer-
>composite() : op; | 954 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer-
>composite() : op; |
953 RenderObject* clientForBackgroundImage = backgroundObject ? backgrou
ndObject : this; | 955 RenderObject* clientForBackgroundImage = backgroundObject ? backgrou
ndObject : this; |
(...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2831 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 2833 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
2832 for (RenderObject* child = startChild; child && child != endChild; ) { | 2834 for (RenderObject* child = startChild; child && child != endChild; ) { |
2833 // Save our next sibling as moveChildTo will clear it. | 2835 // Save our next sibling as moveChildTo will clear it. |
2834 RenderObject* nextSibling = child->nextSibling(); | 2836 RenderObject* nextSibling = child->nextSibling(); |
2835 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 2837 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
2836 child = nextSibling; | 2838 child = nextSibling; |
2837 } | 2839 } |
2838 } | 2840 } |
2839 | 2841 |
2840 } // namespace WebCore | 2842 } // namespace WebCore |
OLD | NEW |