提交 bd590c7b 编写于 作者: O Ojan Vafai

Remove mask painting.

Now that we don't have -webkit-mask-*, this is dead code.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/886263003
上级 81ae67c9
......@@ -193,9 +193,6 @@ void InlineBox::adjustPosition(float dx, float dy)
void InlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
{
if (paintInfo.phase == PaintPhaseMask)
return;
LayoutPoint childPoint = paintOffset;
RenderBlock::paintAsInlineBlock(&renderer(), paintInfo, childPoint);
}
......
......@@ -997,11 +997,6 @@ void InlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
if (!paintInfo.rect.intersects(pixelSnappedIntRect(overflowRect)))
return;
if (paintInfo.phase == PaintPhaseMask) {
paintMask(paintInfo, paintOffset);
return;
}
paintBoxDecorationBackground(paintInfo, paintOffset);
for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
......@@ -1168,51 +1163,6 @@ void InlineFlowBox::paintBoxDecorationBackground(PaintInfo& paintInfo, const Lay
}
}
void InlineFlowBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
// Pixel snap mask painting.
LayoutRect frameRect = roundedFrameRect();
// Move x/y to our coordinates.
LayoutRect localRect(frameRect);
LayoutPoint adjustedPaintOffset = paintOffset + localRect.location();
const NinePieceImage& maskNinePieceImage = renderer().style()->maskBoxImage();
StyleImage* maskBoxImage = renderer().style()->maskBoxImage().image();
LayoutRect paintRect = LayoutRect(adjustedPaintOffset, frameRect.size());
paintFillLayers(paintInfo, Color::transparent, renderer().style()->maskLayers(), paintRect);
bool hasBoxImage = maskBoxImage && maskBoxImage->canRender(renderer());
if (!hasBoxImage || !maskBoxImage->isLoaded()) {
return; // Don't paint anything while we wait for the image to load.
}
// The simple case is where we are the only box for this object. In those
// cases only a single call to draw is required.
if (!prevLineBox() && !nextLineBox()) {
boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(adjustedPaintOffset, frameRect.size()), renderer().style(), maskNinePieceImage);
} else {
// We have a mask image that spans multiple lines.
// We need to adjust _tx and _ty by the width of all previous lines.
LayoutUnit logicalOffsetOnLine = 0;
for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox())
logicalOffsetOnLine += curr->logicalWidth();
LayoutUnit totalLogicalWidth = logicalOffsetOnLine;
for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
totalLogicalWidth += curr->logicalWidth();
LayoutUnit stripX = adjustedPaintOffset.x() - logicalOffsetOnLine;
LayoutUnit stripY = adjustedPaintOffset.y();
LayoutUnit stripWidth = totalLogicalWidth;
LayoutUnit stripHeight = frameRect.height();
LayoutRect clipRect = clipRectForNinePieceImageStrip(this, maskNinePieceImage, paintRect);
GraphicsContextStateSaver stateSaver(*paintInfo.context);
paintInfo.context->clip(clipRect);
boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(stripX, stripY, stripWidth, stripHeight), renderer().style(), maskNinePieceImage);
}
}
InlineBox* InlineFlowBox::firstLeafChild() const
{
InlineBox* leaf = 0;
......
......@@ -291,7 +291,6 @@ public:
private:
void paintBoxDecorationBackground(PaintInfo&, const LayoutPoint&);
void paintMask(PaintInfo&, const LayoutPoint&);
void paintFillLayers(const PaintInfo&, const Color&, const FillLayer&, const LayoutRect&);
void paintFillLayer(const PaintInfo&, const Color&, const FillLayer&, const LayoutRect&);
void paintBoxShadow(const PaintInfo&, RenderStyle*, ShadowStyle, const LayoutRect&);
......
......@@ -39,7 +39,6 @@ namespace blink {
enum PaintPhase {
PaintPhaseForeground,
PaintPhaseMask,
};
} // namespace blink
......
......@@ -501,9 +501,7 @@ void RenderBlock::paintChildAsInlineBlock(RenderBox* child, PaintInfo& paintInfo
void RenderBlock::paintAsInlineBlock(RenderObject* renderer, PaintInfo& paintInfo, const LayoutPoint& childPoint)
{
// FIXME(sky): Why don't masks go down this path?
if (paintInfo.phase == PaintPhaseMask)
return;
// FIXME(sky): Remove this function.
renderer->paint(paintInfo, childPoint);
}
......@@ -538,11 +536,6 @@ void RenderBlock::paintCarets(PaintInfo& paintInfo, const LayoutPoint& paintOffs
void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (paintInfo.phase == PaintPhaseMask) {
paintMask(paintInfo, paintOffset);
return;
}
if (hasBoxDecorationBackground())
paintBoxDecorationBackground(paintInfo, paintOffset);
......
......@@ -499,13 +499,6 @@ bool RenderBox::backgroundHasOpaqueTopLayer() const
return false;
}
void RenderBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
LayoutRect paintRect = LayoutRect(paintOffset, size());
paintFillLayers(paintInfo, Color::transparent, style()->maskLayers(), paintRect, BackgroundBleedNone);
paintNinePieceImage(paintInfo.context, paintRect, style(), style()->maskBoxImage());
}
void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer& fillLayer, const LayoutRect& rect,
BackgroundBleedAvoidance bleedAvoidance, RenderObject* backgroundObject)
{
......@@ -568,9 +561,6 @@ void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const
bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumulatedOffset, ContentsClipBehavior contentsClipBehavior)
{
if (paintInfo.phase == PaintPhaseMask)
return false;
bool isOverflowClip = hasOverflowClip() && !layer()->isSelfPaintingLayer();
if (!isOverflowClip)
return false;
......
......@@ -381,7 +381,6 @@ public:
virtual void paintObject(PaintInfo&, const LayoutPoint&) { ASSERT_NOT_REACHED(); }
virtual void paintBoxDecorationBackground(PaintInfo&, const LayoutPoint&);
virtual void paintMask(PaintInfo&, const LayoutPoint&);
// Called when a positioned object moves but doesn't necessarily change size. A simplified layout is attempted
// that just updates the object's position. If the size does change, the object remains dirty.
......
......@@ -950,9 +950,6 @@ void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti
// Make sure that we now use the original transparency context.
ASSERT(transparencyLayerContext == context);
if (shouldPaintContent && renderer()->hasMask())
paintMask(context, localPaintingInfo, layerLocation, backgroundRect);
// End our transparency layer
if (haveTransparency && m_usedTransparency) {
context->endLayer();
......@@ -1027,21 +1024,6 @@ void RenderLayer::paintForeground(GraphicsContext* context, GraphicsContext* tra
restoreClip(context, localPaintingInfo.paintDirtyRect, layerForegroundRect);
}
void RenderLayer::paintMask(GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
LayoutPoint& layerLocation, ClipRect& layerBackgroundRect)
{
if (localPaintingInfo.clipToDirtyRect)
clipToRect(localPaintingInfo, context, layerBackgroundRect, DoNotIncludeSelfForBorderRadius); // Mask painting will handle clipping to self.
// Paint the mask.
// FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
PaintInfo paintInfo(context, pixelSnappedIntRect(layerBackgroundRect.rect()), PaintPhaseMask, localPaintingInfo.rootLayer->renderer());
renderer()->paint(paintInfo, layerLocation);
if (localPaintingInfo.clipToDirtyRect)
restoreClip(context, localPaintingInfo.paintDirtyRect, layerBackgroundRect);
}
static inline LayoutRect frameVisibleRect(RenderObject* renderer)
{
FrameView* frameView = renderer->document().view();
......
......@@ -289,8 +289,6 @@ private:
void paintForeground(GraphicsContext*, GraphicsContext* transparencyLayerContext,
const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const LayerPaintingInfo&,
LayoutPoint& layerLocation, ClipRect& layerForegroundRect);
void paintMask(GraphicsContext*, const LayerPaintingInfo&,
LayoutPoint& layerLocation, ClipRect& layerBackgroundRect);
RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result,
const LayoutRect& hitTestRect, const HitTestLocation&, bool appliedTransform,
......
......@@ -93,11 +93,6 @@ void RenderReplaced::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
LayoutPoint adjustedPaintOffset = paintOffset + location();
if (paintInfo.phase == PaintPhaseMask) {
paintMask(paintInfo, adjustedPaintOffset);
return;
}
if (hasBoxDecorationBackground())
paintBoxDecorationBackground(paintInfo, adjustedPaintOffset);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册