[Webkit-unassigned] [Bug 43166] InsertOrderedList does not switch the list type properly when it has an inner list.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 29 11:37:41 PDT 2010


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


Darin Adler <darin at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #62913|review?                     |review-
               Flag|                            |




--- Comment #2 from Darin Adler <darin at apple.com>  2010-07-29 11:37:41 PST ---
(From update of attachment 62913)
Looks good. A few comments.

> +    if (previousList && previousList->isHTMLElement() && canMergeLists(previousList, listElement))

> +    if (nextList && nextList->isHTMLElement() && canMergeLists(listElement, nextList)) {

If we need an isHTMLElement check here, then why does canMergeLists take an Element*?

If canMergeLists takes an Element*, then should it do the isHTMLElement check itself?

> +    const QualifiedName listTag = (m_type == OrderedList) ? olTag : ulTag;

This should be const QualifiedName& rather than const QualifiedName, to generate slightly more efficient code and avoid a ref/deref of the tag.

> +    RefPtr<Range> currentSelection = endingSelection().firstRange();
> +    doApplyForSingleParagraph(false, listTag, currentSelection.get());

You could do this without a local variable if you think that would be more readable.

    doApplyForSingleParagraph(false, listTag, endingSelection().firstRange().get());

> +    bool selectionHasListOfType(const VisiblePosition& start, const VisiblePosition& end, const QualifiedName&);

Too bad we have to pass two VisiblePosition. It would be nice if "selection" was a single argument.

> +    HTMLElement* mergeWithNeighboringLists(HTMLElement*);

Using raw pointers in cases like this can be unsafe if there are DOM mutation events involved. You might need the result to be PassRefPtr in case the list is destroyed during the merging process.

Do the new tests really cover all the branches in the code? I see lots of branches in the code and only a couple test cases. I don't think there is enough test coverage here.

review- so you can at least fix the const QualifiedName& thing.

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