RESOLVED FIXED 38874
Adding block elements to a block and removing them changes the height of the element
https://bugs.webkit.org/show_bug.cgi?id=38874
Summary Adding block elements to a block and removing them changes the height of the ...
Enrica Casucci
Reported 2010-05-10 15:44:50 PDT
Created attachment 55612 [details] Test case 1. Create an empty editable element. (<div contentEditable="true"></div> 2. Add block elements to it. (<div contentEditable="true"><div>aaa</div><div>bbb</div></div>) 3. Remove all the added elements (<div contentEditable="true"></div>) EXPECTED: the height of the element is the same before and after the dom mutation. ACTUAL: the height of the element is different.
Attachments
Test case (868 bytes, text/html)
2010-05-10 15:44 PDT, Enrica Casucci
no flags
Patch (8.84 KB, patch)
2010-05-10 16:24 PDT, Enrica Casucci
no flags
Patch2 (8.89 KB, patch)
2010-05-11 09:35 PDT, Enrica Casucci
hyatt: review-
Patch3 (9.17 KB, text/plain)
2010-05-11 14:04 PDT, Enrica Casucci
no flags
A real patch (9.17 KB, patch)
2010-05-11 14:08 PDT, Enrica Casucci
hyatt: review+
Patch4 (10.64 KB, patch)
2010-05-12 14:14 PDT, Enrica Casucci
hyatt: review+
Patch5 (8.91 KB, patch)
2010-05-13 13:39 PDT, Enrica Casucci
hyatt: review+
Enrica Casucci
Comment 1 2010-05-10 16:24:38 PDT
Alexey Proskuryakov
Comment 2 2010-05-10 19:57:25 PDT
A passing test shouldn't have red rectangles in its rendering. Also, the attached test case doesn't seem to work in Firefox (I didn't try one from the patch, but it looks identical). Keeping r? for code review, but please fix the test.
Enrica Casucci
Comment 3 2010-05-11 09:35:11 PDT
Created attachment 55710 [details] Patch2 Changed the border color to green and used appendChild instead of innerText to allow you to see the test in Firefox. Firefox behaves differently because it returns 0 height for empty editable blocks, but it is consistent. This bugs is about inconsistency of before and after. I've discussed this with Hyatt on IRC and he agreed on the approach.
Alexey Proskuryakov
Comment 4 2010-05-11 10:11:05 PDT
Another way to fix this for Firefox would be to use innerHTML or textContent instead of innerText. I prefer innerHTML, because it works in both Firefox and IE. > Changed the border color to green I should have mentioned that the best color for this is blue - red is failure, green is success, and other colors are for content that indicates neither. But it's less important than not making it red.
Enrica Casucci
Comment 5 2010-05-11 10:19:24 PDT
(In reply to comment #4) > Another way to fix this for Firefox would be to use innerHTML or textContent instead of innerText. I prefer innerHTML, because it works in both Firefox and IE. > > > Changed the border color to green > > I should have mentioned that the best color for this is blue - red is failure, green is success, and other colors are for content that indicates neither. But it's less important than not making it red. I will change it to blue when I check in. Thanks for pointing me to the link with the guidelines.
Dave Hyatt
Comment 6 2010-05-11 13:25:08 PDT
Comment on attachment 55710 [details] Patch2 You really want to revert back to childrenInline = true when kids get removed, not at layout time. RenderBlock::removeChild seems like a better place to do this than layoutBlock. Something like this: if (!firstChild() && !childrenInline() && isRenderBlock()) setChildrenInline(true); Strictly speaking you could even revert back to childrenInline = true if all you have left are floating/positioned children, but that could get expensive to check, so I wouldn't bother.
Enrica Casucci
Comment 7 2010-05-11 13:34:51 PDT
(In reply to comment #6) > (From update of attachment 55710 [details]) > You really want to revert back to childrenInline = true when kids get removed, not at layout time. RenderBlock::removeChild seems like a better place to do this than layoutBlock. Something like this: > > if (!firstChild() && !childrenInline() && isRenderBlock()) > setChildrenInline(true); > > Strictly speaking you could even revert back to childrenInline = true if all you have left are floating/positioned children, but that could get expensive to check, so I wouldn't bother. That was my initial thought, but I wasn't sure if was missing some cases. I'll change the code the way you suggest it. Thanks!
Enrica Casucci
Comment 8 2010-05-11 14:04:38 PDT
Enrica Casucci
Comment 9 2010-05-11 14:08:18 PDT
Created attachment 55753 [details] A real patch one more time, with the right flags.
Dave Hyatt
Comment 10 2010-05-12 10:27:45 PDT
Comment on attachment 55753 [details] A real patch r=me
Enrica Casucci
Comment 11 2010-05-12 11:30:28 PDT
Committed revision 59245.
Eric Seidel (no email)
Comment 12 2010-05-12 12:11:03 PDT
WebKit Review Bot
Comment 13 2010-05-12 12:30:51 PDT
http://trac.webkit.org/changeset/59245 might have broken Leopard Intel Release (Tests), SnowLeopard Intel Release (Tests), and GTK Linux 64-bit Release The following changes are on the blame list: http://trac.webkit.org/changeset/59243 http://trac.webkit.org/changeset/59244 http://trac.webkit.org/changeset/59245 http://trac.webkit.org/changeset/59246
Eric Seidel (no email)
Comment 14 2010-05-12 12:32:13 PDT
Eric Seidel (no email)
Comment 15 2010-05-12 13:11:23 PDT
Reverted r59245 for reason: Broke at least one test on multiple platforms Committed r59256: <http://trac.webkit.org/changeset/59256>
mitz
Comment 16 2010-05-12 13:32:44 PDT
(In reply to comment #9) > one more time, with the right flags. You can change the flags after uploading an attachment by clicking the Details link next to it.
Enrica Casucci
Comment 17 2010-05-12 14:14:30 PDT
Created attachment 55897 [details] Patch4 Added the new result for the fast/event/mouseout-dead-node.html tests that I missed in the previous patch.
Dave Hyatt
Comment 18 2010-05-12 14:16:36 PDT
Comment on attachment 55897 [details] Patch4 r=me
Enrica Casucci
Comment 19 2010-05-12 14:25:08 PDT
Committed revision 59270.
WebKit Review Bot
Comment 20 2010-05-12 14:45:07 PDT
http://trac.webkit.org/changeset/59270 might have broken GTK Linux 32-bit Release The following changes are on the blame list: http://trac.webkit.org/changeset/59269 http://trac.webkit.org/changeset/59270
Eric Seidel (no email)
Comment 21 2010-05-12 15:05:16 PDT
It appears gtk needs result updates.
Enrica Casucci
Comment 22 2010-05-12 16:11:53 PDT
(In reply to comment #21) > It appears gtk needs result updates. Ossy fixed it in r59272 at 2:47pm.
Simon Fraser (smfr)
Comment 23 2010-05-12 21:37:14 PDT
This caused a new crash: bug 39042
Simon Fraser (smfr)
Comment 24 2010-05-12 21:42:44 PDT
We had to roll this out again: bug 39042.
Mark Rowe (bdash)
Comment 25 2010-05-12 21:54:26 PDT
Enrica Casucci
Comment 26 2010-05-13 13:39:47 PDT
Created attachment 56016 [details] Patch5 New patch that fixes the crash.
Dave Hyatt
Comment 27 2010-05-13 13:43:41 PDT
Comment on attachment 56016 [details] Patch5 r=me
Enrica Casucci
Comment 28 2010-05-13 13:49:46 PDT
Committed revision 59385.
WebKit Review Bot
Comment 29 2010-05-13 15:29:35 PDT
http://trac.webkit.org/changeset/59385 might have broken Tiger Intel Release
James Robinson
Comment 30 2010-05-17 13:51:06 PDT
This is still causing crashes: https://bugs.webkit.org/show_bug.cgi?id=39143
Note You need to log in before you can comment on or make changes to this bug.