Changeset 269962 in webkit
- Timestamp:
- Nov 18, 2020 9:45:21 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r269950 r269962 1 2020-11-18 Antoine Quint <graouts@webkit.org> 2 3 Support <source> as a child of <model> to specify the current source 4 https://bugs.webkit.org/show_bug.cgi?id=219080 5 6 Reviewed by Dean Jackson. 7 8 Add a series of tests for the HTMLModelElement.currentSrc property and its relationship with <source> elements. 9 10 * system-preview/model/model-element-source-expected.txt: Added. 11 * system-preview/model/model-element-source.html: Added. 12 1 13 2020-11-18 Commit Queue <commit-queue@webkit.org> 2 14 -
trunk/Source/WebCore/ChangeLog
r269960 r269962 1 2020-11-18 Antoine Quint <graouts@webkit.org> 2 3 Support <source> as a child of <model> to specify the current source 4 https://bugs.webkit.org/show_bug.cgi?id=219080 5 6 Reviewed by Dean Jackson. 7 8 Test: system-preview/model/model-element-source.html 9 10 * html/HTMLModelElement.cpp: 11 (WebCore::HTMLModelElement::sourcesChanged): 12 (WebCore::HTMLModelElement::setSourceURL): 13 (WebCore::HTMLModelElement::didMoveToNewDocument): 14 * html/HTMLModelElement.h: 15 * html/HTMLModelElement.idl: 16 * html/HTMLSourceElement.cpp: 17 (WebCore::HTMLSourceElement::insertedIntoAncestor): 18 (WebCore::HTMLSourceElement::removedFromAncestor): 19 (WebCore::HTMLSourceElement::parseAttribute): 20 1 21 2020-11-18 Chris Dumez <cdumez@apple.com> 2 22 -
trunk/Source/WebCore/html/HTMLModelElement.cpp
r269880 r269962 29 29 #if ENABLE(MODEL_ELEMENT) 30 30 31 #include "HTMLNames.h" 32 #include "HTMLSourceElement.h" 31 33 #include <wtf/IsoMallocInlines.h> 34 #include <wtf/URL.h> 32 35 33 36 namespace WebCore { … … 49 52 } 50 53 54 void HTMLModelElement::sourcesChanged() 55 { 56 if (!document().hasBrowsingContext()) { 57 setSourceURL(URL()); 58 return; 59 } 60 61 for (auto& element : childrenOfType<HTMLSourceElement>(*this)) { 62 // FIXME: for now we use the first valid URL without looking at the mime-type. 63 auto url = element.getNonEmptyURLAttribute(srcAttr); 64 if (url.isValid()) { 65 setSourceURL(url); 66 return; 67 } 68 } 69 70 setSourceURL(URL()); 71 } 72 73 void HTMLModelElement::setSourceURL(const URL& url) 74 { 75 // FIXME: actually do something with that URL now. 76 m_sourceURL = url; 77 } 78 79 void HTMLModelElement::didMoveToNewDocument(Document& oldDocument, Document& newDocument) 80 { 81 HTMLElement::didMoveToNewDocument(oldDocument, newDocument); 82 sourcesChanged(); 83 } 84 51 85 } 52 86 -
trunk/Source/WebCore/html/HTMLModelElement.h
r269880 r269962 38 38 virtual ~HTMLModelElement(); 39 39 40 void sourcesChanged(); 41 const URL& currentSrc() const { return m_sourceURL; } 42 40 43 private: 41 44 HTMLModelElement(const QualifiedName&, Document&); 45 46 void didMoveToNewDocument(Document& oldDocument, Document& newDocument) final; 47 48 void setSourceURL(const URL&); 49 50 URL m_sourceURL; 42 51 }; 43 52 -
trunk/Source/WebCore/html/HTMLModelElement.idl
r269880 r269962 29 29 Exposed=Window, 30 30 ] interface HTMLModelElement : HTMLElement { 31 [URL] readonly attribute USVString currentSrc; 31 32 }; -
trunk/Source/WebCore/html/HTMLSourceElement.cpp
r263345 r269962 41 41 #endif 42 42 43 #if ENABLE(MODEL_ELEMENT) 44 #include "HTMLModelElement.h" 45 #endif 46 43 47 namespace WebCore { 44 48 … … 76 80 if (is<HTMLMediaElement>(*parent)) 77 81 downcast<HTMLMediaElement>(*parent).sourceWasAdded(*this); 82 else 83 #endif 84 #if ENABLE(MODEL_ELEMENT) 85 if (is<HTMLModelElement>(*parent)) 86 downcast<HTMLModelElement>(*parent).sourcesChanged(); 78 87 else 79 88 #endif … … 101 110 else 102 111 #endif 112 #if ENABLE(MODEL_ELEMENT) 113 if (is<HTMLModelElement>(oldParentOfRemovedTree)) 114 downcast<HTMLModelElement>(oldParentOfRemovedTree).sourcesChanged(); 115 else 116 #endif 103 117 if (m_shouldCallSourcesChanged) { 104 118 downcast<HTMLPictureElement>(oldParentOfRemovedTree).sourcesChanged(); … … 171 185 downcast<HTMLPictureElement>(*parent).sourcesChanged(); 172 186 } 187 #if ENABLE(MODEL_ELEMENT) 188 if (name == srcAttr || name == typeAttr) { 189 RefPtr<Element> parent = parentElement(); 190 if (is<HTMLModelElement>(parent)) 191 downcast<HTMLModelElement>(*parent).sourcesChanged(); 192 } 193 #endif 173 194 } 174 195
Note: See TracChangeset
for help on using the changeset viewer.