Bug 18786 - Once rendered, SVG text elements removed from DOM continue to be displayed
Summary: Once rendered, SVG text elements removed from DOM continue to be displayed
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.4
: P2 Major
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-28 09:32 PDT by Glenn Brauen
Modified: 2008-06-19 09:39 PDT (History)
4 users (show)

See Also:


Attachments
SVG example that demonstrates the problem as described. (1.77 KB, image/svg+xml)
2008-04-28 09:34 PDT, Glenn Brauen
no flags Details
First attempt (9.75 KB, patch)
2008-05-01 04:10 PDT, Rob Buis
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Glenn Brauen 2008-04-28 09:32:30 PDT
I have an application that manages objects and text dynamically, sometimes replacing graphics and text based on user input.  In the latest webkit nightlies and in Safari 3.1, removing <text> elements from the DOM does not remove them from the display.

I will attach a simplified SVG test file that demonstrates the problem.  In this case, I statically create a group containing graphics and text, let it render when loaded but use an onload function to start a timer that removes all elements within a specified <g> after a 1 second timeout.  The graphics disappear but the text remains visible.  Both the graphics and the text have been removed from the DOM.

This works in the latest Firefox 2 builds: both graphics and text disappear.

Although my work on this app has been dormant for a while, this used to work in Safari 3.0.  I went back as far as nightly build r29862 (January 30, 2008) and this has been broken in webkit nightlies at least that long.
Comment 1 Glenn Brauen 2008-04-28 09:34:06 PDT
Created attachment 20867 [details]
SVG example that demonstrates the problem as described.
Comment 2 Glenn Brauen 2008-04-28 10:30:10 PDT
This also works properly in Firefox 3.0 beta 5: both text and graphics disappear.
Comment 3 Mark Rowe (bdash) 2008-04-29 15:14:48 PDT
It looks like an invalidation issue: forcing a repaint causes the text to disappear.
Comment 4 Rob Buis 2008-05-01 04:10:56 PDT
Created attachment 20910 [details]
First attempt

The problem here is that the inline textbox structures are destroyed before the
repaint in RenderContainer::removeChildNode is done. That means the bounding box
for the RenderSVGInlineText is empty at the time of repaint, as well as for RenderSVGText. It seems for html text this is no problem as the layer system takes care of repainting. The patch fixes it by repainting "manually" before
destroying.
The testcase is tricky. I hope it can be done as text only dump, but I guess it is not possible as this is a rendering error.
Cheers,

Rob.
Comment 5 Eric Seidel (no email) 2008-05-01 19:29:40 PDT
hyatt or mitz really should look at this craziness.
Comment 6 Darin Adler 2008-06-08 18:08:28 PDT
Comment on attachment 20910 [details]
First attempt

r=me
Comment 7 Rob Buis 2008-06-18 12:53:46 PDT
Landed in r34648.
Comment 8 Glenn Brauen 2008-06-19 09:39:04 PDT
Using r34655, I verified this with the application I was using when I originally discovered this problem. It works as expected now.

Thanks!

Glenn