Changeset 100656 in webkit
- Timestamp:
- Nov 17, 2011 12:09:34 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r100652 r100656 1 2011-11-17 Fady Samuel <fsamuel@chromium.org> 2 3 Pass Aspect Ratio to RenderStyle 4 https://bugs.webkit.org/show_bug.cgi?id=72350 5 6 Reviewed by Ojan Vafai. 7 8 * css/CSSComputedStyleDeclaration.cpp: 9 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): 10 * css/CSSStyleApplyProperty.cpp: 11 (WebCore::ApplyPropertyAspectRatio::applyInheritValue): 12 (WebCore::ApplyPropertyAspectRatio::applyInitialValue): 13 (WebCore::ApplyPropertyAspectRatio::applyValue): 14 (WebCore::ApplyPropertyAspectRatio::createHandler): 15 (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty): 16 * css/CSSStyleSelector.cpp: 17 (WebCore::CSSStyleSelector::applyProperty): 18 * css/CSSValue.h: 19 (WebCore::CSSValue::isAspectRatioValue): 20 * rendering/style/RenderStyle.h: 21 (WebCore::InheritedFlags::hasAspectRatio): 22 (WebCore::InheritedFlags::aspectRatio): 23 (WebCore::InheritedFlags::aspectRatioDenominator): 24 (WebCore::InheritedFlags::aspectRatioNumerator): 25 (WebCore::InheritedFlags::setHasAspectRatio): 26 (WebCore::InheritedFlags::setAspectRatioDenominator): 27 (WebCore::InheritedFlags::setAspectRatioNumerator): 28 (WebCore::InheritedFlags::initialHasAspectRatio): 29 (WebCore::InheritedFlags::initialAspectRatioDenominator): 30 (WebCore::InheritedFlags::initialAspectRatioNumerator): 31 * rendering/style/StyleRareNonInheritedData.cpp: 32 (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): 33 (WebCore::StyleRareNonInheritedData::operator==): 34 * rendering/style/StyleRareNonInheritedData.h: 35 1 36 2011-11-09 Robert Hogan <robert@webkit.org> 2 37 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r100604 r100656 1877 1877 case CSSPropertyWebkitAppearance: 1878 1878 return primitiveValueCache->createValue(style->appearance()); 1879 case CSSPropertyWebkitAspectRatio: 1880 if (!style->hasAspectRatio()) 1881 return primitiveValueCache->createIdentifierValue(CSSValueNone); 1882 return primitiveValueCache->createValue(style->aspectRatio(), CSSPrimitiveValue::CSS_NUMBER); 1879 1883 case CSSPropertyWebkitBackfaceVisibility: 1880 1884 return primitiveValueCache->createIdentifierValue((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible); … … 2071 2075 2072 2076 /* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */ 2073 case CSSPropertyWebkitAspectRatio:2074 2077 case CSSPropertyWebkitTextEmphasis: 2075 2078 case CSSPropertyTextLineThrough: -
trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp
r100604 r100656 26 26 #include "CSSStyleApplyProperty.h" 27 27 28 #include "CSSAspectRatioValue.h" 28 29 #include "CSSCursorImageValue.h" 29 30 #include "CSSFlexValue.h" … … 832 833 }; 833 834 835 class ApplyPropertyAspectRatio { 836 public: 837 static void applyInheritValue(CSSStyleSelector* selector) 838 { 839 if (!selector->parentStyle()->hasAspectRatio()) 840 return; 841 selector->style()->setAspectRatioDenominator(selector->parentStyle()->aspectRatioDenominator()); 842 selector->style()->setAspectRatioNumerator(selector->parentStyle()->aspectRatioNumerator()); 843 } 844 845 static void applyInitialValue(CSSStyleSelector* selector) 846 { 847 selector->style()->setHasAspectRatio(RenderStyle::initialHasAspectRatio()); 848 selector->style()->setAspectRatioDenominator(RenderStyle::initialAspectRatioDenominator()); 849 selector->style()->setAspectRatioNumerator(RenderStyle::initialAspectRatioNumerator()); 850 } 851 852 static void applyValue(CSSStyleSelector* selector, CSSValue* value) 853 { 854 if (!value->isAspectRatioValue()) { 855 selector->style()->setHasAspectRatio(false); 856 return; 857 } 858 CSSAspectRatioValue* aspectRatioValue = static_cast<CSSAspectRatioValue*>(value); 859 selector->style()->setHasAspectRatio(true); 860 selector->style()->setAspectRatioDenominator(aspectRatioValue->denominatorValue()); 861 selector->style()->setAspectRatioNumerator(aspectRatioValue->numeratorValue()); 862 } 863 864 static PropertyHandler createHandler() 865 { 866 return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); 867 } 868 }; 869 834 870 const CSSStyleApplyProperty& CSSStyleApplyProperty::sharedCSSStyleApplyProperty() 835 871 { … … 842 878 for (int i = 0; i < numCSSProperties; ++i) 843 879 m_propertyMap[i] = PropertyHandler(); 880 881 setPropertyHandler(CSSPropertyWebkitAspectRatio, ApplyPropertyAspectRatio::createHandler()); 844 882 845 883 setPropertyHandler(CSSPropertyColor, ApplyPropertyColor<InheritFromParent, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::setVisitedLinkColor, &RenderStyle::invalidColor, RenderStyle::initialColor>::createHandler()); -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r100604 r100656 30 30 31 31 #include "Attribute.h" 32 #include "CachedImage.h" 32 33 #include "ContentData.h" 34 #include "Counter.h" 33 35 #include "CounterContent.h" 34 #include "CursorList.h"35 36 #include "CSSBorderImageValue.h" 36 37 #include "CSSCursorImageValue.h" … … 54 55 #include "CSSTimingFunctionValue.h" 55 56 #include "CSSValueList.h" 56 #include "CachedImage.h" 57 #include "Counter.h" 57 #include "CursorList.h" 58 58 #if ENABLE(CSS_FILTERS) 59 59 #include "FilterOperation.h" … … 3823 3823 case CSSPropertyTextUnderlineStyle: 3824 3824 case CSSPropertyTextUnderlineWidth: 3825 case CSSPropertyWebkitAspectRatio:3826 3825 case CSSPropertyWebkitFontSizeDelta: 3827 3826 case CSSPropertyWebkitTextDecorationsInEffect: … … 3926 3925 case CSSPropertyWebkitBackgroundOrigin: 3927 3926 case CSSPropertyBackgroundImage: 3927 case CSSPropertyWebkitAspectRatio: 3928 3928 case CSSPropertyBackgroundSize: 3929 3929 case CSSPropertyWebkitBackgroundSize: -
trunk/Source/WebCore/css/CSSValue.h
r100481 r100656 60 60 bool isValueList() const { return m_isList; } 61 61 62 bool isAspectRatioValue() const { return m_classType == AspectRatioClass; } 62 63 bool isBorderImageValue() const { return m_classType == BorderImageClass; } 63 64 bool isBorderImageSliceValue() const { return m_classType == BorderImageSliceClass; } -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r100604 r100656 702 702 float opacity() const { return rareNonInheritedData->opacity; } 703 703 ControlPart appearance() const { return static_cast<ControlPart>(rareNonInheritedData->m_appearance); } 704 // aspect ratio convenience method 705 bool hasAspectRatio() const { return rareNonInheritedData->m_hasAspectRatio; } 706 float aspectRatio() const { return aspectRatioNumerator() / aspectRatioDenominator(); } 707 float aspectRatioDenominator() const { return rareNonInheritedData->m_aspectRatioDenominator; } 708 float aspectRatioNumerator() const { return rareNonInheritedData->m_aspectRatioNumerator; } 704 709 EBoxAlignment boxAlign() const { return static_cast<EBoxAlignment>(rareNonInheritedData->m_deprecatedFlexibleBox->align); } 705 710 EBoxDirection boxDirection() const { return static_cast<EBoxDirection>(inherited_flags._box_direction); } … … 1055 1060 void setCaptionSide(ECaptionSide v) { inherited_flags._caption_side = v; } 1056 1061 1062 void setHasAspectRatio(bool b) { SET_VAR(rareNonInheritedData, m_hasAspectRatio, b); } 1063 void setAspectRatioDenominator(float v) { SET_VAR(rareNonInheritedData, m_aspectRatioDenominator, v); } 1064 void setAspectRatioNumerator(float v) { SET_VAR(rareNonInheritedData, m_aspectRatioNumerator, v); } 1057 1065 void setCounterIncrement(short v) { SET_VAR(rareNonInheritedData, m_counterIncrement, v) } 1058 1066 void setCounterReset(short v) { SET_VAR(rareNonInheritedData, m_counterReset, v) } … … 1464 1472 static EResize initialResize() { return RESIZE_NONE; } 1465 1473 static ControlPart initialAppearance() { return NoControlPart; } 1474 static bool initialHasAspectRatio() { return false; } 1475 static float initialAspectRatioDenominator() { return 1; } 1476 static float initialAspectRatioNumerator() { return 1; } 1466 1477 static Order initialRTLOrdering() { return LogicalOrder; } 1467 1478 static float initialTextStrokeWidth() { return 0; } -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
r100604 r100656 36 36 StyleRareNonInheritedData::StyleRareNonInheritedData() 37 37 : opacity(RenderStyle::initialOpacity()) 38 , m_aspectRatioDenominator(RenderStyle::initialAspectRatioDenominator()) 39 , m_aspectRatioNumerator(RenderStyle::initialAspectRatioNumerator()) 38 40 , m_counterIncrement(0) 39 41 , m_counterReset(0) … … 67 69 , m_wrapFlow(RenderStyle::initialWrapFlow()) 68 70 , m_wrapThrough(RenderStyle::initialWrapThrough()) 71 , m_hasAspectRatio(false) 69 72 #if USE(ACCELERATED_COMPOSITING) 70 73 , m_runningAcceleratedAnimation(false) … … 77 80 : RefCounted<StyleRareNonInheritedData>() 78 81 , opacity(o.opacity) 82 , m_aspectRatioDenominator(o.m_aspectRatioDenominator) 83 , m_aspectRatioNumerator(o.m_aspectRatioNumerator) 79 84 , m_counterIncrement(o.m_counterIncrement) 80 85 , m_counterReset(o.m_counterReset) … … 128 133 , m_wrapFlow(o.m_wrapFlow) 129 134 , m_wrapThrough(o.m_wrapThrough) 135 , m_hasAspectRatio(o.m_hasAspectRatio) 130 136 #if USE(ACCELERATED_COMPOSITING) 131 137 , m_runningAcceleratedAnimation(o.m_runningAcceleratedAnimation) … … 163 169 && m_borderFit == o.m_borderFit 164 170 && m_textCombine == o.m_textCombine 171 && m_aspectRatioDenominator == o.m_aspectRatioDenominator 172 && m_aspectRatioNumerator == o.m_aspectRatioNumerator 165 173 && m_counterIncrement == o.m_counterIncrement 166 174 && m_counterReset == o.m_counterReset 175 && m_hasAspectRatio == o.m_hasAspectRatio 167 176 #if USE(ACCELERATED_COMPOSITING) 168 177 && !m_runningAcceleratedAnimation && !o.m_runningAcceleratedAnimation -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h
r100604 r100656 90 90 float opacity; // Whether or not we're transparent. 91 91 92 float m_aspectRatioDenominator; 93 float m_aspectRatioNumerator; 94 92 95 short m_counterIncrement; 93 96 short m_counterReset; … … 162 165 unsigned m_wrapThrough: 1; // WrapThrough 163 166 167 bool m_hasAspectRatio : 1; // Whether or not an aspect ratio has been specified. 164 168 #if USE(ACCELERATED_COMPOSITING) 165 169 bool m_runningAcceleratedAnimation : 1;
Note: See TracChangeset
for help on using the changeset viewer.