Changeset 161208 in webkit


Ignore:
Timestamp:
Jan 2, 2014 7:51:59 AM (10 years ago)
Author:
Antti Koivisto
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:
Location:
trunk/Source/WebCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r161207 r161208  
     12014-01-02  Antti Koivisto  <antti@apple.com>
     2
     3        Always resolve style from root
     4        https://bugs.webkit.org/show_bug.cgi?id=126380
     5
     6        Reviewed by Andreas Kling.
     7       
     8        Forced style resolve that does not start from the root is never really correct.
     9        Remove the few remaining instances.
     10
     11        * dom/ShadowRoot.cpp:
     12        (WebCore::ShadowRoot::setResetStyleInheritance):
     13       
     14            Update style asynchronously.
     15
     16        * dom/ShadowRoot.h:
     17        * dom/Text.h:
     18        * html/HTMLPlugInImageElement.cpp:
     19        (WebCore::HTMLPlugInImageElement::createElementRenderer):
     20        (WebCore::HTMLPlugInImageElement::documentWillSuspendForPageCache):
     21        (WebCore::HTMLPlugInImageElement::documentDidResumeFromPageCache):
     22       
     23            Delete the render tree synchronously on suspend and rebuild it asynchronously on resume.
     24            No need for m_customStyleForPageCache hack.
     25
     26        * html/HTMLPlugInImageElement.h:
     27       
     28            Remove m_customStyleForPageCache.
     29
     30        * style/StyleResolveTree.cpp:
     31        * style/StyleResolveTree.h:
     32       
     33            Remove Element version of resolveTree from the interface.
     34
     35        * svg/SVGUseElement.h:
     36
    1372014-01-02  Antti Koivisto  <antti@apple.com>
    238
  • trunk/Source/WebCore/dom/ShadowRoot.cpp

    r161127 r161208  
    141141    if (value != m_resetStyleInheritance) {
    142142        m_resetStyleInheritance = value;
    143         if (renderer() && hostElement())
    144             Style::resolveTree(*hostElement(), Style::Force);
     143        if (hostElement())
     144            setNeedsStyleRecalc();
    145145    }
    146146}
  • trunk/Source/WebCore/dom/ShadowRoot.h

    r159036 r161208  
    3434#include "Element.h"
    3535#include "ExceptionCode.h"
    36 #include "StyleResolveTree.h"
    3736#include "TreeScope.h"
    3837
  • trunk/Source/WebCore/dom/Text.h

    r161143 r161208  
    2626#include "CharacterData.h"
    2727#include "RenderPtr.h"
    28 #include "StyleResolveTree.h"
    2928
    3029namespace WebCore {
  • trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp

    r161195 r161208  
    199199RenderPtr<RenderElement> HTMLPlugInImageElement::createElementRenderer(PassRef<RenderStyle> style)
    200200{
     201    ASSERT(!document().inPageCache());
     202
    201203    if (displayState() >= PreparingPluginReplacement)
    202204        return HTMLPlugInElement::createElementRenderer(std::move(style));
     
    310312void HTMLPlugInImageElement::documentWillSuspendForPageCache()
    311313{
    312     if (RenderStyle* renderStyle = this->renderStyle()) {
    313         m_customStyleForPageCache = RenderStyle::clone(renderStyle);
    314         m_customStyleForPageCache->setDisplay(NONE);
    315         Style::resolveTree(*this, Style::Force);
    316     }
     314    if (renderer())
     315        Style::detachRenderTree(*this);
    317316
    318317    HTMLPlugInElement::documentWillSuspendForPageCache();
     
    321320void HTMLPlugInImageElement::documentDidResumeFromPageCache()
    322321{
    323     if (m_customStyleForPageCache) {
    324         m_customStyleForPageCache = 0;
    325         Style::resolveTree(*this, Style::Force);
    326     }
     322    setNeedsStyleRecalc(ReconstructRenderTree);
    327323
    328324    HTMLPlugInElement::documentDidResumeFromPageCache();
    329 }
    330 
    331 PassRefPtr<RenderStyle> HTMLPlugInImageElement::customStyleForRenderer()
    332 {
    333     if (!m_customStyleForPageCache)
    334         return document().ensureStyleResolver().styleForElement(this);
    335     return m_customStyleForPageCache;
    336325}
    337326
  • trunk/Source/WebCore/html/HTMLPlugInImageElement.h

    r161181 r161208  
    128128    virtual void documentDidResumeFromPageCache() OVERRIDE;
    129129
    130     virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE;
    131 
    132130    virtual bool isRestartedPlugin() const OVERRIDE { return m_isRestartedPlugin; }
    133131    virtual bool requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues) OVERRIDE;
     
    159157    bool m_shouldPreferPlugInsForImages;
    160158    bool m_needsDocumentActivationCallbacks;
    161     RefPtr<RenderStyle> m_customStyleForPageCache;
    162159    RefPtr<MouseEvent> m_pendingClickEventFromSnapshot;
    163160    DeferrableOneShotTimer<HTMLPlugInImageElement> m_simulatedMouseClickTimer;
  • trunk/Source/WebCore/style/StyleResolveTree.cpp

    r161205 r161208  
    6565static void attachTextRenderer(Text&);
    6666static void detachRenderTree(Element&, DetachType);
     67static void resolveTree(Element&, Change);
    6768
    6869Change determineChange(const RenderStyle* s1, const RenderStyle* s2, Settings* settings)
  • trunk/Source/WebCore/style/StyleResolveTree.h

    r161205 r161208  
    3939enum Change { NoChange, NoInherit, Inherit, Detach, Force };
    4040
    41 void resolveTree(Element&, Change);
    4241void resolveTree(Document&, Change);
    4342
    4443void detachRenderTree(Element&);
     44void detachTextRenderer(Text&);
    4545
    46 void detachTextRenderer(Text&);
    4746void updateTextRendererAfterContentChange(Text&, unsigned offsetOfReplacedData, unsigned lengthOfReplacedData);
    4847
  • trunk/Source/WebCore/svg/SVGUseElement.h

    r161181 r161208  
    3131#include "SVGNames.h"
    3232#include "SVGURIReference.h"
    33 #include "StyleResolveTree.h"
    3433
    3534namespace WebCore {
Note: See TracChangeset for help on using the changeset viewer.