Bug 70823 - Using the EditorCommand InsertText with spaces destroys the style.
Summary: Using the EditorCommand InsertText with spaces destroys the style.
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-25 10:16 PDT by Mike Fenton
Modified: 2011-10-25 11:08 PDT (History)
2 users (show)

See Also:


Attachments
Test to validate insertion. (3.20 KB, patch)
2011-10-25 10:16 PDT, Mike Fenton
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Fenton 2011-10-25 10:16:36 PDT
Created attachment 112353 [details]
Test to validate insertion.

Attempting to insert text using the InsertTextCommand code destroys the style of the selection if a space exists.

From InsertTextCommand::doApply
    // FIXME: This delete operation blows away the typing style.
    if (endingSelection().isRange()) {
        if (performTrivialReplace(m_text, m_selectInsertedText))
            return;
        deleteSelection(false, true, true, false);
    }

The selection is deleted if a trivial replacement cannot be done.

From InsertTextCommand::performTrivialReplace

    if (text.contains('\t') || text.contains(' ') || text.contains('\n'))
        return false;

Trivial replacement only occurs when none of the above characters are present.