Title: [94344] trunk/Source/WebCore
- Revision
- 94344
- Author
- [email protected]
- Date
- 2011-09-01 14:22:24 -0700 (Thu, 01 Sep 2011)
Log Message
HTMLMediaElement should use fastHasAttribute instead of hasAttribute
https://bugs.webkit.org/show_bug.cgi?id=67421
Reviewed by Simon Fraser.
Use fastHasAttribute instead of hasAttribute because it is faster, and HTMLMediaElement
doesn't ever need to check style or SVG animated attributes.
No new tests required, this is just an optimization.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::selectMediaResource): hasAttribute -> fastHasAttribute.
(WebCore::HTMLMediaElement::loadResource): Ditto.
(WebCore::HTMLMediaElement::autoplay): Ditto.
(WebCore::HTMLMediaElement::loop): Ditto.
(WebCore::HTMLMediaElement::controls): Ditto.
(WebCore::HTMLMediaElement::selectNextSourceChild): Ditto.
(WebCore::HTMLMediaElement::sourceWasAdded): Ditto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (94343 => 94344)
--- trunk/Source/WebCore/ChangeLog 2011-09-01 21:14:56 UTC (rev 94343)
+++ trunk/Source/WebCore/ChangeLog 2011-09-01 21:22:24 UTC (rev 94344)
@@ -1,3 +1,24 @@
+2011-09-01 Eric Carlson <[email protected]>
+
+ HTMLMediaElement should use fastHasAttribute instead of hasAttribute
+ https://bugs.webkit.org/show_bug.cgi?id=67421
+
+ Reviewed by Simon Fraser.
+
+ Use fastHasAttribute instead of hasAttribute because it is faster, and HTMLMediaElement
+ doesn't ever need to check style or SVG animated attributes.
+
+ No new tests required, this is just an optimization.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::selectMediaResource): hasAttribute -> fastHasAttribute.
+ (WebCore::HTMLMediaElement::loadResource): Ditto.
+ (WebCore::HTMLMediaElement::autoplay): Ditto.
+ (WebCore::HTMLMediaElement::loop): Ditto.
+ (WebCore::HTMLMediaElement::controls): Ditto.
+ (WebCore::HTMLMediaElement::selectNextSourceChild): Ditto.
+ (WebCore::HTMLMediaElement::sourceWasAdded): Ditto.
+
2011-09-01 Dominic Mazzoni <[email protected]>
Add API functions to enable starting and stopping speech input,
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (94343 => 94344)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2011-09-01 21:14:56 UTC (rev 94343)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2011-09-01 21:22:24 UTC (rev 94344)
@@ -638,7 +638,7 @@
Mode mode = attribute;
// 3 - ... the media element has neither a src attribute ...
- if (!hasAttribute(srcAttr)) {
+ if (!fastHasAttribute(srcAttr)) {
// ... nor a source element child: ...
Node* node;
for (node = firstChild(); node; node = node->nextSibling()) {
@@ -809,7 +809,7 @@
m_player->setPreload(m_preload);
m_player->setPreservesPitch(m_webkitPreservesPitch);
- if (hasAttribute(mutedAttr))
+ if (fastHasAttribute(mutedAttr))
m_muted = true;
updateVolume();
@@ -1533,7 +1533,7 @@
bool HTMLMediaElement::autoplay() const
{
- return hasAttribute(autoplayAttr);
+ return fastHasAttribute(autoplayAttr);
}
void HTMLMediaElement::setAutoplay(bool b)
@@ -1718,7 +1718,7 @@
bool HTMLMediaElement::loop() const
{
- return hasAttribute(loopAttr);
+ return fastHasAttribute(loopAttr);
}
void HTMLMediaElement::setLoop(bool b)
@@ -1743,7 +1743,7 @@
if (isFullscreen())
return true;
- return hasAttribute(controlsAttr);
+ return fastHasAttribute(controlsAttr);
}
void HTMLMediaElement::setControls(bool b)
@@ -1965,7 +1965,7 @@
if (mediaURL.isEmpty())
goto check_again;
- if (source->hasAttribute(mediaAttr)) {
+ if (source->fastHasAttribute(mediaAttr)) {
MediaQueryEvaluator screenEval("screen", document()->frame(), renderer() ? renderer()->style() : 0);
RefPtr<MediaList> media = MediaList::createAllowingDescriptionSyntax(source->media());
#if !LOG_DISABLED
@@ -1976,7 +1976,7 @@
goto check_again;
}
- if (source->hasAttribute(typeAttr)) {
+ if (source->fastHasAttribute(typeAttr)) {
#if !LOG_DISABLED
if (shouldLog)
LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'type' is %s", source->type().utf8().data());
@@ -2028,7 +2028,7 @@
#endif
// We should only consider a <source> element when there is not src attribute at all.
- if (hasAttribute(srcAttr))
+ if (fastHasAttribute(srcAttr))
return;
// 4.8.8 - If a source element is inserted as a child of a media element that has no src
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes