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

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

Issue 159863002: Remove CSS regions support, keeping a bare minimum to support "region-based" multicol. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 // If the previous block is absolutely positioned, then we can't be paginate d by the columns block. 618 // If the previous block is absolutely positioned, then we can't be paginate d by the columns block.
619 if (prevBlock->isOutOfFlowPositioned()) 619 if (prevBlock->isOutOfFlowPositioned())
620 return false; 620 return false;
621 621
622 // Otherwise we are paginated by the columns block. 622 // Otherwise we are paginated by the columns block.
623 return true; 623 return true;
624 } 624 }
625 625
626 bool RenderLayer::useRegionBasedColumns() const 626 bool RenderLayer::useRegionBasedColumns() const
627 { 627 {
628 const Settings* settings = renderer()->document().settings(); 628 return renderer()->document().regionBasedColumnsEnabled();
629 return settings && settings->regionBasedColumnsEnabled();
630 } 629 }
631 630
632 void RenderLayer::updatePagination() 631 void RenderLayer::updatePagination()
633 { 632 {
634 m_isPaginated = false; 633 m_isPaginated = false;
635 m_enclosingPaginationLayer = 0; 634 m_enclosingPaginationLayer = 0;
636 635
637 if (hasCompositedLayerMapping() || !parent()) 636 if (hasCompositedLayerMapping() || !parent())
638 return; // FIXME: We will have to deal with paginated compositing layers someday. 637 return; // FIXME: We will have to deal with paginated compositing layers someday.
639 // FIXME: For now the RenderView can't be paginated. Eventually printing will move to a model where it is though. 638 // FIXME: For now the RenderView can't be paginated. Eventually printing will move to a model where it is though.
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 EPosition position = renderer->style()->position(); 1499 EPosition position = renderer->style()->position();
1501 1500
1502 // FIXME: Special casing RenderFlowThread so much for fixed positioning here is not great. 1501 // FIXME: Special casing RenderFlowThread so much for fixed positioning here is not great.
1503 RenderFlowThread* fixedFlowThreadContainer = position == FixedPosition ? ren derer->flowThreadContainingBlock() : 0; 1502 RenderFlowThread* fixedFlowThreadContainer = position == FixedPosition ? ren derer->flowThreadContainingBlock() : 0;
1504 if (fixedFlowThreadContainer && !fixedFlowThreadContainer->isOutOfFlowPositi oned()) 1503 if (fixedFlowThreadContainer && !fixedFlowThreadContainer->isOutOfFlowPositi oned())
1505 fixedFlowThreadContainer = 0; 1504 fixedFlowThreadContainer = 0;
1506 1505
1507 // FIXME: Positioning of out-of-flow(fixed, absolute) elements collected in a RenderFlowThread 1506 // FIXME: Positioning of out-of-flow(fixed, absolute) elements collected in a RenderFlowThread
1508 // may need to be revisited in a future patch. 1507 // may need to be revisited in a future patch.
1509 // If the fixed renderer is inside a RenderFlowThread, we should not compute location using localToAbsolute, 1508 // If the fixed renderer is inside a RenderFlowThread, we should not compute location using localToAbsolute,
1510 // since localToAbsolute maps the coordinates from named flow to regions coo rdinates and regions can be 1509 // since localToAbsolute maps the coordinates from flow thread to regions co ordinates and regions can be
1511 // positioned in a completely different place in the viewport (RenderView). 1510 // positioned in a completely different place in the viewport (RenderView).
1512 if (position == FixedPosition && !fixedFlowThreadContainer && (!ancestorLaye r || ancestorLayer == renderer->view()->layer())) { 1511 if (position == FixedPosition && !fixedFlowThreadContainer && (!ancestorLaye r || ancestorLayer == renderer->view()->layer())) {
1513 // If the fixed layer's container is the root, just add in the offset of the view. We can obtain this by calling 1512 // If the fixed layer's container is the root, just add in the offset of the view. We can obtain this by calling
1514 // localToAbsolute() on the RenderView. 1513 // localToAbsolute() on the RenderView.
1515 FloatPoint absPos = renderer->localToAbsolute(FloatPoint(), IsFixed); 1514 FloatPoint absPos = renderer->localToAbsolute(FloatPoint(), IsFixed);
1516 location += LayoutSize(absPos.x(), absPos.y()); 1515 location += LayoutSize(absPos.x(), absPos.y());
1517 return ancestorLayer; 1516 return ancestorLayer;
1518 } 1517 }
1519 1518
1520 // For the fixed positioned elements inside a render flow thread, we should also skip the code path below 1519 // For the fixed positioned elements inside a render flow thread, we should also skip the code path below
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 if (hasCompositedLayerMapping()) 1717 if (hasCompositedLayerMapping())
1719 return compositedLayerMapping()->collectTrackedRepaintRects(); 1718 return compositedLayerMapping()->collectTrackedRepaintRects();
1720 return nullptr; 1719 return nullptr;
1721 } 1720 }
1722 1721
1723 bool RenderLayer::hasOverflowControls() const 1722 bool RenderLayer::hasOverflowControls() const
1724 { 1723 {
1725 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable Area->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE); 1724 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable Area->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE);
1726 } 1725 }
1727 1726
1728 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot, RenderRegion* region, P aintLayerFlags paintFlags) 1727 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot, PaintLayerFlags paintFl ags)
1729 { 1728 {
1730 OverlapTestRequestMap overlapTestRequests; 1729 OverlapTestRequestMap overlapTestRequests;
1731 1730
1732 LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBeha vior, LayoutSize(), paintingRoot, region, &overlapTestRequests); 1731 LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBeha vior, LayoutSize(), paintingRoot, &overlapTestRequests);
1733 paintLayer(context, paintingInfo, paintFlags); 1732 paintLayer(context, paintingInfo, paintFlags);
1734 1733
1735 OverlapTestRequestMap::iterator end = overlapTestRequests.end(); 1734 OverlapTestRequestMap::iterator end = overlapTestRequests.end();
1736 for (OverlapTestRequestMap::iterator it = overlapTestRequests.begin(); it != end; ++it) 1735 for (OverlapTestRequestMap::iterator it = overlapTestRequests.begin(); it != end; ++it)
1737 it->key->setIsOverlapped(false); 1736 it->key->setIsOverlapped(false);
1738 } 1737 }
1739 1738
1740 void RenderLayer::paintOverlayScrollbars(GraphicsContext* context, const LayoutR ect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot) 1739 void RenderLayer::paintOverlayScrollbars(GraphicsContext* context, const LayoutR ect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot)
1741 { 1740 {
1742 if (!m_containsDirtyOverlayScrollbars) 1741 if (!m_containsDirtyOverlayScrollbars)
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1882 } 1881 }
1883 1882
1884 if (enclosingPaginationLayer()) { 1883 if (enclosingPaginationLayer()) {
1885 paintTransformedLayerIntoFragments(context, paintingInfo, paintFlags ); 1884 paintTransformedLayerIntoFragments(context, paintingInfo, paintFlags );
1886 return; 1885 return;
1887 } 1886 }
1888 1887
1889 // Make sure the parent's clip rects have been calculated. 1888 // Make sure the parent's clip rects have been calculated.
1890 ClipRect clipRect = paintingInfo.paintDirtyRect; 1889 ClipRect clipRect = paintingInfo.paintDirtyRect;
1891 if (parent()) { 1890 if (parent()) {
1892 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, paintingIn fo.region, (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : Pa intingClipRects, 1891 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlag s & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects,
1893 IgnoreOverlayScrollbarSize, (paintFlags & PaintLayerPaintingOver flowContents) ? IgnoreOverflowClip : RespectOverflowClip); 1892 IgnoreOverlayScrollbarSize, (paintFlags & PaintLayerPaintingOver flowContents) ? IgnoreOverflowClip : RespectOverflowClip);
1894 clipRect = clipper().backgroundClipRect(clipRectsContext); 1893 clipRect = clipper().backgroundClipRect(clipRectsContext);
1895 clipRect.intersect(paintingInfo.paintDirtyRect); 1894 clipRect.intersect(paintingInfo.paintDirtyRect);
1896 1895
1897 // Push the parent coordinate space's clip. 1896 // Push the parent coordinate space's clip.
1898 parent()->clipToRect(paintingInfo.rootLayer, context, paintingInfo.p aintDirtyRect, clipRect); 1897 parent()->clipToRect(paintingInfo.rootLayer, context, paintingInfo.p aintDirtyRect, clipRect);
1899 } 1898 }
1900 1899
1901 paintLayerByApplyingTransform(context, paintingInfo, paintFlags); 1900 paintLayerByApplyingTransform(context, paintingInfo, paintFlags);
1902 1901
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
2075 PaintBehavior paintBehavior = PaintBehaviorNormal; 2074 PaintBehavior paintBehavior = PaintBehaviorNormal;
2076 if (paintFlags & PaintLayerPaintingSkipRootBackground) 2075 if (paintFlags & PaintLayerPaintingSkipRootBackground)
2077 paintBehavior |= PaintBehaviorSkipRootBackground; 2076 paintBehavior |= PaintBehaviorSkipRootBackground;
2078 else if (paintFlags & PaintLayerPaintingRootBackgroundOnly) 2077 else if (paintFlags & PaintLayerPaintingRootBackgroundOnly)
2079 paintBehavior |= PaintBehaviorRootBackgroundOnly; 2078 paintBehavior |= PaintBehaviorRootBackgroundOnly;
2080 2079
2081 LayerFragments layerFragments; 2080 LayerFragments layerFragments;
2082 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { 2081 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) {
2083 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment, as well as whether or not the content of each 2082 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment, as well as whether or not the content of each
2084 // fragment should paint. 2083 // fragment should paint.
2085 collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaint ingInfo.region, localPaintingInfo.paintDirtyRect, 2084 collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaint ingInfo.paintDirtyRect,
2086 (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : P aintingClipRects, IgnoreOverlayScrollbarSize, 2085 (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : P aintingClipRects, IgnoreOverlayScrollbarSize,
2087 (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowC lip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation); 2086 (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowC lip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation);
2088 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF lags, shouldPaintContent, &offsetFromRoot); 2087 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF lags, shouldPaintContent, &offsetFromRoot);
2089 } 2088 }
2090 2089
2091 if (shouldPaintBackground) 2090 if (shouldPaintBackground)
2092 paintBackgroundForFragments(layerFragments, context, transparencyLayerCo ntext, paintingInfo.paintDirtyRect, haveTransparency, 2091 paintBackgroundForFragments(layerFragments, context, transparencyLayerCo ntext, paintingInfo.paintDirtyRect, haveTransparency,
2093 localPaintingInfo, paintBehavior, paintingRootForRenderer); 2092 localPaintingInfo, paintBehavior, paintingRootForRenderer);
2094 2093
2095 if (shouldPaintNegZOrderList) 2094 if (shouldPaintNegZOrderList)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2156 2155
2157 // Apply the transform. 2156 // Apply the transform.
2158 GraphicsContextStateSaver stateSaver(*context, false); 2157 GraphicsContextStateSaver stateSaver(*context, false);
2159 if (!transform.isIdentity()) { 2158 if (!transform.isIdentity()) {
2160 stateSaver.save(); 2159 stateSaver.save();
2161 context->concatCTM(transform.toAffineTransform()); 2160 context->concatCTM(transform.toAffineTransform());
2162 } 2161 }
2163 2162
2164 // Now do a paint with the root layer shifted to be us. 2163 // Now do a paint with the root layer shifted to be us.
2165 LayerPaintingInfo transformedPaintingInfo(this, enclosingIntRect(transform.i nverse().mapRect(paintingInfo.paintDirtyRect)), paintingInfo.paintBehavior, 2164 LayerPaintingInfo transformedPaintingInfo(this, enclosingIntRect(transform.i nverse().mapRect(paintingInfo.paintDirtyRect)), paintingInfo.paintBehavior,
2166 adjustedSubPixelAccumulation, paintingInfo.paintingRoot, paintingInfo.re gion, paintingInfo.overlapTestRequests); 2165 adjustedSubPixelAccumulation, paintingInfo.paintingRoot, paintingInfo.ov erlapTestRequests);
2167 paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags ); 2166 paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags );
2168 } 2167 }
2169 2168
2170 void RenderLayer::paintChildren(unsigned childrenToVisit, GraphicsContext* conte xt, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) 2169 void RenderLayer::paintChildren(unsigned childrenToVisit, GraphicsContext* conte xt, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
2171 { 2170 {
2172 if (!hasSelfPaintingLayerDescendant()) 2171 if (!hasSelfPaintingLayerDescendant())
2173 return; 2172 return;
2174 2173
2175 #if !ASSERT_DISABLED 2174 #if !ASSERT_DISABLED
2176 LayerListMutationDetector mutationChecker(m_stackingNode.get()); 2175 LayerListMutationDetector mutationChecker(m_stackingNode.get());
2177 #endif 2176 #endif
2178 2177
2179 RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit); 2178 RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit);
2180 while (RenderLayerStackingNode* child = iterator.next()) { 2179 while (RenderLayerStackingNode* child = iterator.next()) {
2181 RenderLayer* childLayer = child->layer(); 2180 RenderLayer* childLayer = child->layer();
2182 2181
2183 // Squashed RenderLayers should not paint into their ancestor. 2182 // Squashed RenderLayers should not paint into their ancestor.
2184 if (childLayer->compositingState() == PaintsIntoGroupedBacking) 2183 if (childLayer->compositingState() == PaintsIntoGroupedBacking)
2185 continue; 2184 continue;
2186 2185
2187 if (!childLayer->isPaginated()) 2186 if (!childLayer->isPaginated())
2188 childLayer->paintLayer(context, paintingInfo, paintFlags); 2187 childLayer->paintLayer(context, paintingInfo, paintFlags);
2189 else 2188 else
2190 paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFla gs); 2189 paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFla gs);
2191 } 2190 }
2192 } 2191 }
2193 2192
2194 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer* rootLayer, RenderRegion* region, const LayoutRect& dirtyRect, 2193 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer* rootLayer, const LayoutRect& dirtyRect,
2195 ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollba rSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint * offsetFromRoot, 2194 ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollba rSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint * offsetFromRoot,
2196 const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox) 2195 const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox)
2197 { 2196 {
2198 if (!enclosingPaginationLayer() || hasTransform()) { 2197 if (!enclosingPaginationLayer() || hasTransform()) {
2199 // For unpaginated layers, there is only one fragment. 2198 // For unpaginated layers, there is only one fragment.
2200 LayerFragment fragment; 2199 LayerFragment fragment;
2201 ClipRectsContext clipRectsContext(rootLayer, region, clipRectsType, inOv erlayScrollbarSizeRelevancy, respectOverflowClip, subPixelAccumulation); 2200 ClipRectsContext clipRectsContext(rootLayer, clipRectsType, inOverlayScr ollbarSizeRelevancy, respectOverflowClip, subPixelAccumulation);
2202 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBoun ds, fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offs etFromRoot); 2201 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBoun ds, fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offs etFromRoot);
2203 fragments.append(fragment); 2202 fragments.append(fragment);
2204 return; 2203 return;
2205 } 2204 }
2206 2205
2207 // Compute our offset within the enclosing pagination layer. 2206 // Compute our offset within the enclosing pagination layer.
2208 LayoutPoint offsetWithinPaginatedLayer; 2207 LayoutPoint offsetWithinPaginatedLayer;
2209 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer) ; 2208 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer) ;
2210 2209
2211 // Calculate clip rects relative to the enclosingPaginationLayer. The purpos e of this call is to determine our bounds clipped to intermediate 2210 // Calculate clip rects relative to the enclosingPaginationLayer. The purpos e of this call is to determine our bounds clipped to intermediate
2212 // layers between us and the pagination context. It's important to minimize the number of fragments we need to create and this helps with that. 2211 // layers between us and the pagination context. It's important to minimize the number of fragments we need to create and this helps with that.
2213 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), regi on, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip); 2212 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), clip RectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip);
2214 LayoutRect layerBoundsInFlowThread; 2213 LayoutRect layerBoundsInFlowThread;
2215 ClipRect backgroundRectInFlowThread; 2214 ClipRect backgroundRectInFlowThread;
2216 ClipRect foregroundRectInFlowThread; 2215 ClipRect foregroundRectInFlowThread;
2217 ClipRect outlineRectInFlowThread; 2216 ClipRect outlineRectInFlowThread;
2218 clipper().calculateRects(paginationClipRectsContext, PaintInfo::infiniteRect (), layerBoundsInFlowThread, backgroundRectInFlowThread, foregroundRectInFlowThr ead, 2217 clipper().calculateRects(paginationClipRectsContext, PaintInfo::infiniteRect (), layerBoundsInFlowThread, backgroundRectInFlowThread, foregroundRectInFlowThr ead,
2219 outlineRectInFlowThread, &offsetWithinPaginatedLayer); 2218 outlineRectInFlowThread, &offsetWithinPaginatedLayer);
2220 2219
2221 // Take our bounding box within the flow thread and clip it. 2220 // Take our bounding box within the flow thread and clip it.
2222 LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingB ox : boundingBox(enclosingPaginationLayer(), 0, &offsetWithinPaginatedLayer); 2221 LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingB ox : boundingBox(enclosingPaginationLayer(), 0, &offsetWithinPaginatedLayer);
2223 layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect()); 2222 layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect());
2224 2223
2225 // Shift the dirty rect into flow thread coordinates. 2224 // Shift the dirty rect into flow thread coordinates.
2226 LayoutPoint offsetOfPaginationLayerFromRoot; 2225 LayoutPoint offsetOfPaginationLayerFromRoot;
2227 enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOfPaginati onLayerFromRoot); 2226 enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOfPaginati onLayerFromRoot);
2228 LayoutRect dirtyRectInFlowThread(dirtyRect); 2227 LayoutRect dirtyRectInFlowThread(dirtyRect);
2229 dirtyRectInFlowThread.moveBy(-offsetOfPaginationLayerFromRoot); 2228 dirtyRectInFlowThread.moveBy(-offsetOfPaginationLayerFromRoot);
2230 2229
2231 // Tell the flow thread to collect the fragments. We pass enough information to create a minimal number of fragments based off the pages/columns 2230 // Tell the flow thread to collect the fragments. We pass enough information to create a minimal number of fragments based off the pages/columns
2232 // that intersect the actual dirtyRect as well as the pages/columns that int ersect our layer's bounding box. 2231 // that intersect the actual dirtyRect as well as the pages/columns that int ersect our layer's bounding box.
2233 RenderFlowThread* enclosingFlowThread = toRenderFlowThread(enclosingPaginati onLayer()->renderer()); 2232 RenderFlowThread* enclosingFlowThread = toRenderFlowThread(enclosingPaginati onLayer()->renderer());
2234 enclosingFlowThread->collectLayerFragments(fragments, layerBoundingBoxInFlow Thread, dirtyRectInFlowThread); 2233 enclosingFlowThread->collectLayerFragments(fragments, layerBoundingBoxInFlow Thread, dirtyRectInFlowThread);
2235 2234
2236 if (fragments.isEmpty()) 2235 if (fragments.isEmpty())
2237 return; 2236 return;
2238 2237
2239 // Get the parent clip rects of the pagination layer, since we need to inter sect with that when painting column contents. 2238 // Get the parent clip rects of the pagination layer, since we need to inter sect with that when painting column contents.
2240 ClipRect ancestorClipRect = dirtyRect; 2239 ClipRect ancestorClipRect = dirtyRect;
2241 if (enclosingPaginationLayer()->parent()) { 2240 if (enclosingPaginationLayer()->parent()) {
2242 ClipRectsContext clipRectsContext(rootLayer, region, clipRectsType, inOv erlayScrollbarSizeRelevancy, respectOverflowClip); 2241 ClipRectsContext clipRectsContext(rootLayer, clipRectsType, inOverlayScr ollbarSizeRelevancy, respectOverflowClip);
2243 ancestorClipRect = enclosingPaginationLayer()->clipper().backgroundClipR ect(clipRectsContext); 2242 ancestorClipRect = enclosingPaginationLayer()->clipper().backgroundClipR ect(clipRectsContext);
2244 ancestorClipRect.intersect(dirtyRect); 2243 ancestorClipRect.intersect(dirtyRect);
2245 } 2244 }
2246 2245
2247 for (size_t i = 0; i < fragments.size(); ++i) { 2246 for (size_t i = 0; i < fragments.size(); ++i) {
2248 LayerFragment& fragment = fragments.at(i); 2247 LayerFragment& fragment = fragments.at(i);
2249 2248
2250 // Set our four rects with all clipping applied that was internal to the flow thread. 2249 // Set our four rects with all clipping applied that was internal to the flow thread.
2251 fragment.setRects(layerBoundsInFlowThread, backgroundRectInFlowThread, f oregroundRectInFlowThread, outlineRectInFlowThread); 2250 fragment.setRects(layerBoundsInFlowThread, backgroundRectInFlowThread, f oregroundRectInFlowThread, outlineRectInFlowThread);
2252 2251
(...skipping 22 matching lines...) Expand all
2275 fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBo unds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFro mRoot); 2274 fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBo unds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFro mRoot);
2276 } 2275 }
2277 } 2276 }
2278 } 2277 }
2279 2278
2280 void RenderLayer::paintTransformedLayerIntoFragments(GraphicsContext* context, c onst LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) 2279 void RenderLayer::paintTransformedLayerIntoFragments(GraphicsContext* context, c onst LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
2281 { 2280 {
2282 LayerFragments enclosingPaginationFragments; 2281 LayerFragments enclosingPaginationFragments;
2283 LayoutPoint offsetOfPaginationLayerFromRoot; 2282 LayoutPoint offsetOfPaginationLayerFromRoot;
2284 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination Layer(), PaintingTransparencyClipBox, RootOfTransparencyClipBox, paintingInfo.pa intBehavior); 2283 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination Layer(), PaintingTransparencyClipBox, RootOfTransparencyClipBox, paintingInfo.pa intBehavior);
2285 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, p aintingInfo.rootLayer, paintingInfo.region, paintingInfo.paintDirtyRect, 2284 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, p aintingInfo.rootLayer, paintingInfo.paintDirtyRect,
2286 (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : Paint ingClipRects, IgnoreOverlayScrollbarSize, 2285 (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : Paint ingClipRects, IgnoreOverlayScrollbarSize,
2287 (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetOfPaginationLayerFromRoot, paintingInfo.subPixelAcc umulation, &transformedExtent); 2286 (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetOfPaginationLayerFromRoot, paintingInfo.subPixelAcc umulation, &transformedExtent);
2288 2287
2289 for (size_t i = 0; i < enclosingPaginationFragments.size(); ++i) { 2288 for (size_t i = 0; i < enclosingPaginationFragments.size(); ++i) {
2290 const LayerFragment& fragment = enclosingPaginationFragments.at(i); 2289 const LayerFragment& fragment = enclosingPaginationFragments.at(i);
2291 2290
2292 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and 2291 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and
2293 // the enclosing pagination layer. 2292 // the enclosing pagination layer.
2294 LayoutRect clipRect = fragment.backgroundRect.rect(); 2293 LayoutRect clipRect = fragment.backgroundRect.rect();
2295 2294
2296 // Now compute the clips within a given fragment 2295 // Now compute the clips within a given fragment
2297 if (parent() != enclosingPaginationLayer()) { 2296 if (parent() != enclosingPaginationLayer()) {
2298 enclosingPaginationLayer()->convertToLayerCoords(paintingInfo.rootLa yer, offsetOfPaginationLayerFromRoot); 2297 enclosingPaginationLayer()->convertToLayerCoords(paintingInfo.rootLa yer, offsetOfPaginationLayerFromRoot);
2299 2298
2300 ClipRectsContext clipRectsContext(enclosingPaginationLayer(), painti ngInfo.region, (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, 2299 ClipRectsContext clipRectsContext(enclosingPaginationLayer(), (paint Flags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects,
2301 IgnoreOverlayScrollbarSize, (paintFlags & PaintLayerPaintingOver flowContents) ? IgnoreOverflowClip : RespectOverflowClip); 2300 IgnoreOverlayScrollbarSize, (paintFlags & PaintLayerPaintingOver flowContents) ? IgnoreOverflowClip : RespectOverflowClip);
2302 LayoutRect parentClipRect = clipper().backgroundClipRect(clipRectsCo ntext).rect(); 2301 LayoutRect parentClipRect = clipper().backgroundClipRect(clipRectsCo ntext).rect();
2303 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination LayerFromRoot); 2302 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination LayerFromRoot);
2304 clipRect.intersect(parentClipRect); 2303 clipRect.intersect(parentClipRect);
2305 } 2304 }
2306 2305
2307 parent()->clipToRect(paintingInfo.rootLayer, context, paintingInfo.paint DirtyRect, clipRect); 2306 parent()->clipToRect(paintingInfo.rootLayer, context, paintingInfo.paint DirtyRect, clipRect);
2308 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset); 2307 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset);
2309 parent()->restoreClip(context, paintingInfo.paintDirtyRect, clipRect); 2308 parent()->restoreClip(context, paintingInfo.paintDirtyRect, clipRect);
2310 } 2309 }
(...skipping 22 matching lines...) Expand all
2333 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo. rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior); 2332 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo. rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior);
2334 2333
2335 if (localPaintingInfo.clipToDirtyRect) { 2334 if (localPaintingInfo.clipToDirtyRect) {
2336 // Paint our background first, before painting any child layers. 2335 // Paint our background first, before painting any child layers.
2337 // Establish the clip used to paint our background. 2336 // Establish the clip used to paint our background.
2338 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Bac kground painting will handle clipping to self. 2337 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Bac kground painting will handle clipping to self.
2339 } 2338 }
2340 2339
2341 // Paint the background. 2340 // Paint the background.
2342 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 2341 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
2343 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, loc alPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); 2342 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, 0, 0, localPaintingInfo.rootLayer->renderer());
2344 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu mulation, compositingState()))); 2343 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu mulation, compositingState())));
2345 2344
2346 if (localPaintingInfo.clipToDirtyRect) 2345 if (localPaintingInfo.clipToDirtyRect)
2347 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect); 2346 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect);
2348 } 2347 }
2349 } 2348 }
2350 2349
2351 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, 2350 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext,
2352 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 2351 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior,
2353 RenderObject* paintingRootForRenderer, bool selectionOnly, bool forceBlackTe xt) 2352 RenderObject* paintingRootForRenderer, bool selectionOnly, bool forceBlackTe xt)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2391 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() > 1; 2390 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() > 1;
2392 2391
2393 for (size_t i = 0; i < layerFragments.size(); ++i) { 2392 for (size_t i = 0; i < layerFragments.size(); ++i) {
2394 const LayerFragment& fragment = layerFragments.at(i); 2393 const LayerFragment& fragment = layerFragments.at(i);
2395 if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty()) 2394 if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty())
2396 continue; 2395 continue;
2397 2396
2398 if (shouldClip) 2397 if (shouldClip)
2399 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.foregroundRect); 2398 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.foregroundRect);
2400 2399
2401 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.foregroundRect .rect()), phase, paintBehavior, paintingRootForRenderer, localPaintingInfo.regio n, 0, 0, localPaintingInfo.rootLayer->renderer()); 2400 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.foregroundRect .rect()), phase, paintBehavior, paintingRootForRenderer, 0, 0, localPaintingInfo .rootLayer->renderer());
2402 if (phase == PaintPhaseForeground) 2401 if (phase == PaintPhaseForeground)
2403 paintInfo.overlapTestRequests = localPaintingInfo.overlapTestRequest s; 2402 paintInfo.overlapTestRequests = localPaintingInfo.overlapTestRequest s;
2404 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu mulation, compositingState()))); 2403 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu mulation, compositingState())));
2405 2404
2406 if (shouldClip) 2405 if (shouldClip)
2407 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore groundRect); 2406 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore groundRect);
2408 } 2407 }
2409 } 2408 }
2410 2409
2411 void RenderLayer::paintOutlineForFragments(const LayerFragments& layerFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, 2410 void RenderLayer::paintOutlineForFragments(const LayerFragments& layerFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
2412 PaintBehavior paintBehavior, RenderObject* paintingRootForRenderer) 2411 PaintBehavior paintBehavior, RenderObject* paintingRootForRenderer)
2413 { 2412 {
2414 for (size_t i = 0; i < layerFragments.size(); ++i) { 2413 for (size_t i = 0; i < layerFragments.size(); ++i) {
2415 const LayerFragment& fragment = layerFragments.at(i); 2414 const LayerFragment& fragment = layerFragments.at(i);
2416 if (fragment.outlineRect.isEmpty()) 2415 if (fragment.outlineRect.isEmpty())
2417 continue; 2416 continue;
2418 2417
2419 // Paint our own outline 2418 // Paint our own outline
2420 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.re ct()), PaintPhaseSelfOutline, paintBehavior, paintingRootForRenderer, localPaint ingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); 2419 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.re ct()), PaintPhaseSelfOutline, paintBehavior, paintingRootForRenderer, 0, 0, loca lPaintingInfo.rootLayer->renderer());
2421 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paint DirtyRect, fragment.outlineRect, DoNotIncludeSelfForBorderRadius); 2420 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paint DirtyRect, fragment.outlineRect, DoNotIncludeSelfForBorderRadius);
2422 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu mulation, compositingState()))); 2421 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu mulation, compositingState())));
2423 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.outlineR ect); 2422 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.outlineR ect);
2424 } 2423 }
2425 } 2424 }
2426 2425
2427 void RenderLayer::paintMaskForFragments(const LayerFragments& layerFragments, Gr aphicsContext* context, const LayerPaintingInfo& localPaintingInfo, 2426 void RenderLayer::paintMaskForFragments(const LayerFragments& layerFragments, Gr aphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
2428 RenderObject* paintingRootForRenderer) 2427 RenderObject* paintingRootForRenderer)
2429 { 2428 {
2430 for (size_t i = 0; i < layerFragments.size(); ++i) { 2429 for (size_t i = 0; i < layerFragments.size(); ++i) {
2431 const LayerFragment& fragment = layerFragments.at(i); 2430 const LayerFragment& fragment = layerFragments.at(i);
2432 if (!fragment.shouldPaintContent) 2431 if (!fragment.shouldPaintContent)
2433 continue; 2432 continue;
2434 2433
2435 if (localPaintingInfo.clipToDirtyRect) 2434 if (localPaintingInfo.clipToDirtyRect)
2436 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Mas k painting will handle clipping to self. 2435 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Mas k painting will handle clipping to self.
2437 2436
2438 // Paint the mask. 2437 // Paint the mask.
2439 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 2438 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
2440 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseMask, PaintBehaviorNormal, paintingRootForRenderer, localPai ntingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); 2439 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseMask, PaintBehaviorNormal, paintingRootForRenderer, 0, 0, lo calPaintingInfo.rootLayer->renderer());
2441 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu mulation, compositingState()))); 2440 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu mulation, compositingState())));
2442 2441
2443 if (localPaintingInfo.clipToDirtyRect) 2442 if (localPaintingInfo.clipToDirtyRect)
2444 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect); 2443 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect);
2445 } 2444 }
2446 } 2445 }
2447 2446
2448 void RenderLayer::paintChildClippingMaskForFragments(const LayerFragments& layer Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, 2447 void RenderLayer::paintChildClippingMaskForFragments(const LayerFragments& layer Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
2449 RenderObject* paintingRootForRenderer) 2448 RenderObject* paintingRootForRenderer)
2450 { 2449 {
2451 for (size_t i = 0; i < layerFragments.size(); ++i) { 2450 for (size_t i = 0; i < layerFragments.size(); ++i) {
2452 const LayerFragment& fragment = layerFragments.at(i); 2451 const LayerFragment& fragment = layerFragments.at(i);
2453 if (!fragment.shouldPaintContent) 2452 if (!fragment.shouldPaintContent)
2454 continue; 2453 continue;
2455 2454
2456 if (localPaintingInfo.clipToDirtyRect) 2455 if (localPaintingInfo.clipToDirtyRect)
2457 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.foregroundRect, IncludeSelfForBorderRadius); // Child cl ipping mask painting will handle clipping to self. 2456 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.foregroundRect, IncludeSelfForBorderRadius); // Child cl ipping mask painting will handle clipping to self.
2458 2457
2459 // Paint the the clipped mask. 2458 // Paint the the clipped mask.
2460 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseClippingMask, PaintBehaviorNormal, paintingRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); 2459 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseClippingMask, PaintBehaviorNormal, paintingRootForRenderer, 0, 0, localPaintingInfo.rootLayer->renderer());
2461 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu mulation, compositingState()))); 2460 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu mulation, compositingState())));
2462 2461
2463 if (localPaintingInfo.clipToDirtyRect) 2462 if (localPaintingInfo.clipToDirtyRect)
2464 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore groundRect); 2463 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore groundRect);
2465 } 2464 }
2466 } 2465 }
2467 2466
2468 void RenderLayer::paintOverflowControlsForFragments(const LayerFragments& layerF ragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo) 2467 void RenderLayer::paintOverflowControlsForFragments(const LayerFragments& layerF ragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo)
2469 { 2468 {
2470 for (size_t i = 0; i < layerFragments.size(); ++i) { 2469 for (size_t i = 0; i < layerFragments.size(); ++i) {
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2759 2758
2760 // The natural thing would be to keep HitTestingTransformState on the stack, but it's big, so we heap-allocate. 2759 // The natural thing would be to keep HitTestingTransformState on the stack, but it's big, so we heap-allocate.
2761 2760
2762 // Apply a transform if we have one. 2761 // Apply a transform if we have one.
2763 if (transform() && !appliedTransform) { 2762 if (transform() && !appliedTransform) {
2764 if (enclosingPaginationLayer()) 2763 if (enclosingPaginationLayer())
2765 return hitTestTransformedLayerInFragments(rootLayer, containerLayer, request, result, hitTestRect, hitTestLocation, transformState, zOffset); 2764 return hitTestTransformedLayerInFragments(rootLayer, containerLayer, request, result, hitTestRect, hitTestLocation, transformState, zOffset);
2766 2765
2767 // Make sure the parent's clip rects have been calculated. 2766 // Make sure the parent's clip rects have been calculated.
2768 if (parent()) { 2767 if (parent()) {
2769 ClipRectsContext clipRectsContext(rootLayer, hitTestLocation.region( ), RootRelativeClipRects, IncludeOverlayScrollbarSize); 2768 ClipRectsContext clipRectsContext(rootLayer, RootRelativeClipRects, IncludeOverlayScrollbarSize);
2770 ClipRect clipRect = clipper().backgroundClipRect(clipRectsContext); 2769 ClipRect clipRect = clipper().backgroundClipRect(clipRectsContext);
2771 // Go ahead and test the enclosing clip now. 2770 // Go ahead and test the enclosing clip now.
2772 if (!clipRect.intersects(hitTestLocation)) 2771 if (!clipRect.intersects(hitTestLocation))
2773 return 0; 2772 return 0;
2774 } 2773 }
2775 2774
2776 return hitTestLayerByApplyingTransform(rootLayer, containerLayer, reques t, result, hitTestRect, hitTestLocation, transformState, zOffset); 2775 return hitTestLayerByApplyingTransform(rootLayer, containerLayer, reques t, result, hitTestRect, hitTestLocation, transformState, zOffset);
2777 } 2776 }
2778 2777
2779 // Ensure our lists and 3d status are up-to-date. 2778 // Ensure our lists and 3d status are up-to-date.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2845 hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, request, result, h itTestRect, hitTestLocation, 2844 hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, request, result, h itTestRect, hitTestLocation,
2846 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants); 2845 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants);
2847 if (hitLayer) { 2846 if (hitLayer) {
2848 if (!depthSortDescendants) 2847 if (!depthSortDescendants)
2849 return hitLayer; 2848 return hitLayer;
2850 candidateLayer = hitLayer; 2849 candidateLayer = hitLayer;
2851 } 2850 }
2852 2851
2853 // Collect the fragments. This will compute the clip rectangles for each lay er fragment. 2852 // Collect the fragments. This will compute the clip rectangles for each lay er fragment.
2854 LayerFragments layerFragments; 2853 LayerFragments layerFragments;
2855 collectFragments(layerFragments, rootLayer, hitTestLocation.region(), hitTes tRect, RootRelativeClipRects, IncludeOverlayScrollbarSize); 2854 collectFragments(layerFragments, rootLayer, hitTestRect, RootRelativeClipRec ts, IncludeOverlayScrollbarSize);
2856 2855
2857 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra gments, hitTestLocation)) { 2856 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra gments, hitTestLocation)) {
2858 renderer()->updateHitTestResult(result, hitTestLocation.point()); 2857 renderer()->updateHitTestResult(result, hitTestLocation.point());
2859 return this; 2858 return this;
2860 } 2859 }
2861 2860
2862 // Next we want to see if the mouse pos is inside the child RenderObjects of the layer. Check 2861 // Next we want to see if the mouse pos is inside the child RenderObjects of the layer. Check
2863 // every fragment in reverse order. 2862 // every fragment in reverse order.
2864 if (isSelfPaintingLayer()) { 2863 if (isSelfPaintingLayer()) {
2865 // Hit test with a temporary HitTestResult, because we only want to comm it to 'result' if we know we're frontmost. 2864 // Hit test with a temporary HitTestResult, because we only want to comm it to 'result' if we know we're frontmost.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2928 2927
2929 return false; 2928 return false;
2930 } 2929 }
2931 2930
2932 RenderLayer* RenderLayer::hitTestTransformedLayerInFragments(RenderLayer* rootLa yer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result, 2931 RenderLayer* RenderLayer::hitTestTransformedLayerInFragments(RenderLayer* rootLa yer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result,
2933 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset) 2932 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset)
2934 { 2933 {
2935 LayerFragments enclosingPaginationFragments; 2934 LayerFragments enclosingPaginationFragments;
2936 LayoutPoint offsetOfPaginationLayerFromRoot; 2935 LayoutPoint offsetOfPaginationLayerFromRoot;
2937 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination Layer(), HitTestingTransparencyClipBox, RootOfTransparencyClipBox); 2936 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination Layer(), HitTestingTransparencyClipBox, RootOfTransparencyClipBox);
2938 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, r ootLayer, hitTestLocation.region(), hitTestRect, 2937 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, r ootLayer, hitTestRect,
2939 RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip, &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent); 2938 RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip, &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent);
2940 2939
2941 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) { 2940 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) {
2942 const LayerFragment& fragment = enclosingPaginationFragments.at(i); 2941 const LayerFragment& fragment = enclosingPaginationFragments.at(i);
2943 2942
2944 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and 2943 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and
2945 // the enclosing pagination layer. 2944 // the enclosing pagination layer.
2946 LayoutRect clipRect = fragment.backgroundRect.rect(); 2945 LayoutRect clipRect = fragment.backgroundRect.rect();
2947 2946
2948 // Now compute the clips within a given fragment 2947 // Now compute the clips within a given fragment
2949 if (parent() != enclosingPaginationLayer()) { 2948 if (parent() != enclosingPaginationLayer()) {
2950 enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOf PaginationLayerFromRoot); 2949 enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOf PaginationLayerFromRoot);
2951 2950
2952 ClipRectsContext clipRectsContext(enclosingPaginationLayer(), hitTes tLocation.region(), RootRelativeClipRects, IncludeOverlayScrollbarSize); 2951 ClipRectsContext clipRectsContext(enclosingPaginationLayer(), RootRe lativeClipRects, IncludeOverlayScrollbarSize);
2953 LayoutRect parentClipRect = clipper().backgroundClipRect(clipRectsCo ntext).rect(); 2952 LayoutRect parentClipRect = clipper().backgroundClipRect(clipRectsCo ntext).rect();
2954 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination LayerFromRoot); 2953 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination LayerFromRoot);
2955 clipRect.intersect(parentClipRect); 2954 clipRect.intersect(parentClipRect);
2956 } 2955 }
2957 2956
2958 if (!hitTestLocation.intersects(clipRect)) 2957 if (!hitTestLocation.intersects(clipRect))
2959 continue; 2958 continue;
2960 2959
2961 RenderLayer* hitLayer = hitTestLayerByApplyingTransform(rootLayer, conta inerLayer, request, result, hitTestRect, hitTestLocation, 2960 RenderLayer* hitLayer = hitTestLayerByApplyingTransform(rootLayer, conta inerLayer, request, result, hitTestRect, hitTestLocation,
2962 transformState, zOffset, fragment.paginationOffset); 2961 transformState, zOffset, fragment.paginationOffset);
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
3200 child->repaintBlockSelectionGaps(); 3199 child->repaintBlockSelectionGaps();
3201 3200
3202 if (m_blockSelectionGapsBounds.isEmpty()) 3201 if (m_blockSelectionGapsBounds.isEmpty())
3203 return; 3202 return;
3204 3203
3205 LayoutRect rect = m_blockSelectionGapsBounds; 3204 LayoutRect rect = m_blockSelectionGapsBounds;
3206 if (renderer()->hasOverflowClip()) { 3205 if (renderer()->hasOverflowClip()) {
3207 RenderBox* box = renderBox(); 3206 RenderBox* box = renderBox();
3208 rect.move(-box->scrolledContentOffset()); 3207 rect.move(-box->scrolledContentOffset());
3209 if (!scrollableArea()->usesCompositedScrolling()) 3208 if (!scrollableArea()->usesCompositedScrolling())
3210 rect.intersect(box->overflowClipRect(LayoutPoint(), 0)); // FIXME: R egions not accounted for. 3209 rect.intersect(box->overflowClipRect(LayoutPoint()));
3211 } 3210 }
3212 if (renderer()->hasClip()) 3211 if (renderer()->hasClip())
3213 rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint(), 0)); // FIXME: Regions not accounted for. 3212 rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint()));
3214 if (!rect.isEmpty()) 3213 if (!rect.isEmpty())
3215 renderer()->repaintRectangle(rect); 3214 renderer()->repaintRectangle(rect);
3216 } 3215 }
3217 3216
3218 bool RenderLayer::hasBlockSelectionGapBounds() const 3217 bool RenderLayer::hasBlockSelectionGapBounds() const
3219 { 3218 {
3220 return !m_blockSelectionGapsBounds.isEmpty(); 3219 return !m_blockSelectionGapsBounds.isEmpty();
3221 } 3220 }
3222 3221
3223 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layo utRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromR oot) const 3222 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layo utRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromR oot) const
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
4008 } 4007 }
4009 } 4008 }
4010 4009
4011 void showLayerTree(const WebCore::RenderObject* renderer) 4010 void showLayerTree(const WebCore::RenderObject* renderer)
4012 { 4011 {
4013 if (!renderer) 4012 if (!renderer)
4014 return; 4013 return;
4015 showLayerTree(renderer->enclosingLayer()); 4014 showLayerTree(renderer->enclosingLayer());
4016 } 4015 }
4017 #endif 4016 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698