Bug 86315

Summary: Styles are not recalculated when the seamless attribute is dynamically added/removed
Product: WebKit Reporter: pimvdb
Component: FramesAssignee: Eric Seidel (no email) <eric>
Status: RESOLVED FIXED    
Severity: Normal CC: eric, jamesr, jchaffraix, kling, koivisto, ojan, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 45950    
Attachments:
Description Flags
Test case - main page
none
Test case - iframe page
none
Patch none

Description pimvdb 2012-05-13 02:14:16 PDT
Scenario:

A main page with a seamless iframe and an iframe page. The main page has CSS "color: red" applied to "body". Both the main page and the iframe page have text, which initially is both colored red (as expected).

Problems:

When the seamless attribute is removed, the iframe page should lose its inherited color style. So, the iframe page should get black text, but it stays red. Using the inspector to select an element on the parent page (e.g. the html element) *does* make the text color to be updated to black.

Also (without the attribute removed), when the main web page gets another color set such as blue, then the main web page gets blue text but the iframe page stays red. The inspector trick does not seem to work here.

I believe this is a bug because the HTML5 spec says:

"The attribute can be set or removed dynamically, with the rendering updating in tandem."

I'll try to attach a test case, but it's tricky because there are two HTML files involved (main page and parent page).
Comment 1 pimvdb 2012-05-13 02:14:55 PDT
Created attachment 141601 [details]
Test case - main page
Comment 2 pimvdb 2012-05-13 02:15:24 PDT
Created attachment 141602 [details]
Test case - iframe page
Comment 3 Eric Seidel (no email) 2012-05-14 16:47:19 PDT
This sounds like two (great) bugs.  I'm working on bug #1 now.  We'll have to split this bug into two to solve both.
Comment 4 Eric Seidel (no email) 2012-05-14 17:23:25 PDT
Bug #2 is not actually a bug in the code, but a bug in your test. :)  The body { } selector is inherited by the child iframe, so even though you change the color on the outer body, it will not be changed on the inner body, since a more specific selector applies. :)
Comment 5 Eric Seidel (no email) 2012-05-14 17:31:55 PDT
Created attachment 141826 [details]
Patch
Comment 6 Eric Seidel (no email) 2012-05-14 17:34:12 PDT
Thank you for the great bug!  I look forward to many more. :)

The layout changes for seamless should land in the next couple days, at which point it should begin being actually useful. :)  Right now we have only landed the style inheritance, stylesheet inheritance, and navigational changes.  The dynamic sizing/layout code will be in my next patch.
Comment 7 Eric Seidel (no email) 2012-05-14 17:45:34 PDT
I've heard that Antti and Kling are perhaps familiar with the world of style as well. :)
Comment 8 Andreas Kling 2012-05-14 18:18:56 PDT
Comment on attachment 141826 [details]
Patch

Looks fabulous, r=me
Comment 9 WebKit Review Bot 2012-05-14 21:35:47 PDT
Comment on attachment 141826 [details]
Patch

Clearing flags on attachment: 141826

Committed r117026: <http://trac.webkit.org/changeset/117026>
Comment 10 WebKit Review Bot 2012-05-14 21:35:52 PDT
All reviewed patches have been landed.  Closing bug.
Comment 11 pimvdb 2012-05-15 02:47:47 PDT
Whoops, bug #2 is indeed my own fault. Sorry about that.

Thanks for the very quick response and patch.