Closed Bug 279156 Opened 20 years ago Closed 20 years ago

[FIXr]Default constructor for nsStyleBorder should set mBorderStyle better

Categories

(Core :: CSS Parsing and Computation, defect, P3)

x86
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla1.8beta2

People

(Reporter: bzbarsky, Assigned: bzbarsky)

Details

Attachments

(1 file)

In brief, we want the default constructor to create the "initial" border struct.
 That is, it should have the equivalent of setting:

 border-width: medium;
 border-style: none;
 border-color: -moz-use-text-color;

At the moment, we set it to:

 border-width: medium;
 border-style: none;
 border-color: rgb(0,0,0);

and then set the BORDER_COLOR_DEFINED flag to false so that in
nsStyleBorder::RecalcData we will go through and call SetBorderToForeground() on
all the sides.  I think we should be able to just eliminate BORDER_COLOR_DEFINED
altogether if we just set the color up front in the constructor.
Attached patch PatchSplinter Review
The basic idea here is that the only way that BORDER_COLOR_DEFINED could be not
set on a side is if the color for that side had never been set (to a color, to
foreground, or to transparent), and the border-colors for that side had never
been set.  In that case, the "foreground" flag got set.

The same effect can be achieved by setting the "foreground" flag in the
constructor, and eliminating the "defined" flag altogether, since border
structs now always have a defined border color ("foreground" if nothing else
was explicitly set on the struct).

I've tested that this correctly handles things like "border-style: solid"
(without setting color) on root and nonroot elements, and that it passes the
tests at http://dbaron.org/css/test/shortborder and
http://dbaron.org/css/test/shortborder2

The "defined" flag on outline was simply unused, so I removed it from there
too...
Attachment #171911 - Flags: superreview?(dbaron)
Attachment #171911 - Flags: review?(dbaron)
fantasai, want to check on that patch too?  You've messed around in this code...
Priority: -- → P3
Summary: Default constructor for nsStyleBorder should set mBorderStyle better → [FIX]Default constructor for nsStyleBorder should set mBorderStyle better
Target Milestone: --- → mozilla1.8beta
Comment on attachment 171911 [details] [diff] [review]
Patch

r+sr=dbaron; sorry for the delay
Attachment #171911 - Flags: superreview?(dbaron)
Attachment #171911 - Flags: superreview+
Attachment #171911 - Flags: review?(dbaron)
Attachment #171911 - Flags: review+
Summary: [FIX]Default constructor for nsStyleBorder should set mBorderStyle better → [FIXr]Default constructor for nsStyleBorder should set mBorderStyle better
Checked in for 1.8b2
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Target Milestone: mozilla1.8beta1 → mozilla1.8beta2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: