Bug 138617

Summary: Avoid looking up the type attribute twice in HTMLInputElement::ensureInputType()
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: DOMAssignee: Chris Dumez <cdumez>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: commit-queue, darin, rniwa
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Chris Dumez 2014-11-11 11:15:57 PST
We currently call hasAttribute(typeAttr) then if it returns true, we call fastGetAttribute(typeAttr).
First of all, fastHasAttribute() would have been better as it would have avoided attribute synchronization. Secondly, We could call fastGetAttribute(typeAttr) directly and check if the returned value is nullAtom, instead of calling hasAttribute(). This way, we only do the linear attribute search once.
Comment 1 Chris Dumez 2014-11-11 11:19:35 PST
Created attachment 241365 [details]
Patch
Comment 2 Geoffrey Garen 2014-11-11 11:59:52 PST
Comment on attachment 241365 [details]
Patch

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

r=me

> Source/WebCore/ChangeLog:9
> +        calling directly fastGetAttribute(typeAttr) and check if its returns

Should be "call" and "it" instead of "calling" and "its".
Comment 3 Chris Dumez 2014-11-11 12:46:04 PST
Created attachment 241371 [details]
Patch
Comment 4 Chris Dumez 2014-11-11 15:49:26 PST
Merging into Bug 138524.

*** This bug has been marked as a duplicate of bug 138524 ***