Changeset 95239 in webkit
- Timestamp:
- Sep 15, 2011 3:53:54 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r95235 r95239 1 2011-09-15 David Hyatt <hyatt@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=50072 4 5 Make overflow clipping to border-radius work across layers. This patch makes painting 6 work but does not attempt to fix hit testing. It also doesn't work when a composited 7 layer is clipped by a non-composited ancestor. 8 9 Add a new ClipRect class (used by ClipRects and RenderLayer) that is basically just tracking 10 a rect and a border radius taint. At the time we set a clip, if the rectangle is listed 11 as also being clipped by a radius, then we walk up the layer tree and push those inner border 12 rounded rect clips for any overflow areas in the containing block chain. 13 14 Reviewed by Beth Dakin. 15 16 * fast/clip/overflow-border-radius-combinations.html: Added. 17 * fast/clip/overflow-border-radius-composited.html: Added. 18 * fast/clip/overflow-border-radius-transformed.html: Added. 19 * platform/mac/fast/clip/overflow-border-radius-combinations-expected.png: Added. 20 * platform/mac/fast/clip/overflow-border-radius-combinations-expected.txt: Added. 21 * platform/mac/fast/clip/overflow-border-radius-composited-expected.png: Added. 22 * platform/mac/fast/clip/overflow-border-radius-composited-expected.txt: Added. 23 * platform/mac/fast/clip/overflow-border-radius-transformed-expected.png: Added. 24 * platform/mac/fast/clip/overflow-border-radius-transformed-expected.txt: Added. 25 1 26 2011-09-15 Julien Chaffraix <jchaffraix@webkit.org> 2 27 -
trunk/Source/WebCore/ChangeLog
r95235 r95239 1 2011-09-15 David Hyatt <hyatt@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=50072 4 5 Make overflow clipping to border-radius work across layers. This patch makes painting 6 work but does not attempt to fix hit testing. It also doesn't work when a composited 7 layer is clipped by a non-composited ancestor. 8 9 Add a new ClipRect class (used by ClipRects and RenderLayer) that is basically just tracking 10 a rect and a border radius taint. At the time we set a clip, if the rectangle is listed 11 as also being clipped by a radius, then we walk up the layer tree and push those inner border 12 rounded rect clips for any overflow areas in the containing block chain. 13 14 Reviewed by Beth Dakin. 15 16 Added new tests in fast/clip. 17 18 * rendering/RenderBox.cpp: 19 (WebCore::RenderBox::pushContentsClip): 20 * rendering/RenderLayer.cpp: 21 (WebCore::inContainingBlockChain): 22 (WebCore::RenderLayer::clipToRect): 23 (WebCore::RenderLayer::restoreClip): 24 (WebCore::RenderLayer::paintLayer): 25 (WebCore::RenderLayer::hitTestLayer): 26 (WebCore::RenderLayer::calculateClipRects): 27 (WebCore::RenderLayer::backgroundClipRect): 28 (WebCore::RenderLayer::calculateRects): 29 (WebCore::RenderLayer::childrenClipRect): 30 (WebCore::RenderLayer::selfClipRect): 31 * rendering/RenderLayer.h: 32 (WebCore::ClipRect::ClipRect): 33 (WebCore::ClipRect::rect): 34 (WebCore::ClipRect::setRect): 35 (WebCore::ClipRect::hasRadius): 36 (WebCore::ClipRect::setHasRadius): 37 (WebCore::ClipRect::operator==): 38 (WebCore::ClipRect::intersect): 39 (WebCore::ClipRect::move): 40 (WebCore::ClipRect::isEmpty): 41 (WebCore::ClipRect::intersects): 42 (WebCore::intersection): 43 (WebCore::ClipRects::overflowClipRect): 44 (WebCore::ClipRects::setOverflowClipRect): 45 (WebCore::ClipRects::fixedClipRect): 46 (WebCore::ClipRects::setFixedClipRect): 47 (WebCore::ClipRects::posClipRect): 48 (WebCore::ClipRects::setPosClipRect): 49 * rendering/RenderLayerBacking.cpp: 50 (WebCore::RenderLayerBacking::updateCompositedBounds): 51 (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): 52 (WebCore::RenderLayerBacking::paintIntoLayer): 53 * rendering/RenderLayerCompositor.cpp: 54 (WebCore::RenderLayerCompositor::addToOverlapMap): 55 (WebCore::RenderLayerCompositor::clippedByAncestor): 56 * rendering/RenderTreeAsText.cpp: 57 (WebCore::writeLayers): 58 1 59 2011-09-15 Julien Chaffraix <jchaffraix@webkit.org> 2 60 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r95235 r95239 1161 1161 paintInfo.context->save(); 1162 1162 if (style()->hasBorderRadius()) 1163 paintInfo.context->addRoundedRectClip(style()->getRounded BorderFor(LayoutRect(accumulatedOffset, size())));1163 paintInfo.context->addRoundedRectClip(style()->getRoundedInnerBorderFor(LayoutRect(accumulatedOffset, size()))); 1164 1164 paintInfo.context->clip(clipRect); 1165 1165 return true; -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r94912 r95239 2555 2555 } 2556 2556 2557 static void setClip(GraphicsContext* p, const LayoutRect& paintDirtyRect, const LayoutRect& clipRect) 2558 { 2559 if (paintDirtyRect == clipRect) 2560 return; 2561 p->save(); 2562 p->clip(clipRect); 2563 } 2564 2565 static void restoreClip(GraphicsContext* p, const LayoutRect& paintDirtyRect, const LayoutRect& clipRect) 2566 { 2567 if (paintDirtyRect == clipRect) 2557 static bool inContainingBlockChain(RenderLayer* startLayer, RenderLayer* endLayer) 2558 { 2559 if (startLayer == endLayer) 2560 return true; 2561 2562 for (RenderBlock* currentBlock = startLayer->renderer()->containingBlock(); currentBlock; currentBlock = currentBlock->containingBlock()) { 2563 if (currentBlock->layer() == endLayer) 2564 return true; 2565 } 2566 2567 return false; 2568 } 2569 2570 void RenderLayer::clipToRect(RenderLayer* rootLayer, GraphicsContext* context, const LayoutRect& paintDirtyRect, const ClipRect& clipRect, 2571 BorderRadiusClippingRule rule) 2572 { 2573 if (clipRect.rect() == paintDirtyRect) 2574 return; 2575 context->save(); 2576 context->clip(clipRect.rect()); 2577 2578 if (!clipRect.hasRadius()) 2579 return; 2580 2581 // If the clip rect has been tainted by a border radius, then we have to walk up our layer chain applying the clips from 2582 // any layers with overflow. The condition for being able to apply these clips is that the overflow object be in our 2583 // containing block chain so we check that also. 2584 for (RenderLayer* layer = rule == IncludeSelfForBorderRadius ? this : parent(); layer; layer = layer->parent()) { 2585 if (layer->renderer()->hasOverflowClip() && layer->renderer()->style()->hasBorderRadius() && inContainingBlockChain(this, layer)) { 2586 LayoutPoint delta; 2587 layer->convertToLayerCoords(rootLayer, delta); 2588 context->addRoundedRectClip(layer->renderer()->style()->getRoundedInnerBorderFor(LayoutRect(delta, layer->size()))); 2589 } 2590 2591 if (layer == rootLayer) 2592 break; 2593 } 2594 } 2595 2596 void RenderLayer::restoreClip(GraphicsContext* p, const LayoutRect& paintDirtyRect, const ClipRect& clipRect) 2597 { 2598 if (clipRect.rect() == paintDirtyRect) 2568 2599 return; 2569 2600 p->restore(); … … 2641 2672 2642 2673 // Make sure the parent's clip rects have been calculated. 2643 LayoutRect clipRect = paintDirtyRect;2674 ClipRect clipRect = paintDirtyRect; 2644 2675 if (parent()) { 2645 2676 clipRect = backgroundClipRect(rootLayer, paintFlags & PaintLayerTemporaryClipRects); 2646 2677 clipRect.intersect(paintDirtyRect); 2647 }2648 2678 2649 // Push the parent coordinate space's clip. 2650 setClip(p, paintDirtyRect, clipRect); 2679 // Push the parent coordinate space's clip. 2680 parent()->clipToRect(rootLayer, p, paintDirtyRect, clipRect); 2681 } 2651 2682 2652 2683 // Adjust the transform such that the renderer's upper left corner will paint at (0,0) in user space. … … 2667 2698 2668 2699 // Restore the clip. 2669 restoreClip(p, paintDirtyRect, clipRect); 2670 2700 if (parent()) 2701 parent()->restoreClip(p, paintDirtyRect, clipRect); 2702 2671 2703 return; 2672 2704 } … … 2684 2716 2685 2717 // Calculate the clip rects we should use. 2686 LayoutRect layerBounds, damageRect, clipRectToApply, outlineRect; 2718 LayoutRect layerBounds; 2719 ClipRect damageRect, clipRectToApply, outlineRect; 2687 2720 calculateRects(rootLayer, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect, localPaintFlags & PaintLayerTemporaryClipRects); 2688 2721 LayoutPoint paintOffset = toPoint(layerBounds.location() - renderBoxLocation()); … … 2708 2741 2709 2742 // We want to paint our layer, but only if we intersect the damage rect. 2710 bool shouldPaint = intersectsDamageRect(layerBounds, damageRect , rootLayer) && m_hasVisibleContent && isSelfPaintingLayer();2743 bool shouldPaint = intersectsDamageRect(layerBounds, damageRect.rect(), rootLayer) && m_hasVisibleContent && isSelfPaintingLayer(); 2711 2744 if (shouldPaint && !selectionOnly && !damageRect.isEmpty() && !paintingOverlayScrollbars) { 2712 2745 // Begin transparency layers lazily now that we know we have to paint something. … … 2716 2749 // Paint our background first, before painting any child layers. 2717 2750 // Establish the clip used to paint our background. 2718 setClip(p, paintDirtyRect, damageRect);2751 clipToRect(rootLayer, p, paintDirtyRect, damageRect, DoNotIncludeSelfForBorderRadius); // Background painting will handle clipping to self. 2719 2752 2720 2753 // Paint the background. 2721 PaintInfo paintInfo(p, damageRect , PaintPhaseBlockBackground, false, paintingRootForRenderer, 0);2754 PaintInfo paintInfo(p, damageRect.rect(), PaintPhaseBlockBackground, false, paintingRootForRenderer, 0); 2722 2755 renderer()->paint(paintInfo, paintOffset); 2723 2756 … … 2736 2769 2737 2770 // Set up the clip used when painting our children. 2738 setClip(p, paintDirtyRect, clipRectToApply);2739 PaintInfo paintInfo(p, clipRectToApply ,2740 2741 2771 clipToRect(rootLayer, p, paintDirtyRect, clipRectToApply); 2772 PaintInfo paintInfo(p, clipRectToApply.rect(), 2773 selectionOnly ? PaintPhaseSelection : PaintPhaseChildBlockBackgrounds, 2774 forceBlackText, paintingRootForRenderer, 0); 2742 2775 renderer()->paint(paintInfo, paintOffset); 2743 2776 if (!selectionOnly) { … … 2757 2790 if (!outlineRect.isEmpty() && isSelfPaintingLayer() && !paintingOverlayScrollbars) { 2758 2791 // Paint our own outline 2759 PaintInfo paintInfo(p, outlineRect , PaintPhaseSelfOutline, false, paintingRootForRenderer, 0);2760 setClip(p, paintDirtyRect, outlineRect);2792 PaintInfo paintInfo(p, outlineRect.rect(), PaintPhaseSelfOutline, false, paintingRootForRenderer, 0); 2793 clipToRect(rootLayer, p, paintDirtyRect, outlineRect, DoNotIncludeSelfForBorderRadius); 2761 2794 renderer()->paint(paintInfo, paintOffset); 2762 2795 restoreClip(p, paintDirtyRect, outlineRect); … … 2770 2803 2771 2804 if (renderer()->hasMask() && shouldPaint && !selectionOnly && !damageRect.isEmpty() && !paintingOverlayScrollbars) { 2772 setClip(p, paintDirtyRect, damageRect);2805 clipToRect(rootLayer, p, paintDirtyRect, damageRect, DoNotIncludeSelfForBorderRadius); // Mask painting will handle clipping to self. 2773 2806 2774 2807 // Paint the mask. 2775 PaintInfo paintInfo(p, damageRect , PaintPhaseMask, false, paintingRootForRenderer, 0);2808 PaintInfo paintInfo(p, damageRect.rect(), PaintPhaseMask, false, paintingRootForRenderer, 0); 2776 2809 renderer()->paint(paintInfo, paintOffset); 2777 2810 … … 2781 2814 2782 2815 if (paintingOverlayScrollbars) { 2783 setClip(p, paintDirtyRect, damageRect);2784 paintOverflowControls(p, paintOffset, damageRect , true);2816 clipToRect(rootLayer, p, paintDirtyRect, damageRect); 2817 paintOverflowControls(p, paintOffset, damageRect.rect(), true); 2785 2818 restoreClip(p, paintDirtyRect, damageRect); 2786 2819 } … … 3061 3094 // Make sure the parent's clip rects have been calculated. 3062 3095 if (parent()) { 3063 LayoutRect clipRect = backgroundClipRect(rootLayer, useTemporaryClipRects, IncludeOverlayScrollbarSize);3096 ClipRect clipRect = backgroundClipRect(rootLayer, useTemporaryClipRects, IncludeOverlayScrollbarSize); 3064 3097 // Go ahead and test the enclosing clip now. 3065 3098 if (!clipRect.intersects(hitTestArea)) … … 3126 3159 // Calculate the clip rects we should use. 3127 3160 LayoutRect layerBounds; 3128 LayoutRect bgRect;3129 LayoutRect fgRect;3130 LayoutRect outlineRect;3161 ClipRect bgRect; 3162 ClipRect fgRect; 3163 ClipRect outlineRect; 3131 3164 calculateRects(rootLayer, hitTestRect, layerBounds, bgRect, fgRect, outlineRect, useTemporaryClipRects, IncludeOverlayScrollbarSize); 3132 3165 … … 3432 3465 else 3433 3466 parentLayer->calculateClipRects(rootLayer, clipRects); 3434 } 3435 else 3467 } else 3436 3468 clipRects.reset(PaintInfo::infiniteRect()); 3437 3469 … … 3460 3492 3461 3493 if (renderer()->hasOverflowClip()) { 3462 LayoutRect newOverflowClip = toRenderBox(renderer())->overflowClipRect(offset, relevancy); 3494 ClipRect newOverflowClip = toRenderBox(renderer())->overflowClipRect(offset, relevancy); 3495 if (renderer()->style()->hasBorderRadius()) 3496 newOverflowClip.setHasRadius(true); 3463 3497 clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.overflowClipRect())); 3464 3498 if (renderer()->isPositioned() || renderer()->isRelPositioned()) … … 3486 3520 } 3487 3521 3488 LayoutRect RenderLayer::backgroundClipRect(const RenderLayer* rootLayer, bool temporaryClipRects, OverlayScrollbarSizeRelevancy relevancy) const3489 { 3490 LayoutRect backgroundRect;3522 ClipRect RenderLayer::backgroundClipRect(const RenderLayer* rootLayer, bool temporaryClipRects, OverlayScrollbarSizeRelevancy relevancy) const 3523 { 3524 ClipRect backgroundRect; 3491 3525 if (parent()) { 3492 3526 ClipRects parentRects; … … 3504 3538 3505 3539 void RenderLayer::calculateRects(const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds, 3506 LayoutRect& backgroundRect, LayoutRect& foregroundRect, LayoutRect& outlineRect, bool temporaryClipRects,3540 ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, bool temporaryClipRects, 3507 3541 OverlayScrollbarSizeRelevancy relevancy) const 3508 3542 { … … 3523 3557 if (renderer()->hasOverflowClip() || renderer()->hasClip()) { 3524 3558 // This layer establishes a clip of some kind. 3525 if (renderer()->hasOverflowClip()) 3559 if (renderer()->hasOverflowClip()) { 3526 3560 foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(offset, relevancy)); 3561 if (renderer()->style()->hasBorderRadius()) 3562 foregroundRect.setHasRadius(true); 3563 } 3564 3527 3565 if (renderer()->hasClip()) { 3528 3566 // Clip applies to *us* as well, so go ahead and update the damageRect. … … 3545 3583 LayoutRect RenderLayer::childrenClipRect() const 3546 3584 { 3585 // FIXME: border-radius not accounted for. 3547 3586 RenderView* renderView = renderer()->view(); 3548 3587 RenderLayer* clippingRootLayer = clippingRoot(); 3549 LayoutRect layerBounds, backgroundRect, foregroundRect, outlineRect; 3588 LayoutRect layerBounds; 3589 ClipRect backgroundRect, foregroundRect, outlineRect; 3550 3590 calculateRects(clippingRootLayer, renderView->unscaledDocumentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect); 3551 return clippingRootLayer->renderer()->localToAbsoluteQuad(FloatQuad(foregroundRect )).enclosingBoundingBox();3591 return clippingRootLayer->renderer()->localToAbsoluteQuad(FloatQuad(foregroundRect.rect())).enclosingBoundingBox(); 3552 3592 } 3553 3593 3554 3594 LayoutRect RenderLayer::selfClipRect() const 3555 3595 { 3596 // FIXME: border-radius not accounted for. 3556 3597 RenderView* renderView = renderer()->view(); 3557 3598 RenderLayer* clippingRootLayer = clippingRoot(); 3558 LayoutRect layerBounds, backgroundRect, foregroundRect, outlineRect; 3599 LayoutRect layerBounds; 3600 ClipRect backgroundRect, foregroundRect, outlineRect; 3559 3601 calculateRects(clippingRootLayer, renderView->documentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect); 3560 return clippingRootLayer->renderer()->localToAbsoluteQuad(FloatQuad(backgroundRect )).enclosingBoundingBox();3602 return clippingRootLayer->renderer()->localToAbsoluteQuad(FloatQuad(backgroundRect.rect())).enclosingBoundingBox(); 3561 3603 } 3562 3604 -
trunk/Source/WebCore/rendering/RenderLayer.h
r94900 r95239 69 69 #endif 70 70 71 enum BorderRadiusClippingRule { IncludeSelfForBorderRadius, DoNotIncludeSelfForBorderRadius }; 72 73 class ClipRect { 74 public: 75 ClipRect() 76 : m_hasRadius(false) 77 { } 78 79 ClipRect(const LayoutRect& rect) 80 : m_rect(rect) 81 , m_hasRadius(false) 82 { } 83 84 const LayoutRect& rect() const { return m_rect; } 85 void setRect(const LayoutRect& rect) { m_rect = rect; } 86 87 bool hasRadius() const { return m_hasRadius; } 88 void setHasRadius(bool hasRadius) { m_hasRadius = hasRadius; } 89 90 bool operator==(const ClipRect& other) const { return rect() == other.rect() && hasRadius() == other.hasRadius(); } 91 92 void intersect(const LayoutRect& other) { m_rect.intersect(other); } 93 void intersect(const ClipRect& other) 94 { 95 m_rect.intersect(other.rect()); 96 if (other.hasRadius()) 97 m_hasRadius = true; 98 } 99 void move(LayoutUnit x, LayoutUnit y) { m_rect.move(x, y); } 100 101 bool isEmpty() const { return m_rect.isEmpty(); } 102 bool intersects(const LayoutRect& rect) { return m_rect.intersects(rect); } 103 104 private: 105 LayoutRect m_rect; 106 bool m_hasRadius; 107 }; 108 109 inline ClipRect intersection(const ClipRect& a, const ClipRect& b) 110 { 111 ClipRect c = a; 112 c.intersect(b); 113 return c; 114 } 115 71 116 class ClipRects { 72 117 public: … … 103 148 } 104 149 105 const LayoutRect& overflowClipRect() const { return m_overflowClipRect; }106 void setOverflowClipRect(const LayoutRect& r) { m_overflowClipRect = r; }107 108 const LayoutRect& fixedClipRect() const { return m_fixedClipRect; }109 void setFixedClipRect(const LayoutRect&r) { m_fixedClipRect = r; }110 111 const LayoutRect& posClipRect() const { return m_posClipRect; }112 void setPosClipRect(const LayoutRect& r) { m_posClipRect = r; }150 const ClipRect& overflowClipRect() const { return m_overflowClipRect; } 151 void setOverflowClipRect(const ClipRect& r) { m_overflowClipRect = r; } 152 153 const ClipRect& fixedClipRect() const { return m_fixedClipRect; } 154 void setFixedClipRect(const ClipRect&r) { m_fixedClipRect = r; } 155 156 const ClipRect& posClipRect() const { return m_posClipRect; } 157 void setPosClipRect(const ClipRect& r) { m_posClipRect = r; } 113 158 114 159 bool fixed() const { return m_fixed; } … … 148 193 149 194 private: 150 LayoutRect m_overflowClipRect;151 LayoutRect m_fixedClipRect;152 LayoutRect m_posClipRect;195 ClipRect m_overflowClipRect; 196 ClipRect m_fixedClipRect; 197 ClipRect m_posClipRect; 153 198 unsigned m_refCnt : 31; 154 199 bool m_fixed : 1; … … 381 426 // for painting/event handling. 382 427 void calculateRects(const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds, 383 LayoutRect& backgroundRect, LayoutRect& foregroundRect, LayoutRect& outlineRect, bool temporaryClipRects = false,384 OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;428 ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, 429 bool temporaryClipRects = false, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const; 385 430 386 431 // Compute and cache clip rects computed with the given layer as the root … … 470 515 void computeRepaintRects(IntPoint* offsetFromRoot = 0); 471 516 void clearRepaintRects(); 517 518 void clipToRect(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect& paintDirtyRect, const ClipRect&, 519 BorderRadiusClippingRule = IncludeSelfForBorderRadius); 520 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const ClipRect&); 472 521 473 522 // The normal operator new is disallowed on all render objects. … … 601 650 602 651 void parentClipRects(const RenderLayer* rootLayer, ClipRects&, bool temporaryClipRects = false, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const; 603 LayoutRect backgroundClipRect(const RenderLayer* rootLayer, bool temporaryClipRects, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;652 ClipRect backgroundClipRect(const RenderLayer* rootLayer, bool temporaryClipRects, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const; 604 653 605 654 RenderLayer* enclosingTransformedAncestor() const; -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r93429 r95239 211 211 212 212 if (m_owningLayer != rootLayer) 213 clippingBounds.intersect(m_owningLayer->backgroundClipRect(rootLayer, true) );213 clippingBounds.intersect(m_owningLayer->backgroundClipRect(rootLayer, true).rect()); 214 214 215 215 LayoutPoint delta; … … 396 396 // layer. Note that we call it with temporaryClipRects = true because normally when computing clip rects 397 397 // for a compositing layer, rootLayer is the layer itself. 398 LayoutRect parentClipRect = m_owningLayer->backgroundClipRect(compAncestor, true) ;398 LayoutRect parentClipRect = m_owningLayer->backgroundClipRect(compAncestor, true).rect(); 399 399 ASSERT(parentClipRect != PaintInfo::infiniteRect()); 400 400 m_ancestorClippingLayer->setPosition(FloatPoint() + (parentClipRect.location() - graphicsLayerParentLocation)); … … 1079 1079 } 1080 1080 1081 static void setClip(GraphicsContext* p, const LayoutRect& paintDirtyRect, const LayoutRect& clipRect)1082 {1083 if (paintDirtyRect == clipRect)1084 return;1085 p->save();1086 p->clip(clipRect);1087 }1088 1089 static void restoreClip(GraphicsContext* p, const LayoutRect& paintDirtyRect, const LayoutRect& clipRect)1090 {1091 if (paintDirtyRect == clipRect)1092 return;1093 p->restore();1094 }1095 1096 1081 // Share this with RenderLayer::paintLayer, which would have to be educated about GraphicsLayerPaintingPhase? 1097 1082 void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* context, … … 1108 1093 1109 1094 // Calculate the clip rects we should use. 1110 LayoutRect layerBounds, damageRect, clipRectToApply, outlineRect; 1095 LayoutRect layerBounds; 1096 ClipRect damageRect, clipRectToApply, outlineRect; 1111 1097 m_owningLayer->calculateRects(rootLayer, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect); 1112 1098 … … 1126 1112 // Paint our background first, before painting any child layers. 1127 1113 // Establish the clip used to paint our background. 1128 setClip(context, paintDirtyRect, damageRect);1129 1130 PaintInfo info(context, damageRect , PaintPhaseBlockBackground, false, paintingRootForRenderer, 0);1114 m_owningLayer->clipToRect(rootLayer, context, paintDirtyRect, damageRect, DoNotIncludeSelfForBorderRadius); 1115 1116 PaintInfo info(context, damageRect.rect(), PaintPhaseBlockBackground, false, paintingRootForRenderer, 0); 1131 1117 renderer()->paint(info, paintOffset); 1132 1118 … … 1134 1120 // z-index. We paint after we painted the background/border, so that the scrollbars will 1135 1121 // sit above the background/border. 1136 m_owningLayer->paintOverflowControls(context, layerBounds.location(), damageRect );1122 m_owningLayer->paintOverflowControls(context, layerBounds.location(), damageRect.rect()); 1137 1123 1138 1124 // Restore the clip. 1139 restoreClip(context, paintDirtyRect, damageRect);1125 m_owningLayer->restoreClip(context, paintDirtyRect, damageRect); 1140 1126 1141 1127 // Now walk the sorted list of children with negative z-indices. Only RenderLayers without compositing layers will paint. … … 1148 1134 if (shouldPaint && (paintingPhase & GraphicsLayerPaintForeground)) { 1149 1135 // Set up the clip used when painting our children. 1150 setClip(context, paintDirtyRect, clipRectToApply);1151 PaintInfo paintInfo(context, clipRectToApply ,1152 1153 1136 m_owningLayer->clipToRect(rootLayer, context, paintDirtyRect, clipRectToApply); 1137 PaintInfo paintInfo(context, clipRectToApply.rect(), 1138 selectionOnly ? PaintPhaseSelection : PaintPhaseChildBlockBackgrounds, 1139 forceBlackText, paintingRootForRenderer, 0); 1154 1140 renderer()->paint(paintInfo, paintOffset); 1155 1141 … … 1166 1152 1167 1153 // Now restore our clip. 1168 restoreClip(context, paintDirtyRect, clipRectToApply);1154 m_owningLayer->restoreClip(context, paintDirtyRect, clipRectToApply); 1169 1155 1170 1156 if (!outlineRect.isEmpty()) { 1171 1157 // Paint our own outline 1172 PaintInfo paintInfo(context, outlineRect , PaintPhaseSelfOutline, false, paintingRootForRenderer, 0);1173 setClip(context, paintDirtyRect, outlineRect);1158 PaintInfo paintInfo(context, outlineRect.rect(), PaintPhaseSelfOutline, false, paintingRootForRenderer, 0); 1159 m_owningLayer->clipToRect(rootLayer, context, paintDirtyRect, outlineRect, DoNotIncludeSelfForBorderRadius); 1174 1160 renderer()->paint(paintInfo, paintOffset); 1175 restoreClip(context, paintDirtyRect, outlineRect);1161 m_owningLayer->restoreClip(context, paintDirtyRect, outlineRect); 1176 1162 } 1177 1163 … … 1185 1171 if (shouldPaint && (paintingPhase & GraphicsLayerPaintMask)) { 1186 1172 if (renderer()->hasMask() && !selectionOnly && !damageRect.isEmpty()) { 1187 setClip(context, paintDirtyRect, damageRect);1173 m_owningLayer->clipToRect(rootLayer, context, paintDirtyRect, damageRect, DoNotIncludeSelfForBorderRadius); 1188 1174 1189 1175 // Paint the mask. 1190 PaintInfo paintInfo(context, damageRect , PaintPhaseMask, false, paintingRootForRenderer, 0);1176 PaintInfo paintInfo(context, damageRect.rect(), PaintPhaseMask, false, paintingRootForRenderer, 0); 1191 1177 renderer()->paint(paintInfo, paintOffset); 1192 1178 1193 1179 // Restore the clip. 1194 restoreClip(context, paintDirtyRect, damageRect);1180 m_owningLayer->restoreClip(context, paintDirtyRect, damageRect); 1195 1181 } 1196 1182 } -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r95158 r95239 574 574 } 575 575 576 LayoutRect clipRect = layer->backgroundClipRect(rootRenderLayer(), true) ;576 LayoutRect clipRect = layer->backgroundClipRect(rootRenderLayer(), true).rect(); 577 577 clipRect.intersect(layerBounds); 578 578 overlapMap.add(layer, clipRect); … … 1346 1346 return false; 1347 1347 1348 LayoutRect backgroundRect = layer->backgroundClipRect(computeClipRoot, true); 1349 return backgroundRect != PaintInfo::infiniteRect(); 1348 return layer->backgroundClipRect(computeClipRoot, true).rect() != PaintInfo::infiniteRect(); 1350 1349 } 1351 1350 -
trunk/Source/WebCore/rendering/RenderTreeAsText.cpp
r94640 r95239 705 705 706 706 // Calculate the clip rects we should use. 707 IntRect layerBounds, damageRect, clipRectToApply, outlineRect; 707 IntRect layerBounds; 708 ClipRect damageRect, clipRectToApply, outlineRect; 708 709 l->calculateRects(rootLayer, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect, true); 709 710 … … 712 713 l->updateNormalFlowList(); 713 714 714 bool shouldPaint = (behavior & RenderAsTextShowAllLayers) ? true : l->intersectsDamageRect(layerBounds, damageRect , rootLayer);715 bool shouldPaint = (behavior & RenderAsTextShowAllLayers) ? true : l->intersectsDamageRect(layerBounds, damageRect.rect(), rootLayer); 715 716 Vector<RenderLayer*>* negList = l->negZOrderList(); 716 717 bool paintsBackgroundSeparately = negList && negList->size() > 0; 717 718 if (shouldPaint && paintsBackgroundSeparately) 718 write(ts, *l, layerBounds, damageRect , clipRectToApply, outlineRect, LayerPaintPhaseBackground, indent, behavior);719 write(ts, *l, layerBounds, damageRect.rect(), clipRectToApply.rect(), outlineRect.rect(), LayerPaintPhaseBackground, indent, behavior); 719 720 720 721 if (negList) { … … 730 731 731 732 if (shouldPaint) 732 write(ts, *l, layerBounds, damageRect , clipRectToApply, outlineRect, paintsBackgroundSeparately ? LayerPaintPhaseForeground : LayerPaintPhaseAll, indent, behavior);733 write(ts, *l, layerBounds, damageRect.rect(), clipRectToApply.rect(), outlineRect.rect(), paintsBackgroundSeparately ? LayerPaintPhaseForeground : LayerPaintPhaseAll, indent, behavior); 733 734 734 735 if (Vector<RenderLayer*>* normalFlowList = l->normalFlowList()) {
Note: See TracChangeset
for help on using the changeset viewer.