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

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

Issue 625903004: [New Multicolumn] Correct paint rectangle calculation for compositing. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Got mislead by incorrect documentation. The paint rectangle is visual, not in flow thread coordinat… Created 6 years, 2 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
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 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 if (positionedParent->renderer()->hasOverflowClip()) { 807 if (positionedParent->renderer()->hasOverflowClip()) {
808 LayoutSize offset = positionedParent->renderBox()->scrolledContentOf fset(); 808 LayoutSize offset = positionedParent->renderBox()->scrolledContentOf fset();
809 localPoint -= offset; 809 localPoint -= offset;
810 } 810 }
811 811
812 if (positionedParent->renderer()->isRelPositioned() && positionedParent- >renderer()->isRenderInline()) { 812 if (positionedParent->renderer()->isRelPositioned() && positionedParent- >renderer()->isRenderInline()) {
813 LayoutSize offset = toRenderInline(positionedParent->renderer())->of fsetForInFlowPositionedInline(*toRenderBox(renderer())); 813 LayoutSize offset = toRenderInline(positionedParent->renderer())->of fsetForInFlowPositionedInline(*toRenderBox(renderer()));
814 localPoint += offset; 814 localPoint += offset;
815 } 815 }
816 } else if (parent()) { 816 } else if (parent()) {
817 // FIXME: This code is very wrong. The compositing system doesn't 817 // FIXME: This code is very wrong, but luckily only needed in the old/cu rrent multicol
818 // understand columns and we're hacking around that fact by faking 818 // implementation. The compositing system doesn't understand columns and we're hacking
819 // the position of the RenderLayers when we think we'll end up being 819 // around that fact by faking the position of the RenderLayers when we t hink we'll end up
820 // composited. Hopefully we'll be able to unwind this hack when we 820 // being composited.
821 // implement multi-column using regions.
822 if (hasStyleDeterminedDirectCompositingReasons()) { 821 if (hasStyleDeterminedDirectCompositingReasons()) {
823 // FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column. 822 // FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column.
824 // They won't split across columns properly. 823 // They won't split across columns properly.
825 if (!parent()->renderer()->hasColumns() && parent()->renderer()->isD ocumentElement() && renderer()->view()->hasColumns()) 824 if (!parent()->renderer()->hasColumns() && parent()->renderer()->isD ocumentElement() && renderer()->view()->hasColumns())
826 localPoint += renderer()->view()->columnOffset(localPoint); 825 localPoint += renderer()->view()->columnOffset(localPoint);
827 else
828 localPoint += parent()->renderer()->columnOffset(localPoint);
andersr 2014/10/07 15:51:21 Composited RenderLayers now render at flow-thread
mstensho (USE GERRIT) 2014/10/07 16:35:59 Done.
829 } 826 }
830 827
831 if (parent()->renderer()->hasOverflowClip()) { 828 if (parent()->renderer()->hasOverflowClip()) {
832 IntSize scrollOffset = parent()->renderBox()->scrolledContentOffset( ); 829 IntSize scrollOffset = parent()->renderBox()->scrolledContentOffset( );
833 localPoint -= scrollOffset; 830 localPoint -= scrollOffset;
834 } 831 }
835 } 832 }
836 833
837 localPoint.move(offsetForInFlowPosition()); 834 localPoint.move(offsetForInFlowPosition());
838 835
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 ClipRect backgroundRectInFlowThread; 1479 ClipRect backgroundRectInFlowThread;
1483 ClipRect foregroundRectInFlowThread; 1480 ClipRect foregroundRectInFlowThread;
1484 ClipRect outlineRectInFlowThread; 1481 ClipRect outlineRectInFlowThread;
1485 clipper().calculateRects(paginationClipRectsContext, PaintInfo::infiniteRect (), layerBoundsInFlowThread, backgroundRectInFlowThread, foregroundRectInFlowThr ead, 1482 clipper().calculateRects(paginationClipRectsContext, PaintInfo::infiniteRect (), layerBoundsInFlowThread, backgroundRectInFlowThread, foregroundRectInFlowThr ead,
1486 outlineRectInFlowThread, &offsetWithinPaginatedLayer); 1483 outlineRectInFlowThread, &offsetWithinPaginatedLayer);
1487 1484
1488 // Take our bounding box within the flow thread and clip it. 1485 // Take our bounding box within the flow thread and clip it.
1489 LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingB ox : physicalBoundingBox(enclosingPaginationLayer(), &offsetWithinPaginatedLayer ); 1486 LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingB ox : physicalBoundingBox(enclosingPaginationLayer(), &offsetWithinPaginatedLayer );
1490 layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect()); 1487 layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect());
1491 1488
1492 // Shift the dirty rect into flow thread coordinates. 1489 // Make the dirty rect relative to the fragmentation context (multicol conta iner, etc.).
1490 RenderFlowThread* enclosingFlowThread = toRenderFlowThread(enclosingPaginati onLayer()->renderer());
1493 LayoutPoint offsetOfPaginationLayerFromRoot; 1491 LayoutPoint offsetOfPaginationLayerFromRoot;
1494 enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOfPaginati onLayerFromRoot); 1492 // FIXME: more work needed if there are nested pagination layers.
1493 if (rootLayer != enclosingPaginationLayer() && rootLayer->enclosingPaginatio nLayer() == enclosingPaginationLayer()) {
1494 // The root layer is inside the fragmentation context. So we need to loo k inside it and find
1495 // the visual offset from the fragmentation context.
1496 LayoutPoint flowThreadOffset;
1497 rootLayer->convertToLayerCoords(enclosingPaginationLayer(), flowThreadOf fset);
1498 offsetOfPaginationLayerFromRoot = -enclosingFlowThread->flowThreadPointT oVisualPoint(flowThreadOffset);
1499 } else {
1500 enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOfPagi nationLayerFromRoot);
1501 }
1495 LayoutRect dirtyRectInFlowThread(dirtyRect); 1502 LayoutRect dirtyRectInFlowThread(dirtyRect);
1496 dirtyRectInFlowThread.moveBy(-offsetOfPaginationLayerFromRoot); 1503 dirtyRectInFlowThread.moveBy(-offsetOfPaginationLayerFromRoot);
1497 1504
1498 // Tell the flow thread to collect the fragments. We pass enough information to create a minimal number of fragments based off the pages/columns 1505 // Tell the flow thread to collect the fragments. We pass enough information to create a minimal number of fragments based off the pages/columns
1499 // that intersect the actual dirtyRect as well as the pages/columns that int ersect our layer's bounding box. 1506 // that intersect the actual dirtyRect as well as the pages/columns that int ersect our layer's bounding box.
1500 RenderFlowThread* enclosingFlowThread = toRenderFlowThread(enclosingPaginati onLayer()->renderer());
1501 enclosingFlowThread->collectLayerFragments(fragments, layerBoundingBoxInFlow Thread, dirtyRectInFlowThread); 1507 enclosingFlowThread->collectLayerFragments(fragments, layerBoundingBoxInFlow Thread, dirtyRectInFlowThread);
1502 1508
1503 if (fragments.isEmpty()) 1509 if (fragments.isEmpty())
1504 return; 1510 return;
1505 1511
1506 // Get the parent clip rects of the pagination layer, since we need to inter sect with that when painting column contents. 1512 // Get the parent clip rects of the pagination layer, since we need to inter sect with that when painting column contents.
1507 ClipRect ancestorClipRect = dirtyRect; 1513 ClipRect ancestorClipRect = dirtyRect;
1508 if (enclosingPaginationLayer()->parent()) { 1514 if (enclosingPaginationLayer()->parent()) {
1509 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, inOverl ayScrollbarSizeRelevancy); 1515 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, inOverl ayScrollbarSizeRelevancy);
1510 if (respectOverflowClip == IgnoreOverflowClip) 1516 if (respectOverflowClip == IgnoreOverflowClip)
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after
2851 } 2857 }
2852 } 2858 }
2853 2859
2854 void showLayerTree(const blink::RenderObject* renderer) 2860 void showLayerTree(const blink::RenderObject* renderer)
2855 { 2861 {
2856 if (!renderer) 2862 if (!renderer)
2857 return; 2863 return;
2858 showLayerTree(renderer->enclosingLayer()); 2864 showLayerTree(renderer->enclosingLayer());
2859 } 2865 }
2860 #endif 2866 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderFlowThread.h ('k') | Source/core/rendering/RenderMultiColumnSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698