HTML5 <details> and <summary>: rendering
authorluiz@webkit.org <luiz@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Mar 2011 17:35:17 +0000 (17:35 +0000)
committerluiz@webkit.org <luiz@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Mar 2011 17:35:17 +0000 (17:35 +0000)
commit9449702d4f5f0cc8ac22fdaa3db54f3f4647b734
tree5cb7daca0d64fa378a3b9690f7a92dbec10b5055
parentbce7cd43d45513dbb1265b87cd16aedea60a6dd8
HTML5 <details> and <summary>: rendering
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: https://svn.webkit.org/repository/webkit/trunk@81035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
107 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/html/details-add-summary-1-and-click.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-1.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-10-and-click.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-10.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-2-and-click.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-2.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-3-and-click.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-3.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-4-and-click.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-4.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-5-and-click.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-5.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-6-and-click.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-6.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-7-and-click.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-7.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-8-and-click.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-8.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-9-and-click.html [new file with mode: 0644]
LayoutTests/fast/html/details-add-summary-9.html [new file with mode: 0644]
LayoutTests/fast/html/details-element-render-inline-crash-expected.txt
LayoutTests/fast/html/details-mouse-click-expected.txt [new file with mode: 0644]
LayoutTests/fast/html/details-mouse-click.html [new file with mode: 0644]
LayoutTests/fast/html/details-no-summary1.html [new file with mode: 0644]
LayoutTests/fast/html/details-no-summary2.html [new file with mode: 0644]
LayoutTests/fast/html/details-no-summary3.html [new file with mode: 0644]
LayoutTests/fast/html/details-no-summary4.html [new file with mode: 0644]
LayoutTests/fast/html/details-open-javascript.html [new file with mode: 0644]
LayoutTests/fast/html/details-open1.html [new file with mode: 0644]
LayoutTests/fast/html/details-open2.html [new file with mode: 0644]
LayoutTests/fast/html/details-open3.html [new file with mode: 0644]
LayoutTests/fast/html/details-open4.html [new file with mode: 0644]
LayoutTests/fast/html/details-open5.html [new file with mode: 0644]
LayoutTests/fast/html/details-open6.html [new file with mode: 0644]
LayoutTests/fast/html/details-position.html [new file with mode: 0644]
LayoutTests/fast/html/details-remove-summary-1-and-click.html [new file with mode: 0644]
LayoutTests/fast/html/details-remove-summary-1.html [new file with mode: 0644]
LayoutTests/fast/html/details-remove-summary-2-and-click.html [new file with mode: 0644]
LayoutTests/fast/html/details-remove-summary-2.html [new file with mode: 0644]
LayoutTests/fast/html/details-remove-summary-3-and-click.html [new file with mode: 0644]
LayoutTests/fast/html/details-remove-summary-3.html [new file with mode: 0644]
LayoutTests/fast/html/details-remove-summary-4-and-click.html [new file with mode: 0644]
LayoutTests/fast/html/details-remove-summary-4.html [new file with mode: 0644]
LayoutTests/fast/html/details-remove-summary-5-and-click.html [new file with mode: 0644]
LayoutTests/fast/html/details-remove-summary-5.html [new file with mode: 0644]
LayoutTests/fast/html/details-remove-summary-6-and-click.html [new file with mode: 0644]
LayoutTests/fast/html/details-remove-summary-6.html [new file with mode: 0644]
LayoutTests/fast/html/details-writing-mode.html [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-1-and-click-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-1-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-10-and-click-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-10-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-2-and-click-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-2-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-3-and-click-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-3-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-4-and-click-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-4-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-5-and-click-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-5-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-6-and-click-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-6-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-7-and-click-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-7-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-8-and-click-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-8-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-9-and-click-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-add-summary-9-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-no-summary1-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-no-summary2-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-no-summary3-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-no-summary4-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-open-javascript-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-open1-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-open2-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-open3-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-open4-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-open5-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-open6-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-position-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-remove-summary-1-and-click-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-remove-summary-1-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-remove-summary-2-and-click-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-remove-summary-2-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-remove-summary-3-and-click-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-remove-summary-3-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-remove-summary-4-and-click-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-remove-summary-4-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-remove-summary-5-and-click-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-remove-summary-5-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-remove-summary-6-and-click-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-remove-summary-6-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/html/details-writing-mode-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/multicol/span/clone-anonymous-block-non-inline-child-crash-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLDetailsElement.cpp
Source/WebCore/html/HTMLDetailsElement.h
Source/WebCore/html/HTMLSummaryElement.cpp
Source/WebCore/html/HTMLSummaryElement.h
Source/WebCore/rendering/RenderDetails.cpp
Source/WebCore/rendering/RenderDetails.h
Source/WebCore/rendering/RenderDetailsMarker.cpp
Source/WebCore/rendering/RenderDetailsMarker.h
Source/WebCore/rendering/RenderSummary.cpp
Source/WebCore/rendering/RenderSummary.h
Source/WebCore/rendering/RenderTreeAsText.cpp