Bug 625289 patch 6 - Store style contexts being reframed in the ReframingStyleContexts struct. r=heycam

This commit is contained in:
L. David Baron 2014-08-13 15:39:01 -07:00
Родитель 86de53b549
Коммит ebafb4f9b6
2 изменённых файлов: 30 добавлений и 3 удалений

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

@ -141,11 +141,27 @@ public:
*
* In all cases, the content node in the hash table is the real
* content node, not the anonymous content node we create for ::before
* or ::after.
* or ::after. The content node passed to the Get and Put methods is,
* however, the content node to be associate with the frame's style
* context.
*/
typedef nsRefPtrHashtable<nsRefPtrHashKey<nsIContent>, nsStyleContext>
ReframingStyleContextTable;
class ReframingStyleContexts {
public:
void Put(nsIContent* aContent, nsStyleContext* aStyleContext) {
MOZ_ASSERT(aContent);
nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
if (pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
mElementContexts.Put(aContent, aStyleContext);
} else if (pseudoType == nsCSSPseudoElements::ePseudo_before) {
MOZ_ASSERT(aContent->Tag() == nsGkAtoms::mozgeneratedcontentbefore);
mBeforePseudoContexts.Put(aContent->GetParent(), aStyleContext);
} else if (pseudoType == nsCSSPseudoElements::ePseudo_after) {
MOZ_ASSERT(aContent->Tag() == nsGkAtoms::mozgeneratedcontentafter);
mAfterPseudoContexts.Put(aContent->GetParent(), aStyleContext);
}
}
private:
ReframingStyleContextTable mElementContexts;
ReframingStyleContextTable mBeforePseudoContexts;

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

@ -33,6 +33,7 @@
#include <stdarg.h>
#include "nsFrameManager.h"
#include "nsLayoutUtils.h"
#include "RestyleManager.h"
#include "nsIDOMNode.h"
#include "nsISelection.h"
@ -651,11 +652,21 @@ nsFrame::DestroyFrom(nsIFrame* aDestructRoot)
}
}
// This needs to happen before shell->NotifyDestroyingFrame because that
// clears our Properties() table.
bool isPrimaryFrame = (mContent && mContent->GetPrimaryFrame() == this);
if (isPrimaryFrame) {
// This needs to happen before shell->NotifyDestroyingFrame because
// that clears our Properties() table.
ActiveLayerTracker::TransferActivityToContent(this, mContent);
// Unfortunately, we need to do this for all frames being reframed
// and not only those whose current style involves CSS transitions,
// because what matters is whether the new style (not the old)
// specifies CSS transitions.
RestyleManager::ReframingStyleContexts* rsc =
presContext->RestyleManager()->GetReframingStyleContexts();
if (rsc) {
rsc->Put(mContent, mStyleContext);
}
}
shell->NotifyDestroyingFrame(this);