Closed Bug 88653 Opened 24 years ago Closed 24 years ago

dynamically changing clip does not redraw correctly

Categories

(Core Graveyard :: GFX, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: jqs, Assigned: bzbarsky)

Details

(Keywords: testcase)

Attachments

(4 files)

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.1) Gecko/20010607 BuildID: 2001060703 I should be able to do somthing like this: test = eval("document.getElementById('wrapper')"); test.style.clip = "rect (0px, 100px, 50px, 50px)"; where I change the value of the clipped region, but this just does nothing (works fine on IE5.5) Reproducible: Always Steps to Reproduce: 1) set up a <div> to map a region 100px wide 50px high 2) set up 2 divs within the above div both 50px by 50px (second has a left of 50px -- so they are side by side) 3) put two links to javascript functions that switch the clip:rect to cover/uncover alternating regions (see attached code) Actual Results: nothing happens Expected Results: should hide / reveal different areas of the div test case code: <html> <head> <script language=javascript> function showOne() { test = eval("document.getElementById('wrapper')"); test.style.clip = "rect (0px, 50px, 50px, 0px)"; } function showTwo() { test = eval("document.getElementById('wrapper')"); test.style.clip = "rect (0px, 100px, 50px, 50px)"; } </script> </head> <body bgcolor="#FFFFFF" text="#000000"> <div id="wrapper" style=" clip:rect(0px,50px,50px,0px); position: absolute; z-index: 2; top: 25px; left: 5px; width: 100px; height: 50px; visibility: visible"> <div id="content" style=" position: absolute; z-index: 1; top: 0px; left: 0px; width: 50px; height: 50px; visibility: visible"> one</div> <div id="content2" style=" position: absolute; z-index: 1; top: 0px; left: 50px; width: 50px; height: 50px; visibility: visible"> two</div></div> <div id="links" style=" position: absolute; z-index: 1; top: 100px; left: 0px; width: 100px; height: 50px; visibility: visible"> <a href="javascript:showOne();">Show one</a><br><a href="javascript:showTwo();">Show two</a> </div> </body> </html>
Attached file testcase
this may be a dup of bug 69182, I'm not qualified to tell.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: testcase
Attached file corrected testcase
Two problems here: 1) "rect" must be immediately followed by "(" to be valid css. The testcase had a space between the two. So we ignored the invalid css 2) Once you fix that (see my attached testcase), we still don't change the clip. Forcing a reflow (eg resizing browser window) makes the clip update. Looks like a painting problem... Over to compositor.
Assignee: jst → kmcclusk
Component: DOM Style → Compositor
QA Contact: ian → petersen
Summary: Cannot change clip:rect value dynamicly → dynamically changing clip does not redraw correctly
I thought the problem might have been that view's were not being updated with new clipping values because the style hint for clip property change was visual and it needed to be reflow to get the view updated. I tied modifying: PRInt32 nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const { if (mBinding != aOther.mBinding || mPosition != aOther.mPosition) return NS_STYLE_HINT_FRAMECHANGE; if ((mDisplay == aOther.mDisplay) && (mFloats == aOther.mFloats) && (mOverflow == aOther.mOverflow)) { if ((mBreakType == aOther.mBreakType) && (mBreakBefore == aOther.mBreakBefore) && (mBreakAfter == aOther.mBreakAfter)) { if ((mClipFlags == aOther.mClipFlags) && (mClip == aOther.mClip)) { return NS_STYLE_HINT_NONE; } return NS_STYLE_HINT_REFLOW; <== changed this to Reflow instead of Visual } return NS_STYLE_HINT_REFLOW; } return NS_STYLE_HINT_FRAMECHANGE; } This DID NOT fix the problem! I set breakpoint in the debugger and discovered that when clipping changes we are not detecting any change in the nsStyleDisplay struct when it appears we should. Looks like a style issue. Reassinging to Pierre for further analysis.
Assignee: kmcclusk → pierre
Kevin, in this case the hint comes from nsCSSProps::kHintTable instead of from nsStyleDisplay::CalcDifference() Attaching a patch that fixes this bug for me. Chances are, we want to change nsStyleDisplay::CalcDifference() as well
Attached patch Possible patchSplinter Review
good fix. roc+moz, please s/r
Assignee: pierre → bzbarsky
Comment on attachment 52812 [details] [diff] [review] More comlete patch (change nsStyleDisplay::CalcDifference too) r=pierre
Attachment #52812 - Flags: review+
checked into trunk
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Thanks for working this... This kind of testing / development will help my case in adding Moz to our supported platforms (a choice instead of IE) I can now begin the port to Moz (this bug was a sev 0 for our Web App) Jeffrey (Reporter)
Jeffrey, if you can verify that this bug is fixed in current nightlys, could you change the status to "VERIFIED"?
Verified this fixed my issue... Thanks again...
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: