68 Commits

Author SHA1 Message Date
Elliott Sprehn
b05eec5f30 Prune the API of StyleResolver.
R=ojan@chromium.org

Review URL: https://codereview.chromium.org/858073003
2015-01-20 19:10:03 -08:00
Elliott Sprehn
f0e8f7c7d3 Treat UA rules like author rules when matching.
Sky doesn't have a concept of UA rules, just some default style
rules you can override.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/864693002
2015-01-20 18:49:23 -08:00
Elliott Sprehn
1d3828fb29 Put the StyleResourceLoader on the stack.
It has no state, we should just put it on the stack during style
resolve.

I also combined the methods inside StyleResourceLoader to make it
simpler.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/825433003
2015-01-20 16:49:40 -08:00
Elliott Sprehn
7686fb0b8f Simplify media query handling for stylesheets.
Just rebuild the sheets when the viewport changes sizes since that's
super rare in sky right now. This also causes a full document style
recalc, but we'll fix that later too. For now lets make the system
simpler.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/848483003
2015-01-20 15:35:25 -08:00
Elliott Sprehn
38c4d27f53 Remove custom element :unresolved.
Sky doesn't do upgrades and unknown elements become <error>
so this doesn't make sense.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/842033004
2015-01-16 17:50:18 -08:00
Elliott Sprehn
9bb2664b06 Get rid of ensureStyleResolver().
It doesn't have side effects anymore, and active documents always
have a StyleResolver.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/838003008
2015-01-16 17:49:32 -08:00
Elliott Sprehn
8f1c3bacfc Trim the deps of StyleResolver.h
TBR=abarth@chromium.org

Review URL: https://codereview.chromium.org/794783003
2015-01-15 13:11:10 -08:00
Ojan Vafai
d563e42443 Unprefix -webkit-filter and add a pixel test for it.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/850103003
2015-01-14 15:14:46 -08:00
Elliott Sprehn
6f8568037a Move @font-face logic from ScopedStyleResolver to StyleEngine.
R=abarth@chromium.org, ojan@chromium.org

Review URL: https://codereview.chromium.org/851873002
2015-01-14 11:07:22 -08:00
Elliott Sprehn
e71cf28f76 Merge StyleSheetCollection into ScopedStyleResolver.
There's no reason to keep two identical lists of the sheets
and have this separate object. I also moved the updating
logic out of StyleResolver and into ScopedStyleResolver
which makes more sense. There's still some weirdness since
some global state still exists in the StyleResolver, but
that's something we can fix in future patches.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/852703002
2015-01-13 18:37:00 -08:00
Elliott Sprehn
1eb36b8721 Remove RuleSet::viewportDependentMediaQueryResults.
Sky doesn't support @media rules, <style> elements must use
the media attribute which instead stores the media query
info on the CSSStyleSheet instead.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/850463003
2015-01-13 11:34:14 -08:00
Elliott Sprehn
7fd0df2238 Remove tracking of pending sheets.
I was going to remove all this anyway since we don't need it in sky, all sheets
are local and there's no concept of a pending sheet now.

I also removed the dirty bit I added to StyleSheetCollection. The bit
is not correct and is preventing us from correctly processing sheets and
invalidating style. I'll add it back later when I understand how to add
the dirty bit correctly.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/846183002
2015-01-12 18:15:23 -08:00
Elliott Sprehn
9931dadd39 Don't check shareElement for attribute rules in SharedStyleFinder.
There's no reason to do this, if an element matched
an attribute rule then it'll have a unique style and
RenderStyle::isSharable() will return false so we
wouldn't even get here.

If we could have matched an attribute rule, but didn't
actually match one then we can continue to share with
other elements that aren't affected by attribute rules
since even though our attributes could affect styling
the rules didn't match us.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/843233002
2015-01-09 19:14:33 -08:00
Elliott Sprehn
47b217c64c Don't scope check in SelectorChecker.
Instead of checking if the rule is from the right scope
in SelectorChecker, just store :host rules separately
and always assume rules are in the right scope in the
checker.

This removes a lot of complexity that was passing around
the scope and checking it, and also the need to plumb
if we're matching UA rules down into the checker.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/848493003
2015-01-09 19:00:51 -08:00
Elliott Sprehn
7b0d1d8fda Remove CascadeScope.
It's always zero in sky.

This was for sorting tree boundary crossing rules and rules in multiple
ShadowRoots on the same element. Neither of those things exist in Sky
so we can remove it.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/800483006
2015-01-08 18:02:23 -08:00
Elliott Sprehn
c953075f5f Remove includeEmptyRules.
No one ever sets this, and I'm not sure why we'd ever want to
keep around empty property sets.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/828373005
2015-01-08 17:23:05 -08:00
Ojan Vafai
7ae966e650 Fix crash in continuations.
Style sharing didn't play nicely with elements getting
their display adjusted based off the parent's display.
We style share without doing adjusting, so we need to
avoid style sharing if adjusting would result in
a different style. Particularly, we need to make sure
that the display coercion would happen in the same way.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/839153002
2015-01-08 17:20:00 -08:00
Elliott Sprehn
e737df55fb Simplify the style sharing list code.
We don't need separate lists per depth now, in fact we never
increment the depth so everything is already at depth 0.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/844873002
2015-01-08 13:53:00 -08:00
Elliott Sprehn
967cc9ed34 Move StyleResolver code out of ScopedStyleResolver.
Instead lets process the ruleset into the global lists in
the StyleResolver itself. I also combined the methods in
StyleResolver and removed the now dead AddRuleFlags
argument.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/838313002
2015-01-08 13:44:12 -08:00
Elliott Sprehn
c42957e7e7 Combine match methods on StyleResolver.
We can combine matchAuthorRulesForShadowHost into
matchAuthorRules, and also combine the two matchUARules
methods.

collectScopedResolversForHostedShadowTrees and the Vector
of ScopedStyleResolvers was also not needed. Sky can only
ever have two resolvers, the one for your scope, and the
one for your host rules.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/836193003
2015-01-08 10:16:59 -08:00
Elliott Sprehn
8fc2d586cb Remove SelectorChecker::ContextFlags.
We don't need the flags, we can just use an explicit
check for :host().

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/838863002
2015-01-07 11:57:32 -08:00
Elliott Sprehn
8bdd05a389 Remove applyAuthorStyles flag.
This flag doesn't really make sense in sky, rules should
only match if they're from the same scope or are a :host
rule in the ShadowRoot on the element. Removing this also
eliminates the ScopeContainsLastMatchedElement flag. For
now we just check if the scope is null for the same
behavior, in the future we'll never let scope be null
and we'll just enforce the normal style scoping rules.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/833443003
2015-01-07 11:35:40 -08:00
Elliott Sprehn
61d08323e8 Remove dead enums from StyleResolver.
We never disable style sharing with DisallowStyleSharing
now, and SMIL doesn't exist in Sky so the
MatchAllRulesExcludingSMIL flag is just dead code.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/823633006
2015-01-07 11:19:29 -08:00
Elliott Sprehn
059ceb6e3f Remove the remaining parts of ignorePendingStylesheets and placeholder styles.
This patch is largely just a rename since updateLayoutIgnorePendingStylesheets()
didn't really do anything except call updateLayout() now as nothing was reading
the ignorePendingStyleSheets state, and no callers used the synchronous post
layout task option which was meant for plugins (which Sky doesn't have).

Placeholder styles were related and just add confusion since things pretend to
be display: none while <import>'s are loading. We should expose a real API for
avoiding FOUC instead of pumping frames with display: none elements when
imports are loading.

I had to skip the layout/continuations.sky test since it always crashes now
with an ASSERT failure about a bad cast (filed as bug 446739). The bug already
existed, this patch just makes that one test hit it.

BUG=446739
R=ojan@chromium.org

Review URL: https://codereview.chromium.org/834693007
2015-01-07 10:54:41 -08:00
Elliott Sprehn
8b97399df3 Simplify ScopedStyleResolver keyframe handling.
Just linearly search for keyframes in the set of stylesheets.
Components rarely have many sheets, and sheets rarely have many
keyframes so this should be quite fast. It's also much simpler
than having to collect all the keyframes from all the rulesets.

R=ojan@chromium.org, rafaelw@chromium.org

Review URL: https://codereview.chromium.org/839473005
2015-01-07 10:47:43 -08:00
Elliott Sprehn
f4546b7716 Store features in the ScopedStyleResoolver.
This now means that using a class/id/attribute selector in one scope will
not cause style recalcs in other scopes in the page when something with
that feature changes.

It also removes an iteration over all the scopes that used to collect
features.

I also removed all the extra cases around adding/removing classes since
the general case can handle them.

In addition I removed the check for classStringHasClassName which looked
to see if the string was all whitespace. This check dated way back to
fixing an assert in code we don't even have anymore. Assertion fix aside
all the extra check optimized for was if you wrote class="  " with no
names, which will now cause an extra malloc of the SpaceSplitString::Data.
This seems super rare, it makes more sense to not scan the class string
every time the list of classes changes which is far more common than
setting a string of only whitespace.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/837883002
2015-01-06 22:22:44 -08:00
Elliott Sprehn
3ffc5ab932 StyleSheetContents doesn't need a set of clients.
The clients were only used to call clearResolver(), but all clients in Sky
are from the same document, so we can just store the document instead. We
can also use the lifetime of the StyleSheetContents object to manage the
cache in the StyleEngine instead of the list of clients.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/791633010
2014-12-16 16:22:04 -08:00
Elliott Sprehn
2a1d0c5abb Remove global set of ScopedStyleResolvers.
Just walk the DOM instead. This will be slower, but I'm going to get rid
of the global RuleFeatureSet anyway, so this is just a temporary measure
to simplify the system. Removing the set also means removing a bunch of
special cases for when the document didn't have any ShadowRoots with
styles (which is very unlikely in Sky).

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/810893002
2014-12-16 15:57:47 -08:00
Elliott Sprehn
f44ab040a3 Remove @media rules.
In sky we only support inline styles and <style media>, not
@media rules. This removes the Bison support for parsing them
which was also removed in Blink in favor of the other media
query parser which was added for use on the pre-scanner thread.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/807703003
2014-12-15 18:29:19 -08:00
Elliott Sprehn
ca96d732de Remove REM units.
The code to make them dynamically update was already removed when
Document::inheritHtmlAndBodyElementStyles was removed. We might want
to add them back later, but probably in a different way, so lets
remove the code for now to make refactoring the style system easier.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/788883005
2014-12-15 17:29:04 -08:00
Elliott Sprehn
e0cde8499a Remove single client special cases for StyleSheetContents.
We can also remove all single document checks since in Sky we
don't have the cross document cache so all sheets are always
connected to a single document.

I also did some minor code simplification and removed an
OILPAN ifdef.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/799143002
2014-12-12 17:08:43 -08:00
Elliott Sprehn
e1c6f5561c Remove style element counting in ShadowRoot.
This optimization doesn't make sense, all it does is avoid adding
the ScopedStyleResolver for the ShadowRoot when looking for host
styles, but having that extra resolver shouldn't be slow, and in
sky it's very rare to have a ShadowRoot without styles unlike
on the web where <input> is very common and gets its style from
the UA instead of from a <style> like a normal component.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/797873002
2014-12-11 17:33:56 -08:00
Elliott Sprehn
0af96f055d Turn StyleSharing to 11.
In Sky we can style share if our TreeScopes have the same styles, our :host
styles are the same, and we'd inherit the same styles. This allows a lot of
simplification to the style sharing logic since we don't need to deal with
descendant selectors or tree boundary crossing rules:

- We can remove the logic that was checking that we were distributed
to the same insertion points since there's no ::content selectors.

- We can check the actual inherited values instead of looking at the
parentOrSHadowHostNode(). We used to look at the node in Blink because we
were checking that you'd get the same descendant selectors applied. In Sky
we instead want to make sure you'd inherit the same values. This also
means we don't need the element().parentOrShadowHostElement() != parent case
in the SharedStyleFinder which was trying to deal with descendant selectors
again.

I also removed the checks that were redundant with the checks inside
supportsStyleSharing() which we always check before adding sharing
candidates.

Finally by refactoring the code to make the TreeScope style check work it
exposed that the Document::styleSheets() and TreeScope::styleSheets() APIs
are now dead. A future patch will delete the now dead StyleSheetList class
as well.

This change makes the city-list application share between all the items in
the list, and all of the headers of the same type now share as well.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/796713002
2014-12-11 15:34:24 -08:00
Elliott Sprehn
2be9b79d94 Use the HashSet of attribute names in SharedStyleFinder.
Instead of trying to match the actual attribute rules, lets just look
at the HashSet of attribute names. This is faster, though possibly less
optimal if you use compound rules like .foo[attr]. That's rare though,
and removing this extra RuleSet will allow simplifying SelectorChecker
since hasAnyMatchingRules required a special mode where it tried to
match selectors but ignored if the scope could really match. This paves
the way to moving the RuleFeatureSet to be per-TreeScope instead of
per-Document.

I also made the API of classNamesAffectedByRules match the newly added
attributesAffectedByRules to make SharedStyleFinder consistent.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/796583002
2014-12-10 17:12:07 -08:00
Elliott Sprehn
6c94c18612 Remove the CSSOM.
This leaves CSSValue, but removes everything else.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/780483002
2014-12-03 10:50:02 -08:00
Elliott Sprehn
1ace39304c Remove code to collect rules when matching.
We should come up with a better way to implement this feature for the
inspector, the current implementation uses CSSOM wrappers and is n^2
over the number of rules in the page.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/772363002
2014-12-02 23:10:58 -08:00
Elliott Sprehn
1f1d90bc70 Remove ScopedStyleResolver::treeScopeFor.
We only support inline stylesheets or <style scoped> so we can remove
this helper.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/767013004
2014-12-02 10:06:48 -08:00
Elliott Sprehn
65c353a334 Remove parent() concept from ScopedStyleResolver.
This isn't needed, we don't have any tree boundary crossing rules.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/767273003
2014-12-01 20:04:48 -08:00
Elliott Sprehn
253b5bed74 Only allow one shadowRoot.
R=ojan@chromium.org

Review URL: https://codereview.chromium.org/759663003
2014-11-26 13:54:14 -05:00
Eric Seidel
295f920116 Fix sky include guards to match Chromium style
I wrote a script to do this which is attached
to the bug.

TBR=abarth@chromium.org
BUG=435361

Review URL: https://codereview.chromium.org/736373003
2014-11-21 02:48:38 -08:00
Eric Seidel
e0fd75b5ab Make absolute and sort all Sky headers
This caused us to lose our gn check certification. :(

Turns out gn check was just ignoring all the header
paths it didn't understand and so gn check passing
for sky wasn't meaning much.  I tried to straighten
out some of the mess in this CL, but its going to take
several more rounds of massaging before gn check
passes again.  On the bright side (almost) all of
our headers are absolute now.  Turns out my script
(attached to the bug) didn't notice ../ includes
but I'll fix that in the next patch.

R=abarth@chromium.org
BUG=435361

Review URL: https://codereview.chromium.org/746023002
2014-11-20 17:42:05 -08:00
Eric Seidel
55b5bc485d Sort headers
Fix (most) generated includes to have gen/ in their path.

This makes it easier to tell where files exist on disk.

Unfortunately I had to leave the old include path
in engine/BUILD.gn to support all the v8 includes
which were too many to deal with in this patch.

It's a little nasty to have the raw build directory
in our include path, but it produces nicer paths.

R=abarth@chromium.org
2014-11-19 12:33:42 -08:00
Benjamin Lerman
40f1c26a7d Fix android build.
TBR=ojan@chromium.org

Review URL: https://codereview.chromium.org/739573003
2014-11-18 16:10:52 +01:00
Ojan Vafai
7a37fa8c09 First step at getting rid of anonymous blocks and continuations.
-Add RenderParagraph and display:paragraph. This is the only
render type that's allowed to contain inlines or text.
-If you put text nodes directly in a non-paragraph, wrap them
in an anonymous paragraph. This may not be the place we want
to end up, but it's a good stopgap to make it so we don't
crash in this case.
-Make StyleAdjuster force that non-paragraph blocks only contain
RenderBlock subclasses and that paragraphs and inlines only contain
inlines.
-Considerably simplify addChildIgnoringAnonymousColumnBlocks
now that we only create anonymous blocks for the case of
text nodes in non-paragraphs. Also get rid of the behavior
where we try to group multiple nodes into a single
anonymous block.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/729693003
2014-11-17 18:39:52 -08:00
Rafael Weinstein
0b758e5227 Remove CSSCompositing
BUG=
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/731863003
2014-11-17 14:34:30 -08:00
Elliott Sprehn
42d362ff6b Remove tons of OILPAN.
This removes ::trace, traceAfterDispatch and finalizeGarbageCollectedObject.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/723253004
2014-11-13 16:56:13 -08:00
Elliott Sprehn
89d5919878 Merge CSSDefaultStyleSheets into StyleResolver.
R=abarth@chromium.org, ojan@chromium.org

Review URL: https://codereview.chromium.org/712143004
2014-11-10 18:50:13 -08:00
Elliott Sprehn
9c7987a6e1 Remove StyleInvalidator machinery.
We don't support descendant selectors, so switch everything back to
basic hash table lookups.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/712173002
2014-11-10 17:35:11 -08:00
Ojan Vafai
275c5e291c Remove zoom() and effectiveZoom().
No change in behavior since we already removed the zoom setters.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/711203002
2014-11-10 17:32:52 -08:00
Ojan Vafai
e00f34ccf6 Initial step of removing CSS zoom related properties.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/710113003
2014-11-10 13:07:29 -08:00