Closed Bug 1266249 Opened 4 years ago Closed 4 years ago

Remove mHasCachedOutline

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: bholley, Assigned: bholley)

References

Details

Attachments

(1 file)

outline-width never takes a percentage, so this is always true.
Comment on attachment 8743602 [details] [diff] [review]
Remove mHasCachedOutline. v1

> nsComputedDOMStyle::DoGetOutlineWidth()
> {
>   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
> 
>   const nsStyleOutline* outline = StyleOutline();
> 
>   nscoord width;
>   if (outline->GetOutlineStyle() == NS_STYLE_BORDER_STYLE_NONE) {
>-    NS_ASSERTION(outline->GetOutlineWidth(width) && width == 0,
>-                 "unexpected width");

You should rewrite this assertion (outline->GetOutlineWidth() == 0) rather than deleting.

> void 
> nsStyleOutline::RecalcData(nsPresContext* aContext)
> {
>   if (NS_STYLE_BORDER_STYLE_NONE == GetOutlineStyle()) {
>     mCachedOutlineWidth = 0;
>-    mHasCachedOutline = true;
>   } else if (IsFixedUnit(mOutlineWidth, true)) {

This IsFixedUnit() check should become an assertion that IsFixedUnit() is true, rather than a test.

>@@ -1286,23 +1286,20 @@ struct nsStyleOutline
...
>-  bool GetOutlineWidth(nscoord& aWidth) const
>+  nscoord GetOutlineWidth() const
>   {
>-    if (mHasCachedOutline) {
>-      aWidth = mCachedOutlineWidth;
>-      return true;
>-    }
>-    return false;
>+    MOZ_ASSERT(GetOutlineStyle() != NS_STYLE_BORDER_STYLE_NONE);
>+    return mCachedOutlineWidth;
>   }

Please don't add this MOZ_ASSERT; this should be usable (and return 0) when the outline-style is none.


r=dbaron with that
Attachment #8743602 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/413ad396d8a4
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in before you can comment on or make changes to this bug.