Bug 1023677 - Don't flatten active transform layers. r=roc

This commit is contained in:
Matt Woodrow 2014-07-18 18:48:23 +12:00
Родитель 12825a660a
Коммит 10606c58a7
1 изменённых файлов: 15 добавлений и 4 удалений

Просмотреть файл

@ -530,7 +530,7 @@ public:
* @param aTextContentFlags if any child layer has CONTENT_COMPONENT_ALPHA, * @param aTextContentFlags if any child layer has CONTENT_COMPONENT_ALPHA,
* set *aTextContentFlags to CONTENT_COMPONENT_ALPHA * set *aTextContentFlags to CONTENT_COMPONENT_ALPHA
*/ */
void Finish(uint32_t *aTextContentFlags, LayerManagerData* aData); void Finish(uint32_t *aTextContentFlags, LayerManagerData* aData, bool& aHasComponentAlphaChildren);
nsRect GetChildrenBounds() { return mBounds; } nsRect GetChildrenBounds() { return mBounds; }
@ -3065,7 +3065,7 @@ ContainerState::CollectOldLayers()
} }
void void
ContainerState::Finish(uint32_t* aTextContentFlags, LayerManagerData* aData) ContainerState::Finish(uint32_t* aTextContentFlags, LayerManagerData* aData, bool& aHasComponentAlphaChildren)
{ {
while (!mThebesLayerDataStack.IsEmpty()) { while (!mThebesLayerDataStack.IsEmpty()) {
PopThebesLayerData(); PopThebesLayerData();
@ -3084,6 +3084,16 @@ ContainerState::Finish(uint32_t* aTextContentFlags, LayerManagerData* aData)
textContentFlags |= textContentFlags |=
layer->GetContentFlags() & (Layer::CONTENT_COMPONENT_ALPHA | layer->GetContentFlags() & (Layer::CONTENT_COMPONENT_ALPHA |
Layer::CONTENT_COMPONENT_ALPHA_DESCENDANT); Layer::CONTENT_COMPONENT_ALPHA_DESCENDANT);
// Notify the parent of component alpha children unless it's coming from
// within a transformed child since we don't want flattening of component
// alpha layers to happen across transforms. Re-rendering the text during
// transform animations looks worse than losing subpixel-AA.
if ((layer->GetContentFlags() & Layer::CONTENT_COMPONENT_ALPHA) &&
(layer->GetType() != Layer::TYPE_CONTAINER ||
layer->GetBaseTransform().IsIdentity())) {
aHasComponentAlphaChildren = true;
}
} }
if (!layer->GetParent()) { if (!layer->GetParent()) {
@ -3423,12 +3433,13 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
// Set CONTENT_COMPONENT_ALPHA if any of our children have it. // Set CONTENT_COMPONENT_ALPHA if any of our children have it.
// This is suboptimal ... a child could have text that's over transparent // This is suboptimal ... a child could have text that's over transparent
// pixels in its own layer, but over opaque parts of previous siblings. // pixels in its own layer, but over opaque parts of previous siblings.
state.Finish(&flags, data); bool hasComponentAlphaChildren = false;
state.Finish(&flags, data, hasComponentAlphaChildren);
bounds = state.GetChildrenBounds(); bounds = state.GetChildrenBounds();
pixBounds = state.ScaleToOutsidePixels(bounds, false); pixBounds = state.ScaleToOutsidePixels(bounds, false);
appUnitsPerDevPixel = state.GetAppUnitsPerDevPixel(); appUnitsPerDevPixel = state.GetAppUnitsPerDevPixel();
if ((flags & Layer::CONTENT_COMPONENT_ALPHA) && if (hasComponentAlphaChildren &&
mRetainingManager && mRetainingManager &&
!mRetainingManager->AreComponentAlphaLayersEnabled() && !mRetainingManager->AreComponentAlphaLayersEnabled() &&
containerLayer->HasMultipleChildren() && containerLayer->HasMultipleChildren() &&