| 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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 // If the previous block is absolutely positioned, then we can't be paginate
d by the columns block. | 593 // If the previous block is absolutely positioned, then we can't be paginate
d by the columns block. |
| 594 if (prevBlock->isOutOfFlowPositioned()) | 594 if (prevBlock->isOutOfFlowPositioned()) |
| 595 return false; | 595 return false; |
| 596 | 596 |
| 597 // Otherwise we are paginated by the columns block. | 597 // Otherwise we are paginated by the columns block. |
| 598 return true; | 598 return true; |
| 599 } | 599 } |
| 600 | 600 |
| 601 bool RenderLayer::useRegionBasedColumns() const | 601 bool RenderLayer::useRegionBasedColumns() const |
| 602 { | 602 { |
| 603 const Settings* settings = renderer()->document().settings(); | 603 return renderer()->document().regionBasedColumnsEnabled(); |
| 604 return settings && settings->regionBasedColumnsEnabled(); | |
| 605 } | 604 } |
| 606 | 605 |
| 607 void RenderLayer::updatePagination() | 606 void RenderLayer::updatePagination() |
| 608 { | 607 { |
| 609 m_isPaginated = false; | 608 m_isPaginated = false; |
| 610 m_enclosingPaginationLayer = 0; | 609 m_enclosingPaginationLayer = 0; |
| 611 | 610 |
| 612 if (hasCompositedLayerMapping() || !parent()) | 611 if (hasCompositedLayerMapping() || !parent()) |
| 613 return; // FIXME: We will have to deal with paginated compositing layers
someday. | 612 return; // FIXME: We will have to deal with paginated compositing layers
someday. |
| 614 // FIXME: For now the RenderView can't be paginated. Eventually
printing will move to a model where it is though. | 613 // FIXME: For now the RenderView can't be paginated. Eventually
printing will move to a model where it is though. |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1469 EPosition position = renderer->style()->position(); | 1468 EPosition position = renderer->style()->position(); |
| 1470 | 1469 |
| 1471 // FIXME: Special casing RenderFlowThread so much for fixed positioning here
is not great. | 1470 // FIXME: Special casing RenderFlowThread so much for fixed positioning here
is not great. |
| 1472 RenderFlowThread* fixedFlowThreadContainer = position == FixedPosition ? ren
derer->flowThreadContainingBlock() : 0; | 1471 RenderFlowThread* fixedFlowThreadContainer = position == FixedPosition ? ren
derer->flowThreadContainingBlock() : 0; |
| 1473 if (fixedFlowThreadContainer && !fixedFlowThreadContainer->isOutOfFlowPositi
oned()) | 1472 if (fixedFlowThreadContainer && !fixedFlowThreadContainer->isOutOfFlowPositi
oned()) |
| 1474 fixedFlowThreadContainer = 0; | 1473 fixedFlowThreadContainer = 0; |
| 1475 | 1474 |
| 1476 // FIXME: Positioning of out-of-flow(fixed, absolute) elements collected in
a RenderFlowThread | 1475 // FIXME: Positioning of out-of-flow(fixed, absolute) elements collected in
a RenderFlowThread |
| 1477 // may need to be revisited in a future patch. | 1476 // may need to be revisited in a future patch. |
| 1478 // If the fixed renderer is inside a RenderFlowThread, we should not compute
location using localToAbsolute, | 1477 // If the fixed renderer is inside a RenderFlowThread, we should not compute
location using localToAbsolute, |
| 1479 // since localToAbsolute maps the coordinates from named flow to regions coo
rdinates and regions can be | 1478 // since localToAbsolute maps the coordinates from flow thread to regions co
ordinates and regions can be |
| 1480 // positioned in a completely different place in the viewport (RenderView). | 1479 // positioned in a completely different place in the viewport (RenderView). |
| 1481 if (position == FixedPosition && !fixedFlowThreadContainer && (!ancestorLaye
r || ancestorLayer == renderer->view()->layer())) { | 1480 if (position == FixedPosition && !fixedFlowThreadContainer && (!ancestorLaye
r || ancestorLayer == renderer->view()->layer())) { |
| 1482 // If the fixed layer's container is the root, just add in the offset of
the view. We can obtain this by calling | 1481 // If the fixed layer's container is the root, just add in the offset of
the view. We can obtain this by calling |
| 1483 // localToAbsolute() on the RenderView. | 1482 // localToAbsolute() on the RenderView. |
| 1484 FloatPoint absPos = renderer->localToAbsolute(FloatPoint(), IsFixed); | 1483 FloatPoint absPos = renderer->localToAbsolute(FloatPoint(), IsFixed); |
| 1485 location += LayoutSize(absPos.x(), absPos.y()); | 1484 location += LayoutSize(absPos.x(), absPos.y()); |
| 1486 return ancestorLayer; | 1485 return ancestorLayer; |
| 1487 } | 1486 } |
| 1488 | 1487 |
| 1489 // For the fixed positioned elements inside a render flow thread, we should
also skip the code path below | 1488 // 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... |
| 1687 if (hasCompositedLayerMapping()) | 1686 if (hasCompositedLayerMapping()) |
| 1688 return compositedLayerMapping()->collectTrackedRepaintRects(); | 1687 return compositedLayerMapping()->collectTrackedRepaintRects(); |
| 1689 return nullptr; | 1688 return nullptr; |
| 1690 } | 1689 } |
| 1691 | 1690 |
| 1692 bool RenderLayer::hasOverflowControls() const | 1691 bool RenderLayer::hasOverflowControls() const |
| 1693 { | 1692 { |
| 1694 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable
Area->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE); | 1693 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable
Area->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE); |
| 1695 } | 1694 } |
| 1696 | 1695 |
| 1697 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect,
PaintBehavior paintBehavior, RenderObject* paintingRoot, RenderRegion* region, P
aintLayerFlags paintFlags) | 1696 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect,
PaintBehavior paintBehavior, RenderObject* paintingRoot, PaintLayerFlags paintFl
ags) |
| 1698 { | 1697 { |
| 1699 OverlapTestRequestMap overlapTestRequests; | 1698 OverlapTestRequestMap overlapTestRequests; |
| 1700 | 1699 |
| 1701 LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBeha
vior, LayoutSize(), paintingRoot, region, &overlapTestRequests); | 1700 LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBeha
vior, LayoutSize(), paintingRoot, &overlapTestRequests); |
| 1702 paintLayer(context, paintingInfo, paintFlags); | 1701 paintLayer(context, paintingInfo, paintFlags); |
| 1703 | 1702 |
| 1704 OverlapTestRequestMap::iterator end = overlapTestRequests.end(); | 1703 OverlapTestRequestMap::iterator end = overlapTestRequests.end(); |
| 1705 for (OverlapTestRequestMap::iterator it = overlapTestRequests.begin(); it !=
end; ++it) | 1704 for (OverlapTestRequestMap::iterator it = overlapTestRequests.begin(); it !=
end; ++it) |
| 1706 it->key->setIsOverlapped(false); | 1705 it->key->setIsOverlapped(false); |
| 1707 } | 1706 } |
| 1708 | 1707 |
| 1709 void RenderLayer::paintOverlayScrollbars(GraphicsContext* context, const LayoutR
ect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot) | 1708 void RenderLayer::paintOverlayScrollbars(GraphicsContext* context, const LayoutR
ect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot) |
| 1710 { | 1709 { |
| 1711 if (!m_containsDirtyOverlayScrollbars) | 1710 if (!m_containsDirtyOverlayScrollbars) |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1851 } | 1850 } |
| 1852 | 1851 |
| 1853 if (enclosingPaginationLayer()) { | 1852 if (enclosingPaginationLayer()) { |
| 1854 paintTransformedLayerIntoFragments(context, paintingInfo, paintFlags
); | 1853 paintTransformedLayerIntoFragments(context, paintingInfo, paintFlags
); |
| 1855 return; | 1854 return; |
| 1856 } | 1855 } |
| 1857 | 1856 |
| 1858 // Make sure the parent's clip rects have been calculated. | 1857 // Make sure the parent's clip rects have been calculated. |
| 1859 ClipRect clipRect = paintingInfo.paintDirtyRect; | 1858 ClipRect clipRect = paintingInfo.paintDirtyRect; |
| 1860 if (parent()) { | 1859 if (parent()) { |
| 1861 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, paintingIn
fo.region, (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : Pa
intingClipRects, | 1860 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlag
s & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, |
| 1862 IgnoreOverlayScrollbarSize, (paintFlags & PaintLayerPaintingOver
flowContents) ? IgnoreOverflowClip : RespectOverflowClip); | 1861 IgnoreOverlayScrollbarSize, (paintFlags & PaintLayerPaintingOver
flowContents) ? IgnoreOverflowClip : RespectOverflowClip); |
| 1863 clipRect = clipper().backgroundClipRect(clipRectsContext); | 1862 clipRect = clipper().backgroundClipRect(clipRectsContext); |
| 1864 clipRect.intersect(paintingInfo.paintDirtyRect); | 1863 clipRect.intersect(paintingInfo.paintDirtyRect); |
| 1865 | 1864 |
| 1866 // Push the parent coordinate space's clip. | 1865 // Push the parent coordinate space's clip. |
| 1867 parent()->clipToRect(paintingInfo.rootLayer, context, paintingInfo.p
aintDirtyRect, clipRect); | 1866 parent()->clipToRect(paintingInfo.rootLayer, context, paintingInfo.p
aintDirtyRect, clipRect); |
| 1868 } | 1867 } |
| 1869 | 1868 |
| 1870 paintLayerByApplyingTransform(context, paintingInfo, paintFlags); | 1869 paintLayerByApplyingTransform(context, paintingInfo, paintFlags); |
| 1871 | 1870 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2044 PaintBehavior paintBehavior = PaintBehaviorNormal; | 2043 PaintBehavior paintBehavior = PaintBehaviorNormal; |
| 2045 if (paintFlags & PaintLayerPaintingSkipRootBackground) | 2044 if (paintFlags & PaintLayerPaintingSkipRootBackground) |
| 2046 paintBehavior |= PaintBehaviorSkipRootBackground; | 2045 paintBehavior |= PaintBehaviorSkipRootBackground; |
| 2047 else if (paintFlags & PaintLayerPaintingRootBackgroundOnly) | 2046 else if (paintFlags & PaintLayerPaintingRootBackgroundOnly) |
| 2048 paintBehavior |= PaintBehaviorRootBackgroundOnly; | 2047 paintBehavior |= PaintBehaviorRootBackgroundOnly; |
| 2049 | 2048 |
| 2050 LayerFragments layerFragments; | 2049 LayerFragments layerFragments; |
| 2051 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars)
{ | 2050 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars)
{ |
| 2052 // 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 | 2051 // 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 |
| 2053 // fragment should paint. | 2052 // fragment should paint. |
| 2054 collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaint
ingInfo.region, localPaintingInfo.paintDirtyRect, | 2053 collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaint
ingInfo.paintDirtyRect, |
| 2055 (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : P
aintingClipRects, IgnoreOverlayScrollbarSize, | 2054 (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : P
aintingClipRects, IgnoreOverlayScrollbarSize, |
| 2056 (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowC
lip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation); | 2055 (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowC
lip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation); |
| 2057 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF
lags, shouldPaintContent, &offsetFromRoot); | 2056 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF
lags, shouldPaintContent, &offsetFromRoot); |
| 2058 } | 2057 } |
| 2059 | 2058 |
| 2060 if (shouldPaintBackground) | 2059 if (shouldPaintBackground) |
| 2061 paintBackgroundForFragments(layerFragments, context, transparencyLayerCo
ntext, paintingInfo.paintDirtyRect, haveTransparency, | 2060 paintBackgroundForFragments(layerFragments, context, transparencyLayerCo
ntext, paintingInfo.paintDirtyRect, haveTransparency, |
| 2062 localPaintingInfo, paintBehavior, paintingRootForRenderer); | 2061 localPaintingInfo, paintBehavior, paintingRootForRenderer); |
| 2063 | 2062 |
| 2064 if (shouldPaintNegZOrderList) | 2063 if (shouldPaintNegZOrderList) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2122 IntPoint roundedDelta = roundedIntPoint(delta); | 2121 IntPoint roundedDelta = roundedIntPoint(delta); |
| 2123 transform.translateRight(roundedDelta.x(), roundedDelta.y()); | 2122 transform.translateRight(roundedDelta.x(), roundedDelta.y()); |
| 2124 LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation
+ (delta - roundedDelta); | 2123 LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation
+ (delta - roundedDelta); |
| 2125 | 2124 |
| 2126 // Apply the transform. | 2125 // Apply the transform. |
| 2127 GraphicsContextStateSaver stateSaver(*context); | 2126 GraphicsContextStateSaver stateSaver(*context); |
| 2128 context->concatCTM(transform.toAffineTransform()); | 2127 context->concatCTM(transform.toAffineTransform()); |
| 2129 | 2128 |
| 2130 // Now do a paint with the root layer shifted to be us. | 2129 // Now do a paint with the root layer shifted to be us. |
| 2131 LayerPaintingInfo transformedPaintingInfo(this, enclosingIntRect(transform.i
nverse().mapRect(paintingInfo.paintDirtyRect)), paintingInfo.paintBehavior, | 2130 LayerPaintingInfo transformedPaintingInfo(this, enclosingIntRect(transform.i
nverse().mapRect(paintingInfo.paintDirtyRect)), paintingInfo.paintBehavior, |
| 2132 adjustedSubPixelAccumulation, paintingInfo.paintingRoot, paintingInfo.re
gion, paintingInfo.overlapTestRequests); | 2131 adjustedSubPixelAccumulation, paintingInfo.paintingRoot, paintingInfo.ov
erlapTestRequests); |
| 2133 paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags
); | 2132 paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags
); |
| 2134 } | 2133 } |
| 2135 | 2134 |
| 2136 void RenderLayer::paintChildren(unsigned childrenToVisit, GraphicsContext* conte
xt, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | 2135 void RenderLayer::paintChildren(unsigned childrenToVisit, GraphicsContext* conte
xt, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
| 2137 { | 2136 { |
| 2138 if (!hasSelfPaintingLayerDescendant()) | 2137 if (!hasSelfPaintingLayerDescendant()) |
| 2139 return; | 2138 return; |
| 2140 | 2139 |
| 2141 #if !ASSERT_DISABLED | 2140 #if !ASSERT_DISABLED |
| 2142 LayerListMutationDetector mutationChecker(m_stackingNode.get()); | 2141 LayerListMutationDetector mutationChecker(m_stackingNode.get()); |
| 2143 #endif | 2142 #endif |
| 2144 | 2143 |
| 2145 RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit); | 2144 RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit); |
| 2146 while (RenderLayerStackingNode* child = iterator.next()) { | 2145 while (RenderLayerStackingNode* child = iterator.next()) { |
| 2147 RenderLayer* childLayer = child->layer(); | 2146 RenderLayer* childLayer = child->layer(); |
| 2148 | 2147 |
| 2149 // Squashed RenderLayers should not paint into their ancestor. | 2148 // Squashed RenderLayers should not paint into their ancestor. |
| 2150 if (childLayer->compositingState() == PaintsIntoGroupedBacking) | 2149 if (childLayer->compositingState() == PaintsIntoGroupedBacking) |
| 2151 continue; | 2150 continue; |
| 2152 | 2151 |
| 2153 if (!childLayer->isPaginated()) | 2152 if (!childLayer->isPaginated()) |
| 2154 childLayer->paintLayer(context, paintingInfo, paintFlags); | 2153 childLayer->paintLayer(context, paintingInfo, paintFlags); |
| 2155 else | 2154 else |
| 2156 paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFla
gs); | 2155 paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFla
gs); |
| 2157 } | 2156 } |
| 2158 } | 2157 } |
| 2159 | 2158 |
| 2160 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer*
rootLayer, RenderRegion* region, const LayoutRect& dirtyRect, | 2159 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer*
rootLayer, const LayoutRect& dirtyRect, |
| 2161 ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollba
rSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint
* offsetFromRoot, | 2160 ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollba
rSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint
* offsetFromRoot, |
| 2162 const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox) | 2161 const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox) |
| 2163 { | 2162 { |
| 2164 if (!enclosingPaginationLayer() || hasTransform()) { | 2163 if (!enclosingPaginationLayer() || hasTransform()) { |
| 2165 // For unpaginated layers, there is only one fragment. | 2164 // For unpaginated layers, there is only one fragment. |
| 2166 LayerFragment fragment; | 2165 LayerFragment fragment; |
| 2167 ClipRectsContext clipRectsContext(rootLayer, region, clipRectsType, inOv
erlayScrollbarSizeRelevancy, respectOverflowClip, subPixelAccumulation); | 2166 ClipRectsContext clipRectsContext(rootLayer, clipRectsType, inOverlayScr
ollbarSizeRelevancy, respectOverflowClip, subPixelAccumulation); |
| 2168 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBoun
ds, fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offs
etFromRoot); | 2167 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBoun
ds, fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offs
etFromRoot); |
| 2169 fragments.append(fragment); | 2168 fragments.append(fragment); |
| 2170 return; | 2169 return; |
| 2171 } | 2170 } |
| 2172 | 2171 |
| 2173 // Compute our offset within the enclosing pagination layer. | 2172 // Compute our offset within the enclosing pagination layer. |
| 2174 LayoutPoint offsetWithinPaginatedLayer; | 2173 LayoutPoint offsetWithinPaginatedLayer; |
| 2175 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer)
; | 2174 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer)
; |
| 2176 | 2175 |
| 2177 // Calculate clip rects relative to the enclosingPaginationLayer. The purpos
e of this call is to determine our bounds clipped to intermediate | 2176 // Calculate clip rects relative to the enclosingPaginationLayer. The purpos
e of this call is to determine our bounds clipped to intermediate |
| 2178 // 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. | 2177 // 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. |
| 2179 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), regi
on, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip); | 2178 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), clip
RectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip); |
| 2180 LayoutRect layerBoundsInFlowThread; | 2179 LayoutRect layerBoundsInFlowThread; |
| 2181 ClipRect backgroundRectInFlowThread; | 2180 ClipRect backgroundRectInFlowThread; |
| 2182 ClipRect foregroundRectInFlowThread; | 2181 ClipRect foregroundRectInFlowThread; |
| 2183 ClipRect outlineRectInFlowThread; | 2182 ClipRect outlineRectInFlowThread; |
| 2184 clipper().calculateRects(paginationClipRectsContext, PaintInfo::infiniteRect
(), layerBoundsInFlowThread, backgroundRectInFlowThread, foregroundRectInFlowThr
ead, | 2183 clipper().calculateRects(paginationClipRectsContext, PaintInfo::infiniteRect
(), layerBoundsInFlowThread, backgroundRectInFlowThread, foregroundRectInFlowThr
ead, |
| 2185 outlineRectInFlowThread, &offsetWithinPaginatedLayer); | 2184 outlineRectInFlowThread, &offsetWithinPaginatedLayer); |
| 2186 | 2185 |
| 2187 // Take our bounding box within the flow thread and clip it. | 2186 // Take our bounding box within the flow thread and clip it. |
| 2188 LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingB
ox : boundingBox(enclosingPaginationLayer(), 0, &offsetWithinPaginatedLayer); | 2187 LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingB
ox : boundingBox(enclosingPaginationLayer(), 0, &offsetWithinPaginatedLayer); |
| 2189 layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect()); | 2188 layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect()); |
| 2190 | 2189 |
| 2191 // Shift the dirty rect into flow thread coordinates. | 2190 // Shift the dirty rect into flow thread coordinates. |
| 2192 LayoutPoint offsetOfPaginationLayerFromRoot; | 2191 LayoutPoint offsetOfPaginationLayerFromRoot; |
| 2193 enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOfPaginati
onLayerFromRoot); | 2192 enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOfPaginati
onLayerFromRoot); |
| 2194 LayoutRect dirtyRectInFlowThread(dirtyRect); | 2193 LayoutRect dirtyRectInFlowThread(dirtyRect); |
| 2195 dirtyRectInFlowThread.moveBy(-offsetOfPaginationLayerFromRoot); | 2194 dirtyRectInFlowThread.moveBy(-offsetOfPaginationLayerFromRoot); |
| 2196 | 2195 |
| 2197 // Tell the flow thread to collect the fragments. We pass enough information
to create a minimal number of fragments based off the pages/columns | 2196 // Tell the flow thread to collect the fragments. We pass enough information
to create a minimal number of fragments based off the pages/columns |
| 2198 // that intersect the actual dirtyRect as well as the pages/columns that int
ersect our layer's bounding box. | 2197 // that intersect the actual dirtyRect as well as the pages/columns that int
ersect our layer's bounding box. |
| 2199 RenderFlowThread* enclosingFlowThread = toRenderFlowThread(enclosingPaginati
onLayer()->renderer()); | 2198 RenderFlowThread* enclosingFlowThread = toRenderFlowThread(enclosingPaginati
onLayer()->renderer()); |
| 2200 enclosingFlowThread->collectLayerFragments(fragments, layerBoundingBoxInFlow
Thread, dirtyRectInFlowThread); | 2199 enclosingFlowThread->collectLayerFragments(fragments, layerBoundingBoxInFlow
Thread, dirtyRectInFlowThread); |
| 2201 | 2200 |
| 2202 if (fragments.isEmpty()) | 2201 if (fragments.isEmpty()) |
| 2203 return; | 2202 return; |
| 2204 | 2203 |
| 2205 // Get the parent clip rects of the pagination layer, since we need to inter
sect with that when painting column contents. | 2204 // Get the parent clip rects of the pagination layer, since we need to inter
sect with that when painting column contents. |
| 2206 ClipRect ancestorClipRect = dirtyRect; | 2205 ClipRect ancestorClipRect = dirtyRect; |
| 2207 if (enclosingPaginationLayer()->parent()) { | 2206 if (enclosingPaginationLayer()->parent()) { |
| 2208 ClipRectsContext clipRectsContext(rootLayer, region, clipRectsType, inOv
erlayScrollbarSizeRelevancy, respectOverflowClip); | 2207 ClipRectsContext clipRectsContext(rootLayer, clipRectsType, inOverlayScr
ollbarSizeRelevancy, respectOverflowClip); |
| 2209 ancestorClipRect = enclosingPaginationLayer()->clipper().backgroundClipR
ect(clipRectsContext); | 2208 ancestorClipRect = enclosingPaginationLayer()->clipper().backgroundClipR
ect(clipRectsContext); |
| 2210 ancestorClipRect.intersect(dirtyRect); | 2209 ancestorClipRect.intersect(dirtyRect); |
| 2211 } | 2210 } |
| 2212 | 2211 |
| 2213 for (size_t i = 0; i < fragments.size(); ++i) { | 2212 for (size_t i = 0; i < fragments.size(); ++i) { |
| 2214 LayerFragment& fragment = fragments.at(i); | 2213 LayerFragment& fragment = fragments.at(i); |
| 2215 | 2214 |
| 2216 // Set our four rects with all clipping applied that was internal to the
flow thread. | 2215 // Set our four rects with all clipping applied that was internal to the
flow thread. |
| 2217 fragment.setRects(layerBoundsInFlowThread, backgroundRectInFlowThread, f
oregroundRectInFlowThread, outlineRectInFlowThread); | 2216 fragment.setRects(layerBoundsInFlowThread, backgroundRectInFlowThread, f
oregroundRectInFlowThread, outlineRectInFlowThread); |
| 2218 | 2217 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2241 fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBo
unds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFro
mRoot); | 2240 fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBo
unds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFro
mRoot); |
| 2242 } | 2241 } |
| 2243 } | 2242 } |
| 2244 } | 2243 } |
| 2245 | 2244 |
| 2246 void RenderLayer::paintTransformedLayerIntoFragments(GraphicsContext* context, c
onst LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | 2245 void RenderLayer::paintTransformedLayerIntoFragments(GraphicsContext* context, c
onst LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
| 2247 { | 2246 { |
| 2248 LayerFragments enclosingPaginationFragments; | 2247 LayerFragments enclosingPaginationFragments; |
| 2249 LayoutPoint offsetOfPaginationLayerFromRoot; | 2248 LayoutPoint offsetOfPaginationLayerFromRoot; |
| 2250 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination
Layer(), PaintingTransparencyClipBox, RootOfTransparencyClipBox, paintingInfo.pa
intBehavior); | 2249 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination
Layer(), PaintingTransparencyClipBox, RootOfTransparencyClipBox, paintingInfo.pa
intBehavior); |
| 2251 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, p
aintingInfo.rootLayer, paintingInfo.region, paintingInfo.paintDirtyRect, | 2250 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, p
aintingInfo.rootLayer, paintingInfo.paintDirtyRect, |
| 2252 (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : Paint
ingClipRects, IgnoreOverlayScrollbarSize, | 2251 (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : Paint
ingClipRects, IgnoreOverlayScrollbarSize, |
| 2253 (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip :
RespectOverflowClip, &offsetOfPaginationLayerFromRoot, paintingInfo.subPixelAcc
umulation, &transformedExtent); | 2252 (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip :
RespectOverflowClip, &offsetOfPaginationLayerFromRoot, paintingInfo.subPixelAcc
umulation, &transformedExtent); |
| 2254 | 2253 |
| 2255 for (size_t i = 0; i < enclosingPaginationFragments.size(); ++i) { | 2254 for (size_t i = 0; i < enclosingPaginationFragments.size(); ++i) { |
| 2256 const LayerFragment& fragment = enclosingPaginationFragments.at(i); | 2255 const LayerFragment& fragment = enclosingPaginationFragments.at(i); |
| 2257 | 2256 |
| 2258 // Apply the page/column clip for this fragment, as well as any clips es
tablished by layers in between us and | 2257 // Apply the page/column clip for this fragment, as well as any clips es
tablished by layers in between us and |
| 2259 // the enclosing pagination layer. | 2258 // the enclosing pagination layer. |
| 2260 LayoutRect clipRect = fragment.backgroundRect.rect(); | 2259 LayoutRect clipRect = fragment.backgroundRect.rect(); |
| 2261 | 2260 |
| 2262 // Now compute the clips within a given fragment | 2261 // Now compute the clips within a given fragment |
| 2263 if (parent() != enclosingPaginationLayer()) { | 2262 if (parent() != enclosingPaginationLayer()) { |
| 2264 enclosingPaginationLayer()->convertToLayerCoords(paintingInfo.rootLa
yer, offsetOfPaginationLayerFromRoot); | 2263 enclosingPaginationLayer()->convertToLayerCoords(paintingInfo.rootLa
yer, offsetOfPaginationLayerFromRoot); |
| 2265 | 2264 |
| 2266 ClipRectsContext clipRectsContext(enclosingPaginationLayer(), painti
ngInfo.region, (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects
: PaintingClipRects, | 2265 ClipRectsContext clipRectsContext(enclosingPaginationLayer(), (paint
Flags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, |
| 2267 IgnoreOverlayScrollbarSize, (paintFlags & PaintLayerPaintingOver
flowContents) ? IgnoreOverflowClip : RespectOverflowClip); | 2266 IgnoreOverlayScrollbarSize, (paintFlags & PaintLayerPaintingOver
flowContents) ? IgnoreOverflowClip : RespectOverflowClip); |
| 2268 LayoutRect parentClipRect = clipper().backgroundClipRect(clipRectsCo
ntext).rect(); | 2267 LayoutRect parentClipRect = clipper().backgroundClipRect(clipRectsCo
ntext).rect(); |
| 2269 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination
LayerFromRoot); | 2268 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination
LayerFromRoot); |
| 2270 clipRect.intersect(parentClipRect); | 2269 clipRect.intersect(parentClipRect); |
| 2271 } | 2270 } |
| 2272 | 2271 |
| 2273 parent()->clipToRect(paintingInfo.rootLayer, context, paintingInfo.paint
DirtyRect, clipRect); | 2272 parent()->clipToRect(paintingInfo.rootLayer, context, paintingInfo.paint
DirtyRect, clipRect); |
| 2274 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen
t.paginationOffset); | 2273 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen
t.paginationOffset); |
| 2275 parent()->restoreClip(context, paintingInfo.paintDirtyRect, clipRect); | 2274 parent()->restoreClip(context, paintingInfo.paintDirtyRect, clipRect); |
| 2276 } | 2275 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2299 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.
rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior); | 2298 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.
rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior); |
| 2300 | 2299 |
| 2301 if (localPaintingInfo.clipToDirtyRect) { | 2300 if (localPaintingInfo.clipToDirtyRect) { |
| 2302 // Paint our background first, before painting any child layers. | 2301 // Paint our background first, before painting any child layers. |
| 2303 // Establish the clip used to paint our background. | 2302 // Establish the clip used to paint our background. |
| 2304 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p
aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Bac
kground painting will handle clipping to self. | 2303 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p
aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Bac
kground painting will handle clipping to self. |
| 2305 } | 2304 } |
| 2306 | 2305 |
| 2307 // Paint the background. | 2306 // Paint the background. |
| 2308 // FIXME: Eventually we will collect the region from the fragment itself
instead of just from the paint info. | 2307 // FIXME: Eventually we will collect the region from the fragment itself
instead of just from the paint info. |
| 2309 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect
.rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, loc
alPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); | 2308 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect
.rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, 0,
0, localPaintingInfo.rootLayer->renderer()); |
| 2310 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r
enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu
mulation, compositingState()))); | 2309 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r
enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu
mulation, compositingState()))); |
| 2311 | 2310 |
| 2312 if (localPaintingInfo.clipToDirtyRect) | 2311 if (localPaintingInfo.clipToDirtyRect) |
| 2313 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back
groundRect); | 2312 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back
groundRect); |
| 2314 } | 2313 } |
| 2315 } | 2314 } |
| 2316 | 2315 |
| 2317 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen
ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, | 2316 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen
ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, |
| 2318 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L
ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, | 2317 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L
ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, |
| 2319 RenderObject* paintingRootForRenderer, bool selectionOnly, bool forceBlackTe
xt) | 2318 RenderObject* paintingRootForRenderer, bool selectionOnly, bool forceBlackTe
xt) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2357 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size()
> 1; | 2356 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size()
> 1; |
| 2358 | 2357 |
| 2359 for (size_t i = 0; i < layerFragments.size(); ++i) { | 2358 for (size_t i = 0; i < layerFragments.size(); ++i) { |
| 2360 const LayerFragment& fragment = layerFragments.at(i); | 2359 const LayerFragment& fragment = layerFragments.at(i); |
| 2361 if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty()) | 2360 if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty()) |
| 2362 continue; | 2361 continue; |
| 2363 | 2362 |
| 2364 if (shouldClip) | 2363 if (shouldClip) |
| 2365 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p
aintDirtyRect, fragment.foregroundRect); | 2364 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p
aintDirtyRect, fragment.foregroundRect); |
| 2366 | 2365 |
| 2367 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.foregroundRect
.rect()), phase, paintBehavior, paintingRootForRenderer, localPaintingInfo.regio
n, 0, 0, localPaintingInfo.rootLayer->renderer()); | 2366 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.foregroundRect
.rect()), phase, paintBehavior, paintingRootForRenderer, 0, 0, localPaintingInfo
.rootLayer->renderer()); |
| 2368 if (phase == PaintPhaseForeground) | 2367 if (phase == PaintPhaseForeground) |
| 2369 paintInfo.overlapTestRequests = localPaintingInfo.overlapTestRequest
s; | 2368 paintInfo.overlapTestRequests = localPaintingInfo.overlapTestRequest
s; |
| 2370 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r
enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu
mulation, compositingState()))); | 2369 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r
enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu
mulation, compositingState()))); |
| 2371 | 2370 |
| 2372 if (shouldClip) | 2371 if (shouldClip) |
| 2373 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore
groundRect); | 2372 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore
groundRect); |
| 2374 } | 2373 } |
| 2375 } | 2374 } |
| 2376 | 2375 |
| 2377 void RenderLayer::paintOutlineForFragments(const LayerFragments& layerFragments,
GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, | 2376 void RenderLayer::paintOutlineForFragments(const LayerFragments& layerFragments,
GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, |
| 2378 PaintBehavior paintBehavior, RenderObject* paintingRootForRenderer) | 2377 PaintBehavior paintBehavior, RenderObject* paintingRootForRenderer) |
| 2379 { | 2378 { |
| 2380 for (size_t i = 0; i < layerFragments.size(); ++i) { | 2379 for (size_t i = 0; i < layerFragments.size(); ++i) { |
| 2381 const LayerFragment& fragment = layerFragments.at(i); | 2380 const LayerFragment& fragment = layerFragments.at(i); |
| 2382 if (fragment.outlineRect.isEmpty()) | 2381 if (fragment.outlineRect.isEmpty()) |
| 2383 continue; | 2382 continue; |
| 2384 | 2383 |
| 2385 // Paint our own outline | 2384 // Paint our own outline |
| 2386 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.re
ct()), PaintPhaseSelfOutline, paintBehavior, paintingRootForRenderer, localPaint
ingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); | 2385 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.re
ct()), PaintPhaseSelfOutline, paintBehavior, paintingRootForRenderer, 0, 0, loca
lPaintingInfo.rootLayer->renderer()); |
| 2387 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paint
DirtyRect, fragment.outlineRect, DoNotIncludeSelfForBorderRadius); | 2386 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paint
DirtyRect, fragment.outlineRect, DoNotIncludeSelfForBorderRadius); |
| 2388 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r
enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu
mulation, compositingState()))); | 2387 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r
enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu
mulation, compositingState()))); |
| 2389 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.outlineR
ect); | 2388 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.outlineR
ect); |
| 2390 } | 2389 } |
| 2391 } | 2390 } |
| 2392 | 2391 |
| 2393 void RenderLayer::paintMaskForFragments(const LayerFragments& layerFragments, Gr
aphicsContext* context, const LayerPaintingInfo& localPaintingInfo, | 2392 void RenderLayer::paintMaskForFragments(const LayerFragments& layerFragments, Gr
aphicsContext* context, const LayerPaintingInfo& localPaintingInfo, |
| 2394 RenderObject* paintingRootForRenderer) | 2393 RenderObject* paintingRootForRenderer) |
| 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) | 2397 if (!fragment.shouldPaintContent) |
| 2399 continue; | 2398 continue; |
| 2400 | 2399 |
| 2401 if (localPaintingInfo.clipToDirtyRect) | 2400 if (localPaintingInfo.clipToDirtyRect) |
| 2402 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p
aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Mas
k painting will handle clipping to self. | 2401 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p
aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Mas
k painting will handle clipping to self. |
| 2403 | 2402 |
| 2404 // Paint the mask. | 2403 // Paint the mask. |
| 2405 // FIXME: Eventually we will collect the region from the fragment itself
instead of just from the paint info. | 2404 // FIXME: Eventually we will collect the region from the fragment itself
instead of just from the paint info. |
| 2406 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect
.rect()), PaintPhaseMask, PaintBehaviorNormal, paintingRootForRenderer, localPai
ntingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); | 2405 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect
.rect()), PaintPhaseMask, PaintBehaviorNormal, paintingRootForRenderer, 0, 0, lo
calPaintingInfo.rootLayer->renderer()); |
| 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 (localPaintingInfo.clipToDirtyRect) | 2408 if (localPaintingInfo.clipToDirtyRect) |
| 2410 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back
groundRect); | 2409 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back
groundRect); |
| 2411 } | 2410 } |
| 2412 } | 2411 } |
| 2413 | 2412 |
| 2414 void RenderLayer::paintChildClippingMaskForFragments(const LayerFragments& layer
Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, | 2413 void RenderLayer::paintChildClippingMaskForFragments(const LayerFragments& layer
Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, |
| 2415 RenderObject* paintingRootForRenderer) | 2414 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.shouldPaintContent) | 2418 if (!fragment.shouldPaintContent) |
| 2420 continue; | 2419 continue; |
| 2421 | 2420 |
| 2422 if (localPaintingInfo.clipToDirtyRect) | 2421 if (localPaintingInfo.clipToDirtyRect) |
| 2423 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p
aintDirtyRect, fragment.foregroundRect, IncludeSelfForBorderRadius); // Child cl
ipping mask painting will handle clipping to self. | 2422 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p
aintDirtyRect, fragment.foregroundRect, IncludeSelfForBorderRadius); // Child cl
ipping mask painting will handle clipping to self. |
| 2424 | 2423 |
| 2425 // Paint the the clipped mask. | 2424 // Paint the the clipped mask. |
| 2426 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect
.rect()), PaintPhaseClippingMask, PaintBehaviorNormal, paintingRootForRenderer,
localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); | 2425 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect
.rect()), PaintPhaseClippingMask, PaintBehaviorNormal, paintingRootForRenderer,
0, 0, localPaintingInfo.rootLayer->renderer()); |
| 2427 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r
enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu
mulation, compositingState()))); | 2426 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r
enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu
mulation, compositingState()))); |
| 2428 | 2427 |
| 2429 if (localPaintingInfo.clipToDirtyRect) | 2428 if (localPaintingInfo.clipToDirtyRect) |
| 2430 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore
groundRect); | 2429 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore
groundRect); |
| 2431 } | 2430 } |
| 2432 } | 2431 } |
| 2433 | 2432 |
| 2434 void RenderLayer::paintOverflowControlsForFragments(const LayerFragments& layerF
ragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo) | 2433 void RenderLayer::paintOverflowControlsForFragments(const LayerFragments& layerF
ragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo) |
| 2435 { | 2434 { |
| 2436 for (size_t i = 0; i < layerFragments.size(); ++i) { | 2435 for (size_t i = 0; i < layerFragments.size(); ++i) { |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2721 | 2720 |
| 2722 // The natural thing would be to keep HitTestingTransformState on the stack,
but it's big, so we heap-allocate. | 2721 // The natural thing would be to keep HitTestingTransformState on the stack,
but it's big, so we heap-allocate. |
| 2723 | 2722 |
| 2724 // Apply a transform if we have one. | 2723 // Apply a transform if we have one. |
| 2725 if (transform() && !appliedTransform) { | 2724 if (transform() && !appliedTransform) { |
| 2726 if (enclosingPaginationLayer()) | 2725 if (enclosingPaginationLayer()) |
| 2727 return hitTestTransformedLayerInFragments(rootLayer, containerLayer,
request, result, hitTestRect, hitTestLocation, transformState, zOffset); | 2726 return hitTestTransformedLayerInFragments(rootLayer, containerLayer,
request, result, hitTestRect, hitTestLocation, transformState, zOffset); |
| 2728 | 2727 |
| 2729 // Make sure the parent's clip rects have been calculated. | 2728 // Make sure the parent's clip rects have been calculated. |
| 2730 if (parent()) { | 2729 if (parent()) { |
| 2731 ClipRectsContext clipRectsContext(rootLayer, hitTestLocation.region(
), RootRelativeClipRects, IncludeOverlayScrollbarSize); | 2730 ClipRectsContext clipRectsContext(rootLayer, RootRelativeClipRects,
IncludeOverlayScrollbarSize); |
| 2732 ClipRect clipRect = clipper().backgroundClipRect(clipRectsContext); | 2731 ClipRect clipRect = clipper().backgroundClipRect(clipRectsContext); |
| 2733 // Go ahead and test the enclosing clip now. | 2732 // Go ahead and test the enclosing clip now. |
| 2734 if (!clipRect.intersects(hitTestLocation)) | 2733 if (!clipRect.intersects(hitTestLocation)) |
| 2735 return 0; | 2734 return 0; |
| 2736 } | 2735 } |
| 2737 | 2736 |
| 2738 return hitTestLayerByApplyingTransform(rootLayer, containerLayer, reques
t, result, hitTestRect, hitTestLocation, transformState, zOffset); | 2737 return hitTestLayerByApplyingTransform(rootLayer, containerLayer, reques
t, result, hitTestRect, hitTestLocation, transformState, zOffset); |
| 2739 } | 2738 } |
| 2740 | 2739 |
| 2741 // Ensure our lists and 3d status are up-to-date. | 2740 // Ensure our lists and 3d status are up-to-date. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2807 hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, request, result, h
itTestRect, hitTestLocation, | 2806 hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, request, result, h
itTestRect, hitTestLocation, |
| 2808 localTransformState.get(), zOffsetForDescendantsPtr,
zOffset, unflattenedTransformState.get(), depthSortDescendants); | 2807 localTransformState.get(), zOffsetForDescendantsPtr,
zOffset, unflattenedTransformState.get(), depthSortDescendants); |
| 2809 if (hitLayer) { | 2808 if (hitLayer) { |
| 2810 if (!depthSortDescendants) | 2809 if (!depthSortDescendants) |
| 2811 return hitLayer; | 2810 return hitLayer; |
| 2812 candidateLayer = hitLayer; | 2811 candidateLayer = hitLayer; |
| 2813 } | 2812 } |
| 2814 | 2813 |
| 2815 // Collect the fragments. This will compute the clip rectangles for each lay
er fragment. | 2814 // Collect the fragments. This will compute the clip rectangles for each lay
er fragment. |
| 2816 LayerFragments layerFragments; | 2815 LayerFragments layerFragments; |
| 2817 collectFragments(layerFragments, rootLayer, hitTestLocation.region(), hitTes
tRect, RootRelativeClipRects, IncludeOverlayScrollbarSize); | 2816 collectFragments(layerFragments, rootLayer, hitTestRect, RootRelativeClipRec
ts, IncludeOverlayScrollbarSize); |
| 2818 | 2817 |
| 2819 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra
gments, hitTestLocation)) { | 2818 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra
gments, hitTestLocation)) { |
| 2820 renderer()->updateHitTestResult(result, hitTestLocation.point()); | 2819 renderer()->updateHitTestResult(result, hitTestLocation.point()); |
| 2821 return this; | 2820 return this; |
| 2822 } | 2821 } |
| 2823 | 2822 |
| 2824 // Next we want to see if the mouse pos is inside the child RenderObjects of
the layer. Check | 2823 // Next we want to see if the mouse pos is inside the child RenderObjects of
the layer. Check |
| 2825 // every fragment in reverse order. | 2824 // every fragment in reverse order. |
| 2826 if (isSelfPaintingLayer()) { | 2825 if (isSelfPaintingLayer()) { |
| 2827 // Hit test with a temporary HitTestResult, because we only want to comm
it to 'result' if we know we're frontmost. | 2826 // 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... |
| 2890 | 2889 |
| 2891 return false; | 2890 return false; |
| 2892 } | 2891 } |
| 2893 | 2892 |
| 2894 RenderLayer* RenderLayer::hitTestTransformedLayerInFragments(RenderLayer* rootLa
yer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult&
result, | 2893 RenderLayer* RenderLayer::hitTestTransformedLayerInFragments(RenderLayer* rootLa
yer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult&
result, |
| 2895 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset) | 2894 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset) |
| 2896 { | 2895 { |
| 2897 LayerFragments enclosingPaginationFragments; | 2896 LayerFragments enclosingPaginationFragments; |
| 2898 LayoutPoint offsetOfPaginationLayerFromRoot; | 2897 LayoutPoint offsetOfPaginationLayerFromRoot; |
| 2899 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination
Layer(), HitTestingTransparencyClipBox, RootOfTransparencyClipBox); | 2898 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination
Layer(), HitTestingTransparencyClipBox, RootOfTransparencyClipBox); |
| 2900 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, r
ootLayer, hitTestLocation.region(), hitTestRect, | 2899 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, r
ootLayer, hitTestRect, |
| 2901 RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip,
&offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent); | 2900 RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip,
&offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent); |
| 2902 | 2901 |
| 2903 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) { | 2902 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) { |
| 2904 const LayerFragment& fragment = enclosingPaginationFragments.at(i); | 2903 const LayerFragment& fragment = enclosingPaginationFragments.at(i); |
| 2905 | 2904 |
| 2906 // Apply the page/column clip for this fragment, as well as any clips es
tablished by layers in between us and | 2905 // Apply the page/column clip for this fragment, as well as any clips es
tablished by layers in between us and |
| 2907 // the enclosing pagination layer. | 2906 // the enclosing pagination layer. |
| 2908 LayoutRect clipRect = fragment.backgroundRect.rect(); | 2907 LayoutRect clipRect = fragment.backgroundRect.rect(); |
| 2909 | 2908 |
| 2910 // Now compute the clips within a given fragment | 2909 // Now compute the clips within a given fragment |
| 2911 if (parent() != enclosingPaginationLayer()) { | 2910 if (parent() != enclosingPaginationLayer()) { |
| 2912 enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOf
PaginationLayerFromRoot); | 2911 enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOf
PaginationLayerFromRoot); |
| 2913 | 2912 |
| 2914 ClipRectsContext clipRectsContext(enclosingPaginationLayer(), hitTes
tLocation.region(), RootRelativeClipRects, IncludeOverlayScrollbarSize); | 2913 ClipRectsContext clipRectsContext(enclosingPaginationLayer(), RootRe
lativeClipRects, IncludeOverlayScrollbarSize); |
| 2915 LayoutRect parentClipRect = clipper().backgroundClipRect(clipRectsCo
ntext).rect(); | 2914 LayoutRect parentClipRect = clipper().backgroundClipRect(clipRectsCo
ntext).rect(); |
| 2916 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination
LayerFromRoot); | 2915 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination
LayerFromRoot); |
| 2917 clipRect.intersect(parentClipRect); | 2916 clipRect.intersect(parentClipRect); |
| 2918 } | 2917 } |
| 2919 | 2918 |
| 2920 if (!hitTestLocation.intersects(clipRect)) | 2919 if (!hitTestLocation.intersects(clipRect)) |
| 2921 continue; | 2920 continue; |
| 2922 | 2921 |
| 2923 RenderLayer* hitLayer = hitTestLayerByApplyingTransform(rootLayer, conta
inerLayer, request, result, hitTestRect, hitTestLocation, | 2922 RenderLayer* hitLayer = hitTestLayerByApplyingTransform(rootLayer, conta
inerLayer, request, result, hitTestRect, hitTestLocation, |
| 2924 transformState, zOffset, fragment.paginationOffset); | 2923 transformState, zOffset, fragment.paginationOffset); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3162 child->repaintBlockSelectionGaps(); | 3161 child->repaintBlockSelectionGaps(); |
| 3163 | 3162 |
| 3164 if (m_blockSelectionGapsBounds.isEmpty()) | 3163 if (m_blockSelectionGapsBounds.isEmpty()) |
| 3165 return; | 3164 return; |
| 3166 | 3165 |
| 3167 LayoutRect rect = m_blockSelectionGapsBounds; | 3166 LayoutRect rect = m_blockSelectionGapsBounds; |
| 3168 if (renderer()->hasOverflowClip()) { | 3167 if (renderer()->hasOverflowClip()) { |
| 3169 RenderBox* box = renderBox(); | 3168 RenderBox* box = renderBox(); |
| 3170 rect.move(-box->scrolledContentOffset()); | 3169 rect.move(-box->scrolledContentOffset()); |
| 3171 if (!scrollableArea()->usesCompositedScrolling()) | 3170 if (!scrollableArea()->usesCompositedScrolling()) |
| 3172 rect.intersect(box->overflowClipRect(LayoutPoint(), 0)); // FIXME: R
egions not accounted for. | 3171 rect.intersect(box->overflowClipRect(LayoutPoint())); |
| 3173 } | 3172 } |
| 3174 if (renderer()->hasClip()) | 3173 if (renderer()->hasClip()) |
| 3175 rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint(), 0)); //
FIXME: Regions not accounted for. | 3174 rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint())); |
| 3176 if (!rect.isEmpty()) | 3175 if (!rect.isEmpty()) |
| 3177 renderer()->repaintRectangle(rect); | 3176 renderer()->repaintRectangle(rect); |
| 3178 } | 3177 } |
| 3179 | 3178 |
| 3180 bool RenderLayer::hasBlockSelectionGapBounds() const | 3179 bool RenderLayer::hasBlockSelectionGapBounds() const |
| 3181 { | 3180 { |
| 3182 return !m_blockSelectionGapsBounds.isEmpty(); | 3181 return !m_blockSelectionGapsBounds.isEmpty(); |
| 3183 } | 3182 } |
| 3184 | 3183 |
| 3185 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layo
utRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromR
oot) const | 3184 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layo
utRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromR
oot) const |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3930 } | 3929 } |
| 3931 } | 3930 } |
| 3932 | 3931 |
| 3933 void showLayerTree(const WebCore::RenderObject* renderer) | 3932 void showLayerTree(const WebCore::RenderObject* renderer) |
| 3934 { | 3933 { |
| 3935 if (!renderer) | 3934 if (!renderer) |
| 3936 return; | 3935 return; |
| 3937 showLayerTree(renderer->enclosingLayer()); | 3936 showLayerTree(renderer->enclosingLayer()); |
| 3938 } | 3937 } |
| 3939 #endif | 3938 #endif |
| OLD | NEW |