| 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 2264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2275 if (!scrollbar) | 2275 if (!scrollbar) |
| 2276 return; | 2276 return; |
| 2277 | 2277 |
| 2278 const IntRect& scrollbarRect = scrollbar->frameRect(); | 2278 const IntRect& scrollbarRect = scrollbar->frameRect(); |
| 2279 TransformRecorder transformRecorder(context, *scrollbar, AffineTransform::tr
anslation(-scrollbarRect.x(), -scrollbarRect.y())); | 2279 TransformRecorder transformRecorder(context, *scrollbar, AffineTransform::tr
anslation(-scrollbarRect.x(), -scrollbarRect.y())); |
| 2280 IntRect transformedClip = clip; | 2280 IntRect transformedClip = clip; |
| 2281 transformedClip.moveBy(scrollbarRect.location()); | 2281 transformedClip.moveBy(scrollbarRect.location()); |
| 2282 scrollbar->paint(context, CullRect(transformedClip)); | 2282 scrollbar->paint(context, CullRect(transformedClip)); |
| 2283 } | 2283 } |
| 2284 | 2284 |
| 2285 // TODO(eseckler): Make recording distance configurable, e.g. for use in |
| 2286 // headless, where we would like to record an exact area (distance = 0). |
| 2285 static const int kPixelDistanceToRecord = 4000; | 2287 static const int kPixelDistanceToRecord = 4000; |
| 2286 | 2288 |
| 2287 IntRect CompositedLayerMapping::recomputeInterestRect(const GraphicsLayer* graph
icsLayer) const | 2289 IntRect CompositedLayerMapping::recomputeInterestRect(const GraphicsLayer* graph
icsLayer) const |
| 2288 { | 2290 { |
| 2289 FloatRect graphicsLayerBounds(FloatPoint(), graphicsLayer->size()); | 2291 FloatRect graphicsLayerBounds(FloatPoint(), graphicsLayer->size()); |
| 2290 | 2292 |
| 2291 IntSize offsetFromAnchorLayoutObject; | 2293 IntSize offsetFromAnchorLayoutObject; |
| 2292 const LayoutBoxModelObject* anchorLayoutObject; | 2294 const LayoutBoxModelObject* anchorLayoutObject; |
| 2293 if (graphicsLayer == m_squashingLayer.get()) { | 2295 if (graphicsLayer == m_squashingLayer.get()) { |
| 2294 // TODO(chrishtr): this is a speculative fix for crbug.com/561306. Howev
er, it should never be the case that | 2296 // 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... |
| 2310 // Start with the bounds of the graphics layer in the space of the anchor La
youtObject. | 2312 // Start with the bounds of the graphics layer in the space of the anchor La
youtObject. |
| 2311 FloatRect graphicsLayerBoundsInObjectSpace(graphicsLayerBounds); | 2313 FloatRect graphicsLayerBoundsInObjectSpace(graphicsLayerBounds); |
| 2312 graphicsLayerBoundsInObjectSpace.move(offsetFromAnchorLayoutObject); | 2314 graphicsLayerBoundsInObjectSpace.move(offsetFromAnchorLayoutObject); |
| 2313 | 2315 |
| 2314 // Now map the bounds to its visible content rect in screen space, including
applying clips along the way. | 2316 // Now map the bounds to its visible content rect in screen space, including
applying clips along the way. |
| 2315 LayoutRect visibleContentRect(graphicsLayerBoundsInObjectSpace); | 2317 LayoutRect visibleContentRect(graphicsLayerBoundsInObjectSpace); |
| 2316 LayoutView* rootView = anchorLayoutObject->view(); | 2318 LayoutView* rootView = anchorLayoutObject->view(); |
| 2317 while (rootView->frame()->ownerLayoutObject()) | 2319 while (rootView->frame()->ownerLayoutObject()) |
| 2318 rootView = rootView->frame()->ownerLayoutObject()->view(); | 2320 rootView = rootView->frame()->ownerLayoutObject()->view(); |
| 2319 anchorLayoutObject->mapToVisualRectInAncestorSpace(rootView, visibleContentR
ect); | 2321 anchorLayoutObject->mapToVisualRectInAncestorSpace(rootView, visibleContentR
ect); |
| 2320 visibleContentRect.intersect(LayoutRect(rootView->frameView()->visibleConten
tRect())); | 2322 visibleContentRect.intersect(LayoutRect(rootView->frameView()->visibleConten
tRectForPainting())); |
| 2321 | 2323 |
| 2322 IntRect enclosingGraphicsLayerBounds(enclosingIntRect(graphicsLayerBounds)); | 2324 IntRect enclosingGraphicsLayerBounds(enclosingIntRect(graphicsLayerBounds)); |
| 2323 | 2325 |
| 2324 // Map the visible content rect from screen space to local graphics layer sp
ace. | 2326 // Map the visible content rect from screen space to local graphics layer sp
ace. |
| 2325 IntRect localInterestRect; | 2327 IntRect localInterestRect; |
| 2326 // If the visible content rect is empty, then it makes no sense to map it ba
ck since there is nothing to map. | 2328 // If the visible content rect is empty, then it makes no sense to map it ba
ck since there is nothing to map. |
| 2327 if (!visibleContentRect.isEmpty()) { | 2329 if (!visibleContentRect.isEmpty()) { |
| 2328 localInterestRect = anchorLayoutObject->absoluteToLocalQuad(FloatRect(vi
sibleContentRect), UseTransforms | TraverseDocumentBoundaries).enclosingBounding
Box(); | 2330 localInterestRect = anchorLayoutObject->absoluteToLocalQuad(FloatRect(vi
sibleContentRect), UseTransforms | TraverseDocumentBoundaries).enclosingBounding
Box(); |
| 2329 localInterestRect.move(-offsetFromAnchorLayoutObject); | 2331 localInterestRect.move(-offsetFromAnchorLayoutObject); |
| 2330 // TODO(chrishtr): the code below is a heuristic, instead we should dete
ct and return whether the mapping failed. | 2332 // TODO(chrishtr): the code below is a heuristic, instead we should dete
ct and return whether the mapping failed. |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2691 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2693 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
| 2692 name = "Scrolling Contents Layer"; | 2694 name = "Scrolling Contents Layer"; |
| 2693 } else { | 2695 } else { |
| 2694 ASSERT_NOT_REACHED(); | 2696 ASSERT_NOT_REACHED(); |
| 2695 } | 2697 } |
| 2696 | 2698 |
| 2697 return name; | 2699 return name; |
| 2698 } | 2700 } |
| 2699 | 2701 |
| 2700 } // namespace blink | 2702 } // namespace blink |
| OLD | NEW |