Commit Graph

135 Commits

Author SHA1 Message Date
Cameron McCormack
6b74d596a5 Bug 1331294 - Part 4: Make ServoStyleSet::StyleDocument call Servo_TraverseSubtree unconditionally, and return whether a post-traversal is required. r=bholley
MozReview-Commit-ID: 6jgH6NDz3h
2017-02-10 10:42:30 +08:00
Bobby Holley
b77d94bc0f Bug 1333183 - Prime the root element cache before the servo traversal. r=emilio 2017-02-08 17:04:47 -08:00
Bobby Holley
0e45459ddd Bug 1335319 - Add a global flag indicating that we're in the servo traversal. r=bz 2017-02-08 17:04:44 -08:00
Manish Goregaokar
9f16c02625 Bug 1330041 - Basic handling framework for presentation attributes in Stylo, with handling for font-size and color; r=bz,emilio
This introduces a basic framework for servo's style system to be able
to query the style of presentation attributes which it can then insert
into the cascade. It uses that framework to implement the size and
color attributes on <font>.

There are a number of improvements that can be done on top of this:

 - Implement all other properties
 - Abstractify the ruledata parameter of the mappers using templates or virtual dispatch so that it can be a Servo decl block instead
 - Implement aforementiond abstraction over Servo decl blocks (this obsoletes the code in the first item above, so it might just be better to skip that and directly do this)
 - Replace uses of nsHTMLStyleSheet with an abstract base class containing common elements between Servo and Gecko

I'd prefer for these to be done in separate steps.

MozReview-Commit-ID: GO60qfeZOfl
2017-01-19 15:56:53 -08:00
Hiroyuki Ikezoe
70fd29eb2a Bug 1328787 - Part 13: Call nsAnimationManager.UpdateAnimations(). r=heycam
MozReview-Commit-ID: CcA3dJaxuYY
2017-01-29 12:59:00 +09:00
Hiroyuki Ikezoe
628935e580 Bug 1328787 - Part 3: Add functions for filling each servo's animation keyframes into nsTArray<Keyframe>. r=heycam
The argument, ServoComputedValues*, will be used the case where keyframe is not specified.

MozReview-Commit-ID: HqqEXuYajCi
2017-01-29 12:58:28 +09:00
Emilio Cobos Álvarez
0be8a2c6ab Bug 1331213: Bootstrap a Gecko-side Device, and track it's dirtiness manually in the per-doc data. r=heycam
The setup is quite different to Servo-land, so add a comment about the different
setup.

Also, check viewport rules when flushing stylesheets. I believe that the
previous behavior is plain wrong, though I haven't taken the time to come up
with a test case.

In any case, it doesn't hurt any of both back-ends.

MozReview-Commit-ID: 46gtTkesOsr
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-01-17 14:20:03 +01:00
Wes Kocher
0d767f9ab1 Merge m-c to inbound a=merge
MozReview-Commit-ID: G24aq5fbYNd
2017-01-09 16:44:58 -08:00
Cameron McCormack
85a42391b3 Bug 1323665 - Part 1: Adjust some ServoStyleSet assertions. r=xidorn
We're incorrectly asserting that a sheet is applicable when we remove it from
the style set, but we'll actually cause the sheet to be not applicable just
before we remove it from the style set.  (Note how nsStyleSet doesn't assert
this in RemoveStyleSheet.)  Also, we were missing a corresponding assertion
in AddDocStylesSheet.

MozReview-Commit-ID: E5qwxwrA74F
2017-01-09 17:42:52 +08:00
Bobby Holley
0aaca3b258 Bug 1325734 - Simplify ElementData and eliminate the concept of consuming styles. r=emilio 2017-01-09 11:50:16 -08:00
Boris Zbarsky
e26cbf2ac6 Bug 1298588 followup whitespace fix to address a missed review comment. DONTBUILD 2017-01-04 23:19:34 -05:00
Boris Zbarsky
db8c7b6474 Bug 1298588 part 10, gecko piece. Pass through useful default styles to apply_declarations(). r=bholley 2017-01-04 14:52:27 -05:00
Boris Zbarsky
2ac8e1a125 Bug 1298588 part 7, gecko piece. Stop using initial_values in general in Gecko glue code. r=bholley 2017-01-04 14:52:27 -05:00
Boris Zbarsky
060fd86fad Bug 1298588 part 6, gecko piece. Stop using initial_values when doing inheritance in Gecko glue code. r=bholley 2017-01-04 14:52:27 -05:00
Boris Zbarsky
71433082f9 Bug 1298588 part 4, gecko piece. Recreate the default computed values for a document as needed. r=bholley 2017-01-04 14:52:27 -05:00
Boris Zbarsky
1c5e450d55 Bug 1298588 part 2, gecko piece. Pass through an nsPresContext to the PerDocumentStyleData constructor. r=bholley 2017-01-04 14:52:26 -05:00
Daniel Holbert
d7f3526208 Bug 1326574: Add some needed includes/forward-declarations in layout/style, to preemptively fix unified bustage. r=xidorn
MozReview-Commit-ID: 2vM3aiR87T3
2016-12-31 16:10:45 -08:00
Wes Kocher
67f1a33d79 Merge inbound to central, a=merge
MozReview-Commit-ID: 3AlcRAsPF0s
2016-12-28 16:08:44 -08:00
Cameron McCormack
74ae182bbf Bug 1326015 - Run AssertTreeIsClean on all style roots. r=xidorn
MozReview-Commit-ID: 1GkRS05tda
2016-12-28 16:26:10 +08:00
Bobby Holley
fa4099d657 Bug 1324627 - Add a special, explicit path for lazy style resolution and use it for GetComputedStyle. r=heycam 2016-12-28 15:49:12 +08:00
Phil Ringnalda
091c8b0527 Backed out changeset 5986d8880ad1 (bug 1324627) for a variety of computed style failures
MozReview-Commit-ID: AMTshx423hQ
2016-12-27 21:34:45 -08:00
Bobby Holley
5245f35145 Bug 1324627 - Add a special, explicit path for lazy style resolution and use it for GetComputedStyle. r=heycam
MozReview-Commit-ID: ECnoeHYkpT
2016-12-28 11:33:18 +08:00
Bobby Holley
5c55211c18 Bug 1325728 - Simplify pseudo-element handling. r=heycam 2016-12-23 19:23:52 -08:00
Bobby Holley
c4c72367e8 Bug 1325728 - Use Gecko's existing mechanism to coordinate flushing the Stylist. r=heycam 2016-12-23 19:23:50 -08:00
Cameron McCormack
244c8f4be3 Bug 1324341 - Part 2: Redo the cascade when CSSOM methods modify style sheets. r=xidorn
MozReview-Commit-ID: AIkwBaUlxD7
2016-12-19 14:30:14 +08:00
Bobby Holley
2a011cd176 Bug 1322945 - Change skip_root to unstyled_children_only and use StyleNewChildren in more places. r=heycam
I noticed that our current behavior in ContentRangeInserted is incorrect. Unlike
ContentInserted (where this code lived originally), ContentRangeInserted takes a
start and end element. I'm not sure if we ever take that path for new content that
needs style, but it seemed sketchy. And generally, it seems nice to just always
style new content the same way (though we still need to style NAC by the subtree
root, since it hasn't been attached to the parent yet).

For situations where there is indeed only one unstyled child, the traversal
overhead should be neglible, since we special-case the single-element in
parallel.rs to avoid calling into rayon.

Being more explicit about what we want here also makes us more robust against
the other handful of callpaths that can take us into
nsCSSFrameConstructor::{ContentRangeInserted,ContentAppended}. Currently we
can call StyleNewSubtree on an already-styled element via RecreateFramesForContent,
which triggers an assertion in the servo traversal.

MozReview-Commit-ID: DqCGh90deHH
2016-12-12 18:39:33 -08:00
Cameron McCormack
a0875e2a06 Bug 1321284 - Part 5: Process document level NAC when restyling. r=bholley
MozReview-Commit-ID: GigSrTHXXte
2016-12-01 16:19:50 +08:00
Bobby Holley
3775205e64 Bug 1317016 - Basic infrastructure for RestyleHint-driven traversal. r=emilio
MozReview-Commit-ID: 7wH5XcILVmX
2016-11-25 10:06:39 -08:00
Cameron McCormack
15e6c53c13 Bug 1318238 - Clear all ServoNodeData during style set shutdown. r=bholley
MozReview-Commit-ID: 9MvBTAWeawC
2016-11-18 16:54:10 +08:00
Bobby Holley
53acf04c7b Bug 1292729 - Style text nodes on the main thread. r=heycam
MozReview-Commit-ID: CroFtWpuIrO
2016-10-25 20:10:04 -07:00
Xidorn Quan
b8a48e579e Bug 1309868 part 3 - Make NonOwningStyleContextSource store const ServoComputedValues. r=heycam
MozReview-Commit-ID: G84fYXLbQyt
2016-10-18 15:29:03 +11:00
Xidorn Quan
7d6c4129ab Bug 1304302 part 10 - Replace all uses of StyleSheetHandle. r=heycam
This commit is generated by the following commands with some minor
manual adjustment:

find . \( -name '*.h' -or -name '*.cpp' \) -not -path './layout/style/StyleSheet*' -exec sed -i -b \
  -e '/^\(#include\|using\)/s/StyleSheetHandle/StyleSheet/g' \
  -e 's/\(mozilla::\)\?StyleSheetHandle::RefPtr/RefPtr<\1StyleSheet>/g' \
  -e 's/StyleSheetHandle()/nullptr/g' \
  -e 's/->AsStyleSheet()//g' \
  -e 's/StyleSheetHandle/StyleSheet*/g' {} +
sed -i -b 's/sheet->AsVoidPtr()/sheet.get()/' layout/style/Loader.cpp
sed -i -b 's/AsHandle()/this/' layout/style/StyleSheet.cpp

MozReview-Commit-ID: 7abdvlKHukd
2016-09-26 22:03:25 +10:00
Manish Goregaokar
49b3b83008 Bug 1300337 - Replace None_ variants from nsStyleConsts.h with None; r=heycam,TYLin
MozReview-Commit-ID: CxHzbEzjLxT
2016-09-04 00:16:58 +05:30
Emilio Cobos Álvarez
2efcfaad38 Bug 1299066: Make NS_STYLE_DISPLAY_* an enum class. Prefer indexing instead of linear search in the frame constructor r=heycam,bz
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
2016-09-01 20:41:17 -07:00
Ryan VanderMeulen
a1e704ac46 Merge m-c to autoland. a=merge 2016-08-31 22:34:02 -04:00
Emilio Cobos Álvarez
e00e28c598 Bug 1299396: Don't style content that is not an element or a text node in ServoStyleSet::StyleNewSubtree. r=bholley
MozReview-Commit-ID: KmcYPFqt48W
2016-08-31 14:33:46 -07:00
Bobby Holley
8e6b8445cc Bug 1299348 - Remove StylingStarted(). r=emilio
StylingStarted is a kind of nebulous and not-very-useful concept. The concept
that _is_ useful is whether the presshell has been initialized or not, but the
root element may not exist at that point.

So we need to make sure we that we can trigger the initial document style in both
presshell initialized _and_ ContentInserted, which has the nice effect of handling
root element reinsertions.

We also take the opportunity to make StyleDocument assert the existence of a root
element, and align the responsibility for clearing the dirty descendant bits between
document and non-document nodes.
2016-08-31 10:32:42 -07:00
Emilio Cobos Álvarez
0ef9a4de4c Bug 1292280: Force a full document restyle on ServoStyleSet::StartStyling. r=bholley
Some things like nsDocumentViewer::SetPageMode recreate the presShell, so we
can't rely on the flags being correctly set always.

MozReview-Commit-ID: 4bxNjXGBaJt
2016-08-25 13:36:51 -07:00
Bobby Holley
2317c7eb1c Bug 1292662 - Use accessors to unset stylo dirty bits. r=heycam
I often find myself wanting to hook them for logging etc, and this makes the
API symmetric with the setters.
2016-08-25 21:36:57 -07:00
Bobby Holley
a256e14379 Bug 1292662 - Use StyleChildrenIterator in ServoRestyleManger and ServoStyleSet. r=heycam
Most importantly, this causes us to traverse NAC during style context fixup.
2016-08-25 21:36:51 -07:00
Bobby Holley
fb49955c2b Bug 1292279 - Clear up the semantics of our Servo traversal APIs. r=heycam 2016-08-25 21:34:31 -07:00
Xidorn Quan
a87b549cbc Bug 1296173 part 2 - Rename the servo binding functions. r=bholley
MozReview-Commit-ID: Gxqx52v3sDQ
2016-08-23 13:14:27 +10:00
Xidorn Quan
bbb47cb2f5 Bug 1296173 part 1 - Change StyleSet manipulation functions to be prefixed by Servo_StyleSet_. r=bholley
MozReview-Commit-ID: C1PPJltyodE
2016-08-23 13:10:49 +10:00
Emilio Cobos Álvarez
5f19f35643 Bug 1292618: followup: Use IsGeneratedContentContainerForBefore/After in ServoStyleSet. r=me
MozReview-Commit-ID: AU8YKQBvXX7
2016-08-22 10:42:18 -07:00
Emilio Cobos Álvarez
bcc78cf397 Bug 1292618: Specialize ServoStyleSet::ResolveStyleForText to take into account generated nodes. r=heycam
Eventually, we might want to use the same mechanism that Gecko uses directly,
and stop styling text nodes from Servo.

This would have the benefit of removing the "stash the change on the parent"
thing.

MozReview-Commit-ID: IOxNR05jkh
Signed-off-by: Emilio Cobos Álvarez <ecoal95@gmail.com>
2016-08-19 20:24:28 -07:00
Emilio Cobos Álvarez
b233d1f26a Bug 1292618: Support basic pseudo-element restyling. r=heycam
:before and :after only, for now.

MozReview-Commit-ID: 9hLFvVhqIrN
2016-08-19 20:24:27 -07:00
Wes Kocher
9e201f5768 Backed out 4 changesets (bug 1292618) because it was making merging things difficult a=backout
Backed out changeset 14733a383b4c (bug 1292618)
Backed out changeset 17dfe8bc5f76 (bug 1292618)
Backed out changeset d04597bd1109 (bug 1292618)
Backed out changeset 30f7696fea2d (bug 1292618)
2016-08-19 18:37:09 -07:00
Emilio Cobos Álvarez
27b661c9b7 Bug 1292618: Specialize ServoStyleSet::ResolveStyleForText to take into account generated nodes. r=heycam
Eventually, we might want to use the same mechanism that Gecko uses directly,
and stop styling text nodes from Servo.

This would have the benefit of removing the "stash the change on the parent"
thing.

MozReview-Commit-ID: IOxNR05jkh
Signed-off-by: Emilio Cobos Álvarez <ecoal95@gmail.com>
2016-08-19 18:26:38 -07:00
Emilio Cobos Álvarez
6798126e12 Bug 1292618: Support basic pseudo-element restyling. r=heycam
:before and :after only, for now.

MozReview-Commit-ID: 9hLFvVhqIrN
Signed-off-by: Emilio Cobos Álvarez <ecoal95@gmail.com>
2016-08-19 18:26:38 -07:00
Phil Ringnalda
069e5d30dc Backed out 5 changesets (bug 1292618) for !mImageTracked assertion failures
CLOSED TREE

Backed out changeset 1d767147e160 (bug 1292618)
Backed out changeset e6034e58efe4 (bug 1292618)
Backed out changeset 928dd363efa0 (bug 1292618)
Backed out changeset 8e274c66ae7f (bug 1292618)
Backed out changeset 6c347701d343 (bug 1292618)
2016-08-19 00:23:42 -07:00