Commit Graph

186 Commits

Author SHA1 Message Date
J. Ryan Stinnett
56b5ec82a0 Bug 1328509 - Wire up visited values in ServoStyleSet::GetContext. r=emilio
Create an extra style context using the visited values (if they exist).  This
mirrors the logic Gecko performs in nsStyleSet::GetContext for visited support.

MozReview-Commit-ID: EiJQXDgz8tX
2017-05-24 21:20:06 -05:00
Jonathan Kew
fcf175b16a Bug 1365928 - patch 2 - Annotate style-struct getters with MOZ_NONNULL_RETURN for better optimization. r=mats 2017-05-22 19:00:19 +01:00
Cameron McCormack
a34d0bbc9d Bug 1344914 - stylo: Stop pretending to handle style fixups on the C++ side. r=bz
MozReview-Commit-ID: FBM2NOlXIe5

--HG--
extra : rebase_source : b197089498e261a3abc7a50f4f06df92d7478d97
2017-04-25 12:52:51 +08:00
Emilio Cobos Álvarez
90236f99ab Bug 1360508: Allow fixups on text styles to be reflected. rpending=heycam a=orange
MozReview-Commit-ID: Eh6shYiv4RC
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-04-28 20:19:03 +02:00
Ting-Yu Lin
b71ec494d5 Bug 1322570 Part 1 - Add MOZ_ASSERT in nsStyleContext::GetParent() to disallow usage by stylo. r=bz
Also, add GetParentAllowServo() to whitelist the usage in servo-backed style
system in subsequent parts so that we could revisit them later.

MozReview-Commit-ID: JthU18Ftx02

--HG--
extra : rebase_source : b8840adcc4959f96cd429db65584f3e83c09c597
2017-03-20 14:11:06 +08:00
Carsten "Tomcat" Book
97f79397b6 Merge mozilla-central to mozilla-inbound 2017-03-21 12:07:49 +01:00
Cameron McCormack
cf56de72b5 Bug 1302054 - Part 2: Remove no longer useful nsStyleContext::CalcDifference optimization that handles the same-rule-node case. r=dbaron
nsStyleContext::CalcDifference had an optimization where, when we knew
that the old and new style context have the same rule node, we knew that
the only change hints that would need to be handled are those in the
"not handled for descendants" category, generated due to explicit
'inherit' values on reset properties.  This was because any changes due
to differences in inherited properties should only have generated
"handled for descendants" change hints (and thus would already have been
handled on an ancestor).

Before bug 931668, this let us avoid calling CalcDifference on structs
that only would have generated hints that we knew we already would have
handled.  However, after bug 931668, we compare all structs anyway so
that we can set the aEqualStructs outparam, so we don't gain anything
from this optimization.  We can still return these change hints we know
will not need to be handled, and rely on ElementRestyler::CaptureChange
to filter them out.

MozReview-Commit-ID: Ld1s2Js0i6r
2017-03-21 16:33:05 +08:00
Cameron McCormack
5131fe23a2 Bug 1302054 - Part 1: Avoid computing style differences when we just want to ensure structs are cached on the new context. r=dbaron
MozReview-Commit-ID: DLhHcCD4GQS
2017-03-21 16:33:05 +08:00
Bobby Holley
7b43e374c0 Bug 1348602 - Assert main thread when setting style bits. r=emilio
We also assert against the Servo traversal because we don't currently test the
parallel traversal on CI (though we will soon).

MozReview-Commit-ID: 9GRNizE44Oi
2017-03-20 15:31:14 -07:00
Boris Zbarsky
b537f110e2 Bug 1345362 part 3. Introduce CSSPseudoElementType::NonInheritingAnonBox to represent non-inheriting anon boxes. r=heycam
The idea is to be able to call the right function during style resolution time
without doing a linear walk via nsCSSAnonBoxes::IsNonInheritingAnonBox.

MozReview-Commit-ID: JKt33GggTjz

--HG--
extra : rebase_source : fcf477dcef8529c803bf97b1d3a16f8f4fcea39f
2017-03-08 23:41:04 -05:00
Emilio Cobos Álvarez
7b7a364f71 Bug 1322317: Fix CalcStyleDifference assumptions and PeekStyleContext semantics. r=heycam
For the reasoning for this change, please see the related bugs and:

http://logs.glob.uno/?c=mozilla%23layout&s=22+Feb+2017&e=22+Feb+2017#c27236

Mainly, before this change, there was nothing forcing style structs computed in
a style context to remain computed for the new style context after a call to
CalcStyleDifference. This can make us skip change hints when a style change
doesn't force to recompute one of these structs.

MozReview-Commit-ID: FoWbLjt97Uu
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>

--HG--
extra : rebase_source : 27772fc67b3c241ca4cef580112c949ad506b167
2017-02-21 16:56:43 +01:00
Iris Hsiao
eb16544eaf Backed out changeset 3cf38f4d7395 (bug 1322317) for stylo test failure 2017-02-22 17:31:04 +08:00
Emilio Cobos Álvarez
0ca5ea4955 Bug 1322317: Don't call FinishStyle off-main-thread for reset structs. r=heycam
MozReview-Commit-ID: FoWbLjt97Uu

--HG--
extra : rebase_source : 00f5565a9c3bd09b7d2ed7c6aadd2d58ec0e1ec4
2017-02-21 16:56:43 +01:00
Bobby Holley
d05a45802c Bug 1340339 - Generalize the mechanism for accessing servo style structs without side effects and use it in CalcStyleDifferenceInternal. r=heycam
MozReview-Commit-ID: 54cL2ePc0OF
2017-02-16 21:57:48 -08:00
Emilio Cobos Álvarez
51e9294d5f Bug 1335987: stylo: Don't use the change hint to decide whether to recreate style contexts. r=bholley
MozReview-Commit-ID: 11Yyq8UE3LP
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-02-03 22:03:34 +01:00
Emilio Cobos Álvarez
7a40386fed Bug 1330874: Preserve neutral style changes for stylo. r=heycam
Since we use the presence of a change hint to determine whether we should
recreate a style context, we can't just strip them out on CalcStyleDifference.

MozReview-Commit-ID: GLhbTc2W3d7
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-01-15 16:10:01 +01:00
Xidorn Quan
97d13f46a3 Bug 1303241 part 2 - Make GetVisitedDependentColor use style structs directly. r=dbaron
I think there are three advantages of this change:
1. removes some dependencies from layout / painting code to pre-computed
   value stuff in the style system;
2. makes it easier to audit usage of specific fields in style structs
   (which is probably a side effect of the first one);
3. potentially improves performance since it doesn't go through the
   unnecessary general logic in ExtractComputedValue.

Also, combined with the part before, we get a unified list for visited-
dependent properties so that we can ensure the assertion here and the
style difference calc code are consistent.

MozReview-Commit-ID: 5B9aN7CfRgI

--HG--
extra : rebase_source : ac80eaea2474b9ec4b47b1cc9a5bdd2e61f6ec4d
2016-12-31 00:57:37 +11:00
Bobby Holley
f8c9d884fc Bug 1317016 - Basic infrastructure for RestyleHint-driven traversal. r=emilio
MozReview-Commit-ID: 7wH5XcILVmX
2016-11-25 10:06:39 -08:00
Cameron McCormack
642cdb8e14 Bug 1288302 - Part 4: Perform final main thread work on style structs sourced from ServoComputedValues. r=xidorn
MozReview-Commit-ID: D6nQQ3yI4sx
2016-11-02 16:58:32 +08:00
Cameron McCormack
13f86cd932 Merge backout. 2016-11-01 08:43:23 +08:00
Cameron McCormack
02f1de5bbd Back out a0488e9c0024..5ebcedea1fa5 (bug 1288302 and bug 1310463) for Talos RSS regressions.
MozReview-Commit-ID: JB5uwDeO0We
2016-11-01 08:42:49 +08:00
Cameron McCormack
2cd316fd59 Bug 1288302 - Part 4: Perform final main thread work on style structs sourced from ServoComputedValues. r=xidorn
MozReview-Commit-ID: D6nQQ3yI4sx
2016-10-20 08:36:23 +08:00
Xidorn Quan
fe470c1653 Bug 1309868 part 3 - Make NonOwningStyleContextSource store const ServoComputedValues. r=heycam
MozReview-Commit-ID: G84fYXLbQyt

--HG--
extra : source : 85ba0fdfc05ec11dd08eba5a1b1f6a9d7e8acd8f
2016-10-18 15:29:03 +11:00
Xidorn Quan
a7771e9c76 Bug 1311598 part 2 - Declare Servo_GetStyle* functions in nsStyleContext.h. r=heycam
MozReview-Commit-ID: 5i3rX4ateH3

--HG--
extra : rebase_source : f541b11b9eeb5b76be99277300faf3cbfc777eca
extra : source : c600b8ff90d4d9f6e5a4aefcc4230842da22615e
2016-10-24 20:16:46 +11:00
Xidorn Quan
2f279e5ef8 Bug 1306214 part 3 - Remove -moz-use-text-color from Gecko. r=heycam
MozReview-Commit-ID: EEYCB5jUH9L

--HG--
extra : rebase_source : ce6fcfdd573e1986a07fdae84106274bd2ae2495
2016-09-29 17:47:22 +10:00
Jeremy Chen
05b7065953 Bug 1305004 - fix ReResolveStyleContext related comments. r=heycam
Fix comment only, NPOTB, DONTBUILD.

MozReview-Commit-ID: APxOg5yVw7A

--HG--
extra : rebase_source : a48180811fedda97eaf374a7777374f8c3616ce3
2016-09-23 18:08:01 +08:00
Xidorn Quan
6b6e2ad7b2 Bug 1299741 part 11 - Change text-{emphasis,fill,stroke}-color to using StyleComplexColor. r=dbaron
MozReview-Commit-ID: 1MlgGAkdPn8

--HG--
extra : rebase_source : 293aa61adaa091bb3d4350a4b86ec9cfbb40eb02
2016-09-16 14:40:45 +10:00
Nicholas Nethercote
34dcc7b852 Bug 1299384 - Use MOZ_MUST_USE with NS_warn_if_impl(). r=erahm.
This change avoids lots of false positives for Coverity's CHECKED_RETURN
warning, caused by NS_WARN_IF's current use in both statement-style and
expression-style.

In the case where the code within the NS_WARN_IF has side-effects, I made the
following change.

> NS_WARN_IF(NS_FAILED(FunctionWithSideEffects()));
> -->
> Unused << NS_WARN_IF(NS_FAILED(FunctionWithSideEffects()));

In the case where the code within the NS_WARN_IF lacks side-effects, I made the
following change.

> NS_WARN_IF(!condWithoutSideEffects);
> -->
> NS_WARNING_ASSERTION(condWithoutSideEffects, "msg");

This has two improvements.
- The condition is not evaluated in non-debug builds.
- The sense of the condition is inverted to the familiar "this condition should
  be true" sense used in assertions.

A common variation on the side-effect-free case is the following.

> nsresult rv = Fn();
> NS_WARN_IF_(NS_FAILED(rv));
> -->
> DebugOnly<nsresult rv> = Fn();
> NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Fn failed");

--HG--
extra : rebase_source : 58788245021096efa8372a9dc1d597a611d45611
2016-09-02 17:12:24 +10:00
Emilio Cobos Álvarez
1c69b29535 Bug 1296556: Don't store change hints for non-elements. r=heycam
MozReview-Commit-ID: 1pIajBpt4CT

--HG--
extra : rebase_source : c91a1ddac66f4e64909220d4425c49e5605ac7a4
2016-08-20 00:20:36 -07:00
Emilio Cobos Álvarez
83a2bc2ac0 Bug 1296556: Reach the parent to compute inherited style structs. r=heycam
It's a shame that assertion can be made a crashing one, but unfortunately it was
hitting me regularly.

MozReview-Commit-ID: 4iZf1rm1fO2

--HG--
extra : rebase_source : 0b9ef55e3036eeefe4b989c284b1aff3e99a906d
2016-08-19 14:32:51 -07:00
Bobby Holley
6ba364070d Bug 1297572 - Prevent HasPseudoElementData from erroneously tracking anonymous boxes. r=heycam
The layout inspector ends up traversing into the root scroll frame in the next patch. If we don't
fix this, we erroneously enter this code here:

http://searchfox.org/mozilla-central/rev/44f6964ba95b8ddd8ebf70c55b34cd2323afeef4/layout/style/nsComputedDOMStyle.cpp#682

in this test:

devtools/client/inspector/markup/test/browser_markup_anonymous_04.js
2016-08-25 21:34:21 -07:00
Nathan Froyd
d9759d258f Bug 1295192 - part 1 - remove CPP_THROW_NEW on layout struct operator new overloads that forward to nsPresShell::AllocateByObjectID; r=dholbert
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.
2016-08-17 15:28:45 -04:00
Wes Kocher
57773cd69e Backed out 4 changesets (bug 1295192) for being a possible cause of crashtest assertions CLOSED TREE
Backed out changeset 7f10779fe019 (bug 1295192)
Backed out changeset e683dce4197a (bug 1295192)
Backed out changeset 67d12eaa8074 (bug 1295192)
Backed out changeset 44f143a01f78 (bug 1295192)
2016-08-16 11:22:04 -07:00
Nathan Froyd
fa4f709cfd Bug 1295192 - part 1 - remove CPP_THROW_NEW on layout struct operator new overloads that forward to nsPresShell::AllocateByObjectID; r=dholbert
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.
2016-08-16 17:05:39 -04:00
Jonathan Chan
9c62a2c11c Bug 1293739 - Part 1: Rename nsCSSProperty to nsCSSPropertyID. r=dholbert
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
2016-08-09 16:28:19 -07:00
Emilio Cobos Álvarez
9faca13ea4 Bug 1292930: stylo: Store the change hint generated by non-elements in their parent element. r=heycam
Otherwise, the parent style context doesn't have some inherited structs in the
cache, so it avoids comparing them entirely.

For example, the following example:

<p>Hey</p>

p { color: blue }
p:hover { color: red }

Wouldn't work as intended, because when calculating the change hint the
nsStyleColor struct in the element hasn't been accessed by layout (only the
child text frame's has), so it will report a change hint of 0 when hovering over
the paragraph, and we would ignore the nsChangeHint_ReconstructFrame generated
by the text node.

MozReview-Commit-ID: FW7Thhuh7LG
2016-08-10 22:01:35 -07:00
Emilio Cobos Álvarez
1b5c331814 Bug 1290335: followup: Fix the ConsumeStoredChangeHint assertion. r=me
That will teach me to address review comments at night.

MozReview-Commit-ID: 9AGFoj2du7C
2016-08-03 19:26:37 -07:00
Emilio Cobos Álvarez
7f36b64101 Bug 1290335: stylo: Allow processing change hints generated from Servo. r=heycam
MozReview-Commit-ID: Alc0wcXvHcD
2016-08-03 15:11:15 -07:00
Bobby Holley
fe8622a540 Bug 1289622 - Add the ability to store change hints on the style context. r=heycam 2016-07-27 13:35:12 -07:00
Bobby Holley
747712c081 Bug 1289622 - Add a ServoComputedValues* overload for CalcStyleDifference. r=heycam 2016-07-27 13:35:11 -07:00
Bobby Holley
9f75d89883 Bug 1289622 - Delegate CalcStyleDifference to a templated helper. r=heycam 2016-07-27 13:35:09 -07:00
Cameron McCormack
2a58c3e595 Bug 1277163 - Rename nsStyleContext* argument to Calc(Style)Difference methods to indicate it's the new style. r=dbaron
MozReview-Commit-ID: 9AvGc1tjJpx
2016-06-21 11:47:54 +10:00
Bobby Holley
8cd5efe7f9 Bug 1274443 - Always cache reset structs for servo. r=heycam
The shared code always caches inherited structs, but not reset structs. Without
this change we will always do an FFI call to get the struct.
2016-05-24 18:50:31 -07:00
Bobby Holley
9c8af73cc2 Bug 1274443 - Avoid calling ApplyStyleFixups for ServoComputedValues. r=heycam 2016-05-24 18:50:28 -07:00
Cameron McCormack
75c6df145e Bug 1267560 - Get style structs from ServoComputedValues rather than the rule node, when using the Servo-backed style system. r=bholley 2016-04-27 12:34:49 +10:00
Jeremy Chen
84a70f3910 Bug 1248708 - Part1: parse and compute -webkit-text-stroke property. r=heycam 2016-04-23 01:40:39 +08:00
Xidorn Quan
68af7e6457 Bug 1097499 part 4 - Adjust computed value of writing-mode on text frames when text-combine-upright is used. r=heycam
MozReview-Commit-ID: KNRe0ZpzxGr

--HG--
extra : source : dfd24ab49704b6542207aaab5b1283a4db355e60
2016-04-22 09:18:41 +10:00
CJKu
ecc0333324 Bug 1261578 - Part 1. Correct text color in selection range; r=jfkthame
MozReview-Commit-ID: 9gBWQ00MtNC

--HG--
extra : rebase_source : a0ad39cd6e887926ce6d633b49d1fd936d91a797
2016-04-19 17:09:42 +08:00
Jeremy Chen
49cb886e74 Bug 1261568 - part1: take -webkit-text-fill-color into consideration while
building displaylist for text frame. r=jfkthame

--HG--
extra : commitid : 6qd1b5QuedD
extra : rebase_source : 4a445ebb92610944ad1b131fb4ba262d4b3cfc8b
2016-04-05 12:35:44 +08:00
Bobby Holley
3831864b3d Bug 1260310 - Create servo style contexts from ServoStyleSet. r=heycam 2016-03-29 22:16:38 -07:00