author | Robert O'Callahan <robert@ocallahan.org> |
Sat, 10 Nov 2012 00:42:10 -0500 | |
changeset 113327 | 28c5c66f9e313717b73c3e9510034492d610a035 |
parent 113326 | 4900b1e47d617d2db848a41c3fb9418670ce577b |
child 113328 | b16f3d964ecf9446f2c95d54dfc4b00b1cbb3e96 |
push id | 23869 |
push user | emorley@mozilla.com |
push date | Thu, 15 Nov 2012 16:18:16 +0000 |
treeherder | mozilla-central@a37525d304d9 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mattwoodrow |
bugs | 810470 |
milestone | 19.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -1656,54 +1656,30 @@ static bool RoundedRectContainsRect(cons bool nsDisplayBackgroundImage::IsSingleFixedPositionImage(nsDisplayListBuilder* aBuilder, const nsRect& aClipRect) { if (mIsThemed || !mBackgroundStyle) return false; nsPresContext* presContext = mFrame->PresContext(); - nsStyleContext* bgSC; - nsCSSRendering::FindBackground(presContext, mFrame, &bgSC); - - bool drawBackgroundImage; - bool drawBackgroundColor; - nsCSSRendering::DetermineBackgroundColor(presContext, - bgSC, - mFrame, - drawBackgroundImage, - drawBackgroundColor); - - // For now we don't know how to draw image layers with a background color. - if (!drawBackgroundImage || drawBackgroundColor) - return false; - - const nsStyleBackground *bg = bgSC->GetStyleBackground(); - - // We could pretty easily support multiple image layers, but for now we - // just punt here. - if (bg->mLayers.Length() != 1) - return false; - uint32_t flags = aBuilder->GetBackgroundPaintFlags(); - nsPoint offset = ToReferenceFrame(); - nsRect borderArea = nsRect(offset, mFrame->GetSize()); - - const nsStyleBackground::Layer &layer = bg->mLayers[0]; + nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize()); + const nsStyleBackground::Layer &layer = mBackgroundStyle->mLayers[mLayer]; if (layer.mAttachment != NS_STYLE_BG_ATTACHMENT_FIXED) return false; nsBackgroundLayerState state = nsCSSRendering::PrepareBackgroundLayer(presContext, mFrame, flags, borderArea, aClipRect, - *bg, + *mBackgroundStyle, layer); nsImageRenderer* imageRenderer = &state.mImageRenderer; // We only care about images here, not gradients. if (!imageRenderer->IsRasterImage()) return false; int32_t appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel(); @@ -1714,46 +1690,27 @@ nsDisplayBackgroundImage::IsSingleFixedP bool nsDisplayBackgroundImage::TryOptimizeToImageLayer(nsDisplayListBuilder* aBuilder) { if (mIsThemed || !mBackgroundStyle) return false; nsPresContext* presContext = mFrame->PresContext(); - nsStyleContext* bgSC; - nsCSSRendering::FindBackground(presContext, mFrame, &bgSC); - - bool drawBackgroundImage; - bool drawBackgroundColor; - nsCSSRendering::DetermineBackgroundColor(presContext, - bgSC, - mFrame, - drawBackgroundImage, - drawBackgroundColor); - - // For now we don't know how to draw image layers with a background color. - if (!drawBackgroundImage || drawBackgroundColor) - return false; - - const nsStyleBackground *bg = bgSC->GetStyleBackground(); - uint32_t flags = aBuilder->GetBackgroundPaintFlags(); - nsPoint offset = ToReferenceFrame(); - nsRect borderArea = nsRect(offset, mFrame->GetSize()); - - const nsStyleBackground::Layer &layer = bg->mLayers[mLayer]; + nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize()); + const nsStyleBackground::Layer &layer = mBackgroundStyle->mLayers[mLayer]; nsBackgroundLayerState state = nsCSSRendering::PrepareBackgroundLayer(presContext, mFrame, flags, borderArea, borderArea, - *bg, + *mBackgroundStyle, layer); nsImageRenderer* imageRenderer = &state.mImageRenderer; // We only care about images here, not gradients. if (imageRenderer->IsRasterImage()) return false; nsRefPtr<ImageContainer> imageContainer = imageRenderer->GetContainer();
--- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -1860,17 +1860,16 @@ public: nsRegion* aInvalidRegion); static nsRegion GetInsideClipRegion(nsDisplayItem* aItem, nsPresContext* aPresContext, uint8_t aClip, const nsRect& aRect, bool* aSnap); protected: typedef class mozilla::layers::ImageContainer ImageContainer; typedef class mozilla::layers::ImageLayer ImageLayer; - bool TryOptimizeToImageLayer(nsDisplayListBuilder* aBuilder); bool IsSingleFixedPositionImage(nsDisplayListBuilder* aBuilder, const nsRect& aClipRect); void ConfigureLayer(ImageLayer* aLayer); // Cache the result of nsCSSRendering::FindBackground. Always null if // mIsThemed is true or if FindBackground returned false. const nsStyleBackground* mBackgroundStyle; /* If this background can be a simple image layer, we store the format here. */