Title: [210536] trunk
Revision
210536
Author
cdu...@apple.com
Date
2017-01-09 21:04:36 -0800 (Mon, 09 Jan 2017)

Log Message

REGRESSION(r189555): ImageDocument title no longer includes the size of the image
https://bugs.webkit.org/show_bug.cgi?id=166876
<rdar://problem/29939970>

Reviewed by Tim Horton.

Source/WebCore:

ImageDocument title no longer included the size of the image after r189555.
This is because Document::setTitle() is a no-op if the document does not
have a <head> element. To address the issue, we now include a <head>
element in ImageDocuments so that their title element properly gets added
to it.

Test: fast/images/imageDocument-title.html

* html/ImageDocument.cpp:
(WebCore::ImageDocument::createDocumentStructure):

LayoutTests:

Add layout test coverage.

* fast/images/imageDocument-title-expected.txt: Added.
* fast/images/imageDocument-title.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (210535 => 210536)


--- trunk/LayoutTests/ChangeLog	2017-01-10 04:19:43 UTC (rev 210535)
+++ trunk/LayoutTests/ChangeLog	2017-01-10 05:04:36 UTC (rev 210536)
@@ -1,3 +1,16 @@
+2017-01-09  Chris Dumez  <cdu...@apple.com>
+
+        REGRESSION(r189555): ImageDocument title no longer includes the size of the image
+        https://bugs.webkit.org/show_bug.cgi?id=166876
+        <rdar://problem/29939970>
+
+        Reviewed by Tim Horton.
+
+        Add layout test coverage.
+
+        * fast/images/imageDocument-title-expected.txt: Added.
+        * fast/images/imageDocument-title.html: Added.
+
 2017-01-09  Zalan Bujtas  <za...@apple.com>
 
         ASSERTION FAILED: newLogicalTop >= logicalTop in WebCore::RenderBlockFlow::getClearDelta

Added: trunk/LayoutTests/fast/images/imageDocument-title-expected.txt (0 => 210536)


--- trunk/LayoutTests/fast/images/imageDocument-title-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/images/imageDocument-title-expected.txt	2017-01-10 05:04:36 UTC (rev 210536)
@@ -0,0 +1,11 @@
+Tests that the title of an ImageDocument is properly set.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS f.contentDocument.title is "green-24x24.jpg 24×24 pixels"
+PASS f.contentDocument.head.getElementsByTagName('title')[0].textContent is "green-24x24.jpg 24×24 pixels"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/images/imageDocument-title.html (0 => 210536)


--- trunk/LayoutTests/fast/images/imageDocument-title.html	                        (rev 0)
+++ trunk/LayoutTests/fast/images/imageDocument-title.html	2017-01-10 05:04:36 UTC (rev 210536)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+</head>
+<body>
+<script src=""
+<script>
+description("Tests that the title of an ImageDocument is properly set.");
+jsTestIsAsync = true;
+
+var f = document.createElement("iframe");
+f._onload_ = function() {
+    shouldBeEqualToString("f.contentDocument.title", "green-24x24.jpg 24×24 pixels");
+    shouldBeEqualToString("f.contentDocument.head.getElementsByTagName('title')[0].textContent", "green-24x24.jpg 24×24 pixels");
+    finishJSTest();
+}
+
+f.src = ""
+document.body.appendChild(f);
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (210535 => 210536)


--- trunk/Source/WebCore/ChangeLog	2017-01-10 04:19:43 UTC (rev 210535)
+++ trunk/Source/WebCore/ChangeLog	2017-01-10 05:04:36 UTC (rev 210536)
@@ -1,3 +1,22 @@
+2017-01-09  Chris Dumez  <cdu...@apple.com>
+
+        REGRESSION(r189555): ImageDocument title no longer includes the size of the image
+        https://bugs.webkit.org/show_bug.cgi?id=166876
+        <rdar://problem/29939970>
+
+        Reviewed by Tim Horton.
+
+        ImageDocument title no longer included the size of the image after r189555.
+        This is because Document::setTitle() is a no-op if the document does not
+        have a <head> element. To address the issue, we now include a <head>
+        element in ImageDocuments so that their title element properly gets added
+        to it.
+
+        Test: fast/images/imageDocument-title.html
+
+        * html/ImageDocument.cpp:
+        (WebCore::ImageDocument::createDocumentStructure):
+
 2017-01-09  Zalan Bujtas  <za...@apple.com>
 
         ASSERTION FAILED: newLogicalTop >= logicalTop in WebCore::RenderBlockFlow::getClearDelta

Modified: trunk/Source/WebCore/html/ImageDocument.cpp (210535 => 210536)


--- trunk/Source/WebCore/html/ImageDocument.cpp	2017-01-10 04:19:43 UTC (rev 210535)
+++ trunk/Source/WebCore/html/ImageDocument.cpp	2017-01-10 05:04:36 UTC (rev 210536)
@@ -35,6 +35,7 @@
 #include "FrameLoaderClient.h"
 #include "FrameView.h"
 #include "HTMLBodyElement.h"
+#include "HTMLHeadElement.h"
 #include "HTMLHtmlElement.h"
 #include "HTMLImageElement.h"
 #include "HTMLNames.h"
@@ -215,6 +216,9 @@
 
     frame()->injectUserScripts(InjectAtDocumentStart);
 
+    auto head = HTMLHeadElement::create(*this);
+    rootElement->appendChild(head);
+
     auto body = HTMLBodyElement::create(*this);
     body->setAttribute(styleAttr, "margin: 0px");
     if (MIMETypeRegistry::isPDFMIMEType(document().loader()->responseMIMEType()))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to