Title: [180601] trunk
Revision
180601
Author
wei...@apple.com
Date
2015-02-24 17:49:59 -0800 (Tue, 24 Feb 2015)

Log Message

[Attachment] Give <attachment> elements an underlying File
https://bugs.webkit.org/show_bug.cgi?id=141993

Reviewed by Tim Horton.

Source/WebCore:

- Add a JS subclass for attachments so that <attachment>s are
  instances of HTMLAttachmentElement rather than HTMLElement.
- Give HTMLAttachmentElements an underlying File that they
  are the representation of. Expose it via a new 'file' property.
- Expose a new Internals function called window.internals.createFile(url)
  that allows creating File objects for testing.

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* fileapi/File.h:
* html/HTMLAttachmentElement.cpp:
(WebCore::HTMLAttachmentElement::~HTMLAttachmentElement):
(WebCore::HTMLAttachmentElement::file):
(WebCore::HTMLAttachmentElement::setFile):
* html/HTMLAttachmentElement.h:
* html/HTMLAttachmentElement.idl: Added.
* html/HTMLTagNames.in:
* testing/Internals.cpp:
(WebCore::Internals::createFile):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

Update attachment-dom.html to test setting and getting the
underlying file.

* fast/attachment/attachment-dom-expected.txt:
* fast/attachment/attachment-dom.html:
* fast/attachment/resources: Added.
* fast/attachment/resources/test-file.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (180600 => 180601)


--- trunk/LayoutTests/ChangeLog	2015-02-25 01:43:42 UTC (rev 180600)
+++ trunk/LayoutTests/ChangeLog	2015-02-25 01:49:59 UTC (rev 180601)
@@ -1,3 +1,18 @@
+2015-02-24  Sam Weinig  <s...@webkit.org>
+
+        [Attachment] Give <attachment> elements an underlying File
+        https://bugs.webkit.org/show_bug.cgi?id=141993
+
+        Reviewed by Tim Horton.
+
+        Update attachment-dom.html to test setting and getting the
+        underlying file.
+
+        * fast/attachment/attachment-dom-expected.txt:
+        * fast/attachment/attachment-dom.html:
+        * fast/attachment/resources: Added.
+        * fast/attachment/resources/test-file.txt: Added.
+
 2015-02-24  Joanmarie Diggs  <jdi...@igalia.com>
 
         AX: Implement support for ARIA 1.1 'switch' role

Modified: trunk/LayoutTests/fast/attachment/attachment-dom-expected.txt (180600 => 180601)


--- trunk/LayoutTests/fast/attachment/attachment-dom-expected.txt	2015-02-25 01:43:42 UTC (rev 180600)
+++ trunk/LayoutTests/fast/attachment/attachment-dom-expected.txt	2015-02-25 01:49:59 UTC (rev 180601)
@@ -3,7 +3,11 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS attachment is an instance of HTMLElement
+PASS attachment is an instance of HTMLAttachmentElement
+PASS attachment.file is null
+Setting attachment.file to a file created from resources/test-file.txt
+PASS attachment.file is file
+PASS attachment.file.name is 'test-file.txt'
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/attachment/attachment-dom.html (180600 => 180601)


--- trunk/LayoutTests/fast/attachment/attachment-dom.html	2015-02-25 01:43:42 UTC (rev 180600)
+++ trunk/LayoutTests/fast/attachment/attachment-dom.html	2015-02-25 01:49:59 UTC (rev 180601)
@@ -10,8 +10,19 @@
 description("This tests that attachments have an instance type of HTMLElement.");
 
 var attachment = document.createElement("attachment");
-shouldBeType("attachment", "HTMLElement");
+shouldBeType("attachment", "HTMLAttachmentElement");
 
+var file;
+if (window.internals) {
+    file = window.internals.createFile("resources/test-file.txt");
+}
+
+shouldBeNull("attachment.file");
+
+debug("Setting attachment.file to a file created from resources/test-file.txt")
+attachment.file = file;
+shouldBe("attachment.file", "file");
+shouldBe("attachment.file.name", "'test-file.txt'");
 </script>
 <script src=""
 </body>

Added: trunk/LayoutTests/fast/attachment/resources/test-file.txt ( => )


Modified: trunk/Source/WebCore/CMakeLists.txt
===================================================================
--- trunk/Source/WebCore/CMakeLists.txt	2015-02-25 01:43:42 UTC (rev 180600)
+++ trunk/Source/WebCore/CMakeLists.txt	2015-02-25 01:49:59 UTC (rev 180601)
@@ -445,6 +445,7 @@
     html/HTMLAnchorElement.idl
     html/HTMLAppletElement.idl
     html/HTMLAreaElement.idl
+    html/HTMLAttachmentElement.idl
     html/HTMLAudioElement.idl
     html/HTMLBRElement.idl
     html/HTMLBaseElement.idl

Modified: trunk/Source/WebCore/ChangeLog (180600 => 180601)


--- trunk/Source/WebCore/ChangeLog	2015-02-25 01:43:42 UTC (rev 180600)
+++ trunk/Source/WebCore/ChangeLog	2015-02-25 01:49:59 UTC (rev 180601)
@@ -1,3 +1,36 @@
+2015-02-24  Sam Weinig  <s...@webkit.org>
+
+        [Attachment] Give <attachment> elements an underlying File
+        https://bugs.webkit.org/show_bug.cgi?id=141993
+
+        Reviewed by Tim Horton.
+
+        - Add a JS subclass for attachments so that <attachment>s are
+          instances of HTMLAttachmentElement rather than HTMLElement.
+        - Give HTMLAttachmentElements an underlying File that they
+          are the representation of. Expose it via a new 'file' property.
+        - Expose a new Internals function called window.internals.createFile(url)
+          that allows creating File objects for testing.
+
+        * CMakeLists.txt:
+        * DerivedSources.cpp:
+        * DerivedSources.make:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * fileapi/File.h:
+        * html/HTMLAttachmentElement.cpp:
+        (WebCore::HTMLAttachmentElement::~HTMLAttachmentElement):
+        (WebCore::HTMLAttachmentElement::file):
+        (WebCore::HTMLAttachmentElement::setFile):
+        * html/HTMLAttachmentElement.h:
+        * html/HTMLAttachmentElement.idl: Added.
+        * html/HTMLTagNames.in:
+        * testing/Internals.cpp:
+        (WebCore::Internals::createFile):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2015-02-24  Joanmarie Diggs  <jdi...@igalia.com>
 
         AX: Implement support for ARIA 1.1 'switch' role

Modified: trunk/Source/WebCore/DerivedSources.cpp (180600 => 180601)


--- trunk/Source/WebCore/DerivedSources.cpp	2015-02-25 01:43:42 UTC (rev 180600)
+++ trunk/Source/WebCore/DerivedSources.cpp	2015-02-25 01:49:59 UTC (rev 180601)
@@ -171,6 +171,9 @@
 #include "JSHTMLAnchorElement.cpp"
 #include "JSHTMLAppletElement.cpp"
 #include "JSHTMLAreaElement.cpp"
+#if ENABLE(ATTACHMENT_ELEMENT)
+#include "JSHTMLAttachmentElement.cpp"
+#endif
 #include "JSHTMLAudioElement.cpp"
 #include "JSHTMLBaseElement.cpp"
 #include "JSHTMLBaseFontElement.cpp"

Modified: trunk/Source/WebCore/DerivedSources.make (180600 => 180601)


--- trunk/Source/WebCore/DerivedSources.make	2015-02-25 01:43:42 UTC (rev 180600)
+++ trunk/Source/WebCore/DerivedSources.make	2015-02-25 01:49:59 UTC (rev 180601)
@@ -331,6 +331,7 @@
     $(WebCore)/html/HTMLAnchorElement.idl \
     $(WebCore)/html/HTMLAppletElement.idl \
     $(WebCore)/html/HTMLAreaElement.idl \
+    $(WebCore)/html/HTMLAttachmentElement.idl \
     $(WebCore)/html/HTMLAudioElement.idl \
     $(WebCore)/html/HTMLBRElement.idl \
     $(WebCore)/html/HTMLBaseElement.idl \

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (180600 => 180601)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-02-25 01:43:42 UTC (rev 180600)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-02-25 01:49:59 UTC (rev 180601)
@@ -2227,6 +2227,20 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSHTMLAttachmentElement.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSHTMLAudioElement.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -18616,6 +18630,7 @@
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSHTMLAnchorElement.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSHTMLAppletElement.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSHTMLAreaElement.h" />
+    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSHTMLAttachmentElement.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSHTMLAudioElement.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSHTMLBaseElement.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSHTMLBaseFontElement.h" />

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (180600 => 180601)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2015-02-25 01:43:42 UTC (rev 180600)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2015-02-25 01:49:59 UTC (rev 180601)
@@ -5323,6 +5323,9 @@
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSHTMLAreaElement.cpp">
       <Filter>DerivedSources</Filter>
     </ClCompile>
+    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSHTMLAttachmentElement.cpp">
+      <Filter>DerivedSources</Filter>
+    </ClCompile>
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSHTMLAudioElement.cpp">
       <Filter>DerivedSources</Filter>
     </ClCompile>
@@ -12677,6 +12680,9 @@
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSHTMLAreaElement.h">
       <Filter>DerivedSources</Filter>
     </ClInclude>
+    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSHTMLAttachmentElement.h">
+      <Filter>DerivedSources</Filter>
+    </ClInclude>
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSHTMLAudioElement.h">
       <Filter>DerivedSources</Filter>
     </ClInclude>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (180600 => 180601)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-02-25 01:43:42 UTC (rev 180600)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-02-25 01:49:59 UTC (rev 180601)
@@ -2492,6 +2492,8 @@
 		7C74D43818823B1900E5ED57 /* UTextProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C74D43618823B1900E5ED57 /* UTextProvider.h */; };
 		7C74D43B1882400400E5ED57 /* UTextProviderUTF16.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C74D4391882400400E5ED57 /* UTextProviderUTF16.cpp */; };
 		7C74D43C1882400400E5ED57 /* UTextProviderUTF16.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */; };
+		7C9DBFED1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C9DBFEB1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp */; };
+		7C9DBFEE1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9DBFEC1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h */; };
 		7CC564B818BABEA6001B9652 /* TelephoneNumberDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC564B618BABEA6001B9652 /* TelephoneNumberDetector.h */; };
 		7CC564BA18BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CC564B918BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp */; };
 		7CC69940191EC5F500AF2270 /* JSWebKitNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CC6993E191EC5F500AF2270 /* JSWebKitNamespace.cpp */; };
@@ -9683,6 +9685,9 @@
 		7C74D43618823B1900E5ED57 /* UTextProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProvider.h; sourceTree = "<group>"; };
 		7C74D4391882400400E5ED57 /* UTextProviderUTF16.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProviderUTF16.cpp; sourceTree = "<group>"; };
 		7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderUTF16.h; sourceTree = "<group>"; };
+		7C9DBFEA1A9C489F000D6B25 /* HTMLAttachmentElement.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTMLAttachmentElement.idl; sourceTree = "<group>"; };
+		7C9DBFEB1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSHTMLAttachmentElement.cpp; path = JSHTMLAttachmentElement.cpp; sourceTree = "<group>"; };
+		7C9DBFEC1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSHTMLAttachmentElement.h; path = JSHTMLAttachmentElement.h; sourceTree = "<group>"; };
 		7CC564B618BABEA6001B9652 /* TelephoneNumberDetector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TelephoneNumberDetector.h; sourceTree = "<group>"; };
 		7CC564B918BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TelephoneNumberDetectorCocoa.cpp; sourceTree = "<group>"; };
 		7CC6993E191EC5F500AF2270 /* JSWebKitNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitNamespace.cpp; sourceTree = "<group>"; };
@@ -17777,6 +17782,7 @@
 				1AE2A9F00A1CDA5700B42B25 /* HTMLAreaElement.idl */,
 				7C5F28F91A827D8400C0F31F /* HTMLAttachmentElement.cpp */,
 				7C5F28FA1A827D8400C0F31F /* HTMLAttachmentElement.h */,
+				7C9DBFEA1A9C489F000D6B25 /* HTMLAttachmentElement.idl */,
 				519FE0A10DAD446E00A08F21 /* HTMLAttributeNames.in */,
 				E446138F0CD6331000FADA75 /* HTMLAudioElement.cpp */,
 				E44613900CD6331000FADA75 /* HTMLAudioElement.h */,
@@ -18776,6 +18782,8 @@
 				1A4A2DEE0A1B852A00C807F8 /* JSHTMLAppletElement.h */,
 				1AE2AA0A0A1CDAB300B42B25 /* JSHTMLAreaElement.cpp */,
 				1AE2AA0B0A1CDAB300B42B25 /* JSHTMLAreaElement.h */,
+				7C9DBFEB1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp */,
+				7C9DBFEC1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h */,
 				E4B4237D0CBFB73C00AF2ECE /* JSHTMLAudioElement.cpp */,
 				E4B4237E0CBFB73C00AF2ECE /* JSHTMLAudioElement.h */,
 				A80E7B080A19D606007FB8C5 /* JSHTMLBaseElement.cpp */,
@@ -23717,6 +23725,7 @@
 				9746AF2114F4DDE6003E7A71 /* Coordinates.h in Headers */,
 				CE1252371A15BDBE00864480 /* CoreGraphicsSPI.h in Headers */,
 				443818001A91B2F8006E04F2 /* CoreMediaSoftLink.h in Headers */,
+				7C9DBFEE1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h in Headers */,
 				4449A4051A964B0000B64AD5 /* CoreMediaSPI.h in Headers */,
 				1C6466251A12C38E0094603C /* CoreTextSPI.h in Headers */,
 				862F129E18C1576F005C54AF /* CountedUserActivity.h in Headers */,
@@ -29363,6 +29372,7 @@
 				99CC0B5518BE9849006CEBCC /* ReplayingInputCursor.cpp in Sources */,
 				267725FC1A5B3AD9003C24DD /* DFA.cpp in Sources */,
 				99CC0B5718BE984A006CEBCC /* ReplayInputCreationMethods.cpp in Sources */,
+				7C9DBFED1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp in Sources */,
 				99CC0B5818BE984A006CEBCC /* ReplayInputDispatchMethods.cpp in Sources */,
 				99CC0B5918BE984A006CEBCC /* ReplaySession.cpp in Sources */,
 				99CC0B5B18BE984A006CEBCC /* ReplaySessionSegment.cpp in Sources */,

Modified: trunk/Source/WebCore/fileapi/File.h (180600 => 180601)


--- trunk/Source/WebCore/fileapi/File.h	2015-02-25 01:43:42 UTC (rev 180600)
+++ trunk/Source/WebCore/fileapi/File.h	2015-02-25 01:49:59 UTC (rev 180601)
@@ -70,7 +70,7 @@
 #endif
 
 private:
-    explicit File(const String& path);
+    WEBCORE_EXPORT explicit File(const String& path);
     File(const String& path, const String& nameOverride);
 
     File(DeserializationContructor, const String& path, const URL& srcURL, const String& type, const String& name);

Modified: trunk/Source/WebCore/html/HTMLAttachmentElement.cpp (180600 => 180601)


--- trunk/Source/WebCore/html/HTMLAttachmentElement.cpp	2015-02-25 01:43:42 UTC (rev 180600)
+++ trunk/Source/WebCore/html/HTMLAttachmentElement.cpp	2015-02-25 01:49:59 UTC (rev 180601)
@@ -28,6 +28,7 @@
 
 #if ENABLE(ATTACHMENT_ELEMENT)
 
+#include "File.h"
 #include "HTMLNames.h"
 #include "RenderAttachment.h"
 
@@ -41,6 +42,10 @@
     ASSERT(hasTagName(attachmentTag));
 }
 
+HTMLAttachmentElement::~HTMLAttachmentElement()
+{
+}
+
 Ref<HTMLAttachmentElement> HTMLAttachmentElement::create(const QualifiedName& tagName, Document& document)
 {
     return adoptRef(*new HTMLAttachmentElement(tagName, document));
@@ -50,7 +55,17 @@
 {
     return createRenderer<RenderAttachment>(*this, WTF::move(style));
 }
-    
+
+File* HTMLAttachmentElement::file()
+{
+    return m_file.get();
+}
+
+void HTMLAttachmentElement::setFile(File* file)
+{
+    m_file = file;
+}
+
 void HTMLAttachmentElement::setFocus(bool shouldBeFocused)
 {
     if (focused() == shouldBeFocused)

Modified: trunk/Source/WebCore/html/HTMLAttachmentElement.h (180600 => 180601)


--- trunk/Source/WebCore/html/HTMLAttachmentElement.h	2015-02-25 01:43:42 UTC (rev 180600)
+++ trunk/Source/WebCore/html/HTMLAttachmentElement.h	2015-02-25 01:49:59 UTC (rev 180601)
@@ -32,17 +32,25 @@
 
 namespace WebCore {
 
+class File;
+
 class HTMLAttachmentElement final : public HTMLElement {
 public:
     static Ref<HTMLAttachmentElement> create(const QualifiedName&, Document&);
-    
+
+    File* file();
+    void setFile(File*);
+
 private:
     HTMLAttachmentElement(const QualifiedName&, Document&);
+    virtual ~HTMLAttachmentElement();
 
     virtual RenderPtr<RenderElement> createElementRenderer(Ref<RenderStyle>&&) override;
 
     virtual bool isFocusable() const override { return true; }
     virtual void setFocus(bool shouldBeFocused) override;
+    
+    RefPtr<File> m_file;
 };
 
 } // namespace WebCore

Added: trunk/Source/WebCore/html/HTMLAttachmentElement.idl (0 => 180601)


--- trunk/Source/WebCore/html/HTMLAttachmentElement.idl	                        (rev 0)
+++ trunk/Source/WebCore/html/HTMLAttachmentElement.idl	2015-02-25 01:49:59 UTC (rev 180601)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Conditional=ATTACHMENT_ELEMENT
+] interface HTMLAttachmentElement : HTMLElement {
+    attribute File file;
+};

Modified: trunk/Source/WebCore/html/HTMLTagNames.in (180600 => 180601)


--- trunk/Source/WebCore/html/HTMLTagNames.in	2015-02-25 01:43:42 UTC (rev 180600)
+++ trunk/Source/WebCore/html/HTMLTagNames.in	2015-02-25 01:49:59 UTC (rev 180601)
@@ -11,7 +11,7 @@
 area
 article interfaceName=HTMLElement
 aside interfaceName=HTMLElement
-attachment JSInterfaceName=HTMLElement, conditional=ATTACHMENT_ELEMENT, settingsConditional=attachmentElementEnabled
+attachment conditional=ATTACHMENT_ELEMENT, settingsConditional=attachmentElementEnabled
 audio wrapperOnlyIfMediaIsAvailable, conditional=VIDEO, constructorNeedsCreatedByParser, customTypeHelper
 b interfaceName=HTMLElement
 base

Modified: trunk/Source/WebCore/testing/Internals.cpp (180600 => 180601)


--- trunk/Source/WebCore/testing/Internals.cpp	2015-02-25 01:43:42 UTC (rev 180600)
+++ trunk/Source/WebCore/testing/Internals.cpp	2015-02-25 01:49:59 UTC (rev 180601)
@@ -48,6 +48,7 @@
 #include "Element.h"
 #include "EventHandler.h"
 #include "ExceptionCode.h"
+#include "File.h"
 #include "FontCache.h"
 #include "FormController.h"
 #include "FrameLoader.h"
@@ -2516,4 +2517,17 @@
     return document->page()->isPlayingAudio();
 }
 
+RefPtr<File> Internals::createFile(const String& path)
+{
+    Document* document = contextDocument();
+    if (!document)
+        return nullptr;
+
+    URL url = ""
+    if (!url.isLocalFile())
+        return nullptr;
+
+    return File::create(url.fileSystemPath());
 }
+
+}

Modified: trunk/Source/WebCore/testing/Internals.h (180600 => 180601)


--- trunk/Source/WebCore/testing/Internals.h	2015-02-25 01:43:42 UTC (rev 180600)
+++ trunk/Source/WebCore/testing/Internals.h	2015-02-25 01:49:59 UTC (rev 180601)
@@ -47,6 +47,7 @@
 class DOMWindow;
 class Document;
 class Element;
+class File;
 class Frame;
 class InspectorFrontendChannelDummy;
 class InspectorFrontendClientDummy;
@@ -364,6 +365,8 @@
     void setPageMuted(bool);
     bool isPagePlayingAudio();
 
+    RefPtr<File> createFile(const String&);
+
 private:
     explicit Internals(Document*);
     Document* contextDocument() const;

Modified: trunk/Source/WebCore/testing/Internals.idl (180600 => 180601)


--- trunk/Source/WebCore/testing/Internals.idl	2015-02-25 01:43:42 UTC (rev 180600)
+++ trunk/Source/WebCore/testing/Internals.idl	2015-02-25 01:49:59 UTC (rev 180601)
@@ -320,4 +320,6 @@
 
     void setPageMuted(boolean muted);
     boolean isPagePlayingAudio();
+    
+    File createFile(DOMString url);
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to