Bug 655864 Password field is not masked immediately and shows artifacts, when typing past the end of the field r=roc

This commit is contained in:
Benjamin Stover 2011-05-18 15:54:31 -07:00
Родитель 081ec7b12c
Коммит dae90969ea
2 изменённых файлов: 28 добавлений и 14 удалений

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

@ -439,10 +439,11 @@ FrameLayerBuilder::Init(nsDisplayListBuilder* aBuilder)
}
PRBool
FrameLayerBuilder::DisplayItemDataEntry::HasContainerLayer()
FrameLayerBuilder::DisplayItemDataEntry::HasNonEmptyContainerLayer()
{
for (PRUint32 i = 0; i < mData.Length(); ++i) {
if (mData[i].mLayer->GetType() == Layer::TYPE_CONTAINER)
if (mData[i].mLayer->GetType() == Layer::TYPE_CONTAINER &&
mData[i].mLayerState != LAYER_ACTIVE_EMPTY)
return PR_TRUE;
}
return PR_FALSE;
@ -609,7 +610,7 @@ FrameLayerBuilder::UpdateDisplayItemDataForFrame(nsPtrHashKey<nsIFrame>* aEntry,
return PL_DHASH_REMOVE;
}
if (newDisplayItems->HasContainerLayer()) {
if (newDisplayItems->HasNonEmptyContainerLayer()) {
// Reset or create the invalid region now so we can start collecting
// new dirty areas.
// Note that the NS_FRAME_HAS_CONTAINER_LAYER bit is set in
@ -1314,8 +1315,7 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList,
}
mBounds.UnionRect(mBounds, itemContent);
nsIntRect itemDrawRect = itemContent.ToOutsidePixels(appUnitsPerDevPixel);
nsDisplayItem::LayerState layerState =
item->GetLayerState(mBuilder, mManager);
LayerState layerState = item->GetLayerState(mBuilder, mManager);
nsIFrame* activeScrolledRoot =
nsLayoutUtils::GetActiveScrolledRootFor(item, mBuilder);
@ -1384,7 +1384,7 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList,
InvalidateForLayerChange(item, ownLayer);
mNewChildLayers.AppendElement(ownLayer);
mBuilder->LayerBuilder()->AddLayerDisplayItem(ownLayer, item);
mBuilder->LayerBuilder()->AddLayerDisplayItem(ownLayer, item, layerState);
} else {
nsRefPtr<ThebesLayer> thebesLayer =
FindThebesLayerFor(item, itemVisibleRect, itemDrawRect, aClip,
@ -1462,7 +1462,7 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayer* aLayer,
nsIFrame* aContainerLayerFrame,
LayerState aLayerState)
{
AddLayerDisplayItem(aLayer, aItem);
AddLayerDisplayItem(aLayer, aItem, aLayerState);
ThebesLayerItemsEntry* entry = mThebesLayerItems.PutEntry(aLayer);
if (entry) {
@ -1476,7 +1476,8 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayer* aLayer,
void
FrameLayerBuilder::AddLayerDisplayItem(Layer* aLayer,
nsDisplayItem* aItem)
nsDisplayItem* aItem,
LayerState aLayerState)
{
if (aLayer->Manager() != mRetainingManager)
return;
@ -1484,7 +1485,7 @@ FrameLayerBuilder::AddLayerDisplayItem(Layer* aLayer,
nsIFrame* f = aItem->GetUnderlyingFrame();
DisplayItemDataEntry* entry = mNewDisplayItemData.PutEntry(f);
if (entry) {
entry->mData.AppendElement(DisplayItemData(aLayer, aItem->GetPerFrameKey()));
entry->mData.AppendElement(DisplayItemData(aLayer, aItem->GetPerFrameKey(), aLayerState));
}
}
@ -1635,6 +1636,16 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
return nsnull;
}
if (aContainerItem &&
aContainerItem->GetLayerState(aBuilder, aManager) == LAYER_ACTIVE_EMPTY) {
// Empty layers only have metadata and should never have display items. We
// early exit because later, invalidation will walk up the frame tree to
// determine which thebes layer gets invalidated. Since an empty layer
// should never have anything to paint, it should never be invalidated.
NS_ASSERTION(aChildren.IsEmpty(), "Should have no children");
return containerLayer.forget();
}
ContainerState state(aBuilder, aManager, aContainerFrame, containerLayer);
nscoord appUnitsPerDevPixel = aContainerFrame->PresContext()->AppUnitsPerDevPixel();
@ -1642,7 +1653,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
DisplayItemDataEntry* entry = mNewDisplayItemData.PutEntry(aContainerFrame);
if (entry) {
entry->mData.AppendElement(
DisplayItemData(containerLayer, containerDisplayItemKey));
DisplayItemData(containerLayer, containerDisplayItemKey, LAYER_ACTIVE));
}
nsPoint* offsetAtLastPaint = static_cast<nsPoint*>

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

@ -224,7 +224,9 @@ public:
/**
* Record aItem as a display item that is rendered by aLayer.
*/
void AddLayerDisplayItem(Layer* aLayer, nsDisplayItem* aItem);
void AddLayerDisplayItem(Layer* aLayer,
nsDisplayItem* aItem,
LayerState aLayerState);
/**
* Record aItem as a display item that is rendered by the ThebesLayer
@ -382,11 +384,12 @@ protected:
*/
class DisplayItemData {
public:
DisplayItemData(Layer* aLayer, PRUint32 aKey)
: mLayer(aLayer), mDisplayItemKey(aKey) {}
DisplayItemData(Layer* aLayer, PRUint32 aKey, LayerState aLayerState)
: mLayer(aLayer), mDisplayItemKey(aKey), mLayerState(aLayerState) {}
nsRefPtr<Layer> mLayer;
PRUint32 mDisplayItemKey;
LayerState mLayerState;
};
static void InternalDestroyDisplayItemData(nsIFrame* aFrame,
@ -416,7 +419,7 @@ protected:
NS_ERROR("Should never be called, since we ALLOW_MEMMOVE");
}
PRBool HasContainerLayer();
PRBool HasNonEmptyContainerLayer();
nsTArray<DisplayItemData> mData;