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