[Webkit-unassigned] [Bug 9505] New: moveParagraphContentsToNewBlockIfNecessary creates a new block outside the current position

bugzilla-daemon at opendarwin.org bugzilla-daemon at opendarwin.org
Mon Jun 19 06:33:07 PDT 2006


http://bugzilla.opendarwin.org/show_bug.cgi?id=9505

           Summary: moveParagraphContentsToNewBlockIfNecessary creates a new
                    block outside the current position
           Product: WebKit
           Version: 420+ (nightly)
          Platform: Macintosh
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HTML Editing
        AssignedTo: webkit-unassigned at opendarwin.org
        ReportedBy: Graham.Dennis at gmail.com


When pasting certain HTML from Safari, moveParagraphContents creates an invalid
DIV element as the first child of a TABLE element. e.g.
<table> <div> <tbody> ... </tbody> </div> </table>

Steps to reproduce:
Do a select-all on the website http://nowataballpark.org/contact.html then
paste the result into any contentEditable div. The result will include a <div>
element within the table.

Cause: By the time the fixupNodeStyles() phase of pasting begins, the HTML just
before the table element looks like:
...
    <p style="color: rgb(255, 0, 0); text-align: -khtml-center; "/>
    <table border="1" bgcolor="#FFFFFF">
      <tbody style="border-spacing: 2px 2px; color: rgb(255, 0, 0); ">
...
When applyStyle() is called on the empty paragraph element, this eventually
calls through to moveParagraphContentsToNewBlockIfNecessary with a position of
[p, 0) (where p is the paragraph element). When the VisiblePositions are
created, because the paragraph element has no visible position, the vp's are
all within the table element, and a div element is created inside the table
element. I will attach a patch.

This patch doesn't come with any layout tests as I haven't managed to get one
working. I've tried modifying editing/pasteboard/paste-4039777-fix without any
luck. However the above-mentioned steps do replicate the bug.


-- 
Configure bugmail: http://bugzilla.opendarwin.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list