[Webkit-unassigned] [Bug 128904] [GTK] ASSERTION FAILED: hasClass()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Feb 17 11:23:34 PST 2014


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


Anders Carlsson <andersca at apple.com> changed:

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




--- Comment #2 from Anders Carlsson <andersca at apple.com>  2014-02-17 11:20:47 PST ---
(From update of attachment 224360)
View in context: https://bugs.webkit.org/attachment.cgi?id=224360&action=review

> Source/WebCore/platform/gtk/RenderThemeGtk.cpp:114
>  static bool nodeHasClass(Node* node, const char* className)

I think this should take a const Node& since it can never be null (You'd have to change the call sites as well). The same thing is true for nodeHasPseudo but that doesn't have to be in this patch.

> Source/WebCore/platform/gtk/RenderThemeGtk.cpp:116
> -    return node->isElementNode() ? toElement(node)->classNames().contains(className) : false;
> +    return (node->isElementNode() && toElement(node)->hasClass()) ? toElement(node)->classNames().contains(className) : false;

I think this would look better with early returns, something like:

if (!node.isElementNode())
    return false;

const Element& element = toElement(node);
if (!element.hasClass())
    return false;

return element.classNames().contains(className);

-- 
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