Changeset 175380 in webkit
- Timestamp:
- Oct 30, 2014 2:25:30 PM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r175379 r175380 1 2014-10-30 Chris Dumez <cdumez@apple.com> 2 3 Optimize HTMLVideoElement / HTMLAudioElement type checks a bit 4 https://bugs.webkit.org/show_bug.cgi?id=138202 5 6 Reviewed by Benjamin Poulain. 7 8 Optimize HTMLVideoElement / HTMLAudioElement type checks a bit by: 9 1. Using is<HTMLMediaElement>() instead of 10 (is<HTMLVideoElement>() || is<HTMLAudioElement>()) if the caller is 11 interested in both video and audio elements. This is faster because 12 it ends up doing: 13 - virtual call to Element::isMediaElement() 14 instead of 15 - Node::isHTMLElement() + 16 virtual call to HTMLElement::isHTMLUnknownElement() + 17 2 * HTMLElement::hasTagName() 18 2. Updating HTMLVideoElement / HTMLAudioElement type traits 19 specializations to: 20 - Avoid doing any virtual function call if the input type is an 21 HTMLMediaElement (which is common in the code base). 22 - Speed up check if the input is an Element by doing: 23 - virtual call to Element::isMediaElement() + 24 HTMLElement::hasTagName() 25 instead of 26 - Node::isHTMLElement() + 27 virtual call to !HTMLElement::isHTMLUnknownElement() + 28 HTMLElement::hasTagName() 29 The speed stays the same if the input is a Node or an HTMLElement. 30 31 No new tests, no behavior change. 32 33 * css/CSSDefaultStyleSheets.cpp: 34 (WebCore::CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement): 35 * dom/make_names.pl: 36 (defaultTagPropertyHash): 37 (printTypeHelpers): 38 * html/HTMLAudioElement.h: 39 (isType): 40 * html/HTMLImageLoader.cpp: 41 * html/HTMLTagNames.in: 42 * html/HTMLVideoElement.h: 43 (isType): 44 * page/ChromeClient.h: 45 1 46 2014-10-30 Myles C. Maxfield <mmaxfield@apple.com> 2 47 -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r175237 r175380 45 45 #include "FrameSelection.h" 46 46 #include "HTMLAreaElement.h" 47 #include "HTMLAudioElement.h" 47 48 #include "HTMLFormElement.h" 48 49 #include "HTMLFrameElementBase.h" … … 58 59 #include "HTMLTableElement.h" 59 60 #include "HTMLTextAreaElement.h" 61 #include "HTMLVideoElement.h" 60 62 #include "HitTestRequest.h" 61 63 #include "HitTestResult.h" -
trunk/Source/WebCore/css/CSSDefaultStyleSheets.cpp
r174084 r175380 178 178 179 179 #if ENABLE(VIDEO) 180 if (!mediaControlsStyleSheet && (is<HTMLVideoElement>(element) || is<HTMLAudioElement>(element))) {180 if (!mediaControlsStyleSheet && is<HTMLMediaElement>(element)) { 181 181 String mediaRules = RenderTheme::themeForPage(element.document().page())->mediaControlsStyleSheet(); 182 182 if (mediaRules.isEmpty()) -
trunk/Source/WebCore/dom/make_names.pl
r174375 r175380 195 195 'conditional' => 0, 196 196 'runtimeConditional' => 0, 197 'customTypeHelper' => 0, 197 198 ); 198 199 } … … 635 636 636 637 for my $class (sort keys %classToTags) { 638 my $name = $classToTags{$class}[0]; 639 next if $parsedTags{$name}{customTypeHelper}; 637 640 # Skip classes that map to more than 1 tag. 638 641 my $tagCount = scalar @{$classToTags{$class}}; 639 642 next if $tagCount > 1; 640 my $name = $classToTags{$class}[0]; 643 641 644 print F <<END 642 645 namespace WebCore { -
trunk/Source/WebCore/html/HTMLAudioElement.h
r173969 r175380 46 46 }; 47 47 48 } // namespace48 } // namespace WebCore 49 49 50 #endif 51 #endif 50 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::HTMLAudioElement) 51 static bool isType(const WebCore::HTMLMediaElement& element) { return element.hasTagName(WebCore::HTMLNames::audioTag); } 52 static bool isType(const WebCore::Element& element) { return is<WebCore::HTMLMediaElement>(element) && isType(downcast<WebCore::HTMLMediaElement>(element)); } 53 static bool isType(const WebCore::Node& node) { return is<WebCore::HTMLMediaElement>(node) && isType(downcast<WebCore::HTMLMediaElement>(node)); } 54 SPECIALIZE_TYPE_TRAITS_END() 55 56 #endif // ENABLE(VIDEO) 57 #endif // HTMLAudioElement_h -
trunk/Source/WebCore/html/HTMLImageLoader.cpp
r173980 r175380 30 30 #include "HTMLObjectElement.h" 31 31 #include "HTMLParserIdioms.h" 32 #include "HTMLVideoElement.h" 32 33 #include "Settings.h" 33 34 -
trunk/Source/WebCore/html/HTMLTagNames.in
r174050 r175380 12 12 article interfaceName=HTMLElement 13 13 aside interfaceName=HTMLElement 14 audio wrapperOnlyIfMediaIsAvailable, conditional=VIDEO, constructorNeedsCreatedByParser 14 audio wrapperOnlyIfMediaIsAvailable, conditional=VIDEO, constructorNeedsCreatedByParser, customTypeHelper 15 15 b interfaceName=HTMLElement 16 16 base … … 135 135 ul interfaceName=HTMLUListElement 136 136 var interfaceName=HTMLElement 137 video wrapperOnlyIfMediaIsAvailable, conditional=VIDEO, constructorNeedsCreatedByParser 137 video wrapperOnlyIfMediaIsAvailable, conditional=VIDEO, constructorNeedsCreatedByParser, customTypeHelper 138 138 wbr interfaceName=HTMLElement 139 139 xmp interfaceName=HTMLPreElement -
trunk/Source/WebCore/html/HTMLVideoElement.h
r175328 r175380 105 105 }; 106 106 107 } // namespace107 } // namespace WebCore 108 108 109 #endif 110 #endif 109 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::HTMLVideoElement) 110 static bool isType(const WebCore::HTMLMediaElement& element) { return element.hasTagName(WebCore::HTMLNames::videoTag); } 111 static bool isType(const WebCore::Element& element) { return is<WebCore::HTMLMediaElement>(element) && isType(downcast<WebCore::HTMLMediaElement>(element)); } 112 static bool isType(const WebCore::Node& node) { return is<WebCore::HTMLMediaElement>(node) && isType(downcast<WebCore::HTMLMediaElement>(node)); } 113 SPECIALIZE_TYPE_TRAITS_END() 114 115 #endif // ENABLE(VIDEO) 116 #endif // HTMLVideoElement_h -
trunk/Source/WebCore/page/ChromeClient.h
r175279 r175380 76 76 class GraphicsLayerFactory; 77 77 class HTMLInputElement; 78 class HTMLVideoElement; 78 79 class HitTestResult; 79 80 class IntRect;
Note: See TracChangeset
for help on using the changeset viewer.