[Webkit-unassigned] [Bug 54105] Add convenience method toHTMLElement(Node*)

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


https://bugs.webkit.org/show_bug.cgi?id=54105


Darin Adler <darin at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #81812|review?, commit-queue?      |review+, commit-queue+
               Flag|                            |




--- Comment #3 from Darin Adler <darin at apple.com>  2011-02-09 07:48:05 PST ---
(From update of attachment 81812)
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.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list