| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 2114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2125 void operator() (GraphicsLayer* layer) const | 2125 void operator() (GraphicsLayer* layer) const |
| 2126 { | 2126 { |
| 2127 IntRect visualRectOnLayer; | 2127 IntRect visualRectOnLayer; |
| 2128 if (visualRect) { | 2128 if (visualRect) { |
| 2129 visualRectOnLayer = enclosingIntRect(LayoutRect(visualRect->location
() + subpixelAccumulation, visualRect->size())); | 2129 visualRectOnLayer = enclosingIntRect(LayoutRect(visualRect->location
() + subpixelAccumulation, visualRect->size())); |
| 2130 visualRectOnLayer.move(-layer->offsetFromLayoutObject()); | 2130 visualRectOnLayer.move(-layer->offsetFromLayoutObject()); |
| 2131 } | 2131 } |
| 2132 layer->invalidateDisplayItemClient(displayItemClient, invalidationReason
, visualRect ? &visualRectOnLayer : nullptr); | 2132 layer->invalidateDisplayItemClient(displayItemClient, invalidationReason
, visualRect ? &visualRectOnLayer : nullptr); |
| 2133 } | 2133 } |
| 2134 | 2134 |
| 2135 const DisplayItemClientWrapper& displayItemClient; | 2135 const DisplayItemClient& displayItemClient; |
| 2136 PaintInvalidationReason invalidationReason; | 2136 PaintInvalidationReason invalidationReason; |
| 2137 const LayoutRect* visualRect; | 2137 const LayoutRect* visualRect; |
| 2138 LayoutSize subpixelAccumulation; | 2138 LayoutSize subpixelAccumulation; |
| 2139 }; | 2139 }; |
| 2140 | 2140 |
| 2141 void CompositedLayerMapping::invalidateDisplayItemClient(const DisplayItemClient
Wrapper& displayItemClient, PaintInvalidationReason paintInvalidationReason, con
st LayoutRect* visualRect) | 2141 void CompositedLayerMapping::invalidateDisplayItemClient(const DisplayItemClient
& displayItemClient, PaintInvalidationReason paintInvalidationReason, const Layo
utRect* visualRect) |
| 2142 { | 2142 { |
| 2143 InvalidateDisplayItemClientFunctor functor = { displayItemClient, paintInval
idationReason, visualRect, m_owningLayer.subpixelAccumulation() }; | 2143 InvalidateDisplayItemClientFunctor functor = { displayItemClient, paintInval
idationReason, visualRect, m_owningLayer.subpixelAccumulation() }; |
| 2144 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); | 2144 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); |
| 2145 } | 2145 } |
| 2146 | 2146 |
| 2147 void CompositedLayerMapping::invalidateDisplayItemClientOnScrollingContentsLayer
(const DisplayItemClientWrapper& displayItemClient, PaintInvalidationReason pain
tInvalidationReason, const LayoutRect* visualRect) | 2147 void CompositedLayerMapping::invalidateDisplayItemClientOnScrollingContentsLayer
(const DisplayItemClient& displayItemClient, PaintInvalidationReason paintInvali
dationReason, const LayoutRect* visualRect) |
| 2148 { | 2148 { |
| 2149 InvalidateDisplayItemClientFunctor functor = { displayItemClient, paintInval
idationReason, visualRect, m_owningLayer.subpixelAccumulation() }; | 2149 InvalidateDisplayItemClientFunctor functor = { displayItemClient, paintInval
idationReason, visualRect, m_owningLayer.subpixelAccumulation() }; |
| 2150 ApplyToGraphicsLayers(this, functor, ApplyToScrollingContentsLayer); | 2150 ApplyToGraphicsLayers(this, functor, ApplyToScrollingContentsLayer); |
| 2151 } | 2151 } |
| 2152 | 2152 |
| 2153 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, un
signed maxSquashedLayerIndex) | 2153 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, un
signed maxSquashedLayerIndex) |
| 2154 { | 2154 { |
| 2155 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) { | 2155 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) { |
| 2156 if (layoutObject->isDescendantOf(layers[i].paintLayer->layoutObject())) | 2156 if (layoutObject->isDescendantOf(layers[i].paintLayer->layoutObject())) |
| 2157 return &layers[i]; | 2157 return &layers[i]; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2180 ClipRectsContext clipRectsContext(ancestorPaintInfo->paintLayer, UncachedCli
pRects); | 2180 ClipRectsContext clipRectsContext(ancestorPaintInfo->paintLayer, UncachedCli
pRects); |
| 2181 IntRect parentClipRect = pixelSnappedIntRect(paintInfo.paintLayer->clipper()
.backgroundClipRect(clipRectsContext).rect()); | 2181 IntRect parentClipRect = pixelSnappedIntRect(paintInfo.paintLayer->clipper()
.backgroundClipRect(clipRectsContext).rect()); |
| 2182 ASSERT(parentClipRect != LayoutRect::infiniteIntRect()); | 2182 ASSERT(parentClipRect != LayoutRect::infiniteIntRect()); |
| 2183 | 2183 |
| 2184 // Convert from ancestor to local coordinates. | 2184 // Convert from ancestor to local coordinates. |
| 2185 IntSize ancestorToLocalOffset = paintInfo.offsetFromLayoutObject - ancestorP
aintInfo->offsetFromLayoutObject; | 2185 IntSize ancestorToLocalOffset = paintInfo.offsetFromLayoutObject - ancestorP
aintInfo->offsetFromLayoutObject; |
| 2186 parentClipRect.move(ancestorToLocalOffset); | 2186 parentClipRect.move(ancestorToLocalOffset); |
| 2187 return parentClipRect; | 2187 return parentClipRect; |
| 2188 } | 2188 } |
| 2189 | 2189 |
| 2190 void CompositedLayerMapping::doPaintTask(const GraphicsLayerPaintInfo& paintInfo
, const PaintLayerFlags& paintLayerFlags, GraphicsContext* context, | 2190 void CompositedLayerMapping::doPaintTask(const GraphicsLayerPaintInfo& paintInfo
, const GraphicsLayer& graphicsLayer, const PaintLayerFlags& paintLayerFlags, Gr
aphicsContext* context, |
| 2191 const IntRect& clip /* In the coords of rootLayer */) const | 2191 const IntRect& clip /* In the coords of rootLayer */) const |
| 2192 { | 2192 { |
| 2193 FontCachePurgePreventer fontCachePurgePreventer; | 2193 FontCachePurgePreventer fontCachePurgePreventer; |
| 2194 | 2194 |
| 2195 IntSize offset = paintInfo.offsetFromLayoutObject; | 2195 IntSize offset = paintInfo.offsetFromLayoutObject; |
| 2196 AffineTransform translation; | 2196 AffineTransform translation; |
| 2197 translation.translate(-offset.width(), -offset.height()); | 2197 translation.translate(-offset.width(), -offset.height()); |
| 2198 TransformRecorder transformRecorder(*context, *this, translation); | 2198 TransformRecorder transformRecorder(*context, graphicsLayer, translation); |
| 2199 | 2199 |
| 2200 // The dirtyRect is in the coords of the painting root. | 2200 // The dirtyRect is in the coords of the painting root. |
| 2201 IntRect dirtyRect(clip); | 2201 IntRect dirtyRect(clip); |
| 2202 dirtyRect.move(offset); | 2202 dirtyRect.move(offset); |
| 2203 | 2203 |
| 2204 if (!(paintLayerFlags & PaintLayerPaintingOverflowContents)) { | 2204 if (!(paintLayerFlags & PaintLayerPaintingOverflowContents)) { |
| 2205 LayoutRect bounds = paintInfo.compositedBounds; | 2205 LayoutRect bounds = paintInfo.compositedBounds; |
| 2206 bounds.move(paintInfo.paintLayer->subpixelAccumulation()); | 2206 bounds.move(paintInfo.paintLayer->subpixelAccumulation()); |
| 2207 dirtyRect.intersect(pixelSnappedIntRect(bounds)); | 2207 dirtyRect.intersect(pixelSnappedIntRect(bounds)); |
| 2208 } else { | 2208 } else { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2225 PaintLayerPainter(*paintInfo.paintLayer).paintLayerContents(context,
paintingInfo, paintLayerFlags | PaintLayerPaintingOverlayScrollbars); | 2225 PaintLayerPainter(*paintInfo.paintLayer).paintLayerContents(context,
paintingInfo, paintLayerFlags | PaintLayerPaintingOverlayScrollbars); |
| 2226 } else { | 2226 } else { |
| 2227 PaintLayerPaintingInfo paintingInfo(paintInfo.paintLayer, LayoutRect(dir
tyRect), GlobalPaintNormalPhase, paintInfo.paintLayer->subpixelAccumulation()); | 2227 PaintLayerPaintingInfo paintingInfo(paintInfo.paintLayer, LayoutRect(dir
tyRect), GlobalPaintNormalPhase, paintInfo.paintLayer->subpixelAccumulation()); |
| 2228 | 2228 |
| 2229 // PaintLayer::paintLayer assumes that the caller clips to the passed re
ct. Squashed layers need to do this clipping in software, | 2229 // PaintLayer::paintLayer assumes that the caller clips to the passed re
ct. Squashed layers need to do this clipping in software, |
| 2230 // since there is no graphics layer to clip them precisely. Furthermore,
in some cases we squash layers that need clipping in software | 2230 // since there is no graphics layer to clip them precisely. Furthermore,
in some cases we squash layers that need clipping in software |
| 2231 // from clipping ancestors (see CompositedLayerMapping::localClipRectFor
SquashedLayer()). | 2231 // from clipping ancestors (see CompositedLayerMapping::localClipRectFor
SquashedLayer()). |
| 2232 // FIXME: Is it correct to clip to dirtyRect in slimming paint mode? | 2232 // FIXME: Is it correct to clip to dirtyRect in slimming paint mode? |
| 2233 // FIXME: Combine similar code here and LayerClipRecorder. | 2233 // FIXME: Combine similar code here and LayerClipRecorder. |
| 2234 dirtyRect.intersect(paintInfo.localClipRectForSquashedLayer); | 2234 dirtyRect.intersect(paintInfo.localClipRectForSquashedLayer); |
| 2235 context->paintController().createAndAppend<ClipDisplayItem>(*this, Displ
ayItem::ClipLayerOverflowControls, dirtyRect); | 2235 context->paintController().createAndAppend<ClipDisplayItem>(graphicsLaye
r, DisplayItem::ClipLayerOverflowControls, dirtyRect); |
| 2236 | 2236 |
| 2237 PaintLayerPainter(*paintInfo.paintLayer).paintLayer(context, paintingInf
o, paintLayerFlags); | 2237 PaintLayerPainter(*paintInfo.paintLayer).paintLayer(context, paintingInf
o, paintLayerFlags); |
| 2238 context->paintController().endItem<EndClipDisplayItem>(*this, DisplayIte
m::clipTypeToEndClipType(DisplayItem::ClipLayerOverflowControls)); | 2238 context->paintController().endItem<EndClipDisplayItem>(graphicsLayer, Di
splayItem::clipTypeToEndClipType(DisplayItem::ClipLayerOverflowControls)); |
| 2239 } | 2239 } |
| 2240 } | 2240 } |
| 2241 | 2241 |
| 2242 static void paintScrollbar(const Scrollbar* scrollbar, GraphicsContext& context,
const IntRect& clip) | 2242 static void paintScrollbar(const Scrollbar* scrollbar, GraphicsContext& context,
const IntRect& clip) |
| 2243 { | 2243 { |
| 2244 if (!scrollbar) | 2244 if (!scrollbar) |
| 2245 return; | 2245 return; |
| 2246 | 2246 |
| 2247 const IntRect& scrollbarRect = scrollbar->frameRect(); | 2247 const IntRect& scrollbarRect = scrollbar->frameRect(); |
| 2248 TransformRecorder transformRecorder(context, *scrollbar, AffineTransform::tr
anslation(-scrollbarRect.x(), -scrollbarRect.y())); | 2248 TransformRecorder transformRecorder(context, *scrollbar, AffineTransform::tr
anslation(-scrollbarRect.x(), -scrollbarRect.y())); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2395 || graphicsLayer == m_childClippingMaskLayer.get() | 2395 || graphicsLayer == m_childClippingMaskLayer.get() |
| 2396 || graphicsLayer == m_scrollingContentsLayer.get() | 2396 || graphicsLayer == m_scrollingContentsLayer.get() |
| 2397 || graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2397 || graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
| 2398 | 2398 |
| 2399 GraphicsLayerPaintInfo paintInfo; | 2399 GraphicsLayerPaintInfo paintInfo; |
| 2400 paintInfo.paintLayer = &m_owningLayer; | 2400 paintInfo.paintLayer = &m_owningLayer; |
| 2401 paintInfo.compositedBounds = compositedBounds(); | 2401 paintInfo.compositedBounds = compositedBounds(); |
| 2402 paintInfo.offsetFromLayoutObject = graphicsLayer->offsetFromLayoutObject
(); | 2402 paintInfo.offsetFromLayoutObject = graphicsLayer->offsetFromLayoutObject
(); |
| 2403 | 2403 |
| 2404 // We have to use the same root as for hit testing, because both methods
can compute and cache clipRects. | 2404 // We have to use the same root as for hit testing, because both methods
can compute and cache clipRects. |
| 2405 doPaintTask(paintInfo, paintLayerFlags, &context, interestRect); | 2405 doPaintTask(paintInfo, *graphicsLayer, paintLayerFlags, &context, intere
stRect); |
| 2406 } else if (graphicsLayer == m_squashingLayer.get()) { | 2406 } else if (graphicsLayer == m_squashingLayer.get()) { |
| 2407 for (size_t i = 0; i < m_squashedLayers.size(); ++i) | 2407 for (size_t i = 0; i < m_squashedLayers.size(); ++i) |
| 2408 doPaintTask(m_squashedLayers[i], paintLayerFlags, &context, interest
Rect); | 2408 doPaintTask(m_squashedLayers[i], *graphicsLayer, paintLayerFlags, &c
ontext, interestRect); |
| 2409 } else if (graphicsLayer == layerForHorizontalScrollbar()) { | 2409 } else if (graphicsLayer == layerForHorizontalScrollbar()) { |
| 2410 paintScrollbar(m_owningLayer.scrollableArea()->horizontalScrollbar(), co
ntext, interestRect); | 2410 paintScrollbar(m_owningLayer.scrollableArea()->horizontalScrollbar(), co
ntext, interestRect); |
| 2411 } else if (graphicsLayer == layerForVerticalScrollbar()) { | 2411 } else if (graphicsLayer == layerForVerticalScrollbar()) { |
| 2412 paintScrollbar(m_owningLayer.scrollableArea()->verticalScrollbar(), cont
ext, interestRect); | 2412 paintScrollbar(m_owningLayer.scrollableArea()->verticalScrollbar(), cont
ext, interestRect); |
| 2413 } else if (graphicsLayer == layerForScrollCorner()) { | 2413 } else if (graphicsLayer == layerForScrollCorner()) { |
| 2414 IntPoint scrollCornerAndResizerLocation = m_owningLayer.scrollableArea()
->scrollCornerAndResizerRect().location(); | 2414 IntPoint scrollCornerAndResizerLocation = m_owningLayer.scrollableArea()
->scrollCornerAndResizerRect().location(); |
| 2415 CullRect cullRect(enclosingIntRect(interestRect)); | 2415 CullRect cullRect(enclosingIntRect(interestRect)); |
| 2416 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintScrollCorner
(&context, -scrollCornerAndResizerLocation, cullRect); | 2416 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintScrollCorner
(&context, -scrollCornerAndResizerLocation, cullRect); |
| 2417 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintResizer(&con
text, -scrollCornerAndResizerLocation, cullRect); | 2417 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintResizer(&con
text, -scrollCornerAndResizerLocation, cullRect); |
| 2418 } | 2418 } |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2601 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2601 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
| 2602 name = "Scrolling Block Selection Layer"; | 2602 name = "Scrolling Block Selection Layer"; |
| 2603 } else { | 2603 } else { |
| 2604 ASSERT_NOT_REACHED(); | 2604 ASSERT_NOT_REACHED(); |
| 2605 } | 2605 } |
| 2606 | 2606 |
| 2607 return name; | 2607 return name; |
| 2608 } | 2608 } |
| 2609 | 2609 |
| 2610 } // namespace blink | 2610 } // namespace blink |
| OLD | NEW |