[Webkit-unassigned] [Bug 67056] Code Refactoring for HTMLElement::deprecatedCreateContextualFragment

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 29 12:02:56 PDT 2011


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





--- Comment #9 from Eric Seidel <eric at webkit.org>  2011-08-29 12:02:56 PST ---
(From update of attachment 105477)
View in context: https://bugs.webkit.org/attachment.cgi?id=105477&action=review

> Source/WebCore/dom/Range.cpp:1138
> +    RefPtr<Node> nextNode;
> +    for (RefPtr<Node> node = fragment->firstChild(); node; node = nextNode) {
> +        nextNode = node->nextSibling();
> +        if (node->hasTagName(htmlTag) || node->hasTagName(headTag) || node->hasTagName(bodyTag)) {
> +            HTMLElement* element = toHTMLElement(node.get());
> +            Node* firstChild = element->firstChild();
> +            if (firstChild)
> +                nextNode = firstChild;
> +            RefPtr<Node> nextChild;
> +            for (RefPtr<Node> child = firstChild; child; child = nextChild) {
> +                nextChild = child->nextSibling();
> +                element->removeChild(child.get(), ignoredExceptionCode);
> +                ASSERT(!ignoredExceptionCode);
> +                fragment->insertBefore(child, element, ignoredExceptionCode);
> +                ASSERT(!ignoredExceptionCode);
> +            }
> +            fragment->removeChild(element, ignoredExceptionCode);
> +            ASSERT(!ignoredExceptionCode);
> +        }
> +    }

Seems this could be split of into a separate helper function.  Even static inline.

> Source/WebCore/editing/markup.cpp:687
> +    RefPtr<DocumentFragment> fragment = (Range::create(document))->createContextualFragment(markup, ec, scriptingPermission);

Again here, no parens around Range::create() are needed.

> Source/WebKit/qt/Api/qwebelement.cpp:1421
> +    RefPtr<DocumentFragment> fragment = (Range::create(doc))->createContextualFragment(markup, exception);

These extra () around Range::create() are not needed.

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