Skip to content
  • luiz@webkit.org's avatar
    HTML5 <details> and <summary>: rendering · fb0b8be9
    luiz@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=51071
    
    Reviewed by Dave Hyatt.
    
    Source/WebCore:
    
    Tests: fast/html/details-add-summary-1-and-click.html
           fast/html/details-add-summary-1.html
           fast/html/details-add-summary-10-and-click.html
           fast/html/details-add-summary-10.html
           fast/html/details-add-summary-2-and-click.html
           fast/html/details-add-summary-2.html
           fast/html/details-add-summary-3-and-click.html
           fast/html/details-add-summary-3.html
           fast/html/details-add-summary-4-and-click.html
           fast/html/details-add-summary-4.html
           fast/html/details-add-summary-5-and-click.html
           fast/html/details-add-summary-5.html
           fast/html/details-add-summary-6-and-click.html
           fast/html/details-add-summary-6.html
           fast/html/details-add-summary-7-and-click.html
           fast/html/details-add-summary-7.html
           fast/html/details-add-summary-8-and-click.html
           fast/html/details-add-summary-8.html
           fast/html/details-add-summary-9-and-click.html
           fast/html/details-add-summary-9.html
           fast/html/details-mouse-click.html
           fast/html/details-no-summary1.html
           fast/html/details-no-summary2.html
           fast/html/details-no-summary3.html
           fast/html/details-no-summary4.html
           fast/html/details-open-javascript.html
           fast/html/details-open1.html
           fast/html/details-open2.html
           fast/html/details-open3.html
           fast/html/details-open4.html
           fast/html/details-open5.html
           fast/html/details-open6.html
           fast/html/details-position.html
           fast/html/details-remove-summary-1-and-click.html
           fast/html/details-remove-summary-1.html
           fast/html/details-remove-summary-2-and-click.html
           fast/html/details-remove-summary-2.html
           fast/html/details-remove-summary-3-and-click.html
           fast/html/details-remove-summary-3.html
           fast/html/details-remove-summary-4-and-click.html
           fast/html/details-remove-summary-4.html
           fast/html/details-remove-summary-5-and-click.html
           fast/html/details-remove-summary-5.html
           fast/html/details-remove-summary-6-and-click.html
           fast/html/details-remove-summary-6.html
           fast/html/details-writing-mode.html
    
    http://www.w3.org/TR/html5/interactive-elements.html#the-details-element
    
    The main <summary> element is the first <summary> element of a <details> element.
    All other childs of the <details> element are rendered only if the attribute 'open' is set.
    Click event toggles the 'open' attribute.
    
    * html/HTMLDetailsElement.cpp:
    (WebCore::HTMLDetailsElement::HTMLDetailsElement):
    (WebCore::HTMLDetailsElement::findMainSummary):
    (WebCore::HTMLDetailsElement::childrenChanged):
    (WebCore::HTMLDetailsElement::finishParsingChildren):
    (WebCore::HTMLDetailsElement::parseMappedAttribute):
    (WebCore::HTMLDetailsElement::childShouldCreateRenderer):
    (WebCore::HTMLDetailsElement::defaultEventHandler):
    * html/HTMLDetailsElement.h:
    (WebCore::HTMLDetailsElement::mainSummary):
    
    Method createRenderer added to class HTMLSummaryElement.
    
    * html/HTMLSummaryElement.cpp:
    (WebCore::HTMLSummaryElement::createRenderer):
    * html/HTMLSummaryElement.h:
    
    The first <summary> element is positioned at the top of its <details> parent.
    The area occupied by this main <summary> element is the interactive area of the
    <details> element. If the <details> tag has no <summary> child an OwnedSummaryRenderer
    is created and added to the corresponding RenderDetails object.
    
    * rendering/RenderDetails.cpp:
    (WebCore::RenderDetails::RenderDetails):
    (WebCore::RenderDetails::destroy):
    (WebCore::RenderDetails::summaryBlock):
    (WebCore::RenderDetails::contentBlock):
    (WebCore::RenderDetails::addChild):
    (WebCore::RenderDetails::removeChild):
    (WebCore::RenderDetails::setMarkerStyle):
    (WebCore::RenderDetails::styleDidChange):
    (WebCore::RenderDetails::getRenderPosition):
    (WebCore::RenderDetails::markerDestroyed):
    (WebCore::RenderDetails::summaryDestroyed):
    (WebCore::RenderDetails::moveSummaryToContents):
    (WebCore::RenderDetails::createSummaryStyle):
    (WebCore::RenderDetails::replaceMainSummary):
    (WebCore::RenderDetails::createDefaultSummary):
    (WebCore::RenderDetails::checkMainSummary):
    (WebCore::RenderDetails::layout):
    (WebCore::RenderDetails::isOpen):
    (WebCore::RenderDetails::getParentOfFirstLineBox):
    (WebCore::RenderDetails::firstNonMarkerChild):
    (WebCore::RenderDetails::updateMarkerLocation):
    * rendering/RenderDetails.h:
    (WebCore::RenderDetails::interactiveArea):
    (WebCore::RenderDetails::removeLeftoverAnonymousBlock):
    (WebCore::RenderDetails::createsAnonymousWrapper):
    (WebCore::RenderDetails::requiresForcedStyleRecalcPropagation):
    
    A marker is added to the main <summary> element to indicate the current value of the 'open'
    attribute of the <details> element.
    
    * rendering/RenderDetailsMarker.cpp:
    (WebCore::RenderDetailsMarker::RenderDetailsMarker):
    (WebCore::RenderDetailsMarker::destroy):
    (WebCore::RenderDetailsMarker::lineHeight):
    (WebCore::RenderDetailsMarker::baselinePosition):
    (WebCore::RenderDetailsMarker::computePreferredLogicalWidths):
    (WebCore::RenderDetailsMarker::layout):
    (WebCore::RenderDetailsMarker::getRelativeMarkerRect):
    (WebCore::RenderDetailsMarker::isOpen):
    (WebCore::createPath):
    (WebCore::createDownArrowPath):
    (WebCore::createUpArrowPath):
    (WebCore::createLeftArrowPath):
    (WebCore::createRightArrowPath):
    (WebCore::RenderDetailsMarker::orientation):
    (WebCore::RenderDetailsMarker::getCanonicalPath):
    (WebCore::RenderDetailsMarker::getPath):
    (WebCore::RenderDetailsMarker::paint):
    * rendering/RenderDetailsMarker.h:
    (WebCore::toRenderDetailsMarker):
    
    * rendering/RenderSummary.cpp:
    (WebCore::RenderSummary::RenderSummary):
    (WebCore::RenderSummary::destroy):
    (WebCore::RenderSummary::parentDetails):
    (WebCore::RenderSummary::styleDidChange):
    * rendering/RenderSummary.h:
    
    * rendering/RenderTreeAsText.cpp:
    (WebCore::RenderTreeAsText::writeRenderObject):
    
    LayoutTests:
    
    * fast/html/details-add-summary-1-and-click.html: Added.
    * fast/html/details-add-summary-1.html: Added.
    * fast/html/details-add-summary-10-and-click.html: Added.
    * fast/html/details-add-summary-10.html: Added.
    * fast/html/details-add-summary-2-and-click.html: Added.
    * fast/html/details-add-summary-2.html: Added.
    * fast/html/details-add-summary-3-and-click.html: Added.
    * fast/html/details-add-summary-3.html: Added.
    * fast/html/details-add-summary-4-and-click.html: Added.
    * fast/html/details-add-summary-4.html: Added.
    * fast/html/details-add-summary-5-and-click.html: Added.
    * fast/html/details-add-summary-5.html: Added.
    * fast/html/details-add-summary-6-and-click.html: Added.
    * fast/html/details-add-summary-6.html: Added.
    * fast/html/details-add-summary-7-and-click.html: Added.
    * fast/html/details-add-summary-7.html: Added.
    * fast/html/details-add-summary-8-and-click.html: Added.
    * fast/html/details-add-summary-8.html: Added.
    * fast/html/details-add-summary-9-and-click.html: Added.
    * fast/html/details-add-summary-9.html: Added.
    * fast/html/details-mouse-click-expected.txt: Added.
    * fast/html/details-mouse-click.html: Added.
    * fast/html/details-no-summary1.html: Added.
    * fast/html/details-no-summary2.html: Added.
    * fast/html/details-no-summary3.html: Added.
    * fast/html/details-no-summary4.html: Added.
    * fast/html/details-open-javascript.html: Added.
    * fast/html/details-open1.html: Added.
    * fast/html/details-open2.html: Added.
    * fast/html/details-open3.html: Added.
    * fast/html/details-open4.html: Added.
    * fast/html/details-open5.html: Added.
    * fast/html/details-open6.html: Added.
    * fast/html/details-position.html: Added.
    * fast/html/details-remove-summary-1-and-click.html: Added.
    * fast/html/details-remove-summary-1.html: Added.
    * fast/html/details-remove-summary-2-and-click.html: Added.
    * fast/html/details-remove-summary-2.html: Added.
    * fast/html/details-remove-summary-3-and-click.html: Added.
    * fast/html/details-remove-summary-3.html: Added.
    * fast/html/details-remove-summary-4-and-click.html: Added.
    * fast/html/details-remove-summary-4.html: Added.
    * fast/html/details-remove-summary-5-and-click.html: Added.
    * fast/html/details-remove-summary-5.html: Added.
    * fast/html/details-remove-summary-6-and-click.html: Added.
    * fast/html/details-remove-summary-6.html: Added.
    * fast/html/details-writing-mode.html: Added.
    * platform/qt/fast/html/details-add-summary-1-and-click-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-1-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-10-and-click-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-10-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-2-and-click-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-2-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-3-and-click-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-3-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-4-and-click-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-4-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-5-and-click-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-5-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-6-and-click-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-6-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-7-and-click-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-7-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-8-and-click-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-8-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-9-and-click-expected.txt: Added.
    * platform/qt/fast/html/details-add-summary-9-expected.txt: Added.
    * platform/qt/fast/html/details-no-summary1-expected.txt: Added.
    * platform/qt/fast/html/details-no-summary2-expected.txt: Added.
    * platform/qt/fast/html/details-no-summary3-expected.txt: Added.
    * platform/qt/fast/html/details-no-summary4-expected.txt: Added.
    * platform/qt/fast/html/details-open-javascript-expected.txt: Added.
    * platform/qt/fast/html/details-open1-expected.txt: Added.
    * platform/qt/fast/html/details-open2-expected.txt: Added.
    * platform/qt/fast/html/details-open3-expected.txt: Added.
    * platform/qt/fast/html/details-open4-expected.txt: Added.
    * platform/qt/fast/html/details-open5-expected.txt: Added.
    * platform/qt/fast/html/details-open6-expected.txt: Added.
    * platform/qt/fast/html/details-remove-summary-1-and-click-expected.txt: Added.
    * platform/qt/fast/html/details-remove-summary-1-expected.txt: Added.
    * platform/qt/fast/html/details-remove-summary-2-and-click-expected.txt: Added.
    * platform/qt/fast/html/details-remove-summary-2-expected.txt: Added.
    * platform/qt/fast/html/details-remove-summary-3-and-click-expected.txt: Added.
    * platform/qt/fast/html/details-remove-summary-3-expected.txt: Added.
    * platform/qt/fast/html/details-remove-summary-4-and-click-expected.txt: Added.
    * platform/qt/fast/html/details-remove-summary-4-expected.txt: Added.
    * platform/qt/fast/html/details-remove-summary-5-and-click-expected.txt: Added.
    * platform/qt/fast/html/details-remove-summary-5-expected.txt: Added.
    * platform/qt/fast/html/details-remove-summary-6-and-click-expected.txt: Added.
    * platform/qt/fast/html/details-remove-summary-6-expected.txt: Added.
    * platform/qt/fast/html/details-writing-mode-expected.txt: Added.
    * platform/qt/fast/multicol/span/clone-anonymous-block-non-inline-child-crash-expected.txt:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@81035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    fb0b8be9