Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 1070143002: [Alignment] Single class for holding the alignment data. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased and got back previous setter names. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 StyleSelfAlignmentData StyleBuilderConverter::convertSelfOrDefaultAlignmentData( StyleResolverState&, CSSValue* value)
336 {
337 StyleSelfAlignmentData alignmentData = ComputedStyle::initialSelfAlignment() ;
338 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
339 if (Pair* pairValue = primitiveValue->getPairValue()) {
340 if (pairValue->first()->getValueID() == CSSValueLegacy) {
341 alignmentData.setPositionType(LegacyPosition);
342 alignmentData.setPosition(*pairValue->second());
343 } else {
344 alignmentData.setPosition(*pairValue->first());
345 alignmentData.setOverflow(*pairValue->second());
346 }
347 } else {
348 alignmentData.setPosition(*primitiveValue);
349 }
350 return alignmentData;
351 }
352
353 StyleContentAlignmentData StyleBuilderConverter::convertContentAlignmentData(Sty leResolverState&, CSSValue* value)
354 {
355 StyleContentAlignmentData alignmentData = ComputedStyle::initialContentAlign ment();
356 CSSContentDistributionValue* contentValue = toCSSContentDistributionValue(va lue);
357 if (contentValue->distribution()->getValueID() != CSSValueInvalid)
358 alignmentData.setDistribution(*contentValue->distribution());
359 if (contentValue->position()->getValueID() != CSSValueInvalid)
360 alignmentData.setPosition(*contentValue->position());
361 if (contentValue->overflow()->getValueID() != CSSValueInvalid)
362 alignmentData.setOverflow(*contentValue->overflow());
363 return alignmentData;
364 }
365
334 GridAutoFlow StyleBuilderConverter::convertGridAutoFlow(StyleResolverState&, CSS Value* value) 366 GridAutoFlow StyleBuilderConverter::convertGridAutoFlow(StyleResolverState&, CSS Value* value)
335 { 367 {
336 CSSValueList* list = toCSSValueList(value); 368 CSSValueList* list = toCSSValueList(value);
337 369
338 ASSERT(list->length() >= 1); 370 ASSERT(list->length() >= 1);
339 CSSPrimitiveValue* first = toCSSPrimitiveValue(list->item(0)); 371 CSSPrimitiveValue* first = toCSSPrimitiveValue(list->item(0));
340 CSSPrimitiveValue* second = list->length() == 2 ? toCSSPrimitiveValue(list-> item(1)) : nullptr; 372 CSSPrimitiveValue* second = list->length() == 2 ? toCSSPrimitiveValue(list-> item(1)) : nullptr;
341 373
342 switch (first->getValueID()) { 374 switch (first->getValueID()) {
343 case CSSValueRow: 375 case CSSValueRow:
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 CSSPrimitiveValue* primitiveValueZ = toCSSPrimitiveValue(list->item(2)); 897 CSSPrimitiveValue* primitiveValueZ = toCSSPrimitiveValue(list->item(2));
866 898
867 return TransformOrigin( 899 return TransformOrigin(
868 convertOriginLength<CSSValueLeft, CSSValueRight>(state, primitiveValueX) , 900 convertOriginLength<CSSValueLeft, CSSValueRight>(state, primitiveValueX) ,
869 convertOriginLength<CSSValueTop, CSSValueBottom>(state, primitiveValueY) , 901 convertOriginLength<CSSValueTop, CSSValueBottom>(state, primitiveValueY) ,
870 StyleBuilderConverter::convertComputedLength<float>(state, primitiveValu eZ) 902 StyleBuilderConverter::convertComputedLength<float>(state, primitiveValu eZ)
871 ); 903 );
872 } 904 }
873 905
874 } // namespace blink 906 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.h ('k') | Source/core/css/resolver/StyleBuilderCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698