Bug 836844 - Pass the right clip area for canvas frames. r=roc

This commit is contained in:
Matt Woodrow 2013-02-04 07:11:49 -05:00
parent bdf9a900a1
commit ce93190e34
6 changed files with 45 additions and 6 deletions

View File

@ -3006,12 +3006,13 @@ nsRect
nsCSSRendering::GetBackgroundLayerRect(nsPresContext* aPresContext,
nsIFrame* aForFrame,
const nsRect& aBorderArea,
const nsRect& aClipRect,
const nsStyleBackground& aBackground,
const nsStyleBackground::Layer& aLayer)
{
nsBackgroundLayerState state =
PrepareBackgroundLayer(aPresContext, aForFrame, 0, aBorderArea,
aBorderArea, aBackground, aLayer);
aClipRect, aBackground, aLayer);
return state.mFillArea;
}

View File

@ -390,6 +390,7 @@ struct nsCSSRendering {
static nsRect GetBackgroundLayerRect(nsPresContext* aPresContext,
nsIFrame* aForFrame,
const nsRect& aBorderArea,
const nsRect& aClipRect,
const nsStyleBackground& aBackground,
const nsStyleBackground::Layer& aLayer);

View File

@ -2010,11 +2010,8 @@ nsDisplayBackgroundImage::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
(!mFrame->GetPrevContinuation() && !mFrame->GetNextContinuation())) {
const nsStyleBackground::Layer& layer = mBackgroundStyle->mLayers[mLayer];
if (layer.mImage.IsOpaque()) {
nsRect borderBox = nsRect(ToReferenceFrame(), mFrame->GetSize());
nsPresContext* presContext = mFrame->PresContext();
nsRect r = nsCSSRendering::GetBackgroundLayerRect(presContext, mFrame,
borderBox, *mBackgroundStyle, layer);
result = GetInsideClipRegion(this, presContext, layer.mClip, r, aSnap);
result = GetInsideClipRegion(this, presContext, layer.mClip, mBounds, aSnap);
}
}
@ -2193,9 +2190,14 @@ nsDisplayBackgroundImage::GetBoundsInternal() {
}
nsRect borderBox = nsRect(ToReferenceFrame(), mFrame->GetSize());
nsRect clipRect = borderBox;
if (mFrame->GetType() == nsGkAtoms::canvasFrame) {
nsCanvasFrame* frame = static_cast<nsCanvasFrame*>(mFrame);
clipRect = frame->CanvasArea() + ToReferenceFrame();
}
const nsStyleBackground::Layer& layer = mBackgroundStyle->mLayers[mLayer];
return nsCSSRendering::GetBackgroundLayerRect(presContext, mFrame,
borderBox, *mBackgroundStyle, layer);
borderBox, clipRect, *mBackgroundStyle, layer);
}
uint32_t

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
body {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAECAYAAACzzX7wAAAANUlEQVQImWPonzzt/6L5y+B4Yv8UFD4DMgcbhiuYMnni/wULFsAlJkzqJ2DCwuX/F81f9h8Aludb9rn0ffkAAAAASUVORK5CYII=') repeat scroll 0% 0% transparent;
}
</style>
</head>
<body>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html class="reftest-wait"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
body {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAECAYAAACzzX7wAAAANUlEQVQImWPonzzt/6L5y+B4Yv8UFD4DMgcbhiuYMnni/wULFsAlJkzqJ2DCwuX/F81f9h8Aludb9rn0ffkAAAAASUVORK5CYII=') repeat scroll 0% 0% transparent;
overflow: hidden;
}
</style>
<script type="text/javascript">
function doScroll() {
window.scrollTo(0, 500);
document.documentElement.removeAttribute("class");
}
document.addEventListener("MozReftestInvalidate", doScroll, false);
</script>
</head>
<body>
<div style="height: 2000px;"></div>
</body></html>

View File

@ -1743,3 +1743,4 @@ skip-if(B2G) == 818276-1.html 818276-1-ref.html
== 827577-1a.html 827577-1-ref.html
== 827577-1b.html 827577-1-ref.html
== 827799-1.html about:blank
== 836844-1.html 836844-1-ref.html