Closed Bug 1209715 Opened 4 years ago Closed 4 years ago

Give DrawResult operators to make it easier to combine different DrawResults

Categories

(Core :: ImageLib, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: seth, Assigned: seth)

References

Details

Attachments

(1 file)

Right now we only combine different DrawResults in nsCSSRendering::PaintBackgroundWithSC(), but to fix 1209703 we're going to have to combine them in *many* places, because borders are frequently drawn using loops. This operation is going to be so common that I think operator overloads are justified.

The operators that I think make the most sense to use for this are the bitwise AND operators, because conceptually combining DrawResults works in the same way as bitwise AND: the result is DrawResult::SUCCESS only if both operands are DrawResult::SUCCESS, and otherwise the result is failure. The details are slightly more complicated, because DrawResult::BAD_IMAGE should also be sticky; see the comments in the patch for details.
(In reply to Seth Fowler [:seth] [:s2h] from comment #0)
> DrawResult::BAD_IMAGE should
> also be sticky; see the comments in the patch for details.

Actually I stated this exactly backwards - DrawResult::BAD_IMAGE is explicitly non-sticky, because we want to know if there were any recoverable failures that might go away if we do another paint. So we only want to return DrawResult::BAD_IMAGE if there were no recoverable failures. Unlike comment 0, the comments in the patch get this right. =)
Here's the patch.
Attachment #8667515 - Flags: review?(tnikkel)
Blocks: 1209725
Blocks: 1213465
Attachment #8667515 - Flags: review?(tnikkel) → review+
Thanks for the review!
https://hg.mozilla.org/mozilla-central/rev/4d87d0f8b704
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.