HTML
1.HTMLElement.idl
1 interface HTMLElement : Element { 2 [Reflect] attribute DOMString id; 3 [Reflect] attribute DOMString title; 4 [Reflect] attribute DOMString lang; 5 attribute boolean translate; 6 [Reflect] attribute DOMString dir; 7 attribute long tabIndex; 8 attribute boolean draggable; 9 [Reflect] attribute DOMString webkitdropzone; 10 [Reflect] attribute boolean hidden; 11 [Reflect] attribute DOMString accessKey; 12 13 // Extensions 14 [TreatNullAs=NullString, SetterRaisesException] attribute DOMString innerHTML; 15 [TreatNullAs=NullString, SetterRaisesException] attribute DOMString innerText; 16 [TreatNullAs=NullString, SetterRaisesException] attribute DOMString outerHTML; 17 [TreatNullAs=NullString, SetterRaisesException] attribute DOMString outerText; 18 19 [RaisesException] Element insertAdjacentElement([Default=Undefined] optional DOMString where, 20 [Default=Undefined] optional Element element); 21 [RaisesException] void insertAdjacentHTML([Default=Undefined] optional DOMString where, 22 [Default=Undefined] optional DOMString html); 23 [RaisesException] void insertAdjacentText([Default=Undefined] optional DOMString where, 24 [Default=Undefined] optional DOMString text); 25 26 readonly attribute HTMLCollection children; 27 attribute boolean spellcheck; 28 void click(); 29 };
HTMLElement.cpp
String HTMLElement::nodeName() const { // FIXME: Would be nice to have an atomicstring lookup based off uppercase // chars that does not have to copy the string on a hit in the hash. // FIXME: We should have a way to detect XHTML elements and replace the hasPrefix() check with it. if (document().isHTMLDocument() && !tagQName().hasPrefix()) return tagQName().localNameUpper(); return Element::nodeName(); } unsigned HTMLElement::parseBorderWidthAttribute(const AtomicString& value) const { unsigned borderWidth = 0; if (value.isEmpty() || !parseHTMLNonNegativeInteger(value, borderWidth)) return hasTagName(tableTag) ? 1 : borderWidth; return borderWidth; }
HTMLDocument.idl
1 [Custom] void write([Default=Undefined] optional DOMString text); 2 [Custom] void writeln([Default=Undefined] optional DOMString text); 3 4 readonly attribute HTMLCollection embeds; 5 readonly attribute HTMLCollection plugins; 6 readonly attribute HTMLCollection scripts;
HTMLDocument.cpp
1 PassRefPtr<Element> HTMLDocument::createElement(const AtomicString& name, ExceptionCode& ec) 2 { 3 if (!isValidName(name)) { 4 ec = INVALID_CHARACTER_ERR; 5 return 0; 6 } 7 return HTMLElementFactory::createElement(QualifiedName(nullAtom, name.lower(), xhtmlNamespaceURI), *this); 8 }
FileList.idl
1 interface FileList { 2 readonly attribute unsigned long length; 3 getter File item(unsigned long index); 4 };
FileList.h
1 class FileList : public ScriptWrappable, public RefCounted<FileList> { 2 public: 3 static PassRefPtr<FileList> create() 4 { 5 return adoptRef(new FileList); 6 } 7 8 static PassRefPtr<FileList> create(Vector<RefPtr<File>>&& files) 9 { 10 return adoptRef(new FileList(WTF::move(files))); 11 } 12 13 unsigned length() const { return m_files.size(); } 14 File* item(unsigned index) const; 15 16 bool isEmpty() const { return m_files.isEmpty(); } 17 Vector<String> paths() const;
FileList.cpp
1 File* FileList::item(unsigned index) const 2 { 3 if (index >= m_files.size()) 4 return 0; 5 return m_files[index].get(); 6 } 7 8 Vector<String> FileList::paths() const 9 { 10 Vector<String> paths; 11 for (unsigned i = 0; i < m_files.size(); ++i) 12 paths.append(m_files[i]->path()); 13 14 return paths; 15 }
FileReader.idl
1 interface FileReader { 2 // ready states 3 const unsigned short EMPTY = 0; 4 const unsigned short LOADING = 1; 5 const unsigned short DONE = 2; 6 readonly attribute unsigned short readyState; 7 8 // async read methods 9 [RaisesException] void readAsArrayBuffer(Blob blob); 10 [RaisesException] void readAsBinaryString(Blob blob); 11 [RaisesException] void readAsText(Blob blob, optional DOMString encoding); 12 [RaisesException] void readAsDataURL(Blob blob); 13 14 void abort(); 15 16 // file data 17 [Custom] readonly attribute any result; 18 19 readonly attribute FileError error; 20 21 // EventTarget interface 22 void addEventListener(DOMString type, 23 EventListener listener, 24 optional boolean useCapture); 25 void removeEventListener(DOMString type, 26 EventListener listener, 27 optional boolean useCapture); 28 [RaisesException] boolean dispatchEvent(Event evt); 29 30 attribute EventListener onloadstart; 31 attribute EventListener onprogress; 32 attribute EventListener onload; 33 attribute EventListener onabort; 34 attribute EventListener onerror; 35 attribute EventListener onloadend; 36 };
FileReader.h
1 class FileReader final : public RefCounted<FileReader>, public ActiveDOMObject, public EventTargetWithInlineData, public FileReaderLoaderClient { 2 public: 3 static PassRefPtr<FileReader> create(ScriptExecutionContext&); 4 5 virtual ~FileReader(); 6 7 enum ReadyState { 8 EMPTY = 0, 9 LOADING = 1, 10 DONE = 2 11 }; 12 13 void readAsArrayBuffer(Blob*, ExceptionCode&); 14 void readAsBinaryString(Blob*, ExceptionCode&); 15 void readAsText(Blob*, const String& encoding, ExceptionCode&); 16 void readAsText(Blob*, ExceptionCode&); 17 void readAsDataURL(Blob*, ExceptionCode&); 18 void abort(); 19 20 void doAbort(); 21 22 ReadyState readyState() const { return m_state; } 23 PassRefPtr<FileError> error() { return m_error; } 24 FileReaderLoader::ReadType readType() const { return m_readType; } 25 PassRefPtr<JSC::ArrayBuffer> arrayBufferResult() const; 26 String stringResult(); 27 28 // EventTarget 29 virtual EventTargetInterface eventTargetInterface() const override { return FileReaderEventTargetInterfaceType; } 30 virtual ScriptExecutionContext* scriptExecutionContext() const override { return ActiveDOMObject::scriptExecutionContext(); } 31 32 // FileReaderLoaderClient 33 virtual void didStartLoading() override; 34 virtual void didReceiveData() override; 35 virtual void didFinishLoading() override; 36 virtual void didFail(int errorCode) override; 37 38 using RefCounted<FileReader>::ref; 39 using RefCounted<FileReader>::deref; 40 41 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart); 42 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); 43 DEFINE_ATTRIBUTE_EVENT_LISTENER(load); 44 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); 45 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); 46 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadend);
ReadType.enum
1 enum ReadType { 2 ReadAsArrayBuffer, 3 ReadAsBinaryString, 4 ReadAsBlob, 5 ReadAsText, 6 ReadAsDataURL 7 };
ConvertToDataURL.method
1 void FileReaderLoader::convertToDataURL() 2 { 3 StringBuilder builder; 4 builder.appendLiteral("data:"); 5 6 if (!m_bytesLoaded) { 7 m_stringResult = builder.toString(); 8 return; 9 } 10 11 builder.append(m_dataType); 12 builder.appendLiteral(";base64,"); 13 14 Vector<char> out; 15 base64Encode(m_rawData->data(), m_bytesLoaded, out); 16 out.append('\0'); 17 builder.append(out.data()); 18 19 m_stringResult = builder.toString();
ConvertToText.method
1 void FileReaderLoader::convertToText() 2 { 3 if (!m_bytesLoaded) 4 return; 5 6 // Decode the data. 7 // The File API spec says that we should use the supplied encoding if it is valid. However, we choose to ignore this 8 // requirement in order to be consistent with how WebKit decodes the web content: always has the BOM override the 9 // provided encoding. 10 // FIXME: consider supporting incremental decoding to improve the perf. 11 if (!m_decoder) 12 m_decoder = TextResourceDecoder::create("text/plain", m_encoding.isValid() ? m_encoding : UTF8Encoding()); 13 if (isCompleted()) 14 m_stringResult = m_decoder->decodeAndFlush(static_cast<const char*>(m_rawData->data()), m_bytesLoaded); 15 else 16 m_stringResult = m_decoder->decode(static_cast<const char*>(m_rawData->data()), m_bytesLoaded); 17 }
FileStream.h
1 class FileStream : public RefCounted<FileStream> { 2 public: 3 static PassRefPtr<FileStream> create() 4 { 5 return adoptRef(new FileStream()); 6 } 7 ~FileStream(); 8 9 // FIXME: To be removed when we switch to using BlobData. 10 void start(); 11 12 // Aborts the operation. 13 void stop(); 14 15 // Gets the size of a file. Also validates if the file has been changed or not if the expected modification time is provided, i.e. non-zero. 16 // Returns total number of bytes if successful. -1 otherwise. 17 long long getSize(const String& path, double expectedModificationTime); 18 19 // Opens a file for reading. The reading starts at the specified offset and lasts till the specified length. 20 // Returns true on success. False otherwise. 21 bool openForRead(const String& path, long long offset, long long length); 22 23 // Opens a file for writing. 24 // Returns true on success. False otherwise. 25 bool openForWrite(const String& path); 26 27 // Closes the file. 28 void close(); 29 30 // Reads a file into the provided data buffer. 31 // Returns number of bytes being read on success. -1 otherwise. 32 // If 0 is returned, it means that the reading is completed. 33 int read(char* buffer, int length); 34 35 // Writes a blob to the file. 36 // Returns number of bytes being written on success. -1 otherwise. 37 int write(const URL& blobURL, long long position, int length); 38 39 // Truncates the file to the specified position. 40 // Returns true on success. False otherwise. 41 bool truncate(long long position); 42 43 private: 44 FileStream(); 45 46 PlatformFileHandle m_handle; 47 long long m_bytesProcessed; 48 long long m_totalBytesToRead; 49 };
FileSystem.h
1 WEBCORE_EXPORT bool fileExists(const String&); 2 WEBCORE_EXPORT bool deleteFile(const String&); 3 WEBCORE_EXPORT bool deleteEmptyDirectory(const String&); 4 bool getFileSize(const String&, long long& result); 5 WEBCORE_EXPORT bool getFileModificationTime(const String&, time_t& result); 6 WEBCORE_EXPORT bool getFileCreationTime(const String&, time_t& result); // Not all platforms store file creation time. 7 bool getFileMetadata(const String&, FileMetadata&); 8 WEBCORE_EXPORT String pathByAppendingComponent(const String& path, const String& component); 9 WEBCORE_EXPORT bool makeAllDirectories(const String& path); 10 String homeDirectoryPath(); 11 WEBCORE_EXPORT String pathGetFileName(const String&); 12 WEBCORE_EXPORT String directoryName(const String&); 13 14 WEBCORE_EXPORT void setMetadataURL(String& URLString, const String& referrer, const String& path); 15 16 bool canExcludeFromBackup(); // Returns true if any file can ever be excluded from backup. 17 bool excludeFromBackup(const String&); // Returns true if successful. 18 19 WEBCORE_EXPORT Vector<String> listDirectory(const String& path, const String& filter = String()); 20 21 WEBCORE_EXPORT CString fileSystemRepresentation(const String&); 22 23 inline bool isHandleValid(const PlatformFileHandle& handle) { return handle != invalidPlatformFileHandle; } 24 25 inline double invalidFileTime() { return std::numeric_limits<double>::quiet_NaN(); } 26 inline bool isValidFileTime(double time) { return std::isfinite(time); } 27 28 // Prefix is what the filename should be prefixed with, not the full path. 29 WEBCORE_EXPORT String openTemporaryFile(const String& prefix, PlatformFileHandle&); 30 WEBCORE_EXPORT PlatformFileHandle openFile(const String& path, FileOpenMode); 31 WEBCORE_EXPORT void closeFile(PlatformFileHandle&); 32 // Returns the resulting offset from the beginning of the file if successful, -1 otherwise. 33 long long seekFile(PlatformFileHandle, long long offset, FileSeekOrigin); 34 bool truncateFile(PlatformFileHandle, long long offset); 35 // Returns number of bytes actually read if successful, -1 otherwise. 36 WEBCORE_EXPORT int writeToFile(PlatformFileHandle, const char* data, int length); 37 // Returns number of bytes actually written if successful, -1 otherwise. 38 int readFromFile(PlatformFileHandle, char* data, int length); 39 #if USE(FILE_LOCK) 40 bool lockFile(PlatformFileHandle, FileLockMode); 41 bool unlockFile(PlatformFileHandle); 42 #endif 43 44 // Functions for working with loadable modules. 45 bool unloadModule(PlatformModule); 46 47 // Encode a string for use within a file name. 48 WEBCORE_EXPORT String encodeForFileName(const String&); 49 50 #if USE(CF) 51 RetainPtr<CFURLRef> pathAsURL(const String&); 52 #endif 53 54 #if PLATFORM(GTK) 55 String filenameToString(const char*); 56 String filenameForDisplay(const String&); 57 CString applicationDirectoryPath(); 58 CString sharedResourcesPath(); 59 #endif 60 #if USE(SOUP) 61 uint64_t getVolumeFreeSizeForPath(const char*); 62 #endif 63 64 #if PLATFORM(WIN) 65 String localUserSpecificStorageDirectory(); 66 String roamingUserSpecificStorageDirectory(); 67 #endif 68 69 } // namespace WebCore
HTMLVideoElement.h
1 class HTMLVideoElement final : public HTMLMediaElement { 2 public: 3 static PassRefPtr<HTMLVideoElement> create(const QualifiedName&, Document&, bool); 4 5 WEBCORE_EXPORT unsigned videoWidth() const; 6 WEBCORE_EXPORT unsigned videoHeight() const; 7 8 // Fullscreen 9 void webkitEnterFullscreen(ExceptionCode&); 10 void webkitExitFullscreen(); 11 bool webkitSupportsFullscreen(); 12 bool webkitDisplayingFullscreen(); 13 14 // FIXME: Maintain "FullScreen" capitalization scheme for backwards compatibility. 15 // https://bugs.webkit.org/show_bug.cgi?id=36081 16 void webkitEnterFullScreen(ExceptionCode& ec) { webkitEnterFullscreen(ec); } 17 void webkitExitFullScreen() { webkitExitFullscreen(); } 18 19 #if ENABLE(IOS_AIRPLAY) 20 bool webkitWirelessVideoPlaybackDisabled() const; 21 void setWebkitWirelessVideoPlaybackDisabled(bool); 22 #endif 23 24 #if ENABLE(MEDIA_STATISTICS) 25 // Statistics 26 unsigned webkitDecodedFrameCount() const; 27 unsigned webkitDroppedFrameCount() const; 28 #endif 29 30 // Used by canvas to gain raw pixel access 31 void paintCurrentFrameInContext(GraphicsContext*, const IntRect&); 32 33 PassNativeImagePtr nativeImageForCurrentTime(); 34 35 // Used by WebGL to do GPU-GPU textures copy if possible. 36 // See more details at MediaPlayer::copyVideoTextureToPlatformTexture() defined in Source/WebCore/platform/graphics/MediaPlayer.h. 37 bool copyVideoTextureToPlatformTexture(GraphicsContext3D*, Platform3DObject texture, GC3Dint level, GC3Denum type, GC3Denum internalFormat, bool premultiplyAlpha, bool flipY); 38 39 bool shouldDisplayPosterImage() const { return displayMode() == Poster || displayMode() == PosterWaitingForVideo; } 40 41 URL posterImageURL() const; 42 virtual RenderPtr<RenderElement> createElementRenderer(PassRef<RenderStyle>) override;
浙公网安备 33010602011771号