Commit Graph

57 Commits

Author SHA1 Message Date
Ehsan Akhgari
3bb4f6f867 Bug 1048246 - Fix more bad implicit constructors in layout; r=roc
--HG--
extra : rebase_source : ed828993139bc70232508364a9f046e38b7d3e06
2014-08-07 19:48:38 -04:00
Alexandros Chronopoulos
7532ad60f8 Bug 751939 - make url( followed by EOF valid. r=dbaron 2014-07-23 00:14:16 +03:00
Simon Sapin
7d52218be2 Bug 976787 part 2: Add the grid-template-areas property to the style system. r=dholbert 2014-03-10 15:54:14 -07:00
Ehsan Akhgari
eaa7491d77 Bug 927728 - Part 1: Replace PRUnichar with char16_t; r=roc
This patch was automatically generated by the following script:

#!/bin/bash
# Command to convert PRUnichar to char16_t

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*modules/libmar*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name prtypes.h \
       ! -name Char16.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 PRUnichar char16_t
2014-01-04 10:02:17 -05:00
Cameron McCormack
4fd40c24b6 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
14c9ae88db Bug 773296 - Part 11: Give nsCSSParser and nsCSSScanner the ability to save/restore their current input state. r=dbaron
This adds functions to nsCSSParser and nsCSSScanner that let us save the
current input position (and corresponding information like line/column
number) and parser pushback, and be able to restore it later.  We'll use
this when rewinding the scanner after we first encounter a property with
a variable reference and go back to reparse it as a token stream.
2013-12-12 13:09:42 +11:00
Cameron McCormack
6c08a4ff75 Bug 773296 - Part 9: Give nsCSSScanner the ability to remember when it encounters a "var(" token. r=dbaron
This is the first part of handling variable references in regular
properties.  We have the scanner set a flag whenever it returns a "var("
token, so that when we come to the end of parsing a property that
failed, we know that it is because of a variable reference.
2013-12-12 13:09:42 +11:00
Cameron McCormack
4fb5922824 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
Cameron McCormack
79ae140eaf Bug 773296 - Part 6: Add enum to represent types of CSS tokens involved in serialization. r=dbaron
This adds an enum to nsCSSScanner.h that represents the types of tokens
we need to consider when pasting together two adjacent tokens during
serialization or variable resolution.  For example with:

  var-a:orange;
  var-b:red;
  color:var(a)var(b);

we need to generate the string "orange/**/red" to parse for the value of
'color'.
2013-12-12 13:09:41 +11:00
Cameron McCormack
42f0f46be2 Bug 914072 - Have nsCSSScanner store any implied characters at EOF needed for correct serialization. r=dbaron 2013-12-07 12:25:07 +11:00
Corey Ford
fbf08070fa Bug 883987 - Don't allow BAD_STRING or BAD_URL tokens in @supports conditions. r=dbaron 2013-06-27 17:03:33 -07:00
Joshua Cranmer
c763b1352e 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
Zack Weinberg
b78db0f4d6 Bug 543151, part A4: unify the inner text-scanning loops used by GatherIdent, ScanString, NextURL. r=heycam 2013-02-16 18:27:53 -05:00
Zack Weinberg
0fbb550fc0 Bug 543151, part A3: convert the scanner to use peek/advance. r=heycam 2013-02-16 18:27:53 -05:00
Zack Weinberg
57e2a60ca6 Bug 543151, part A2: Introduce the new peek/advance API and reimplement the old read/pushback API on top of it. r=heycam 2013-02-16 18:27:53 -05:00
Zack Weinberg
575de8ae8c Bug 543151, part A1: Preliminary cleanups to the scanner/parser interface and the organization of nsCSSScanner.cpp. r=heycam 2013-02-16 18:27:53 -05:00
Zack Weinberg
02d54c729f Bug 413958: report the text of the offending line in CSS error messages. r=dbaron 2013-01-11 12:27:43 -05:00
Zack Weinberg
974d69cf27 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
Seth Fowler
ed479625af Bug 786108 - Cache UTF-16 version of URI to prevent repeated conversions in the CSS scanner, and free the cache after a short time. r=bz 2012-10-03 15:28:57 -07:00
Ed Morley
9bd985c476 Backout ec0dcd401a3f (bug 786108) for crashes 2012-09-28 22:04:56 +01:00
Seth Fowler
e97e0bcb99 Bug 786108 - Cache UTF-16 version of URI to prevent repeated conversions in the CSS scanner, and free the cache after a short time. r=bz 2012-09-28 09:56:47 -07:00
Mats Palmgren
b602620a6a Bug 788836 - Simplify @-keyword parsing by letting ParseAtKeyword deal with everthing after the @. Make it pass the first char to GatherIdent so that it returns false for a bad escape sequence at the start. r=dbaron 2012-09-12 00:20:52 +02:00
Ehsan Akhgari
8c296bbcd4 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
Cameron McCormack
78727e2c15 Bug 649740 - Implement @supports. r=dbaron,bz 2012-08-02 10:32:12 +10:00
Gervase Markham
87620f5676 Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
Jacob Holzinger
86f648606c Bug 696242 - Convert NS_RegisterStaticAtoms and nsCSSScanner::ReportUnexpectedParams to take an array-reference rather than a pointer and length, making it impossible to pass a pointer/length that are inconsistent. r=jwalden
--HG--
extra : rebase_source : 882b5b4d500b1fa242c0a3cfa3084e4171cbaa9d
2012-03-08 18:22:57 -08:00
Jesse Ruderman
d2371a1d0e Bug 675553 followup: remove tautologous assertions. r=ehsan 2011-10-24 16:21:09 -07:00
Zack Weinberg
7ef69cf55a Bug 659963: consistently use infallible malloc in the CSS parser. r=dbaron 2011-05-28 15:38:48 -07:00
Zack Weinberg
6f73ba4b1a Bug 543151 part 1: Remove stream-processing code from nsCSSScanner.cpp. r=dbaron 2011-05-18 10:33:16 -07:00
Ehsan Akhgari
2a602a5685 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Landing on a CLOSED TREE
2011-10-17 10:59:28 -04: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
Mihai Sucan
726b8bb058 Bug 670896 - Add inner window ID and timestamp to nsIScriptError2; r=bzbarsky 2011-08-24 23:44:35 +03:00
L. David Baron
2887557e92 Allow ParseAndAppendEscape to fail when the stream does not contain an escape, and make callers handle this failure appropriately. This changes our behavior when backslash immediately precedes end-of-stream. (Bug 384672, patch 3) r=bzbarsky 2011-05-03 13:19:19 -07:00
L. David Baron
0099793035 Pass whether we're in a string to ParseAndAppendEscape. (Bug 384672, patch 1) r=bzbarsky
This passes true for string tokens and for url() tokens containing
string, since that is what CSS 2.1 chapter 4's tokenization suggests.
2011-05-03 13:19:18 -07:00
L. David Baron
62b1274403 Include the close parenthesis in the URL token and make quoted URLs produce URL tokens rather than string tokens. (Bug 604179, patch 6) r=bzbarsky 2011-03-11 11:29:45 -06:00
L. David Baron
0041c7ae2e Move the consumption of beginning whitespace (for all forms) and ending whitespace (for the string form) inside url() into the tokenizer. (Bug 604179, patch 3) r=bzbarsky 2011-03-11 11:29:44 -06:00
L. David Baron
866f3aece4 Rename CSS tokens to be closer to the names of newly-added tokens (BAD_STRING, BAD_URI) in the CSS 2.1 tokenization. (Bug 604179, patch 2) r=bzbarsky 2011-03-11 11:29:44 -06:00
Mihai Sucan
215e61a4b2 Bug 606498 - Make sure the new nsIScriptError2 is used in all possible places- part 3; r=bzbarsky,dbaron,mrbkap sr=jst a=blocking2.0 2010-12-20 12:21:59 -04:00
Robert Longson
d796beb26c Bug 489871 - CSS comments should not be allowed in presentation attribute values. r=dbaron a=roc
--HG--
extra : rebase_source : 7a41fca1422a024934839ebe0c50cc479223915f
2010-12-05 20:37:39 +00:00
Zack Weinberg
8a88b3f08f Eliminate NS_HIDDEN and NS_HIDDEN_ from layout/style/. Search-and-replace plus formatting fixes. rs=bzbarsky, no bug. 2010-04-06 14:52:17 -07:00
L. David Baron
194436e18a Bug 526402: Stop accepting unitless 0 for angles, times, and frequencies. r=zwol 2009-11-04 18:36:18 -08:00
Zack Weinberg
63e2075a2a Bug 443976: Parsing support for the unicode-range: descriptor in @font-face. r=dbaron 2009-08-20 14:52:47 -07:00
Arpad Borsos
5b33bf7a38 Bug 492531 - Optimize some CSS and Reflow classes for memory usage; r+sr=dbaron 2009-05-13 10:26:48 +02:00
Alfred Kayser
5be50b1a31 Bug 483971 - nsCSSScanner: cleanup of EatWhiteSpace and removal of EatNewline. r+sr=dbaron 2009-04-09 08:46:26 +02:00
Boris Zbarsky
1de330b786 Backed out changeset 3c687f3d4ff4 (bug 482971) on suspicion of causing intermittent leak orange. 2009-04-09 11:58:40 -04:00
Alfred Kayser
894d7a59e8 Bug 483971 - nsCSSScanner: cleanup of EatWhiteSpace and removal of EatNewline. r+sr=dbaron 2009-04-09 08:46:26 +02:00
Zack Weinberg
be8953654b bug 452518: move private functions out of nsCSSScanner.h. r+sr=dbaron 2008-09-09 21:38:29 -07:00
Zack Weinberg
f3752b90cb bug 452275: eliminate aErrorCode argument to most nsCSSScanner/nsCSSParserImpl functions. r+sr=dbaron 2008-09-09 21:38:14 -07:00
Benjamin Smedberg
a28cb29d53 Bug 445570 - Mark CSSToken::mIdent heap autostring as we-know-what-we're-doing, r=dbaron 2008-08-27 10:58:50 -04:00
Robert Longson
fc1670f89f bug 302971 - Scientific notation in stroke-width doesnt work r+sr=dbaron 2008-08-12 15:02:22 +01:00