Changeset 61518 in webkit
- Timestamp:
- Jun 20, 2010 6:05:16 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r61517 r61518 1 2010-06-20 Tony Gentilcore <tonyg@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Test to make sure parsing of async attribute works for HTML script tags 6 and test to make sure that async is not parsed for SVG script tags. 7 https://bugs.webkit.org/show_bug.cgi?id=39026 8 9 * fast/dom/HTMLScriptElement/script-async-attr-expected.txt: Added. 10 * fast/dom/HTMLScriptElement/script-async-attr.html: Added. 11 * svg/dom/SVGScriptElement/script-async-attr-expected.txt: Added. 12 * svg/dom/SVGScriptElement/script-async-attr.svg: Added. 13 1 14 2010-06-20 Tony Chang <tony@chromium.org> 2 15 -
trunk/WebCore/ChangeLog
r61514 r61518 1 2010-06-20 Tony Gentilcore <tonyg@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Recognize async attribute on HTML script tags. 6 https://bugs.webkit.org/show_bug.cgi?id=39026 7 8 This does not implement async behavior, it only parses the async 9 attribute for HTML script tags. SVG script tags continue to not 10 support the async attribute. 11 12 Tests: fast/dom/HTMLScriptElement/script-async-attr.html 13 svg/dom/SVGScriptElement/script-async-attr.svg 14 15 * dom/ScriptElement.cpp: 16 (WebCore::ScriptElementData::isAsynchronous): 17 (WebCore::ScriptElementData::isDeferred): 18 * dom/ScriptElement.h: 19 * html/HTMLAttributeNames.in: 20 * html/HTMLScriptElement.cpp: 21 (WebCore::HTMLScriptElement::async): 22 (WebCore::HTMLScriptElement::setAsync): 23 (WebCore::HTMLScriptElement::defer): 24 (WebCore::HTMLScriptElement::asyncAttributeValue): 25 (WebCore::HTMLScriptElement::deferAttributeValue): 26 * html/HTMLScriptElement.h: 27 * html/HTMLScriptElement.idl: 28 * svg/SVGScriptElement.cpp: 29 (WebCore::SVGScriptElement::asyncAttributeValue): 30 (WebCore::SVGScriptElement::deferAttributeValue): 31 * svg/SVGScriptElement.h: 32 1 33 2010-06-20 Nikita Vasilyev <me@elv1s.ru> 2 34 -
trunk/WebCore/dom/ScriptElement.cpp
r60275 r61518 306 306 } 307 307 308 bool ScriptElementData::isAsynchronous() const 309 { 310 // Only external scripts may be asynchronous. 311 // See: http://dev.w3.org/html5/spec/Overview.html#attr-script-async 312 return !m_scriptElement->sourceAttributeValue().isEmpty() && m_scriptElement->asyncAttributeValue(); 313 } 314 315 bool ScriptElementData::isDeferred() const 316 { 317 // Only external scripts may be deferred and async trumps defer to allow for backward compatibility. 318 // See: http://dev.w3.org/html5/spec/Overview.html#attr-script-defer 319 return !m_scriptElement->sourceAttributeValue().isEmpty() && !m_scriptElement->asyncAttributeValue() && m_scriptElement->deferAttributeValue(); 320 } 321 308 322 ScriptElement* toScriptElement(Element* element) 309 323 { -
trunk/WebCore/dom/ScriptElement.h
r60275 r61518 45 45 virtual String forAttributeValue() const = 0; 46 46 virtual String eventAttributeValue() const = 0; 47 virtual bool asyncAttributeValue() const = 0; 48 virtual bool deferAttributeValue() const = 0; 47 49 48 50 virtual void dispatchLoadEvent() = 0; … … 75 77 String scriptContent() const; 76 78 String scriptCharset() const; 79 bool isAsynchronous() const; 80 bool isDeferred() const; 77 81 78 82 Element* element() const { return m_element; } -
trunk/WebCore/html/HTMLAttributeNames.in
r60727 r61518 44 44 aria-valuenow 45 45 aria-valuetext 46 async 46 47 autocomplete 47 48 autofocus -
trunk/WebCore/html/HTMLScriptElement.cpp
r61410 r61518 150 150 } 151 151 152 bool HTMLScriptElement::async() const 153 { 154 return asyncAttributeValue(); 155 } 156 157 void HTMLScriptElement::setAsync(bool async) 158 { 159 setAttribute(asyncAttr, async ? "" : 0); 160 } 161 152 162 bool HTMLScriptElement::defer() const 153 163 { 164 return deferAttributeValue(); 165 } 166 167 void HTMLScriptElement::setDefer(bool defer) 168 { 169 setAttribute(deferAttr, defer ? "" : 0); 170 } 171 172 KURL HTMLScriptElement::src() const 173 { 174 return document()->completeURL(sourceAttributeValue()); 175 } 176 177 void HTMLScriptElement::setSrc(const String &value) 178 { 179 setAttribute(srcAttr, value); 180 } 181 182 String HTMLScriptElement::type() const 183 { 184 return typeAttributeValue(); 185 } 186 187 void HTMLScriptElement::setType(const String &value) 188 { 189 setAttribute(typeAttr, value); 190 } 191 192 String HTMLScriptElement::scriptCharset() const 193 { 194 return m_data.scriptCharset(); 195 } 196 197 String HTMLScriptElement::scriptContent() const 198 { 199 return m_data.scriptContent(); 200 } 201 202 void HTMLScriptElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const 203 { 204 HTMLElement::addSubresourceAttributeURLs(urls); 205 206 addSubresourceURL(urls, src()); 207 } 208 209 String HTMLScriptElement::sourceAttributeValue() const 210 { 211 return getAttribute(srcAttr).string(); 212 } 213 214 String HTMLScriptElement::charsetAttributeValue() const 215 { 216 return getAttribute(charsetAttr).string(); 217 } 218 219 String HTMLScriptElement::typeAttributeValue() const 220 { 221 return getAttribute(typeAttr).string(); 222 } 223 224 String HTMLScriptElement::languageAttributeValue() const 225 { 226 return getAttribute(languageAttr).string(); 227 } 228 229 String HTMLScriptElement::forAttributeValue() const 230 { 231 return getAttribute(forAttr).string(); 232 } 233 234 String HTMLScriptElement::eventAttributeValue() const 235 { 236 return getAttribute(eventAttr).string(); 237 } 238 239 bool HTMLScriptElement::asyncAttributeValue() const 240 { 241 return !getAttribute(asyncAttr).isNull(); 242 } 243 244 bool HTMLScriptElement::deferAttributeValue() const 245 { 154 246 return !getAttribute(deferAttr).isNull(); 155 }156 157 void HTMLScriptElement::setDefer(bool defer)158 {159 setAttribute(deferAttr, defer ? "" : 0);160 }161 162 KURL HTMLScriptElement::src() const163 {164 return document()->completeURL(sourceAttributeValue());165 }166 167 void HTMLScriptElement::setSrc(const String &value)168 {169 setAttribute(srcAttr, value);170 }171 172 String HTMLScriptElement::type() const173 {174 return typeAttributeValue();175 }176 177 void HTMLScriptElement::setType(const String &value)178 {179 setAttribute(typeAttr, value);180 }181 182 String HTMLScriptElement::scriptCharset() const183 {184 return m_data.scriptCharset();185 }186 187 String HTMLScriptElement::scriptContent() const188 {189 return m_data.scriptContent();190 }191 192 void HTMLScriptElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const193 {194 HTMLElement::addSubresourceAttributeURLs(urls);195 196 addSubresourceURL(urls, src());197 }198 199 String HTMLScriptElement::sourceAttributeValue() const200 {201 return getAttribute(srcAttr).string();202 }203 204 String HTMLScriptElement::charsetAttributeValue() const205 {206 return getAttribute(charsetAttr).string();207 }208 209 String HTMLScriptElement::typeAttributeValue() const210 {211 return getAttribute(typeAttr).string();212 }213 214 String HTMLScriptElement::languageAttributeValue() const215 {216 return getAttribute(languageAttr).string();217 }218 219 String HTMLScriptElement::forAttributeValue() const220 {221 return getAttribute(forAttr).string();222 }223 224 String HTMLScriptElement::eventAttributeValue() const225 {226 return getAttribute(eventAttr).string();227 247 } 228 248 -
trunk/WebCore/html/HTMLScriptElement.h
r60361 r61518 48 48 void setCharset(const String&); 49 49 50 bool async() const; 51 void setAsync(bool); 52 50 53 bool defer() const; 51 54 void setDefer(bool); … … 86 89 virtual String forAttributeValue() const; 87 90 virtual String eventAttributeValue() const; 91 virtual bool asyncAttributeValue() const; 92 virtual bool deferAttributeValue() const; 88 93 89 94 virtual void dispatchLoadEvent(); -
trunk/WebCore/html/HTMLScriptElement.idl
r61413 r61518 25 25 attribute [Reflect] DOMString event; 26 26 attribute [Reflect] DOMString charset; 27 attribute [Reflect] boolean async; 27 28 attribute [Reflect] boolean defer; 28 29 attribute [ReflectURL] DOMString src; -
trunk/WebCore/svg/SVGScriptElement.cpp
r59773 r61518 200 200 } 201 201 202 bool SVGScriptElement::asyncAttributeValue() const 203 { 204 return false; 205 } 206 207 bool SVGScriptElement::deferAttributeValue() const 208 { 209 return false; 210 } 211 202 212 void SVGScriptElement::dispatchLoadEvent() 203 213 { -
trunk/WebCore/svg/SVGScriptElement.h
r59773 r61518 68 68 virtual String forAttributeValue() const; 69 69 virtual String eventAttributeValue() const; 70 virtual bool asyncAttributeValue() const; 71 virtual bool deferAttributeValue() const; 70 72 71 73 virtual void dispatchLoadEvent();
Note: See TracChangeset
for help on using the changeset viewer.