| 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 RenderView* view = m_owningLayer->renderer()->view(); | 359 RenderView* view = m_owningLayer->renderer()->view(); |
| 360 RenderLayer* rootLayer = view->layer(); | 360 RenderLayer* rootLayer = view->layer(); |
| 361 | 361 |
| 362 LayoutRect clippingBounds; | 362 LayoutRect clippingBounds; |
| 363 if (renderer()->style()->position() == FixedPosition && renderer()->cont
ainer() == view) | 363 if (renderer()->style()->position() == FixedPosition && renderer()->cont
ainer() == view) |
| 364 clippingBounds = view->frameView()->viewportConstrainedVisibleConten
tRect(); | 364 clippingBounds = view->frameView()->viewportConstrainedVisibleConten
tRect(); |
| 365 else | 365 else |
| 366 clippingBounds = view->unscaledDocumentRect(); | 366 clippingBounds = view->unscaledDocumentRect(); |
| 367 | 367 |
| 368 if (m_owningLayer != rootLayer) | 368 if (m_owningLayer != rootLayer) |
| 369 clippingBounds.intersect(m_owningLayer->clipper().backgroundClipRect
(ClipRectsContext(rootLayer, 0, AbsoluteClipRects)).rect()); // FIXME: Incorrect
for CSS regions. | 369 clippingBounds.intersect(m_owningLayer->clipper().backgroundClipRect
(ClipRectsContext(rootLayer, AbsoluteClipRects)).rect()); |
| 370 | 370 |
| 371 LayoutPoint delta; | 371 LayoutPoint delta; |
| 372 m_owningLayer->convertToLayerCoords(rootLayer, delta); | 372 m_owningLayer->convertToLayerCoords(rootLayer, delta); |
| 373 clippingBounds.move(-delta.x(), -delta.y()); | 373 clippingBounds.move(-delta.x(), -delta.y()); |
| 374 | 374 |
| 375 layerBounds.intersect(clippingBounds); | 375 layerBounds.intersect(clippingBounds); |
| 376 } | 376 } |
| 377 | 377 |
| 378 // If the element has a transform-origin that has fixed lengths, and the ren
derer has zero size, | 378 // If the element has a transform-origin that has fixed lengths, and the ren
derer has zero size, |
| 379 // then we need to ensure that the compositing layer has non-zero size so th
at we can apply | 379 // then we need to ensure that the compositing layer has non-zero size so th
at we can apply |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 if (renderer->isRenderPart()) | 532 if (renderer->isRenderPart()) |
| 533 layerConfigChanged = RenderLayerCompositor::parentFrameContentLayers(toR
enderPart(renderer)); | 533 layerConfigChanged = RenderLayerCompositor::parentFrameContentLayers(toR
enderPart(renderer)); |
| 534 | 534 |
| 535 return layerConfigChanged; | 535 return layerConfigChanged; |
| 536 } | 536 } |
| 537 | 537 |
| 538 static IntRect clipBox(RenderBox* renderer) | 538 static IntRect clipBox(RenderBox* renderer) |
| 539 { | 539 { |
| 540 LayoutRect result = PaintInfo::infiniteRect(); | 540 LayoutRect result = PaintInfo::infiniteRect(); |
| 541 if (renderer->hasOverflowClip()) | 541 if (renderer->hasOverflowClip()) |
| 542 result = renderer->overflowClipRect(LayoutPoint(), 0); // FIXME: Incorre
ct for CSS regions. | 542 result = renderer->overflowClipRect(LayoutPoint()); |
| 543 | 543 |
| 544 if (renderer->hasClip()) | 544 if (renderer->hasClip()) |
| 545 result.intersect(renderer->clipRect(LayoutPoint(), 0)); // FIXME: Incorr
ect for CSS regions. | 545 result.intersect(renderer->clipRect(LayoutPoint())); |
| 546 | 546 |
| 547 return pixelSnappedIntRect(result); | 547 return pixelSnappedIntRect(result); |
| 548 } | 548 } |
| 549 | 549 |
| 550 void CompositedLayerMapping::adjustBoundsForSubPixelAccumulation(const RenderLay
er* compositedAncestor, IntRect& localBounds, IntRect& relativeBounds, IntPoint&
delta) | 550 void CompositedLayerMapping::adjustBoundsForSubPixelAccumulation(const RenderLay
er* compositedAncestor, IntRect& localBounds, IntRect& relativeBounds, IntPoint&
delta) |
| 551 { | 551 { |
| 552 LayoutRect localRawCompositingBounds = compositedBounds(); | 552 LayoutRect localRawCompositingBounds = compositedBounds(); |
| 553 LayoutPoint rawDelta; | 553 LayoutPoint rawDelta; |
| 554 m_owningLayer->convertToLayerCoords(compositedAncestor, rawDelta); | 554 m_owningLayer->convertToLayerCoords(compositedAncestor, rawDelta); |
| 555 delta = flooredIntPoint(rawDelta); | 555 delta = flooredIntPoint(rawDelta); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 RenderBox* renderBox = toRenderBox(compAncestor->renderer()); | 634 RenderBox* renderBox = toRenderBox(compAncestor->renderer()); |
| 635 IntSize scrollOffset = renderBox->scrolledContentOffset(); | 635 IntSize scrollOffset = renderBox->scrolledContentOffset(); |
| 636 IntPoint scrollOrigin(renderBox->borderLeft(), renderBox->borderTop()); | 636 IntPoint scrollOrigin(renderBox->borderLeft(), renderBox->borderTop()); |
| 637 graphicsLayerParentLocation = scrollOrigin - scrollOffset; | 637 graphicsLayerParentLocation = scrollOrigin - scrollOffset; |
| 638 } | 638 } |
| 639 | 639 |
| 640 if (compAncestor && m_ancestorClippingLayer) { | 640 if (compAncestor && m_ancestorClippingLayer) { |
| 641 // Call calculateRects to get the backgroundRect which is what is used t
o clip the contents of this | 641 // Call calculateRects to get the backgroundRect which is what is used t
o clip the contents of this |
| 642 // layer. Note that we call it with temporaryClipRects = true because no
rmally when computing clip rects | 642 // layer. Note that we call it with temporaryClipRects = true because no
rmally when computing clip rects |
| 643 // for a compositing layer, rootLayer is the layer itself. | 643 // for a compositing layer, rootLayer is the layer itself. |
| 644 ClipRectsContext clipRectsContext(compAncestor, 0, TemporaryClipRects, I
gnoreOverlayScrollbarSize, IgnoreOverflowClip); | 644 ClipRectsContext clipRectsContext(compAncestor, TemporaryClipRects, Igno
reOverlayScrollbarSize, IgnoreOverflowClip); |
| 645 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer->clipper().ba
ckgroundClipRect(clipRectsContext).rect()); // FIXME: Incorrect for CSS regions. | 645 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer->clipper().ba
ckgroundClipRect(clipRectsContext).rect()); // FIXME: Incorrect for CSS regions. |
| 646 ASSERT(parentClipRect != PaintInfo::infiniteRect()); | 646 ASSERT(parentClipRect != PaintInfo::infiniteRect()); |
| 647 m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location(
) - graphicsLayerParentLocation)); | 647 m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location(
) - graphicsLayerParentLocation)); |
| 648 m_ancestorClippingLayer->setSize(parentClipRect.size()); | 648 m_ancestorClippingLayer->setSize(parentClipRect.size()); |
| 649 | 649 |
| 650 // backgroundRect is relative to compAncestor, so subtract deltaX/deltaY
to get back to local coords. | 650 // backgroundRect is relative to compAncestor, so subtract deltaX/deltaY
to get back to local coords. |
| 651 m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location()
- delta); | 651 m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location()
- delta); |
| 652 | 652 |
| 653 // The primary layer is then parented in, and positioned relative to thi
s clipping layer. | 653 // The primary layer is then parented in, and positioned relative to thi
s clipping layer. |
| 654 graphicsLayerParentLocation = parentClipRect.location(); | 654 graphicsLayerParentLocation = parentClipRect.location(); |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 RenderObject* renderObject = renderer(); | 1471 RenderObject* renderObject = renderer(); |
| 1472 if (renderObject->hasMask()) // masks require special treatment | 1472 if (renderObject->hasMask()) // masks require special treatment |
| 1473 return false; | 1473 return false; |
| 1474 | 1474 |
| 1475 if (renderObject->isReplaced() && !isCompositedPlugin(renderObject)) | 1475 if (renderObject->isReplaced() && !isCompositedPlugin(renderObject)) |
| 1476 return false; | 1476 return false; |
| 1477 | 1477 |
| 1478 if (paintsBoxDecorations() || paintsChildren()) | 1478 if (paintsBoxDecorations() || paintsChildren()) |
| 1479 return false; | 1479 return false; |
| 1480 | 1480 |
| 1481 if (renderObject->isRenderRegion()) | |
| 1482 return false; | |
| 1483 | |
| 1484 if (renderObject->node() && renderObject->node()->isDocumentNode()) { | 1481 if (renderObject->node() && renderObject->node()->isDocumentNode()) { |
| 1485 // Look to see if the root object has a non-simple background | 1482 // Look to see if the root object has a non-simple background |
| 1486 RenderObject* rootObject = renderObject->document().documentElement() ?
renderObject->document().documentElement()->renderer() : 0; | 1483 RenderObject* rootObject = renderObject->document().documentElement() ?
renderObject->document().documentElement()->renderer() : 0; |
| 1487 if (!rootObject) | 1484 if (!rootObject) |
| 1488 return false; | 1485 return false; |
| 1489 | 1486 |
| 1490 RenderStyle* style = rootObject->style(); | 1487 RenderStyle* style = rootObject->style(); |
| 1491 | 1488 |
| 1492 // Reject anything that has a border, a border-radius or outline, | 1489 // Reject anything that has a border, a border-radius or outline, |
| 1493 // or is not a simple background (no background, or solid color). | 1490 // or is not a simple background (no background, or solid color). |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1869 dirtyRect.intersect(pixelSnappedIntRect(bounds)); | 1866 dirtyRect.intersect(pixelSnappedIntRect(bounds)); |
| 1870 } else { | 1867 } else { |
| 1871 dirtyRect.move(roundedIntSize(m_subpixelAccumulation)); | 1868 dirtyRect.move(roundedIntSize(m_subpixelAccumulation)); |
| 1872 } | 1869 } |
| 1873 | 1870 |
| 1874 #ifndef NDEBUG | 1871 #ifndef NDEBUG |
| 1875 paintInfo.renderLayer->renderer()->assertSubtreeIsLaidOut(); | 1872 paintInfo.renderLayer->renderer()->assertSubtreeIsLaidOut(); |
| 1876 #endif | 1873 #endif |
| 1877 | 1874 |
| 1878 if (paintInfo.renderLayer->compositingState() != PaintsIntoGroupedBacking) { | 1875 if (paintInfo.renderLayer->compositingState() != PaintsIntoGroupedBacking) { |
| 1879 // FIXME: GraphicsLayers need a way to split for RenderRegions. | |
| 1880 LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBe
haviorNormal, m_subpixelAccumulation); | 1876 LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBe
haviorNormal, m_subpixelAccumulation); |
| 1881 paintInfo.renderLayer->paintLayerContents(context, paintingInfo, paintFl
ags); | 1877 paintInfo.renderLayer->paintLayerContents(context, paintingInfo, paintFl
ags); |
| 1882 | 1878 |
| 1883 ASSERT(!paintInfo.isBackgroundLayer || paintFlags & PaintLayerPaintingRo
otBackgroundOnly); | 1879 ASSERT(!paintInfo.isBackgroundLayer || paintFlags & PaintLayerPaintingRo
otBackgroundOnly); |
| 1884 | 1880 |
| 1885 if (paintInfo.renderLayer->containsDirtyOverlayScrollbars()) | 1881 if (paintInfo.renderLayer->containsDirtyOverlayScrollbars()) |
| 1886 paintInfo.renderLayer->paintLayerContents(context, paintingInfo, pai
ntFlags | PaintLayerPaintingOverlayScrollbars); | 1882 paintInfo.renderLayer->paintLayerContents(context, paintingInfo, pai
ntFlags | PaintLayerPaintingOverlayScrollbars); |
| 1887 } else { | 1883 } else { |
| 1888 ASSERT(compositor()->layerSquashingEnabled()); | 1884 ASSERT(compositor()->layerSquashingEnabled()); |
| 1889 LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBe
haviorNormal, LayoutSize()); | 1885 LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBe
haviorNormal, LayoutSize()); |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2233 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2229 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
| 2234 name = "Scrolling Contents Layer"; | 2230 name = "Scrolling Contents Layer"; |
| 2235 } else { | 2231 } else { |
| 2236 ASSERT_NOT_REACHED(); | 2232 ASSERT_NOT_REACHED(); |
| 2237 } | 2233 } |
| 2238 | 2234 |
| 2239 return name; | 2235 return name; |
| 2240 } | 2236 } |
| 2241 | 2237 |
| 2242 } // namespace WebCore | 2238 } // namespace WebCore |
| OLD | NEW |