2009-06-23 Simon Fraser <simon.fraser@apple.com>

        Reviewed by Dave Hyatt

        First part of https://bugs.webkit.org/show_bug.cgi?id=26652

        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::paint):
        (WebCore::RenderLayer::paintLayer):
        * rendering/RenderLayer.h:
        (WebCore::RenderLayer::):
        * rendering/RenderReplica.cpp:
        (WebCore::RenderReplica::paint):
        Replace the 3 boolean params to RenderLayer::paintLayer() with a bit mask for readability.

        * rendering/RenderLayerBacking.cpp:
        (WebCore::RenderLayerBacking::paintIntoLayer):
        (WebCore::RenderLayerBacking::paintContents):
        * rendering/RenderLayerBacking.h:
        Remove the unused 'haveTransparency' param to paintIntoLayer().

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@45001 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c326351a
......@@ -108,6 +108,27 @@
* storage/StorageArea.h:
(WebCore::StorageArea::blockUntilImportComplete):
2009-06-23 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dave Hyatt
First part of https://bugs.webkit.org/show_bug.cgi?id=26652
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paint):
(WebCore::RenderLayer::paintLayer):
* rendering/RenderLayer.h:
(WebCore::RenderLayer::):
* rendering/RenderReplica.cpp:
(WebCore::RenderReplica::paint):
Replace the 3 boolean params to RenderLayer::paintLayer() with a bit mask for readability.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::paintIntoLayer):
(WebCore::RenderLayerBacking::paintContents):
* rendering/RenderLayerBacking.h:
Remove the unused 'haveTransparency' param to paintIntoLayer().
2009-06-23 Simon Fraser <simon.fraser@apple.com>
Reviewed by Darin Adler.
......
......@@ -1894,7 +1894,7 @@ bool RenderLayer::scroll(ScrollDirection direction, ScrollGranularity granularit
void RenderLayer::paint(GraphicsContext* p, const IntRect& damageRect, PaintRestriction paintRestriction, RenderObject *paintingRoot)
{
RenderObject::OverlapTestRequestMap overlapTestRequests;
paintLayer(this, p, damageRect, false, paintRestriction, paintingRoot, &overlapTestRequests);
paintLayer(this, p, damageRect, paintRestriction, paintingRoot, &overlapTestRequests);
RenderObject::OverlapTestRequestMap::iterator end = overlapTestRequests.end();
for (RenderObject::OverlapTestRequestMap::iterator it = overlapTestRequests.begin(); it != end; ++it)
it->first->setOverlapTestResult(false);
......@@ -1931,16 +1931,16 @@ static void performOverlapTests(RenderObject::OverlapTestRequestMap& overlapTest
}
void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p,
const IntRect& paintDirtyRect, bool haveTransparency, PaintRestriction paintRestriction,
const IntRect& paintDirtyRect, PaintRestriction paintRestriction,
RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap* overlapTestRequests,
bool appliedTransform, bool temporaryClipRects)
PaintLayerFlags paintFlags)
{
#if USE(ACCELERATED_COMPOSITING)
if (isComposited()) {
// The updatingControlTints() painting pass goes through compositing layers,
// but we need to ensure that we don't cache clip rects computed with the wrong root in this case.
if (p->updatingControlTints())
temporaryClipRects = true;
paintFlags |= PaintLayerTemporaryClipRects;
else if (!backing()->paintingGoesToWindow()) {
// If this RenderLayer should paint into its backing, that will be done via RenderLayerBacking::paintIntoLayer().
return;
......@@ -1959,24 +1959,24 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p,
return;
if (paintsWithTransparency())
haveTransparency = true;
paintFlags |= PaintLayerHaveTransparency;
// Apply a transform if we have one. A reflection is considered to be a transform, since it is a flip and a translate.
if (paintsWithTransform() && !appliedTransform) {
if (paintsWithTransform() && !(paintFlags & PaintLayerAppliedTransform)) {
// If the transform can't be inverted, then don't paint anything.
if (!m_transform->isInvertible())
return;
// If we have a transparency layer enclosing us and we are the root of a transform, then we need to establish the transparency
// layer from the parent now.
if (haveTransparency)
if (paintFlags & PaintLayerHaveTransparency)
parent()->beginTransparencyLayers(p, rootLayer);
// Make sure the parent's clip rects have been calculated.
IntRect clipRect = paintDirtyRect;
if (parent()) {
ClipRects parentRects;
parentClipRects(rootLayer, parentRects, temporaryClipRects);
parentClipRects(rootLayer, parentRects, paintFlags & PaintLayerTemporaryClipRects);
clipRect = parentRects.overflowClipRect();
clipRect.intersect(paintDirtyRect);
}
......@@ -1998,7 +1998,7 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p,
p->concatCTM(transform);
// Now do a paint with the root layer shifted to be us.
paintLayer(this, p, transform.inverse().mapRect(paintDirtyRect), haveTransparency, paintRestriction, paintingRoot, overlapTestRequests, true, temporaryClipRects);
paintLayer(this, p, transform.inverse().mapRect(paintDirtyRect), paintRestriction, paintingRoot, overlapTestRequests, paintFlags | PaintLayerAppliedTransform);
p->restore();
......@@ -2008,17 +2008,20 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p,
return;
}
PaintLayerFlags localPaintFlags = paintFlags & ~PaintLayerAppliedTransform;
bool haveTransparency = localPaintFlags & PaintLayerHaveTransparency;
// Paint the reflection first if we have one.
if (m_reflection && !m_paintingInsideReflection && (!m_transform || appliedTransform)) {
if (m_reflection && !m_paintingInsideReflection && (!m_transform || (paintFlags & PaintLayerAppliedTransform))) {
// Mark that we are now inside replica painting.
m_paintingInsideReflection = true;
reflectionLayer()->paintLayer(rootLayer, p, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot, overlapTestRequests, false, temporaryClipRects);
reflectionLayer()->paintLayer(rootLayer, p, paintDirtyRect, paintRestriction, paintingRoot, overlapTestRequests, localPaintFlags);
m_paintingInsideReflection = false;
}
// Calculate the clip rects we should use.
IntRect layerBounds, damageRect, clipRectToApply, outlineRect;
calculateRects(rootLayer, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect, temporaryClipRects);
calculateRects(rootLayer, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect, localPaintFlags & PaintLayerTemporaryClipRects);
int x = layerBounds.x();
int y = layerBounds.y();
int tx = x - renderBoxX();
......@@ -2063,7 +2066,7 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p,
// Now walk the sorted list of children with negative z-indices.
if (m_negZOrderList)
for (Vector<RenderLayer*>::iterator it = m_negZOrderList->begin(); it != m_negZOrderList->end(); ++it)
it[0]->paintLayer(rootLayer, p, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot, overlapTestRequests, false, temporaryClipRects);
it[0]->paintLayer(rootLayer, p, paintDirtyRect, paintRestriction, paintingRoot, overlapTestRequests, localPaintFlags);
// Now establish the appropriate clip and paint our child RenderObjects.
if (shouldPaint && !clipRectToApply.isEmpty()) {
......@@ -2102,12 +2105,12 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p,
// Paint any child layers that have overflow.
if (m_normalFlowList)
for (Vector<RenderLayer*>::iterator it = m_normalFlowList->begin(); it != m_normalFlowList->end(); ++it)
it[0]->paintLayer(rootLayer, p, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot, overlapTestRequests, false, temporaryClipRects);
it[0]->paintLayer(rootLayer, p, paintDirtyRect, paintRestriction, paintingRoot, overlapTestRequests, localPaintFlags);
// Now walk the sorted list of children with positive z-indices.
if (m_posZOrderList)
for (Vector<RenderLayer*>::iterator it = m_posZOrderList->begin(); it != m_posZOrderList->end(); ++it)
it[0]->paintLayer(rootLayer, p, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot, overlapTestRequests, false, temporaryClipRects);
it[0]->paintLayer(rootLayer, p, paintDirtyRect, paintRestriction, paintingRoot, overlapTestRequests, localPaintFlags);
if (renderer()->hasMask() && shouldPaint && !selectionOnly && !damageRect.isEmpty()) {
setClip(p, paintDirtyRect, damageRect);
......
......@@ -439,10 +439,17 @@ private:
void updateLayerListsIfNeeded();
enum PaintLayerFlag {
PaintLayerHaveTransparency = 1,
PaintLayerAppliedTransform = 1 << 1,
PaintLayerTemporaryClipRects = 1 << 2
};
typedef unsigned PaintLayerFlags;
void paintLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect,
bool haveTransparency, PaintRestriction, RenderObject* paintingRoot,
RenderObject::OverlapTestRequestMap* = 0,
bool appliedTransform = false, bool temporaryClipRects = false);
PaintRestriction, RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap* = 0,
PaintLayerFlags paintFlags = 0);
RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result,
const IntRect& hitTestRect, const IntPoint& hitTestPoint, bool appliedTransform,
......
......@@ -739,7 +739,7 @@ static void restoreClip(GraphicsContext* p, const IntRect& paintDirtyRect, const
// Share this with RenderLayer::paintLayer, which would have to be educated about GraphicsLayerPaintingPhase?
void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* context,
const IntRect& paintDirtyRect, // in the coords of rootLayer
bool haveTransparency, PaintRestriction paintRestriction, GraphicsLayerPaintingPhase paintingPhase,
PaintRestriction paintRestriction, GraphicsLayerPaintingPhase paintingPhase,
RenderObject* paintingRoot)
{
if (paintingGoesToWindow()) {
......@@ -816,7 +816,7 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
Vector<RenderLayer*>* negZOrderList = m_owningLayer->negZOrderList();
if (negZOrderList) {
for (Vector<RenderLayer*>::iterator it = negZOrderList->begin(); it != negZOrderList->end(); ++it)
it[0]->paintLayer(rootLayer, context, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot);
it[0]->paintLayer(rootLayer, context, paintDirtyRect, paintRestriction, paintingRoot);
}
bool forceBlackText = paintRestriction == PaintRestrictionSelectionOnlyBlackText;
......@@ -855,14 +855,14 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
Vector<RenderLayer*>* normalFlowList = m_owningLayer->normalFlowList();
if (normalFlowList) {
for (Vector<RenderLayer*>::iterator it = normalFlowList->begin(); it != normalFlowList->end(); ++it)
it[0]->paintLayer(rootLayer, context, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot);
it[0]->paintLayer(rootLayer, context, paintDirtyRect, paintRestriction, paintingRoot);
}
// Now walk the sorted list of children with positive z-indices.
Vector<RenderLayer*>* posZOrderList = m_owningLayer->posZOrderList();
if (posZOrderList) {
for (Vector<RenderLayer*>::iterator it = posZOrderList->begin(); it != posZOrderList->end(); ++it)
it[0]->paintLayer(rootLayer, context, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot);
it[0]->paintLayer(rootLayer, context, paintDirtyRect, paintRestriction, paintingRoot);
}
if (renderer()->hasMask() && !selectionOnly && !damageRect.isEmpty()) {
......@@ -899,7 +899,7 @@ void RenderLayerBacking::paintContents(const GraphicsLayer*, GraphicsContext& co
IntRect dirtyRect = enclosingBBox;
dirtyRect.intersect(clipRect);
paintIntoLayer(m_owningLayer, &context, dirtyRect, false, PaintRestrictionNone, drawingPhase, renderer());
paintIntoLayer(m_owningLayer, &context, dirtyRect, PaintRestrictionNone, drawingPhase, renderer());
}
bool RenderLayerBacking::startAnimation(double beginTime, const Animation* anim, const KeyframeList& keyframes)
......
......@@ -151,7 +151,7 @@ private:
bool hasNonCompositingContent() const;
void paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect,
bool haveTransparency, PaintRestriction paintRestriction, GraphicsLayerPaintingPhase, RenderObject* paintingRoot);
PaintRestriction paintRestriction, GraphicsLayerPaintingPhase, RenderObject* paintingRoot);
static int graphicsLayerToCSSProperty(AnimatedPropertyID);
static AnimatedPropertyID cssToGraphicsLayerProperty(int);
......
......@@ -72,9 +72,8 @@ void RenderReplica::paint(PaintInfo& paintInfo, int tx, int ty)
// computing using the wrong rootLayer
layer()->parent()->paintLayer(layer()->transform() ? layer()->parent() : layer()->enclosingTransformedAncestor(),
paintInfo.context, paintInfo.rect,
true, PaintRestrictionNone, 0, 0,
true, // appliedTransform
true); // temporaryClipRects
PaintRestrictionNone, 0, 0,
RenderLayer::PaintLayerHaveTransparency | RenderLayer::PaintLayerAppliedTransform | RenderLayer::PaintLayerTemporaryClipRects);
else if (paintInfo.phase == PaintPhaseMask)
paintMask(paintInfo, tx, ty);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment