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

Side by Side Diff: third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp

Issue 2682573002: Split EBreak enum into EBreakBetween & EBreakInside (Closed)
Patch Set: Created 3 years, 10 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) 2004 Zack Rusin <zack@kde.org> 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 5 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
7 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 7 * Copyright (C) 2011 Sencha, Inc. All rights reserved.
8 * Copyright (C) 2015 Google Inc. All rights reserved. 8 * Copyright (C) 2015 Google Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 for (auto& coordinate : coordinates) { 1899 for (auto& coordinate : coordinates) {
1900 auto pair = CSSValueList::createSpaceSeparated(); 1900 auto pair = CSSValueList::createSpaceSeparated();
1901 pair->append(*zoomAdjustedPixelValueForLength(coordinate.x(), style)); 1901 pair->append(*zoomAdjustedPixelValueForLength(coordinate.x(), style));
1902 pair->append(*zoomAdjustedPixelValueForLength(coordinate.y(), style)); 1902 pair->append(*zoomAdjustedPixelValueForLength(coordinate.y(), style));
1903 list->append(*pair); 1903 list->append(*pair);
1904 } 1904 }
1905 1905
1906 return list; 1906 return list;
1907 } 1907 }
1908 1908
1909 // Returns a suitable value for the page-break-(before|after|inside) property, 1909 // Returns a suitable value for the page-break-(before|after) property, given
1910 // given the computed value of the more general break-(before|after|inside) 1910 // the computed value of the more general break-(before|after) property.
1911 // property. 1911 static CSSValue* valueForPageBreak(EBreakBetween breakValue) {
1912 static CSSValue* valueForPageBreak(EBreak breakValue) {
1913 switch (breakValue) { 1912 switch (breakValue) {
1914 case BreakAvoidColumn: 1913 case EBreakBetween::kAvoidColumn:
1915 case BreakColumn: 1914 case EBreakBetween::kColumn:
1916 case BreakRecto: 1915 case EBreakBetween::kRecto:
1917 case BreakVerso: 1916 case EBreakBetween::kVerso:
1918 return CSSIdentifierValue::create(CSSValueAuto); 1917 return CSSIdentifierValue::create(CSSValueAuto);
1919 case BreakPage: 1918 case EBreakBetween::kPage:
1920 return CSSIdentifierValue::create(CSSValueAlways); 1919 return CSSIdentifierValue::create(CSSValueAlways);
1921 case BreakAvoidPage: 1920 case EBreakBetween::kAvoidPage:
1922 return CSSIdentifierValue::create(CSSValueAvoid); 1921 return CSSIdentifierValue::create(CSSValueAvoid);
1923 default: 1922 default:
1924 return CSSIdentifierValue::create(breakValue); 1923 return CSSIdentifierValue::create(breakValue);
1925 } 1924 }
1926 } 1925 }
1927 1926
1928 // Returns a suitable value for the -webkit-column-break-(before|after|inside) 1927 // Returns a suitable value for the -webkit-column-break-(before|after)
1929 // property, given the computed value of the more general 1928 // property, given the computed value of the more general break-(before|after)
1930 // break-(before|after|inside) property. 1929 // property.
1931 static CSSValue* valueForWebkitColumnBreak(EBreak breakValue) { 1930 static CSSValue* valueForWebkitColumnBreak(EBreakBetween breakValue) {
1932 switch (breakValue) { 1931 switch (breakValue) {
1933 case BreakAvoidPage: 1932 case EBreakBetween::kAvoidPage:
1934 case BreakLeft: 1933 case EBreakBetween::kLeft:
1935 case BreakPage: 1934 case EBreakBetween::kPage:
1936 case BreakRecto: 1935 case EBreakBetween::kRecto:
1937 case BreakRight: 1936 case EBreakBetween::kRight:
1938 case BreakVerso: 1937 case EBreakBetween::kVerso:
1939 return CSSIdentifierValue::create(CSSValueAuto); 1938 return CSSIdentifierValue::create(CSSValueAuto);
1940 case BreakColumn: 1939 case EBreakBetween::kColumn:
1941 return CSSIdentifierValue::create(CSSValueAlways); 1940 return CSSIdentifierValue::create(CSSValueAlways);
1942 case BreakAvoidColumn: 1941 case EBreakBetween::kAvoidColumn:
1943 return CSSIdentifierValue::create(CSSValueAvoid); 1942 return CSSIdentifierValue::create(CSSValueAvoid);
1944 default: 1943 default:
1945 return CSSIdentifierValue::create(breakValue); 1944 return CSSIdentifierValue::create(breakValue);
1945 }
1946 }
1947
1948 // Returns a suitable value for the page-break-inside property, given the
1949 // computed value of the more general break-inside property.
1950 static CSSValue* valueForPageBreak(EBreakInside breakValue) {
1951 switch (breakValue) {
1952 case EBreakInside::kAvoidColumn:
1953 return CSSIdentifierValue::create(CSSValueAuto);
1954 case EBreakInside::kAvoidPage:
1955 return CSSIdentifierValue::create(CSSValueAvoid);
1956 default:
1957 return CSSIdentifierValue::create(breakValue);
1958 }
1959 }
1960
1961 // Returns a suitable value for the -webkit-column-break-inside property, given
1962 // the computed value of the more general break-inside property.
1963 static CSSValue* valueForWebkitColumnBreak(EBreakInside breakValue) {
1964 switch (breakValue) {
1965 case EBreakInside::kAvoidPage:
1966 return CSSIdentifierValue::create(CSSValueAuto);
1967 case EBreakInside::kAvoidColumn:
1968 return CSSIdentifierValue::create(CSSValueAvoid);
1969 default:
1970 return CSSIdentifierValue::create(breakValue);
1946 } 1971 }
1947 } 1972 }
1948 1973
1949 const CSSValue* ComputedStyleCSSValueMapping::get( 1974 const CSSValue* ComputedStyleCSSValueMapping::get(
1950 const AtomicString customPropertyName, 1975 const AtomicString customPropertyName,
1951 const ComputedStyle& style, 1976 const ComputedStyle& style,
1952 const PropertyRegistry* registry) { 1977 const PropertyRegistry* registry) {
1953 if (registry) { 1978 if (registry) {
1954 const PropertyRegistry::Registration* registration = 1979 const PropertyRegistry::Registration* registration =
1955 registry->registration(customPropertyName); 1980 registry->registration(customPropertyName);
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after
3641 case CSSPropertyAll: 3666 case CSSPropertyAll:
3642 return nullptr; 3667 return nullptr;
3643 default: 3668 default:
3644 break; 3669 break;
3645 } 3670 }
3646 ASSERT_NOT_REACHED(); 3671 ASSERT_NOT_REACHED();
3647 return nullptr; 3672 return nullptr;
3648 } 3673 }
3649 3674
3650 } // namespace blink 3675 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698