Commit Graph

487 Commits

Author SHA1 Message Date
Emil Sjolander
ca34ff4446 Correctly size cross axis when measuring flex basis 2016-07-08 16:05:21 +01:00
Emil Sjölander
d878091c4b Merge pull request #203 from emilsjolander/at-most-root-js
Add missing js implementation for PR #200
2016-07-08 15:52:19 +01:00
Emil Sjolander
c4fa32cfd3 Add missing js implementation for PR #200 2016-07-08 14:43:30 +01:00
Emil Sjölander
6e05325f08 Merge pull request #200 from emilsjolander/at-most-root
Use AT_MOST measurespec when onyl max dimension is defined
2016-07-04 23:25:04 +01:00
Emil Sjolander
a1f36b53f5 Use AT_MOST measurespec when onyl max dimension is defined 2016-07-02 11:22:57 +01:00
Emil Sjölander
383d8a6b3d Merge pull request #195 from emilsjolander/imrpove-cache-hit
Improve heuristic for cache re-use
2016-06-09 10:55:48 -04:00
Emil Sjolander
7b0c008300 Improve heuristic for cache re-use 2016-06-09 10:33:00 -04:00
Emil Sjölander
45e595e6ae Merge pull request #193 from emilsjolander/stretch-perf
Measure with exact measurement when stretch is defined
2016-06-09 10:21:04 -04:00
Emil Sjolander
2a816bf5a7 Measure with exact measurement when stretch is defined 2016-06-08 14:00:31 -04:00
Emil Sjölander
71eb25d1cc Merge pull request #196 from emilsjolander/styling
Remove whitespace on empty lines etc.
2016-06-03 22:19:53 +01:00
Emil Sjolander
c06752e052 Remove whitespace on empty lines etc. 2016-06-03 22:19:03 +01:00
Emil Sjölander
bd92550d57 Merge pull request #192 from rigdern/rigdern/expose-props
Expose getters and setters for some new properties
2016-06-02 17:20:30 +01:00
Adam Comella
9260363fef Expose getters and setters for some new properties
The properties include overflow and min/max height/width.
2016-06-01 12:56:35 -07:00
Emil Sjölander
9d62cee68b Merge pull request #185 from rigdern/rigdern/spec-conformance
Alter layout engine to conform closer to W3C spec
2016-05-31 11:04:41 +01:00
Adam Comella
16f43dac87 Skip measurement when there's no available vertical space
We already did this optimization when there wasn't any
available horizontal space. Now we're covering the
vertical space case as well.

This optimization assumes that, for a node with a
measure function, if there isn't any available
horizontal or vertical space, then we don't need to
measure the node and can assume that the node is 0x0.
2016-05-25 10:53:15 -07:00
Adam Comella
8177bfe702 Heuristics for skipping calls to the measure function
Introduced heuristics that enable css-layout to avoid
calling measure functions under a number of conditions.
This enables us to save time by skipping unnecessary
measurements.
2016-05-18 13:40:34 -07:00
Adam Comella
8779d942ea Fix positioning of items with min/max width/height
We found a case where a flexible item with a max width that was supposed
to be centered was positioned in the wrong location.

The problem was with our 2 pass approach for sizing flexible items with
a min/max width/height. Items sized in the first pass were being double
counted when calculating the remainingFreeSpace. Specifically, their
sizes were being subtracted from remainingFreeSpace in both the first
and second passes.

I also noticed a second unrelated bug. We weren't correctly calculating
deltaFreeSpace in the first pass. When calculating deltaFreeSpace, we
need to take into account the flex basis like we do in the second pass.
Consequently, in the first pass I changed this:
  deltaFreeSpace -= boundMainSize;

To this:
  deltaFreeSpace -= boundMainSize - childFlexBasis;

The problem there was that we'd end up double counting childFlexBasis
in the remainingFreeSpace.
2016-05-11 00:29:40 -07:00
Adam Comella
f3dd51ab97 Alter layout engine to conform closer to W3C spec
The primary goals of this change are:
  - Better conformance to the W3C flexbox standard (https://www.w3.org/TR/css-flexbox-1/)
    and a clear articulation of the areas where it deviates from the spec.
  - Support for flex-shrink.
  - Conformance with layout effects of "overflow: hidden".

Specifically, here are the limitations of this implementation as compared to the W3C
flexbox standard (this is also documented in Layout.js):
  - Display property is always assumed to be 'flex' except for Text nodes, which
    are assumed to be 'inline-flex'.
  - The 'zIndex' property (or any form of z ordering) is not supported. Nodes are
    stacked in document order.
  - The 'order' property is not supported. The order of flex items is always defined
    by document order.
  - The 'visibility' property is always assumed to be 'visible'. Values of 'collapse'
    and 'hidden' are not supported.
  - The 'wrap' property supports only 'nowrap' (which is the default) or 'wrap'. The
    rarely-used 'wrap-reverse' is not supported.
  - Rather than allowing arbitrary combinations of flexGrow, flexShrink and
    flexBasis, this algorithm supports only the three most common combinations:
      - flex: 0 is equiavlent to flex: 0 0 auto
      - flex: n (where n is a positive value) is equivalent to flex: n 0 0
      - flex: -1 (or any negative value) is equivalent to flex: 0 1 auto
  - Margins cannot be specified as 'auto'. They must be specified in terms of pixel
    values, and the default value is 0.
  - The 'baseline' value is not supported for alignItems and alignSelf properties.
  - Values of width, maxWidth, minWidth, height, maxHeight and minHeight must be
    specified as pixel values, not as percentages.
  - There is no support for calculation of dimensions based on intrinsic aspect ratios
    (e.g. images).
  - There is no support for forced breaks.
  - It does not support vertical inline directions (top-to-bottom or bottom-to-top text).

And here is how the implementation deviates from the standard (this is also documented in
Layout.js):
  - Section 4.5 of the spec indicates that all flex items have a default minimum
    main size. For text blocks, for example, this is the width of the widest word.
    Calculating the minimum width is expensive, so we forego it and assume a default
    minimum main size of 0.
  - Min/Max sizes in the main axis are not honored when resolving flexible lengths.
  - The spec indicates that the default value for 'flexDirection' is 'row', but
    the algorithm below assumes a default of 'column'.
2016-04-26 19:45:58 -07:00
Emil Sjölander
b0d00ad338 Merge pull request #163 from emilsjolander/measuremode
Add support for measure mode
2016-04-06 18:07:37 +01:00
Emil Sjolander
7bd6b2b7dd Add support for measure mode 2016-04-01 11:01:16 +01:00
Pieter De Baets
68e0b0cc58 Merge pull request #182 from javache/skip-layout-correctly
Correct skipLayout condition in Layout.c
2016-03-30 15:22:43 +01:00
Pieter De Baets
5b56be412c Correct skipLayout condition in Layout.c
Fixes #155
2016-03-30 12:11:49 +01:00
Lucas Rocha
3454511947 Merge pull request #178 from javache/node-layout-reset 2016-03-29 11:15:53 +01:00
Pieter De Baets
b157ab4a00 Reset child position/sizes before calculating layout 2016-03-29 11:05:53 +01:00
Lucas Rocha
8d5cdd4e6c Merge pull request #145 from alebo/issue-127 2016-03-01 23:07:14 +00:00
Alex Bogomazov
425345aa8d Redo layout of 'stretch' aligned items for correct positioning of nested
items

Fixes facebook/css-layout#83, facebook/css-layout#100,
facebook/css-layout#127.
2016-02-26 00:43:58 +03:00
Christopher Chedeau
dd8e5cd65d Merge pull request #170 from casandrasilva/patch-1
fixes UMD url
2016-02-05 03:57:39 -08:00
Casandra Silva Zenteno
64704dd708 fixes UMD url 2016-02-04 23:31:16 -08:00
Christopher Chedeau
dc7059d340 Merge pull request #166 from RReverser/patch-1
Add C# to the supported language list
2016-01-13 06:26:40 -08:00
Ingvar Stepanyan
acd295e470 Add C# to the supported language list 2016-01-13 14:15:48 +00:00
Lucas Rocha
5d5630d3c8 Merge pull request #161 from emilsjolander/master 2016-01-07 12:17:49 +00:00
Emil Sjolander
c9094f94d0 Check layout instead of style before setting height and width to whatever is set in layout 2016-01-06 15:07:41 +00:00
Christopher Chedeau
f3b6fb3be0 Merge pull request #159 from CatalystCode/dirty
Need dirty() to be virtual to override in special cases.
2016-01-05 07:19:23 -08:00
Eric Rozell
3d7bc48fa6 Need dirty() to be virtual to override in special cases.
See, for example ReactShadowNode in the ReactAndroid code base, which overrides this virtual.
2016-01-05 08:55:32 -05:00
Lucas Rocha
219bdaed15 Merge pull request #154 from majak/width 2015-12-14 16:28:52 +00:00
Martin Kralik
f2aa5ba604 passing height to the measure function
This diff:
* adds height as another parameter passed to the measure function, computed the same way width is
* adds tests for this extension, which has involved adding a new measure function to all of js, c, java and c# tests
2015-12-14 15:00:13 +00:00
Colin Eberhardt
53769ccbc5 Merge pull request #153 from casandrawith1s/patch-1
'package-all' tense consistency
2015-11-22 14:36:31 +00:00
Casandra Silva
2733ebf1d0 'package-all' tense consistency
Change 'package-all' comment to present tense and unfiform grammar for consistency
2015-11-21 21:51:50 -08:00
Colin Eberhardt
45227c0b9a Merge pull request #151 from pragmatrix/csharp-travis-pr
Configure travis to install mono and run the C# tests from within the…
2015-11-20 09:11:27 +00:00
Armin Sander
e848706911 Configure travis to install mono and run the C# tests from within the Gruntfile 2015-11-19 21:27:58 +01:00
Colin Eberhardt
79d7291906 1.1.1 v1.1.1 2015-11-12 14:32:34 +00:00
Colin Eberhardt
bae4eb1830 Updated distribution build 2015-11-12 14:31:58 +00:00
Colin Eberhardt
609d4ae69d Do not delete release instructions! 2015-11-12 14:26:15 +00:00
Colin Eberhardt
99c3a88df4 Update release process to include a build step!
See #149
2015-11-12 11:52:07 +00:00
Colin Eberhardt
4364c6ebb2 Merge pull request #150 from wpcarro/patch-1
grammatical fix
2015-11-11 07:41:42 +00:00
Colin Eberhardt
73b1e63bd7 1.1.0 v1.1.0 2015-11-11 07:27:17 +00:00
William Carroll
b7856ce26a grammatical fix
also, on line 134, I could be wrong, but be wary of this sentence: "No C implementation of this function is provided in provided..." Perhaps this is a mistake.

thanks for all the awesome code!
2015-11-10 22:46:41 -08:00
Christopher Chedeau
f5eefe51f8 Merge pull request #148 from moneppo/master
Add C usage to documentation.
2015-11-07 08:39:01 -08:00
Michael
aac6694127 Add C usage to documentation.
Fixes #114.
2015-11-07 08:29:12 -08:00
Krzysztof Magiera
6e499300ff Merge pull request #146 from lucasr/style-getters
New style getters and cleanups in CSSNode
2015-10-21 16:42:46 +01:00