Changeset 111126 in webkit
- Timestamp:
- Mar 17, 2012 12:54:09 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 48 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r111120 r111126 1 2012-03-17 Joe Thomas <joethomas@motorola.com> 2 3 move calc*Value functions out from Length (and platform) 4 https://bugs.webkit.org/show_bug.cgi?id=80897 5 6 Moving the Length calc*Value functions out from Length structure and also from /WebCore/platform/ folder. 7 This helps to avoid the layering violation while length calculation. Otherwise layer violation can be avoided only by adding a virtual interface(bug 27160). 8 9 Reviewed by Antti Koivisto. 10 11 * GNUmakefile.list.am: Build system changes for adding new files. 12 * Target.pri: Ditto. 13 * WebCore.gypi: Ditto. 14 * WebCore.vcproj/WebCore.vcproj: Ditto. 15 * WebCore.xcodeproj/project.pbxproj: Ditto. 16 * accessibility/gtk/WebKitAccessibleInterfaceText.cpp: 17 (getAttributeSetForAccessibilityObject): 18 * css/CSSComputedStyleDeclaration.cpp: 19 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): 20 * css/LengthFunctions.h: Added. Moved calc*Value functions of Length. 21 (WebCore): 22 (WebCore::calculateMinimumValue): 23 (WebCore::calculateValue): 24 (WebCore::calculateFloatValue): 25 * dom/Document.cpp: 26 (WebCore::Document::pageSizeAndMarginsInPixels): 27 * html/HTMLAreaElement.cpp: 28 (WebCore::HTMLAreaElement::getRegion): 29 * platform/CalculationValue.h: 30 (WebCore::CalcExpressionLength::evaluate): 31 * platform/Length.h: Removed the calc*Value functions from Length structure. 32 (Length): 33 (WebCore::Length::getFloatValue): 34 (WebCore::Length::getIntValue): 35 * platform/graphics/ca/mac/PlatformCAAnimationMac.mm: 36 * platform/graphics/ca/mac/PlatformCALayerMac.mm: 37 (PlatformCALayer::setFilters): 38 * platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp: 39 (WebCore::CCRenderSurfaceFilters::apply): 40 * platform/graphics/filters/FilterOperations.cpp: 41 (WebCore::FilterOperations::getOutsets): 42 * platform/graphics/transforms/PerspectiveTransformOperation.cpp: 43 (WebCore::PerspectiveTransformOperation::blend): 44 * platform/graphics/transforms/PerspectiveTransformOperation.h: 45 (WebCore::PerspectiveTransformOperation::isIdentity): 46 (WebCore::PerspectiveTransformOperation::apply): 47 * platform/graphics/transforms/TranslateTransformOperation.h: 48 (WebCore::TranslateTransformOperation::x): 49 (WebCore::TranslateTransformOperation::y): 50 (WebCore::TranslateTransformOperation::z): 51 (WebCore::TranslateTransformOperation::isIdentity): 52 * platform/win/PopupMenuWin.cpp: 53 (WebCore::PopupMenuWin::paint): 54 * rendering/AutoTableLayout.cpp: 55 (WebCore::AutoTableLayout::layout): 56 * rendering/FilterEffectRenderer.cpp: 57 (WebCore::FilterEffectRenderer::build): 58 * rendering/FixedTableLayout.cpp: 59 (WebCore::FixedTableLayout::layout): 60 * rendering/RenderBlock.cpp: 61 (WebCore::RenderBlock::textIndentOffset): 62 (WebCore::RenderBlock::computeInlinePreferredLogicalWidths): 63 * rendering/RenderBox.cpp: 64 (WebCore::RenderBox::reflectionOffset): 65 (WebCore::RenderBox::clipRect): 66 (WebCore::RenderBox::computeLogicalWidthInRegion): 67 (WebCore::RenderBox::computeLogicalWidthInRegionUsing): 68 (WebCore::RenderBox::computeInlineDirectionMargins): 69 (WebCore::RenderBox::computePercentageLogicalHeight): 70 (WebCore::RenderBox::computeReplacedLogicalWidthUsing): 71 (WebCore::RenderBox::computeReplacedLogicalHeightUsing): 72 (WebCore::RenderBox::availableLogicalHeightUsing): 73 (WebCore::RenderBox::computeBlockDirectionMargins): 74 (WebCore::RenderBox::computePositionedLogicalWidthUsing): 75 (WebCore::RenderBox::computePositionedLogicalHeightUsing): 76 (WebCore::RenderBox::computePositionedLogicalWidthReplaced): 77 (WebCore::RenderBox::computePositionedLogicalHeightReplaced): 78 * rendering/RenderBoxModelObject.cpp: 79 (WebCore::RenderBoxModelObject::relativePositionOffsetX): 80 (WebCore::RenderBoxModelObject::relativePositionOffsetY): 81 (WebCore::RenderBoxModelObject::paddingTop): 82 (WebCore::RenderBoxModelObject::paddingBottom): 83 (WebCore::RenderBoxModelObject::paddingLeft): 84 (WebCore::RenderBoxModelObject::paddingRight): 85 (WebCore::RenderBoxModelObject::paddingBefore): 86 (WebCore::RenderBoxModelObject::paddingAfter): 87 (WebCore::RenderBoxModelObject::paddingStart): 88 (WebCore::RenderBoxModelObject::paddingEnd): 89 (WebCore::RenderBoxModelObject::calculateFillTileSize): 90 (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): 91 (WebCore::computeBorderImageSide): 92 (WebCore::RenderBoxModelObject::paintNinePieceImage): 93 * rendering/RenderFlexibleBox.cpp: 94 (WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild): 95 (WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes): 96 (WebCore::RenderFlexibleBox::runFreeSpaceAllocationAlgorithm): 97 * rendering/RenderFrameSet.cpp: 98 (WebCore::RenderFrameSet::layOutAxis): 99 * rendering/RenderInline.cpp: 100 (WebCore::computeMargin): 101 * rendering/RenderLayer.cpp: 102 (WebCore::RenderLayer::perspectiveTransform): 103 (WebCore::RenderLayer::perspectiveOrigin): 104 * rendering/RenderLayerBacking.cpp: 105 (WebCore::RenderLayerBacking::computeTransformOrigin): 106 (WebCore::RenderLayerBacking::computePerspectiveOrigin): 107 * rendering/RenderMarquee.cpp: 108 (WebCore::RenderMarquee::timerFired): 109 * rendering/RenderMenuList.cpp: 110 (WebCore::RenderMenuList::updateOptionsWidth): 111 * rendering/RenderObject.cpp: 112 (WebCore::RenderObject::repaintAfterLayoutIfNeeded): 113 * rendering/RenderReplaced.cpp: 114 (WebCore::RenderReplaced::computeReplacedLogicalWidth): 115 * rendering/RenderScrollbarPart.cpp: 116 (WebCore::calcScrollbarThicknessUsing): 117 (WebCore::RenderScrollbarPart::computeScrollbarWidth): 118 (WebCore::RenderScrollbarPart::computeScrollbarHeight): 119 * rendering/RenderTable.cpp: 120 (WebCore::RenderTable::computeLogicalWidth): 121 (WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth): 122 * rendering/RenderTableCell.cpp: 123 (WebCore::RenderTableCell::logicalHeightForRowSizing): 124 * rendering/RenderTableSection.cpp: 125 (WebCore::RenderTableSection::calcRowLogicalHeight): 126 * rendering/RenderText.h: 127 (WebCore::RenderText::marginLeft): 128 (WebCore::RenderText::marginRight): 129 * rendering/RootInlineBox.cpp: 130 (WebCore::RootInlineBox::verticalPositionForBox): 131 * rendering/style/RenderStyle.cpp: 132 (WebCore::RenderStyle::applyTransform): 133 (WebCore::calcRadiiFor): 134 * rendering/style/RenderStyle.h: 135 * rendering/svg/RenderSVGRoot.cpp: 136 (WebCore::RenderSVGRoot::computeIntrinsicRatioInformation): 137 (WebCore::resolveLengthAttributeForSVG): 138 * svg/SVGSVGElement.cpp: 139 (WebCore::SVGSVGElement::currentViewBoxRect): 140 (WebCore::SVGSVGElement::currentViewportSize): 141 * svg/graphics/SVGImage.cpp: 142 (WebCore::SVGImage::computeIntrinsicDimensions): 143 1 144 2012-03-17 Nikolas Zimmermann <nzimmermann@rim.com> 2 145 -
trunk/Source/WebCore/GNUmakefile.list.am
r111075 r111126 1646 1646 Source/WebCore/css/FontValue.cpp \ 1647 1647 Source/WebCore/css/FontValue.h \ 1648 Source/WebCore/css/LengthFunctions.h \ 1648 1649 Source/WebCore/css/MediaFeatureNames.cpp \ 1649 1650 Source/WebCore/css/MediaFeatureNames.h \ -
trunk/Source/WebCore/Target.pri
r111075 r111126 1610 1610 css/FontFeatureValue.h \ 1611 1611 css/FontValue.h \ 1612 css/LengthFunctions.h \ 1612 1613 css/MediaFeatureNames.h \ 1613 1614 css/MediaList.h \ -
trunk/Source/WebCore/WebCore.gypi
r111112 r111126 90 90 'css/CSSValueList.h', 91 91 'css/CSSWrapShapes.h', 92 'css/LengthFunctions.h', 92 93 'css/Pair.h', 93 94 'css/WebKitCSSFilterValue.h', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r111075 r111126 36475 36475 </File> 36476 36476 <File 36477 RelativePath="..\css\LengthFunctions.h" 36478 > 36479 </File> 36480 <File 36477 36481 RelativePath="..\css\MediaAllInOne.cpp" 36478 36482 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r111107 r111126 5959 5959 E4D687770ED7AE3D006EA978 /* PurgeableBufferMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4D687760ED7AE3D006EA978 /* PurgeableBufferMac.cpp */; }; 5960 5960 E4D687790ED7AE4F006EA978 /* PurgeableBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D687780ED7AE4F006EA978 /* PurgeableBuffer.h */; }; 5961 E5BA7D63151437CA00FE1E3F /* LengthFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E5BA7D62151437CA00FE1E3F /* LengthFunctions.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5961 5962 ED2BA83C09A24B91006C0AC4 /* DocumentMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = ED2BA83B09A24B91006C0AC4 /* DocumentMarker.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5962 5963 ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED501DC50B249F2900AE18D9 /* EditorMac.mm */; }; … … 13072 13073 E4D687760ED7AE3D006EA978 /* PurgeableBufferMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PurgeableBufferMac.cpp; sourceTree = "<group>"; }; 13073 13074 E4D687780ED7AE4F006EA978 /* PurgeableBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurgeableBuffer.h; sourceTree = "<group>"; }; 13075 E5BA7D62151437CA00FE1E3F /* LengthFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LengthFunctions.h; sourceTree = "<group>"; }; 13074 13076 ED2BA83B09A24B91006C0AC4 /* DocumentMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentMarker.h; sourceTree = "<group>"; }; 13075 13077 ED501DC50B249F2900AE18D9 /* EditorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = EditorMac.mm; path = mac/EditorMac.mm; sourceTree = "<group>"; }; … … 20472 20474 CDBD93BA1333BD4B002570E3 /* fullscreenQuickTime.css */, 20473 20475 93CA4C9909DF93FA00DF8677 /* html.css */, 20476 E5BA7D62151437CA00FE1E3F /* LengthFunctions.h */, 20474 20477 93CA4C9A09DF93FA00DF8677 /* make-css-file-arrays.pl */, 20475 20478 93CA4C9B09DF93FA00DF8677 /* makeprop.pl */, … … 23474 23477 BCE65BEB0EACDF16007E4533 /* Length.h in Headers */, 23475 23478 BCFF64910EAD15C200C1D6F7 /* LengthBox.h in Headers */, 23479 E5BA7D63151437CA00FE1E3F /* LengthFunctions.h in Headers */, 23476 23480 BCFF64920EAD15C200C1D6F7 /* LengthSize.h in Headers */, 23477 23481 8CADF2A9135C7B36009EF43F /* LevelDBComparator.h in Headers */, -
trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.cpp
r107086 r111126 241 241 242 242 if (!style->textIndent().isUndefined()) { 243 int indentation = style->textIndent().calcValue(object->size().width());243 int indentation = valueForLength(style->textIndent(), object->size().width()); 244 244 buffer.set(g_strdup_printf("%i", indentation)); 245 245 result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_INDENT), buffer.get()); -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r110588 r111126 1775 1775 // and the right-edge of the containing box, when display == BLOCK. Let's calculate the absolute 1776 1776 // value of the specified margin-right % instead of relying on RenderBox's marginRight() value. 1777 value = m arginRight.calcMinValue(toRenderBox(renderer)->containingBlockLogicalWidthForContent());1777 value = miminumValueForLength(marginRight, toRenderBox(renderer)->containingBlockLogicalWidthForContent()); 1778 1778 else 1779 1779 value = toRenderBox(renderer)->marginRight(); … … 2187 2187 if (renderer) { 2188 2188 LayoutRect box = sizingBox(renderer); 2189 list->append(zoomAdjustedPixelValue( style->perspectiveOriginX().calcMinValue(box.width()), style.get(), cssValuePool));2190 list->append(zoomAdjustedPixelValue( style->perspectiveOriginY().calcMinValue(box.height()), style.get(), cssValuePool));2189 list->append(zoomAdjustedPixelValue(miminumValueForLength(style->perspectiveOriginX(), box.width()), style.get(), cssValuePool)); 2190 list->append(zoomAdjustedPixelValue(miminumValueForLength(style->perspectiveOriginY(), box.height()), style.get(), cssValuePool)); 2191 2191 } 2192 2192 else { … … 2233 2233 if (renderer) { 2234 2234 IntRect box = sizingBox(renderer); 2235 list->append(zoomAdjustedPixelValue( style->transformOriginX().calcMinValue(box.width()), style.get(), cssValuePool));2236 list->append(zoomAdjustedPixelValue( style->transformOriginY().calcMinValue(box.height()), style.get(), cssValuePool));2235 list->append(zoomAdjustedPixelValue(miminumValueForLength(style->transformOriginX(), box.width()), style.get(), cssValuePool)); 2236 list->append(zoomAdjustedPixelValue(miminumValueForLength(style->transformOriginY(), box.height()), style.get(), cssValuePool)); 2237 2237 if (style->transformOriginZ() != 0) 2238 2238 list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get(), cssValuePool)); -
trunk/Source/WebCore/dom/Document.cpp
r111048 r111126 1803 1803 ASSERT(size.width().isFixed()); 1804 1804 ASSERT(size.height().isFixed()); 1805 width = size.width().calcValue(0);1806 height = size.height().calcValue(0);1805 width = valueForLength(size.width(), 0); 1806 height = valueForLength(size.height(), 0); 1807 1807 break; 1808 1808 } … … 1814 1814 // The percentage is calculated with respect to the width even for margin top and bottom. 1815 1815 // http://www.w3.org/TR/CSS2/box.html#margin-properties 1816 marginTop = style->marginTop().isAuto() ? marginTop : style->marginTop().calcValue(width);1817 marginRight = style->marginRight().isAuto() ? marginRight : style->marginRight().calcValue(width);1818 marginBottom = style->marginBottom().isAuto() ? marginBottom : style->marginBottom().calcValue(width);1819 marginLeft = style->marginLeft().isAuto() ? marginLeft : style->marginLeft().calcValue(width);1816 marginTop = style->marginTop().isAuto() ? marginTop : valueForLength(style->marginTop(), width); 1817 marginRight = style->marginRight().isAuto() ? marginRight : valueForLength(style->marginRight(), width); 1818 marginBottom = style->marginBottom().isAuto() ? marginBottom : valueForLength(style->marginBottom(), width); 1819 marginLeft = style->marginLeft().isAuto() ? marginLeft : valueForLength(style->marginLeft(), width); 1820 1820 } 1821 1821 -
trunk/Source/WebCore/html/HTMLAreaElement.cpp
r109785 r111126 148 148 if (m_coordsLen >= 6) { 149 149 int numPoints = m_coordsLen / 2; 150 path.moveTo(FloatPoint(m _coords[0].calcMinValue(width), m_coords[1].calcMinValue(height)));150 path.moveTo(FloatPoint(miminumValueForLength(m_coords[0], width), miminumValueForLength(m_coords[1], height))); 151 151 for (int i = 1; i < numPoints; ++i) 152 path.addLineTo(FloatPoint(m _coords[i * 2].calcMinValue(width), m_coords[i * 2 + 1].calcMinValue(height)));152 path.addLineTo(FloatPoint(miminumValueForLength(m_coords[i * 2], width), miminumValueForLength(m_coords[i * 2 + 1], height))); 153 153 path.closeSubpath(); 154 154 } … … 157 157 if (m_coordsLen >= 3) { 158 158 Length radius = m_coords[2]; 159 int r = min( radius.calcMinValue(width), radius.calcMinValue(height));160 path.addEllipse(FloatRect(m _coords[0].calcMinValue(width) - r, m_coords[1].calcMinValue(height) - r, 2 * r, 2 * r));159 int r = min(miminumValueForLength(radius, width), miminumValueForLength(radius, height)); 160 path.addEllipse(FloatRect(miminumValueForLength(m_coords[0], width) - r, miminumValueForLength(m_coords[1], height) - r, 2 * r, 2 * r)); 161 161 } 162 162 break; 163 163 case Rect: 164 164 if (m_coordsLen >= 4) { 165 int x0 = m _coords[0].calcMinValue(width);166 int y0 = m _coords[1].calcMinValue(height);167 int x1 = m _coords[2].calcMinValue(width);168 int y1 = m _coords[3].calcMinValue(height);165 int x0 = miminumValueForLength(m_coords[0], width); 166 int y0 = miminumValueForLength(m_coords[1], height); 167 int x1 = miminumValueForLength(m_coords[2], width); 168 int y1 = miminumValueForLength(m_coords[3], height); 169 169 path.addRect(FloatRect(x0, y0, x1 - x0, y1 - y0)); 170 170 } -
trunk/Source/WebCore/platform/CalculationValue.h
r110148 r111126 33 33 34 34 #include "Length.h" 35 #include "LengthFunctions.h" 35 36 #include <wtf/OwnPtr.h> 36 37 #include <wtf/PassOwnPtr.h> … … 102 103 virtual float evaluate(float maxValue) const 103 104 { 104 return m_length.calcFloatValue(maxValue);105 return floatValueForLength(m_length, maxValue); 105 106 } 106 107 -
trunk/Source/WebCore/platform/Length.h
r110532 r111126 160 160 } 161 161 162 int calcValue(int maxValue, bool roundPercentages = false) const163 {164 switch (type()) {165 case Fixed:166 case Percent:167 case Calculated:168 return calcMinValue(maxValue, roundPercentages);169 case Auto:170 return maxValue;171 case Relative:172 case Intrinsic:173 case MinIntrinsic:174 case Undefined:175 ASSERT_NOT_REACHED();176 return 0;177 }178 ASSERT_NOT_REACHED();179 return 0;180 }181 182 int calcMinValue(int maxValue, bool roundPercentages = false) const183 {184 switch (type()) {185 case Fixed:186 return value();187 case Percent:188 if (roundPercentages)189 return static_cast<int>(round(maxValue * percent() / 100.0f));190 // Don't remove the extra cast to float. It is needed for rounding on 32-bit Intel machines that use the FPU stack.191 return static_cast<int>(static_cast<float>(maxValue * percent() / 100.0f));192 case Calculated:193 return nonNanCalculatedValue(maxValue);194 case Auto:195 return 0;196 case Relative:197 case Intrinsic:198 case MinIntrinsic:199 case Undefined:200 ASSERT_NOT_REACHED();201 return 0;202 }203 ASSERT_NOT_REACHED();204 return 0;205 }206 207 // FIXME: when subpixel layout is supported this copy of calcFloatValue() can be removed. See bug 71143.208 float calcFloatValue(int maxValue) const209 {210 switch (type()) {211 case Fixed:212 return getFloatValue();213 case Percent:214 return static_cast<float>(maxValue * percent() / 100.0f);215 case Auto:216 return static_cast<float>(maxValue);217 case Calculated:218 return nonNanCalculatedValue(maxValue);219 case Relative:220 case Intrinsic:221 case MinIntrinsic:222 case Undefined:223 ASSERT_NOT_REACHED();224 return 0;225 }226 ASSERT_NOT_REACHED();227 return 0;228 }229 230 float calcFloatValue(float maxValue) const231 {232 switch (type()) {233 case Fixed:234 return getFloatValue();235 case Percent:236 return static_cast<float>(maxValue * percent() / 100.0f);237 case Auto:238 return static_cast<float>(maxValue);239 case Calculated:240 return nonNanCalculatedValue(maxValue);241 case Relative:242 case Intrinsic:243 case MinIntrinsic:244 case Undefined:245 ASSERT_NOT_REACHED();246 return 0;247 }248 ASSERT_NOT_REACHED();249 return 0;250 }251 252 162 bool isUndefined() const { return type() == Undefined; } 253 163 … … 313 223 } 314 224 225 float getFloatValue() const 226 { 227 ASSERT(!isUndefined()); 228 return m_isFloat ? m_floatValue : m_intValue; 229 } 230 float nonNanCalculatedValue(int maxValue) const; 231 315 232 private: 316 233 int getIntValue() const … … 319 236 return m_isFloat ? static_cast<int>(m_floatValue) : m_intValue; 320 237 } 321 322 float getFloatValue() const323 {324 ASSERT(!isUndefined());325 return m_isFloat ? m_floatValue : m_intValue;326 }327 328 238 void initFromLength(const Length &length) 329 239 { … … 340 250 incrementCalculatedRef(); 341 251 } 342 343 float nonNanCalculatedValue(int maxValue) const; 252 344 253 int calculationHandle() const 345 254 { -
trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCAAnimationMac.mm
r107422 r111126 31 31 32 32 #import "FloatConversion.h" 33 #import "LengthFunctions.h" 33 34 #import "PlatformString.h" 34 35 #import "TimingFunction.h" … … 503 504 if (!operation->isDefault()) { 504 505 const BlurFilterOperation* op = static_cast<const BlurFilterOperation*>(operation); 505 amount = op->stdDeviation().calcFloatValue(0);506 amount = floatValueForLength(op->stdDeviation(), 0); 506 507 } 507 508 -
trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm
r109788 r111126 35 35 #import "GraphicsContext.h" 36 36 #import "GraphicsLayerCA.h" 37 #import "LengthFunctions.h" 37 38 #import "WebLayer.h" 38 39 #import "WebTiledLayer.h" … … 824 825 CIFilter* caFilter = [CIFilter filterWithName:@"CIGaussianBlur"]; 825 826 [caFilter setDefaults]; 826 [caFilter setValue:[NSNumber numberWithFloat: op->stdDeviation().calcFloatValue(0)] forKey:@"inputRadius"];827 [caFilter setValue:[NSNumber numberWithFloat:floatValueForLength(op->stdDeviation(), 0)] forKey:@"inputRadius"]; 827 828 [caFilter setName:filterName]; 828 829 [array.get() addObject:caFilter]; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp
r111047 r111126 31 31 32 32 #include "GraphicsContext3D.h" 33 #include "LengthFunctions.h" 33 34 #include "SkBlurImageFilter.h" 34 35 #include "SkCanvas.h" … … 270 271 case FilterOperation::BLUR: { 271 272 const BlurFilterOperation* op = static_cast<const BlurFilterOperation*>(filterOperation); 272 float stdX = op->stdDeviation().calcFloatValue(0);273 float stdY = op->stdDeviation().calcFloatValue(1);273 float stdX = floatValueForLength(op->stdDeviation(), 0); 274 float stdY = floatValueForLength(op->stdDeviation(), 1); 274 275 SkAutoTUnref<SkImageFilter> filter(new SkBlurImageFilter(stdX, stdY)); 275 276 SkPaint paint; -
trunk/Source/WebCore/platform/graphics/filters/FilterOperations.cpp
r108013 r111126 29 29 #include "FEGaussianBlur.h" 30 30 #include "IntSize.h" 31 #include "LengthFunctions.h" 31 32 32 33 #if ENABLE(CSS_FILTERS) … … 108 109 case FilterOperation::BLUR: { 109 110 BlurFilterOperation* blurOperation = static_cast<BlurFilterOperation*>(filterOperation); 110 float stdDeviation = blurOperation->stdDeviation().calcFloatValue(0);111 float stdDeviation = floatValueForLength(blurOperation->stdDeviation(), 0); 111 112 IntSize outset = outsetSizeForBlur(stdDeviation); 112 113 top += outset.height(); -
trunk/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp
r102740 r111126 40 40 41 41 if (blendToIdentity) { 42 double p = m_p.calcFloatValue(1);42 double p = floatValueForLength(m_p, 1); 43 43 p = WebCore::blend(p, 1.0, progress); // FIXME: this seems wrong. https://bugs.webkit.org/show_bug.cgi?id=52700 44 44 return PerspectiveTransformOperation::create(Length(clampToPositiveInteger(p), Fixed)); … … 51 51 TransformationMatrix fromT; 52 52 TransformationMatrix toT; 53 fromT.applyPerspective(f romP.calcFloatValue(1));54 toT.applyPerspective( toP.calcFloatValue(1));53 fromT.applyPerspective(floatValueForLength(fromP, 1)); 54 toT.applyPerspective(floatValueForLength(toP, 1)); 55 55 toT.blend(fromT, progress); 56 56 TransformationMatrix::DecomposedType decomp; -
trunk/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h
r95901 r111126 28 28 29 29 #include "Length.h" 30 #include "LengthFunctions.h" 30 31 #include "TransformOperation.h" 31 32 … … 42 43 43 44 private: 44 virtual bool isIdentity() const { return m_p.calcFloatValue(1) == 0; }45 virtual bool isIdentity() const { return !floatValueForLength(m_p, 1); } 45 46 virtual OperationType getOperationType() const { return PERSPECTIVE; } 46 47 virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == PERSPECTIVE; } … … 56 57 virtual bool apply(TransformationMatrix& transform, const FloatSize&) const 57 58 { 58 transform.applyPerspective( m_p.calcFloatValue(1));59 transform.applyPerspective(floatValueForLength(m_p, 1)); 59 60 return false; 60 61 } -
trunk/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h
r95901 r111126 27 27 28 28 #include "Length.h" 29 #include "LengthFunctions.h" 29 30 #include "TransformOperation.h" 30 31 … … 43 44 } 44 45 45 double x(const FloatSize& borderBoxSize) const { return m_x.calcFloatValue(borderBoxSize.width()); }46 double y(const FloatSize& borderBoxSize) const { return m_y.calcFloatValue(borderBoxSize.height()); }47 double z(const FloatSize&) const { return m_z.calcFloatValue(1); }46 double x(const FloatSize& borderBoxSize) const { return floatValueForLength(m_x, borderBoxSize.width()); } 47 double y(const FloatSize& borderBoxSize) const { return floatValueForLength(m_y, borderBoxSize.height()); } 48 double z(const FloatSize&) const { return floatValueForLength(m_z, 1); } 48 49 49 50 Length x() const { return m_x; } … … 52 53 53 54 private: 54 virtual bool isIdentity() const { return m_x.calcFloatValue(1) == 0 && m_y.calcFloatValue(1) == 0 && m_z.calcFloatValue(1) == 0; }55 virtual bool isIdentity() const { return !floatValueForLength(m_x, 1) && !floatValueForLength(m_y, 1) && !floatValueForLength(m_z, 1); } 55 56 56 57 virtual OperationType getOperationType() const { return m_type; } -
trunk/Source/WebCore/platform/win/PopupMenuWin.cpp
r107574 r111126 34 34 #include "HWndDC.h" 35 35 #include "HostWindow.h" 36 #include "LengthFunctions.h" 36 37 #include "Page.h" 37 38 #include "PlatformMouseEvent.h" … … 655 656 int textX = max(0, client()->clientPaddingLeft() - client()->clientInsetLeft()); 656 657 if (RenderTheme::defaultTheme()->popupOptionSupportsTextIndent() && itemStyle.textDirection() == LTR) 657 textX += itemStyle.textIndent().calcMinValue(itemRect.width());658 textX += miminumValueForLength(itemStyle.textIndent(), itemRect.width()); 658 659 int textY = itemRect.y() + itemFont.fontMetrics().ascent() + (itemRect.height() - itemFont.fontMetrics().height()) / 2; 659 660 context.drawBidiText(itemFont, textRun, IntPoint(textX, textY)); -
trunk/Source/WebCore/rendering/AutoTableLayout.cpp
r106479 r111126 552 552 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 553 553 if (logicalWidth.isPercent()) { 554 int cellLogicalWidth = max<int>(m_layoutStruct[i].effectiveMinLogicalWidth, logicalWidth.calcMinValue(tableLogicalWidth));554 int cellLogicalWidth = max<int>(m_layoutStruct[i].effectiveMinLogicalWidth, miminumValueForLength(logicalWidth, tableLogicalWidth)); 555 555 available += m_layoutStruct[i].computedLogicalWidth - cellLogicalWidth; 556 556 m_layoutStruct[i].computedLogicalWidth = cellLogicalWidth; -
trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp
r109016 r111126 238 238 case FilterOperation::BLUR: { 239 239 BlurFilterOperation* blurOperation = static_cast<BlurFilterOperation*>(filterOperation); 240 float stdDeviation = blurOperation->stdDeviation().calcFloatValue(0);240 float stdDeviation = floatValueForLength(blurOperation->stdDeviation(), 0); 241 241 effect = FEGaussianBlur::create(this, stdDeviation, stdDeviation); 242 242 break; -
trunk/Source/WebCore/rendering/FixedTableLayout.cpp
r111118 r111126 245 245 totalFixedWidth += calcWidth[i]; 246 246 } else if (m_width[i].isPercent()) { 247 calcWidth[i] = m_width[i].calcValue(tableLogicalWidth);247 calcWidth[i] = valueForLength(m_width[i], tableLogicalWidth); 248 248 totalPercentWidth += calcWidth[i]; 249 249 totalPercent += m_width[i].percent(); -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r111048 r111126 3902 3902 if (style()->textIndent().isPercent()) 3903 3903 cw = containingBlock()->availableLogicalWidth(); 3904 return style()->textIndent().calcMinValue(cw);3904 return miminumValueForLength(style()->textIndent(), cw); 3905 3905 } 3906 3906 … … 5542 5542 if (!addedTextIndent) { 5543 5543 addedTextIndent = true; 5544 ti = styleToUse->textIndent().calcMinValue(cw);5544 ti = miminumValueForLength(styleToUse->textIndent(), cw); 5545 5545 childMin += ti; 5546 5546 childMax += ti; … … 5613 5613 if (!addedTextIndent) { 5614 5614 addedTextIndent = true; 5615 ti = styleToUse->textIndent().calcMinValue(cw);5615 ti = miminumValueForLength(styleToUse->textIndent(), cw); 5616 5616 childMin+=ti; beginMin += ti; 5617 5617 childMax+=ti; beginMax += ti; -
trunk/Source/WebCore/rendering/RenderBox.cpp
r111064 r111126 624 624 return 0; 625 625 if (style()->boxReflect()->direction() == ReflectionLeft || style()->boxReflect()->direction() == ReflectionRight) 626 return style()->boxReflect()->offset().calcValue(borderBoxRect().width());627 return style()->boxReflect()->offset().calcValue(borderBoxRect().height());626 return valueForLength(style()->boxReflect()->offset(), borderBoxRect().width()); 627 return valueForLength(style()->boxReflect()->offset(), borderBoxRect().height()); 628 628 } 629 629 … … 1295 1295 1296 1296 if (!style()->clipLeft().isAuto()) { 1297 LayoutUnit c = style()->clipLeft().calcValue(borderBoxRect.width());1297 LayoutUnit c = valueForLength(style()->clipLeft(), borderBoxRect.width()); 1298 1298 clipRect.move(c, 0); 1299 1299 clipRect.contract(c, 0); … … 1304 1304 1305 1305 if (!style()->clipRight().isAuto()) 1306 clipRect.contract(width() - style()->clipRight().calcValue(width()), 0);1306 clipRect.contract(width() - valueForLength(style()->clipRight(), width()), 0); 1307 1307 1308 1308 if (!style()->clipTop().isAuto()) { 1309 LayoutUnit c = style()->clipTop().calcValue(borderBoxRect.height());1309 LayoutUnit c = valueForLength(style()->clipTop(), borderBoxRect.height()); 1310 1310 clipRect.move(0, c); 1311 1311 clipRect.contract(0, c); … … 1313 1313 1314 1314 if (!style()->clipBottom().isAuto()) 1315 clipRect.contract(0, height() - style()->clipBottom().calcValue(height()));1315 clipRect.contract(0, height() - valueForLength(style()->clipBottom(), height())); 1316 1316 1317 1317 return clipRect; … … 1780 1780 if (isInline() && !isInlineBlockOrInlineTable()) { 1781 1781 // just calculate margins 1782 setMarginStart( styleToUse->marginStart().calcMinValue(containerLogicalWidth));1783 setMarginEnd( styleToUse->marginEnd().calcMinValue(containerLogicalWidth));1782 setMarginStart(miminumValueForLength(styleToUse->marginStart(), containerLogicalWidth)); 1783 setMarginEnd(miminumValueForLength(styleToUse->marginEnd(), containerLogicalWidth)); 1784 1784 if (treatAsReplaced) 1785 setLogicalWidth(max<LayoutUnit>( logicalWidthLength.calcFloatValue(0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth()));1785 setLogicalWidth(max<LayoutUnit>(floatValueForLength(logicalWidthLength, 0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth())); 1786 1786 return; 1787 1787 } … … 1819 1819 // Margin calculations. 1820 1820 if (logicalWidthLength.isAuto() || hasPerpendicularContainingBlock) { 1821 setMarginStart( styleToUse->marginStart().calcMinValue(containerLogicalWidth));1822 setMarginEnd( styleToUse->marginEnd().calcMinValue(containerLogicalWidth));1821 setMarginStart(miminumValueForLength(styleToUse->marginStart(), containerLogicalWidth)); 1822 setMarginEnd(miminumValueForLength(styleToUse->marginEnd(), containerLogicalWidth)); 1823 1823 } else 1824 1824 computeInlineDirectionMargins(cb, containerLogicalWidth, logicalWidth()); … … 1843 1843 1844 1844 if (logicalWidth.isIntrinsicOrAuto()) { 1845 LayoutUnit marginStart = styleToUse->marginStart().calcMinValue(availableLogicalWidth);1846 LayoutUnit marginEnd = styleToUse->marginEnd().calcMinValue(availableLogicalWidth);1845 LayoutUnit marginStart = miminumValueForLength(styleToUse->marginStart(), availableLogicalWidth); 1846 LayoutUnit marginEnd = miminumValueForLength(styleToUse->marginEnd(), availableLogicalWidth); 1847 1847 logicalWidthResult = availableLogicalWidth - marginStart - marginEnd; 1848 1848 … … 1855 1855 } 1856 1856 } else // FIXME: If the containing block flow is perpendicular to our direction we need to use the available logical height instead. 1857 logicalWidthResult = computeBorderBoxLogicalWidth( logicalWidth.calcValue(availableLogicalWidth));1857 logicalWidthResult = computeBorderBoxLogicalWidth(valueForLength(logicalWidth, availableLogicalWidth)); 1858 1858 1859 1859 return logicalWidthResult; … … 1926 1926 if (isFloating() || isInline()) { 1927 1927 // Inline blocks/tables and floats don't have their margins increased. 1928 containingBlock->setMarginStartForChild(this, m arginStartLength.calcMinValue(containerWidth));1929 containingBlock->setMarginEndForChild(this, m arginEndLength.calcMinValue(containerWidth));1928 containingBlock->setMarginStartForChild(this, miminumValueForLength(marginStartLength, containerWidth)); 1929 containingBlock->setMarginEndForChild(this, miminumValueForLength(marginEndLength, containerWidth)); 1930 1930 return; 1931 1931 } … … 1941 1941 // Case Two: The object is being pushed to the start of the containing block's available logical width. 1942 1942 if (marginEndLength.isAuto() && childWidth < containerWidth) { 1943 containingBlock->setMarginStartForChild(this, marginStartLength.calcValue(containerWidth));1943 containingBlock->setMarginStartForChild(this, valueForLength(marginStartLength, containerWidth)); 1944 1944 containingBlock->setMarginEndForChild(this, containerWidth - childWidth - containingBlock->marginStartForChild(this)); 1945 1945 return; … … 1950 1950 || (containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_RIGHT)); 1951 1951 if ((marginStartLength.isAuto() && childWidth < containerWidth) || pushToEndFromTextAlign) { 1952 containingBlock->setMarginEndForChild(this, marginEndLength.calcValue(containerWidth));1952 containingBlock->setMarginEndForChild(this, valueForLength(marginEndLength, containerWidth)); 1953 1953 containingBlock->setMarginStartForChild(this, containerWidth - childWidth - containingBlock->marginEndForChild(this)); 1954 1954 return; … … 1957 1957 // Case Four: Either no auto margins, or our width is >= the container width (css2.1, 10.3.3). In that case 1958 1958 // auto margins will just turn into 0. 1959 containingBlock->setMarginStartForChild(this, m arginStartLength.calcMinValue(containerWidth));1960 containingBlock->setMarginEndForChild(this, m arginEndLength.calcMinValue(containerWidth));1959 containingBlock->setMarginStartForChild(this, miminumValueForLength(marginStartLength, containerWidth)); 1960 containingBlock->setMarginEndForChild(this, miminumValueForLength(marginEndLength, containerWidth)); 1961 1961 } 1962 1962 … … 2246 2246 2247 2247 if (result != -1) { 2248 result = height.calcValue(result);2248 result = valueForLength(height, result); 2249 2249 if (includeBorderPadding) { 2250 2250 // It is necessary to use the border-box to match WinIE's broken … … 2281 2281 const LayoutUnit cw = isPositioned() ? containingBlockLogicalWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockLogicalWidthForContent(); 2282 2282 if (cw > 0) 2283 return computeContentBoxLogicalWidth( logicalWidth.calcMinValue(cw));2283 return computeContentBoxLogicalWidth(miminumValueForLength(logicalWidth, cw)); 2284 2284 } 2285 2285 // fall through … … 2323 2323 LayoutUnit newHeight = block->computeContentBoxLogicalHeight(block->contentHeight()); 2324 2324 block->setHeight(oldHeight); 2325 return computeContentBoxLogicalHeight( logicalHeight.calcValue(newHeight));2325 return computeContentBoxLogicalHeight(valueForLength(logicalHeight, newHeight)); 2326 2326 } 2327 2327 … … 2344 2344 // <http://bugs.webkit.org/show_bug.cgi?id=15359> 2345 2345 availableHeight = max(availableHeight, intrinsicLogicalHeight()); 2346 return logicalHeight.calcValue(availableHeight - borderAndPaddingLogicalHeight());2346 return valueForLength(logicalHeight, availableHeight - borderAndPaddingLogicalHeight()); 2347 2347 } 2348 2348 cb = cb->containingBlock(); … … 2350 2350 } 2351 2351 } 2352 return computeContentBoxLogicalHeight( logicalHeight.calcValue(availableHeight));2352 return computeContentBoxLogicalHeight(valueForLength(logicalHeight, availableHeight)); 2353 2353 } 2354 2354 default: … … 2385 2385 else 2386 2386 availableHeight = containingBlock()->availableLogicalHeight(); 2387 return computeContentBoxLogicalHeight( h.calcValue(availableHeight));2387 return computeContentBoxLogicalHeight(valueForLength(h, availableHeight)); 2388 2388 } 2389 2389 … … 2417 2417 2418 2418 RenderStyle* containingBlockStyle = containingBlock->style(); 2419 containingBlock->setMarginBeforeForChild(this, style()->marginBeforeUsing(containingBlockStyle).calcMinValue(cw));2420 containingBlock->setMarginAfterForChild(this, style()->marginAfterUsing(containingBlockStyle).calcMinValue(cw));2419 containingBlock->setMarginBeforeForChild(this, miminumValueForLength(style()->marginBeforeUsing(containingBlockStyle), cw)); 2420 containingBlock->setMarginAfterForChild(this, miminumValueForLength(style()->marginAfterUsing(containingBlockStyle), cw)); 2421 2421 } 2422 2422 … … 2758 2758 // case because the value is not used for any further calculations. 2759 2759 2760 logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);2761 logicalWidthValue = computeContentBoxLogicalWidth( logicalWidth.calcValue(containerLogicalWidth));2762 2763 const LayoutUnit availableSpace = containerLogicalWidth - (logicalLeftValue + logicalWidthValue + logicalRight.calcValue(containerLogicalWidth) + bordersPlusPadding);2760 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); 2761 logicalWidthValue = computeContentBoxLogicalWidth(valueForLength(logicalWidth, containerLogicalWidth)); 2762 2763 const LayoutUnit availableSpace = containerLogicalWidth - (logicalLeftValue + logicalWidthValue + valueForLength(logicalRight, containerLogicalWidth) + bordersPlusPadding); 2764 2764 2765 2765 // Margins are now the only unknown … … 2782 2782 } else if (marginLogicalLeft.isAuto()) { 2783 2783 // Solve for left margin 2784 marginLogicalRightValue = marginLogicalRight.calcValue(containerLogicalWidth);2784 marginLogicalRightValue = valueForLength(marginLogicalRight, containerLogicalWidth); 2785 2785 marginLogicalLeftValue = availableSpace - marginLogicalRightValue; 2786 2786 } else if (marginLogicalRight.isAuto()) { 2787 2787 // Solve for right margin 2788 marginLogicalLeftValue = marginLogicalLeft.calcValue(containerLogicalWidth);2788 marginLogicalLeftValue = valueForLength(marginLogicalLeft, containerLogicalWidth); 2789 2789 marginLogicalRightValue = availableSpace - marginLogicalLeftValue; 2790 2790 } else { 2791 2791 // Over-constrained, solve for left if direction is RTL 2792 marginLogicalLeftValue = marginLogicalLeft.calcValue(containerLogicalWidth);2793 marginLogicalRightValue = marginLogicalRight.calcValue(containerLogicalWidth);2792 marginLogicalLeftValue = valueForLength(marginLogicalLeft, containerLogicalWidth); 2793 marginLogicalRightValue = valueForLength(marginLogicalRight, containerLogicalWidth); 2794 2794 2795 2795 // Use the containing block's direction rather than the parent block's … … 2841 2841 2842 2842 // Calculate margins, 'auto' margins are ignored. 2843 marginLogicalLeftValue = m arginLogicalLeft.calcMinValue(containerLogicalWidth);2844 marginLogicalRightValue = m arginLogicalRight.calcMinValue(containerLogicalWidth);2843 marginLogicalLeftValue = miminumValueForLength(marginLogicalLeft, containerLogicalWidth); 2844 marginLogicalRightValue = miminumValueForLength(marginLogicalRight, containerLogicalWidth); 2845 2845 2846 2846 const LayoutUnit availableSpace = containerLogicalWidth - (marginLogicalLeftValue + marginLogicalRightValue + bordersPlusPadding); … … 2850 2850 if (logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) { 2851 2851 // RULE 1: (use shrink-to-fit for width, and solve of left) 2852 LayoutUnit logicalRightValue = logicalRight.calcValue(containerLogicalWidth);2852 LayoutUnit logicalRightValue = valueForLength(logicalRight, containerLogicalWidth); 2853 2853 2854 2854 // FIXME: would it be better to have shrink-to-fit in one step? … … 2860 2860 } else if (!logicalLeftIsAuto && logicalWidthIsAuto && logicalRightIsAuto) { 2861 2861 // RULE 3: (use shrink-to-fit for width, and no need solve of right) 2862 logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);2862 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); 2863 2863 2864 2864 // FIXME: would it be better to have shrink-to-fit in one step? … … 2869 2869 } else if (logicalLeftIsAuto && !logicalWidthIsAuto && !logicalRightIsAuto) { 2870 2870 // RULE 4: (solve for left) 2871 logicalWidthValue = computeContentBoxLogicalWidth( logicalWidth.calcValue(containerLogicalWidth));2872 logicalLeftValue = availableSpace - (logicalWidthValue + logicalRight.calcValue(containerLogicalWidth));2871 logicalWidthValue = computeContentBoxLogicalWidth(valueForLength(logicalWidth, containerLogicalWidth)); 2872 logicalLeftValue = availableSpace - (logicalWidthValue + valueForLength(logicalRight, containerLogicalWidth)); 2873 2873 } else if (!logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) { 2874 2874 // RULE 5: (solve for width) 2875 logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);2876 logicalWidthValue = availableSpace - (logicalLeftValue + logicalRight.calcValue(containerLogicalWidth));2875 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); 2876 logicalWidthValue = availableSpace - (logicalLeftValue + valueForLength(logicalRight, containerLogicalWidth)); 2877 2877 } else if (!logicalLeftIsAuto && !logicalWidthIsAuto && logicalRightIsAuto) { 2878 2878 // RULE 6: (no need solve for right) 2879 logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);2880 logicalWidthValue = computeContentBoxLogicalWidth( logicalWidth.calcValue(containerLogicalWidth));2879 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); 2880 logicalWidthValue = computeContentBoxLogicalWidth(valueForLength(logicalWidth, containerLogicalWidth)); 2881 2881 } 2882 2882 } … … 3093 3093 // case because the value is not used for any further calculations. 3094 3094 3095 logicalHeightValue = computeContentBoxLogicalHeight( logicalHeightLength.calcValue(containerLogicalHeight));3096 logicalTopValue = logicalTop.calcValue(containerLogicalHeight);3097 3098 const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopValue + logicalHeightValue + logicalBottom.calcValue(containerLogicalHeight) + bordersPlusPadding);3095 logicalHeightValue = computeContentBoxLogicalHeight(valueForLength(logicalHeightLength, containerLogicalHeight)); 3096 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); 3097 3098 const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopValue + logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight) + bordersPlusPadding); 3099 3099 3100 3100 // Margins are now the only unknown … … 3106 3106 } else if (marginBefore.isAuto()) { 3107 3107 // Solve for top margin 3108 marginAfterValue = marginAfter.calcValue(containerLogicalHeight);3108 marginAfterValue = valueForLength(marginAfter, containerLogicalHeight); 3109 3109 marginBeforeValue = availableSpace - marginAfterValue; 3110 3110 } else if (marginAfter.isAuto()) { 3111 3111 // Solve for bottom margin 3112 marginBeforeValue = marginBefore.calcValue(containerLogicalHeight);3112 marginBeforeValue = valueForLength(marginBefore, containerLogicalHeight); 3113 3113 marginAfterValue = availableSpace - marginBeforeValue; 3114 3114 } else { 3115 3115 // Over-constrained, (no need solve for bottom) 3116 marginBeforeValue = marginBefore.calcValue(containerLogicalHeight);3117 marginAfterValue = marginAfter.calcValue(containerLogicalHeight);3116 marginBeforeValue = valueForLength(marginBefore, containerLogicalHeight); 3117 marginAfterValue = valueForLength(marginAfter, containerLogicalHeight); 3118 3118 } 3119 3119 } else { … … 3144 3144 3145 3145 // Calculate margins, 'auto' margins are ignored. 3146 marginBeforeValue = m arginBefore.calcMinValue(containerLogicalHeight);3147 marginAfterValue = m arginAfter.calcMinValue(containerLogicalHeight);3146 marginBeforeValue = miminumValueForLength(marginBefore, containerLogicalHeight); 3147 marginAfterValue = miminumValueForLength(marginAfter, containerLogicalHeight); 3148 3148 3149 3149 const LayoutUnit availableSpace = containerLogicalHeight - (marginBeforeValue + marginAfterValue + bordersPlusPadding); … … 3153 3153 // RULE 1: (height is content based, solve of top) 3154 3154 logicalHeightValue = contentLogicalHeight; 3155 logicalTopValue = availableSpace - (logicalHeightValue + logicalBottom.calcValue(containerLogicalHeight));3155 logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight)); 3156 3156 } else if (!logicalTopIsAuto && logicalHeightIsAuto && logicalBottomIsAuto) { 3157 3157 // RULE 3: (height is content based, no need solve of bottom) 3158 logicalTopValue = logicalTop.calcValue(containerLogicalHeight);3158 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); 3159 3159 logicalHeightValue = contentLogicalHeight; 3160 3160 } else if (logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsAuto) { 3161 3161 // RULE 4: (solve of top) 3162 logicalHeightValue = computeContentBoxLogicalHeight( logicalHeightLength.calcValue(containerLogicalHeight));3163 logicalTopValue = availableSpace - (logicalHeightValue + logicalBottom.calcValue(containerLogicalHeight));3162 logicalHeightValue = computeContentBoxLogicalHeight(valueForLength(logicalHeightLength, containerLogicalHeight)); 3163 logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight)); 3164 3164 } else if (!logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) { 3165 3165 // RULE 5: (solve of height) 3166 logicalTopValue = logicalTop.calcValue(containerLogicalHeight);3167 logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTopValue + logicalBottom.calcValue(containerLogicalHeight)));3166 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); 3167 logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTopValue + valueForLength(logicalBottom, containerLogicalHeight))); 3168 3168 } else if (!logicalTopIsAuto && !logicalHeightIsAuto && logicalBottomIsAuto) { 3169 3169 // RULE 6: (no need solve of bottom) 3170 logicalHeightValue = computeContentBoxLogicalHeight( logicalHeightLength.calcValue(containerLogicalHeight));3171 logicalTopValue = logicalTop.calcValue(containerLogicalHeight);3170 logicalHeightValue = computeContentBoxLogicalHeight(valueForLength(logicalHeightLength, containerLogicalHeight)); 3171 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); 3172 3172 } 3173 3173 } … … 3250 3250 ASSERT(!(logicalLeft.isAuto() && logicalRight.isAuto())); 3251 3251 3252 logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);3253 logicalRightValue = logicalRight.calcValue(containerLogicalWidth);3252 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); 3253 logicalRightValue = valueForLength(logicalRight, containerLogicalWidth); 3254 3254 3255 3255 LayoutUnit difference = availableSpace - (logicalLeftValue + logicalRightValue); … … 3274 3274 \*-----------------------------------------------------------------------*/ 3275 3275 } else if (logicalLeft.isAuto()) { 3276 marginLogicalLeftAlias = marginLogicalLeft.calcValue(containerLogicalWidth);3277 marginLogicalRightAlias = marginLogicalRight.calcValue(containerLogicalWidth);3278 logicalRightValue = logicalRight.calcValue(containerLogicalWidth);3276 marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth); 3277 marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth); 3278 logicalRightValue = valueForLength(logicalRight, containerLogicalWidth); 3279 3279 3280 3280 // Solve for 'left' 3281 3281 logicalLeftValue = availableSpace - (logicalRightValue + marginLogicalLeftAlias + marginLogicalRightAlias); 3282 3282 } else if (logicalRight.isAuto()) { 3283 marginLogicalLeftAlias = marginLogicalLeft.calcValue(containerLogicalWidth);3284 marginLogicalRightAlias = marginLogicalRight.calcValue(containerLogicalWidth);3285 logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);3283 marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth); 3284 marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth); 3285 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); 3286 3286 3287 3287 // Solve for 'right' 3288 3288 logicalRightValue = availableSpace - (logicalLeftValue + marginLogicalLeftAlias + marginLogicalRightAlias); 3289 3289 } else if (marginLogicalLeft.isAuto()) { 3290 marginLogicalRightAlias = marginLogicalRight.calcValue(containerLogicalWidth);3291 logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);3292 logicalRightValue = logicalRight.calcValue(containerLogicalWidth);3290 marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth); 3291 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); 3292 logicalRightValue = valueForLength(logicalRight, containerLogicalWidth); 3293 3293 3294 3294 // Solve for 'margin-left' 3295 3295 marginLogicalLeftAlias = availableSpace - (logicalLeftValue + logicalRightValue + marginLogicalRightAlias); 3296 3296 } else if (marginLogicalRight.isAuto()) { 3297 marginLogicalLeftAlias = marginLogicalLeft.calcValue(containerLogicalWidth);3298 logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);3299 logicalRightValue = logicalRight.calcValue(containerLogicalWidth);3297 marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth); 3298 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); 3299 logicalRightValue = valueForLength(logicalRight, containerLogicalWidth); 3300 3300 3301 3301 // Solve for 'margin-right' … … 3303 3303 } else { 3304 3304 // Nothing is 'auto', just calculate the values. 3305 marginLogicalLeftAlias = marginLogicalLeft.calcValue(containerLogicalWidth);3306 marginLogicalRightAlias = marginLogicalRight.calcValue(containerLogicalWidth);3307 logicalRightValue = logicalRight.calcValue(containerLogicalWidth);3308 logicalLeftValue = logicalLeft.calcValue(containerLogicalWidth);3305 marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerLogicalWidth); 3306 marginLogicalRightAlias = valueForLength(marginLogicalRight, containerLogicalWidth); 3307 logicalRightValue = valueForLength(logicalRight, containerLogicalWidth); 3308 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); 3309 3309 // If the containing block is right-to-left, then push the left position as far to the right as possible 3310 3310 if (containerDirection == RTL) { … … 3412 3412 ASSERT(!(logicalTop.isAuto() || logicalBottom.isAuto())); 3413 3413 3414 logicalTopValue = logicalTop.calcValue(containerLogicalHeight);3415 logicalBottomValue = logicalBottom.calcValue(containerLogicalHeight);3414 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); 3415 logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight); 3416 3416 3417 3417 LayoutUnit difference = availableSpace - (logicalTopValue + logicalBottomValue); … … 3425 3425 \*-----------------------------------------------------------------------*/ 3426 3426 } else if (logicalTop.isAuto()) { 3427 marginBeforeAlias = marginBefore.calcValue(containerLogicalHeight);3428 marginAfterAlias = marginAfter.calcValue(containerLogicalHeight);3429 logicalBottomValue = logicalBottom.calcValue(containerLogicalHeight);3427 marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight); 3428 marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight); 3429 logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight); 3430 3430 3431 3431 // Solve for 'top' 3432 3432 logicalTopValue = availableSpace - (logicalBottomValue + marginBeforeAlias + marginAfterAlias); 3433 3433 } else if (logicalBottom.isAuto()) { 3434 marginBeforeAlias = marginBefore.calcValue(containerLogicalHeight);3435 marginAfterAlias = marginAfter.calcValue(containerLogicalHeight);3436 logicalTopValue = logicalTop.calcValue(containerLogicalHeight);3434 marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight); 3435 marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight); 3436 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); 3437 3437 3438 3438 // Solve for 'bottom' … … 3440 3440 // use the value. 3441 3441 } else if (marginBefore.isAuto()) { 3442 marginAfterAlias = marginAfter.calcValue(containerLogicalHeight);3443 logicalTopValue = logicalTop.calcValue(containerLogicalHeight);3444 logicalBottomValue = logicalBottom.calcValue(containerLogicalHeight);3442 marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight); 3443 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); 3444 logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight); 3445 3445 3446 3446 // Solve for 'margin-top' 3447 3447 marginBeforeAlias = availableSpace - (logicalTopValue + logicalBottomValue + marginAfterAlias); 3448 3448 } else if (marginAfter.isAuto()) { 3449 marginBeforeAlias = marginBefore.calcValue(containerLogicalHeight);3450 logicalTopValue = logicalTop.calcValue(containerLogicalHeight);3451 logicalBottomValue = logicalBottom.calcValue(containerLogicalHeight);3449 marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight); 3450 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); 3451 logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight); 3452 3452 3453 3453 // Solve for 'margin-bottom' … … 3455 3455 } else { 3456 3456 // Nothing is 'auto', just calculate the values. 3457 marginBeforeAlias = marginBefore.calcValue(containerLogicalHeight);3458 marginAfterAlias = marginAfter.calcValue(containerLogicalHeight);3459 logicalTopValue = logicalTop.calcValue(containerLogicalHeight);3457 marginBeforeAlias = valueForLength(marginBefore, containerLogicalHeight); 3458 marginAfterAlias = valueForLength(marginAfter, containerLogicalHeight); 3459 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); 3460 3460 // NOTE: It is not necessary to solve for 'bottom' because we don't ever 3461 3461 // use the value. -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r111066 r111126 438 438 RenderBlock* cb = containingBlock(); 439 439 if (!style()->right().isAuto() && !cb->style()->isLeftToRightDirection()) 440 return - style()->right().calcValue(cb->availableWidth());441 return offset + style()->left().calcValue(cb->availableWidth());440 return -valueForLength(style()->right(), cb->availableWidth()); 441 return offset + valueForLength(style()->left(), cb->availableWidth()); 442 442 } 443 443 if (!style()->right().isAuto()) { 444 444 RenderBlock* cb = containingBlock(); 445 return offset + - style()->right().calcValue(cb->availableWidth());445 return offset + -valueForLength(style()->right(), cb->availableWidth()); 446 446 } 447 447 return offset; … … 463 463 || !style()->top().isPercent() 464 464 || containingBlock->stretchesToViewport())) 465 return offset + style()->top().calcValue(containingBlock->availableHeight());465 return offset + valueForLength(style()->top(), containingBlock->availableHeight()); 466 466 467 467 if (!style()->bottom().isAuto() … … 469 469 || !style()->bottom().isPercent() 470 470 || containingBlock->stretchesToViewport())) 471 return offset + - style()->bottom().calcValue(containingBlock->availableHeight());471 return offset + -valueForLength(style()->bottom(), containingBlock->availableHeight()); 472 472 473 473 return offset; … … 557 557 if (padding.isPercent()) 558 558 w = containingBlock()->availableLogicalWidth(); 559 return padding.calcMinValue(w);559 return miminumValueForLength(padding, w); 560 560 } 561 561 … … 566 566 if (padding.isPercent()) 567 567 w = containingBlock()->availableLogicalWidth(); 568 return padding.calcMinValue(w);568 return miminumValueForLength(padding, w); 569 569 } 570 570 … … 575 575 if (padding.isPercent()) 576 576 w = containingBlock()->availableLogicalWidth(); 577 return padding.calcMinValue(w);577 return miminumValueForLength(padding, w); 578 578 } 579 579 … … 584 584 if (padding.isPercent()) 585 585 w = containingBlock()->availableLogicalWidth(); 586 return padding.calcMinValue(w);586 return miminumValueForLength(padding, w); 587 587 } 588 588 … … 593 593 if (padding.isPercent()) 594 594 w = containingBlock()->availableLogicalWidth(); 595 return padding.calcMinValue(w);595 return miminumValueForLength(padding, w); 596 596 } 597 597 … … 602 602 if (padding.isPercent()) 603 603 w = containingBlock()->availableLogicalWidth(); 604 return padding.calcMinValue(w);604 return miminumValueForLength(padding, w); 605 605 } 606 606 … … 611 611 if (padding.isPercent()) 612 612 w = containingBlock()->availableLogicalWidth(); 613 return padding.calcMinValue(w);613 return miminumValueForLength(padding, w); 614 614 } 615 615 … … 620 620 if (padding.isPercent()) 621 621 w = containingBlock()->availableLogicalWidth(); 622 return padding.calcMinValue(w);622 return miminumValueForLength(padding, w); 623 623 } 624 624 … … 999 999 w = layerWidth.value(); 1000 1000 else if (layerWidth.isPercent()) 1001 w = layerWidth.calcValue(positioningAreaSize.width());1001 w = valueForLength(layerWidth, positioningAreaSize.width()); 1002 1002 1003 1003 if (layerHeight.isFixed()) 1004 1004 h = layerHeight.value(); 1005 1005 else if (layerHeight.isPercent()) 1006 h = layerHeight.calcValue(positioningAreaSize.height());1006 h = valueForLength(layerHeight, positioningAreaSize.height()); 1007 1007 1008 1008 // If one of the values is auto we have to use the appropriate … … 1140 1140 EFillRepeat backgroundRepeatY = fillLayer->repeatY(); 1141 1141 1142 LayoutUnit xPosition = fillLayer->xPosition().calcMinValue(positioningAreaSize.width() - geometry.tileSize().width(), true);1142 LayoutUnit xPosition = miminumValueForLength(fillLayer->xPosition(), positioningAreaSize.width() - geometry.tileSize().width(), true); 1143 1143 if (backgroundRepeatX == RepeatFill) 1144 1144 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - (xPosition + left) % geometry.tileSize().width() : 0); … … 1146 1146 geometry.setNoRepeatX(xPosition + left); 1147 1147 1148 LayoutUnit yPosition = fillLayer->yPosition().calcMinValue(positioningAreaSize.height() - geometry.tileSize().height(), true);1148 LayoutUnit yPosition = miminumValueForLength(fillLayer->yPosition(), positioningAreaSize.height() - geometry.tileSize().height(), true); 1149 1149 if (backgroundRepeatY == RepeatFill) 1150 1150 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - (yPosition + top) % geometry.tileSize().height() : 0); … … 1165 1165 if (borderSlice.isAuto()) 1166 1166 return imageSide; 1167 return borderSlice.calcValue(boxExtent);1167 return valueForLength(borderSlice, boxExtent); 1168 1168 } 1169 1169 … … 1203 1203 int imageHeight = imageSize.height() / style->effectiveZoom(); 1204 1204 1205 int topSlice = min<int>(imageHeight, ninePieceImage.imageSlices().top().calcValue(imageHeight));1206 int rightSlice = min<int>(imageWidth, ninePieceImage.imageSlices().right().calcValue(imageWidth));1207 int bottomSlice = min<int>(imageHeight, ninePieceImage.imageSlices().bottom().calcValue(imageHeight));1208 int leftSlice = min<int>(imageWidth, ninePieceImage.imageSlices().left().calcValue(imageWidth));1205 int topSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().top(), imageHeight)); 1206 int rightSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().right(), imageWidth)); 1207 int bottomSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().bottom(), imageHeight)); 1208 int leftSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().left(), imageWidth)); 1209 1209 1210 1210 ENinePieceImageRule hRule = ninePieceImage.horizontalRule(); -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r111103 r111126 574 574 return mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child); 575 575 } 576 return m ainAxisLength.calcMinValue(mainAxisContentExtent());576 return miminumValueForLength(mainAxisLength, mainAxisContentExtent()); 577 577 } 578 578 … … 681 681 // computes the start/end margins. 682 682 if (isHorizontalFlow()) { 683 child->setMarginLeft( child->style()->marginLeft().calcMinValue(flexboxAvailableContentExtent));684 child->setMarginRight( child->style()->marginRight().calcMinValue(flexboxAvailableContentExtent));683 child->setMarginLeft(miminumValueForLength(child->style()->marginLeft(), flexboxAvailableContentExtent)); 684 child->setMarginRight(miminumValueForLength(child->style()->marginRight(), flexboxAvailableContentExtent)); 685 685 } else { 686 child->setMarginTop( child->style()->marginTop().calcMinValue(flexboxAvailableContentExtent));687 child->setMarginBottom( child->style()->marginBottom().calcMinValue(flexboxAvailableContentExtent));686 child->setMarginTop(miminumValueForLength(child->style()->marginTop(), flexboxAvailableContentExtent)); 687 child->setMarginBottom(miminumValueForLength(child->style()->marginBottom(), flexboxAvailableContentExtent)); 688 688 } 689 689 } … … 759 759 760 760 Length childLogicalMaxWidth = isHorizontalFlow() ? child->style()->maxWidth() : child->style()->maxHeight(); 761 if (childLogicalMaxWidth.isSpecified() && childPreferredSize > childLogicalMaxWidth.calcValue(flexboxAvailableContentExtent)) {762 childPreferredSize = childLogicalMaxWidth.calcValue(flexboxAvailableContentExtent);761 if (childLogicalMaxWidth.isSpecified() && childPreferredSize > valueForLength(childLogicalMaxWidth, flexboxAvailableContentExtent)) { 762 childPreferredSize = valueForLength(childLogicalMaxWidth, flexboxAvailableContentExtent); 763 763 availableFreeSpace -= childPreferredSize - preferredMainAxisContentExtentForChild(child); 764 764 totalPositiveFlexibility -= positiveFlexForChild(child); … … 771 771 772 772 Length childLogicalMinWidth = isHorizontalFlow() ? child->style()->minWidth() : child->style()->minHeight(); 773 if (childLogicalMinWidth.isSpecified() && childPreferredSize < childLogicalMinWidth.calcValue(flexboxAvailableContentExtent)) {774 childPreferredSize = childLogicalMinWidth.calcValue(flexboxAvailableContentExtent);773 if (childLogicalMinWidth.isSpecified() && childPreferredSize < valueForLength(childLogicalMinWidth, flexboxAvailableContentExtent)) { 774 childPreferredSize = valueForLength(childLogicalMinWidth, flexboxAvailableContentExtent); 775 775 availableFreeSpace += preferredMainAxisContentExtentForChild(child) - childPreferredSize; 776 776 totalNegativeFlexibility -= negativeFlexForChild(child); -
trunk/Source/WebCore/rendering/RenderFrameSet.cpp
r107889 r111126 224 224 // Count the number of columns/rows which are percentages -> countPercent 225 225 if (grid[i].isPercent()) { 226 gridLayout[i] = max( grid[i].calcValue(availableLen), 0);226 gridLayout[i] = max(valueForLength(grid[i], availableLen), 0); 227 227 totalPercent += gridLayout[i]; 228 228 countPercent++; -
trunk/Source/WebCore/rendering/RenderInline.cpp
r110643 r111126 702 702 return margin.value(); 703 703 if (margin.isPercent()) 704 return m argin.calcMinValue(max<LayoutUnit>(0, renderer->containingBlock()->availableLogicalWidth()));704 return miminumValueForLength(margin, max<LayoutUnit>(0, renderer->containingBlock()->availableLogicalWidth())); 705 705 return 0; 706 706 } -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r110629 r111126 821 821 const float boxHeight = borderBox.height(); 822 822 823 float perspectiveOriginX = style->perspectiveOriginX().calcFloatValue(boxWidth);824 float perspectiveOriginY = style->perspectiveOriginY().calcFloatValue(boxHeight);823 float perspectiveOriginX = floatValueForLength(style->perspectiveOriginX(), boxWidth); 824 float perspectiveOriginY = floatValueForLength(style->perspectiveOriginY(), boxHeight); 825 825 826 826 // A perspective origin of 0,0 makes the vanishing point in the center of the element. … … 845 845 RenderStyle* style = renderer()->style(); 846 846 847 return FloatPoint( style->perspectiveOriginX().calcFloatValue(borderBox.width()),848 style->perspectiveOriginY().calcFloatValue(borderBox.height()));847 return FloatPoint(floatValueForLength(style->perspectiveOriginX(), borderBox.width()), 848 floatValueForLength(style->perspectiveOriginY(), borderBox.height())); 849 849 } 850 850 -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r110646 r111126 1006 1006 1007 1007 FloatPoint3D origin; 1008 origin.setX( style->transformOriginX().calcFloatValue(borderBox.width()));1009 origin.setY( style->transformOriginY().calcFloatValue(borderBox.height()));1008 origin.setX(floatValueForLength(style->transformOriginX(), borderBox.width())); 1009 origin.setY(floatValueForLength(style->transformOriginY(), borderBox.height())); 1010 1010 origin.setZ(style->transformOriginZ()); 1011 1011 … … 1021 1021 1022 1022 FloatPoint origin; 1023 origin.setX( style->perspectiveOriginX().calcFloatValue(boxWidth));1024 origin.setY( style->perspectiveOriginY().calcFloatValue(boxHeight));1023 origin.setX(floatValueForLength(style->perspectiveOriginX(), boxWidth)); 1024 origin.setY(floatValueForLength(style->perspectiveOriginY(), boxHeight)); 1025 1025 1026 1026 return origin; -
trunk/Source/WebCore/rendering/RenderMarquee.cpp
r107880 r111126 290 290 bool positive = range > 0; 291 291 int clientSize = (isHorizontal() ? m_layer->renderBox()->clientWidth() : m_layer->renderBox()->clientHeight()); 292 int increment = abs( m_layer->renderer()->style()->marqueeIncrement().calcValue(clientSize));292 int increment = abs(valueForLength(m_layer->renderer()->style()->marqueeIncrement(), clientSize)); 293 293 int currentPos = (isHorizontal() ? m_layer->scrollXOffset() : m_layer->scrollYOffset()); 294 294 newPos = currentPos + (addIncrement ? increment : -increment); -
trunk/Source/WebCore/rendering/RenderMenuList.cpp
r110405 r111126 162 162 float optionWidth = 0; 163 163 if (RenderStyle* optionStyle = element->renderStyle()) 164 optionWidth += optionStyle->textIndent().calcMinValue(0);164 optionWidth += miminumValueForLength(optionStyle->textIndent(), 0); 165 165 if (!text.isEmpty()) 166 166 optionWidth += style()->font().width(text); -
trunk/Source/WebCore/rendering/RenderObject.cpp
r111082 r111126 1446 1446 int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0; 1447 1447 LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : zeroLayoutUnit; 1448 LayoutUnit borderWidth = max<LayoutUnit>(-outlineStyle->outlineOffset(), max<LayoutUnit>(borderRight, max<LayoutUnit>( style()->borderTopRightRadius().width().calcValue(boxWidth), style()->borderBottomRightRadius().width().calcValue(boxWidth)))) + max<LayoutUnit>(ow, shadowRight);1448 LayoutUnit borderWidth = max<LayoutUnit>(-outlineStyle->outlineOffset(), max<LayoutUnit>(borderRight, max<LayoutUnit>(valueForLength(style()->borderTopRightRadius().width(), boxWidth), valueForLength(style()->borderBottomRightRadius().width(), boxWidth)))) + max<LayoutUnit>(ow, shadowRight); 1449 1449 LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth, 1450 1450 newOutlineBox.y(), … … 1465 1465 int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0; 1466 1466 LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : zeroLayoutUnit; 1467 LayoutUnit borderHeight = max<LayoutUnit>(-outlineStyle->outlineOffset(), max<LayoutUnit>(borderBottom, max<LayoutUnit>( style()->borderBottomLeftRadius().height().calcValue(boxHeight), style()->borderBottomRightRadius().height().calcValue(boxHeight)))) + max<LayoutUnit>(ow, shadowBottom);1467 LayoutUnit borderHeight = max<LayoutUnit>(-outlineStyle->outlineOffset(), max<LayoutUnit>(borderBottom, max<LayoutUnit>(valueForLength(style()->borderBottomLeftRadius().height(), boxHeight), valueForLength(style()->borderBottomRightRadius().height(), boxHeight)))) + max<LayoutUnit>(ow, shadowBottom); 1468 1468 LayoutRect bottomRect(newOutlineBox.x(), 1469 1469 min(newOutlineBox.maxY(), oldOutlineBox.maxY()) - borderHeight, -
trunk/Source/WebCore/rendering/RenderReplaced.cpp
r110323 r111126 336 336 337 337 // This solves above equation for 'width' (== logicalWidth). 338 LayoutUnit marginStart = style()->marginStart().calcMinValue(logicalWidth);339 LayoutUnit marginEnd = style()->marginEnd().calcMinValue(logicalWidth);338 LayoutUnit marginStart = miminumValueForLength(style()->marginStart(), logicalWidth); 339 LayoutUnit marginEnd = miminumValueForLength(style()->marginEnd(), logicalWidth); 340 340 logicalWidth = max(0, logicalWidth - (marginStart + marginEnd + (width() - clientWidth()))); 341 341 if (isPercentageIntrinsicSize) -
trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp
r109785 r111126 84 84 if (l.isIntrinsicOrAuto()) 85 85 return ScrollbarTheme::theme()->scrollbarThickness(); 86 return l.calcMinValue(containingLength);86 return miminumValueForLength(l, containingLength); 87 87 } 88 88 … … 98 98 99 99 // Buttons and track pieces can all have margins along the axis of the scrollbar. 100 m_marginLeft = style()->marginLeft().calcMinValue(visibleSize);101 m_marginRight = style()->marginRight().calcMinValue(visibleSize);100 m_marginLeft = miminumValueForLength(style()->marginLeft(), visibleSize); 101 m_marginRight = miminumValueForLength(style()->marginRight(), visibleSize); 102 102 } 103 103 … … 113 113 114 114 // Buttons and track pieces can all have margins along the axis of the scrollbar. 115 m_marginTop = style()->marginTop().calcMinValue(visibleSize);116 m_marginBottom = style()->marginBottom().calcMinValue(visibleSize);115 m_marginTop = miminumValueForLength(style()->marginTop(), visibleSize); 116 m_marginBottom = miminumValueForLength(style()->marginBottom(), visibleSize); 117 117 } 118 118 -
trunk/Source/WebCore/rendering/RenderTable.cpp
r109785 r111126 233 233 else { 234 234 // Subtract out any fixed margins from our available width for auto width tables. 235 LayoutUnit marginStart = style()->marginStart().calcMinValue(availableLogicalWidth);236 LayoutUnit marginEnd = style()->marginEnd().calcMinValue(availableLogicalWidth);235 LayoutUnit marginStart = miminumValueForLength(style()->marginStart(), availableLogicalWidth); 236 LayoutUnit marginEnd = miminumValueForLength(style()->marginEnd(), availableLogicalWidth); 237 237 LayoutUnit marginTotal = marginStart + marginEnd; 238 238 … … 262 262 computeInlineDirectionMargins(cb, availableLogicalWidth, logicalWidth()); 263 263 else { 264 setMarginStart( style()->marginStart().calcMinValue(availableLogicalWidth));265 setMarginEnd( style()->marginEnd().calcMinValue(availableLogicalWidth));264 setMarginStart(miminumValueForLength(style()->marginStart(), availableLogicalWidth)); 265 setMarginEnd(miminumValueForLength(style()->marginEnd(), availableLogicalWidth)); 266 266 } 267 267 } … … 277 277 borders = borderStart() + borderEnd() + (collapseBorders() ? 0 : paddingStart() + paddingEnd()); 278 278 } 279 return styleLogicalWidth.calcMinValue(availableWidth) + borders;279 return miminumValueForLength(styleLogicalWidth, availableWidth) + borders; 280 280 } 281 281 -
trunk/Source/WebCore/rendering/RenderTableCell.cpp
r109818 r111126 96 96 LayoutUnit adjustedLogicalHeight = logicalHeight() - (intrinsicPaddingBefore() + intrinsicPaddingAfter()); 97 97 98 LayoutUnit styleLogicalHeight = style()->logicalHeight().calcValue(0);98 LayoutUnit styleLogicalHeight = valueForLength(style()->logicalHeight(), 0); 99 99 if (document()->inQuirksMode() || style()->boxSizing() == BORDER_BOX) { 100 100 // Explicit heights use the border box in quirks mode. -
trunk/Source/WebCore/rendering/RenderTableSection.cpp
r110336 r111126 339 339 340 340 // Our base size is the biggest logical height from our cells' styles (excluding row spanning cells). 341 m_rowPos[r + 1] = max(m_rowPos[r] + m _grid[r].logicalHeight.calcMinValue(0), 0);341 m_rowPos[r + 1] = max(m_rowPos[r] + miminumValueForLength(m_grid[r].logicalHeight, 0), 0); 342 342 343 343 Row& row = m_grid[r].row; -
trunk/Source/WebCore/rendering/RenderText.h
r110224 r111126 98 98 virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0); 99 99 100 virtual LayoutUnit marginLeft() const { return style()->marginLeft().calcMinValue(0); }101 virtual LayoutUnit marginRight() const { return style()->marginRight().calcMinValue(0); }100 virtual LayoutUnit marginLeft() const { return miminumValueForLength(style()->marginLeft(), 0); } 101 virtual LayoutUnit marginRight() const { return miminumValueForLength(style()->marginRight(), 0); } 102 102 103 103 virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const; -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r109785 r111126 845 845 verticalPosition += -renderer->lineHeight(firstLine, lineDirection) / 2 + renderer->baselinePosition(baselineType(), firstLine, lineDirection); 846 846 else if (verticalAlign == LENGTH) 847 verticalPosition -= renderer->style()->verticalAlignLength().calcValue(renderer->lineHeight(firstLine, lineDirection));847 verticalPosition -= valueForLength(renderer->style()->verticalAlignLength(), renderer->lineHeight(firstLine, lineDirection)); 848 848 } 849 849 -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r111076 r111126 803 803 804 804 if (applyTransformOrigin) 805 transform.translate3d( transformOriginX().calcFloatValue(borderBoxSize.width()), transformOriginY().calcFloatValue(borderBoxSize.height()), transformOriginZ());805 transform.translate3d(floatValueForLength(transformOriginX(), borderBoxSize.width()), floatValueForLength(transformOriginY(), borderBoxSize.height()), transformOriginZ()); 806 806 807 807 unsigned size = transformOperations.size(); … … 810 810 811 811 if (applyTransformOrigin) 812 transform.translate3d(- transformOriginX().calcFloatValue(borderBoxSize.width()), -transformOriginY().calcFloatValue(borderBoxSize.height()), -transformOriginZ());812 transform.translate3d(-floatValueForLength(transformOriginX(), borderBoxSize.width()), -floatValueForLength(transformOriginY(), borderBoxSize.height()), -transformOriginZ()); 813 813 } 814 814 … … 822 822 823 823 if (applyTransformOrigin) { 824 transform.translate3d( transformOriginX().calcFloatValue(boundingBox.width()) + offsetX,825 transformOriginY().calcFloatValue(boundingBox.height()) + offsetY,824 transform.translate3d(floatValueForLength(transformOriginX(), boundingBox.width()) + offsetX, 825 floatValueForLength(transformOriginY(), boundingBox.height()) + offsetY, 826 826 transformOriginZ()); 827 827 } … … 832 832 833 833 if (applyTransformOrigin) { 834 transform.translate3d(- transformOriginX().calcFloatValue(boundingBox.width()) - offsetX,835 - transformOriginY().calcFloatValue(boundingBox.height()) - offsetY,834 transform.translate3d(-floatValueForLength(transformOriginX(), boundingBox.width()) - offsetX, 835 -floatValueForLength(transformOriginY(), boundingBox.height()) - offsetY, 836 836 -transformOriginZ()); 837 837 } … … 878 878 { 879 879 return RoundedRect::Radii( 880 IntSize( border.topLeft().width().calcValue(size.width()),881 border.topLeft().height().calcValue(size.height())),882 IntSize( border.topRight().width().calcValue(size.width()),883 border.topRight().height().calcValue(size.height())),884 IntSize( border.bottomLeft().width().calcValue(size.width()),885 border.bottomLeft().height().calcValue(size.height())),886 IntSize( border.bottomRight().width().calcValue(size.width()),887 border.bottomRight().height().calcValue(size.height())));880 IntSize(valueForLength(border.topLeft().width(), size.width()), 881 valueForLength(border.topLeft().height(), size.height())), 882 IntSize(valueForLength(border.topRight().width(), size.width()), 883 valueForLength(border.topRight().height(), size.height())), 884 IntSize(valueForLength(border.bottomLeft().width(), size.width()), 885 valueForLength(border.bottomLeft().height(), size.height())), 886 IntSize(valueForLength(border.bottomRight().width(), size.width()), 887 valueForLength(border.bottomRight().height(), size.height()))); 888 888 } 889 889 -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r111076 r111126 40 40 #include "Length.h" 41 41 #include "LengthBox.h" 42 #include "LengthFunctions.h" 42 43 #include "LengthSize.h" 43 44 #include "LineClampValue.h" … … 631 632 632 633 if (lh.isPercent()) 633 return lh.calcMinValue(fontSize());634 return miminumValueForLength(lh, fontSize()); 634 635 635 636 return lh.value(); -
trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp
r110285 r111126 88 88 if (intrinsicWidthAttribute.isFixed() || intrinsicHeightAttribute.isFixed()) { 89 89 if (intrinsicWidthAttribute.isFixed()) 90 intrinsicSize.setWidth( intrinsicWidthAttribute.calcFloatValue(0));90 intrinsicSize.setWidth(floatValueForLength(intrinsicWidthAttribute, 0)); 91 91 if (intrinsicHeightAttribute.isFixed()) 92 intrinsicSize.setHeight( intrinsicHeightAttribute.calcFloatValue(0));92 intrinsicSize.setHeight(floatValueForLength(intrinsicHeightAttribute, 0)); 93 93 if (!intrinsicSize.isEmpty()) 94 94 intrinsicRatio = intrinsicSize.width() / static_cast<double>(intrinsicSize.height()); … … 154 154 static inline LayoutUnit resolveLengthAttributeForSVG(const Length& length, float scale, float maxSize) 155 155 { 156 return static_cast<LayoutUnit>( length.calcValue(maxSize) * (length.isFixed() ? scale : 1));156 return static_cast<LayoutUnit>(valueForLength(length, maxSize) * (length.isFixed() ? scale : 1)); 157 157 } 158 158 -
trunk/Source/WebCore/svg/SVGSVGElement.cpp
r108441 r111126 542 542 // If no viewBox is specified but non-relative width/height values, then we 543 543 // should always synthesize a viewBox if we're embedded through a SVGImage. 544 return FloatRect(FloatPoint(), FloatSize( intrinsicWidth.calcFloatValue(0), intrinsicHeight.calcFloatValue(0)));544 return FloatRect(FloatPoint(), FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0))); 545 545 } 546 546 … … 550 550 Length intrinsicHeight = this->intrinsicHeight(); 551 551 if (intrinsicWidth.isFixed() && intrinsicHeight.isFixed()) 552 return FloatSize( intrinsicWidth.calcFloatValue(0), intrinsicHeight.calcFloatValue(0));552 return FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0)); 553 553 554 554 if (!renderer()) -
trunk/Source/WebCore/svg/graphics/SVGImage.cpp
r110581 r111126 294 294 intrinsicRatio = rootElement->viewBox().size(); 295 295 if (intrinsicRatio.isEmpty() && intrinsicWidth.isFixed() && intrinsicHeight.isFixed()) 296 intrinsicRatio = FloatSize( intrinsicWidth.calcFloatValue(0), intrinsicHeight.calcFloatValue(0));296 intrinsicRatio = FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0)); 297 297 } 298 298 -
trunk/Source/WebKit2/ChangeLog
r111125 r111126 1 2012-03-17 Joe Thomas <joethomas@motorola.com> 2 3 move calc*Value functions out from Length (and platform) 4 https://bugs.webkit.org/show_bug.cgi?id=80897 5 6 Moving the Length calc*Value functions out from Length structure and also from /WebCore/platform/ folder. 7 This helps to avoid the layering violation while length calculation. Otherwise layer violation can be avoided only by adding a virtual interface(bug 27160). 8 9 Reviewed by Antti Koivisto. 10 11 * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp: 12 (WebKit::WebPopupMenu::setUpPlatformData): 13 1 14 2012-03-17 Dan Bernstein <mitz@apple.com> 2 15 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp
r95901 r111126 30 30 #include <WebCore/Font.h> 31 31 #include <WebCore/GraphicsContext.h> 32 #include <WebCore/LengthFunctions.h> 32 33 #include <WebCore/TextRun.h> 33 34 #include <WebCore/PopupMenuClient.h> … … 136 137 int textX = std::max(0, data.m_clientPaddingLeft - data.m_clientInsetLeft); 137 138 if (RenderTheme::defaultTheme()->popupOptionSupportsTextIndent() && itemStyle.textDirection() == LTR) 138 textX += itemStyle.textIndent().calcMinValue(itemRect.width());139 textX += miminumValueForLength(itemStyle.textIndent(), itemRect.width()); 139 140 int textY = itemRect.y() + itemFont.fontMetrics().ascent() + (itemRect.height() - itemFont.fontMetrics().height()) / 2; 140 141
Note: See TracChangeset
for help on using the changeset viewer.