Bug 149035

Summary: 'relative' positioned child element not cleared completely if parent's style.display is set to 'none'
Product: WebKit Reporter: Grzegorz Ludwikowski <g.ludwikowsk>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ahmad.saleem792, bfulgham, g.ludwikowsk, simon.fraser, zalan
Priority: P2    
Version: WebKit Local Build   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Minimal testcase for reproduction.
none
Screenshot before clicking 'NEW' button
none
Screenshot after clicking 'NEW' button, part of the 'NEW' button not cleared from screen
none
Screenshot, rendered correctly of Firefox none

Description Grzegorz Ludwikowski 2015-09-10 05:49:10 PDT
Created attachment 260919 [details]
Minimal testcase for reproduction.

Reproduction: see minimal_testcase_webkit.html, click 'NEW' button. It sets 'NEW' button parent div's 'style.display' to none, but some part of the 'NEW' button isn't repainted/cleared. If 'BACK' button is pressed, the 'NEW' button is correctly repainted/shown back to screen.

From my analysis I've found out that for the 'NEW' button, during clearing it from screen, its repaint/dirty rectangle doesn't include an offset from being below '.somespace' div. Yet during painting it back, its repaint rectangle is calculated correctly, and includes the offset (200px).

I've tried to find the reason for this difference. Render tree during removing '.somespace' div from screen lacks one anonymous RenderBox, which is present during layouting the div back to screen (as RenderButton parent). Processing this RenderBox in RenderBox.cpp:2233 (computeRectForRepaint(...) - "topLeft.move(locationOffset);") adds mentioned offset.

This anonymous RenderBox is removed from the render tree in RenderBlock.cpp:752 (removeChild(...) - "collapseAnonymousBoxChild(*this, downcast<RenderBlock>(child));") earlier in repainting, during processing '.somespace' div's rendertree node. There is a test, which decides whether it is safe to collapseAnonymousBoxChild, but it evaluates to true.

If I skip the call to collapseAnonymousBoxChild in a debugger, the button is cleared correctly.


'NEW' button is cleared correctly on Firefox and Chromium.

Tested on WebKit MiniBrowserEFL @r189566 on Linux.
Comment 1 Grzegorz Ludwikowski 2015-09-10 05:55:34 PDT
Created attachment 260920 [details]
Screenshot before clicking 'NEW' button
Comment 2 Grzegorz Ludwikowski 2015-09-10 05:57:06 PDT
Created attachment 260921 [details]
Screenshot after clicking 'NEW' button, part of the 'NEW' button not cleared from screen
Comment 3 Grzegorz Ludwikowski 2015-09-10 06:02:45 PDT
Created attachment 260922 [details]
Screenshot, rendered correctly of Firefox
Comment 4 Ahmad Saleem 2022-12-16 02:51:30 PST
I am able to reproduce this bug in Safari Technology Preview 160, it seems to be painting or invalidation issue where when clicking "Next", it does show both "Back" and "Next" but if I move to different tab or resize then "Next" go away. It works perfectly fine on first try in Chrome Canary 110 and Firefox Nightly 110.

Just wanted to share updated testing result. Thanks!