Changeset 161195 in webkit


Ignore:
Timestamp:
Jan 1, 2014, 1:20:51 PM (11 years ago)
Author:
Antti Koivisto
Message:

Do less synchronous render tree construction
https://bugs.webkit.org/show_bug.cgi?id=126359

Source/WebCore:

Reviewed by Anders Carlsson.

Remove some now-unnecessary attachRenderTree calls.

  • html/HTMLDetailsElement.cpp:

(WebCore::HTMLDetailsElement::parseAttribute):

  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::parseAttribute):

  • html/HTMLObjectElement.cpp:

(WebCore::HTMLObjectElement::renderFallbackContent):

  • html/HTMLPlugInElement.cpp:

(WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot):

  • html/HTMLPlugInImageElement.cpp:

(WebCore::HTMLPlugInImageElement::willRecalcStyle):
(WebCore::HTMLPlugInImageElement::createShadowIFrameSubtree):
(WebCore::HTMLPlugInImageElement::restartSnapshottedPlugIn):

  • html/HTMLViewSourceDocument.cpp:

(WebCore::HTMLViewSourceDocument::createContainingTable):
(WebCore::HTMLViewSourceDocument::addSpanWithClassName):
(WebCore::HTMLViewSourceDocument::addLine):
(WebCore::HTMLViewSourceDocument::finishLine):
(WebCore::HTMLViewSourceDocument::addBase):
(WebCore::HTMLViewSourceDocument::addLink):

  • xml/XMLErrors.cpp:

(WebCore::XMLErrors::insertErrorMessageBlock):

LayoutTests:

  • fast/html/object-image-nested-fallback.html: Update test to work with asynchronous load failures.
  • fast/overflow/overflow-height-float-not-removed-crash3-expected.txt: Whitespace change.
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r161193 r161195  
     12014-01-01  Antti Koivisto  <antti@apple.com>
     2
     3        Do less synchronous render tree construction
     4        https://bugs.webkit.org/show_bug.cgi?id=126359
     5
     6        * fast/html/object-image-nested-fallback.html: Update test to work with asynchronous load failures.
     7        * fast/overflow/overflow-height-float-not-removed-crash3-expected.txt: Whitespace change.
     8
    192014-01-01  Zan Dobersek  <zdobersek@igalia.com>
    210
  • trunk/LayoutTests/fast/html/object-image-nested-fallback.html

    r121012 r161195  
    11<html>
    22    <script>
    3         if (window.testRunner)
     3        if (window.testRunner) {
    44            testRunner.dumpAsText();
     5            testRunner.waitUntilDone();
     6        }
     7        function done() {
     8            if (testRunner)
     9                testRunner.notifyDone();
     10        }
    511    </script>
    6     <body> 
     12    <body>
    713        <object type="image/png" data="this.object.does.not.exist.dtd">
    814            <object type="image/png" data="this.object.does.not.exist.dtd">
    9                 <object type="image/png" data="this.object.does.not.exist.dtd">PASS when no crash occurs.</object>
     15                <object type="image/png" data="this.object.does.not.exist.dtd" onerror="done()">PASS when no crash occurs.</object>
    1016            </object>
    1117        </object>
  • trunk/LayoutTests/fast/overflow/overflow-height-float-not-removed-crash3-expected.txt

    r79462 r161195  
    11Test passes if it does not crash.
    22 sometextsometextsometextsometextsometextsometext
    3 
     3 
  • trunk/Source/WebCore/ChangeLog

    r161194 r161195  
     12014-01-01  Antti Koivisto  <antti@apple.com>
     2
     3        Do less synchronous render tree construction
     4        https://bugs.webkit.org/show_bug.cgi?id=126359
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Remove some now-unnecessary attachRenderTree calls.
     9
     10        * html/HTMLDetailsElement.cpp:
     11        (WebCore::HTMLDetailsElement::parseAttribute):
     12        * html/HTMLInputElement.cpp:
     13        (WebCore::HTMLInputElement::parseAttribute):
     14        * html/HTMLObjectElement.cpp:
     15        (WebCore::HTMLObjectElement::renderFallbackContent):
     16        * html/HTMLPlugInElement.cpp:
     17        (WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot):
     18        * html/HTMLPlugInImageElement.cpp:
     19        (WebCore::HTMLPlugInImageElement::willRecalcStyle):
     20        (WebCore::HTMLPlugInImageElement::createShadowIFrameSubtree):
     21        (WebCore::HTMLPlugInImageElement::restartSnapshottedPlugIn):
     22        * html/HTMLViewSourceDocument.cpp:
     23        (WebCore::HTMLViewSourceDocument::createContainingTable):
     24        (WebCore::HTMLViewSourceDocument::addSpanWithClassName):
     25        (WebCore::HTMLViewSourceDocument::addLine):
     26        (WebCore::HTMLViewSourceDocument::finishLine):
     27        (WebCore::HTMLViewSourceDocument::addBase):
     28        (WebCore::HTMLViewSourceDocument::addLink):
     29        * xml/XMLErrors.cpp:
     30        (WebCore::XMLErrors::insertErrorMessageBlock):
     31
    1322014-01-01  Simon Fraser  <simon.fraser@apple.com>
    233
  • trunk/Source/WebCore/html/HTMLDetailsElement.cpp

    r161181 r161195  
    137137        bool oldValue = m_isOpen;
    138138        m_isOpen = !value.isNull();
    139         if (oldValue != m_isOpen && renderer())
    140             Style::reattachRenderTree(*this);
     139        if (oldValue != m_isOpen)
     140            setNeedsStyleRecalc(ReconstructRenderTree);
    141141    } else
    142142        HTMLElement::parseAttribute(name, value);
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r161181 r161195  
    683683        int oldResults = m_maxResults;
    684684        m_maxResults = !value.isNull() ? std::min(value.toInt(), maxSavedResults) : -1;
    685         // FIXME: Detaching just for maxResults change is not ideal.  We should figure out the right
    686         // time to relayout for this change.
    687         if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0) && renderer())
    688             Style::reattachRenderTree(*this);
    689         setNeedsStyleRecalc();
     685
     686        if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0))
     687            setNeedsStyleRecalc(ReconstructRenderTree);
     688        else
     689            setNeedsStyleRecalc();
    690690        FeatureObserver::observe(&document(), FeatureObserver::ResultsAttribute);
    691691    } else if (name == autosaveAttr) {
     
    735735#if ENABLE(INPUT_SPEECH)
    736736    else if (name == webkitspeechAttr) {
    737         if (renderer()) {
    738             // This renderer and its children have quite different layouts and styles depending on
    739             // whether the speech button is visible or not. So we reset the whole thing and recreate
    740             // to get the right styles and layout.
    741             Style::detachRenderTree(*this);
    742             m_inputType->destroyShadowSubtree();
    743             m_inputType->createShadowSubtree();
    744             Style::attachRenderTree(*this);
    745         } else {
    746             m_inputType->destroyShadowSubtree();
    747             m_inputType->createShadowSubtree();
    748         }
     737        m_inputType->destroyShadowSubtree();
     738        m_inputType->createShadowSubtree();
     739
     740        // This renderer and its children have quite different layouts and styles depending on
     741        // whether the speech button is visible or not. So we reset the whole thing and recreate
     742        // to get the right styles and layout.
     743        setNeedsStyleRecalc(ReconstructRenderTree);
     744
    749745        setFormControlValueMatchesRenderer(false);
    750         setNeedsStyleRecalc();
    751746        FeatureObserver::observe(&document(), FeatureObserver::PrefixedSpeechAttribute);
    752747    } else if (name == onwebkitspeechchangeAttr)
  • trunk/Source/WebCore/html/HTMLObjectElement.cpp

    r160908 r161195  
    374374        return;
    375375
     376    setNeedsStyleRecalc(ReconstructRenderTree);
     377
    376378    // Before we give up and use fallback content, check to see if this is a MIME type issue.
    377379    if (m_imageLoader && m_imageLoader->image() && m_imageLoader->image()->status() != CachedResource::LoadError) {
     
    380382            // If we don't think we have an image type anymore, then clear the image from the loader.
    381383            m_imageLoader->setImage(0);
    382             Style::reattachRenderTree(*this);
    383384            return;
    384385        }
     
    386387
    387388    m_useFallbackContent = true;
    388 
    389     // FIXME: Style gets recalculated which is suboptimal.
    390     Style::reattachRenderTree(*this);
    391389}
    392390
  • trunk/Source/WebCore/html/HTMLPlugInElement.cpp

    r161181 r161195  
    310310    if (m_pluginReplacement->installReplacement(root)) {
    311311        setDisplayState(DisplayingPluginReplacement);
    312         Style::reattachRenderTree(*this);
     312        setNeedsStyleRecalc(ReconstructRenderTree);
    313313    }
    314314}
  • trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp

    r161181 r161195  
    239239bool HTMLPlugInImageElement::willRecalcStyle(Style::Change)
    240240{
    241     // FIXME: Why is this necessary?  Manual re-attach is almost always wrong.
     241    // FIXME: There shoudn't be need to force render tree reconstruction here.
     242    // It is only done because loading and load event dispatching is tied to render tree construction.
    242243    if (!useFallbackContent() && needsWidgetUpdate() && renderer() && !isImageType() && (displayState() != DisplayingSnapshot))
    243         Style::reattachRenderTree(*this);
     244        setNeedsStyleRecalc(ReconstructRenderTree);
    244245    return true;
    245246}
     
    464465    iframeElement->setAttribute(HTMLNames::scrollingAttr, AtomicString("no", AtomicString::ConstructFromLiteral));
    465466    shadowElement->appendChild(iframeElement, ASSERT_NO_EXCEPTION);
    466 
    467     if (renderer())
    468         Style::reattachRenderTree(*this);
    469467}
    470468#endif
     
    573571
    574572    setDisplayState(Restarting);
    575     Style::reattachRenderTree(*this);
     573    setNeedsStyleRecalc(ReconstructRenderTree);
    576574}
    577575
  • trunk/Source/WebCore/html/HTMLViewSourceDocument.cpp

    r158650 r161195  
    8181    table->parserAppendChild(m_tbody);
    8282    m_current = m_tbody;
    83 
    84     Style::attachRenderTree(*html);
    8583}
    8684
     
    180178    span->setAttribute(classAttr, className);
    181179    m_current->parserAppendChild(span);
    182     Style::attachRenderTree(*span);
    183180    return span.release();
    184181}
     
    189186    RefPtr<HTMLTableRowElement> trow = HTMLTableRowElement::create(*this);
    190187    m_tbody->parserAppendChild(trow);
    191     Style::reattachRenderTree(*trow);
    192188
    193189    // Create a cell that will hold the line number (it is generated in the stylesheet using counters).
     
    195191    td->setAttribute(classAttr, "webkit-line-number");
    196192    trow->parserAppendChild(td);
    197     Style::attachRenderTree(*td);
    198193
    199194    // Create a second cell for the line contents
     
    201196    td->setAttribute(classAttr, "webkit-line-content");
    202197    trow->parserAppendChild(td);
    203     Style::attachRenderTree(*td);
    204198    m_current = m_td = td;
    205199
     
    207201    RefPtr<Text> lineNumberText = Text::create(*this, String::number(parser()->lineNumber() + 1) + " ");
    208202    td->addChild(lineNumberText);
    209     Style::attachRenderTree(lineNumberText.get());
    210203#endif
    211204
     
    223216        RefPtr<HTMLBRElement> br = HTMLBRElement::create(*this);
    224217        m_current->parserAppendChild(br);
    225         Style::attachRenderTree(*br);
    226218    }
    227219    m_current = m_tbody;
     
    279271    base->setAttribute(hrefAttr, href);
    280272    m_current->parserAppendChild(base);
    281     Style::attachRenderTree(*base);
    282273    return base.release();
    283274}
     
    299290    anchor->setAttribute(hrefAttr, url);
    300291    m_current->parserAppendChild(anchor);
    301     Style::attachRenderTree(*anchor);
    302292    return anchor.release();
    303293}
  • trunk/Source/WebCore/xml/XMLErrors.cpp

    r161127 r161195  
    141141        m_document->parserAppendChild(rootElement.get());
    142142
    143         if (m_document->hasLivingRenderTree())
    144             // In general, rootElement shouldn't be attached right now, but it will be if there is a style element
    145             // in the SVG content.
    146             Style::reattachRenderTree(*rootElement);
    147 
    148143        documentElement = body.get();
    149144    }
Note: See TracChangeset for help on using the changeset viewer.