Closed
Bug 33601
Opened 24 years ago
Closed 23 years ago
DOM modification of opacity property doesn't work
Categories
(Core :: CSS Parsing and Computation, defect, P2)
Tracking
()
RESOLVED
FIXED
Future
People
(Reporter: Chris244, Assigned: roc)
References
Details
(Keywords: polish)
Attachments
(5 files, 4 obsolete files)
519 bytes,
text/html
|
Details | |
568 bytes,
text/html
|
Details | |
2.28 KB,
text/html
|
Details | |
5.20 KB,
patch
|
dbaron
:
review+
waterson
:
superreview+
|
Details | Diff | Splinter Review |
307 bytes,
text/html
|
Details |
Modifying the opacity property of an element that had opacity: 1.0 when the page loaded doesn't work. Since the default opacity value is 1.0, this applies to all elements that don't have opacity < 1. If the element does have opacity < 1 when the page loads, updates to the opacity property are reflected correctly on the display. The value may even be changed to 1 and back. This is a drawing problem. The actual value of the opacity property changes but is not reflected on screen. This is most likely due to an important drawing optimization to only blend elements with opacity < 1. However, if the value changes from 1, the update must be realized.
Reporter | ||
Comment 1•24 years ago
|
||
Comment 2•24 years ago
|
||
The style contexts are getting updated correctly (Show Style Context in Viewer before and after changing). However, the opacity of the view is not getting update correctly (similarly, Show Views from Viewer). I think the frames need to handle the case where they have a view and the apacity is being changed; they need to update the view's opacity.
Assignee: pierre → attinasi
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•24 years ago
|
Status: NEW → ASSIGNED
Target Milestone: --- → M17
Comment 3•24 years ago
|
||
All of the mechanisms are in place to update the view's opacity, however it is not happening correctly. I've spent a couple of hours looking at this, how important is it? Nominating nsbeta2 to get the PDT's opinion. Note: setting the opacity statically works fine, it is modification of opacity via the DOM that is failing.
Keywords: nsbeta2
Putting on [nsbeta2-] radar. Not critical to beta2. Adding nsbeta3 keyword
Keywords: nsbeta3
Whiteboard: [nsbeta2-]
Updated•24 years ago
|
Target Milestone: M17 → M20
Comment 5•24 years ago
|
||
[nsbeta3-] and Future.
Whiteboard: [nsbeta2-] → [nsbeta2-][nsbeta3-]
Target Milestone: M20 → Future
Comment 6•24 years ago
|
||
Hmm, no progress! But the bug is now a little bit bigger! If you start the testcase, now the div id="h" doesn't get opacity 0.5 on startup. You can not click the button again (i think that's an other bug!) ... in http://www336.l4.xodox.com/radio/index.html the select box wouldn't redraw rightly but this is every time you try a not correct JavaScript! To get the button work again, select something else!
Assignee | ||
Updated•24 years ago
|
Assignee: attinasi → roc+moz
Status: ASSIGNED → NEW
Assignee | ||
Comment 7•24 years ago
|
||
The name of the opacity property has changed to "-moz-opacity", that's why the testcase doesn't work anymore. I know what the problem is with this bug. I will take care of it. Marc, I'm assigning it to myself, if that's not OK, take it back :-).
Comment 8•24 years ago
|
||
Thanks Robert - is this fixed by your view manager rewrite? CC'ing self.
Assignee | ||
Comment 9•24 years ago
|
||
No. I think the problem is that we're not creating a view for element 'w' (the one that starts with opacity 1.0). When its opacity changes to less than 1.0, we need to create a view for it. But the style system just gives us a VISUAL change hint, so we don't get a chance to create a view (which can only happen on FRAMECHANGE). The fix is to make opacity changes from 1.0 to less than 1.0 cause FRAMECHANGE. We don't want to make ALL opacity changes cause FRAMECHANGE though, because that would make fade-in/fade-out effects hideously slow. We actually have a similar problem with background-attachment. Changing it to "fixed" in the DOM means we need a view for the frame, but we won't create one. It would be cool if we could have a style change hint that meant "FRAMECHANGE if the frame has no view, otherwise VISUAL". But we shouldn't worry about that for now.
Status: NEW → ASSIGNED
Assignee | ||
Comment 10•24 years ago
|
||
Assignee | ||
Comment 11•24 years ago
|
||
Assignee | ||
Comment 12•24 years ago
|
||
Assignee | ||
Comment 13•24 years ago
|
||
Marc, can you review?
Comment 14•24 years ago
|
||
I think maybe a hint like 'VIEWCHANGE might be useful for cases where we need to create or destroy views but otherwise don't need to muck with the frame tree, but I agree that we could address that later. Anyway, the changes look OK. A couple of issues: In ComputeChangeHint there is a typo I believe: the comment should say 'Otherwise there must already be a view' not 'Otherwise there must already be a frame' I think. Additionally, in that new function shouldn't we check for the opacity going from less-than-one back to one, so we can eliminate the view? I admit is is not as important, since having an extra view around is probably not a big deal, but it struck me as asymmetrical and suboptimal memory-wise (but better for performance since it eliminates a reframe). I have a new implemenation of that method that causes a REFAME when the opacity changes to or from 1.0 instead of just from 1.0. What do you think? Here is a possible implementaion of the method that cleans up the view when it is no longer needed: static PRInt32 ComputeChangeHint(nsCSSProperty aPropID, const nsCSSValue& aOldValue, const nsCSSValue& aValue) { switch (aPropID) { case eCSSProperty_opacity: NS_ASSERTION(aOldValue != aValue, "ComputeChangeHint should not be called with equal values"); if(aOldValue.GetUnit() == eCSSUnit_Number && aValue.GetUnit() == eCSSUnit_Number) { // If the opacity is changing to or from 1.0, then reframe to cause a view to be created or eliminated // Otherwise we just need a visual change. This is important because opacity is frequently used // for fade effects, and we don't want to reframe for every step of the fade. if( (aOldValue.GetFloatValue() < 1.0 && aValue.GetFloatValue() == 1.0) || (aOldValue.GetFloatValue() == 1.0 && aValue.GetFloatValue() < 1.0) ){ // XXX: it would be better to pass out a hint NS_STYLE_HINT_VIEWCHANGE, but it does not exist return NS_STYLE_HINT_FRAMECHANGE; } else { return NS_STYLE_HINT_VISUAL; } } default: return nsCSSProps::kHintTable[aPropID]; } }
Assignee | ||
Comment 15•24 years ago
|
||
> In ComputeChangeHint there is a typo I believe Oops, you are right. > REFAME when the opacity changes to or from 1.0 instead of just from 1.0 It looks OK. I originally thought that was unnecessarily complex, but it probably does make slightly more sense to do it this way. I will attach a new patch.
Comment 16•24 years ago
|
||
Will -moz-opacity changed after the fix back to opacity ?? And what is with the other bug (stop redrawing by false JavaScript)? Should I make a new sample and Bug Report?
Assignee | ||
Comment 17•24 years ago
|
||
Assignee | ||
Comment 18•24 years ago
|
||
Note that I hoisted the assertion and removed the fall through to "default:". I also simplified the expression based on the assumption that the two values are not equal. (Of course, thing still work safely even if the assumption is violated, we just get a superfluous frame change.) Alexander, "-moz-opacity" is not going to be changed back to "opacity" because "opacity" is not a standard CSS property. It may become standard in the future, but obviously we don't know if or when that will happen. There are various bugs related to opacity and widgets. Please have a good look through Bugzilla and see if your one has already been reported.
Comment 19•24 years ago
|
||
Robert, your patch looks great (I like your version much better, btw.) Thanks, and r=attinasi
Comment 20•24 years ago
|
||
ok, it works with Mozilla/5.0 (Windows; U; Win98; en-US; m18) Gecko/2000110904 File updated: http://www336.l4.xodox.com/radio/test2.html
Comment 21•24 years ago
|
||
r=buster. the only thing I don't like is forcing a reframe when all we need is a manipulation of the view. This is horribly inefficient. It will generally cause a reframe of all children of the frame that is being targeted, which is potentially very expensive. Please submit a perf bug about this issue. We need to invent the NS_STYLE_HINT_VIEWCHANGE you hint at in the patch.
Assignee | ||
Comment 22•24 years ago
|
||
Implementing such a VIEWCHANGE thingy would be rather difficult. It would require inserting a view into the middle of the view hierarchy.
Updated•24 years ago
|
Keywords: mozilla1.0
QA Contact: chrisd → ian
Assignee | ||
Comment 23•24 years ago
|
||
Darn, I droppped this on the floor. Marc, is your review still good?
Comment 24•24 years ago
|
||
Robert, my r= has no statute of limitations ;) Assuming it still works, that is...
Assignee | ||
Comment 25•23 years ago
|
||
I will attach a new patch, retargeted to the files in 'content' but otherwise unchanged. Given that Marc's r= is still valid, I'd like sr= from waterson and then I'll check it in :-).
Priority: P3 → P2
Whiteboard: [nsbeta2-][nsbeta3-]
Assignee | ||
Comment 26•23 years ago
|
||
Comment 27•23 years ago
|
||
*** Bug 92282 has been marked as a duplicate of this bug. ***
Comment 28•23 years ago
|
||
Kevin/Waterson: please s/r and comment on [buster 2000-11-16 12:22].
Comment 29•23 years ago
|
||
So, ah..., there's a patch and it has been there since 2001-03-27 with an r=attinasi and a request for s/r=waterson. What's the holdup? I suppose if we are going to sit of this patch indefinitely, the workaround is instead of using an upper value of 100% to, rather, use an upper value no greater than exactly 99.9999961853% for DOM modifications of -moz-opacity (style.MozOpacity) to work. Jake
Comment 30•23 years ago
|
||
I might've missed this: sometimes I go through bug mail pretty quickly. Anyway, is the patch still current? If so, sr=waterson.
Assignee | ||
Comment 31•23 years ago
|
||
The patch was obseleted by one or more style system reorgs. New patch coming up.
Assignee | ||
Comment 32•23 years ago
|
||
Please re-r/sr. Thanks!
Attachment #19009 -
Attachment is obsolete: true
Attachment #19021 -
Attachment is obsolete: true
Attachment #29000 -
Attachment is obsolete: true
Comment 33•23 years ago
|
||
Actually, I'd feel more comfortable if dbaron or hyatt could r= this one (to go along with attinasi's sr=).
Assignee | ||
Comment 34•23 years ago
|
||
OK, I'll ping them.
Comment on attachment 65730 [details] [diff] [review] Updated patch r=dbaron, although it would be good to put a comment in nsCSSPropList.h (at both changes) that you really mean VIEWCHANGE. Also, nsStyleVisibility::CalcDifference could be written a little more cleanly if you do an if/else inside the first part that you changed (which would mean you wouldn't have to change the second part you changed at all)
Attachment #65730 -
Flags: review+
Assignee | ||
Comment 36•23 years ago
|
||
The first test in CalcDifference() tests more than just mOpacity != aOther.mOpacity, so I don't think it suffices to put the rest of the function into an else clause.
Assignee: roc+moz → dbaron
Status: ASSIGNED → NEW
Oops. Never mind the CalcDifference comment.
Assignee | ||
Comment 39•23 years ago
|
||
Chris, since Marc is apparently out of town I would be grateful if you could sr or at least rs this.
Comment 40•23 years ago
|
||
Comment on attachment 65730 [details] [diff] [review] Updated patch sr=waterson
Attachment #65730 -
Flags: superreview+
Comment 41•23 years ago
|
||
dbaron, didn't you mean "avoid else after return and invert the if condition to avoid a gratuitous cvs diff line"? I.e., instead of - return NS_STYLE_HINT_NONE; + if (mOpacity == aOther.mOpacity) + return NS_STYLE_HINT_NONE; + else + return NS_STYLE_HINT_VISUAL; write it this way: + if (mOpacity != aOther.mOpacity) + return NS_STYLE_HINT_VISUAL; return NS_STYLE_HINT_NONE; /be
Assignee | ||
Comment 42•23 years ago
|
||
Checked in.
Assignee | ||
Comment 43•23 years ago
|
||
Marking FIXED
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 44•23 years ago
|
||
ComputeChangeHint resulted in: roc+ (188 warnings) 1-188. content/html/style/src/nsCSSParser.cpp:3356 (See 1st of 188 warnings in build log)Enumeration value `eCSSProperty_UNKNOWN' not handled in switch It appears you're using a switch (foo){case bar: {/*...*/}} where a simple if would suffice: if (foo == bar) {{/*...*/}}. If you expect to use the switch for other cases, please add a default, otherwise can we switch to if ()?
Assignee | ||
Comment 45•23 years ago
|
||
Add a default. You write the patch, I'll review it :-).
Comment 46•23 years ago
|
||
sorry, there's an else after return in the neighborhood and if brendan saw me patching that he'd probably ask me why i left it alone (after asking why i bothered spending any time on this at all)
Assignee | ||
Comment 47•23 years ago
|
||
Comment on attachment 68370 [details] [diff] [review] add default Personally I think "else after return" is Just Fine; it promotes a more functional style of programming. But if it makes Brendan happy :-)
Attachment #68370 -
Flags: review+
Comment 48•23 years ago
|
||
Comment on attachment 68370 [details] [diff] [review] add default sr=alecf
Attachment #68370 -
Flags: superreview+
Attachment #68370 -
Attachment is obsolete: true
Comment 49•23 years ago
|
||
Comment on attachment 68370 [details] [diff] [review] add default I checked this in. Within two cycles the warning count dropped by 182. The odd thing is that in the interim cycle, I gained the blame for those warnings. By the second cycle I couldn't find them anymore.
Comment 50•22 years ago
|
||
Should this bug be reopened? The reason is that bug 66022 was reopened with this comment from Rick Potts ( bug 66022, comment 25 ). I'm reopening this bug :-( Currently, the attached test case causes mozilla to hang because the onLoad handler for the image is fired *each* time the 'MozOpacity' style is changed. What's happening is that image onLoad handlers are being incorrectly fired each time the associated image frame is recreated (due to style changes)... -- rick It really would suck if, after we spent so long waiting for a fix and finally getting one, MozOpacity didn't work in Mozilla 1.0! Jake
Comment 51•22 years ago
|
||
Bug not yet reopened -- what's the scoop? (roc, C isn't functional, neither is C++, but small lapses in else-after-return intolerance are ok -- the usual bad pattern, however, leads to massively overindented Pascal-ese with the common case buried 9 else-if's down and off the right margin :-). /be
Comment 52•22 years ago
|
||
Today I realized the modification of MozOpacity property is not working for elements that are inline and with style defiintion without position: attribute. When I add position:relative when it works. I am wondering if you know about this regression... I see the regression in asa's slide presentations and I am helping him creating the workaround for now.
Comment 53•22 years ago
|
||
Note. the element is a span. Does not work via markup of via DOM. I created this simple testcase from asa's presentation. If you believe this is another regression not related with this bug, please let me know. This is an important regression at this point in the game and it's branch.
Assignee | ||
Comment 54•22 years ago
|
||
opacity is fundamentally broken and is not a priority for 1.0.
Comment 55•22 years ago
|
||
Robert, do you think this one is a regression? or is another bug? (since opacity does not work with simple markup).
Assignee | ||
Comment 56•22 years ago
|
||
I'm not sure that opacity on inline elements has ever really worked properly, so I'm not sure if this is a regression or an old bug.
Comment 57•22 years ago
|
||
Unless I'm missing something, this is definitely a regression. It worked fine after the patch for this bug was committed. The reason why I brought it up is that testcases that the patch for this bug fixed are no longer working. How is that not a regression? Jake
Comment 58•21 years ago
|
||
see bug 202028, to see behaviour of '-moz-opacity'
You need to log in
before you can comment on or make changes to this bug.
Description
•