Hi, On Fri, Dec 11, 2009 at 08:53:18PM +0100, Johannes Hofmann wrote:
Hi,
On Fri, Dec 11, 2009 at 07:46:33AM +0000, corvid wrote:
Here's the nightmarish hackery that I ended up with while getting show/hide to work on display:none.
There might be issues with the implementation - I need to look at it in more detail - but the result is pretty amazing!
Let me check your patch in detail...
bleh. But I realized it still won't work right for the case like <form action=...> <input type=text name=... value="something to right-click on"> <div style="display:none"> <textarea name=...> text </textarea> </div> </form> because I would have to start digging into display:none Textblocks in search of not-display:none form things, but then normally you don't want to display not-display:none things inside display:none...so...ummm... this is all a demonstration of what not to do. As for what _would_ be non-horrible, good question.
I suppose a way just to toggle whether display:none is obeyed at all might be nicer for us, albeit not for the user.
Ok, I understand your concerns now. It might be better to simply not create dw-widgets in the display:none case. At least we should try that option to see if it's simpler. My reasons are: * we would not pollute dw/* which is complex already. dw/* would not look at style.display at all. * as Tim mentioned, you can always switch off remote CSS to see display:none stuff. * it does not mean that elements with display:none would not be part of the DOM tree, as the DOM tree will be separate from the widget tree. I also understand now your's and Tim's concerns about the style pointer in struct Word. As soon as we start to modify styles in an existing widget tree we will get into trouble with all those pointers as we can't modify style objects in place. So I would propose to do display handling in html.cc. Then we can convert Doctree to a real DOM tree. With that in place we can come back to the style in struct Word issue. We might simply have a pointer to the corresponding DoctreeNode, which could hold the style. We might even drop the style sharing code then - but let's see. Here comes a simple example to demonstrate why I think DOM-tree and widget tree should be separate - and I suppose that this is what Sebastian also had in mind with his CSS plan. This piece of HTML: <html> <body> <ul> <li>foo</li> <li>ba<b>r</b></li> </ul> </body> </html> results in: DOM-Tree: Widget-Tree: ========= ============ html | body Textblock | | ul Textblock / \ / \ li li AlignedTextblock AlignedTextblock | b whereas: <html> <body> <ul> <li style="display: inline">foo</li> <li>ba<b>r</b></li> </ul> </body> </html> results in: DOM-Tree: Widget-Tree: ========= ============ html | body Textblock | | ul Textblock / \ | li li AlignedTextblock | b Cheers, Johannes