Converted the #define variable NS_STYLE_FLEX_DIRECTION to an enum class in nsStyleConsts.h and made changes in other files that access it
Differential Revision: https://phabricator.services.mozilla.com/D20291
--HG--
extra : moz-landing-system : lando
-moz-tab-size, border-image-outset and border-image-slice.
This is not a particularly interesting patch, just removes some code. We can
remove way more code when a few related properties are also ported.
Differential Revision: https://phabricator.services.mozilla.com/D19825
The reason why we use RelaxedAtomBoolis that
ScrollSnapUtils::GetSnapPointForDestination() is called both from the main and
the compositor threads, and the function will have a branch depending on the
pref value.
Differential Revision: https://phabricator.services.mozilla.com/D20101
--HG--
extra : moz-landing-system : lando
Really sorry for the size of the patch :(
Only intentional behavior change is in the uses of HasLengthAndPercentage(),
where it's easier to do the right thing. The checks that used to check for
(IsCalcUnit() && CalcHasPercentage()) are wrong since bug 957915.
Differential Revision: https://phabricator.services.mozilla.com/D19553
Also for the intersection observer root margin, since it was easier to fix it
up and clean it up than not doing it.
This is the first big step to get rid of nscoord. It duplicates a bit of logic
in nsLayoutUtils since for now max/min-width/height are still represented with
nsStyleCoord, but I think I prefer to land this incrementally.
I didn't add helpers for the physical accessors of the style rect sides that
nsStyleSides has (top/bottom/left/right) since I think we generally should
encourage the logical versions, but let me know if you want me to do that.
Differential Revision: https://phabricator.services.mozilla.com/D17739
Doing it during layout instead. This also has the nice side-effect of
no longer needing to do a full restyle when counter-style rules are inserted.
Differential Revision: https://phabricator.services.mozilla.com/D18343
This will allow me to (in different patches):
* Make the default style structs constructible without a pres context (default
color and co. would need to be faked or moved to Document as well, but that's
ok, since those cannot affect media queries, the default font-size does).
* Remove the nsPresContext pointer from ComputedStyle (moving it to nsFrame,
probably).
That would in turn allow me to have the default style computed without a pres
context, which allows us to fix both bug 1490401 and bug 1471231.
Differential Revision: https://phabricator.services.mozilla.com/D16926
--HG--
extra : moz-landing-system : lando
The only reason it was on style_traits is so that they could use it from some
other crates, but Servo eventually ends up getting the value from an integer, so
may as well pass it around and do that in the end of the process anyway.
Differential Revision: https://phabricator.services.mozilla.com/D16557
This commit implements the first half of the heuristics to detect style changes
that could lead to feedback loops with scroll anchoring. [1]
When these style changes are made, a suppression flag is added to the anchor
container to ignore any adjustments that would be made at the next layout flush
and to invalidate the anchor at that time.
[1] https://drafts.csswg.org/css-scroll-anchoring/#suppression-triggers
Differential Revision: https://phabricator.services.mozilla.com/D13271
--HG--
extra : rebase_source : db0bf373e51325b7ef537c4c245ede4b4219d0d7
extra : source : d9445a5f3458b560fbdb7aee5faabb5a7a9327f3
This commit implements the first half of the heuristics to detect style changes
that could lead to feedback loops with scroll anchoring. [1]
When these style changes are made, a suppression flag is added to the anchor
container to ignore any adjustments that would be made at the next layout flush
and to invalidate the anchor at that time.
[1] https://drafts.csswg.org/css-scroll-anchoring/#suppression-triggers
Differential Revision: https://phabricator.services.mozilla.com/D13271
--HG--
extra : rebase_source : 7919443bdad49ce3623e5b082decb4f5c4a54158
extra : histedit_source : a2283cc31060103ef0929ae11624b45f95113810
Summary: Really sorry for the size of the patch. It's mostly automatic
s/nsIDocument/Document/ but I had to fix up in a bunch of places manually to
add the right namespacing and such.
Overall it's not a very interesting patch I think.
nsDocument.cpp turns into Document.cpp, nsIDocument.h into Document.h and
nsIDocumentInlines.h into DocumentInlines.h.
I also changed a bunch of nsCOMPtr usage to RefPtr, but not all of it.
While fixing up some of the bits I also removed some unneeded OwnerDoc() null
checks and such, but I didn't do anything riskier than that.
All of the removed includes are redundant (i.e. they're #included elsewhere in
the same file).
In most cases, I'm removing the second (redundant) copy of the
#include, except when that copy makes more sense (i.e. if it's in better sorted
order, or if it's paired alongside a closely-associated header while the
earlier copy is not).
Here's the script that I used to generate candidates here -- I ran this in
every subdirectory of layout, on my linux machine (warning, this writes two
files to your /tmp directory):
for FILE in *.h *.cpp; do
nonunique=$(grep \#include $FILE | grep -v List\.h | cut -f2 -d'"' | cut -f2- -d'/'| cut -f2- -d'/' | sort | wc -l)
unique=$( grep \#include $FILE | grep -v List\.h | cut -f2 -d'"' | cut -f2- -d'/'| cut -f2- -d'/' | sort | uniq | wc -l)
if [[ "$unique" != "$nonunique" ]]; then
echo "$FILE: $nonunique / $unique"
grep \#include $FILE | cut -f2 -d'"' | grep -v List\.h | cut -f2- -d'/'| cut -f2- -d'/' | sort > /tmp/nonunique.txt
grep \#include $FILE | cut -f2 -d'"' | grep -v List\.h | cut -f2- -d'/'| cut -f2- -d'/' | sort | uniq > /tmp/unique.txt
diff /tmp/nonunique.txt /tmp/unique.txt
echo
fi
done
Depends on D13773
Differential Revision: https://phabricator.services.mozilla.com/D13774
--HG--
extra : moz-landing-system : lando
I'm pretty sure the FIXME I left in the outline-style code is a bug,
but I want to clean this up further and I didn't want to fix it without adding
a test.
Differential Revision: https://phabricator.services.mozilla.com/D12859
--HG--
extra : moz-landing-system : lando
This is all the style-system work needed for this.
This implements the concept of legacy shorthands, teaches tests to understand
it, and adds a few more tests for these properties in particular.
The WPT even caught a few WebKit / Blink bugs:
https://bugs.chromium.org/p/chromium/issues/detail?id=906336https://bugs.webkit.org/show_bug.cgi?id=191803
This doesn't change the layout behavior for page-break-before: always, since
it'd stop breaking in multicol and such. Similarly, break-before / break-after:
column and page still behave the same, I'll file followups for those given
comment 22.
Differential Revision: https://phabricator.services.mozilla.com/D12211
--HG--
extra : moz-landing-system : lando
Converted NS_STYLE_BORDER_STYLE_* consts to enum class. Updated corresponding values to enum class. reduced BCCornerInfo struct values to fit StyleBorderStyle values inside struct. Added defaults to switches that do not fully cover all instances of StyleBorderStyle.
It doesn't make much sense to return const UniquePtr<Foo>& for something that
can't be null, it's just confusing.
Also make more stuff actually const.
Differential Revision: https://phabricator.services.mozilla.com/D10647
--HG--
extra : moz-landing-system : lando
1. Drop {Width|MinWidth|MaxWidh}DependsOnContainer() and
{Height|MinHeight|MaxHeight}DependsOnContainer() because they are bogus
after introducing the writing mode. Dropping these functions needs
update nsLineLayout because it is the only one who still use
these functions.
2. There are still some potential assertions and bugs on handling keywords
in the block size, so we should update them as well.
Depends on D9438
Differential Revision: https://phabricator.services.mozilla.com/D9439
--HG--
extra : moz-landing-system : lando
First, we generate StyleComputedTimingFunction by cbindgen from Rust, and use
it in nsTimingFunction, so we could copy it directly without handling
the different memory layout. However, we have to rewrite the
nsTimingFunction and mozilla::ComputedTimingFunction for this.
Second, the rust-bindgen seems cannot generate the correct generic members
from complex C++ templates, especially for the nested template struct,
(https://github.com/rust-lang-nursery/rust-bindgen/issues/1429)
So we have to hide StyleTimingFunction to avoid the compilation errors.
Depends on D9312
Differential Revision: https://phabricator.services.mozilla.com/D9313
--HG--
extra : moz-landing-system : lando
frames() timing function was removed from the spec, so we drop it.
Besides, some devtool tests are removed because they use frame(). I will
add them back by using new step function later.
Differential Revision: https://phabricator.services.mozilla.com/D9309
--HG--
extra : moz-landing-system : lando
This change removes directives NS_STYLE_ANIMATION_PLAY_STATE_* and replaces the values with those from a scoped enum called StyleAnimationPlayState.
Differential Revision: https://phabricator.services.mozilla.com/D9382
--HG--
extra : moz-landing-system : lando
It's not really invalidated anywhere, and the float manager code only checks for
float region changes. Extend it so that it knows about shapes as well, and avoid
reframing due to a bogus nsChangeHint_ScrollbarChange which really meant to be
UpdateOverflow, which really is useless in this situation..
Differential Revision: https://phabricator.services.mozilla.com/D7583
The 'x' prefix makes it clearer that these are infallible.
A couple of nsJSID methods are now also infallible.
--HG--
extra : rebase_source : fcce44a00212d6d341afbf3827b31bd4f7355ad5
We implement the layout part of offset-path. Now we don't have
offset-distance, so use the default value, 0%, for it.
Note: rename mCombinedTransform as mIndividualTransform, which only
stores the combined individual transforms. We apply the individual
transforms, motion path transform, and specified transform in
ReadTransforms. (We have to follow the order, so we don't combine the
specified transform in FinishStyle.)
Differential Revision: https://phabricator.services.mozilla.com/D2968
Define OffsetPath & SVGPathData on the servo-side, and StyleMotion &
StyleSVGPath on the gecko-side. We parse the SVG Path string into a
vector of PathCommand. To build the gfx::Path, we will convert it into
gfx::Path later in a different patch.
The basic flow is:
* Parse SVG Path String into SVGPathData (in Rust).
* Use cbindgen to make sure the layout of PathCommand and StylePathCommand,
and then set the Box[PathCommand] into nsTArray<StylePathCommand>.
* Try to convert nsTArray<StylePathCommand> into gfx::Path. (This part
will be implemented in a different patch.)
Finally, we use the gfx::Path to create a motion path transform.
The layout implementation is in the later patch.
Differential Revision: https://phabricator.services.mozilla.com/D2963
Prepare for scrollbar-width which should trigger the same kind of change.
MozReview-Commit-ID: 1n9Y9bobBkJ
--HG--
extra : rebase_source : 520b78dec4daca5050e0cc7fff4ec68fa36663c5
1. We will add more shape-like types in the future, so it's better to
use union to reduce the memory usage.
2. Those shape-like types are mutual exclusive, so we could use union to
wrap them.
Differential Revision: https://phabricator.services.mozilla.com/D2746
--HG--
extra : moz-landing-system : lando
This builds on bug 1428676 and introduces StyleAppearance, which replaces the
NS_THEME_* constants.
Really sorry for the size of the patch.
There's a non-trivial change in the gtk theme, which I submitted separately as
bug 1478385.
Differential Revision: https://phabricator.services.mozilla.com/D2361
MozReview-Commit-ID: DiSmMWK7Krp
I put Balance as the first item in StyleColumnFill because it is the default
value.
MozReview-Commit-ID: A4DVMLL6XBa
--HG--
extra : rebase_source : 8c8d07b724bcd49dd4f4057fcbf0ccd46ed591ff
NS_STYLE_COLUMN_COUNT_UNLIMITED is unused, so I remove it.
MozReview-Commit-ID: HLHLn9ZbkUY
--HG--
extra : rebase_source : 9bf00e1db00051c4454719e205633717fabde050
Most of it is automated by:
%s/eStyleContentType_/StyleContentType::/g
%s/nsStyleContentType/StyleContentType/g
But I removed some parentheses by hand.
Differential Revision: https://phabricator.services.mozilla.com/D1900
MozReview-Commit-ID: 3IcirjIYX5p
This patch is an automatic replacement of s/NS_NOTREACHED/MOZ_ASSERT_UNREACHABLE/. Reindenting long lines and whitespace fixups follow in patch 6b.
MozReview-Commit-ID: 5UQVHElSpCr
--HG--
extra : rebase_source : 4c1b2fc32b269342f07639266b64941e2270e9c4
extra : source : 907543f6eae716f23a6de52b1ffb1c82908d158a
GCC doesn't like StyleComplexColor with constructor in an anonymous
struct in an anonymous union. Replace the use of a union to access
`mBorder[..]Color` fields as an array with an accessor methods.
MozReview-Commit-ID: 1Wulh1qKYCZ
--HG--
extra : rebase_source : 390b8f852d144a54d9d374bcf3ae70ab6d145d50
Refactored StyleComplexColor to support "complex" blending between
background (numeric) color and foreground color (currentColor).
Made explicit the distinction between numeric, currentColor and a
complex blend in Gecko and Stylo.
This is to support SMIL animation, for example, of the form:
<animate from="rgb(10,20,30)" by="currentColor" ... />
MozReview-Commit-ID: IUAK8P07gtm
--HG--
extra : rebase_source : d3648101c6f65479b21e6f02945731cd5bb57663
This was done automatically replacing:
s/mozilla::Move/std::move/
s/ Move(/ std::move(/
s/(Move(/(std::move(/
Removing the 'using mozilla::Move;' lines.
And then with a few manual fixups, see the bug for the split series..
MozReview-Commit-ID: Jxze3adipUh
Change mStopColor, mFloodColor, and mLightingColor in nsStyleSVGReset.
MozReview-Commit-ID: KMRMtHk1jNK
--HG--
extra : rebase_source : c0c12fa811d17ab6fe0a5ceb31ff32ec585314e0
This patch:
* Makes StyleStructID an enum class, and moves it to the mozilla namespaces.
* Introduces StyleStructConstants with some constants scattered through the
codebase.
* Makes the computed style bits an enum class, and splits mPseudoType and mBits
into their own members, since we were using a uint64_t when we have only a
couple flags and CSSPseudoElementType is a byte. We statically assert that
the number of style structs is less or equal to 32.
* Makes mPseudoTag, mPseudoType and mBits const, since we don't want them to be
mutated from C++, and we still need a few more refactorings (mostly getting
rid of FinishStyle) to avoid mutating ComputedStyle instead.
MozReview-Commit-ID: 7qsTtASGcYB
Move from nsStyleColor::CalcComplexColor to StyleComplexColor::CalcColor.
MozReview-Commit-ID: FkYovvPZLc8
--HG--
extra : rebase_source : 54f1966e0ef9258f20e954cd6250774008eca04c
When we finish decoding an image frame, we need to trigger reflow for the
frame containing a float with shape-outside: <image>, and delay the firing
of the document's onload event until that reflow is complete.
When we finish decoding an image frame, we need to trigger reflow for the
frame containing a float with shape-outside: <image>, and delay the firing
of the document's onload event until that reflow is complete.
nsStyleStructList.h was initially made generated in bug 873368 to avoid
manually maintaining boilerplate for if-dispatch, while the if-dispatch
was replaced by jump table in bug 1171842, so the boilerplate went away.
However, in bug 1122781 (before bug 1171842), boilerplate for dependency
check, so it still needs to be generated.
The dependency table is removed in the previous patch, so we no longer
have any boilerplate in the style struct list, and thus it doesn't need
to be generated anymore.
MozReview-Commit-ID: GkbJZ98ojbE
--HG--
extra : rebase_source : a148b97c051bb6c88846cf6ba617c4edef70ca24
extra : source : f1c7d19cde195fb90ac2627d16ed69d020de01b9
This new change hint doesn't influence layout so that it can be regarded
as nsChangeHint_Hints_CanIgnoreIfNotVisible. Note that if visibility changed
from collapse or to collapse, we set NS_STYLE_HINT_REFLOW separetely.
MozReview-Commit-ID: AirDWeBYVKG
--HG--
extra : rebase_source : a462845ac2d8280986bb8db5e6482bf401f65322
This new change hint doesn't influence layout so that it can be regarded
as nsChangeHint_Hints_CanIgnoreIfNotVisible. Note that if visibility changed
from collapse or to collapse, we set NS_STYLE_HINT_REFLOW separetely.
MozReview-Commit-ID: AirDWeBYVKG
--HG--
extra : rebase_source : 1cd03a78a522b1a6965ba73ebf002ddacb0ab4f2
Add three more attributes in nsStyleDisplay
1. mSpecifiedRotate to carry computed value of 'rotate' property.
2. mSpecifiedTranslate to carry computed value of 'translate' property.
3. mSpecifiedScale to carry computed value of 'scale' property.
Since each of these tree new property can be an animation target, we have to store
them in speparate attributes, instead of putting them all in mSpecifiedTransform.
MozReview-Commit-ID: G2dBAxzyBWh
(grafted from 04fe9115ce1d189155ff9b2c89b1a656a55dd1c9)
--HG--
extra : source : 04fe9115ce1d189155ff9b2c89b1a656a55dd1c9
nsDisplayList::mSpecifiedTransform is a RefPtr, no need put it into intialize
list.
MozReview-Commit-ID: B04gytHwb2K
(grafted from f2dc6cad129e9f5c8c8c056c934d2ed3f2e30155)
--HG--
extra : source : f2dc6cad129e9f5c8c8c056c934d2ed3f2e30155
devtools/shared/css/generated/properties-db.js is generated by running
"./mach devtools-css-db"
MozReview-Commit-ID: 1U4yoQTDwxi
--HG--
extra : rebase_source : 16049b4253ae9a3f6e24cc30896ed53f65ebaf7a
Some Gecko style system files are modified to prevent assertions and
crashing, and to keep test failures on stylo disabled builds to minimum.
MozReview-Commit-ID: GuxAeCTz0xx
--HG--
extra : rebase_source : 2342085d13a50535836be46d75a731641d0fc49e
No caller check the return value, and SetURL ever returns true.
MozReview-Commit-ID: 5XPFq41Ktlq
--HG--
extra : rebase_source : de12cbaf09c1d86fdfbcd0f4c79f61d0dac9c7e7
We need to get rid of BindingHolder to handle properly the case of an invalid
binding URL.
MozReview-Commit-ID: 3sIGtcVOt0r
--HG--
extra : rebase_source : a56cebc74ff5f3102ee8ef6d048ad05056fbef41
Some Gecko style system files are modified to prevent assertions and
crashing, and to keep test failures on stylo disabled builds to minimum.
MozReview-Commit-ID: GuxAeCTz0xx
--HG--
extra : rebase_source : 97c8b3900e4492ac03158a38aa03f7c044b71e0f
No caller check the return value, and SetURL ever returns true.
MozReview-Commit-ID: 5XPFq41Ktlq
--HG--
extra : rebase_source : 7522e024ed38da5e1524eb3128bbf5a70e46177f
A repaint is sufficient to pick up the new property value.
MozReview-Commit-ID: oKFgGfquyl
--HG--
extra : rebase_source : 4f145fb29eddcc5f83506cc6f512b123c29676ef
This case is hit by hovering over menu items, so the optimization is somewhat worthwhile.
As a side-effect, not causing reflows also avoids a XUL <select> popup positioning bug.
MozReview-Commit-ID: AOrijytoHHL
--HG--
extra : rebase_source : c2156eb24171f6d0b0e5476c4a7dbc641a0b5301
(Path is actually r=froydnj.)
Bug 1400459 devirtualized nsIAtom so that it is no longer a subclass of
nsISupports. This means that nsAtom is now a better name for it than nsIAtom.
MozReview-Commit-ID: 91U22X2NydP
--HG--
rename : xpcom/ds/nsIAtom.h => xpcom/ds/nsAtom.h
extra : rebase_source : ac3e904a21b8b48e74534fff964f1623ee937c67
This is for implementing shape-outside: <image> later.
MozReview-Commit-ID: 93TmLecRjRx
--HG--
extra : rebase_source : c2b39b1e12ef96e80a3ceb0a800767d379e6e6bb
After StyleBasicShape is set to StyleShapeSource, it's life cycle never go
beyond StyleShapeSource, so I make StyleBasicShape hold by a UniquePtr in
StyleShapeSource.
Also, replace all raw pointers to StyleBasicShape by UniquePtr in all APIs.
MozReview-Commit-ID: 1MfIFjP8TsQ
--HG--
extra : rebase_source : bdbbd47de57e0bc610e37913752ab8413f62588a
The original operator==() (implemented by EqualsInternal<true>) is not been
used. Therefore, I expand EqualsInternal<false> into it, and move it to
nsStyleStruct.cpp.
Also, use DefinitelyEqualURIs() in nsStyleStruct.cpp in operator==().
MozReview-Commit-ID: HccwKvzQHR
--HG--
extra : rebase_source : f63dac121e13fd9c6dccf7f0c6e870bd75d9e03a
This patch merges nsAtom into nsIAtom. For the moment, both names can be used
interchangeably due to a typedef. The patch also devirtualizes nsIAtom, by
making it not inherit from nsISupports, removing NS_DECL_NSIATOM, and dropping
the use of NS_IMETHOD_. It also removes nsIAtom's IIDs.
These changes trigger knock-on changes throughout the codebase, changing the
types of lots of things as follows.
- nsCOMPtr<nsIAtom> --> RefPtr<nsIAtom>
- nsCOMArray<nsIAtom> --> nsTArray<RefPtr<nsIAtom>>
- Count() --> Length()
- ObjectAt() --> ElementAt()
- AppendObject() --> AppendElement()
- RemoveObjectAt() --> RemoveElementAt()
- ns*Hashtable<nsISupportsHashKey, ...> -->
ns*Hashtable<nsRefPtrHashKey<nsIAtom>, ...>
- nsInterfaceHashtable<T, nsIAtom> --> nsRefPtrHashtable<T, nsIAtom>
- This requires adding a Get() method to nsRefPtrHashtable that it lacks but
nsInterfaceHashtable has.
- nsCOMPtr<nsIMutableArray> --> nsTArray<RefPtr<nsIAtom>>
- nsArrayBase::Create() --> nsTArray()
- GetLength() --> Length()
- do_QueryElementAt() --> operator[]
The patch also has some changes to Rust code that manipulates nsIAtom.
MozReview-Commit-ID: DykOl8aEnUJ
--HG--
extra : rebase_source : 254404e318e94b4c93ec8d4081ff0f0fda8aa7d1
This property accepts a color. It's inherited and defaults to transparent.
Its value is respected on macOS when rendering text into transparent pixels.
This property should be used for text that is placed on top of "vibrant"
-moz-appearances, in order to achieve high quality text rendering for such text.
In most cases, the property should be set to a named system color; an upcoming
patch in this patch series will add one such color for each vibrant
-moz-appearance value.
However, in some cases it can also be useful to use a custom color: If text
is rendered into an intermediate surface, for example because a mask is applied
to it, and the background color behind that intermediate surface is known, then
this property can be set to that background color in order to achieve subpixel
AA for the text inside the mask effect. In that case, the font smoothing
background color is respected because text is rendered into transparent pixels
*inside the intermediate surface*. At the moment, the only example of that use
case is the text of the active tab in the state where the text is overflowing.
MozReview-Commit-ID: D98qQnxoFaq
In Stylo, we read font related user prefs to set the default font size only
if we set 'font-size' property. However, users are allowed to set their
preferred minimum font size through the user prefs, even without using
'font-size' property.
Gecko used to do this in nsRuleNode::SetDefaultOnRoot, which calles the
default constructor of nsStyleFont and does the minimum font size applying
right after. Moving the minimum font size applying into the default
constructor of nsStyleFont shoud be no harm to Gecko, but makes Stylo
share the same code path and behave the same.
MozReview-Commit-ID: BDcJX92o0uR
--HG--
extra : rebase_source : 88d9c73d0eb793ffe8a5dc424361f21f6acd078b