Changeset 64085 in webkit
- Timestamp:
- Jul 26, 2010 3:58:33 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r64083 r64085 1 2010-07-26 Darin Adler <darin@apple.com> 2 3 Reviewed by Eric Carlson. 4 5 Don’t handle empty URL attributes specially in reflection, even in cases such as <img src=""> 6 https://bugs.webkit.org/show_bug.cgi?id=42087 7 8 * fast/dom/URL-attribute-reflection-expected.txt: Updated. 9 * fast/dom/script-tests/URL-attribute-reflection.js: Updated test expectations so that even 10 for URLs where "" is invalid, we reflect the empty string resolved to the base URL. 11 12 * media/video-poster-expected.txt: Updated. 13 * media/video-poster.html: Updated to expect poster="" to reflect as the base URL. 14 * media/video-source-error-no-candidate-expected.txt: Updated. 15 * media/video-src-none-expected.txt: Updated. 16 * media/video-src-none.html: Updated to expect src="" to reflect as the base URL. 17 1 18 2010-07-26 Ryosuke Niwa <rniwa@webkit.org> 2 19 -
trunk/LayoutTests/fast/dom/URL-attribute-reflection-expected.txt
r63119 r64085 11 11 FAIL testURLReflection('cite', 'ins') should be URL. Was non-URL. 12 12 FAIL testURLReflection('cite', 'q') should be URL. Was non-URL. 13 FAIL testURLReflection('data', 'object') should be non-empty URL. Was URL. 13 PASS testURLReflection('data', 'object') is 'URL' 14 14 FAIL testURLReflection('formaction', 'button') should be URL. Was none. 15 15 FAIL testURLReflection('formaction', 'input') should be URL. Was none. 16 16 PASS testURLReflection('href', 'a') is 'URL' 17 17 PASS testURLReflection('href', 'area') is 'URL' 18 FAIL testURLReflection('href', 'link') should be non-empty URL. Was URL. 18 PASS testURLReflection('href', 'link') is 'URL' 19 19 FAIL testURLReflection('href', 'base') should be URL. Was non-URL. 20 FAIL testURLReflection('icon', 'command') should be non-emptyURL. Was none.21 FAIL testURLReflection('manifest', 'html') should be non-emptyURL. Was none.22 PASS testURLReflection('poster', 'video') is ' non-emptyURL'23 PASS testURLReflection('src', 'audio') is ' non-emptyURL'24 FAIL testURLReflection('src', 'embed') should be non-emptyURL. Was non-URL.25 FAIL testURLReflection('src', 'iframe') should be non-emptyURL. Was non-URL.26 FAIL testURLReflection('src', 'img') should be non-empty URL. Was URL. 27 FAIL testURLReflection('src', 'input') should be non-empty URL. Was URL. 28 FAIL testURLReflection('src', 'script') should be non-empty URL. Was URL. 29 PASS testURLReflection('src', 'source') is ' non-emptyURL'30 PASS testURLReflection('src', 'video') is ' non-emptyURL'31 FAIL testURLReflection('longDesc', 'img') should be non-empty URL. Was URL. 32 FAIL testURLReflection('lowsrc', 'img') should be non-empty URL. Was URL. 20 FAIL testURLReflection('icon', 'command') should be URL. Was none. 21 FAIL testURLReflection('manifest', 'html') should be URL. Was none. 22 PASS testURLReflection('poster', 'video') is 'URL' 23 PASS testURLReflection('src', 'audio') is 'URL' 24 FAIL testURLReflection('src', 'embed') should be URL. Was non-URL. 25 FAIL testURLReflection('src', 'iframe') should be URL. Was non-URL. 26 PASS testURLReflection('src', 'img') is 'URL' 27 PASS testURLReflection('src', 'input') is 'URL' 28 PASS testURLReflection('src', 'script') is 'URL' 29 PASS testURLReflection('src', 'source') is 'URL' 30 PASS testURLReflection('src', 'video') is 'URL' 31 PASS testURLReflection('longDesc', 'img') is 'URL' 32 PASS testURLReflection('lowsrc', 'img') is 'URL' 33 33 PASS successfullyParsed is true 34 34 -
trunk/LayoutTests/fast/dom/script-tests/URL-attribute-reflection.js
r63057 r64085 37 37 38 38 // The following list comes from the HTML5 document’s attributes index. 39 // The expected results are based on what the table there says.39 // These are the URL attributes from that list. 40 40 41 41 shouldBe("testURLReflection('action', 'form')", "'URL'"); … … 44 44 shouldBe("testURLReflection('cite', 'ins')", "'URL'"); 45 45 shouldBe("testURLReflection('cite', 'q')", "'URL'"); 46 shouldBe("testURLReflection('data', 'object')", "' non-emptyURL'");46 shouldBe("testURLReflection('data', 'object')", "'URL'"); 47 47 shouldBe("testURLReflection('formaction', 'button')", "'URL'"); 48 48 shouldBe("testURLReflection('formaction', 'input')", "'URL'"); 49 49 shouldBe("testURLReflection('href', 'a')", "'URL'"); 50 50 shouldBe("testURLReflection('href', 'area')", "'URL'"); 51 shouldBe("testURLReflection('href', 'link')", "' non-emptyURL'");51 shouldBe("testURLReflection('href', 'link')", "'URL'"); 52 52 shouldBe("testURLReflection('href', 'base')", "'URL'"); 53 shouldBe("testURLReflection('icon', 'command')", "' non-emptyURL'");54 shouldBe("testURLReflection('manifest', 'html')", "' non-emptyURL'");55 shouldBe("testURLReflection('poster', 'video')", "' non-emptyURL'");56 shouldBe("testURLReflection('src', 'audio')", "' non-emptyURL'");57 shouldBe("testURLReflection('src', 'embed')", "' non-emptyURL'");58 shouldBe("testURLReflection('src', 'iframe')", "' non-emptyURL'");59 shouldBe("testURLReflection('src', 'img')", "' non-emptyURL'");60 shouldBe("testURLReflection('src', 'input')", "' non-emptyURL'");61 shouldBe("testURLReflection('src', 'script')", "' non-emptyURL'");62 shouldBe("testURLReflection('src', 'source')", "' non-emptyURL'");63 shouldBe("testURLReflection('src', 'video')", "' non-emptyURL'");53 shouldBe("testURLReflection('icon', 'command')", "'URL'"); 54 shouldBe("testURLReflection('manifest', 'html')", "'URL'"); 55 shouldBe("testURLReflection('poster', 'video')", "'URL'"); 56 shouldBe("testURLReflection('src', 'audio')", "'URL'"); 57 shouldBe("testURLReflection('src', 'embed')", "'URL'"); 58 shouldBe("testURLReflection('src', 'iframe')", "'URL'"); 59 shouldBe("testURLReflection('src', 'img')", "'URL'"); 60 shouldBe("testURLReflection('src', 'input')", "'URL'"); 61 shouldBe("testURLReflection('src', 'script')", "'URL'"); 62 shouldBe("testURLReflection('src', 'source')", "'URL'"); 63 shouldBe("testURLReflection('src', 'video')", "'URL'"); 64 64 65 65 // Other reflected URL attributes. 66 66 67 shouldBe("testURLReflection('longDesc', 'img')", "' non-emptyURL'");68 shouldBe("testURLReflection('lowsrc', 'img')", "' non-emptyURL'");67 shouldBe("testURLReflection('longDesc', 'img')", "'URL'"); 68 shouldBe("testURLReflection('lowsrc', 'img')", "'URL'"); 69 69 70 70 var successfullyParsed = true; -
trunk/LayoutTests/media/video-poster-expected.txt
r63119 r64085 6 6 Set 'poster' to ''. 7 7 EXPECTED (video.getAttribute('poster') == '') OK 8 EXPECTED (relativeURL(video.poster) == ' ') OK8 EXPECTED (relativeURL(video.poster) == 'video-poster.html') OK 9 9 10 10 Set 'poster' to 'content/abe.png'. -
trunk/LayoutTests/media/video-poster.html
r63119 r64085 19 19 consoleWrite("<br><i>Set 'poster' to ''.<" + "/i>"); 20 20 video.setAttribute('poster', ''); 21 testPoster(''); 21 testExpected("video.getAttribute('poster')", ''); 22 testExpected("relativeURL(video.poster)", 'video-poster.html'); 22 23 23 24 consoleWrite("<br><i>Set 'poster' to 'content/abe.png'.<" + "/i>"); -
trunk/LayoutTests/media/video-source-error-no-candidate-expected.txt
r63119 r64085 11 11 EXPECTED (video.error == 'null') OK 12 12 13 EVENT(error) from <source id='empty-src' src=' '> OK13 EVENT(error) from <source id='empty-src' src='video-source-error-no-candidate.html'> OK 14 14 EXPECTED (video.error == 'null') OK 15 15 -
trunk/LayoutTests/media/video-src-none-expected.txt
r63684 r64085 9 9 EXPECTED (videos[1].error == 'null') OK 10 10 EXPECTED (videos[1].networkState == '0') OK 11 EXPECTED ( videos[1].src == '') OK11 EXPECTED (relativeURL(videos[1].src) == 'video-src-none.html') OK 12 12 13 13 Calling load() with empty 'src' should fire 'error' event, set network state to NETWORK_NO_SOURCE, and set error to MEDIA_ERR_SRC_NOT_SUPPORTED. -
trunk/LayoutTests/media/video-src-none.html
r63684 r64085 43 43 testExpected("videos[1].error", null); 44 44 testExpected("videos[1].networkState", HTMLMediaElement.NETWORK_EMPTY); 45 testExpected(" videos[1].src", "");45 testExpected("relativeURL(videos[1].src)", "video-src-none.html"); 46 46 47 47 consoleWrite("<br><" + "i>Calling load() with empty 'src' should fire 'error' event, set network state to NETWORK_NO_SOURCE, and set error to MEDIA_ERR_SRC_NOT_SUPPORTED.<" + "/i>"); -
trunk/WebCore/ChangeLog
r64084 r64085 1 2010-07-26 Darin Adler <darin@apple.com> 2 3 Reviewed by Eric Carlson. 4 5 Don't handle empty URL attributes specially in reflection, even in cases such as <img src=""> 6 https://bugs.webkit.org/show_bug.cgi?id=42087 7 8 * html/HTMLMediaElement.cpp: 9 (WebCore::HTMLMediaElement::insertedIntoDocument): Check if the src attribute is empty 10 by calling getAttribute instead of calling the src function. This keeps the behavior 11 correct with the reflection change, and has a side benefit of being more efficient as 12 well since there is no reason to resolve the URL. 13 (WebCore::HTMLMediaElement::loadResource): Call getNonEmptyURLAttribute directly here 14 instead of using the poster function. 15 (WebCore::HTMLMediaElement::getPluginProxyParams): Ditto. 16 17 * html/HTMLMediaElement.h: Removed the poster virtual function. The code that gets the 18 poster attribute is already video-specific and uses generic attribute fetching code, so 19 we no longer need a virtual function. Removed the src function. Since this would give 20 a different result from the JavaScript reflected src attribute, it's safer not to have 21 it, and it was easy to convert all the callers. 22 23 * html/HTMLMediaElement.idl: Removed the NonEmpty extended attribute from the src 24 attribute. 25 26 * html/HTMLSourceElement.cpp: Removed the src function for the same reason as above. 27 * html/HTMLSourceElement.h: Ditto. 28 29 * html/HTMLSourceElement.idl: Removed the NonEmpty extended attribute from the src 30 attribute. 31 32 * html/HTMLVideoElement.cpp: 33 (WebCore::HTMLVideoElement::parseMappedAttribute): Removed code to update m_posterURL, 34 which is no longer needed. Changed call site that used the poster() function to instead 35 use getNonEmptyURLAttribute. 36 (WebCore::HTMLVideoElement::updatePosterImage): Check if the poster attribute is empty 37 by calling getAttribute instead of calling the poster function. This keeps the behavior 38 correct with the reflection change, and has a side benefit of being more efficient as 39 well since there is no reason to resolve the URL. 40 41 * html/HTMLVideoElement.h: Removed the poster function for the same reason we removed 42 the src function above. Also removed now-unneeded m_posterURL data member. 43 44 * html/HTMLVideoElement.idl: Removed the NonEmpty extended attribute from the poster 45 attribute. 46 1 47 2010-07-26 Chris Fleizach <cfleizach@apple.com> 2 48 -
trunk/WebCore/html/HTMLMediaElement.cpp
r63844 r64085 305 305 { 306 306 HTMLElement::insertedIntoDocument(); 307 if (! src().isEmpty() && m_networkState == NETWORK_EMPTY)307 if (!getAttribute(srcAttr).isEmpty() && m_networkState == NETWORK_EMPTY) 308 308 scheduleLoad(); 309 309 } … … 437 437 { 438 438 return m_error; 439 }440 441 KURL HTMLMediaElement::src() const442 {443 return getNonEmptyURLAttribute(srcAttr);444 439 } 445 440 … … 672 667 673 668 if (isVideo() && m_player->canLoadPoster()) { 674 KURL posterU rl = poster();675 if (!posterU rl.isEmpty())676 m_player->setPoster(posterU rl);669 KURL posterURL = getNonEmptyURLAttribute(posterAttr); 670 if (!posterURL.isEmpty()) 671 m_player->setPoster(posterURL); 677 672 } 678 673 … … 1963 1958 1964 1959 if (isVideo()) { 1965 String poster = poster(); 1966 if (!poster.isEmpty() && loader) { 1967 KURL posterURL = loader->completeURL(poster); 1968 if (posterURL.isValid() && loader->willLoadMediaElementURL(posterURL)) { 1969 names.append("_media_element_poster_"); 1970 values.append(posterURL.string()); 1971 } 1960 KURL posterURL = getNonEmptyURLAttribute(posterAttr); 1961 if (!posterURL.isEmpty() && loader && loader->willLoadMediaElementURL(posterURL)) { 1962 names.append("_media_element_poster_"); 1963 values.append(posterURL.string()); 1972 1964 } 1973 1965 } -
trunk/WebCore/html/HTMLMediaElement.h
r63684 r64085 65 65 // Eventually overloaded in HTMLVideoElement 66 66 virtual bool supportsFullscreen() const { return false; }; 67 virtual const KURL poster() const { return KURL(); }68 67 69 68 virtual bool supportsSave() const; … … 85 84 86 85 // network state 87 KURL src() const;88 86 void setSrc(const String&); 89 87 String currentSrc() const; -
trunk/WebCore/html/HTMLMediaElement.idl
r63684 r64085 31 31 32 32 // network state 33 attribute [Reflect, NonEmpty,URL] DOMString src;33 attribute [Reflect,URL] DOMString src; 34 34 readonly attribute DOMString currentSrc; 35 35 -
trunk/WebCore/html/HTMLSourceElement.cpp
r63119 r64085 63 63 } 64 64 65 KURL HTMLSourceElement::src() const66 {67 return getNonEmptyURLAttribute(srcAttr);68 }69 70 65 void HTMLSourceElement::setSrc(const String& url) 71 66 { -
trunk/WebCore/html/HTMLSourceElement.h
r63119 r64085 38 38 static PassRefPtr<HTMLSourceElement> create(const QualifiedName&, Document*); 39 39 40 KURL src() const;41 40 String media() const; 42 41 String type() const; -
trunk/WebCore/html/HTMLSourceElement.idl
r63119 r64085 26 26 module html { 27 27 interface [Conditional=VIDEO] HTMLSourceElement : HTMLElement { 28 attribute [Reflect, NonEmpty,URL] DOMString src;28 attribute [Reflect,URL] DOMString src; 29 29 attribute DOMString type; 30 30 attribute DOMString media; -
trunk/WebCore/html/HTMLVideoElement.cpp
r63119 r64085 102 102 103 103 if (attrName == posterAttr) { 104 m_posterURL = getNonEmptyURLAttribute(posterAttr);105 104 updatePosterImage(); 106 105 if (m_shouldDisplayPosterImage) { … … 111 110 #else 112 111 if (player()) 113 player()->setPoster( poster());112 player()->setPoster(getNonEmptyURLAttribute(posterAttr)); 114 113 #endif 115 114 } … … 180 179 #endif 181 180 182 m_shouldDisplayPosterImage = ! poster().isEmpty() && !hasAvailableVideoFrame();181 m_shouldDisplayPosterImage = !getAttribute(posterAttr).isEmpty() && !hasAvailableVideoFrame(); 183 182 184 183 #if !ENABLE(PLUGIN_PROXY_FOR_VIDEO) -
trunk/WebCore/html/HTMLVideoElement.h
r61959 r64085 45 45 unsigned videoHeight() const; 46 46 47 virtual const KURL poster() const { return m_posterURL; }48 49 47 // Fullscreen 50 48 void webkitEnterFullscreen(bool isUserGesture, ExceptionCode&); … … 85 83 86 84 OwnPtr<HTMLImageLoader> m_imageLoader; 87 KURL m_posterURL;88 85 bool m_shouldDisplayPosterImage; 89 86 }; -
trunk/WebCore/html/HTMLVideoElement.idl
r63119 r64085 33 33 readonly attribute unsigned long videoWidth; 34 34 readonly attribute unsigned long videoHeight; 35 attribute [Reflect, NonEmpty,URL] DOMString poster;35 attribute [Reflect,URL] DOMString poster; 36 36 37 37 readonly attribute boolean webkitSupportsFullscreen;
Note: See TracChangeset
for help on using the changeset viewer.