Bug 74425

Summary: Reduce code duplication in Element::setAttribute methods
Product: WebKit Reporter: Adam Klein <adamk>
Component: New BugsAssignee: Adam Klein <adamk>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, ojan, rniwa, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Adam Klein 2011-12-13 11:12:22 PST
Reduce code duplication in Element::setAttribute methods
Comment 1 Adam Klein 2011-12-13 11:15:18 PST
Created attachment 119046 [details]
Patch
Comment 2 Ryosuke Niwa 2011-12-13 11:24:08 PST
Comment on attachment 119046 [details]
Patch

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

> Source/WebCore/dom/Element.cpp:-664
> -    else if (old && !value.isNull()) {

The other one doesn't check !value.isNull(). Why is that okay?
Comment 3 Adam Klein 2011-12-13 11:32:52 PST
Comment on attachment 119046 [details]
Patch

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

>> Source/WebCore/dom/Element.cpp:-664
>> -    else if (old && !value.isNull()) {
> 
> The other one doesn't check !value.isNull(). Why is that okay?

The first branch's test is "old && value.isNull()", so "else if (old)" is equivalent to "else if (old && !value.isNull())". The one un-handled case here is "!old && value.isNull()", which is a no-op.
Comment 4 Ryosuke Niwa 2011-12-13 11:35:55 PST
Comment on attachment 119046 [details]
Patch

Thanks for the clarification. Makes sense to me.
Comment 5 WebKit Review Bot 2011-12-13 12:41:07 PST
Comment on attachment 119046 [details]
Patch

Clearing flags on attachment: 119046

Committed r102695: <http://trac.webkit.org/changeset/102695>
Comment 6 WebKit Review Bot 2011-12-13 12:41:12 PST
All reviewed patches have been landed.  Closing bug.