132 Commits

Author SHA1 Message Date
Elliott Sprehn
ff2cde060f Remove more properties from the global Window.
StyleMedia seems to have been removed from the web too, and self is a
legacy-ism we don't want. I also removed the global find() which is a
document feature.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/872143004
2015-01-26 15:12:04 -08:00
Elliott Sprehn
ed2912af0b Remove PseudoId.
Sky doesn't have pseudo elements (::before, ::after, etc.)

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/883443003
2015-01-26 13:51:56 -08:00
Elliott Sprehn
86f47baf88 Remove even more @keyframes related code.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/876433002
2015-01-26 11:38:20 -08:00
Adam Barth
da75d15a1b Merge HTMLDocument into Document
HTMLDocument is the same as Document. We can merge them.

R=eseidel@google.com

Review URL: https://codereview.chromium.org/871383002
2015-01-25 23:48:53 -08:00
Elliott Sprehn
0275d42ac7 Add the <t> element and ignore whitespace outside it.
We now only preserve the whitespace inside a <t> element inside
the parser. This removes the known n^2 from reattaching whitespace
which should make parsing and appending nodes faster. I also
removed the dead WhitespaceMode code from the parser, and made
the dom-seralizer.sky auto indent the markup so the test output
would be readable.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/867963006
2015-01-23 16:50:00 -08:00
Elliott Sprehn
1d994fbaf0 Remove lots of @keyframes related code.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/872893002
2015-01-23 13:24:09 -08:00
Elliott Sprehn
c9a152c464 Remove @keyframe parsing.
We still have the code internally, but the parser won't create
StyleRuleKeyframes anymore.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/871773003
2015-01-22 20:48:22 -08:00
Adam Barth
2c0b2f7ff9 Remove UseCounter
We'll eventually add this back but sometime in the future when we actually have
users.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/867903002
2015-01-22 18:26:55 -08:00
Elliott Sprehn
93af6b3bf1 Don't store a RuleFeatureSet on ScopedStyleResolver.
Instead lets just iterate the list of sheets and ask each one questions. This
shouldn't be much slower since most widgets only have one sheet anyway.

I also moved the media query matching to the sheet collection. We weren't
correctly matching them since we only guarded the feature set, not the
addition to the list of active sheets.

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

Review URL: https://codereview.chromium.org/858423002
2015-01-21 17:00:06 -08:00
Elliott Sprehn
a489bb7128 Remove css !important
Sky doesn't have important, it just orders properties in the same order
as the rules you specified.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/860423004
2015-01-21 14:34:02 -08:00
Elliott Sprehn
5ebbdf3db6 Eliminate RuleRange.
In Sky there's no UA rules so we don't need to keep track of the
range of UA vs Author rules for running applyMatchedProperties later.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/863883002
2015-01-20 19:50:35 -08:00
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
d8f1313e81 Always set affected by bits in ElementRuleCollector.
We need to always set these bits, not just if the selector
matched otherwise :hover and friends won't ever match.

BUG=448465
R=ojan@chromium.org

Review URL: https://codereview.chromium.org/852643002
2015-01-13 14:11:02 -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
689b91c36d Replace sheet change methods with styleResolverChanged.
Unlike blink in sky we just want to mark tree scopes dirty. We can
remove these methods, the dirty tree scope tracking we'll add in
the future will take care of this.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/836893003
2015-01-12 18:23:55 -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
b7336cd862 Remove shadowPseudoElementRules.
Nothing uses this now, it was for custom pseudo elements
that don't exist in Sky.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/786953008
2015-01-09 18:18:47 -08:00
Elliott Sprehn
c5d1426457 Remove all attribute selectors that are not Set or Exact.
Sky doesn't support prefix, suffix, list, contains
or other fancy attribute selectors.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/836383004
2015-01-09 18:09:47 -08:00
Elliott Sprehn
bbd0b89106 Get rid of SelectorCheckingContext.
We can just pass the Element and the scope.

I also deleted checkExactAttribute which was not called, and inlined
tagMatches which only had a single caller.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/801283006
2015-01-09 15:17:20 -08:00
Elliott Sprehn
29ce4f5a9a Make SelectorChecker a const operation over element.
We now store the bits about what was matched inside the SelectorChecker
and map them to operations that mutate the style after matching the
selector. This eliminates the SelectorChecker::Mode.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/840163003
2015-01-08 18:06:12 -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
0ef7c1c7ba Fix attribute selectors.
There was a return missing in SelectorChecker, we were also making
the attribute names lowercase which is not neccesary in Sky.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/815613002
2014-12-17 14:00:17 -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
4b7e60d511 Remove dead StyleRuleFilter.
This was for custom shaders, which we don't support (and neither
does Blink).

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/810543002
2014-12-15 16:29:47 -08:00
Elliott Sprehn
e9806c1a88 Remove containsAttributeSelector() checks.
We can just set the style as unique from inside the SelectorChecker
instead. That's not ideal either, but it's simpler, and we'll eventually
use a hashing function to instead make elements with attribute selectors
that have the same values share their style instead of disabling
sharing.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/803113004
2014-12-15 13:43:40 -08:00