Title: [161208] trunk/Source/WebCore
Revision
161208
Author
an...@apple.com
Date
2014-01-02 07:51:59 -0800 (Thu, 02 Jan 2014)

Log Message

Always resolve style from root
https://bugs.webkit.org/show_bug.cgi?id=126380

Reviewed by Andreas Kling.
        
Forced style resolve that does not start from the root is never really correct. 
Remove the few remaining instances.

* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::setResetStyleInheritance):
        
    Update style asynchronously.

* dom/ShadowRoot.h:
* dom/Text.h:
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::createElementRenderer):
(WebCore::HTMLPlugInImageElement::documentWillSuspendForPageCache):
(WebCore::HTMLPlugInImageElement::documentDidResumeFromPageCache):
        
    Delete the render tree synchronously on suspend and rebuild it asynchronously on resume.
    No need for m_customStyleForPageCache hack.

* html/HTMLPlugInImageElement.h:
        
    Remove m_customStyleForPageCache.

* style/StyleResolveTree.cpp:
* style/StyleResolveTree.h:
        
    Remove Element version of resolveTree from the interface.

* svg/SVGUseElement.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (161207 => 161208)


--- trunk/Source/WebCore/ChangeLog	2014-01-02 15:50:28 UTC (rev 161207)
+++ trunk/Source/WebCore/ChangeLog	2014-01-02 15:51:59 UTC (rev 161208)
@@ -1,5 +1,41 @@
 2014-01-02  Antti Koivisto  <an...@apple.com>
 
+        Always resolve style from root
+        https://bugs.webkit.org/show_bug.cgi?id=126380
+
+        Reviewed by Andreas Kling.
+        
+        Forced style resolve that does not start from the root is never really correct. 
+        Remove the few remaining instances.
+
+        * dom/ShadowRoot.cpp:
+        (WebCore::ShadowRoot::setResetStyleInheritance):
+        
+            Update style asynchronously.
+
+        * dom/ShadowRoot.h:
+        * dom/Text.h:
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::HTMLPlugInImageElement::createElementRenderer):
+        (WebCore::HTMLPlugInImageElement::documentWillSuspendForPageCache):
+        (WebCore::HTMLPlugInImageElement::documentDidResumeFromPageCache):
+        
+            Delete the render tree synchronously on suspend and rebuild it asynchronously on resume.
+            No need for m_customStyleForPageCache hack.
+
+        * html/HTMLPlugInImageElement.h:
+        
+            Remove m_customStyleForPageCache.
+
+        * style/StyleResolveTree.cpp:
+        * style/StyleResolveTree.h:
+        
+            Remove Element version of resolveTree from the interface.
+
+        * svg/SVGUseElement.h:
+
+2014-01-02  Antti Koivisto  <an...@apple.com>
+
         Remove PlaceholderDocument
         https://bugs.webkit.org/show_bug.cgi?id=126382
 

Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (161207 => 161208)


--- trunk/Source/WebCore/dom/ShadowRoot.cpp	2014-01-02 15:50:28 UTC (rev 161207)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp	2014-01-02 15:51:59 UTC (rev 161208)
@@ -140,8 +140,8 @@
 
     if (value != m_resetStyleInheritance) {
         m_resetStyleInheritance = value;
-        if (renderer() && hostElement())
-            Style::resolveTree(*hostElement(), Style::Force);
+        if (hostElement())
+            setNeedsStyleRecalc();
     }
 }
 

Modified: trunk/Source/WebCore/dom/ShadowRoot.h (161207 => 161208)


--- trunk/Source/WebCore/dom/ShadowRoot.h	2014-01-02 15:50:28 UTC (rev 161207)
+++ trunk/Source/WebCore/dom/ShadowRoot.h	2014-01-02 15:51:59 UTC (rev 161208)
@@ -33,7 +33,6 @@
 #include "DocumentFragment.h"
 #include "Element.h"
 #include "ExceptionCode.h"
-#include "StyleResolveTree.h"
 #include "TreeScope.h"
 
 namespace WebCore {

Modified: trunk/Source/WebCore/dom/Text.h (161207 => 161208)


--- trunk/Source/WebCore/dom/Text.h	2014-01-02 15:50:28 UTC (rev 161207)
+++ trunk/Source/WebCore/dom/Text.h	2014-01-02 15:51:59 UTC (rev 161208)
@@ -25,7 +25,6 @@
 
 #include "CharacterData.h"
 #include "RenderPtr.h"
-#include "StyleResolveTree.h"
 
 namespace WebCore {
 

Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (161207 => 161208)


--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2014-01-02 15:50:28 UTC (rev 161207)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2014-01-02 15:51:59 UTC (rev 161208)
@@ -198,6 +198,8 @@
 
 RenderPtr<RenderElement> HTMLPlugInImageElement::createElementRenderer(PassRef<RenderStyle> style)
 {
+    ASSERT(!document().inPageCache());
+
     if (displayState() >= PreparingPluginReplacement)
         return HTMLPlugInElement::createElementRenderer(std::move(style));
 
@@ -309,32 +311,19 @@
 
 void HTMLPlugInImageElement::documentWillSuspendForPageCache()
 {
-    if (RenderStyle* renderStyle = this->renderStyle()) {
-        m_customStyleForPageCache = RenderStyle::clone(renderStyle);
-        m_customStyleForPageCache->setDisplay(NONE);
-        Style::resolveTree(*this, Style::Force);
-    }
+    if (renderer())
+        Style::detachRenderTree(*this);
 
     HTMLPlugInElement::documentWillSuspendForPageCache();
 }
 
 void HTMLPlugInImageElement::documentDidResumeFromPageCache()
 {
-    if (m_customStyleForPageCache) {
-        m_customStyleForPageCache = 0;
-        Style::resolveTree(*this, Style::Force);
-    }
+    setNeedsStyleRecalc(ReconstructRenderTree);
 
     HTMLPlugInElement::documentDidResumeFromPageCache();
 }
 
-PassRefPtr<RenderStyle> HTMLPlugInImageElement::customStyleForRenderer()
-{
-    if (!m_customStyleForPageCache)
-        return document().ensureStyleResolver().styleForElement(this);
-    return m_customStyleForPageCache;
-}
-
 void HTMLPlugInImageElement::updateWidgetCallback(Node& node, unsigned)
 {
     toHTMLPlugInImageElement(node).updateWidgetIfNecessary();

Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.h (161207 => 161208)


--- trunk/Source/WebCore/html/HTMLPlugInImageElement.h	2014-01-02 15:50:28 UTC (rev 161207)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.h	2014-01-02 15:51:59 UTC (rev 161208)
@@ -127,8 +127,6 @@
     virtual void documentWillSuspendForPageCache() OVERRIDE;
     virtual void documentDidResumeFromPageCache() OVERRIDE;
 
-    virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE;
-
     virtual bool isRestartedPlugin() const OVERRIDE { return m_isRestartedPlugin; }
     virtual bool requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues) OVERRIDE;
 
@@ -158,7 +156,6 @@
     bool m_needsWidgetUpdate;
     bool m_shouldPreferPlugInsForImages;
     bool m_needsDocumentActivationCallbacks;
-    RefPtr<RenderStyle> m_customStyleForPageCache;
     RefPtr<MouseEvent> m_pendingClickEventFromSnapshot;
     DeferrableOneShotTimer<HTMLPlugInImageElement> m_simulatedMouseClickTimer;
     Timer<HTMLPlugInImageElement> m_removeSnapshotTimer;

Modified: trunk/Source/WebCore/style/StyleResolveTree.cpp (161207 => 161208)


--- trunk/Source/WebCore/style/StyleResolveTree.cpp	2014-01-02 15:50:28 UTC (rev 161207)
+++ trunk/Source/WebCore/style/StyleResolveTree.cpp	2014-01-02 15:51:59 UTC (rev 161208)
@@ -64,6 +64,7 @@
 static void attachRenderTree(Element&, PassRefPtr<RenderStyle>);
 static void attachTextRenderer(Text&);
 static void detachRenderTree(Element&, DetachType);
+static void resolveTree(Element&, Change);
 
 Change determineChange(const RenderStyle* s1, const RenderStyle* s2, Settings* settings)
 {

Modified: trunk/Source/WebCore/style/StyleResolveTree.h (161207 => 161208)


--- trunk/Source/WebCore/style/StyleResolveTree.h	2014-01-02 15:50:28 UTC (rev 161207)
+++ trunk/Source/WebCore/style/StyleResolveTree.h	2014-01-02 15:51:59 UTC (rev 161208)
@@ -38,12 +38,11 @@
 
 enum Change { NoChange, NoInherit, Inherit, Detach, Force };
 
-void resolveTree(Element&, Change);
 void resolveTree(Document&, Change);
 
 void detachRenderTree(Element&);
-
 void detachTextRenderer(Text&);
+
 void updateTextRendererAfterContentChange(Text&, unsigned offsetOfReplacedData, unsigned lengthOfReplacedData);
 
 Change determineChange(const RenderStyle*, const RenderStyle*, Settings*);

Modified: trunk/Source/WebCore/svg/SVGUseElement.h (161207 => 161208)


--- trunk/Source/WebCore/svg/SVGUseElement.h	2014-01-02 15:50:28 UTC (rev 161207)
+++ trunk/Source/WebCore/svg/SVGUseElement.h	2014-01-02 15:51:59 UTC (rev 161208)
@@ -30,7 +30,6 @@
 #include "SVGGraphicsElement.h"
 #include "SVGNames.h"
 #include "SVGURIReference.h"
-#include "StyleResolveTree.h"
 
 namespace WebCore {
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to