Title: [151471] trunk
Revision
151471
Author
rn...@webkit.org
Date
2013-06-11 14:18:55 -0700 (Tue, 11 Jun 2013)

Log Message

Use HTMLElementFactory to create equivalent elements in WebVTTElement
https://bugs.webkit.org/show_bug.cgi?id=117423

Reviewed by Eric Carlson.

Source/WebCore: 

Merge https://chromium.googlesource.com/chromium/blink/+/3d60bec8e5dabfe877c482797d9ef430bfde31

This change forces the calls through the factory so that we create appropriate sub-classes based upon the passed tag name,
rather than just creating a concrete HTMLElement class with an inappropriate tag name.

Test: media/track/getCueAsHTMLCrash.html

* html/track/WebVTTElement.cpp:
(WebCore::WebVTTElement::createEquivalentHTMLElement):

LayoutTests: 

* media/track/getCueAsHTMLCrash-expected.txt: Added.
* media/track/getCueAsHTMLCrash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (151470 => 151471)


--- trunk/LayoutTests/ChangeLog	2013-06-11 21:09:33 UTC (rev 151470)
+++ trunk/LayoutTests/ChangeLog	2013-06-11 21:18:55 UTC (rev 151471)
@@ -1,3 +1,13 @@
+2013-06-11  Ryosuke Niwa  <rn...@webkit.org>
+
+        Use HTMLElementFactory to create equivalent elements in WebVTTElement
+        https://bugs.webkit.org/show_bug.cgi?id=117423
+
+        Reviewed by Eric Carlson.
+
+        * media/track/getCueAsHTMLCrash-expected.txt: Added.
+        * media/track/getCueAsHTMLCrash.html: Added.
+
 2013-06-11  Eric Carlson  <eric.carl...@apple.com>
 
         [Mac] Update text track menu

Added: trunk/LayoutTests/media/track/getCueAsHTMLCrash-expected.txt (0 => 151471)


--- trunk/LayoutTests/media/track/getCueAsHTMLCrash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/track/getCueAsHTMLCrash-expected.txt	2013-06-11 21:18:55 UTC (rev 151471)
@@ -0,0 +1 @@
+Test passes if it does not induce a crash.

Added: trunk/LayoutTests/media/track/getCueAsHTMLCrash.html (0 => 151471)


--- trunk/LayoutTests/media/track/getCueAsHTMLCrash.html	                        (rev 0)
+++ trunk/LayoutTests/media/track/getCueAsHTMLCrash.html	2013-06-11 21:18:55 UTC (rev 151471)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<div>Test passes if it does not induce a crash.</div>
+<script src=""
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+test(function() {
+    var cue = new TextTrackCue(0, 1, '<c>x\0');
+    window.fragment = cue.getCueAsHTML();
+}, document.title + ', creating the cue');
+
+test(function() {
+    assert_false(fragment.childNodes[0].hasChildNodes(), 'hasChildNodes()');
+}, document.title + ', >');
+
+test(function() {}, document.title + ', ');
+test(function() {}, document.title + ', x\\0');
+</script>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (151470 => 151471)


--- trunk/Source/WebCore/ChangeLog	2013-06-11 21:09:33 UTC (rev 151470)
+++ trunk/Source/WebCore/ChangeLog	2013-06-11 21:18:55 UTC (rev 151471)
@@ -1,3 +1,20 @@
+2013-06-11  Ryosuke Niwa  <rn...@webkit.org>
+
+        Use HTMLElementFactory to create equivalent elements in WebVTTElement
+        https://bugs.webkit.org/show_bug.cgi?id=117423
+
+        Reviewed by Eric Carlson.
+
+        Merge https://chromium.googlesource.com/chromium/blink/+/3d60bec8e5dabfe877c482797d9ef430bfde31
+
+        This change forces the calls through the factory so that we create appropriate sub-classes based upon the passed tag name,
+        rather than just creating a concrete HTMLElement class with an inappropriate tag name.
+
+        Test: media/track/getCueAsHTMLCrash.html
+
+        * html/track/WebVTTElement.cpp:
+        (WebCore::WebVTTElement::createEquivalentHTMLElement):
+
 2013-06-11  Benjamin Poulain  <bpoul...@apple.com>
 
         Split SelectorDataList::executeSingleTagNameSelectorData() into the 4 kinds of traversal

Modified: trunk/Source/WebCore/html/track/WebVTTElement.cpp (151470 => 151471)


--- trunk/Source/WebCore/html/track/WebVTTElement.cpp	2013-06-11 21:09:33 UTC (rev 151470)
+++ trunk/Source/WebCore/html/track/WebVTTElement.cpp	2013-06-11 21:18:55 UTC (rev 151471)
@@ -29,6 +29,7 @@
 
 #include "WebVTTElement.h"
 
+#include "HTMLElementFactory.h"
 #include "TextTrack.h"
 
 namespace WebCore {
@@ -93,24 +94,24 @@
     case WebVTTNodeTypeClass:
     case WebVTTNodeTypeLanguage:
     case WebVTTNodeTypeVoice:
-        htmlElement = HTMLElement::create(HTMLNames::spanTag, document);
+        htmlElement = HTMLElementFactory::createHTMLElement(HTMLNames::spanTag, document);
         htmlElement.get()->setAttribute(HTMLNames::titleAttr, getAttribute(voiceAttributeName()));
         htmlElement.get()->setAttribute(HTMLNames::langAttr, getAttribute(langAttributeName()));
         break;
     case WebVTTNodeTypeItalic:
-        htmlElement = HTMLElement::create(HTMLNames::iTag, document);
+        htmlElement = HTMLElementFactory::createHTMLElement(HTMLNames::iTag, document);
         break;
     case WebVTTNodeTypeBold:
-        htmlElement = HTMLElement::create(HTMLNames::bTag, document);
+        htmlElement = HTMLElementFactory::createHTMLElement(HTMLNames::bTag, document);
         break;
     case WebVTTNodeTypeUnderline:
-        htmlElement = HTMLElement::create(HTMLNames::uTag, document);
+        htmlElement = HTMLElementFactory::createHTMLElement(HTMLNames::uTag, document);
         break;
     case WebVTTNodeTypeRuby:
-        htmlElement = HTMLElement::create(HTMLNames::rubyTag, document);
+        htmlElement = HTMLElementFactory::createHTMLElement(HTMLNames::rubyTag, document);
         break;
     case WebVTTNodeTypeRubyText:
-        htmlElement = HTMLElement::create(HTMLNames::rtTag, document);
+        htmlElement = HTMLElementFactory::createHTMLElement(HTMLNames::rtTag, document);
         break;
     default:
         ASSERT_NOT_REACHED();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to