Bug 130090

Summary: Optimize hasTagName when called on an HTMLElement
Product: WebKit Reporter: Darin Adler <darin>
Component: DOMAssignee: Darin Adler <darin>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, buildbot, cdumez, fred.wang, kling, koivisto, ossy, rniwa, webkit-ews
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 124128    
Attachments:
Description Flags
Patch
none
Patch
none
Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2
none
Patch
none
Archive of layout-test-results from webkit-ews-06 for mac-mountainlion
none
Archive of layout-test-results from webkit-ews-09 for mac-mountainlion-wk2
none
Archive of layout-test-results from webkit-ews-01 for mac-mountainlion
none
Archive of layout-test-results from webkit-ews-15 for mac-mountainlion-wk2
none
Archive of layout-test-results from webkit-ews-02 for mac-mountainlion
none
Archive of layout-test-results from webkit-ews-14 for mac-mountainlion-wk2
none
Archive of layout-test-results from webkit-ews-03 for mac-mountainlion
none
Patch
none
Patch
none
Patch none

Description Darin Adler 2014-03-11 07:49:59 PDT
Optimize hasTagName when called on an HTMLElement
Comment 1 Darin Adler 2014-03-11 19:57:50 PDT
Created attachment 226467 [details]
Patch
Comment 2 Early Warning System Bot 2014-03-13 02:47:43 PDT
Attachment 226467 [details] did not pass style-queue:


ERROR: Source/WebCore/svg/SVGUseElement.cpp:545:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 1 in 49 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Antti Koivisto 2014-03-13 03:24:18 PDT
Comment on attachment 226467 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=226467&action=review

Nice! I don't think this is overengineered at all.

Looks like there are some bad hasLocalName calls left at least in TextIterator.cpp.

> Source/WebCore/accessibility/AccessibilityRenderObject.cpp:2429
> +    for (RenderElement* parent = m_renderer->parent(); parent; parent = parent->parent()) {

This could use

for (auto& ancestor : ancestorsOfType<RenderElement>(*m_renderer))

> Source/WebCore/xml/parser/XMLDocumentParser.cpp:278
> -    if (contextElement && (contextElement->hasLocalName(HTMLNames::scriptTag) || contextElement->hasLocalName(HTMLNames::styleTag))) {
> +    if (contextElement && (contextElement->hasLocalName(HTMLNames::scriptTag.localName()) || contextElement->hasLocalName(HTMLNames::styleTag.localName()))) {

Wonder if this is a bug or if the "hack" requires ignoring the namespace.
Comment 4 Darin Adler 2014-03-13 10:46:04 PDT
Committed r165544: <http://trac.webkit.org/changeset/165544>
Comment 5 Benjamin Poulain 2014-03-13 12:48:18 PDT
+Build fix: http://trac.webkit.org/changeset/165560
Comment 6 Csaba Osztrogonác 2014-03-13 13:21:33 PDT
It broke the whole world. Are you going to fix it?
Comment 7 Antti Koivisto 2014-03-13 14:58:48 PDT
Some more places probably need to include HTMLElement.h as that is where Node::hasTagName(const HTMLQualifiedName& name) is now defined.
Comment 8 Csaba Osztrogonác 2014-03-13 14:59:01 PDT
I tried to ping you Darin, but you weren't on #webkit.

It broke the Windows build:
http://build.webkit.org/builders/Apple%20Win%20Release%20%28Build%29/builds/58986

And the EFL/GTK build:
http://build.webkit.org/builders/EFL%20Linux%2064-bit%20Release%20WK1/builds/5427

EWS bots noticed this breakage before landing. :( I willingly help you 
to fix it, but not now, but it's 11 pm here, so I rolled it out by r165568.
I'm going to check the linux build tomorrow mornig. Or feel free to reland
if you find it before me.
Comment 9 Csaba Osztrogonác 2014-03-13 15:02:31 PDT
Reopen not to forget to fix it.
Comment 10 Darin Adler 2014-03-13 15:31:35 PDT
Thanks for rolling out. I am surprised by these failures and I will look into them when I have some time.
Comment 11 Csaba Osztrogonác 2014-03-14 05:03:43 PDT
Created attachment 226687 [details]
Patch

fixed patch for landing
Comment 12 Build Bot 2014-03-14 06:25:03 PDT
Comment on attachment 226687 [details]
Patch

Attachment 226687 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/5004034888957952

New failing tests:
accessibility/canvas-accessibilitynodeobject.html
fast/events/tabindex-focus-blur-all.html
accessibility/accessibility-node-reparent.html
accessibility/accessibility-node-memory-management.html
Comment 13 Build Bot 2014-03-14 06:25:07 PDT
Created attachment 226699 [details]
Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-12  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.5
Comment 14 Frédéric Wang (:fredw) 2014-03-14 06:40:37 PDT
Created attachment 226701 [details]
Patch

Adding headers in PasteboardGtk.cpp to try to fix the GTK builds.
Comment 15 Csaba Osztrogonác 2014-03-14 06:48:50 PDT
Now only the Windows build is broken and there are some layout tests regression.
Comment 16 Build Bot 2014-03-14 07:01:10 PDT
Comment on attachment 226687 [details]
Patch

Attachment 226687 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/6051732031275008

New failing tests:
accessibility/canvas-accessibilitynodeobject.html
fast/events/tabindex-focus-blur-all.html
accessibility/accessibility-node-reparent.html
accessibility/accessibility-node-memory-management.html
Comment 17 Build Bot 2014-03-14 07:01:15 PDT
Created attachment 226707 [details]
Archive of layout-test-results from webkit-ews-06 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-06  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 18 Build Bot 2014-03-14 07:13:44 PDT
Comment on attachment 226687 [details]
Patch

Attachment 226687 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/5353353169076224

New failing tests:
accessibility/canvas-accessibilitynodeobject.html
fast/events/tabindex-focus-blur-all.html
accessibility/accessibility-node-reparent.html
accessibility/accessibility-node-memory-management.html
Comment 19 Build Bot 2014-03-14 07:13:49 PDT
Created attachment 226709 [details]
Archive of layout-test-results from webkit-ews-09 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-09  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.5
Comment 20 Build Bot 2014-03-14 07:51:12 PDT
Comment on attachment 226687 [details]
Patch

Attachment 226687 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/5780163396632576

New failing tests:
accessibility/canvas-accessibilitynodeobject.html
fast/events/tabindex-focus-blur-all.html
accessibility/accessibility-node-reparent.html
accessibility/accessibility-node-memory-management.html
Comment 21 Build Bot 2014-03-14 07:51:15 PDT
Created attachment 226714 [details]
Archive of layout-test-results from webkit-ews-01 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-01  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 22 Build Bot 2014-03-14 07:58:32 PDT
Comment on attachment 226701 [details]
Patch

Attachment 226701 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/5943138078162944

New failing tests:
accessibility/canvas-accessibilitynodeobject.html
fast/events/tabindex-focus-blur-all.html
accessibility/accessibility-node-reparent.html
accessibility/accessibility-node-memory-management.html
Comment 23 Build Bot 2014-03-14 07:58:35 PDT
Created attachment 226715 [details]
Archive of layout-test-results from webkit-ews-15 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-15  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.5
Comment 24 Build Bot 2014-03-14 08:38:28 PDT
Comment on attachment 226701 [details]
Patch

Attachment 226701 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/4558354722586624

New failing tests:
accessibility/canvas-accessibilitynodeobject.html
fast/events/tabindex-focus-blur-all.html
accessibility/accessibility-node-reparent.html
accessibility/accessibility-node-memory-management.html
Comment 25 Build Bot 2014-03-14 08:38:32 PDT
Created attachment 226719 [details]
Archive of layout-test-results from webkit-ews-02 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-02  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 26 Build Bot 2014-03-14 08:49:14 PDT
Comment on attachment 226701 [details]
Patch

Attachment 226701 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/4529045865758720

New failing tests:
accessibility/canvas-accessibilitynodeobject.html
fast/events/tabindex-focus-blur-all.html
accessibility/accessibility-node-reparent.html
accessibility/accessibility-node-memory-management.html
Comment 27 Build Bot 2014-03-14 08:49:18 PDT
Created attachment 226720 [details]
Archive of layout-test-results from webkit-ews-14 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-14  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.5
Comment 28 Build Bot 2014-03-14 09:47:04 PDT
Comment on attachment 226701 [details]
Patch

Attachment 226701 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/6154244310695936

New failing tests:
accessibility/canvas-accessibilitynodeobject.html
fast/events/tabindex-focus-blur-all.html
accessibility/accessibility-node-reparent.html
accessibility/accessibility-node-memory-management.html
Comment 29 Build Bot 2014-03-14 09:47:08 PDT
Created attachment 226725 [details]
Archive of layout-test-results from webkit-ews-03 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-03  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 30 Darin Adler 2014-03-15 14:17:22 PDT
OK, I’ve made fixes for the Windows and GTK compilation failures in my local tree. I am not sure those are the same changes that Ossy and Frédéric made -- I didn’t see their patches yet. Now I am looking into the test failures.
Comment 31 Darin Adler 2014-03-15 18:25:59 PDT
Test failures were due to me using ancestorsOfType instead of lineageOfType in Element::isFocusable.
Comment 32 Darin Adler 2014-03-15 18:26:58 PDT
Created attachment 226828 [details]
Patch
Comment 33 Darin Adler 2014-03-15 23:01:43 PDT
Created attachment 226835 [details]
Patch
Comment 34 Darin Adler 2014-03-15 23:09:11 PDT
There was another Windows build failure related to the WebKit exp file. Uploading a new patch that tries to fix that.
Comment 35 Darin Adler 2014-03-16 08:36:09 PDT
Created attachment 226841 [details]
Patch
Comment 36 Darin Adler 2014-03-16 09:39:25 PDT
Committed r165699: <http://trac.webkit.org/changeset/165699>
Comment 37 Lucas Forschler 2019-02-06 09:04:08 PST
Mass moving XML DOM bugs to the "DOM" Component.