[Webkit-unassigned] [Bug 59961] Implement DefaultParagraphSeparator execCommand, to let authors choose the default block element

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Mar 1 14:38:40 PST 2012


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


Ryosuke Niwa <rniwa at webkit.org> changed:

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




--- Comment #18 from Ryosuke Niwa <rniwa at webkit.org>  2012-03-01 14:38:40 PST ---
(From update of attachment 129748)
View in context: https://bugs.webkit.org/attachment.cgi?id=129748&action=review

> Source/WebCore/editing/Editor.cpp:3026
> +void Editor::setDefaultParagraphSeparator(EditorParagraphSeparator separator)
> +{
> +    ASSERT(separator == EditorParagraphSeparatorDiv || separator == EditorParagraphSeparatorP);
> +    m_defaultParagraphSeparator = separator;
> +}

I don't think we need an assertion here since compiler enforces the value in enum by default. Also, it's probably better to keep it inline.

> Source/WebCore/editing/Editor.h:83
> +enum EditorParagraphSeparator { EditorParagraphSeparatorDiv, EditorParagraphSeparatorP };

Should be EditorParagraphSeparatorIsDiv and EditorParagraphSeparatorIsP

> Source/WebCore/editing/htmlediting.cpp:852
> +    if (document->frame()->editor()->defaultParagraphSeparator() == EditorParagraphSeparatorP)
> +        return HTMLParagraphElement::create(document);
>      return HTMLDivElement::create(document);

We should use switch statement here instead so that we'll get a compilation error when a new value is added to enum and forgot to add a case here.

> Source/WebCore/page/Frame.cpp:311
> +
> +    // Reset the editor's default paragraph separator to the default value (a div).
> +    m_editor.setDefaultParagraphSeparator(EditorParagraphSeparatorDiv);

What!? We shouldn't have to do this.

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