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

Side by Side Diff: Source/core/rendering/RenderLayer.h

Issue 20723003: Fix pixel snapping issues when layers become composited (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 months 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2009, 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 // paints the layers that intersect the damage rect from back to 608 // paints the layers that intersect the damage rect from back to
609 // front. The hitTest method looks for mouse events by walking 609 // front. The hitTest method looks for mouse events by walking
610 // layers that intersect the point from front to back. 610 // layers that intersect the point from front to back.
611 void paint(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior = P aintBehaviorNormal, RenderObject* paintingRoot = 0, 611 void paint(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior = P aintBehaviorNormal, RenderObject* paintingRoot = 0,
612 RenderRegion* = 0, PaintLayerFlags = 0); 612 RenderRegion* = 0, PaintLayerFlags = 0);
613 bool hitTest(const HitTestRequest&, HitTestResult&); 613 bool hitTest(const HitTestRequest&, HitTestResult&);
614 bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&); 614 bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&);
615 void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior, RenderObject* paintingRoot = 0); 615 void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior, RenderObject* paintingRoot = 0);
616 616
617 struct ClipRectsContext { 617 struct ClipRectsContext {
618 ClipRectsContext(const RenderLayer* inRootLayer, RenderRegion* inRegion, ClipRectsType inClipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbar SizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip inRespectO verflowClip = RespectOverflowClip) 618 ClipRectsContext(const RenderLayer* inRootLayer, RenderRegion* inRegion, ClipRectsType inClipRectsType,
619 OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy = Igno reOverlayScrollbarSize,
620 ShouldRespectOverflowClip inRespectOverflowClip = RespectOverflowCli p, const LayoutSize& inSubPixelAccumulation = LayoutSize())
619 : rootLayer(inRootLayer) 621 : rootLayer(inRootLayer)
620 , region(inRegion) 622 , region(inRegion)
621 , clipRectsType(inClipRectsType) 623 , clipRectsType(inClipRectsType)
622 , overlayScrollbarSizeRelevancy(inOverlayScrollbarSizeRelevancy) 624 , overlayScrollbarSizeRelevancy(inOverlayScrollbarSizeRelevancy)
623 , respectOverflowClip(inRespectOverflowClip) 625 , respectOverflowClip(inRespectOverflowClip)
626 , subPixelAccumulation(inSubPixelAccumulation)
624 { } 627 { }
625 const RenderLayer* rootLayer; 628 const RenderLayer* rootLayer;
626 RenderRegion* region; 629 RenderRegion* region;
627 ClipRectsType clipRectsType; 630 ClipRectsType clipRectsType;
628 OverlayScrollbarSizeRelevancy overlayScrollbarSizeRelevancy; 631 OverlayScrollbarSizeRelevancy overlayScrollbarSizeRelevancy;
629 ShouldRespectOverflowClip respectOverflowClip; 632 ShouldRespectOverflowClip respectOverflowClip;
633 const LayoutSize& subPixelAccumulation;
630 }; 634 };
631 635
632 // This method figures out our layerBounds in coordinates relative to 636 // This method figures out our layerBounds in coordinates relative to
633 // |rootLayer}. It also computes our background and foreground clip rects 637 // |rootLayer}. It also computes our background and foreground clip rects
634 // for painting/event handling. 638 // for painting/event handling.
635 // Pass offsetFromRoot if known. 639 // Pass offsetFromRoot if known.
636 void calculateRects(const ClipRectsContext&, const LayoutRect& paintDirtyRec t, LayoutRect& layerBounds, 640 void calculateRects(const ClipRectsContext&, const LayoutRect& paintDirtyRec t, LayoutRect& layerBounds,
637 ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRec t, const LayoutPoint* offsetFromRoot = 0) const; 641 ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRec t, const LayoutPoint* offsetFromRoot = 0) const;
638 642
639 // Compute and cache clip rects computed with the given layer as the root 643 // Compute and cache clip rects computed with the given layer as the root
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 IntRect absoluteBoundingBox() const; 679 IntRect absoluteBoundingBox() const;
676 680
677 // Bounds used for layer overlap testing in RenderLayerCompositor. 681 // Bounds used for layer overlap testing in RenderLayerCompositor.
678 LayoutRect overlapBounds() const { return overlapBoundsIncludeChildren() ? c alculateLayerBounds(this) : localBoundingBox(); } 682 LayoutRect overlapBounds() const { return overlapBoundsIncludeChildren() ? c alculateLayerBounds(this) : localBoundingBox(); }
679 683
680 // If true, this layer's children are included in its bounds for overlap tes ting. 684 // If true, this layer's children are included in its bounds for overlap tes ting.
681 // We can't rely on the children's positions if this layer has a filter that could have moved the children's pixels around. 685 // We can't rely on the children's positions if this layer has a filter that could have moved the children's pixels around.
682 bool overlapBoundsIncludeChildren() const { return hasFilter() && renderer() ->style()->filter().hasFilterThatMovesPixels(); } 686 bool overlapBoundsIncludeChildren() const { return hasFilter() && renderer() ->style()->filter().hasFilterThatMovesPixels(); }
683 687
684 // Can pass offsetFromRoot if known. 688 // Can pass offsetFromRoot if known.
685 IntRect calculateLayerBounds(const RenderLayer* ancestorLayer, const LayoutP oint* offsetFromRoot = 0, CalculateLayerBoundsFlags = DefaultCalculateLayerBound sFlags) const; 689 LayoutRect calculateLayerBounds(const RenderLayer* ancestorLayer, const Layo utPoint* offsetFromRoot = 0, CalculateLayerBoundsFlags = DefaultCalculateLayerBo undsFlags) const;
686 690
687 // WARNING: This method returns the offset for the parent as this is what up dateLayerPositions expects. 691 // WARNING: This method returns the offset for the parent as this is what up dateLayerPositions expects.
688 LayoutPoint computeOffsetFromRoot(bool& hasLayerOffset) const; 692 LayoutPoint computeOffsetFromRoot(bool& hasLayerOffset) const;
689 693
690 // Return a cached repaint rect, computed relative to the layer renderer's c ontainerForRepaint. 694 // Return a cached repaint rect, computed relative to the layer renderer's c ontainerForRepaint.
691 LayoutRect repaintRect() const { return m_repaintRect; } 695 LayoutRect repaintRect() const { return m_repaintRect; }
692 LayoutRect repaintRectIncludingNonCompositingDescendants() const; 696 LayoutRect repaintRectIncludingNonCompositingDescendants() const;
693 697
694 void setRepaintStatus(RepaintStatus status) { m_repaintStatus = status; } 698 void setRepaintStatus(RepaintStatus status) { m_repaintStatus = status; }
695 699
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 void paintLayer(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags) ; 945 void paintLayer(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags) ;
942 void paintLayerContentsAndReflection(GraphicsContext*, const LayerPaintingIn fo&, PaintLayerFlags); 946 void paintLayerContentsAndReflection(GraphicsContext*, const LayerPaintingIn fo&, PaintLayerFlags);
943 void paintLayerByApplyingTransform(GraphicsContext*, const LayerPaintingInfo &, PaintLayerFlags, const LayoutPoint& translationOffset = LayoutPoint()); 947 void paintLayerByApplyingTransform(GraphicsContext*, const LayerPaintingInfo &, PaintLayerFlags, const LayoutPoint& translationOffset = LayoutPoint());
944 void paintLayerContents(GraphicsContext*, const LayerPaintingInfo&, PaintLay erFlags); 948 void paintLayerContents(GraphicsContext*, const LayerPaintingInfo&, PaintLay erFlags);
945 void paintList(Vector<RenderLayer*>*, GraphicsContext*, const LayerPaintingI nfo&, PaintLayerFlags); 949 void paintList(Vector<RenderLayer*>*, GraphicsContext*, const LayerPaintingI nfo&, PaintLayerFlags);
946 void paintPaginatedChildLayer(RenderLayer* childLayer, GraphicsContext*, con st LayerPaintingInfo&, PaintLayerFlags); 950 void paintPaginatedChildLayer(RenderLayer* childLayer, GraphicsContext*, con st LayerPaintingInfo&, PaintLayerFlags);
947 void paintChildLayerIntoColumns(RenderLayer* childLayer, GraphicsContext*, c onst LayerPaintingInfo&, PaintLayerFlags, const Vector<RenderLayer*>& columnLaye rs, size_t columnIndex); 951 void paintChildLayerIntoColumns(RenderLayer* childLayer, GraphicsContext*, c onst LayerPaintingInfo&, PaintLayerFlags, const Vector<RenderLayer*>& columnLaye rs, size_t columnIndex);
948 952
949 void collectFragments(LayerFragments&, const RenderLayer* rootLayer, RenderR egion*, const LayoutRect& dirtyRect, 953 void collectFragments(LayerFragments&, const RenderLayer* rootLayer, RenderR egion*, const LayoutRect& dirtyRect,
950 ClipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelev ancy = IgnoreOverlayScrollbarSize, 954 ClipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelev ancy = IgnoreOverlayScrollbarSize,
951 ShouldRespectOverflowClip = RespectOverflowClip, const LayoutPoint* offs etFromRoot = 0, const LayoutRect* layerBoundingBox = 0); 955 ShouldRespectOverflowClip = RespectOverflowClip, const LayoutPoint* offs etFromRoot = 0,
956 const LayoutSize& subPixelAccumulation = LayoutSize(), const LayoutRect* layerBoundingBox = 0);
952 void updatePaintingInfoForFragments(LayerFragments&, const LayerPaintingInfo &, PaintLayerFlags, bool shouldPaintContent, const LayoutPoint* offsetFromRoot); 957 void updatePaintingInfoForFragments(LayerFragments&, const LayerPaintingInfo &, PaintLayerFlags, bool shouldPaintContent, const LayoutPoint* offsetFromRoot);
953 void paintBackgroundForFragments(const LayerFragments&, GraphicsContext*, Gr aphicsContext* transparencyLayerContext, 958 void paintBackgroundForFragments(const LayerFragments&, GraphicsContext*, Gr aphicsContext* transparencyLayerContext,
954 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, con st LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer); 959 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, con st LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer);
955 void paintForegroundForFragments(const LayerFragments&, GraphicsContext*, Gr aphicsContext* transparencyLayerContext, 960 void paintForegroundForFragments(const LayerFragments&, GraphicsContext*, Gr aphicsContext* transparencyLayerContext,
956 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, con st LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer, 961 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, con st LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer,
957 bool selectionOnly, bool forceBlackText); 962 bool selectionOnly, bool forceBlackText);
958 void paintForegroundForFragmentsWithPhase(PaintPhase, const LayerFragments&, GraphicsContext*, const LayerPaintingInfo&, PaintBehavior, RenderObject* painti ngRootForRenderer); 963 void paintForegroundForFragmentsWithPhase(PaintPhase, const LayerFragments&, GraphicsContext*, const LayerPaintingInfo&, PaintBehavior, RenderObject* painti ngRootForRenderer);
959 void paintOutlineForFragments(const LayerFragments&, GraphicsContext*, const LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer); 964 void paintOutlineForFragments(const LayerFragments&, GraphicsContext*, const LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer);
960 void paintOverflowControlsForFragments(const LayerFragments&, GraphicsContex t*, const LayerPaintingInfo&); 965 void paintOverflowControlsForFragments(const LayerFragments&, GraphicsContex t*, const LayerPaintingInfo&);
961 void paintMaskForFragments(const LayerFragments&, GraphicsContext*, const La yerPaintingInfo&, RenderObject* paintingRootForRenderer); 966 void paintMaskForFragments(const LayerFragments&, GraphicsContext*, const La yerPaintingInfo&, RenderObject* paintingRootForRenderer);
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 1345
1341 } // namespace WebCore 1346 } // namespace WebCore
1342 1347
1343 #ifndef NDEBUG 1348 #ifndef NDEBUG
1344 // Outside the WebCore namespace for ease of invocation from gdb. 1349 // Outside the WebCore namespace for ease of invocation from gdb.
1345 void showLayerTree(const WebCore::RenderLayer*); 1350 void showLayerTree(const WebCore::RenderLayer*);
1346 void showLayerTree(const WebCore::RenderObject*); 1351 void showLayerTree(const WebCore::RenderObject*);
1347 #endif 1352 #endif
1348 1353
1349 #endif // RenderLayer_h 1354 #endif // RenderLayer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698