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,
* 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; }
@ -3065,7 +3065,7 @@ ContainerState::CollectOldLayers()
}
void
ContainerState::Finish(uint32_t* aTextContentFlags, LayerManagerData* aData)
ContainerState::Finish(uint32_t* aTextContentFlags, LayerManagerData* aData, bool& aHasComponentAlphaChildren)
{
while (!mThebesLayerDataStack.IsEmpty()) {
PopThebesLayerData();
@ -3084,6 +3084,16 @@ ContainerState::Finish(uint32_t* aTextContentFlags, LayerManagerData* aData)
textContentFlags |=
layer->GetContentFlags() & (Layer::CONTENT_COMPONENT_ALPHA |
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()) {
@ -3423,12 +3433,13 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
// Set CONTENT_COMPONENT_ALPHA if any of our children have it.
// This is suboptimal ... a child could have text that's over transparent
// 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();
pixBounds = state.ScaleToOutsidePixels(bounds, false);
appUnitsPerDevPixel = state.GetAppUnitsPerDevPixel();
if ((flags & Layer::CONTENT_COMPONENT_ALPHA) &&
if (hasComponentAlphaChildren &&
mRetainingManager &&
!mRetainingManager->AreComponentAlphaLayersEnabled() &&
containerLayer->HasMultipleChildren() &&