nsStyleImage::mImage is always set to a non-null object when its mType
is eStyleImageType_Image, so let's just assert that and stop null
checking in that case.
MozReview-Commit-ID: 2ect4coV0LV
--HG--
extra : rebase_source : 768b0c5989bc3e32d4d8ab803d85885f223bcb43
After using enum class, a switch-case warning in CombineBreakType is caught.
This is one of such kind safty checks that we would like to gain.
Fix it by adding default case for switch-case in CombineBreakType.
MozReview-Commit-ID: BdS3LPN6qzX
--HG--
extra : rebase_source : 17f24a0d482ed6eb51b23e6942d0ac1c87375e0b
The main renaming was generated with the following python script:
```
import sys
import re
CAMEL_CASE_REGEX = re.compile(r"(^|_|-)([A-Z])([A-Z]+)")
DISPLAY_REGEX = re.compile(r"\bNS_STYLE_DISPLAY_([^M][A-Z_]+)\b")
def to_camel_case(ident):
return re.sub(CAMEL_CASE_REGEX,
lambda m: m.group(2) + m.group(3).lower(), ident)
def constant_to_enum(constant):
return "StyleDisplay::" + to_camel_case(constant) + ("_" if constant == "NONE" else "")
def process_line(line):
return re.sub(DISPLAY_REGEX,
lambda m: constant_to_enum(m.group(1)), line)
lines = []
with open(sys.argv[1], "r") as f:
for line in f:
lines.append(process_line(line))
with open(sys.argv[1], "w") as f:
for line in lines:
f.write(line)
```
And the following shell commands:
```
find . -name '*.cpp' -exec python display.py {} \;
find . -name '*.h' -exec python display.py {} \;
```
MozReview-Commit-ID: 91xYCbLC2Vf
The fact that HasTransform() depends on the frame requires the *Internal
functions rather than simply having the public function that takes a
frame call the public function that takes a style context.
MozReview-Commit-ID: CcWZjDTIr52
Given that script may change cursor image in a high frequency, and it
is usually small, it is probably better discarding it urgently.
MozReview-Commit-ID: J6tqIODXykg
operator new overloads that declare that they don't throw exceptions
require a null check on their return value, per the C++ spec. We know
that Servo isn't going to call these functions with null pointers, so
remove the CPP_THROW_NEW annotation and save ourselves some work.
Structs in our style system use an arena-style allocation system,
managed by the presshell to which they belong. All of the relevant
overloads that forward allocation requests to the presshell declare
themselves as CPP_THROW_NEW, which indicates that they do not throw
exceptions. The C++ specification states that operator new overloads
that declare themselves to not throw exceptions require a null check on
their return value. However, the relevant presshell allocation method,
AllocateByObjectID, is infallible and will never return a null pointer.
The callers of all of these methods are therefore doing useless
(compiler-generated) null checks. Let's get rid of those useless checks
by removing the CPP_THROW_NEW annotations. This change declares these
methods will return non-null pointers and throw exceptions in case of
errors--but as we don't use exceptions, and AllocateByObjectID will
abort on OOM, everything works out OK.
This patch is generated by the following commands (note: if you're running
using OS X's sed, which accepts slightly different flags, you'll have to
specify an actual backup suffix in -i, or use gsed from Homebrew):
hg stat -c \
| cut -c 3- \
| tr '\n' '\0' \
| xargs -0 -P 8 gsed --follow-symlinks 's/\bnsCSSProperty\b/nsCSSPropertyID/g' -i''
Then:
hg mv layout/style/nsCSSProperty.h layout/style/nsCSSPropertyID.h
... and finally, manually renaming nsCSSProperty in the include guard in
nsCSSProperty.h.
MozReview-Commit-ID: ZV6jyvmLfA
--HG--
rename : layout/style/nsCSSProperty.h => layout/style/nsCSSPropertyID.h
The merge from inbound to central conflicted with the merge from
autoland to central, it appears. Per tree rules, the commit from the
autoland repo wins and the inbound commit gets backed out.
CLOSED TREE
--HG--
extra : amend_source : 927e1cdfa8e55ccbd873d404d905caf6871c8c4f
extra : histedit_source : 07095868c3f767258e1d7d2645193bf4811b13bb%2Ca49ae5a28bf6e67298b6208ee9254c25a2539712
operator new overloads that declare that they don't throw exceptions
require a null check on their return value, per the C++ spec. We know
that Servo isn't going to call these functions with null pointers, so
remove the CPP_THROW_NEW annotation and save ourselves some work.
Structs in our style system use an arena-style allocation system,
managed by the presshell to which they belong. All of the relevant
overloads that forward allocation requests to the presshell declare
themselves as CPP_THROW_NEW, which indicates that they do not throw
exceptions. The C++ specification states that operator new overloads
that declare themselves to not throw exceptions require a null check on
their return value. However, the relevant presshell allocation method,
AllocateByObjectID, is infallible and will never return a null pointer.
The callers of all of these methods are therefore doing useless
(compiler-generated) null checks. Let's get rid of those useless checks
by removing the CPP_THROW_NEW annotations. This change declares these
methods will return non-null pointers and throw exceptions in case of
errors--but as we don't use exceptions, and AllocateByObjectID will
abort on OOM, everything works out OK.
This patch is generated by the following commands (note: if you're running
using OS X's sed, which accepts slightly different flags, you'll have to
specify an actual backup suffix in -i, or use gsed from Homebrew):
hg stat -c \
| cut -c 3- \
| tr '\n' '\0' \
| xargs -0 -P 8 gsed --follow-symlinks 's/\bnsCSSProperty\b/nsCSSPropertyID/g' -i''
Then:
hg mv layout/style/nsCSSProperty.h layout/style/nsCSSPropertyID.h
... and finally, manually renaming nsCSSProperty in the include guard in
nsCSSProperty.h.
MozReview-Commit-ID: ZV6jyvmLfA
--HG--
rename : layout/style/nsCSSProperty.h => layout/style/nsCSSPropertyID.h
I have to move the definition of StyleBasicShape and StyleShapeSource prior to
where nsStyleDisplay::mShapeOutside is defined since the template struct need to
be fully defined before using as a member variable.
Use SetIdent() in CreatePrimitiveValueForBasicShapeOrURL() in
nsComputedDOMStyle.cpp per bug 1288626 comment 6.
MozReview-Commit-ID: 1KZS299CFul
--HG--
extra : rebase_source : d96276a1d514e1e42e1daf6f23e6bbfcb92d3bec
Change to geometry box to match the name in the spec.
https://drafts.fxtf.org/css-masking-1/#the-clip-path
MozReview-Commit-ID: 8jDTynCkJ4A
--HG--
extra : rebase_source : c2e165e320c1341012b32b48bfb03b3c9b4f56c5
The only difference between clip-path and shape-outside is the reference box
enum, so I generalize StyleClipPath to be a template struct StyleShapeSource to
accommodate both. I'll have to move all the method definition to the header to
make the linker happy.
The only logic change is calling operator==() instead of EqualURIs to compare
urls in StyleShapeSource::operator==().
MozReview-Commit-ID: LOBGVVpnnB
--HG--
extra : rebase_source : eca561500f8f8529cf6e7b5c04372a51c1b62862
StyleClipPathType will be generalized to StyleShapeSourceType to match this
change.
MozReview-Commit-ID: Igaad2EoSSt
--HG--
extra : rebase_source : 517d7b968e90f8f83e1223d33bd9d59000e034fd
Rename StyleBasicShape to StyleBasicShapeType in nsStyleConsts.h, and
replace the old enum nsStyleBasicShape::Type by the enum class
StyleBasicShapeType.
Also, replace NS_ASSERTION() by MOZ_ASSERT().
MozReview-Commit-ID: EuS4ZtYKsk6
--HG--
extra : rebase_source : b6cb68f91c545cef283c97de222111d3acb64b02
Remove unnecessary nsChangeHints used in
nsStyle*:DifferenceAlwaysHandledForDescendants. Accordingly,
nsStyle*:MaxDifference can be simplified as well.
This is a followup patch for part3.2 in Bug 906116.
MozReview-Commit-ID: GgU9xgghCO7
Use ReconstructFrame | (any ther bits needed) to replace
NS_STYLE_HINT_FRAMECHANGE in nsStyle*::MaxDifference.
For those nsStyle* that do not have nsChangeHint_NeutralChange in their
CalcDifference, we should be able to elimate nsChangeHint_NeutralChange from
their MaxDifference as well.
MozReview-Commit-ID: B3VJWt6gKoL
--HG--
extra : rebase_source : d0deff5bb579438c33b7b3288fc76d8b0420e1af
According to our coding style guide, we should always brace controlled
statements, even a single-line consequent of an if-else-statement. It avoids
dangling else bugs.
MozReview-Commit-ID: FT1AR5MqOGw
--HG--
extra : rebase_source : f864e6f66c28e92574fb316a686e2d6d8fcb78e3