<rdar://problem/9750062> REGRESSION: Button text missing in many iTunes Store pages
[WebKit-https.git] / Source / WebCore / dom / Element.cpp
index 94225cb6225663f610ac98fe4d71742816f9be84..79eea9edaa327db39b94a830454ece971d5ebbab 100644 (file)
@@ -1102,8 +1102,11 @@ void Element::recalcStyle(StyleChange change)
     bool hasIndirectAdjacentRules = currentStyle && currentStyle->childrenAffectedByForwardPositionalRules();
 
     if ((change > NoChange || needsStyleRecalc())) {
-        if (hasRareData())
-            rareData()->resetComputedStyle();
+        if (hasRareData()) {
+            ElementRareData* data = rareData();
+            data->resetComputedStyle();
+            data->m_styleAffectedByEmpty = false;
+        }
     }
     if (hasParentStyle && (change >= Inherit || needsStyleRecalc())) {
         RefPtr<RenderStyle> newStyle = styleForRenderer(NodeRenderingContext(this, 0));
@@ -1301,10 +1304,10 @@ bool Element::childTypeAllowed(NodeType type) const
 
 static void checkForEmptyStyleChange(Element* element, RenderStyle* style)
 {
-    if (!style)
+    if (!style && !element->styleAffectedByEmpty())
         return;
 
-    if (style->affectedByEmpty() && (!style->emptyState() || element->hasChildNodes()))
+    if (!style || (style->affectedByEmpty() && (!style->emptyState() || element->hasChildNodes())))
         element->setNeedsStyleRecalc();
 }
 
@@ -1750,6 +1753,17 @@ RenderStyle* Element::computedStyle(PseudoId pseudoElementSpecifier)
     return pseudoElementSpecifier ? data->m_computedStyle->getCachedPseudoStyle(pseudoElementSpecifier) : data->m_computedStyle.get();
 }
 
+void Element::setStyleAffectedByEmpty()
+{
+    ElementRareData* data = ensureRareData();
+    data->m_styleAffectedByEmpty = true;
+}
+
+bool Element::styleAffectedByEmpty() const
+{
+    return hasRareData() && rareData()->m_styleAffectedByEmpty;
+}
+
 AtomicString Element::computeInheritedLanguage() const
 {
     const Node* n = this;