зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1352306 - Part 1: stylo: Only snapshot attributes if there is some rule that depends on that attribute. r=emilio
MozReview-Commit-ID: Emey96ovc2a --HG-- extra : rebase_source : 149334dacb7658b46c477b5286af67453deb5961
This commit is contained in:
Родитель
43e2d655f4
Коммит
7bbb05753b
|
@ -815,10 +815,22 @@ ServoRestyleManager::AttributeWillChange(Element* aElement,
|
|||
return;
|
||||
}
|
||||
|
||||
bool influencesOtherPseudoClassState =
|
||||
AttributeInfluencesOtherPseudoClassState(aElement, aAttribute);
|
||||
|
||||
if (!influencesOtherPseudoClassState &&
|
||||
!((aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::id ||
|
||||
aAttribute == nsGkAtoms::_class)) ||
|
||||
aAttribute == nsGkAtoms::lang ||
|
||||
StyleSet()->MightHaveAttributeDependency(aAttribute))) {
|
||||
return;
|
||||
}
|
||||
|
||||
ServoElementSnapshot& snapshot = SnapshotFor(aElement);
|
||||
snapshot.AddAttrs(aElement, aNameSpaceID, aAttribute);
|
||||
|
||||
if (AttributeInfluencesOtherPseudoClassState(aElement, aAttribute)) {
|
||||
if (influencesOtherPseudoClassState) {
|
||||
snapshot.AddOtherPseudoClassState(aElement);
|
||||
}
|
||||
|
||||
|
@ -833,7 +845,6 @@ ServoRestyleManager::AttributeChanged(Element* aElement, int32_t aNameSpaceID,
|
|||
const nsAttrValue* aOldValue)
|
||||
{
|
||||
MOZ_ASSERT(!mInStyleRefresh);
|
||||
MOZ_ASSERT(!mSnapshots.Get(aElement) || mSnapshots.Get(aElement)->HasAttrs());
|
||||
|
||||
nsIFrame* primaryFrame = aElement->GetPrimaryFrame();
|
||||
if (primaryFrame) {
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<!doctype html>
|
||||
<div id="container" ng-cloak>
|
||||
Should show up
|
||||
</div>
|
|
@ -0,0 +1,20 @@
|
|||
<!doctype html>
|
||||
<div id="container" ng-cloak>
|
||||
Should show up
|
||||
</div>
|
||||
<style>
|
||||
[ng-cloak] {
|
||||
display:none !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
document.body.offsetTop;
|
||||
</script>
|
||||
<style>
|
||||
.ng-foo {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
container.removeAttribute("ng-cloak");
|
||||
</script>
|
|
@ -2006,6 +2006,7 @@ fails-if(styloVsGecko) == 1322512-1.html 1322512-1-ref.html
|
|||
== 1364360-1.html 1364360-1-ref.html
|
||||
== 1365159-1.html 1365159-1-ref.html
|
||||
fails-if(!stylo||styloVsGecko) == 1365162-1.html 1365162-1-ref.html
|
||||
== 1352306-1.html 1352306-1-ref.html
|
||||
== 1366144.html 1366144-ref.html
|
||||
== 1367592-1.html 1367592-1-ref.html
|
||||
== 1368113-1.html 1368113-1-ref.html
|
||||
|
|
|
@ -96,6 +96,9 @@ SERVO_BINDING_FUNC(Servo_StyleSet_ResolveForDeclarations,
|
|||
RawServoStyleSetBorrowed set,
|
||||
ServoComputedValuesBorrowedOrNull parent_style,
|
||||
RawServoDeclarationBlockBorrowed declarations)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_MightHaveAttributeDependency, bool,
|
||||
RawServoStyleSetBorrowed set,
|
||||
nsIAtom* local_name)
|
||||
|
||||
// CSSRuleList
|
||||
SERVO_BINDING_FUNC(Servo_CssRules_ListTypes, void,
|
||||
|
|
|
@ -1356,4 +1356,10 @@ ServoStyleSet::RunPostTraversalTasks()
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ServoStyleSet::MightHaveAttributeDependency(nsIAtom* aAttribute)
|
||||
{
|
||||
return Servo_StyleSet_MightHaveAttributeDependency(mRawSet.get(), aAttribute);
|
||||
}
|
||||
|
||||
ServoStyleSet* ServoStyleSet::sInServoTraversal = nullptr;
|
||||
|
|
|
@ -432,6 +432,16 @@ public:
|
|||
mNeedsRestyleAfterEnsureUniqueInner = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a modification to an an attribute with the specified
|
||||
* local name might require us to restyle the element.
|
||||
*
|
||||
* This function allows us to skip taking a an attribute snapshot when
|
||||
* the modified attribute doesn't appear in an attribute selector in
|
||||
* a style sheet.
|
||||
*/
|
||||
bool MightHaveAttributeDependency(nsIAtom* aAttribute);
|
||||
|
||||
private:
|
||||
// On construction, sets sInServoTraversal to the given ServoStyleSet.
|
||||
// On destruction, clears sInServoTraversal and calls RunPostTraversalTasks.
|
||||
|
|
Загрузка…
Ссылка в новой задаче