RESOLVED FIXED 62202
[ShadowContentElement] should layout child whitespace between span
https://bugs.webkit.org/show_bug.cgi?id=62202
Summary [ShadowContentElement] should layout child whitespace between span
Hajime Morrita
Reported 2011-06-07 04:19:07 PDT
Created attachment 96227 [details] A repro This is the first step for a series of <content> bug hunting.
Attachments
A repro (513 bytes, text/html)
2011-06-07 04:19 PDT, Hajime Morrita
no flags
Patch (13.92 KB, patch)
2011-06-20 01:10 PDT, Hajime Morrita
no flags
Archive of layout-test-results from ec2-cr-linux-03 (1.37 MB, application/zip)
2011-06-20 01:26 PDT, WebKit Review Bot
no flags
Patch (41.38 KB, patch)
2011-06-20 02:12 PDT, Hajime Morrita
no flags
Archive of layout-test-results from ec2-cr-linux-03 (1.33 MB, application/zip)
2011-06-20 02:45 PDT, WebKit Review Bot
no flags
Updated expectations (44.16 KB, patch)
2011-06-20 21:01 PDT, Hajime Morrita
dglazkov: review+
Roland Steiner
Comment 1 2011-06-07 15:53:44 PDT
Adding a span unequivocally may not the correct thing to do in all scenarios. IOW, this again raises the question how we should treat child text nodes, and amongst them inter-element white-space. Additionally/alternatively, we could extend <content> so that one can specify what goes in between child elements, in order for it to work similar to string join. In the simplest case, we could just use the children of the <content> element to have this meaning.
Hajime Morrita
Comment 2 2011-06-07 23:18:01 PDT
(In reply to comment #1) > Adding a span unequivocally may not the correct thing to do in all scenarios. IOW, this again raises the question how we should treat child text nodes, and amongst them inter-element white-space. > > Additionally/alternatively, we could extend <content> so that one can specify what goes in between child elements, in order for it to work similar to string join. In the simplest case, we could just use the children of the <content> element to have this meaning. At least this doesn't work for <details>. It should hold text node as well because using <content> is just an implementation detail. And <details> is a benchmark for expressiveness of <content>.
Hajime Morrita
Comment 3 2011-06-07 23:19:23 PDT
child elements, in order for it to work similar to string join. In the simplest case, we could just use the children of the <content> element to have this meaning. > At least this doesn't work for <details>. > It should hold text node as well because using <content> is just an implementation detail. > And <details> is a benchmark for expressiveness of <content>. On the other hand, I found that handling text nodes correctly in forwarded context is really tricky...
Roland Steiner
Comment 4 2011-06-09 22:27:11 PDT
A simple way could be to view <content select="..."> as "yanking out" those elements from under the host node that it selects. A simple <content> then gets everything that is left over, text nodes and all. This view of things should work for <details>, but I'm not sure if it can address all use cases.
Dimitri Glazkov (Google)
Comment 5 2011-06-10 09:56:29 PDT
(In reply to comment #4) > A simple way could be to view <content select="..."> as "yanking out" those elements from under the host node that it selects. A simple <content> then gets everything that is left over, text nodes and all. Yes! That's exactly how we want it.
Hajime Morrita
Comment 6 2011-06-20 01:10:04 PDT
WebKit Review Bot
Comment 7 2011-06-20 01:26:16 PDT
Comment on attachment 97762 [details] Patch Attachment 97762 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/8908423 New failing tests: fast/html/details-add-child-2.html fast/html/details-open4.html fast/html/details-replace-text.html fast/html/details-nested-1.html fast/html/details-remove-child-1.html fast/html/details-open-javascript.html fast/html/details-no-summary4.html fast/html/details-open2.html fast/html/details-remove-child-2.html fast/html/details-nested-2.html fast/html/details-add-details-child-2.html
WebKit Review Bot
Comment 8 2011-06-20 01:26:21 PDT
Created attachment 97764 [details] Archive of layout-test-results from ec2-cr-linux-03 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-03 Port: Chromium Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Hajime Morrita
Comment 9 2011-06-20 02:12:47 PDT
Hajime Morrita
Comment 10 2011-06-20 02:14:57 PDT
Theoretically, there are more edge cases to handle. But <details> has its <content> elements only on certain position. So we need to unveil such potential cases with internals.createShadowElement(). But it's another story with another bug id...
WebKit Review Bot
Comment 11 2011-06-20 02:45:19 PDT
Comment on attachment 97765 [details] Patch Attachment 97765 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/8911435 New failing tests: fast/html/details-replace-text.html
WebKit Review Bot
Comment 12 2011-06-20 02:45:24 PDT
Created attachment 97768 [details] Archive of layout-test-results from ec2-cr-linux-03 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-03 Port: Chromium Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Hajime Morrita
Comment 13 2011-06-20 21:01:35 PDT
Created attachment 97923 [details] Updated expectations
Hajime Morrita
Comment 14 2011-06-21 22:50:20 PDT
Finally it's green!
Dimitri Glazkov (Google)
Comment 15 2011-06-22 08:06:14 PDT
Comment on attachment 97923 [details] Updated expectations View in context: https://bugs.webkit.org/attachment.cgi?id=97923&action=review So it seems that we are compensating for the fact that we don't have the final flattened tree concept (http://dev.w3.org/2006/xbl2/#the-final-flattened-tree). Perhaps we should look at this problem from the overall design perspective and solve it at that level. O(N) iterations like these always make me feel like there's something missing in bigger picture. > Source/WebCore/ChangeLog:9 > + ignored forward content tree hierarchies and used render-object forwarded > Source/WebCore/ChangeLog:13 > + In this way, these methods can reflect hierarchies of forward (twilight) tree. forwarded. not twilight, right? Light tree I thought? Since we don't have either one defined anywhere, let's just zap the reference to it. > Source/WebCore/dom/NodeRenderingContext.cpp:111 > + size_t currentIndex = notFound; > + for (size_t i = 0; i < parent->inclusionCount(); ++i) { > + if (current == parent->inclusionAt(i)) { > + currentIndex = i; > + break; > + } > + } Sounds like this should be ShadowContentElement::indexOfInclusion. > Source/WebCore/rendering/RenderTreeAsText.cpp:763 > + return ts.release(); Ouch.
Hajime Morrita
Comment 16 2011-06-23 17:54:15 PDT
(In reply to comment #15) > (From update of attachment 97923 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=97923&action=review > > So it seems that we are compensating for the fact that we don't have the final flattened tree concept (http://dev.w3.org/2006/xbl2/#the-final-flattened-tree). Perhaps we should look at this problem from the overall design perspective and solve it at that level. O(N) iterations like these always make me feel like there's something missing in bigger picture. Well, we will not have explicit tree structure for "final flattened tree". We'll make some traversal abstraction instead. For event, your EventDispatchMediator family helps (in my understanding.) For render-tree creation, NodeRenderingContext should help. I wonder if we should have some unified flattened tree traverser. I don't yet have any good picture for that.
Hajime Morrita
Comment 17 2011-06-23 18:35:50 PDT
Note You need to log in before you can comment on or make changes to this bug.