Source/WebCore/ChangeLog

 12012-03-04 MORITA Hajime <morrita@google.com>
 2
 3 Internally used HTMLContentElement subclasses should have correct wrapper.
 4 https://bugs.webkit.org/show_bug.cgi?id=80237
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 DetailsContentElement and DetailsSummaryElement used to use
 9 <div> as their tag name. But this means they are wrapped by
 10 wrapper objects for HTMLDivElement, which is wrong. This happened
 11 to work though because HTMLDivElement has no extra state or API.
 12
 13 This change introduces "noConstructor" keyword for make_name.pl
 14 sources. This keyword allows a tag name to specify its own
 15 wrapper without making the tag name visible from the parser, or
 16 HTMLElementFactory in precise.
 17
 18 Following this addition, this change also adds a new tag name
 19 "webkitShadowContent" for DetailsContentElement and DetailsSummaryElement,
 20 which has no constructor, and whose wrapper type is HTMLElement.
 21
 22 This change isn't visible from the page author and only matters for testing.
 23
 24 Test: fast/dom/shadow/content-element-user-agent-shadow.html
 25
 26 * dom/make_names.pl:
 27 (defaultTagPropertyHash):
 28 (buildConstructorMap):
 29 (printConstructors):
 30 (printFunctionInits):
 31 * html/HTMLDetailsElement.cpp:
 32 (WebCore::DetailsContentElement::DetailsContentElement):
 33 (WebCore::DetailsSummaryElement::DetailsSummaryElement):
 34 * html/HTMLTagNames.in:
 35 * html/shadow/HTMLContentElement.cpp:
 36 (WebCore::contentTagName):
 37
1382012-03-04 Luke Macpherson <macpherson@chromium.org>
239
340 Remove unused macro HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE.

Source/WebCore/dom/make_names.pl

@@sub defaultTagPropertyHash
179179 return (
180180 'constructorNeedsCreatedByParser' => 0,
181181 'constructorNeedsFormElement' => 0,
 182 'noConstructor' => 0,
182183 'interfaceName' => defaultInterfaceName($_[0]),
183184 # By default, the JSInterfaceName is the same as the interfaceName.
184185 'JSInterfaceName' => defaultInterfaceName($_[0]),

@@sub buildConstructorMap
325326 my %tagConstructorMap = ();
326327 for my $tagName (keys %enabledTags) {
327328 my $interfaceName = $enabledTags{$tagName}{interfaceName};
328 
329329 if ($enabledTags{$tagName}{mapToTagName}) {
330330 die "Cannot handle multiple mapToTagName for $tagName\n" if $enabledTags{$enabledTags{$tagName}{mapToTagName}}{mapToTagName};
331331 $interfaceName = $enabledTags{ $enabledTags{$tagName}{mapToTagName} }{interfaceName};

@@sub printConstructors
393393 # Ignore the mapped tag
394394 # FIXME: It could be moved inside this loop but was split for readibility.
395395 next if (defined($uniqueTags{$interfaceName}) || $enabledTags{$tagName}{mapToTagName});
 396 # Tags can have wrappers without constructors.
 397 # This is useful to make user-agent shadow elements internally testable
 398 # while keeping them from being avaialble in the HTML markup.
 399 next if $enabledTags{$tagName}{noConstructor};
396400
397401 $uniqueTags{$interfaceName} = '1';
398402

@@sub printFunctionInits
426430 my %tagConstructorMap = %$tagConstructorMap;
427431
428432 for my $tagName (sort keys %tagConstructorMap) {
 433 next if $enabledTags{$tagName}{noConstructor};
429434
430435 my $conditional = $enabledTags{$tagName}{conditional};
431436 if ($conditional) {

Source/WebCore/html/HTMLDetailsElement.cpp

@@public:
5050
5151private:
5252 DetailsContentElement(Document* document)
53  : HTMLContentElement(HTMLNames::divTag, document)
 53 : HTMLContentElement(HTMLNames::webkitShadowContentTag, document)
5454 {
5555 }
5656};

@@public:
7272
7373private:
7474 DetailsSummaryElement(Document* document)
75  : HTMLContentElement(HTMLNames::divTag, document)
 75 : HTMLContentElement(HTMLNames::webkitShadowContentTag, document)
7676 {
7777 setSelect(summaryQuerySelector());
7878 }

Source/WebCore/html/HTMLTagNames.in

@@col interfaceName=HTMLTableColElement
3232colgroup interfaceName=HTMLTableColElement
3333command interfaceName=HTMLElement
3434content interfaceName=HTMLContentElement, conditional=SHADOW_DOM
 35webkitShadowContent interfaceName=HTMLElement, noConstructor
3536datalist interfaceName=HTMLDataListElement, conditional=DATALIST
3637dd interfaceName=HTMLElement
3738del interfaceName=HTMLModElement

Source/WebCore/html/shadow/HTMLContentElement.cpp

@@static const QualifiedName& contentTagName()
4444#if ENABLE(SHADOW_DOM)
4545 return HTMLNames::contentTag;
4646#else
47  DEFINE_STATIC_LOCAL(QualifiedName, tagName, (nullAtom, "webkitShadowContent", HTMLNames::divTag.namespaceURI()));
48  return tagName;
 47 return HTMLNames::webkitShadowContentTag
4948#endif
5049}
5150

LayoutTests/ChangeLog

 12012-03-04 MORITA Hajime <morrita@google.com>
 2
 3 Internally used HTMLContentElement subclasses should have correct wrapper.
 4 https://bugs.webkit.org/show_bug.cgi?id=80237
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * fast/dom/shadow/content-element-user-agent-shadow-expected.txt: Added.
 9 * fast/dom/shadow/content-element-user-agent-shadow.html: Added.
 10 * platform/chromium-win/fast/html/details-remove-summary-1-and-click-expected.txt:
 11 * platform/chromium-win/fast/html/details-remove-summary-4-and-click-expected.txt:
 12 * platform/gtk/fast/html/details-remove-summary-1-and-click-expected.txt:
 13 * platform/gtk/fast/html/details-remove-summary-4-and-click-expected.txt:
 14 * platform/mac/fast/html/details-remove-summary-1-and-click-expected.txt:
 15 * platform/mac/fast/html/details-remove-summary-4-and-click-expected.txt:
 16 * platform/qt/fast/html/details-remove-summary-1-and-click-expected.txt:
 17 * platform/qt/fast/html/details-remove-summary-4-and-click-expected.txt:
 18
1192012-03-04 Shinya Kawanaka <shinyak@chromium.org>
220
321 Refactoring: Methods like firstRendererOf of NodeRenderingContext should be extracted.

LayoutTests/fast/dom/shadow/content-element-user-agent-shadow-expected.txt

 1PASS parsedElementShouldBeUnknown.tagName is expectedTagName
 2PASS 0 < parsedElementShouldBeUnknown.constructor.toString().indexOf('HTMLUnknownElement') is true
 3PASS contentInuserAgentShadow.tagName is expectedTagName
 4PASS 0 < contentInuserAgentShadow.constructor.toString().indexOf('HTMLElement') is true
 5PASS successfullyParsed is true
 6
 7TEST COMPLETE
 8

LayoutTests/fast/dom/shadow/content-element-user-agent-shadow.html

 1<!DOCTYPE html>
 2<html>
 3<body>
 4<div id="container"></div>
 5<script src="../../js/resources/js-test-pre.js"></script>
 6<script><!--
 7(function()
 8{
 9 if (!window.internals)
 10 return;
 11
 12 // Parser should build HTMLUnknownElement for <webkitShadowContent>.
 13 expectedTagName = "WEBKITSHADOWCONTENT";
 14 container = document.getElementById("container");
 15 container.innerHTML = "<div><webkitShadowContent id='shouldBeUnknown'></webkitShadowContent></div>";
 16 parsedElementShouldBeUnknown = document.getElementById("shouldBeUnknown");
 17 shouldBe("parsedElementShouldBeUnknown.tagName", "expectedTagName");
 18 shouldBeTrue("0 < parsedElementShouldBeUnknown.constructor.toString().indexOf('HTMLUnknownElement')");
 19
 20 container.innerHTML = "<details id='details'><summary></summary></details>";
 21 details = document.getElementById("details");
 22
 23 // The user agent shadow for <details> has HTMLContentElement with tagName "webkitShadowContent".
 24 // This element should be wrapped as an HTMLElement because it isn't HTMLUnknownElement and
 25 // HTMLContentElement wrapper is unavailable unless SHADOW_DOM is enabled.
 26 shadow = internals.shadowRoot(details);
 27 contentInuserAgentShadow = shadow.firstChild;
 28 shouldBe("contentInuserAgentShadow.tagName", "expectedTagName");
 29 shouldBeTrue("0 < contentInuserAgentShadow.constructor.toString().indexOf('HTMLElement')");
 30})();
 31--></script>
 32<script src="../../js/resources/js-test-post.js"></script>
 33</body>
 34</html>

LayoutTests/platform/chromium-win/fast/html/details-remove-summary-1-and-click-expected.txt

@@layer at (0,0) size 800x600
88 RenderDetailsMarker {DIV} at (0,5) size 10x10: down
99 RenderText {#text} at (16,0) size 41x19
1010 text run at (16,0) width 41: "Details"
11 caret: position 0 of child 0 {DIV} of {#shadow-root} of child 0 {SUMMARY} of child 0 {DIV} of {#shadow-root} of child 1 {DETAILS} of body
 11caret: position 0 of child 0 {DIV} of {#shadow-root} of child 0 {SUMMARY} of child 0 {WEBKITSHADOWCONTENT} of {#shadow-root} of child 1 {DETAILS} of body

LayoutTests/platform/chromium-win/fast/html/details-remove-summary-4-and-click-expected.txt

@@layer at (0,0) size 800x600
88 RenderDetailsMarker {DIV} at (0,5) size 10x10: right
99 RenderText {#text} at (16,0) size 41x19
1010 text run at (16,0) width 41: "Details"
11 caret: position 0 of child 0 {DIV} of {#shadow-root} of child 0 {SUMMARY} of child 0 {DIV} of {#shadow-root} of child 1 {DETAILS} of body
 11caret: position 0 of child 0 {DIV} of {#shadow-root} of child 0 {SUMMARY} of child 0 {WEBKITSHADOWCONTENT} of {#shadow-root} of child 1 {DETAILS} of body

LayoutTests/platform/gtk/fast/html/details-remove-summary-1-and-click-expected.txt

@@layer at (0,0) size 800x600
88 RenderDetailsMarker {DIV} at (0,4) size 10x10: down
99 RenderText {#text} at (16,0) size 46x17
1010 text run at (16,0) width 46: "Details"
11 caret: position 0 of child 0 {DIV} of {#shadow-root} of child 0 {SUMMARY} of child 0 {DIV} of {#shadow-root} of child 1 {DETAILS} of body
 11caret: position 0 of child 0 {DIV} of {#shadow-root} of child 0 {SUMMARY} of child 0 {WEBKITSHADOWCONTENT} of {#shadow-root} of child 1 {DETAILS} of body

LayoutTests/platform/gtk/fast/html/details-remove-summary-4-and-click-expected.txt

@@layer at (0,0) size 800x600
88 RenderDetailsMarker {DIV} at (0,4) size 10x10: right
99 RenderText {#text} at (16,0) size 46x17
1010 text run at (16,0) width 46: "Details"
11 caret: position 0 of child 0 {DIV} of {#shadow-root} of child 0 {SUMMARY} of child 0 {DIV} of {#shadow-root} of child 1 {DETAILS} of body
 11caret: position 0 of child 0 {DIV} of {#shadow-root} of child 0 {SUMMARY} of child 0 {WEBKITSHADOWCONTENT} of {#shadow-root} of child 1 {DETAILS} of body

LayoutTests/platform/mac/fast/html/details-remove-summary-1-and-click-expected.txt

@@layer at (0,0) size 800x600
88 RenderDetailsMarker {DIV} at (0,4) size 10x10: down
99 RenderText {#text} at (16,0) size 44x18
1010 text run at (16,0) width 44: "Details"
11 caret: position 0 of child 0 {DIV} of {#shadow-root} of child 0 {SUMMARY} of child 0 {DIV} of {#shadow-root} of child 1 {DETAILS} of body
 11caret: position 0 of child 0 {DIV} of {#shadow-root} of child 0 {SUMMARY} of child 0 {WEBKITSHADOWCONTENT} of {#shadow-root} of child 1 {DETAILS} of body

LayoutTests/platform/mac/fast/html/details-remove-summary-4-and-click-expected.txt

@@layer at (0,0) size 800x600
88 RenderDetailsMarker {DIV} at (0,4) size 10x10: right
99 RenderText {#text} at (16,0) size 44x18
1010 text run at (16,0) width 44: "Details"
11 caret: position 0 of child 0 {DIV} of {#shadow-root} of child 0 {SUMMARY} of child 0 {DIV} of {#shadow-root} of child 1 {DETAILS} of body
 11caret: position 0 of child 0 {DIV} of {#shadow-root} of child 0 {SUMMARY} of child 0 {WEBKITSHADOWCONTENT} of {#shadow-root} of child 1 {DETAILS} of body

LayoutTests/platform/qt/fast/html/details-remove-summary-1-and-click-expected.txt

@@layer at (0,0) size 800x600
88 RenderDetailsMarker {DIV} at (0,6) size 10x10: down
99 RenderText {#text} at (16,0) size 50x21
1010 text run at (16,0) width 50: "Details"
11 caret: position 0 of child 0 {DIV} of {#shadow-root} of child 0 {SUMMARY} of child 0 {DIV} of {#shadow-root} of child 1 {DETAILS} of body
 11caret: position 0 of child 0 {DIV} of {#shadow-root} of child 0 {SUMMARY} of child 0 {WEBKITSHADOWCONTENT} of {#shadow-root} of child 1 {DETAILS} of body

LayoutTests/platform/qt/fast/html/details-remove-summary-4-and-click-expected.txt

@@layer at (0,0) size 800x600
88 RenderDetailsMarker {DIV} at (0,6) size 10x10: right
99 RenderText {#text} at (16,0) size 50x21
1010 text run at (16,0) width 50: "Details"
11 caret: position 0 of child 0 {DIV} of {#shadow-root} of child 0 {SUMMARY} of child 0 {DIV} of {#shadow-root} of child 1 {DETAILS} of body
 11caret: position 0 of child 0 {DIV} of {#shadow-root} of child 0 {SUMMARY} of child 0 {WEBKITSHADOWCONTENT} of {#shadow-root} of child 1 {DETAILS} of body