[webkit-reviews] review granted: [Bug 54105] Add convenience method toHTMLElement(Node*) : [Attachment 81812] Patch.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Feb 9 07:48:05 PST 2011


Darin Adler <darin at apple.com> has granted Yael <yael.aharon at nokia.com>'s
request for review:
Bug 54105: Add convenience method toHTMLElement(Node*)
https://bugs.webkit.org/show_bug.cgi?id=54105

Attachment 81812: Patch.
https://bugs.webkit.org/attachment.cgi?id=81812&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=81812&action=review

This seems OK, but I have two thoughts.

One is that we want to do this for multiple element classes, not just
HTMLElement. The other is that we want to use this type of checked cast
whenever we cast. This helps us find bad casts.

I wouldn’t call it a “convenience method”, I would call it a “checked cast
function”.

>> Source/WebCore/html/HTMLElement.h:113
>> +	ASSERT(!node || node->isHTMLElement());
> 
> would not it be clearer if the assert was ASSERT(node &&
node->isHTMLElement());?

Clearer, but incorrect, because we want to allow 0.

Also, when an assert involves && we normally write it as two asserts.


More information about the webkit-reviews mailing list