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 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 CompositeOperator operation = shouldClearBackground ? CompositeC
opy : context->compositeOperation(); | 861 CompositeOperator operation = shouldClearBackground ? CompositeC
opy : context->compositeOperation(); |
862 context->fillRect(backgroundRect, bgColor, style()->colorSpace()
, operation); | 862 context->fillRect(backgroundRect, bgColor, style()->colorSpace()
, operation); |
863 } else if (shouldClearBackground) | 863 } else if (shouldClearBackground) |
864 context->clearRect(backgroundRect); | 864 context->clearRect(backgroundRect); |
865 } | 865 } |
866 } | 866 } |
867 | 867 |
868 // no progressive loading of the background image | 868 // no progressive loading of the background image |
869 if (shouldPaintBackgroundImage) { | 869 if (shouldPaintBackgroundImage) { |
870 BackgroundImageGeometry geometry; | 870 BackgroundImageGeometry geometry; |
871 calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, geometry); | 871 calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, geometry, b
ackgroundObject); |
872 geometry.clip(paintInfo.rect); | 872 geometry.clip(paintInfo.rect); |
873 if (!geometry.destRect().isEmpty()) { | 873 if (!geometry.destRect().isEmpty()) { |
874 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer-
>composite() : op; | 874 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer-
>composite() : op; |
875 RenderObject* clientForBackgroundImage = backgroundObject ? backgrou
ndObject : this; | 875 RenderObject* clientForBackgroundImage = backgroundObject ? backgrou
ndObject : this; |
876 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geome
try.tileSize()); | 876 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geome
try.tileSize()); |
877 bool useLowQualityScaling = shouldPaintAtLowQuality(context, image.g
et(), bgLayer, geometry.tileSize()); | 877 bool useLowQualityScaling = shouldPaintAtLowQuality(context, image.g
et(), bgLayer, geometry.tileSize()); |
878 context->drawTiledImage(image.get(), style()->colorSpace(), geometry
.destRect(), geometry.relativePhase(), geometry.tileSize(), | 878 context->drawTiledImage(image.get(), style()->colorSpace(), geometry
.destRect(), geometry.relativePhase(), geometry.tileSize(), |
879 compositeOp, useLowQualityScaling); | 879 compositeOp, useLowQualityScaling); |
880 } | 880 } |
881 } | 881 } |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 if (!rootLayer || !rootLayer->isComposited()) | 1100 if (!rootLayer || !rootLayer->isComposited()) |
1101 return false; | 1101 return false; |
1102 | 1102 |
1103 return rootLayer->backing()->backgroundLayerPaintsFixedRootBackground(); | 1103 return rootLayer->backing()->backgroundLayerPaintsFixedRootBackground(); |
1104 #else | 1104 #else |
1105 return false; | 1105 return false; |
1106 #endif | 1106 #endif |
1107 } | 1107 } |
1108 | 1108 |
1109 void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil
lLayer, const LayoutRect& paintRect, | 1109 void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil
lLayer, const LayoutRect& paintRect, |
1110 BackgroundImageGeome
try& geometry) | 1110 BackgroundImageGeometry& geometry, RenderObject* backgroundObject) |
1111 { | 1111 { |
1112 LayoutUnit left = 0; | 1112 LayoutUnit left = 0; |
1113 LayoutUnit top = 0; | 1113 LayoutUnit top = 0; |
1114 IntSize positioningAreaSize; | 1114 IntSize positioningAreaSize; |
1115 IntRect snappedPaintRect = pixelSnappedIntRect(paintRect); | 1115 IntRect snappedPaintRect = pixelSnappedIntRect(paintRect); |
1116 | 1116 |
1117 // Determine the background positioning area and set destRect to the backgro
und painting area. | 1117 // Determine the background positioning area and set destRect to the backgro
und painting area. |
1118 // destRect will be adjusted later if the background is non-repeating. | 1118 // destRect will be adjusted later if the background is non-repeating. |
1119 bool fixedAttachment = fillLayer->attachment() == FixedBackgroundAttachment; | 1119 bool fixedAttachment = fillLayer->attachment() == FixedBackgroundAttachment; |
1120 | 1120 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 IntRect viewportRect = pixelSnappedIntRect(viewRect()); | 1160 IntRect viewportRect = pixelSnappedIntRect(viewRect()); |
1161 if (fixedBackgroundPaintsInLocalCoordinates()) | 1161 if (fixedBackgroundPaintsInLocalCoordinates()) |
1162 viewportRect.setLocation(IntPoint()); | 1162 viewportRect.setLocation(IntPoint()); |
1163 else if (FrameView* frameView = view()->frameView()) | 1163 else if (FrameView* frameView = view()->frameView()) |
1164 viewportRect.setLocation(IntPoint(frameView->scrollOffsetForFixedPos
ition())); | 1164 viewportRect.setLocation(IntPoint(frameView->scrollOffsetForFixedPos
ition())); |
1165 | 1165 |
1166 geometry.setDestRect(pixelSnappedIntRect(viewportRect)); | 1166 geometry.setDestRect(pixelSnappedIntRect(viewportRect)); |
1167 positioningAreaSize = geometry.destRect().size(); | 1167 positioningAreaSize = geometry.destRect().size(); |
1168 } | 1168 } |
1169 | 1169 |
| 1170 RenderObject* clientForBackgroundImage = backgroundObject ? backgroundObject
: this; |
1170 IntSize fillTileSize = calculateFillTileSize(fillLayer, positioningAreaSize)
; | 1171 IntSize fillTileSize = calculateFillTileSize(fillLayer, positioningAreaSize)
; |
1171 fillLayer->image()->setContainerSizeForRenderer(this, fillTileSize, style()-
>effectiveZoom()); | 1172 fillLayer->image()->setContainerSizeForRenderer(clientForBackgroundImage, fi
llTileSize, style()->effectiveZoom()); |
1172 geometry.setTileSize(fillTileSize); | 1173 geometry.setTileSize(fillTileSize); |
1173 | 1174 |
1174 EFillRepeat backgroundRepeatX = fillLayer->repeatX(); | 1175 EFillRepeat backgroundRepeatX = fillLayer->repeatX(); |
1175 EFillRepeat backgroundRepeatY = fillLayer->repeatY(); | 1176 EFillRepeat backgroundRepeatY = fillLayer->repeatY(); |
1176 RenderView* renderView = view(); | 1177 RenderView* renderView = view(); |
1177 int availableWidth = positioningAreaSize.width() - geometry.tileSize().width
(); | 1178 int availableWidth = positioningAreaSize.width() - geometry.tileSize().width
(); |
1178 int availableHeight = positioningAreaSize.height() - geometry.tileSize().hei
ght(); | 1179 int availableHeight = positioningAreaSize.height() - geometry.tileSize().hei
ght(); |
1179 | 1180 |
1180 LayoutUnit computedXPosition = minimumValueForLength(fillLayer->xPosition(),
availableWidth, renderView, true); | 1181 LayoutUnit computedXPosition = minimumValueForLength(fillLayer->xPosition(),
availableWidth, renderView, true); |
1181 if (backgroundRepeatX == RepeatFill) | 1182 if (backgroundRepeatX == RepeatFill) |
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2778 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 2779 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
2779 for (RenderObject* child = startChild; child && child != endChild; ) { | 2780 for (RenderObject* child = startChild; child && child != endChild; ) { |
2780 // Save our next sibling as moveChildTo will clear it. | 2781 // Save our next sibling as moveChildTo will clear it. |
2781 RenderObject* nextSibling = child->nextSibling(); | 2782 RenderObject* nextSibling = child->nextSibling(); |
2782 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 2783 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
2783 child = nextSibling; | 2784 child = nextSibling; |
2784 } | 2785 } |
2785 } | 2786 } |
2786 | 2787 |
2787 } // namespace WebCore | 2788 } // namespace WebCore |
OLD | NEW |