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 2256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2267 if (!scrollbar) | 2267 if (!scrollbar) |
2268 return; | 2268 return; |
2269 | 2269 |
2270 const IntRect& scrollbarRect = scrollbar->frameRect(); | 2270 const IntRect& scrollbarRect = scrollbar->frameRect(); |
2271 TransformRecorder transformRecorder(context, *scrollbar, AffineTransform::tr
anslation(-scrollbarRect.x(), -scrollbarRect.y())); | 2271 TransformRecorder transformRecorder(context, *scrollbar, AffineTransform::tr
anslation(-scrollbarRect.x(), -scrollbarRect.y())); |
2272 IntRect transformedClip = clip; | 2272 IntRect transformedClip = clip; |
2273 transformedClip.moveBy(scrollbarRect.location()); | 2273 transformedClip.moveBy(scrollbarRect.location()); |
2274 scrollbar->paint(context, CullRect(transformedClip)); | 2274 scrollbar->paint(context, CullRect(transformedClip)); |
2275 } | 2275 } |
2276 | 2276 |
| 2277 // TODO(eseckler): Make recording distance configurable, e.g. for use in |
| 2278 // headless, where we would like to record an exact area (distance = 0). |
2277 static const int kPixelDistanceToRecord = 4000; | 2279 static const int kPixelDistanceToRecord = 4000; |
2278 | 2280 |
2279 IntRect CompositedLayerMapping::recomputeInterestRect(const GraphicsLayer* graph
icsLayer) const | 2281 IntRect CompositedLayerMapping::recomputeInterestRect(const GraphicsLayer* graph
icsLayer) const |
2280 { | 2282 { |
2281 FloatRect graphicsLayerBounds(FloatPoint(), graphicsLayer->size()); | 2283 FloatRect graphicsLayerBounds(FloatPoint(), graphicsLayer->size()); |
2282 | 2284 |
2283 IntSize offsetFromAnchorLayoutObject; | 2285 IntSize offsetFromAnchorLayoutObject; |
2284 const LayoutBoxModelObject* anchorLayoutObject; | 2286 const LayoutBoxModelObject* anchorLayoutObject; |
2285 if (graphicsLayer == m_squashingLayer.get()) { | 2287 if (graphicsLayer == m_squashingLayer.get()) { |
2286 // TODO(chrishtr): this is a speculative fix for crbug.com/561306. Howev
er, it should never be the case that | 2288 // TODO(chrishtr): this is a speculative fix for crbug.com/561306. Howev
er, it should never be the case that |
(...skipping 15 matching lines...) Expand all Loading... |
2302 // Start with the bounds of the graphics layer in the space of the anchor La
youtObject. | 2304 // Start with the bounds of the graphics layer in the space of the anchor La
youtObject. |
2303 FloatRect graphicsLayerBoundsInObjectSpace(graphicsLayerBounds); | 2305 FloatRect graphicsLayerBoundsInObjectSpace(graphicsLayerBounds); |
2304 graphicsLayerBoundsInObjectSpace.move(offsetFromAnchorLayoutObject); | 2306 graphicsLayerBoundsInObjectSpace.move(offsetFromAnchorLayoutObject); |
2305 | 2307 |
2306 // Now map the bounds to its visible content rect in screen space, including
applying clips along the way. | 2308 // Now map the bounds to its visible content rect in screen space, including
applying clips along the way. |
2307 LayoutRect visibleContentRect(graphicsLayerBoundsInObjectSpace); | 2309 LayoutRect visibleContentRect(graphicsLayerBoundsInObjectSpace); |
2308 LayoutView* rootView = anchorLayoutObject->view(); | 2310 LayoutView* rootView = anchorLayoutObject->view(); |
2309 while (rootView->frame()->ownerLayoutObject()) | 2311 while (rootView->frame()->ownerLayoutObject()) |
2310 rootView = rootView->frame()->ownerLayoutObject()->view(); | 2312 rootView = rootView->frame()->ownerLayoutObject()->view(); |
2311 anchorLayoutObject->mapToVisualRectInAncestorSpace(rootView, visibleContentR
ect); | 2313 anchorLayoutObject->mapToVisualRectInAncestorSpace(rootView, visibleContentR
ect); |
2312 visibleContentRect.intersect(LayoutRect(rootView->frameView()->visibleConten
tRect())); | 2314 visibleContentRect.intersect(LayoutRect(rootView->frameView()->visibleConten
tRectForRecording())); |
2313 | 2315 |
2314 IntRect enclosingGraphicsLayerBounds(enclosingIntRect(graphicsLayerBounds)); | 2316 IntRect enclosingGraphicsLayerBounds(enclosingIntRect(graphicsLayerBounds)); |
2315 | 2317 |
2316 // Map the visible content rect from screen space to local graphics layer sp
ace. | 2318 // Map the visible content rect from screen space to local graphics layer sp
ace. |
2317 IntRect localInterestRect; | 2319 IntRect localInterestRect; |
2318 // If the visible content rect is empty, then it makes no sense to map it ba
ck since there is nothing to map. | 2320 // If the visible content rect is empty, then it makes no sense to map it ba
ck since there is nothing to map. |
2319 if (!visibleContentRect.isEmpty()) { | 2321 if (!visibleContentRect.isEmpty()) { |
2320 localInterestRect = anchorLayoutObject->absoluteToLocalQuad(FloatRect(vi
sibleContentRect), UseTransforms | TraverseDocumentBoundaries).enclosingBounding
Box(); | 2322 localInterestRect = anchorLayoutObject->absoluteToLocalQuad(FloatRect(vi
sibleContentRect), UseTransforms | TraverseDocumentBoundaries).enclosingBounding
Box(); |
2321 localInterestRect.move(-offsetFromAnchorLayoutObject); | 2323 localInterestRect.move(-offsetFromAnchorLayoutObject); |
2322 // TODO(chrishtr): the code below is a heuristic, instead we should dete
ct and return whether the mapping failed. | 2324 // TODO(chrishtr): the code below is a heuristic, instead we should dete
ct and return whether the mapping failed. |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2672 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2674 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
2673 name = "Scrolling Contents Layer"; | 2675 name = "Scrolling Contents Layer"; |
2674 } else { | 2676 } else { |
2675 ASSERT_NOT_REACHED(); | 2677 ASSERT_NOT_REACHED(); |
2676 } | 2678 } |
2677 | 2679 |
2678 return name; | 2680 return name; |
2679 } | 2681 } |
2680 | 2682 |
2681 } // namespace blink | 2683 } // namespace blink |
OLD | NEW |