Summary: | Regression: Uncaught infinite recursion in javascript | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Allan Sandfeld <kde> |
Component: | khtml | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | amantia, groszdanielpub, loacoon, maksim |
Priority: | NOR | ||
Version: | 4.1.0 | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Unspecified | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Allan Sandfeld
2008-08-26 12:10:36 UTC
IRC discussion summary: it loops infinitely because it keeps revisiting the same node, as it should since the collection is live. Further analysis: After debugging a bit w/Opera, it also revisits the image, but skips over it the next time it visits. Something is wrong with out ::width, I guess. Well, it's getting it from m_renderer->contentWidth(), after doing updateRendering(), but it still gets the stale value, not what it set. Actually, even the below fails, returning 0: <img src="http://www.kde.org/media/images/top-kde.jpg" id="img"> <script> function test() { var i = document.getElementById("img"); //alert(i); alert(i.width); } </script> <body onload="test()"> Allan: Q: how is the size of the image supposed to be recomputed from updateRendering/recalcStyle? It does the new style computation, then diffs them, and returns NoInherit the first time it's changed. Then only recalcStyle gets called and that's it --- how should some sort of a relayout/recompute size method be invoked? I can see that RenderObject::setStyle will call setNeedsLayoutAndMinMaxRecalc, as well as dirtyFormattingContext, but that just sets bits, doesn't it? It seems like this ought to be synchronous for things like offsetWidth, etc., too. Oh. That calls updateLayout and not updateRendering. How about this: --- html/html_imageimpl.cpp (revision 847547) +++ html/html_imageimpl.cpp (working copy) @@ -286,7 +286,7 @@ return 0; } - document()->updateRendering(); + document()->updateLayout(); return m_render ? m_render->contentWidth() : getAttribute(ATTR_WIDTH).toInt(); @@ -304,7 +304,7 @@ return 0; } - document()->updateRendering(); + document()->updateLayout(); return m_render ? m_render->contentHeight() : getAttribute(ATTR_HEIGHT).toInt(); Committed the above. *** Bug 165668 has been marked as a duplicate of this bug. *** *** Bug 166781 has been marked as a duplicate of this bug. *** *** Bug 233246 has been marked as a duplicate of this bug. *** Should note: The original reported case was solved by patch by Maksim. A test-case is now needed, and the duplicates may be unrelated but similar issue. |