Commit Graph

58 Commits

Author SHA1 Message Date
Cameron McCormack
8988b48d12 Bug 1222886 - Remove unused nsCSSParser::{SetStyleSheet,SetChildLoader,SetQuirkMode} methods. r=bzbarsky 2015-11-11 09:17:24 +11:00
L. David Baron
87f75f0802 Bug 1221436 patch 2 - For style attributes, only store a css::Declaration instead of a css::StyleRule. r=heycam
Now that Declaration implements nsIStyleRule, we don't need the memory
overhead of storing a StyleRule object for style attributes.

We also need to change this prior to patch 5, because the changes in
patch 5 that will allow rules to change (but declarations not) would
otherwise break due to style attribute object merging done by
nsAttrValue::ParseStyleAttribute.
2015-11-09 15:57:16 +08:00
Cameron McCormack
4649c5b3d1 Bug 1208951 - Part 4: Add an nsCSSParser entry point to parse a single longhand property and return an nsCSSValue. r=birtles
It is a slight hassle for code to have to create a Declaration object to
pass in to nsCSSParser::ParseProperty when all it wants is the resulting
single nsCSSValue, if parsing a longhand property.  Declaration is also
inaccessible outside layout/style/.
2015-10-22 19:22:37 +11:00
Zack Weinberg
9ceb4413b1 Bug 1035091 part 1: change CSS parser and loader APIs to distinguish UA, user, and author sheets instead of just UA vs everyone else. r=heycam 2015-10-13 17:43:16 -04:00
Jonathan Kew
281dfdbd19 Bug 1099557 followup - Put the default setting for control-character visibility behind a runtime pref, and keep it off-by-default on release builds for now. r=dbaron 2015-10-01 12:26:52 +01:00
Jonathan Kew
7f7aab644c Backed out changeset b3937b455406 (bug 1099557) because an incomplete patch was pushed. 2015-10-01 12:19:39 +01:00
Jonathan Kew
b013c98dbb Bug 1099557 followup - Put the default setting for control-character visibility behind a runtime pref, and keep it off-by-default on release builds for now. r=dbaron 2015-10-01 12:13:33 +01:00
Tom Tromey
b383334103 Bug 1202095 - re-use @imported style sheets from inIDOMUtils.parseStyleSheet. r=heycam 2015-09-18 07:27:00 +02:00
Wes Kocher
8700dcb6b5 Backed out 2 changesets (bug 1035091)
a=backout

Backed out changeset 1fc07bdd9aa8 (bug 1035091)
Backed out changeset f6e98029d1cb (bug 1035091)
2015-09-03 11:41:39 -07:00
Zack Weinberg
50d9ee1776 Bug 1035091 part 1: change CSS parser and loader APIs to distinguish UA, user, and author sheets instead of just UA vs everyone else. r=heycam 2015-09-02 13:52:49 -04:00
Birunthan Mohanathas
e52329c788 Bug 1182996 - Fix and add missing namespace comments. rs=ehsan
The bulk of this commit was generated by running:

  run-clang-tidy.py \
    -checks='-*,llvm-namespace-comment' \
    -header-filter=^/.../mozilla-central/.* \
    -fix
2015-07-13 08:25:42 -07:00
Cameron McCormack
e36cb0498e Bug 1148711 - Remove nsresult return values from nsCSSParser::Parse{Property,Variable}. r=dholbert 2015-03-29 22:57:04 +11:00
Daniel Holbert
f53aa2771b Bug 1135200: Hook up nsCSSParser's pref-backed bool variables in a startup method. r=heycam 2015-02-26 09:02:19 -08:00
Ehsan Akhgari
b6e35bb4b4 Bug 1118486 - Part 1: Use = delete instead of MOZ_DELETE directly; r=Waldo
Most of this patch (with the exception of dom/bindings/Codegen.py) was
generated by the following bash script:

#!/bin/bash

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "*/.git*" \
       ! -wholename "obj-*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_DELETE '= delete'
2015-01-08 23:19:05 -05:00
Cameron McCormack
0fe3c039e0 Bug 1070260 - Add public nsCSSParser function for parsing @font-face descriptors. r=jdaggett 2014-09-24 15:49:02 +10:00
Ehsan Akhgari
95a75d8cc2 Bug 1060985 - Fix more bad implicit constructors in layout; r=roc 2014-08-31 23:36:37 -04:00
Michael Ratcliffe
4969ae2773 Bug 1035106 - Add new APIs to DOMUtils: colorToRGBA, isValidCSSColor & cssPropertyIsValid r=bz 2014-07-17 15:08:07 +01:00
John Schoenick
6b99891708 Bug 870022 - Part 2 - Add ParseSourceSizeList to CSS parser for <picture sizes> grammar. r=bz 2014-06-25 11:47:46 -07:00
Ms2ger
45efada15c Bug 1022855 - Rename nsCSSStyleSheet to mozilla::CSSStyleSheet; r=heycam
--HG--
rename : layout/style/nsCSSStyleSheet.cpp => layout/style/CSSStyleSheet.cpp
rename : layout/style/nsCSSStyleSheet.h => layout/style/CSSStyleSheet.h
2014-06-20 12:32:49 +02:00
Ms2ger
1ab8344d82 Backout revision 308e51eae10c for build bustage.
--HG--
rename : layout/style/CSSStyleSheet.cpp => layout/style/nsCSSStyleSheet.cpp
rename : layout/style/CSSStyleSheet.h => layout/style/nsCSSStyleSheet.h
2014-06-20 13:00:08 +02:00
Ms2ger
530bc74c8d Bug 1022855 - Rename nsCSSStyleSheet to mozilla::CSSStyleSheet; r=heycam
--HG--
rename : layout/style/nsCSSStyleSheet.cpp => layout/style/CSSStyleSheet.cpp
rename : layout/style/nsCSSStyleSheet.h => layout/style/CSSStyleSheet.h
2014-06-20 12:32:49 +02:00
Birunthan Mohanathas
f475f7189b Bug 1026535 - Fix mismatched class/struct tags. r=ehsan 2014-06-18 17:57:51 -07:00
Xidorn Quan
ab361e10f1 Bug 966166 - Part 1: Parse @counter-style rule. r=dbaron, r=bz 2014-06-11 21:10:00 -04:00
John Daggett
b569224dce Bug 280443 p2 - parse font family lists into fontlist structs. r=heycam 2014-06-06 15:09:23 +09:00
Cameron McCormack
44dcde583f Bug 773296 - Part 23: Support variables in CSSStyleDelcaration methods. r=dbaron
This adds support for custom properties on the remainder of the
CSSStyleDeclaration methods.

A shorthand that was specified using a variable reference is serialized
to its originally specified value, rather than by concatenating the
serializations of its longhand components.

A shorthand that was not specified using a variable references but which
has a component longhand that was is serialized to the empty string.
2013-12-12 13:09:46 +11:00
Cameron McCormack
ba08f38dc0 Bug 773296 - Part 18: Add error reporting for invalid variable references. r=dbaron
This adds CSS parser error reporting for parsing of custom properties
and normal properties that have variable references.

When re-parsing a normal property that had a variable reference, we
report any parse error to be at the beginning of the property value.
This is because it is difficult to keep track of where exactly each
variable substitution came from to point to the particular value
that would have caused the parse error.  For example, with this:

  :root {
    var-a: 1px 2px;
    var-b: 3px var(a);
  }
  p {
    margin: var(a) var(b);
  }

we would end up resolving the value of 'margin' to:

  "  1px 2px  3px  1px 2px"

In this string, the parse error occurs when we encounter the final
"2px", but by this point we don't know where that value came from.
So instead we just point to the line on which 'margin' was declared.

We extend ErrorReporter with an OutputError overload that takes the
specific line and column number to use in the error report to get this
right, and we store the line and column number for each token stream
we parse on the nsCSSValueTokenStream object.
2013-12-12 13:09:44 +11:00
Cameron McCormack
9ee3123e5b Bug 773296 - Part 17: Resolve property values that have variable references at computed value time. r=dbaron
This re-parses property values at computed value time if
they had a specified value that was a token stream.  We add
a function nsRuleNode::ResolveVariableReferences that looks
at all the values in the nsRuleData and calls in to a new
nsCSSParser::ParsePropertyWithVariableReferences function if they have a
token stream value.

We add a nsCSSExpandedDataBlock::MapRuleInfoInto function that will
take the re-parsed property value and copy it back into the nsRuleData.

nsRuleNode::ResolveVariableReferences returns whether any variables
were attempted to be resolved, so that nsRuleNode::WalkRuleTree wil
recompute the rule detail in case any became 'inherit'.
2013-12-12 13:09:44 +11:00
Cameron McCormack
589b3b4774 Bug 773296 - Part 8: Resolve and compute CSS variables. r=dbaron
We add a new class CSSVariableResolver whose job is to take the
inherited computed variables and the specified variable declarations and
to perform cycle removal and resolution of the variables, storing the
result in the CSSVariableValues object on an nsStyleVariables.  We use
CSSVariableResolver in nsRuleNode::ComputeVariablesData.

The variable resolver does this:

  1. Asks the CSSVariableValues and CSSVariableDeclarations objects
     to add their variables to it.
  2. Calls in to a new nsCSSParser function
     EnumerateVariableReferences that informs the resolver which
     other variables a given variable references, and by doing so,
     builds a graph of variable dependencies.
  3. Removes variables involved in cyclic references using Tarjan's
     strongly connected component algorithm, setting those variables
     to have an invalid value.
  4. Calls in to a new nsCSSParser function ResolveVariableValue
     to resolve the remaining valid variables by substituting variable
     references.

We extend nsCSSParser::ParseValueWithVariables to take a callback
function to be invoked when encountering a variable reference.  This
lets EnumerateVariableReferences re-use ParseValueWithVariables.

CSSParserImpl::ResolveValueWithVariableReferences needs different
error handling behaviour from ParseValueWithVariables, so we don't
re-use it.

CSSParserImpl::AppendImpliedEOFCharacters is used to take the
value returned from nsCSSScanner::GetImpliedEOFCharacters while
resolving variable references that were declared using custom
properties that encountered EOF before being closed properly.

The SeparatorRequiredBetweenTokens helper function in nsCSSParser.cpp
implements the serialization rules in CSS Syntax Module Level 3:

https://dvcs.w3.org/hg/csswg/raw-file/3479cdefc59a/css-syntax/Overview.html#serialization
2013-12-12 13:09:41 +11:00
Ms2ger
bf0853793a Bug 923251 - Part a: Make ParseMediaList return void; r=heycam 2013-11-11 08:57:34 +01:00
Joshua Cranmer
c7aade5e1f Bug 856108 - Port static analyses to clang, part 2e: use MOZ_STACK_CLASS in layout. r=mats 2013-04-11 22:20:45 -05:00
David Zbarsky
2c3499b66c [Bug 847110] Fix up includes in layout/style r=dbaron 2013-03-02 19:31:48 -05:00
L. David Baron
f8ff60d603 Bug 765599: Make CSS insertRule methods throw SYNTAX_ERR when given an empty rule or more than one rule. r=bzbarsky
This implements the proposed spec clarification in
http://lists.w3.org/Archives/Public/www-style/2013Feb/0229.html which
makes us compatible with WebKit on the insertRule tests in this patch.

I confirmed that the test reports 7 failures without the patch, but
passes with the patch.  (I'm a little disturbed by the way our
testharness.js integration elides runs of successive passes.)
2013-02-09 22:56:49 -08:00
Cameron McCormack
6183878252 Bug 779917 - Implement CSS.supports(). r=dbaron f=bz 2012-11-25 11:26:07 +11:00
Zack Weinberg
faabfb1d5b Bug 516091: Split CSS error reporting to its own file and class. Allows CSS scanner to become a stack object. r=dbaron 2012-11-15 11:36:15 -05:00
Ehsan Akhgari
0fd9123eac Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
This patch was generated by a script.  Here's the source of the script for
future reference:

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name nsXPCOMCID.h \
       ! -name prtypes.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert PRInt8 int8_t
convert PRUint8 uint8_t
convert PRInt16 int16_t
convert PRUint16 uint16_t
convert PRInt32 int32_t
convert PRUint32 uint32_t
convert PRInt64 int64_t
convert PRUint64 uint64_t

convert PRIntn int
convert PRUintn unsigned

convert PRSize size_t

convert PROffset32 int32_t
convert PROffset64 int64_t

convert PRPtrdiff ptrdiff_t

convert PRFloat64 double
2012-08-22 11:56:38 -04:00
Aryeh Gregor
e806eeab4f Bug 777292 part 2 - Change all nsnull to nullptr 2012-07-30 17:20:58 +03:00
Ms2ger
19f060907a Bug 629882 - Support currentColor in the 2D canvas context; r=dbaron
This changes nsCSSParser::ParseColorString to fill in an nsCSSValue instead
of an nscolor, and exposes nsRuleNode::ComputeColor to turn this nsCSSValue
into an nscolor.

Because gradients can be used with different canvas elements in different
documents, these cannot pass useful values for nsRuleNode::ComputeColor's
aPresContext and aStyleContext arguments. This patch also changes SetColor
to deal with those parameters being null.
2012-06-06 09:36:38 +02:00
Gervase Markham
ca171eec44 Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
Jeff Walden
841701c767 Bug 711647 - Add MOZ_DELETE to a bunch of deliberately-not-implemented methods across the tree. r=dbaron
--HG--
extra : rebase_source : 507006c0f099da6851b585d2062267d285978ad7
2011-12-16 14:42:07 -05:00
Mark Banner
cbd25443a2 Bug 693949 - Drop nsCStringArray. r=bsmedberg 2011-10-28 08:35:45 +01:00
Zack Weinberg
572b6a6160 Bug 659963: consistently use infallible malloc in the CSS parser. r=dbaron 2011-05-28 15:38:48 -07:00
Michael Wu
d8e503c38b Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
--HG--
rename : tools/trace-malloc/bloatblame.c => tools/trace-malloc/bloatblame.cpp
2011-09-28 23:19:26 -07:00
Matheus Kerschbaum ext:(%2C%20L.%20David%20Baron%20%3Cdbaron%40dbaron.org%3E)
6469811981 Bug 664924 - Remove MOZ_CSS_ANIMATIONS ifdefs. r=dbaron 2011-06-20 16:47:09 -07:00
Ed Morley
9e71e5b9ac Bug 614515 - Remove MOZ_SVG conditions. r=roc 2011-05-30 09:34:50 +02:00
Zack Weinberg
fc18422932 Bug 541496 part 6: remove no-longer-used stream-processing code from css::Loader and nsCSSParser. r=bzbarsky 2011-05-18 21:22:59 -04:00
Zack Weinberg
4528c43578 Bug 541496 part 1: add an overload of nsCSSParser::Parse() that takes a string rather than a stream; rename both methods ParseSheet(); change calling convention of the older overload for the templated implementation's sake. r=bzbarsky 2011-05-18 21:22:59 -04:00
Craig Topper
cc15a2a6e3 Bug 648925 - Part 1: Change uses of nsICSSRule to css::Rule. r=bzbarsky 2011-04-07 18:23:46 -07:00
L. David Baron
25d74a36a4 Remove null-checks of nsCSSParser, since construction is infallible. (Bug 542058, patch 1) r=bzbarsky
Note that many callers already skipped the null-checks.
2011-04-21 20:17:31 -07:00
L. David Baron
7e86462271 ifdef CSS animations so that the feature can be backed out by flipping the switches in configure.in and then reverting the changes to the following four files appropriately: nsIDOMCSS2Properties.idl, nsIDOMCSSRule.idl, property_database.js, test_transitions_computed_values.html. (Bug 435442, patch 15) r=bzbarsky 2011-04-11 23:18:44 -07:00
L. David Baron
f80131c3b4 Implement parsing and storage of @keyframes rule. (Bug 435442, patch 5) r=bzbarsky 2011-04-11 23:18:43 -07:00