summaryrefslogtreecommitdiffstats
path: root/WebCore/dom
diff options
context:
space:
mode:
authorCary Clark <cary@android.com>2010-11-10 10:26:31 -0500
committerCary Clark <cary@android.com>2010-11-10 10:59:21 -0500
commit67f5008b55a0b63876a1b9c6d83866ab205b05f9 (patch)
tree8116703157b8c67775dc0bb3ac03f2476b3e4ce6 /WebCore/dom
parent0365fb946423581e27fa71021dd0e5c422378f60 (diff)
downloadexternal_webkit-67f5008b55a0b63876a1b9c6d83866ab205b05f9.zip
external_webkit-67f5008b55a0b63876a1b9c6d83866ab205b05f9.tar.gz
external_webkit-67f5008b55a0b63876a1b9c6d83866ab205b05f9.tar.bz2
Ratchet back style changes that rebuild nav caches
Many style changes do not visibly affect the way links are detected -- so limit the rebuild to style changes that either move the size the style, or changes that edit the style's display property. Styles appearing or disappearing (i.e., one is 0) is not treated as a style version change since these events accompany dom edits which are detected outside of this change. bug:3181683 Change-Id: Ie62ef524a956fcd9298ce5878b632645a22e461a
Diffstat (limited to 'WebCore/dom')
-rw-r--r--WebCore/dom/Element.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index a86f30a..be74487 100644
--- a/WebCore/dom/Element.cpp
+++ b/WebCore/dom/Element.cpp
@@ -947,6 +947,17 @@ bool Element::pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderS
return false;
}
+#ifdef ANDROID_STYLE_VERSION
+static bool displayDiff(const RenderStyle* s1, const RenderStyle* s2)
+{
+ if (!s1 || !s2)
+ return false;
+ return s1->display() != s2->display()
+ || s1->left() != s2->left() || s1->top() != s2->top()
+ || s1->right() != s2->right() || s1->bottom() != s2->bottom();
+}
+#endif
+
void Element::recalcStyle(StyleChange change)
{
// Ref currentStyle in case it would otherwise be deleted when setRenderStyle() is called.
@@ -962,7 +973,9 @@ void Element::recalcStyle(StyleChange change)
if ((change > NoChange || needsStyleRecalc())) {
#ifdef ANDROID_STYLE_VERSION
- document()->incStyleVersion();
+ RefPtr<RenderStyle> newStyle = document()->styleSelector()->styleForElement(this);
+ if (displayDiff(currentStyle.get(), newStyle.get()))
+ document()->incStyleVersion();
#endif
if (hasRareData())
rareData()->resetComputedStyle();