Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(551)

Side by Side Diff: sky/engine/core/rendering/RenderLayer.cpp

Issue 768973004: Remove PaintBehavior. It's unused. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/rendering/RenderLayer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 RenderBox* box = renderBox(); 265 RenderBox* box = renderBox();
266 TransformationMatrix currTransform; 266 TransformationMatrix currTransform;
267 box->style()->applyTransform(currTransform, box->pixelSnappedBorderBoxRe ct().size(), RenderStyle::ExcludeTransformOrigin); 267 box->style()->applyTransform(currTransform, box->pixelSnappedBorderBoxRe ct().size(), RenderStyle::ExcludeTransformOrigin);
268 makeMatrixRenderable(currTransform); 268 makeMatrixRenderable(currTransform);
269 return currTransform; 269 return currTransform;
270 } 270 }
271 271
272 return *m_transform; 272 return *m_transform;
273 } 273 }
274 274
275 TransformationMatrix RenderLayer::renderableTransform(PaintBehavior paintBehavio r) const 275 TransformationMatrix RenderLayer::renderableTransform() const
276 { 276 {
277 return m_transform ? *m_transform : TransformationMatrix(); 277 return m_transform ? *m_transform : TransformationMatrix();
278 } 278 }
279 279
280 RenderLayer* RenderLayer::enclosingOverflowClipLayer(IncludeSelfOrNot includeSel f) const 280 RenderLayer* RenderLayer::enclosingOverflowClipLayer(IncludeSelfOrNot includeSel f) const
281 { 281 {
282 const RenderLayer* layer = (includeSelf == IncludeSelf) ? this : parent(); 282 const RenderLayer* layer = (includeSelf == IncludeSelf) ? this : parent();
283 while (layer) { 283 while (layer) {
284 if (layer->renderer()->hasOverflowClip()) 284 if (layer->renderer()->hasOverflowClip())
285 return const_cast<RenderLayer*>(layer); 285 return const_cast<RenderLayer*>(layer);
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 enum TransparencyClipBoxBehavior { 560 enum TransparencyClipBoxBehavior {
561 PaintingTransparencyClipBox, 561 PaintingTransparencyClipBox,
562 HitTestingTransparencyClipBox 562 HitTestingTransparencyClipBox
563 }; 563 };
564 564
565 enum TransparencyClipBoxMode { 565 enum TransparencyClipBoxMode {
566 DescendantsOfTransparencyClipBox, 566 DescendantsOfTransparencyClipBox,
567 RootOfTransparencyClipBox 567 RootOfTransparencyClipBox
568 }; 568 };
569 569
570 static LayoutRect transparencyClipBox(const RenderLayer*, const RenderLayer* roo tLayer, TransparencyClipBoxBehavior, TransparencyClipBoxMode, const LayoutSize& subPixelAccumulation, PaintBehavior = 0); 570 static LayoutRect transparencyClipBox(const RenderLayer*, const RenderLayer* roo tLayer, TransparencyClipBoxBehavior, TransparencyClipBoxMode, const LayoutSize& subPixelAccumulation);
571 571
572 static void expandClipRectForDescendantsAndReflection(LayoutRect& clipRect, cons t RenderLayer* layer, const RenderLayer* rootLayer, 572 static void expandClipRectForDescendantsAndReflection(LayoutRect& clipRect, cons t RenderLayer* layer, const RenderLayer* rootLayer,
573 TransparencyClipBoxBehavior transparencyBehavior, const LayoutSize& subPixel Accumulation, PaintBehavior paintBehavior) 573 TransparencyClipBoxBehavior transparencyBehavior, const LayoutSize& subPixel Accumulation)
574 { 574 {
575 // If we have a mask, then the clip is limited to the border box area (and t here is 575 // If we have a mask, then the clip is limited to the border box area (and t here is
576 // no need to examine child layers). 576 // no need to examine child layers).
577 if (!layer->renderer()->hasMask()) { 577 if (!layer->renderer()->hasMask()) {
578 // Note: we don't have to walk z-order lists since transparent elements always establish 578 // Note: we don't have to walk z-order lists since transparent elements always establish
579 // a stacking container. This means we can just walk the layer tree dire ctly. 579 // a stacking container. This means we can just walk the layer tree dire ctly.
580 for (RenderLayer* curr = layer->firstChild(); curr; curr = curr->nextSib ling()) 580 for (RenderLayer* curr = layer->firstChild(); curr; curr = curr->nextSib ling())
581 clipRect.unite(transparencyClipBox(curr, rootLayer, transparencyBeha vior, DescendantsOfTransparencyClipBox, subPixelAccumulation, paintBehavior)); 581 clipRect.unite(transparencyClipBox(curr, rootLayer, transparencyBeha vior, DescendantsOfTransparencyClipBox, subPixelAccumulation));
582 } 582 }
583 } 583 }
584 584
585 static LayoutRect transparencyClipBox(const RenderLayer* layer, const RenderLaye r* rootLayer, TransparencyClipBoxBehavior transparencyBehavior, 585 static LayoutRect transparencyClipBox(const RenderLayer* layer, const RenderLaye r* rootLayer, TransparencyClipBoxBehavior transparencyBehavior,
586 TransparencyClipBoxMode transparencyMode, const LayoutSize& subPixelAccumula tion, PaintBehavior paintBehavior) 586 TransparencyClipBoxMode transparencyMode, const LayoutSize& subPixelAccumula tion)
587 { 587 {
588 // FIXME: Although this function completely ignores CSS-imposed clipping, we did already intersect with the 588 // FIXME: Although this function completely ignores CSS-imposed clipping, we did already intersect with the
589 // paintDirtyRect, and that should cut down on the amount we have to paint. Still it 589 // paintDirtyRect, and that should cut down on the amount we have to paint. Still it
590 // would be better to respect clips. 590 // would be better to respect clips.
591 591
592 if (rootLayer != layer && ((transparencyBehavior == PaintingTransparencyClip Box && layer->paintsWithTransform(paintBehavior)) 592 if (rootLayer != layer && ((transparencyBehavior == PaintingTransparencyClip Box && layer->paintsWithTransform())
593 || (transparencyBehavior == HitTestingTransparencyClipBox && layer->hasT ransform()))) { 593 || (transparencyBehavior == HitTestingTransparencyClipBox && layer->hasT ransform()))) {
594 // The best we can do here is to use enclosed bounding boxes to establis h a "fuzzy" enough clip to encompass 594 // The best we can do here is to use enclosed bounding boxes to establis h a "fuzzy" enough clip to encompass
595 // the transformed layer and all of its children. 595 // the transformed layer and all of its children.
596 const RenderLayer* rootLayerForTransform = rootLayer; 596 const RenderLayer* rootLayerForTransform = rootLayer;
597 LayoutPoint delta; 597 LayoutPoint delta;
598 layer->convertToLayerCoords(rootLayerForTransform, delta); 598 layer->convertToLayerCoords(rootLayerForTransform, delta);
599 599
600 delta.move(subPixelAccumulation); 600 delta.move(subPixelAccumulation);
601 IntPoint pixelSnappedDelta = roundedIntPoint(delta); 601 IntPoint pixelSnappedDelta = roundedIntPoint(delta);
602 TransformationMatrix transform; 602 TransformationMatrix transform;
603 transform.translate(pixelSnappedDelta.x(), pixelSnappedDelta.y()); 603 transform.translate(pixelSnappedDelta.x(), pixelSnappedDelta.y());
604 transform = transform * *layer->transform(); 604 transform = transform * *layer->transform();
605 605
606 // We don't use fragment boxes when collecting a transformed layer's bou nding box, since it always 606 // We don't use fragment boxes when collecting a transformed layer's bou nding box, since it always
607 // paints unfragmented. 607 // paints unfragmented.
608 LayoutRect clipRect = layer->physicalBoundingBox(layer); 608 LayoutRect clipRect = layer->physicalBoundingBox(layer);
609 expandClipRectForDescendantsAndReflection(clipRect, layer, layer, transp arencyBehavior, subPixelAccumulation, paintBehavior); 609 expandClipRectForDescendantsAndReflection(clipRect, layer, layer, transp arencyBehavior, subPixelAccumulation);
610 layer->renderer()->style()->filterOutsets().expandRect(clipRect); 610 layer->renderer()->style()->filterOutsets().expandRect(clipRect);
611 LayoutRect result = transform.mapRect(clipRect); 611 LayoutRect result = transform.mapRect(clipRect);
612 return result; 612 return result;
613 } 613 }
614 614
615 LayoutRect clipRect = layer->physicalBoundingBox(rootLayer); 615 LayoutRect clipRect = layer->physicalBoundingBox(rootLayer);
616 expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, transp arencyBehavior, subPixelAccumulation, paintBehavior); 616 expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, transp arencyBehavior, subPixelAccumulation);
617 layer->renderer()->style()->filterOutsets().expandRect(clipRect); 617 layer->renderer()->style()->filterOutsets().expandRect(clipRect);
618 clipRect.move(subPixelAccumulation); 618 clipRect.move(subPixelAccumulation);
619 return clipRect; 619 return clipRect;
620 } 620 }
621 621
622 LayoutRect RenderLayer::paintingExtent(const RenderLayer* rootLayer, const Layou tRect& paintDirtyRect, const LayoutSize& subPixelAccumulation, PaintBehavior pai ntBehavior) 622 LayoutRect RenderLayer::paintingExtent(const RenderLayer* rootLayer, const Layou tRect& paintDirtyRect, const LayoutSize& subPixelAccumulation)
623 { 623 {
624 return intersection(transparencyClipBox(this, rootLayer, PaintingTransparenc yClipBox, RootOfTransparencyClipBox, subPixelAccumulation, paintBehavior), paint DirtyRect); 624 return intersection(transparencyClipBox(this, rootLayer, PaintingTransparenc yClipBox, RootOfTransparencyClipBox, subPixelAccumulation), paintDirtyRect);
625 } 625 }
626 626
627 void RenderLayer::beginTransparencyLayers(GraphicsContext* context, const Render Layer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelAc cumulation, PaintBehavior paintBehavior) 627 void RenderLayer::beginTransparencyLayers(GraphicsContext* context, const Render Layer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelAc cumulation)
628 { 628 {
629 if (isTransparent() && m_usedTransparency) 629 if (isTransparent() && m_usedTransparency)
630 return; 630 return;
631 631
632 RenderLayer* ancestor = transparentPaintingAncestor(); 632 RenderLayer* ancestor = transparentPaintingAncestor();
633 if (ancestor) 633 if (ancestor)
634 ancestor->beginTransparencyLayers(context, rootLayer, paintDirtyRect, su bPixelAccumulation, paintBehavior); 634 ancestor->beginTransparencyLayers(context, rootLayer, paintDirtyRect, su bPixelAccumulation);
635 635
636 if (isTransparent()) { 636 if (isTransparent()) {
637 m_usedTransparency = true; 637 m_usedTransparency = true;
638 context->save(); 638 context->save();
639 LayoutRect clipRect = paintingExtent(rootLayer, paintDirtyRect, subPixel Accumulation, paintBehavior); 639 LayoutRect clipRect = paintingExtent(rootLayer, paintDirtyRect, subPixel Accumulation);
640 context->clip(clipRect); 640 context->clip(clipRect);
641 641
642 context->beginTransparencyLayer(renderer()->opacity()); 642 context->beginTransparencyLayer(renderer()->opacity());
643 643
644 #ifdef REVEAL_TRANSPARENCY_LAYERS 644 #ifdef REVEAL_TRANSPARENCY_LAYERS
645 context->setFillColor(Color(0.0f, 0.0f, 0.5f, 0.2f)); 645 context->setFillColor(Color(0.0f, 0.0f, 0.5f, 0.2f));
646 context->fillRect(clipRect); 646 context->fillRect(clipRect);
647 #endif 647 #endif
648 } 648 }
649 } 649 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 m_scrollableArea = adoptPtr(new RenderLayerScrollableArea(*this)); 857 m_scrollableArea = adoptPtr(new RenderLayerScrollableArea(*this));
858 else 858 else
859 m_scrollableArea = nullptr; 859 m_scrollableArea = nullptr;
860 } 860 }
861 861
862 bool RenderLayer::hasOverflowControls() const 862 bool RenderLayer::hasOverflowControls() const
863 { 863 {
864 return m_scrollableArea && m_scrollableArea->hasScrollbar(); 864 return m_scrollableArea && m_scrollableArea->hasScrollbar();
865 } 865 }
866 866
867 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot, PaintLayerFlags paintFl ags) 867 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect, RenderObject* paintingRoot, PaintLayerFlags paintFlags)
868 { 868 {
869 LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBeha vior, LayoutSize(), paintingRoot); 869 LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), LayoutSiz e(), paintingRoot);
870 paintLayer(context, paintingInfo, paintFlags); 870 paintLayer(context, paintingInfo, paintFlags);
871 } 871 }
872 872
873 void RenderLayer::paintOverlayScrollbars(GraphicsContext* context, const LayoutR ect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot) 873 void RenderLayer::paintOverlayScrollbars(GraphicsContext* context, const LayoutR ect& damageRect, RenderObject* paintingRoot)
874 { 874 {
875 if (!m_containsDirtyOverlayScrollbars) 875 if (!m_containsDirtyOverlayScrollbars)
876 return; 876 return;
877 877
878 LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBeha vior, LayoutSize(), paintingRoot); 878 LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), LayoutSiz e(), paintingRoot);
879 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 879 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
880 880
881 m_containsDirtyOverlayScrollbars = false; 881 m_containsDirtyOverlayScrollbars = false;
882 } 882 }
883 883
884 static bool inContainingBlockChain(RenderLayer* startLayer, RenderLayer* endLaye r) 884 static bool inContainingBlockChain(RenderLayer* startLayer, RenderLayer* endLaye r)
885 { 885 {
886 if (startLayer == endLayer) 886 if (startLayer == endLayer)
887 return true; 887 return true;
888 888
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) 952 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant())
953 return; 953 return;
954 954
955 if (shouldSuppressPaintingLayer(this)) 955 if (shouldSuppressPaintingLayer(this))
956 return; 956 return;
957 957
958 // If this layer is totally invisible then there is nothing to paint. 958 // If this layer is totally invisible then there is nothing to paint.
959 if (!renderer()->opacity()) 959 if (!renderer()->opacity())
960 return; 960 return;
961 961
962 if (paintsWithTransform(paintingInfo.paintBehavior)) { 962 if (paintsWithTransform()) {
963 TransformationMatrix layerTransform = renderableTransform(paintingInfo.p aintBehavior); 963 TransformationMatrix layerTransform = renderableTransform();
964 // If the transform can't be inverted, then don't paint anything. 964 // If the transform can't be inverted, then don't paint anything.
965 if (!layerTransform.isInvertible()) 965 if (!layerTransform.isInvertible())
966 return; 966 return;
967 967
968 // If we have a transparency layer enclosing us and we are the root of a transform, then we need to establish the transparency 968 // If we have a transparency layer enclosing us and we are the root of a transform, then we need to establish the transparency
969 // layer from the parent now, assuming there is a parent 969 // layer from the parent now, assuming there is a parent
970 if (isTransparent()) { 970 if (isTransparent()) {
971 if (parent()) 971 if (parent())
972 parent()->beginTransparencyLayers(context, paintingInfo.rootLaye r, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo. paintBehavior); 972 parent()->beginTransparencyLayers(context, paintingInfo.rootLaye r, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation);
973 else 973 else
974 beginTransparencyLayers(context, paintingInfo.rootLayer, paintin gInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehav ior); 974 beginTransparencyLayers(context, paintingInfo.rootLayer, paintin gInfo.paintDirtyRect, paintingInfo.subPixelAccumulation);
975 } 975 }
976 976
977 // Make sure the parent's clip rects have been calculated. 977 // Make sure the parent's clip rects have been calculated.
978 ClipRect clipRect = paintingInfo.paintDirtyRect; 978 ClipRect clipRect = paintingInfo.paintDirtyRect;
979 if (parent()) { 979 if (parent()) {
980 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, PaintingCl ipRects); 980 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, PaintingCl ipRects);
981 clipRect = clipper().backgroundClipRect(clipRectsContext); 981 clipRect = clipper().backgroundClipRect(clipRectsContext);
982 clipRect.intersect(paintingInfo.paintDirtyRect); 982 clipRect.intersect(paintingInfo.paintDirtyRect);
983 983
984 // Push the parent coordinate space's clip. 984 // Push the parent coordinate space's clip.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 // Rewire the old context to a memory buffer, so that we can capture the contents of the layer. 1065 // Rewire the old context to a memory buffer, so that we can capture the contents of the layer.
1066 // NOTE: We saved the old context in the "transparencyLayerContext" local variable, to be able to start a transparency layer 1066 // NOTE: We saved the old context in the "transparencyLayerContext" local variable, to be able to start a transparency layer
1067 // on the original context and avoid duplicating "beginFilterEffect" after each transparency layer call. Also, note that 1067 // on the original context and avoid duplicating "beginFilterEffect" after each transparency layer call. Also, note that
1068 // beginTransparencyLayers will only create a single lazy transparen cy layer, even though it is called twice in this method. 1068 // beginTransparencyLayers will only create a single lazy transparen cy layer, even though it is called twice in this method.
1069 // With deferred filters, we don't need a separate context, but we d o need to do transparency and clipping before starting 1069 // With deferred filters, we don't need a separate context, but we d o need to do transparency and clipping before starting
1070 // filter processing. 1070 // filter processing.
1071 // FIXME: when the legacy path is removed, remove the transparencyLa yerContext as well. 1071 // FIXME: when the legacy path is removed, remove the transparencyLa yerContext as well.
1072 if (deferredFiltersEnabled) { 1072 if (deferredFiltersEnabled) {
1073 if (haveTransparency) { 1073 if (haveTransparency) {
1074 // If we have a filter and transparency, we have to eagerly start a transparency layer here, rather than risk a child layer lazily starts on e after filter processing. 1074 // If we have a filter and transparency, we have to eagerly start a transparency layer here, rather than risk a child layer lazily starts on e after filter processing.
1075 beginTransparencyLayers(context, localPaintingInfo.rootLayer , paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, localPaintingI nfo.paintBehavior); 1075 beginTransparencyLayers(context, localPaintingInfo.rootLayer , paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation);
1076 } 1076 }
1077 // We'll handle clipping to the dirty rect before filter rasteri zation. 1077 // We'll handle clipping to the dirty rect before filter rasteri zation.
1078 // Filter processing will automatically expand the clip rect and the offscreen to accommodate any filter outsets. 1078 // Filter processing will automatically expand the clip rect and the offscreen to accommodate any filter outsets.
1079 // FIXME: It is incorrect to just clip to the damageRect here on ce multiple fragments are involved. 1079 // FIXME: It is incorrect to just clip to the damageRect here on ce multiple fragments are involved.
1080 ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : layerFragments[0].backgroundRect; 1080 ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : layerFragments[0].backgroundRect;
1081 clipToRect(localPaintingInfo, context, backgroundRect, paintFlag s); 1081 clipToRect(localPaintingInfo, context, backgroundRect, paintFlag s);
1082 // Subsequent code should not clip to the dirty rect, since we'v e already 1082 // Subsequent code should not clip to the dirty rect, since we'v e already
1083 // done it above, and doing it later will defeat the outsets. 1083 // done it above, and doing it later will defeat the outsets.
1084 localPaintingInfo.clipToDirtyRect = false; 1084 localPaintingInfo.clipToDirtyRect = false;
1085 } 1085 }
1086 context = filterPainter.beginFilterEffect(context); 1086 context = filterPainter.beginFilterEffect(context);
1087 1087
1088 // Check that we didn't fail to allocate the graphics context for th e offscreen buffer. 1088 // Check that we didn't fail to allocate the graphics context for th e offscreen buffer.
1089 if (filterPainter.hasStartedFilterEffect() && !deferredFiltersEnable d) { 1089 if (filterPainter.hasStartedFilterEffect() && !deferredFiltersEnable d) {
1090 localPaintingInfo.paintDirtyRect = filterPainter.paintInvalidati onRect(); 1090 localPaintingInfo.paintDirtyRect = filterPainter.paintInvalidati onRect();
1091 // If the filter needs the full source image, we need to avoid u sing the clip rectangles. 1091 // If the filter needs the full source image, we need to avoid u sing the clip rectangles.
1092 // Otherwise, if for example this layer has overflow:hidden, a d rop shadow will not compute correctly. 1092 // Otherwise, if for example this layer has overflow:hidden, a d rop shadow will not compute correctly.
1093 // Note that we will still apply the clipping on the final rende ring of the filter. 1093 // Note that we will still apply the clipping on the final rende ring of the filter.
1094 localPaintingInfo.clipToDirtyRect = !filterRenderer()->hasFilter ThatMovesPixels(); 1094 localPaintingInfo.clipToDirtyRect = !filterRenderer()->hasFilter ThatMovesPixels();
1095 } 1095 }
1096 } 1096 }
1097 } 1097 }
1098 1098
1099 if (filterPainter.hasStartedFilterEffect() && haveTransparency && !deferredF iltersEnabled) { 1099 if (filterPainter.hasStartedFilterEffect() && haveTransparency && !deferredF iltersEnabled) {
1100 // If we have a filter and transparency, we have to eagerly start a tran sparency layer here, rather than risk a child layer lazily starts one with the w rong context. 1100 // If we have a filter and transparency, we have to eagerly start a tran sparency layer here, rather than risk a child layer lazily starts one with the w rong context.
1101 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.root Layer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, localPain tingInfo.paintBehavior); 1101 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.root Layer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation);
1102 } 1102 }
1103 1103
1104 // If this layer's renderer is a child of the paintingRoot, we render uncond itionally, which 1104 // If this layer's renderer is a child of the paintingRoot, we render uncond itionally, which
1105 // is done by passing a nil paintingRoot down to our renderer (as if no pain tingRoot was ever set). 1105 // is done by passing a nil paintingRoot down to our renderer (as if no pain tingRoot was ever set).
1106 // Else, our renderer tree may or may not contain the painting root, so we p ass that root along 1106 // Else, our renderer tree may or may not contain the painting root, so we p ass that root along
1107 // so it will be tested against as we descend through the renderers. 1107 // so it will be tested against as we descend through the renderers.
1108 RenderObject* paintingRootForRenderer = 0; 1108 RenderObject* paintingRootForRenderer = 0;
1109 if (localPaintingInfo.paintingRoot && !renderer()->isDescendantOf(localPaint ingInfo.paintingRoot)) 1109 if (localPaintingInfo.paintingRoot && !renderer()->isDescendantOf(localPaint ingInfo.paintingRoot))
1110 paintingRootForRenderer = localPaintingInfo.paintingRoot; 1110 paintingRootForRenderer = localPaintingInfo.paintingRoot;
1111 1111
1112 // FIXME(sky): Get rid of PaintBehavior argument now that it's always Normal .
1113 PaintBehavior paintBehavior = PaintBehaviorNormal;
1114
1115 if (shouldPaintContent) { 1112 if (shouldPaintContent) {
1116 paintBackgroundForFragments(layerFragments, context, transparencyLayerCo ntext, paintingInfo.paintDirtyRect, haveTransparency, 1113 paintBackgroundForFragments(layerFragments, context, transparencyLayerCo ntext, paintingInfo.paintDirtyRect, haveTransparency,
1117 localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlag s); 1114 localPaintingInfo, paintingRootForRenderer, paintFlags);
1118 } 1115 }
1119 1116
1120 paintChildren(NegativeZOrderChildren, context, paintingInfo, paintFlags); 1117 paintChildren(NegativeZOrderChildren, context, paintingInfo, paintFlags);
1121 1118
1122 if (shouldPaintContent) { 1119 if (shouldPaintContent) {
1123 paintForegroundForFragments(layerFragments, context, transparencyLayerCo ntext, paintingInfo.paintDirtyRect, haveTransparency, 1120 paintForegroundForFragments(layerFragments, context, transparencyLayerCo ntext, paintingInfo.paintDirtyRect, haveTransparency,
1124 localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlag s); 1121 localPaintingInfo, paintingRootForRenderer, paintFlags);
1125 } 1122 }
1126 1123
1127 paintOutlineForFragments(layerFragments, context, localPaintingInfo, paintBe havior, paintingRootForRenderer, paintFlags); 1124 paintOutlineForFragments(layerFragments, context, localPaintingInfo, paintin gRootForRenderer, paintFlags);
1128 paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, painting Info, paintFlags); 1125 paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, painting Info, paintFlags);
1129 1126
1130 if (isPaintingOverlayScrollbars) 1127 if (isPaintingOverlayScrollbars)
1131 paintOverflowControlsForFragments(layerFragments, context, localPainting Info, paintFlags); 1128 paintOverflowControlsForFragments(layerFragments, context, localPainting Info, paintFlags);
1132 1129
1133 if (filterPainter.hasStartedFilterEffect()) { 1130 if (filterPainter.hasStartedFilterEffect()) {
1134 // Apply the correct clipping (ie. overflow: hidden). 1131 // Apply the correct clipping (ie. overflow: hidden).
1135 // FIXME: It is incorrect to just clip to the damageRect here once multi ple fragments are involved. 1132 // FIXME: It is incorrect to just clip to the damageRect here once multi ple fragments are involved.
1136 ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : layerF ragments[0].backgroundRect; 1133 ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : layerF ragments[0].backgroundRect;
1137 if (!deferredFiltersEnabled) 1134 if (!deferredFiltersEnabled)
(...skipping 17 matching lines...) Expand all
1155 } 1152 }
1156 } 1153 }
1157 1154
1158 void RenderLayer::paintLayerByApplyingTransform(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& translationOffset) 1155 void RenderLayer::paintLayerByApplyingTransform(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& translationOffset)
1159 { 1156 {
1160 // This involves subtracting out the position of the layer in our current co ordinate space, but preserving 1157 // This involves subtracting out the position of the layer in our current co ordinate space, but preserving
1161 // the accumulated error for sub-pixel layout. 1158 // the accumulated error for sub-pixel layout.
1162 LayoutPoint delta; 1159 LayoutPoint delta;
1163 convertToLayerCoords(paintingInfo.rootLayer, delta); 1160 convertToLayerCoords(paintingInfo.rootLayer, delta);
1164 delta.moveBy(translationOffset); 1161 delta.moveBy(translationOffset);
1165 TransformationMatrix transform(renderableTransform(paintingInfo.paintBehavio r)); 1162 TransformationMatrix transform(renderableTransform());
1166 IntPoint roundedDelta = roundedIntPoint(delta); 1163 IntPoint roundedDelta = roundedIntPoint(delta);
1167 transform.translateRight(roundedDelta.x(), roundedDelta.y()); 1164 transform.translateRight(roundedDelta.x(), roundedDelta.y());
1168 LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation + (delta - roundedDelta); 1165 LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation + (delta - roundedDelta);
1169 1166
1170 // Apply the transform. 1167 // Apply the transform.
1171 GraphicsContextStateSaver stateSaver(*context, false); 1168 GraphicsContextStateSaver stateSaver(*context, false);
1172 if (!transform.isIdentity()) { 1169 if (!transform.isIdentity()) {
1173 stateSaver.save(); 1170 stateSaver.save();
1174 context->concatCTM(transform.toAffineTransform()); 1171 context->concatCTM(transform.toAffineTransform());
1175 } 1172 }
1176 1173
1177 // Now do a paint with the root layer shifted to be us. 1174 // Now do a paint with the root layer shifted to be us.
1178 LayerPaintingInfo transformedPaintingInfo(this, enclosingIntRect(transform.i nverse().mapRect(paintingInfo.paintDirtyRect)), paintingInfo.paintBehavior, 1175 LayerPaintingInfo transformedPaintingInfo(this, enclosingIntRect(transform.i nverse().mapRect(paintingInfo.paintDirtyRect)),
1179 adjustedSubPixelAccumulation, paintingInfo.paintingRoot); 1176 adjustedSubPixelAccumulation, paintingInfo.paintingRoot);
1180 paintLayerContents(context, transformedPaintingInfo, paintFlags); 1177 paintLayerContents(context, transformedPaintingInfo, paintFlags);
1181 } 1178 }
1182 1179
1183 void RenderLayer::paintChildren(unsigned childrenToVisit, GraphicsContext* conte xt, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) 1180 void RenderLayer::paintChildren(unsigned childrenToVisit, GraphicsContext* conte xt, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
1184 { 1181 {
1185 if (!hasSelfPaintingLayerDescendant()) 1182 if (!hasSelfPaintingLayerDescendant())
1186 return; 1183 return;
1187 1184
1188 #if ENABLE(ASSERT) 1185 #if ENABLE(ASSERT)
(...skipping 22 matching lines...) Expand all
1211 { 1208 {
1212 ASSERT(offsetFromRoot); 1209 ASSERT(offsetFromRoot);
1213 for (size_t i = 0; i < fragments.size(); ++i) { 1210 for (size_t i = 0; i < fragments.size(); ++i) {
1214 LayerFragment& fragment = fragments.at(i); 1211 LayerFragment& fragment = fragments.at(i);
1215 LayoutPoint newOffsetFromRoot = *offsetFromRoot; 1212 LayoutPoint newOffsetFromRoot = *offsetFromRoot;
1216 fragment.shouldPaintContent = shouldPaintContent && intersectsDamageRect (fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLay er, &newOffsetFromRoot); 1213 fragment.shouldPaintContent = shouldPaintContent && intersectsDamageRect (fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLay er, &newOffsetFromRoot);
1217 } 1214 }
1218 } 1215 }
1219 1216
1220 void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, 1217 void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext,
1221 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 1218 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo,
1222 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) 1219 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags)
1223 { 1220 {
1224 for (size_t i = 0; i < layerFragments.size(); ++i) { 1221 for (size_t i = 0; i < layerFragments.size(); ++i) {
1225 const LayerFragment& fragment = layerFragments.at(i); 1222 const LayerFragment& fragment = layerFragments.at(i);
1226 if (!fragment.shouldPaintContent) 1223 if (!fragment.shouldPaintContent)
1227 continue; 1224 continue;
1228 1225
1229 // Begin transparency layers lazily now that we know we have to paint so mething. 1226 // Begin transparency layers lazily now that we know we have to paint so mething.
1230 if (haveTransparency) 1227 if (haveTransparency)
1231 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo. rootLayer, transparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, l ocalPaintingInfo.paintBehavior); 1228 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo. rootLayer, transparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation);
1232 1229
1233 if (localPaintingInfo.clipToDirtyRect) { 1230 if (localPaintingInfo.clipToDirtyRect) {
1234 // Paint our background first, before painting any child layers. 1231 // Paint our background first, before painting any child layers.
1235 // Establish the clip used to paint our background. 1232 // Establish the clip used to paint our background.
1236 clipToRect(localPaintingInfo, context, fragment.backgroundRect, pain tFlags, DoNotIncludeSelfForBorderRadius); // Background painting will handle cli pping to self. 1233 clipToRect(localPaintingInfo, context, fragment.backgroundRect, pain tFlags, DoNotIncludeSelfForBorderRadius); // Background painting will handle cli pping to self.
1237 } 1234 }
1238 1235
1239 // Paint the background. 1236 // Paint the background.
1240 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 1237 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
1241 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, 0, localPaintingInfo.rootLayer->renderer()); 1238 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseBlockBackground, paintingRootForRenderer, 0, localPaintingIn fo.rootLayer->renderer());
1242 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation)); 1239 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation));
1243 1240
1244 if (localPaintingInfo.clipToDirtyRect) 1241 if (localPaintingInfo.clipToDirtyRect)
1245 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect); 1242 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect);
1246 } 1243 }
1247 } 1244 }
1248 1245
1249 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, 1246 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext,
1250 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 1247 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo,
1251 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) 1248 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags)
1252 { 1249 {
1253 // Begin transparency if we have something to paint. 1250 // Begin transparency if we have something to paint.
1254 if (haveTransparency) { 1251 if (haveTransparency) {
1255 for (size_t i = 0; i < layerFragments.size(); ++i) { 1252 for (size_t i = 0; i < layerFragments.size(); ++i) {
1256 const LayerFragment& fragment = layerFragments.at(i); 1253 const LayerFragment& fragment = layerFragments.at(i);
1257 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty( )) { 1254 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty( )) {
1258 beginTransparencyLayers(transparencyLayerContext, localPaintingI nfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulatio n, localPaintingInfo.paintBehavior); 1255 beginTransparencyLayers(transparencyLayerContext, localPaintingI nfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulatio n);
1259 break; 1256 break;
1260 } 1257 }
1261 } 1258 }
1262 } 1259 }
1263 1260
1264 // Optimize clipping for the single fragment case. 1261 // Optimize clipping for the single fragment case.
1265 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && layerFragments[0].shouldPaintContent && !layerFragments[0].foregroundRe ct.isEmpty(); 1262 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && layerFragments[0].shouldPaintContent && !layerFragments[0].foregroundRe ct.isEmpty();
1266 if (shouldClip) 1263 if (shouldClip)
1267 clipToRect(localPaintingInfo, context, layerFragments[0].foregroundRect, paintFlags); 1264 clipToRect(localPaintingInfo, context, layerFragments[0].foregroundRect, paintFlags);
1268 1265
1269 // We have to loop through every fragment multiple times, since we have to i ssue paint invalidations in each specific phase in order for 1266 // We have to loop through every fragment multiple times, since we have to i ssue paint invalidations in each specific phase in order for
1270 // interleaving of the fragments to work properly. 1267 // interleaving of the fragments to work properly.
1271 paintForegroundForFragmentsWithPhase(PaintPhaseChildBlockBackgrounds, layerF ragments, 1268 paintForegroundForFragmentsWithPhase(PaintPhaseChildBlockBackgrounds, layerF ragments,
1272 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain tFlags); 1269 context, localPaintingInfo, paintingRootForRenderer, paintFlags);
1273 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragments, c ontext, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags); 1270 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragments, c ontext, localPaintingInfo, paintingRootForRenderer, paintFlags);
1274 paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragments , context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags ); 1271 paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragments , context, localPaintingInfo, paintingRootForRenderer, paintFlags);
1275 1272
1276 if (shouldClip) 1273 if (shouldClip)
1277 restoreClip(context, localPaintingInfo.paintDirtyRect, layerFragments[0] .foregroundRect); 1274 restoreClip(context, localPaintingInfo.paintDirtyRect, layerFragments[0] .foregroundRect);
1278 } 1275 }
1279 1276
1280 void RenderLayer::paintForegroundForFragmentsWithPhase(PaintPhase phase, const L ayerFragments& layerFragments, GraphicsContext* context, 1277 void RenderLayer::paintForegroundForFragmentsWithPhase(PaintPhase phase, const L ayerFragments& layerFragments, GraphicsContext* context,
1281 const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, Ren derObject* paintingRootForRenderer, PaintLayerFlags paintFlags) 1278 const LayerPaintingInfo& localPaintingInfo, RenderObject* paintingRootForRen derer, PaintLayerFlags paintFlags)
1282 { 1279 {
1283 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() > 1; 1280 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() > 1;
1284 1281
1285 for (size_t i = 0; i < layerFragments.size(); ++i) { 1282 for (size_t i = 0; i < layerFragments.size(); ++i) {
1286 const LayerFragment& fragment = layerFragments.at(i); 1283 const LayerFragment& fragment = layerFragments.at(i);
1287 if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty()) 1284 if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty())
1288 continue; 1285 continue;
1289 1286
1290 if (shouldClip) 1287 if (shouldClip)
1291 clipToRect(localPaintingInfo, context, fragment.foregroundRect, pain tFlags); 1288 clipToRect(localPaintingInfo, context, fragment.foregroundRect, pain tFlags);
1292 1289
1293 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.foregroundRect .rect()), phase, paintBehavior, paintingRootForRenderer, 0, localPaintingInfo.ro otLayer->renderer()); 1290 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.foregroundRect .rect()), phase, paintingRootForRenderer, 0, localPaintingInfo.rootLayer->render er());
1294 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation)); 1291 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation));
1295 1292
1296 if (shouldClip) 1293 if (shouldClip)
1297 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore groundRect); 1294 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore groundRect);
1298 } 1295 }
1299 } 1296 }
1300 1297
1301 void RenderLayer::paintOutlineForFragments(const LayerFragments& layerFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, 1298 void RenderLayer::paintOutlineForFragments(const LayerFragments& layerFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
1302 PaintBehavior paintBehavior, RenderObject* paintingRootForRenderer, PaintLay erFlags paintFlags) 1299 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags)
1303 { 1300 {
1304 for (size_t i = 0; i < layerFragments.size(); ++i) { 1301 for (size_t i = 0; i < layerFragments.size(); ++i) {
1305 const LayerFragment& fragment = layerFragments.at(i); 1302 const LayerFragment& fragment = layerFragments.at(i);
1306 if (fragment.outlineRect.isEmpty()) 1303 if (fragment.outlineRect.isEmpty())
1307 continue; 1304 continue;
1308 1305
1309 // Paint our own outline 1306 // Paint our own outline
1310 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.re ct()), PaintPhaseSelfOutline, paintBehavior, paintingRootForRenderer, 0, localPa intingInfo.rootLayer->renderer()); 1307 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.re ct()), PaintPhaseSelfOutline, paintingRootForRenderer, 0, localPaintingInfo.root Layer->renderer());
1311 clipToRect(localPaintingInfo, context, fragment.outlineRect, paintFlags, DoNotIncludeSelfForBorderRadius); 1308 clipToRect(localPaintingInfo, context, fragment.outlineRect, paintFlags, DoNotIncludeSelfForBorderRadius);
1312 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation)); 1309 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation));
1313 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.outlineR ect); 1310 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.outlineR ect);
1314 } 1311 }
1315 } 1312 }
1316 1313
1317 void RenderLayer::paintMaskForFragments(const LayerFragments& layerFragments, Gr aphicsContext* context, const LayerPaintingInfo& localPaintingInfo, 1314 void RenderLayer::paintMaskForFragments(const LayerFragments& layerFragments, Gr aphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
1318 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) 1315 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags)
1319 { 1316 {
1320 for (size_t i = 0; i < layerFragments.size(); ++i) { 1317 for (size_t i = 0; i < layerFragments.size(); ++i) {
1321 const LayerFragment& fragment = layerFragments.at(i); 1318 const LayerFragment& fragment = layerFragments.at(i);
1322 if (!fragment.shouldPaintContent) 1319 if (!fragment.shouldPaintContent)
1323 continue; 1320 continue;
1324 1321
1325 if (localPaintingInfo.clipToDirtyRect) 1322 if (localPaintingInfo.clipToDirtyRect)
1326 clipToRect(localPaintingInfo, context, fragment.backgroundRect, pain tFlags, DoNotIncludeSelfForBorderRadius); // Mask painting will handle clipping to self. 1323 clipToRect(localPaintingInfo, context, fragment.backgroundRect, pain tFlags, DoNotIncludeSelfForBorderRadius); // Mask painting will handle clipping to self.
1327 1324
1328 // Paint the mask. 1325 // Paint the mask.
1329 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 1326 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
1330 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseMask, PaintBehaviorNormal, paintingRootForRenderer, 0, local PaintingInfo.rootLayer->renderer()); 1327 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseMask, paintingRootForRenderer, 0, localPaintingInfo.rootLaye r->renderer());
1331 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation)); 1328 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation));
1332 1329
1333 if (localPaintingInfo.clipToDirtyRect) 1330 if (localPaintingInfo.clipToDirtyRect)
1334 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect); 1331 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect);
1335 } 1332 }
1336 } 1333 }
1337 1334
1338 void RenderLayer::paintOverflowControlsForFragments(const LayerFragments& layerF ragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags) 1335 void RenderLayer::paintOverflowControlsForFragments(const LayerFragments& layerF ragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags)
1339 { 1336 {
1340 for (size_t i = 0; i < layerFragments.size(); ++i) { 1337 for (size_t i = 0; i < layerFragments.size(); ++i) {
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 if (!isSelfPaintingLayer()) 1873 if (!isSelfPaintingLayer())
1877 return LayoutRect(); 1874 return LayoutRect();
1878 1875
1879 if (!ancestorLayer) 1876 if (!ancestorLayer)
1880 ancestorLayer = this; 1877 ancestorLayer = this;
1881 1878
1882 // The root layer is always just the size of the document. 1879 // The root layer is always just the size of the document.
1883 if (isRootLayer()) 1880 if (isRootLayer())
1884 return m_renderer->view()->unscaledDocumentRect(); 1881 return m_renderer->view()->unscaledDocumentRect();
1885 1882
1886 const bool shouldIncludeTransform = paintsWithTransform(PaintBehaviorNormal) || (options == ApplyBoundsChickenEggHacks && transform()); 1883 const bool shouldIncludeTransform = paintsWithTransform() || (options == App lyBoundsChickenEggHacks && transform());
1887 1884
1888 LayoutRect localClipRect = clipper().localClipRect(); 1885 LayoutRect localClipRect = clipper().localClipRect();
1889 if (localClipRect != PaintInfo::infiniteRect()) { 1886 if (localClipRect != PaintInfo::infiniteRect()) {
1890 if (shouldIncludeTransform) 1887 if (shouldIncludeTransform)
1891 localClipRect = transform()->mapRect(localClipRect); 1888 localClipRect = transform()->mapRect(localClipRect);
1892 1889
1893 LayoutPoint delta; 1890 LayoutPoint delta;
1894 convertToLayerCoords(ancestorLayer, delta); 1891 convertToLayerCoords(ancestorLayer, delta);
1895 localClipRect.moveBy(delta); 1892 localClipRect.moveBy(delta);
1896 return localClipRect; 1893 return localClipRect;
(...skipping 13 matching lines...) Expand all
1910 1907
1911 if (shouldIncludeTransform) 1908 if (shouldIncludeTransform)
1912 result = transform()->mapRect(result); 1909 result = transform()->mapRect(result);
1913 1910
1914 LayoutPoint delta; 1911 LayoutPoint delta;
1915 convertToLayerCoords(ancestorLayer, delta); 1912 convertToLayerCoords(ancestorLayer, delta);
1916 result.moveBy(delta); 1913 result.moveBy(delta);
1917 return result; 1914 return result;
1918 } 1915 }
1919 1916
1920 bool RenderLayer::paintsWithTransform(PaintBehavior paintBehavior) const 1917 bool RenderLayer::paintsWithTransform() const
1921 { 1918 {
1922 // FIXME(sky): Remove 1919 // FIXME(sky): Remove
1923 return transform(); 1920 return transform();
1924 } 1921 }
1925 1922
1926 bool RenderLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const 1923 bool RenderLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const
1927 { 1924 {
1928 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) 1925 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant())
1929 return false; 1926 return false;
1930 1927
1931 if (isTransparent()) 1928 if (isTransparent())
1932 return false; 1929 return false;
1933 1930
1934 if (paintsWithFilters() && renderer()->style()->filter().hasFilterThatAffect sOpacity()) 1931 if (paintsWithFilters() && renderer()->style()->filter().hasFilterThatAffect sOpacity())
1935 return false; 1932 return false;
1936 1933
1937 // FIXME: Handle simple transforms. 1934 // FIXME: Handle simple transforms.
1938 if (paintsWithTransform(PaintBehaviorNormal)) 1935 if (paintsWithTransform())
1939 return false; 1936 return false;
1940 1937
1941 // FIXME: Remove this check. 1938 // FIXME: Remove this check.
1942 // This function should not be called when layer-lists are dirty. 1939 // This function should not be called when layer-lists are dirty.
1943 // It is somehow getting triggered during style update. 1940 // It is somehow getting triggered during style update.
1944 if (m_stackingNode->zOrderListsDirty() || m_stackingNode->normalFlowListDirt y()) 1941 if (m_stackingNode->zOrderListsDirty() || m_stackingNode->normalFlowListDirt y())
1945 return false; 1942 return false;
1946 1943
1947 // FIXME: We currently only check the immediate renderer, 1944 // FIXME: We currently only check the immediate renderer,
1948 // which will miss many cases. 1945 // which will miss many cases.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 } 2145 }
2149 } 2146 }
2150 2147
2151 void showLayerTree(const blink::RenderObject* renderer) 2148 void showLayerTree(const blink::RenderObject* renderer)
2152 { 2149 {
2153 if (!renderer) 2150 if (!renderer)
2154 return; 2151 return;
2155 showLayerTree(renderer->enclosingLayer()); 2152 showLayerTree(renderer->enclosingLayer());
2156 } 2153 }
2157 #endif 2154 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698