Changeset 223801 in webkit
- Timestamp:
- Oct 20, 2017 5:03:18 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r223795 r223801 1 2017-10-20 Ryosuke Niwa <rniwa@webkit.org> 2 3 Fix conditions in HTMLSourceElement and HTMLTrackElement's insertedInto and removedFrom 4 https://bugs.webkit.org/show_bug.cgi?id=178607 5 6 Reviewed by Eric Carlson. 7 8 Fixed the conditions in insertedInto and removedFrom of HTMLSourceElement and HTMLTrackElement to be 9 semantically sensisble. Since these elements are only functional when their immediate parents are 10 HTMLMediaElement and HTMLPictureElement, we have to check that its immediate parent changed, not when 11 some of its ancestor had changed by insertion or removal. 12 13 * html/HTMLSourceElement.cpp: 14 (WebCore::HTMLSourceElement::insertedInto): 15 (WebCore::HTMLSourceElement::removedFrom): 16 * html/HTMLTrackElement.cpp: 17 (WebCore::HTMLTrackElement::insertedInto): 18 (WebCore::HTMLTrackElement::removedFrom): 19 1 20 2017-10-20 Keith Miller <keith_miller@apple.com> 2 21 -
trunk/Source/WebCore/html/HTMLSourceElement.cpp
r223685 r223801 67 67 { 68 68 HTMLElement::insertedInto(insertionType, parentOfInsertedTree); 69 // FIXME: This code is wrong if an ancestor of the parent had been inserted.70 if ( auto* parent = parentElement()) {69 RefPtr<Element> parent = parentElement(); 70 if (parent == &parentOfInsertedTree) { 71 71 #if ENABLE(VIDEO) 72 72 if (is<HTMLMediaElement>(*parent)) … … 81 81 82 82 void HTMLSourceElement::removedFrom(RemovalType removalType, ContainerNode& parentOfRemovedTree) 83 { 84 // FIXME: This code is wrong if an ancestor of the parent had been removed. 85 RefPtr<Element> parent = parentElement(); 86 if (!parent && is<Element>(parentOfRemovedTree)) 87 parent = &downcast<Element>(parentOfRemovedTree); 88 if (parent) { 83 { 84 HTMLElement::removedFrom(removalType, parentOfRemovedTree); 85 if (!parentNode() && is<Element>(parentOfRemovedTree)) { 89 86 #if ENABLE(VIDEO) 90 if (is<HTMLMediaElement>( *parent))91 downcast<HTMLMediaElement>( *parent).sourceWasRemoved(*this);87 if (is<HTMLMediaElement>(parentOfRemovedTree)) 88 downcast<HTMLMediaElement>(parentOfRemovedTree).sourceWasRemoved(*this); 92 89 else 93 90 #endif 94 if (is<HTMLPictureElement>( *parent))95 downcast<HTMLPictureElement>( *parent).sourcesChanged();91 if (is<HTMLPictureElement>(parentOfRemovedTree)) 92 downcast<HTMLPictureElement>(parentOfRemovedTree).sourcesChanged(); 96 93 } 97 HTMLElement::removedFrom(removalType, parentOfRemovedTree);98 94 } 99 95 -
trunk/Source/WebCore/html/HTMLTrackElement.cpp
r223685 r223801 81 81 HTMLElement::insertedInto(insertionType, parentOfInsertedTree); 82 82 83 // FIXME: This code is wrong. If HTMLTrackElement can be any descendent of HTMLMediaElement, then check ancestors of parentOfInsertedTree. 84 // If HTMLMediaElement only supports HTMLTrackElement which is an immediate child, then check parentNode() instead. 85 if (is<HTMLMediaElement>(parentOfInsertedTree)) 83 if (parentNode() == &parentOfInsertedTree && is<HTMLMediaElement>(parentOfInsertedTree)) { 86 84 downcast<HTMLMediaElement>(parentOfInsertedTree).didAddTextTrack(*this); 87 88 // Since we've moved to a new parent, we may now be able to load. 89 scheduleLoad(); 85 scheduleLoad(); 86 } 90 87 91 88 return InsertedIntoResult::Done; … … 96 93 HTMLElement::removedFrom(removalType, parentOfRemovedTree); 97 94 98 // FIXME: This code is wrong. If HTMLTrackElement can be any descendent of HTMLMediaElement, then check ancestors of parentOfInsertedTree. 99 // If HTMLMediaElement only supports HTMLTrackElement which is an immediate child, then check parentNode() instead. 100 if (is<HTMLMediaElement>(parentOfRemovedTree)) 95 if (!parentNode() && is<HTMLMediaElement>(parentOfRemovedTree)) 101 96 downcast<HTMLMediaElement>(parentOfRemovedTree).didRemoveTextTrack(*this); 102 97 }
Note: See TracChangeset
for help on using the changeset viewer.