OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * * Redistributions of source code must retain the above copyright | 4 * * Redistributions of source code must retain the above copyright |
5 * notice, this list of conditions and the following disclaimer. | 5 * notice, this list of conditions and the following disclaimer. |
6 * * Redistributions in binary form must reproduce the above | 6 * * Redistributions in binary form must reproduce the above |
7 * copyright notice, this list of conditions and the following disclaimer | 7 * copyright notice, this list of conditions and the following disclaimer |
8 * in the documentation and/or other materials provided with the | 8 * in the documentation and/or other materials provided with the |
9 * distribution. | 9 * distribution. |
10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
(...skipping 10 matching lines...) Expand all Loading... | |
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "core/css/resolver/StyleBuilderConverter.h" | 28 #include "core/css/resolver/StyleBuilderConverter.h" |
29 | 29 |
30 #include "core/css/BasicShapeFunctions.h" | 30 #include "core/css/BasicShapeFunctions.h" |
31 #include "core/css/CSSContentDistributionValue.h" | |
31 #include "core/css/CSSFontFeatureValue.h" | 32 #include "core/css/CSSFontFeatureValue.h" |
32 #include "core/css/CSSFunctionValue.h" | 33 #include "core/css/CSSFunctionValue.h" |
33 #include "core/css/CSSGridLineNamesValue.h" | 34 #include "core/css/CSSGridLineNamesValue.h" |
34 #include "core/css/CSSPrimitiveValueMappings.h" | 35 #include "core/css/CSSPrimitiveValueMappings.h" |
35 #include "core/css/CSSReflectValue.h" | 36 #include "core/css/CSSReflectValue.h" |
36 #include "core/css/CSSShadowValue.h" | 37 #include "core/css/CSSShadowValue.h" |
37 #include "core/css/Pair.h" | 38 #include "core/css/Pair.h" |
38 #include "core/css/Rect.h" | 39 #include "core/css/Rect.h" |
39 #include "core/svg/SVGElement.h" | 40 #include "core/svg/SVGElement.h" |
40 #include "core/svg/SVGURIReference.h" | 41 #include "core/svg/SVGURIReference.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
324 | 325 |
325 if (angle <= 45.0f || angle > 315.0f) | 326 if (angle <= 45.0f || angle > 315.0f) |
326 return GO_0DEG; | 327 return GO_0DEG; |
327 if (angle > 45.0f && angle <= 135.0f) | 328 if (angle > 45.0f && angle <= 135.0f) |
328 return GO_90DEG; | 329 return GO_90DEG; |
329 if (angle > 135.0f && angle <= 225.0f) | 330 if (angle > 135.0f && angle <= 225.0f) |
330 return GO_180DEG; | 331 return GO_180DEG; |
331 return GO_270DEG; | 332 return GO_270DEG; |
332 } | 333 } |
333 | 334 |
335 StyleAlignmentData StyleBuilderConverter::convertSelfAlignmentData(StyleResolver State&, CSSValue* value) | |
336 { | |
337 ItemPosition position = ItemPositionAuto; | |
338 OverflowAlignment overflow = OverflowAlignmentDefault; | |
339 ItemPositionType positionType = NonLegacyPosition; | |
Julien - ping for review
2015/04/13 14:46:20
This is subtly duplicating the logic from the init
jfernandez
2015/04/14 00:18:42
Done.
| |
340 | |
341 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | |
342 if (Pair* pairValue = primitiveValue->getPairValue()) { | |
343 if (pairValue->first()->getValueID() == CSSValueLegacy) { | |
344 positionType = LegacyPosition; | |
345 position = *pairValue->second(); | |
346 } else { | |
347 position = *pairValue->first(); | |
348 overflow = *pairValue->second(); | |
349 } | |
350 } else { | |
351 position = *primitiveValue; | |
352 } | |
353 | |
354 return StyleAlignmentData(position, overflow, positionType); | |
355 } | |
356 | |
357 StyleAlignmentData StyleBuilderConverter::convertContentAlignmentData(StyleResol verState&, CSSValue* value) | |
358 { | |
359 ContentPosition position = ContentPositionAuto; | |
360 ContentDistributionType distribution = ContentDistributionDefault; | |
361 OverflowAlignment overflow = OverflowAlignmentDefault; | |
Julien - ping for review
2015/04/13 14:46:20
Same comment.
jfernandez
2015/04/14 00:18:42
Done.
| |
362 | |
363 CSSContentDistributionValue* contentValue = toCSSContentDistributionValue(va lue); | |
364 if (contentValue->distribution()->getValueID() != CSSValueInvalid) | |
365 distribution = *contentValue->distribution(); | |
366 if (contentValue->position()->getValueID() != CSSValueInvalid) | |
367 position = *contentValue->position(); | |
368 if (contentValue->overflow()->getValueID() != CSSValueInvalid) | |
369 overflow = *contentValue->overflow(); | |
370 | |
371 return StyleAlignmentData(position, distribution, overflow); | |
372 } | |
373 | |
334 GridAutoFlow StyleBuilderConverter::convertGridAutoFlow(StyleResolverState&, CSS Value* value) | 374 GridAutoFlow StyleBuilderConverter::convertGridAutoFlow(StyleResolverState&, CSS Value* value) |
335 { | 375 { |
336 CSSValueList* list = toCSSValueList(value); | 376 CSSValueList* list = toCSSValueList(value); |
337 | 377 |
338 ASSERT(list->length() >= 1); | 378 ASSERT(list->length() >= 1); |
339 CSSPrimitiveValue* first = toCSSPrimitiveValue(list->item(0)); | 379 CSSPrimitiveValue* first = toCSSPrimitiveValue(list->item(0)); |
340 CSSPrimitiveValue* second = list->length() == 2 ? toCSSPrimitiveValue(list-> item(1)) : nullptr; | 380 CSSPrimitiveValue* second = list->length() == 2 ? toCSSPrimitiveValue(list-> item(1)) : nullptr; |
341 | 381 |
342 switch (first->getValueID()) { | 382 switch (first->getValueID()) { |
343 case CSSValueRow: | 383 case CSSValueRow: |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
872 CSSPrimitiveValue* primitiveValueZ = toCSSPrimitiveValue(list->item(2)); | 912 CSSPrimitiveValue* primitiveValueZ = toCSSPrimitiveValue(list->item(2)); |
873 | 913 |
874 return TransformOrigin( | 914 return TransformOrigin( |
875 convertOriginLength<CSSValueLeft, CSSValueRight>(state, primitiveValueX) , | 915 convertOriginLength<CSSValueLeft, CSSValueRight>(state, primitiveValueX) , |
876 convertOriginLength<CSSValueTop, CSSValueBottom>(state, primitiveValueY) , | 916 convertOriginLength<CSSValueTop, CSSValueBottom>(state, primitiveValueY) , |
877 StyleBuilderConverter::convertComputedLength<float>(state, primitiveValu eZ) | 917 StyleBuilderConverter::convertComputedLength<float>(state, primitiveValu eZ) |
878 ); | 918 ); |
879 } | 919 } |
880 | 920 |
881 } // namespace blink | 921 } // namespace blink |
OLD | NEW |