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

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

Issue 2677033002: Remove BreakAlways from EBreak enum (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 static EBreak mapToPageBreakValue(EBreak genericBreakValue) { 1909 // Returns a suitable value for the page-break-(before|after|inside) property,
1910 switch (genericBreakValue) { 1910 // given the computed value of the more general break-(before|after|inside)
1911 // property.
1912 static CSSValue* valueForPageBreak(EBreak breakValue) {
1913 switch (breakValue) {
1911 case BreakAvoidColumn: 1914 case BreakAvoidColumn:
1912 case BreakColumn: 1915 case BreakColumn:
1913 case BreakRecto: 1916 case BreakRecto:
1914 case BreakVerso: 1917 case BreakVerso:
1915 return BreakAuto; 1918 return CSSIdentifierValue::create(CSSValueAuto);
1916 case BreakPage: 1919 case BreakPage:
1917 return BreakAlways; 1920 return CSSIdentifierValue::create(CSSValueAlways);
1918 case BreakAvoidPage: 1921 case BreakAvoidPage:
1919 return BreakAvoid; 1922 return CSSIdentifierValue::create(CSSValueAvoid);
1920 default: 1923 default:
1921 return genericBreakValue; 1924 return CSSIdentifierValue::create(breakValue);
1922 } 1925 }
1923 } 1926 }
1924 1927
1925 static EBreak mapToColumnBreakValue(EBreak genericBreakValue) { 1928 // Returns a suitable value for the -webkit-column-break-(before|after|inside)
1926 switch (genericBreakValue) { 1929 // property, given the computed value of the more general
1930 // break-(before|after|inside) property.
1931 static CSSValue* valueForWebkitColumnBreak(EBreak breakValue) {
1932 switch (breakValue) {
1927 case BreakAvoidPage: 1933 case BreakAvoidPage:
1928 case BreakLeft: 1934 case BreakLeft:
1929 case BreakPage: 1935 case BreakPage:
1930 case BreakRecto: 1936 case BreakRecto:
1931 case BreakRight: 1937 case BreakRight:
1932 case BreakVerso: 1938 case BreakVerso:
1933 return BreakAuto; 1939 return CSSIdentifierValue::create(CSSValueAuto);
1934 case BreakColumn: 1940 case BreakColumn:
1935 return BreakAlways; 1941 return CSSIdentifierValue::create(CSSValueAlways);
1936 case BreakAvoidColumn: 1942 case BreakAvoidColumn:
1937 return BreakAvoid; 1943 return CSSIdentifierValue::create(CSSValueAvoid);
1938 default: 1944 default:
1939 return genericBreakValue; 1945 return CSSIdentifierValue::create(breakValue);
1940 } 1946 }
1941 } 1947 }
1942 1948
1943 const CSSValue* ComputedStyleCSSValueMapping::get( 1949 const CSSValue* ComputedStyleCSSValueMapping::get(
1944 const AtomicString customPropertyName, 1950 const AtomicString customPropertyName,
1945 const ComputedStyle& style, 1951 const ComputedStyle& style,
1946 const PropertyRegistry* registry) { 1952 const PropertyRegistry* registry) {
1947 if (registry) { 1953 if (registry) {
1948 const PropertyRegistry::Registration* registration = 1954 const PropertyRegistry::Registration* registration =
1949 registry->registration(customPropertyName); 1955 registry->registration(customPropertyName);
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
2230 .rgb()) 2236 .rgb())
2231 : currentColorOrValidColor(style, style.columnRuleColor()); 2237 : currentColorOrValidColor(style, style.columnRuleColor());
2232 case CSSPropertyColumnRuleStyle: 2238 case CSSPropertyColumnRuleStyle:
2233 return CSSIdentifierValue::create(style.columnRuleStyle()); 2239 return CSSIdentifierValue::create(style.columnRuleStyle());
2234 case CSSPropertyColumnRuleWidth: 2240 case CSSPropertyColumnRuleWidth:
2235 return zoomAdjustedPixelValue(style.columnRuleWidth(), style); 2241 return zoomAdjustedPixelValue(style.columnRuleWidth(), style);
2236 case CSSPropertyColumnSpan: 2242 case CSSPropertyColumnSpan:
2237 return CSSIdentifierValue::create(style.getColumnSpan() ? CSSValueAll 2243 return CSSIdentifierValue::create(style.getColumnSpan() ? CSSValueAll
2238 : CSSValueNone); 2244 : CSSValueNone);
2239 case CSSPropertyWebkitColumnBreakAfter: 2245 case CSSPropertyWebkitColumnBreakAfter:
2240 return CSSIdentifierValue::create( 2246 return valueForWebkitColumnBreak(style.breakAfter());
2241 mapToColumnBreakValue(style.breakAfter()));
2242 case CSSPropertyWebkitColumnBreakBefore: 2247 case CSSPropertyWebkitColumnBreakBefore:
2243 return CSSIdentifierValue::create( 2248 return valueForWebkitColumnBreak(style.breakBefore());
2244 mapToColumnBreakValue(style.breakBefore()));
2245 case CSSPropertyWebkitColumnBreakInside: 2249 case CSSPropertyWebkitColumnBreakInside:
2246 return CSSIdentifierValue::create( 2250 return valueForWebkitColumnBreak(style.breakInside());
2247 mapToColumnBreakValue(style.breakInside()));
2248 case CSSPropertyColumnWidth: 2251 case CSSPropertyColumnWidth:
2249 if (style.hasAutoColumnWidth()) 2252 if (style.hasAutoColumnWidth())
2250 return CSSIdentifierValue::create(CSSValueAuto); 2253 return CSSIdentifierValue::create(CSSValueAuto);
2251 return zoomAdjustedPixelValue(style.columnWidth(), style); 2254 return zoomAdjustedPixelValue(style.columnWidth(), style);
2252 case CSSPropertyTabSize: 2255 case CSSPropertyTabSize:
2253 return CSSPrimitiveValue::create( 2256 return CSSPrimitiveValue::create(
2254 style.getTabSize().getPixelSize(1.0), 2257 style.getTabSize().getPixelSize(1.0),
2255 style.getTabSize().isSpaces() ? CSSPrimitiveValue::UnitType::Number 2258 style.getTabSize().isSpaces() ? CSSPrimitiveValue::UnitType::Number
2256 : CSSPrimitiveValue::UnitType::Pixels); 2259 : CSSPrimitiveValue::UnitType::Pixels);
2257 case CSSPropertyTextSizeAdjust: 2260 case CSSPropertyTextSizeAdjust:
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
2653 return zoomAdjustedPixelValue( 2656 return zoomAdjustedPixelValue(
2654 toLayoutBox(layoutObject)->computedCSSPaddingLeft(), style); 2657 toLayoutBox(layoutObject)->computedCSSPaddingLeft(), style);
2655 } 2658 }
2656 case CSSPropertyBreakAfter: 2659 case CSSPropertyBreakAfter:
2657 return CSSIdentifierValue::create(style.breakAfter()); 2660 return CSSIdentifierValue::create(style.breakAfter());
2658 case CSSPropertyBreakBefore: 2661 case CSSPropertyBreakBefore:
2659 return CSSIdentifierValue::create(style.breakBefore()); 2662 return CSSIdentifierValue::create(style.breakBefore());
2660 case CSSPropertyBreakInside: 2663 case CSSPropertyBreakInside:
2661 return CSSIdentifierValue::create(style.breakInside()); 2664 return CSSIdentifierValue::create(style.breakInside());
2662 case CSSPropertyPageBreakAfter: 2665 case CSSPropertyPageBreakAfter:
2663 return CSSIdentifierValue::create( 2666 return valueForPageBreak(style.breakAfter());
2664 mapToPageBreakValue(style.breakAfter()));
2665 case CSSPropertyPageBreakBefore: 2667 case CSSPropertyPageBreakBefore:
2666 return CSSIdentifierValue::create( 2668 return valueForPageBreak(style.breakBefore());
2667 mapToPageBreakValue(style.breakBefore()));
2668 case CSSPropertyPageBreakInside: 2669 case CSSPropertyPageBreakInside:
2669 return CSSIdentifierValue::create( 2670 return valueForPageBreak(style.breakInside());
2670 mapToPageBreakValue(style.breakInside()));
2671 case CSSPropertyPosition: 2671 case CSSPropertyPosition:
2672 return CSSIdentifierValue::create(style.position()); 2672 return CSSIdentifierValue::create(style.position());
2673 case CSSPropertyQuotes: 2673 case CSSPropertyQuotes:
2674 if (!style.quotes()) { 2674 if (!style.quotes()) {
2675 // TODO(ramya.v): We should return the quote values that we're actually 2675 // TODO(ramya.v): We should return the quote values that we're actually
2676 // using. 2676 // using.
2677 return nullptr; 2677 return nullptr;
2678 } 2678 }
2679 if (style.quotes()->size()) { 2679 if (style.quotes()->size()) {
2680 CSSValueList* list = CSSValueList::createSpaceSeparated(); 2680 CSSValueList* list = CSSValueList::createSpaceSeparated();
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
3641 case CSSPropertyAll: 3641 case CSSPropertyAll:
3642 return nullptr; 3642 return nullptr;
3643 default: 3643 default:
3644 break; 3644 break;
3645 } 3645 }
3646 ASSERT_NOT_REACHED(); 3646 ASSERT_NOT_REACHED();
3647 return nullptr; 3647 return nullptr;
3648 } 3648 }
3649 3649
3650 } // namespace blink 3650 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h ('k') | third_party/WebKit/Source/core/style/ComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698