Changeset 220052 in webkit
- Timestamp:
- Jul 30, 2017, 2:44:01 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/LayoutTests/ChangeLog ¶
r220050 r220052 1 2017-07-30 Darin Adler <darin@apple.com> 2 3 Remove code in HTMLObjectElement attribute parsing that forces style resolution and layout 4 https://bugs.webkit.org/show_bug.cgi?id=130653 5 6 Reviewed by Antti Koivisto. 7 8 * fast/text/international/embed-bidi-style-in-isolate-crash.html: Removed onerror attribute 9 in the audio element in this test. The error event does fire during the test, which causes 10 the test to fail. Before, the test was prematurely exiting before the load failed, preventing 11 the test from failing, but also meaning we didn't finish running the test. 12 13 * imported/blink/fast/dom/Window/open-window-features-fuzz.html: Use waitUntilDone and 14 notifyDone to prevent the test from exiting prematurely. Use a URL that won't trigger loading 15 outside the web browser; the URL is not what mattered to this test. Before, the test was 16 prematurely exiting before the test ran. Note also, that I don't think this is testing 17 much effectively; not sure we are getting any benefit from this test since before it was 18 not really running to completion anyway. 19 20 * media/event-queue-crash-expected.txt: Updated expectations to expect syntax error. Before 21 there was a race and often the test exited before the syntax error could be logged. 22 23 * platform/mac/TestExpectations: Removed flakiness expectation from the 24 media/event-queue-crash.html test. What made it flaky was a race with the load event, 25 and that race should be fixed by the change to FrameLoader::checkLoadCompleteForThisFrame. 26 The same race existed on all platforms, not just Mac, so this flakiness expectation should 27 be in the main TextExpectations file if anywhere. But I believe it is not needed at all. 28 For media/modern-media-controls/media-documents/background-color-and-centering.html, 29 added image failure expectation because under modern WebKit on Mac the image now captures 30 the upper left hand corner of the controls overlay. Still seems to pass on iOS and the bug 31 this was created for was iOS-specific, so should be OK for now. 32 33 * webarchive/loading/video-in-webarchive-expected.txt: Updated. The old result shows evidence 34 of a premature load event, fixed by the change to FrameLoader::checkLoadCompleteForThisFrame. 35 1 36 2017-07-30 Sam Weinig <sam@webkit.org> 2 37 -
TabularUnified trunk/LayoutTests/fast/text/international/embed-bidi-style-in-isolate-crash.html ¶
r154281 r220052 3 3 <em dir="ltr"> 4 4 <embed></embed> 5 <audio onerror="open()"src="foo"></audio>5 <audio src="foo"></audio> 6 6 </em> 7 7 </bdi> -
TabularUnified trunk/LayoutTests/imported/blink/fast/dom/Window/open-window-features-fuzz.html ¶
r190629 r220052 2 2 3 3 if (window.testRunner) { 4 testRunner.waitUntilDone(); 4 5 testRunner.dumpAsText(); 5 6 testRunner.setCanOpenWindows(); … … 7 8 8 9 function handler() { 9 var url = ' rV1IRI:I';10 var url = 'file:///'; 10 11 var name = 'listing'; 11 12 var features = unescape('%udc10%u0130%u07b2%u037c%ufb3b%u3bf0%u3e4d%u16c3%u3c4f%u3fe7%u12b3%ub73c%u6c25%u938d%u645c%u2470%udbc3%ud2d4'); 12 13 window.open(url, name, features); 14 if (window.testRunner) 15 testRunner.notifyDone(); 13 16 } 14 17 -
TabularUnified trunk/LayoutTests/media/event-queue-crash-expected.txt ¶
r124843 r220052 1 CONSOLE MESSAGE: line 34: SyntaxError: Unexpected token '}'. Expected '(' to start an 'if' condition. 1 2 When an element containing video is removed, WebKit should not crash. 2 3 -
TabularUnified trunk/LayoutTests/platform/mac/TestExpectations ¶
r219983 r220052 868 868 webkit.org/b/142152 media/track/track-in-band-cues-added-once.html [ Failure Timeout ] 869 869 webkit.org/b/147944 media/video-seek-to-current-time.html [ Pass Failure ] 870 webkit.org/b/114177 media/event-queue-crash.html [ Pass Failure ]871 870 webkit.org/b/150408 http/tests/media/video-load-suspend.html [ Pass Timeout ] 872 871 webkit.org/b/155956 media/track/track-remove-track.html [ Pass Failure Timeout ] … … 1603 1602 media/modern-media-controls/scrubber-support/ipad [ Skip ] 1604 1603 1604 # This test relies on the control overlay not being visible in the top left. But the test now fails on Mac because 1605 # the image is dumped after the video is loaded and the control overlay is displayed. It seems the test still works 1606 # on iOS, and the bug it was created to regression-test was iOS-only, so there is no hurry to make it work on Mac. 1607 media/modern-media-controls/media-documents/background-color-and-centering.html [ Pass ImageOnlyFailure ] 1608 1605 1609 # These tests use Picture-in-Picture which isn't supported on El Capitan. 1606 1610 [ ElCapitan ] media/modern-media-controls/placard-support/placard-support-pip.html [ Skip ] -
TabularUnified trunk/LayoutTests/webarchive/loading/video-in-webarchive-expected.txt ¶
r143630 r220052 11 11 frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame 12 12 frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame 13 frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame 14 main frame - didHandleOnloadEventsForFrame 13 15 frame "<!--framePath //<!--frame0-->-->" - didFailLoadWithError 14 16 main frame - didFinishLoadForFrame 15 frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame16 17 -
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r220050 r220052 1 2017-07-30 Darin Adler <darin@apple.com> 2 3 Remove code in HTMLObjectElement attribute parsing that forces style resolution and layout 4 https://bugs.webkit.org/show_bug.cgi?id=130653 5 6 Reviewed by Antti Koivisto. 7 8 Also fixes a bug where load events are delivered prematurely in some cases 9 when an object, embed, frame, or iframe element is still loading. 10 11 * dom/Document.cpp: 12 (WebCore::Document::loadEventDelayTimerFired): Added a call to 13 FrameLoader::checkLoadComplete. Goes along with the change to 14 FrameLoader::checkLoadCompleteForThisFrame, which now respects the 15 isDelayingLoadEvent flag. 16 17 * html/HTMLAppletElement.cpp: 18 (WebCore::HTMLAppletElement::HTMLAppletElement): Removed the createdByParser argument, 19 no longer needed by the base class. 20 (WebCore::HTMLAppletElement::create): Added call to finishCreating, which is now part of 21 the process of creating any object in a class derived from HTMLPlugInImageElement. 22 (WebCore::HTMLAppletElement::updateWidget): Rearranged logic so setNeedsWidgetUpdate 23 is only called when it's becoming false; avoids a false/true/false round trip that can 24 cause trouble. 25 * html/HTMLAppletElement.h: Updated for the above. 26 27 * html/HTMLEmbedElement.cpp: 28 (WebCore::HTMLEmbedElement::HTMLEmbedElement): Removed the createdByParser argument, 29 no longer needed by the base class. 30 (WebCore::HTMLEmbedElement::create): Added call to finishCreating, which is now part of 31 the process of creating any object in a class derived from HTMLPlugInImageElement. 32 (WebCore::HTMLEmbedElement::parseAttribute): Changed srcAttr to call 33 updateImageLoaderWithNewURLSoon to do the image loading logic. 34 (WebCore::HTMLEmbedElement::updateWidget): Rearranged logic so setNeedsWidgetUpdate 35 is only called when it's becoming false; avoids a false/true/false round trip that can 36 cause trouble. 37 * html/HTMLEmbedElement.h: Updated for the above. 38 39 * html/HTMLMediaElement.cpp: 40 (WebCore::HTMLMediaElement::setReadyState): Call setShouldDelayLoadEvent(false) when 41 transitioning to HAVE_CURRENT_DATA (or beyond), even if we have already fired a loadeddata 42 event in the past. This matches what the HTML specification calls for, but only if you 43 read it carefully. Without this change, and with the more complete implementation of 44 load event delay below, one of the regression tests hangs because are permanently stuck 45 dealying load events. Also added a FIXME about other code that likely has a similar 46 problem; the symptom is likely to be subtle and minor, though. 47 48 * html/HTMLObjectElement.cpp: 49 (WebCore::HTMLObjectElement::HTMLObjectElement): Removed the createdByParser argument, 50 no longer needed by the base class. 51 (WebCore::HTMLObjectElement::create): Added call to finishCreating, which is now part of 52 the process of creating any object in a class derived from HTMLPlugInImageElement. 53 (WebCore::HTMLObjectElement::parseAttribute): Changed dataAttr to use 54 updateImageLoaderWithNewURLSoon. Explicitly call scheduleUpdateForAfterStyleResolution 55 since just calling invalidateStyleAndRenderersForSubtree alone is no longer sufficient. 56 (WebCore::HTMLObjectElement::updateWidget): Rearranged logic so setNeedsWidgetUpdate 57 is only called when it's becoming false; avoids a false/true/false round trip that can 58 cause trouble. 59 (WebCore::HTMLObjectElement::childrenChanged): Added calls to the new 60 scheduleUpdateForAfterStyleResolution since invalidating style is no longer sufficient. 61 (WebCore::HTMLObjectElement::renderFallbackContent): Remove the call to 62 updateStyleIfNeeded. This is the main change that the title of this bug refers to. 63 * html/HTMLObjectElement.h: Updated for the above. Also removed the 64 clearUseFallbackContent function because it's clearer to set the data member in 65 line at the single call site in HTMLObjectElement::parseAttribute. 66 67 * html/HTMLPlugInImageElement.cpp: 68 (WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement): Removed the createdByParser 69 argument; no need to set an m_needsWidgetUpdate flag differently for parser cases now. 70 (WebCore::HTMLPlugInImageElement::finshCreating): Added. To be called after creating 71 an element to do work that can't be done in a constructor. 72 (WebCore::HTMLPlugInImageElement::didRecalcStyle): Added. Calls the new 73 scheduleUpdateForAfterStyleResolution function. 74 (WebCore::HTMLPlugInImageElement::didAttachRenderers): Moved all the logic from this 75 function into scheduleUpdateForAfterStyleResolution. Also added a call through to the base 76 class; cleans things up, even though it's just an assertion. 77 (WebCore::HTMLPlugInImageElement::willDetachRenderers): Removed the call to 78 setNeedsWidgetUpdate(true) here; no longer needed because the new logic already 79 does the right thing in this case. 80 (WebCore::HTMLPlugInImageElement::updateWidgetIfNecessary): Deleted. Now handled by 81 updateAfterStyleResolution instead. 82 (WebCore::HTMLPlugInImageElement::finishParsingChildren): Deleted. Handling updates 83 after parsing all the children now comes naturally out of the new implementation. 84 (WebCore::HTMLPlugInImageElement::scheduleUpdateForAfterStyleResolution): Added. 85 Schedules a call to updateAfterStyleResolution when needed, and equally importantly, 86 increments the load event delay count to make sure that loads that are part of that 87 update can participate in decision about whether it's time for the load event. 88 (WebCore::HTMLPlugInImageElement::updateAfterStyleResolution): Added. 89 Combines updateWidgetIfNecessary and startLoadingImage, and also deals with the new 90 m_needsImageReload boolean in cases where no actual loading is done. 91 (WebCore::HTMLPlugInImageElement::didMoveToNewDocument): Update load event delay 92 count when moving an element that is in the middle of loading. This lets the 93 updateAfterStyleResolution function do the right thing even when the element is 94 moved without leaving anything stuck in a strange state. 95 (WebCore::HTMLPlugInImageElement::prepareForDocumentSuspension): Call the new 96 scheduleUpdateForAfterStyleResolution since invalidating style is no longer sufficient. 97 (WebCore::HTMLPlugInImageElement::startLoadingImage): Deleted. Now handled by 98 updateAfterStyleResolution instead. 99 (WebCore::HTMLPlugInImageElement::updateImageLoaderWithNewURLSoon): Added. Does all 100 the right things for when an image URL is changed; for use by the concrete derived classes. 101 * html/HTMLPlugInImageElement.h: Updated for above changes. Also made m_imageLoader 102 private rather than protected, and added the two new boolean data members. 103 104 * html/HTMLTagNames.in: Removed unneeded constructorNeedsCreatedByParser flags for 105 applet, embed, and object. 106 107 * loader/DocumentLoader.cpp: 108 (WebCore::DocumentLoader::isLoadingInAPISense): Return true if the document is 109 delaying a load event. 110 111 * loader/FrameLoader.cpp: 112 (WebCore::FrameLoader::checkLoadCompleteForThisFrame): Don't do any work if 113 isDelayingLoadEvent is true; otherwise this function can have a side effect of 114 triggering the load event. 115 (WebCore::FrameLoader::detachFromParent): Schedule a checkLoadComplete here, too, not 116 just a checkCompleted. This is relevant if the frame we are detaching was delaying 117 a load event because it no longer will be and so the load might be complete. 118 1 119 2017-07-30 Sam Weinig <sam@webkit.org> 2 120 -
TabularUnified trunk/Source/WebCore/dom/Document.cpp ¶
r219954 r220052 5161 5161 m_documentTiming.domContentLoadedEventEnd = MonotonicTime::now(); 5162 5162 5163 if (RefPtr<Frame> f =frame()) {5163 if (RefPtr<Frame> frame = this->frame()) { 5164 5164 // FrameLoader::finishedParsing() might end up calling Document::implicitClose() if all 5165 5165 // resource loads are complete. HTMLObjectElements can start loading their resources from … … 5171 5171 updateStyleIfNeeded(); 5172 5172 5173 f->loader().finishedParsing(); 5174 5175 InspectorInstrumentation::domContentLoadedEventFired(*f); 5173 frame->loader().finishedParsing(); 5174 InspectorInstrumentation::domContentLoadedEventFired(*frame); 5176 5175 } 5177 5176 … … 6224 6223 void Document::loadEventDelayTimerFired() 6225 6224 { 6225 // FIXME: Should the call to FrameLoader::checkLoadComplete be moved inside Document::checkCompleted? 6226 // FIXME: Should this also call DocumentLoader::checkLoadComplete? 6227 // FIXME: Not obvious why checkCompleted needs to go first. The order these are called is 6228 // visible to WebKit clients, but it's more like a race than a well-defined relationship. 6226 6229 checkCompleted(); 6230 if (auto* frame = this->frame()) 6231 frame->loader().checkLoadComplete(); 6227 6232 } 6228 6233 … … 6607 6612 return; 6608 6613 6609 // FIXME: We should call loader()->checkLoadComplete()as well here,6614 // FIXME: We should call DocumentLoader::checkLoadComplete as well here, 6610 6615 // but it seems to cause http/tests/security/feed-urls-from-remote.html 6611 6616 // to timeout on Mac WK1; see http://webkit.org/b/110554 and http://webkit.org/b/110401. -
TabularUnified trunk/Source/WebCore/html/HTMLAppletElement.cpp ¶
r211964 r220052 41 41 using namespace HTMLNames; 42 42 43 HTMLAppletElement::HTMLAppletElement(const QualifiedName& tagName, Document& document, bool createdByParser)44 : HTMLPlugInImageElement(tagName, document , createdByParser)43 inline HTMLAppletElement::HTMLAppletElement(const QualifiedName& tagName, Document& document) 44 : HTMLPlugInImageElement(tagName, document) 45 45 { 46 46 ASSERT(hasTagName(appletTag)); 47 47 48 m_serviceType = "application/x-java-applet";48 m_serviceType = ASCIILiteral { "application/x-java-applet" }; 49 49 } 50 50 51 Ref<HTMLAppletElement> HTMLAppletElement::create(const QualifiedName& tagName, Document& document , bool createdByParser)51 Ref<HTMLAppletElement> HTMLAppletElement::create(const QualifiedName& tagName, Document& document) 52 52 { 53 return adoptRef(*new HTMLAppletElement(tagName, document, createdByParser)); 53 auto result = adoptRef(*new HTMLAppletElement(tagName, document)); 54 result->finishCreating(); 55 return result; 54 56 } 55 57 … … 105 107 void HTMLAppletElement::updateWidget(CreatePlugins createPlugins) 106 108 { 107 setNeedsWidgetUpdate(false);108 109 // FIXME: This should ASSERT isFinishedParsingChildren() instead. 109 if (!isFinishedParsingChildren()) 110 if (!isFinishedParsingChildren()) { 111 setNeedsWidgetUpdate(false); 110 112 return; 113 } 111 114 112 115 #if PLATFORM(IOS) … … 116 119 // See http://trac.webkit.org/changeset/25128 and 117 120 // plugins/netscape-plugin-setwindow-size.html 118 if (createPlugins == CreatePlugins::No) { 119 // Ensure updateWidget() is called again during layout to create the plug-in. 120 setNeedsWidgetUpdate(true); 121 if (createPlugins == CreatePlugins::No) 121 122 return; 122 } 123 124 setNeedsWidgetUpdate(false); 123 125 124 126 RenderEmbeddedObject* renderer = renderEmbeddedObject(); -
TabularUnified trunk/Source/WebCore/html/HTMLAppletElement.h ¶
r208179 r220052 29 29 class HTMLAppletElement final : public HTMLPlugInImageElement { 30 30 public: 31 static Ref<HTMLAppletElement> create(const QualifiedName&, Document& , bool createdByParser);31 static Ref<HTMLAppletElement> create(const QualifiedName&, Document&); 32 32 33 33 private: 34 HTMLAppletElement(const QualifiedName&, Document& , bool createdByParser);34 HTMLAppletElement(const QualifiedName&, Document&); 35 35 36 36 void parseAttribute(const QualifiedName&, const AtomicString&) final; -
TabularUnified trunk/Source/WebCore/html/HTMLEmbedElement.cpp ¶
r212350 r220052 44 44 using namespace HTMLNames; 45 45 46 inline HTMLEmbedElement::HTMLEmbedElement(const QualifiedName& tagName, Document& document , bool createdByParser)47 : HTMLPlugInImageElement(tagName, document , createdByParser)46 inline HTMLEmbedElement::HTMLEmbedElement(const QualifiedName& tagName, Document& document) 47 : HTMLPlugInImageElement(tagName, document) 48 48 { 49 49 ASSERT(hasTagName(embedTag)); 50 50 } 51 51 52 Ref<HTMLEmbedElement> HTMLEmbedElement::create(const QualifiedName& tagName, Document& document, bool createdByParser) 53 { 54 return adoptRef(*new HTMLEmbedElement(tagName, document, createdByParser)); 52 Ref<HTMLEmbedElement> HTMLEmbedElement::create(const QualifiedName& tagName, Document& document) 53 { 54 auto result = adoptRef(*new HTMLEmbedElement(tagName, document)); 55 result->finishCreating(); 56 return result; 55 57 } 56 58 57 59 Ref<HTMLEmbedElement> HTMLEmbedElement::create(Document& document) 58 60 { 59 return adoptRef(*new HTMLEmbedElement(embedTag, document, false));61 return create(embedTag, document); 60 62 } 61 63 … … 113 115 } else if (name == codeAttr) { 114 116 m_url = stripLeadingAndTrailingHTMLSpaces(value); 115 // FIXME: Why no call to the image loader?117 // FIXME: Why no call to updateImageLoaderWithNewURLSoon? 116 118 // FIXME: If both code and src attributes are specified, last one parsed/changed wins. That can't be right! 117 119 } else if (name == srcAttr) { 118 120 m_url = stripLeadingAndTrailingHTMLSpaces(value); 119 document().updateStyleIfNeeded(); 120 if (renderer() && isImageType()) { 121 if (!m_imageLoader) 122 m_imageLoader = std::make_unique<HTMLImageLoader>(*this); 123 m_imageLoader->updateFromElementIgnoringPreviousError(); 124 } 121 updateImageLoaderWithNewURLSoon(); 125 122 // FIXME: If both code and src attributes are specified, last one parsed/changed wins. That can't be right! 126 123 } else … … 145 142 ASSERT(!renderEmbeddedObject()->isPluginUnavailable()); 146 143 ASSERT(needsWidgetUpdate()); 147 setNeedsWidgetUpdate(false); 148 149 if (m_url.isEmpty() && m_serviceType.isEmpty()) 150 return; 144 145 if (m_url.isEmpty() && m_serviceType.isEmpty()) { 146 setNeedsWidgetUpdate(false); 147 return; 148 } 151 149 152 150 // Note these pass m_url and m_serviceType to allow better code sharing with 153 151 // <object> which modifies url and serviceType before calling these. 154 if (!allowedToLoadFrameURL(m_url)) 155 return; 152 if (!allowedToLoadFrameURL(m_url)) { 153 setNeedsWidgetUpdate(false); 154 return; 155 } 156 156 157 157 // FIXME: It's sadness that we have this special case here. 158 158 // See http://trac.webkit.org/changeset/25128 and 159 159 // plugins/netscape-plugin-setwindow-size.html 160 if (createPlugins == CreatePlugins::No && wouldLoadAsPlugIn(m_url, m_serviceType)) { 161 // Ensure updateWidget() is called again during layout to create the Netscape plug-in. 162 setNeedsWidgetUpdate(true); 163 return; 164 } 160 if (createPlugins == CreatePlugins::No && wouldLoadAsPlugIn(m_url, m_serviceType)) 161 return; 162 163 setNeedsWidgetUpdate(false); 165 164 166 165 // FIXME: These should be joined into a PluginParameters class. -
TabularUnified trunk/Source/WebCore/html/HTMLEmbedElement.h ¶
r208658 r220052 30 30 public: 31 31 static Ref<HTMLEmbedElement> create(Document&); 32 static Ref<HTMLEmbedElement> create(const QualifiedName&, Document& , bool createdByParser);32 static Ref<HTMLEmbedElement> create(const QualifiedName&, Document&); 33 33 34 34 private: 35 HTMLEmbedElement(const QualifiedName&, Document& , bool createdByParser);35 HTMLEmbedElement(const QualifiedName&, Document&); 36 36 37 37 void parseAttribute(const QualifiedName&, const AtomicString&) final; -
TabularUnified trunk/Source/WebCore/html/HTMLMediaElement.cpp ¶
r220035 r220052 2416 2416 bool shouldUpdateDisplayState = false; 2417 2417 2418 if (m_readyState >= HAVE_CURRENT_DATA && oldState < HAVE_CURRENT_DATA && !m_haveFiredLoadedData) { 2419 m_haveFiredLoadedData = true; 2420 shouldUpdateDisplayState = true; 2421 scheduleEvent(eventNames().loadeddataEvent); 2418 if (m_readyState >= HAVE_CURRENT_DATA && oldState < HAVE_CURRENT_DATA) { 2419 if (!m_haveFiredLoadedData) { 2420 m_haveFiredLoadedData = true; 2421 scheduleEvent(eventNames().loadeddataEvent); 2422 // FIXME: It's not clear that it's correct to skip these two operations just 2423 // because m_haveFiredLoadedData is already true. At one time we were skipping 2424 // the call to setShouldDelayLoadEvent, which was definitely incorrect. 2425 shouldUpdateDisplayState = true; 2426 applyMediaFragmentURI(); 2427 } 2422 2428 setShouldDelayLoadEvent(false); 2423 applyMediaFragmentURI();2424 2429 } 2425 2430 -
TabularUnified trunk/Source/WebCore/html/HTMLObjectElement.cpp ¶
r219858 r220052 61 61 using namespace HTMLNames; 62 62 63 inline HTMLObjectElement::HTMLObjectElement(const QualifiedName& tagName, Document& document, HTMLFormElement* form , bool createdByParser)64 : HTMLPlugInImageElement(tagName, document , createdByParser)63 inline HTMLObjectElement::HTMLObjectElement(const QualifiedName& tagName, Document& document, HTMLFormElement* form) 64 : HTMLPlugInImageElement(tagName, document) 65 65 , FormAssociatedElement(form) 66 66 { … … 68 68 } 69 69 70 inline HTMLObjectElement::~HTMLObjectElement() 71 { 72 } 73 74 Ref<HTMLObjectElement> HTMLObjectElement::create(const QualifiedName& tagName, Document& document, HTMLFormElement* form, bool createdByParser) 75 { 76 return adoptRef(*new HTMLObjectElement(tagName, document, form, createdByParser)); 70 Ref<HTMLObjectElement> HTMLObjectElement::create(const QualifiedName& tagName, Document& document, HTMLFormElement* form) 71 { 72 auto result = adoptRef(*new HTMLObjectElement(tagName, document, form)); 73 result->finishCreating(); 74 return result; 77 75 } 78 76 … … 113 111 } else if (name == dataAttr) { 114 112 m_url = stripLeadingAndTrailingHTMLSpaces(value); 115 document().updateStyleIfNeeded();116 if (isImageType() && renderer()) {117 if (!m_imageLoader)118 m_imageLoader = std::make_unique<HTMLImageLoader>(*this);119 m_imageLoader->updateFromElementIgnoringPreviousError();120 }121 113 invalidateRenderer = !hasAttributeWithoutSynchronization(classidAttr); 122 114 setNeedsWidgetUpdate(true); 115 updateImageLoaderWithNewURLSoon(); 123 116 } else if (name == classidAttr) { 124 117 invalidateRenderer = true; … … 130 123 return; 131 124 132 clearUseFallbackContent(); 125 m_useFallbackContent = false; 126 scheduleUpdateForAfterStyleResolution(); 133 127 invalidateStyleAndRenderersForSubtree(); 134 128 } … … 216 210 } 217 211 218 219 212 bool HTMLObjectElement::hasFallbackContent() const 220 213 { … … 272 265 ASSERT(!renderEmbeddedObject()->isPluginUnavailable()); 273 266 ASSERT(needsWidgetUpdate()); 274 setNeedsWidgetUpdate(false); 267 275 268 // FIXME: This should ASSERT isFinishedParsingChildren() instead. 276 if (!isFinishedParsingChildren()) 277 return; 269 if (!isFinishedParsingChildren()) { 270 setNeedsWidgetUpdate(false); 271 return; 272 } 278 273 279 274 // FIXME: I'm not sure it's ever possible to get into updateWidget during a 280 275 // removal, but just in case we should avoid loading the frame to prevent 281 276 // security bugs. 282 if (!SubframeLoadingDisabler::canLoadFrame(*this)) 283 return; 277 if (!SubframeLoadingDisabler::canLoadFrame(*this)) { 278 setNeedsWidgetUpdate(false); 279 return; 280 } 284 281 285 282 String url = this->url(); … … 292 289 293 290 // Note: url is modified above by parametersForPlugin. 294 if (!allowedToLoadFrameURL(url)) 295 return; 291 if (!allowedToLoadFrameURL(url)) { 292 setNeedsWidgetUpdate(false); 293 return; 294 } 296 295 297 296 // FIXME: It's sadness that we have this special case here. 298 297 // See http://trac.webkit.org/changeset/25128 and 299 298 // plugins/netscape-plugin-setwindow-size.html 300 if (createPlugins == CreatePlugins::No && wouldLoadAsPlugIn(url, serviceType)) { 301 // Ensure updateWidget() is called again during layout to create the Netscape plug-in. 302 setNeedsWidgetUpdate(true); 303 return; 304 } 299 if (createPlugins == CreatePlugins::No && wouldLoadAsPlugIn(url, serviceType)) 300 return; 301 302 setNeedsWidgetUpdate(false); 305 303 306 304 Ref<HTMLObjectElement> protectedThis(*this); // beforeload and plugin loading can make arbitrary DOM mutations. … … 339 337 if (isConnected() && !m_useFallbackContent) { 340 338 setNeedsWidgetUpdate(true); 339 scheduleUpdateForAfterStyleResolution(); 341 340 invalidateStyleForSubtree(); 342 341 } … … 362 361 return; 363 362 363 scheduleUpdateForAfterStyleResolution(); 364 364 invalidateStyleAndRenderersForSubtree(); 365 365 … … 376 376 377 377 m_useFallbackContent = true; 378 379 // This was added to keep Acid 2 non-flaky. A style recalc is required to make fallback resources load.380 // Without forcing, this may happen after all the other resources have been loaded and the document is already381 // considered complete. FIXME: Would be better to address this with incrementLoadEventDelayCount instead382 // or disentangle loading from style entirely.383 document().updateStyleIfNeeded();384 378 } 385 379 … … 517 511 bool HTMLObjectElement::canContainRangeEndPoint() const 518 512 { 519 // Call through to HTMLElement because we need to skip HTMLPlugInElement 520 // when calling through to the derived class since returns false unconditionally. 521 // An object element with fallback content should basically be treated like 522 // a generic HTML element. 513 // Call through to HTMLElement because HTMLPlugInElement::canContainRangeEndPoint 514 // returns false unconditionally. An object element using fallback content is 515 // treated like a generic HTML element. 523 516 return m_useFallbackContent && HTMLElement::canContainRangeEndPoint(); 524 517 } -
TabularUnified trunk/Source/WebCore/html/HTMLObjectElement.h ¶
r219858 r220052 32 32 class HTMLObjectElement final : public HTMLPlugInImageElement, public FormAssociatedElement { 33 33 public: 34 static Ref<HTMLObjectElement> create(const QualifiedName&, Document&, HTMLFormElement*, bool createdByParser); 35 virtual ~HTMLObjectElement(); 34 static Ref<HTMLObjectElement> create(const QualifiedName&, Document&, HTMLFormElement*); 36 35 37 36 bool isExposed() const { return m_isExposed; } … … 58 57 59 58 private: 60 HTMLObjectElement(const QualifiedName&, Document&, HTMLFormElement* , bool createdByParser);59 HTMLObjectElement(const QualifiedName&, Document&, HTMLFormElement*); 61 60 62 61 void parseAttribute(const QualifiedName&, const AtomicString&) final; … … 88 87 bool shouldAllowQuickTimeClassIdQuirk(); 89 88 bool hasValidClassId(); 90 void clearUseFallbackContent() { m_useFallbackContent = false; }91 89 92 90 void refFormAssociatedElement() final { ref(); } -
TabularUnified trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp ¶
r218794 r220052 93 93 }; 94 94 95 HTMLPlugInImageElement::HTMLPlugInImageElement(const QualifiedName& tagName, Document& document , bool createdByParser)95 HTMLPlugInImageElement::HTMLPlugInImageElement(const QualifiedName& tagName, Document& document) 96 96 : HTMLPlugInElement(tagName, document) 97 , m_needsWidgetUpdate(!createdByParser) // Set true in finishParsingChildren.98 97 , m_simulatedMouseClickTimer(*this, &HTMLPlugInImageElement::simulatedMouseClickTimerFired, simulatedMouseClickTimerDelay) 99 98 , m_removeSnapshotTimer(*this, &HTMLPlugInImageElement::removeSnapshotTimerFired) … … 101 100 { 102 101 setHasCustomStyleResolveCallbacks(); 102 } 103 104 void HTMLPlugInImageElement::finishCreating() 105 { 106 scheduleUpdateForAfterStyleResolution(); 103 107 } 104 108 … … 206 210 // FIXME: There shoudn't be need to force render tree reconstruction here. 207 211 // It is only done because loading and load event dispatching is tied to render tree construction. 208 if (!useFallbackContent() && needsWidgetUpdate() && renderer() && !isImageType() && (displayState() != DisplayingSnapshot))212 if (!useFallbackContent() && needsWidgetUpdate() && renderer() && !isImageType() && displayState() != DisplayingSnapshot) 209 213 invalidateStyleAndRenderersForSubtree(); 210 214 } 211 215 216 void HTMLPlugInImageElement::didRecalcStyle(Style::Change styleChange) 217 { 218 scheduleUpdateForAfterStyleResolution(); 219 220 HTMLPlugInElement::didRecalcStyle(styleChange); 221 } 222 212 223 void HTMLPlugInImageElement::didAttachRenderers() 213 224 { 214 if (!isImageType()) { 215 RefPtr<HTMLPlugInImageElement> element = this; 216 Style::queuePostResolutionCallback([element]{ 217 element->updateWidgetIfNecessary(); 218 }); 219 return; 220 } 221 if (!renderer() || useFallbackContent()) 222 return; 223 224 // Image load might complete synchronously and cause us to re-enter. 225 RefPtr<HTMLPlugInImageElement> element = this; 226 Style::queuePostResolutionCallback([element]{ 227 element->startLoadingImage(); 228 }); 225 m_needsWidgetUpdate = true; 226 scheduleUpdateForAfterStyleResolution(); 227 228 HTMLPlugInElement::didAttachRenderers(); 229 229 } 230 230 231 231 void HTMLPlugInImageElement::willDetachRenderers() 232 232 { 233 // FIXME: Because of the insanity that is HTMLPlugInImageElement::willRecalcStyle,234 // we can end up detaching during an attach() call, before we even have a235 // renderer. In that case, don't mark the widget for update.236 if (renderer() && !useFallbackContent()) {237 // Update the widget the next time we attach (detaching destroys the plugin).238 setNeedsWidgetUpdate(true);239 }240 241 233 auto* widget = pluginWidget(PluginLoadingPolicy::DoNotLoad); 242 234 if (is<PluginViewBase>(widget)) … … 246 238 } 247 239 248 void HTMLPlugInImageElement::updateWidgetIfNecessary() 249 { 250 document().updateStyleIfNeeded(); 251 252 if (!needsWidgetUpdate() || useFallbackContent() || isImageType()) 253 return; 254 255 if (!renderEmbeddedObject() || renderEmbeddedObject()->isPluginUnavailable()) 256 return; 257 258 updateWidget(CreatePlugins::No); 259 } 260 261 void HTMLPlugInImageElement::finishParsingChildren() 262 { 263 HTMLPlugInElement::finishParsingChildren(); 264 if (useFallbackContent()) 265 return; 266 267 // HTMLObjectElement needs to delay widget updates until after all children are parsed, 268 // For HTMLEmbedElement this delay is unnecessary, but there is no harm in doing the same. 269 setNeedsWidgetUpdate(true); 270 if (isConnected()) 271 invalidateStyleForSubtree(); 240 void HTMLPlugInImageElement::scheduleUpdateForAfterStyleResolution() 241 { 242 if (m_hasUpdateScheduledForAfterStyleResolution) 243 return; 244 245 document().incrementLoadEventDelayCount(); 246 247 m_hasUpdateScheduledForAfterStyleResolution = true; 248 249 Style::queuePostResolutionCallback([protectedThis = makeRef(*this)] { 250 protectedThis->updateAfterStyleResolution(); 251 }); 252 } 253 254 void HTMLPlugInImageElement::updateAfterStyleResolution() 255 { 256 m_hasUpdateScheduledForAfterStyleResolution = false; 257 258 // Do this after style resolution, since the image or widget load might complete synchronously 259 // and cause us to re-enter otherwise. Also, we can't really answer the question "do I have a renderer" 260 // accurately until after style resolution. 261 262 if (renderer() && !useFallbackContent()) { 263 if (isImageType()) { 264 if (!m_imageLoader) 265 m_imageLoader = std::make_unique<HTMLImageLoader>(*this); 266 if (m_needsImageReload) 267 m_imageLoader->updateFromElementIgnoringPreviousError(); 268 else 269 m_imageLoader->updateFromElement(); 270 } else { 271 if (needsWidgetUpdate() && renderEmbeddedObject() && !renderEmbeddedObject()->isPluginUnavailable()) 272 updateWidget(CreatePlugins::No); 273 } 274 } 275 276 // Either we reloaded the image just now, or we had some reason not to. 277 // Either way, clear the flag now, since we don't need to remember to try again. 278 m_needsImageReload = false; 279 280 document().decrementLoadEventDelayCount(); 272 281 } 273 282 … … 283 292 m_imageLoader->elementDidMoveToNewDocument(); 284 293 294 if (m_hasUpdateScheduledForAfterStyleResolution) { 295 oldDocument.decrementLoadEventDelayCount(); 296 newDocument.incrementLoadEventDelayCount(); 297 } 298 285 299 HTMLPlugInElement::didMoveToNewDocument(oldDocument, newDocument); 286 300 } … … 296 310 void HTMLPlugInImageElement::resumeFromDocumentSuspension() 297 311 { 312 scheduleUpdateForAfterStyleResolution(); 298 313 invalidateStyleAndRenderersForSubtree(); 299 314 300 315 HTMLPlugInElement::resumeFromDocumentSuspension(); 301 }302 303 void HTMLPlugInImageElement::startLoadingImage()304 {305 if (!m_imageLoader)306 m_imageLoader = std::make_unique<HTMLImageLoader>(*this);307 m_imageLoader->updateFromElement();308 316 } 309 317 … … 778 786 } 779 787 788 void HTMLPlugInImageElement::updateImageLoaderWithNewURLSoon() 789 { 790 if (m_needsImageReload) 791 return; 792 793 m_needsImageReload = true; 794 scheduleUpdateForAfterStyleResolution(); 795 invalidateStyle(); 796 } 797 780 798 } // namespace WebCore -
TabularUnified trunk/Source/WebCore/html/HTMLPlugInImageElement.h ¶
r217876 r220052 82 82 83 83 protected: 84 HTMLPlugInImageElement(const QualifiedName& tagName, Document&, bool createdByParser); 84 HTMLPlugInImageElement(const QualifiedName& tagName, Document&); 85 void finishCreating(); 85 86 86 87 void didMoveToNewDocument(Document& oldDocument, Document& newDocument) override; 88 87 89 bool requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues) final; 88 90 89 91 bool isImageType(); 90 92 HTMLImageLoader* imageLoader() { return m_imageLoader.get(); } 93 void updateImageLoaderWithNewURLSoon(); 91 94 92 95 bool allowedToLoadFrameURL(const String& url); 93 96 bool wouldLoadAsPlugIn(const String& url, const String& serviceType); 94 97 98 void scheduleUpdateForAfterStyleResolution(); 99 95 100 String m_serviceType; 96 101 String m_url; 97 98 std::unique_ptr<HTMLImageLoader> m_imageLoader;99 102 100 103 private: … … 104 107 bool allowedToLoadPluginContent(const String& url, const String& mimeType) const; 105 108 106 void finishParsingChildren() final;107 109 void didAddUserAgentShadowRoot(ShadowRoot*) final; 108 110 … … 110 112 bool childShouldCreateRenderer(const Node&) const override; 111 113 void willRecalcStyle(Style::Change) final; 114 void didRecalcStyle(Style::Change) final; 112 115 void didAttachRenderers() final; 113 116 void willDetachRenderers() final; … … 121 124 void updateSnapshot(Image*) final; 122 125 123 void startLoadingImage(); 124 void updateWidgetIfNecessary(); 126 void updateAfterStyleResolution(); 125 127 126 128 void simulatedMouseClickTimerFired(); … … 147 149 SnapshotDecision m_snapshotDecision { SnapshotNotYetDecided }; 148 150 bool m_plugInDimensionsSpecified { false }; 151 std::unique_ptr<HTMLImageLoader> m_imageLoader; 152 bool m_needsImageReload { false }; 153 bool m_hasUpdateScheduledForAfterStyleResolution { false }; 149 154 }; 150 155 -
TabularUnified trunk/Source/WebCore/html/HTMLTagNames.in ¶
r210763 r220052 9 9 acronym interfaceName=HTMLElement 10 10 address interfaceName=HTMLElement 11 applet constructorNeedsCreatedByParser11 applet 12 12 area 13 13 article interfaceName=HTMLElement … … 45 45 dt interfaceName=HTMLElement 46 46 em interfaceName=HTMLElement 47 embed constructorNeedsCreatedByParser47 embed 48 48 fieldset interfaceName=HTMLFieldSetElement, constructorNeedsFormElement 49 49 figcaption interfaceName=HTMLElement … … 91 91 noframes interfaceName=HTMLElement 92 92 nolayer interfaceName=HTMLElement 93 object constructorNeedsFormElement , constructorNeedsCreatedByParser93 object constructorNeedsFormElement 94 94 ol interfaceName=HTMLOListElement 95 95 optgroup interfaceName=HTMLOptGroupElement -
TabularUnified trunk/Source/WebCore/loader/DocumentLoader.cpp ¶
r219905 r220052 1049 1049 if (m_cachedResourceLoader->requestCount()) 1050 1050 return true; 1051 if (document.isDelayingLoadEvent()) 1052 return true; 1051 1053 if (document.processingLoadEvent()) 1052 1054 return true; -
TabularUnified trunk/Source/WebCore/loader/FrameLoader.cpp ¶
r219733 r220052 2236 2236 ASSERT(m_client.hasWebView()); 2237 2237 2238 // FIXME: Should this check be done in checkLoadComplete instead of here? 2239 // FIXME: Why does this one check need to be repeated here, and not the many others from checkCompleted? 2240 if (m_frame.document()->isDelayingLoadEvent()) 2241 return; 2242 2238 2243 switch (m_state) { 2239 2244 case FrameStateProvisional: { … … 2576 2581 parent->loader().closeAndRemoveChild(m_frame); 2577 2582 parent->loader().scheduleCheckCompleted(); 2583 parent->loader().scheduleCheckLoadComplete(); 2578 2584 } else { 2579 2585 m_frame.setView(nullptr); -
TabularUnified trunk/Tools/ChangeLog ¶
r220051 r220052 1 2017-07-30 Darin Adler <darin@apple.com> 2 3 Remove code in HTMLObjectElement attribute parsing that forces style resolution and layout 4 https://bugs.webkit.org/show_bug.cgi?id=130653 5 6 Reviewed by Antti Koivisto. 7 8 * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: 9 (WTR::InjectedBundlePage::didFinishLoadForFrame): Omit now-unneeded "shouldDump" argument 10 when calling frameDidChangeLocation. 11 (WTR::InjectedBundlePage::frameDidChangeLocation): Removed "shouldDump" argument. This was 12 causing WebKitTestRunner to not dump anything in cases where DumpRenderTree will dump, and 13 thus causing mysterious failures of a couple of tests. There are two remaining issues: 14 1) WebKitTestRunner won't run its dump code if there is no "page", and there is no such 15 consideration in DumpRenderTree and 2) Both DumpRenderTree and WebKitTestRunner share the 16 same logic flaw that causes "top loading frame" to get set to one of the subframes in 17 tests where the following sequence occurs: test calls waitUntilDone, main frame finishes 18 loading, subframe starts loading. It would be good to clean that up some day, but for now 19 this patch makes the two work identically rather than changing both. 20 * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: Updated for change above. 21 1 22 2017-07-30 Wenson Hsieh <wenson_hsieh@apple.com> 2 23 -
TabularUnified trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp ¶
r218014 r220052 935 935 dumpLoadEvent(frame, "didFinishLoadForFrame"); 936 936 937 frameDidChangeLocation(frame , /*shouldDump*/ true);937 frameDidChangeLocation(frame); 938 938 } 939 939 … … 2010 2010 #endif 2011 2011 2012 void InjectedBundlePage::frameDidChangeLocation(WKBundleFrameRef frame , bool shouldDump)2012 void InjectedBundlePage::frameDidChangeLocation(WKBundleFrameRef frame) 2013 2013 { 2014 2014 auto& injectedBundle = InjectedBundle::singleton(); … … 2026 2026 } 2027 2027 2028 if ( shouldDump)2028 if (injectedBundle.pageCount()) 2029 2029 injectedBundle.page()->dump(); 2030 2030 else -
TabularUnified trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h ¶
r174866 r220052 172 172 String platformResponseMimeType(WKURLResponseRef); 173 173 174 void frameDidChangeLocation(WKBundleFrameRef , bool shouldDump = false);174 void frameDidChangeLocation(WKBundleFrameRef); 175 175 176 176 WKBundlePageRef m_page;
Note:
See TracChangeset
for help on using the changeset viewer.