| 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 2262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2273 PaintLayerPainter(*paintInfo.paintLayer).paintLayerContents(context,
paintingInfo, paintLayerFlags | PaintLayerPaintingOverlayScrollbars); | 2273 PaintLayerPainter(*paintInfo.paintLayer).paintLayerContents(context,
paintingInfo, paintLayerFlags | PaintLayerPaintingOverlayScrollbars); |
| 2274 } else { | 2274 } else { |
| 2275 PaintLayerPaintingInfo paintingInfo(paintInfo.paintLayer, LayoutRect(dir
tyRect), GlobalPaintNormalPhase, paintInfo.paintLayer->subpixelAccumulation()); | 2275 PaintLayerPaintingInfo paintingInfo(paintInfo.paintLayer, LayoutRect(dir
tyRect), GlobalPaintNormalPhase, paintInfo.paintLayer->subpixelAccumulation()); |
| 2276 | 2276 |
| 2277 // PaintLayer::paintLayer assumes that the caller clips to the passed re
ct. Squashed layers need to do this clipping in software, | 2277 // PaintLayer::paintLayer assumes that the caller clips to the passed re
ct. Squashed layers need to do this clipping in software, |
| 2278 // since there is no graphics layer to clip them precisely. Furthermore,
in some cases we squash layers that need clipping in software | 2278 // since there is no graphics layer to clip them precisely. Furthermore,
in some cases we squash layers that need clipping in software |
| 2279 // from clipping ancestors (see CompositedLayerMapping::localClipRectFor
SquashedLayer()). | 2279 // from clipping ancestors (see CompositedLayerMapping::localClipRectFor
SquashedLayer()). |
| 2280 // FIXME: Is it correct to clip to dirtyRect in slimming paint mode? | 2280 // FIXME: Is it correct to clip to dirtyRect in slimming paint mode? |
| 2281 // FIXME: Combine similar code here and LayerClipRecorder. | 2281 // FIXME: Combine similar code here and LayerClipRecorder. |
| 2282 dirtyRect.intersect(paintInfo.localClipRectForSquashedLayer); | 2282 dirtyRect.intersect(paintInfo.localClipRectForSquashedLayer); |
| 2283 context.getPaintController().createAndAppend<ClipDisplayItem>(graphicsLa
yer, DisplayItem::ClipLayerOverflowControls, dirtyRect); | 2283 context.getPaintController().createAndAppend<ClipDisplayItem>(graphicsLa
yer, DisplayItem::kClipLayerOverflowControls, dirtyRect); |
| 2284 | 2284 |
| 2285 PaintLayerPainter(*paintInfo.paintLayer).paintLayer(context, paintingInf
o, paintLayerFlags); | 2285 PaintLayerPainter(*paintInfo.paintLayer).paintLayer(context, paintingInf
o, paintLayerFlags); |
| 2286 context.getPaintController().endItem<EndClipDisplayItem>(graphicsLayer,
DisplayItem::clipTypeToEndClipType(DisplayItem::ClipLayerOverflowControls)); | 2286 context.getPaintController().endItem<EndClipDisplayItem>(graphicsLayer,
DisplayItem::clipTypeToEndClipType(DisplayItem::kClipLayerOverflowControls)); |
| 2287 } | 2287 } |
| 2288 } | 2288 } |
| 2289 | 2289 |
| 2290 static void paintScrollbar(const Scrollbar* scrollbar, GraphicsContext& context,
const IntRect& clip) | 2290 static void paintScrollbar(const Scrollbar* scrollbar, GraphicsContext& context,
const IntRect& clip) |
| 2291 { | 2291 { |
| 2292 if (!scrollbar) | 2292 if (!scrollbar) |
| 2293 return; | 2293 return; |
| 2294 | 2294 |
| 2295 const IntRect& scrollbarRect = scrollbar->frameRect(); | 2295 const IntRect& scrollbarRect = scrollbar->frameRect(); |
| 2296 TransformRecorder transformRecorder(context, *scrollbar, AffineTransform::tr
anslation(-scrollbarRect.x(), -scrollbarRect.y())); | 2296 TransformRecorder transformRecorder(context, *scrollbar, AffineTransform::tr
anslation(-scrollbarRect.x(), -scrollbarRect.y())); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2503 page->setIsPainting(false); | 2503 page->setIsPainting(false); |
| 2504 #endif | 2504 #endif |
| 2505 } | 2505 } |
| 2506 | 2506 |
| 2507 void CompositedLayerMapping::paintScrollableArea(const GraphicsLayer* graphicsLa
yer, | 2507 void CompositedLayerMapping::paintScrollableArea(const GraphicsLayer* graphicsLa
yer, |
| 2508 GraphicsContext& context, const IntRect& interestRect) const | 2508 GraphicsContext& context, const IntRect& interestRect) const |
| 2509 { | 2509 { |
| 2510 // Note the composited scrollable area painted here is never associated with
a frame. For | 2510 // Note the composited scrollable area painted here is never associated with
a frame. For |
| 2511 // painting frame ScrollableAreas, see PaintLayerCompositor::paintContents. | 2511 // painting frame ScrollableAreas, see PaintLayerCompositor::paintContents. |
| 2512 | 2512 |
| 2513 if (DrawingRecorder::useCachedDrawingIfPossible(context, *graphicsLayer, Dis
playItem::ScrollbarCompositedScrollbar)) | 2513 if (DrawingRecorder::useCachedDrawingIfPossible(context, *graphicsLayer, Dis
playItem::kScrollbarCompositedScrollbar)) |
| 2514 return; | 2514 return; |
| 2515 | 2515 |
| 2516 FloatRect layerBounds(FloatPoint(), graphicsLayer->size()); | 2516 FloatRect layerBounds(FloatPoint(), graphicsLayer->size()); |
| 2517 SkPictureBuilder pictureBuilder(layerBounds, nullptr, &context); | 2517 SkPictureBuilder pictureBuilder(layerBounds, nullptr, &context); |
| 2518 PaintLayerScrollableArea* scrollableArea = m_owningLayer.getScrollableArea()
; | 2518 PaintLayerScrollableArea* scrollableArea = m_owningLayer.getScrollableArea()
; |
| 2519 if (graphicsLayer == layerForHorizontalScrollbar()) { | 2519 if (graphicsLayer == layerForHorizontalScrollbar()) { |
| 2520 paintScrollbar(scrollableArea->horizontalScrollbar(), pictureBuilder.con
text(), interestRect); | 2520 paintScrollbar(scrollableArea->horizontalScrollbar(), pictureBuilder.con
text(), interestRect); |
| 2521 } else if (graphicsLayer == layerForVerticalScrollbar()) { | 2521 } else if (graphicsLayer == layerForVerticalScrollbar()) { |
| 2522 paintScrollbar(scrollableArea->verticalScrollbar(), pictureBuilder.conte
xt(), interestRect); | 2522 paintScrollbar(scrollableArea->verticalScrollbar(), pictureBuilder.conte
xt(), interestRect); |
| 2523 } else if (graphicsLayer == layerForScrollCorner()) { | 2523 } else if (graphicsLayer == layerForScrollCorner()) { |
| 2524 // Note that scroll corners always paint into local space, whereas scrol
lbars paint in the space of their containing frame. | 2524 // Note that scroll corners always paint into local space, whereas scrol
lbars paint in the space of their containing frame. |
| 2525 IntPoint scrollCornerAndResizerLocation = scrollableArea->scrollCornerAn
dResizerRect().location(); | 2525 IntPoint scrollCornerAndResizerLocation = scrollableArea->scrollCornerAn
dResizerRect().location(); |
| 2526 CullRect cullRect(enclosingIntRect(interestRect)); | 2526 CullRect cullRect(enclosingIntRect(interestRect)); |
| 2527 ScrollableAreaPainter(*scrollableArea).paintScrollCorner(pictureBuilder.
context(), -scrollCornerAndResizerLocation, cullRect); | 2527 ScrollableAreaPainter(*scrollableArea).paintScrollCorner(pictureBuilder.
context(), -scrollCornerAndResizerLocation, cullRect); |
| 2528 ScrollableAreaPainter(*scrollableArea).paintResizer(pictureBuilder.conte
xt(), -scrollCornerAndResizerLocation, cullRect); | 2528 ScrollableAreaPainter(*scrollableArea).paintResizer(pictureBuilder.conte
xt(), -scrollCornerAndResizerLocation, cullRect); |
| 2529 } | 2529 } |
| 2530 // Replay the painted scrollbar content with the GraphicsLayer backing as th
e DisplayItemClient | 2530 // Replay the painted scrollbar content with the GraphicsLayer backing as th
e DisplayItemClient |
| 2531 // in order for the resulting DrawingDisplayItem to produce the correct visu
alRect (i.e., the | 2531 // in order for the resulting DrawingDisplayItem to produce the correct visu
alRect (i.e., the |
| 2532 // bounds of the involved GraphicsLayer). | 2532 // bounds of the involved GraphicsLayer). |
| 2533 DrawingRecorder drawingRecorder(context, *graphicsLayer, DisplayItem::Scroll
barCompositedScrollbar, layerBounds); | 2533 DrawingRecorder drawingRecorder(context, *graphicsLayer, DisplayItem::kScrol
lbarCompositedScrollbar, layerBounds); |
| 2534 pictureBuilder.endRecording()->playback(context.canvas()); | 2534 pictureBuilder.endRecording()->playback(context.canvas()); |
| 2535 } | 2535 } |
| 2536 | 2536 |
| 2537 bool CompositedLayerMapping::isScrollableAreaLayer(const GraphicsLayer* graphics
Layer) const | 2537 bool CompositedLayerMapping::isScrollableAreaLayer(const GraphicsLayer* graphics
Layer) const |
| 2538 { | 2538 { |
| 2539 return graphicsLayer == layerForHorizontalScrollbar() | 2539 return graphicsLayer == layerForHorizontalScrollbar() |
| 2540 || graphicsLayer == layerForVerticalScrollbar() | 2540 || graphicsLayer == layerForVerticalScrollbar() |
| 2541 || graphicsLayer == layerForScrollCorner(); | 2541 || graphicsLayer == layerForScrollCorner(); |
| 2542 } | 2542 } |
| 2543 | 2543 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2703 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2703 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
| 2704 name = "Scrolling Contents Layer"; | 2704 name = "Scrolling Contents Layer"; |
| 2705 } else { | 2705 } else { |
| 2706 ASSERT_NOT_REACHED(); | 2706 ASSERT_NOT_REACHED(); |
| 2707 } | 2707 } |
| 2708 | 2708 |
| 2709 return name; | 2709 return name; |
| 2710 } | 2710 } |
| 2711 | 2711 |
| 2712 } // namespace blink | 2712 } // namespace blink |
| OLD | NEW |