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