Bug 1294299 part 13 - Post restyle event with style attribute hint for style change. r=heycam

MozReview-Commit-ID: 8quLmF0xaxv

--HG--
extra : source : 756be1f6f24db58250575910149e3c63f2320615
This commit is contained in:
Xidorn Quan 2016-11-03 14:41:02 +11:00
Родитель f9aa28d18d
Коммит 67de44415a
2 изменённых файлов: 18 добавлений и 4 удалений

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

@ -35,6 +35,12 @@ ServoRestyleManager::PostRestyleEvent(Element* aElement,
return; // Nothing to do.
}
// XXX This is a temporary hack to make style attribute change works.
// In the future, we should be able to use this hint directly.
if (aRestyleHint & eRestyle_StyleAttribute) {
aRestyleHint |= eRestyle_Subtree;
}
// Note that unlike in Servo, we don't mark elements as dirty until we process
// the restyle hints in ProcessPendingRestyles.
if (aRestyleHint || aMinChangeHint) {
@ -507,6 +513,17 @@ ServoRestyleManager::AttributeWillChange(Element* aElement,
snapshot->AddAttrs(aElement);
}
void
ServoRestyleManager::AttributeChanged(Element* aElement, int32_t aNameSpaceID,
nsIAtom* aAttribute, int32_t aModType,
const nsAttrValue* aOldValue)
{
MOZ_ASSERT(SnapshotForElement(aElement)->HasAttrs());
if (aAttribute == nsGkAtoms::style) {
PostRestyleEvent(aElement, eRestyle_StyleAttribute, nsChangeHint(0));
}
}
nsresult
ServoRestyleManager::ReparentStyleContext(nsIFrame* aFrame)
{

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

@ -73,10 +73,7 @@ public:
void AttributeChanged(dom::Element* aElement, int32_t aNameSpaceID,
nsIAtom* aAttribute, int32_t aModType,
const nsAttrValue* aOldValue)
{
MOZ_ASSERT(SnapshotForElement(aElement)->HasAttrs());
}
const nsAttrValue* aOldValue);
nsresult ReparentStyleContext(nsIFrame* aFrame);