| Differences between
and this patch
- a/Source/WebCore/ChangeLog +354 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2013-03-11  Timothy Loh  <timloh@chromium.org>
2
3
        viewport units (vw, vh) don't work in CSS transforms
4
        https://bugs.webkit.org/show_bug.cgi?id=91554
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        WIP.
9
        Change optional RenderView* parameter in valueForLength functions to a const IntSize&.
10
        Add equivalent valueForLength functions to RenderObject which call the regular ones,
11
        so we don't have to compute the viewportSize all the time.
12
13
        No new tests (OOPS!).
14
15
        * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
16
        (getAttributeSetForAccessibilityObject):
17
        * css/CSSCalculationValue.cpp:
18
        (WebCore::unitCategory):
19
        (WebCore::CSSCalcValue::computeLengthPx):
20
        (WebCore::CSSCalcPrimitiveValue::toCalcValue):
21
        (WebCore::CSSCalcPrimitiveValue::computeLengthPx):
22
        (WebCore::CSSCalcBinaryOperation::computeLengthPx):
23
        * css/CSSCalculationValue.h:
24
        (CSSCalcValue):
25
        * css/CSSComputedStyleDeclaration.cpp:
26
        (WebCore::getPositionOffsetValue):
27
        (WebCore::getBorderRadiusCornerValues):
28
        (WebCore::getBorderRadiusCornerValue):
29
        (WebCore::getBorderRadiusShorthandValue):
30
        (WebCore::computedTransform):
31
        (WebCore::valueForCustomFilterTransformParameter):
32
        (WebCore::valueForGridTrackBreadth):
33
        (WebCore::valueForGridTrackMinMax):
34
        (WebCore::valueForGridTrackGroup):
35
        (WebCore::valueForGridTrackList):
36
        (WebCore::lineHeightFromStyle):
37
        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
38
        * css/CSSGradientValue.cpp:
39
        (WebCore::CSSGradientValue::addStops):
40
        (WebCore::positionFromValue):
41
        (WebCore::CSSGradientValue::computeEndPoint):
42
        (WebCore::CSSLinearGradientValue::createGradient):
43
        (WebCore::CSSRadialGradientValue::resolveRadius):
44
        (WebCore::CSSRadialGradientValue::createGradient):
45
        * css/CSSGradientValue.h:
46
        (CSSGradientValue):
47
        (CSSRadialGradientValue):
48
        * css/CSSPrimitiveValue.cpp:
49
        (WebCore::CSSPrimitiveValue::computeLength):
50
        (WebCore::CSSPrimitiveValue::computeLengthDouble):
51
        (WebCore::CSSPrimitiveValue::equals):
52
        * css/CSSPrimitiveValue.h:
53
        (CSSPrimitiveValue):
54
        * css/CSSPrimitiveValueMappings.h:
55
        (WebCore::CSSPrimitiveValue::convertToLength):
56
        * css/CSSToStyleMap.cpp:
57
        (WebCore::CSSToStyleMap::mapFillXPosition):
58
        (WebCore::CSSToStyleMap::mapFillYPosition):
59
        (WebCore::CSSToStyleMap::mapNinePieceImageQuad):
60
        * css/LengthFunctions.cpp:
61
        (WebCore::minimumIntValueForLength):
62
        (WebCore::intValueForLength):
63
        (WebCore::minimumValueForLength):
64
        (WebCore::valueForLength):
65
        (WebCore::floatValueForLength):
66
        * css/LengthFunctions.h:
67
        (WebCore):
68
        * css/MediaQueryEvaluator.cpp:
69
        (WebCore::computeLength):
70
        (WebCore::device_heightMediaFeatureEval):
71
        (WebCore::device_widthMediaFeatureEval):
72
        (WebCore::heightMediaFeatureEval):
73
        (WebCore::widthMediaFeatureEval):
74
        * css/SVGCSSStyleSelector.cpp:
75
        (WebCore::StyleResolver::applySVGProperty):
76
        * css/StyleBuilder.cpp:
77
        (WebCore::ApplyPropertyAuto::applyValue):
78
        (WebCore::ApplyPropertyLength::applyValue):
79
        (WebCore::ApplyPropertyBorderRadius::applyValue):
80
        (WebCore::ApplyPropertyComputeLength::applyValue):
81
        (WebCore::ApplyPropertyFontSize::applyValue):
82
        (WebCore::ApplyPropertyLineHeight::applyValue):
83
        (WebCore::ApplyPropertyPageSize::mmLength):
84
        (WebCore::ApplyPropertyPageSize::inchLength):
85
        (WebCore::ApplyPropertyPageSize::applyValue):
86
        * css/StyleResolver.cpp:
87
        (WebCore::StyleResolver::applyProperty):
88
        (WebCore::StyleResolver::createFilterOperations):
89
        * css/StyleResolver.h:
90
        (StyleResolver):
91
        * css/WebKitCSSMatrix.cpp:
92
        (WebCore::WebKitCSSMatrix::setMatrixValue):
93
        * dom/Document.cpp:
94
        (WebCore::Document::pageSizeAndMarginsInPixels):
95
        * html/HTMLAreaElement.cpp:
96
        (WebCore::HTMLAreaElement::getRegion):
97
        * page/animation/CSSPropertyAnimation.cpp:
98
        (WebCore::blendFunc):
99
        * platform/CalculationValue.cpp:
100
        (WebCore::CalcExpressionBinaryOperation::evaluate):
101
        (WebCore::CalculationValue::evaluate):
102
        * platform/CalculationValue.h:
103
        (CalcExpressionNode):
104
        (CalculationValue):
105
        (WebCore::CalcExpressionNumber::evaluate):
106
        (WebCore::CalcExpressionLength::evaluate):
107
        (CalcExpressionBinaryOperation):
108
        (WebCore::CalcExpressionBlendLength::evaluate):
109
        * platform/Length.cpp:
110
        (WebCore::Length::nonNanCalculatedValue):
111
        * platform/Length.h:
112
        (Length):
113
        * platform/graphics/GraphicsLayer.h:
114
        (WebCore::GraphicsLayer::addAnimation):
115
        * platform/graphics/GraphicsLayerAnimation.cpp:
116
        (WebCore::blendFunc):
117
        (WebCore::applyFilterAnimation):
118
        (WebCore::applyTransformAnimation):
119
        (WebCore::GraphicsLayerAnimation::applyInternal):
120
        (WebCore::GraphicsLayerAnimation::apply):
121
        (WebCore::GraphicsLayerAnimations::apply):
122
        * platform/graphics/GraphicsLayerAnimation.h:
123
        (GraphicsLayerAnimation):
124
        (GraphicsLayerAnimations):
125
        * platform/graphics/chromium/AnimationTranslationUtil.cpp:
126
        (WebCore::toWebTransformOperations):
127
        (WebCore::appendKeyframeWithStandardTimingFunction):
128
        (WebCore::appendKeyframeWithCustomBezierTimingFunction):
129
        (WebCore::WebTransformAnimationCurve):
130
        (WebCore::createWebAnimation):
131
        * platform/graphics/chromium/AnimationTranslationUtil.h:
132
        (WebCore):
133
        * platform/graphics/chromium/GraphicsLayerChromium.cpp:
134
        (WebCore::GraphicsLayerChromium::addAnimation):
135
        * platform/graphics/chromium/GraphicsLayerChromium.h:
136
        (GraphicsLayerChromium):
137
        * platform/graphics/filters/CustomFilterArrayParameter.h:
138
        (WebCore::CustomFilterArrayParameter::blend):
139
        * platform/graphics/filters/CustomFilterNumberParameter.h:
140
        (WebCore::CustomFilterNumberParameter::blend):
141
        * platform/graphics/filters/CustomFilterOperation.cpp:
142
        (WebCore::CustomFilterOperation::blend):
143
        * platform/graphics/filters/CustomFilterOperation.h:
144
        (CustomFilterOperation):
145
        * platform/graphics/filters/CustomFilterParameter.h:
146
        (CustomFilterParameter):
147
        * platform/graphics/filters/CustomFilterParameterList.cpp:
148
        (WebCore::CustomFilterParameterList::blend):
149
        * platform/graphics/filters/CustomFilterParameterList.h:
150
        (CustomFilterParameterList):
151
        * platform/graphics/filters/CustomFilterRenderer.cpp:
152
        (WebCore::CustomFilterRenderer::bindProgramTransformParameter):
153
        * platform/graphics/filters/CustomFilterTransformParameter.h:
154
        (WebCore::CustomFilterTransformParameter::blend):
155
        (WebCore::CustomFilterTransformParameter::applyTransform):
156
        * platform/graphics/filters/FilterOperation.h:
157
        (WebCore::FilterOperation::FilterOperation::blend):
158
        * platform/graphics/filters/FilterOperations.cpp:
159
        (WebCore::FilterOperations::outsets):
160
        * platform/graphics/filters/ValidatedCustomFilterOperation.cpp:
161
        (WebCore::ValidatedCustomFilterOperation::blend):
162
        * platform/graphics/filters/ValidatedCustomFilterOperation.h:
163
        (ValidatedCustomFilterOperation):
164
        * platform/graphics/transforms/IdentityTransformOperation.h:
165
        (WebCore::IdentityTransformOperation::apply):
166
        (WebCore::IdentityTransformOperation::blend):
167
        * platform/graphics/transforms/Matrix3DTransformOperation.cpp:
168
        (WebCore::Matrix3DTransformOperation::blend):
169
        * platform/graphics/transforms/Matrix3DTransformOperation.h:
170
        (WebCore::Matrix3DTransformOperation::apply):
171
        (Matrix3DTransformOperation):
172
        * platform/graphics/transforms/MatrixTransformOperation.cpp:
173
        (WebCore::MatrixTransformOperation::blend):
174
        * platform/graphics/transforms/MatrixTransformOperation.h:
175
        (WebCore::MatrixTransformOperation::apply):
176
        (MatrixTransformOperation):
177
        * platform/graphics/transforms/PerspectiveTransformOperation.cpp:
178
        (WebCore::PerspectiveTransformOperation::blend):
179
        * platform/graphics/transforms/PerspectiveTransformOperation.h:
180
        (WebCore::PerspectiveTransformOperation::isIdentity):
181
        (WebCore::PerspectiveTransformOperation::apply):
182
        (PerspectiveTransformOperation):
183
        * platform/graphics/transforms/RotateTransformOperation.cpp:
184
        (WebCore::RotateTransformOperation::blend):
185
        * platform/graphics/transforms/RotateTransformOperation.h:
186
        (WebCore::RotateTransformOperation::apply):
187
        (RotateTransformOperation):
188
        * platform/graphics/transforms/ScaleTransformOperation.cpp:
189
        (WebCore::ScaleTransformOperation::blend):
190
        * platform/graphics/transforms/ScaleTransformOperation.h:
191
        (WebCore::ScaleTransformOperation::apply):
192
        (ScaleTransformOperation):
193
        * platform/graphics/transforms/SkewTransformOperation.cpp:
194
        (WebCore::SkewTransformOperation::blend):
195
        * platform/graphics/transforms/SkewTransformOperation.h:
196
        (WebCore::SkewTransformOperation::apply):
197
        (SkewTransformOperation):
198
        * platform/graphics/transforms/TransformOperation.h:
199
        (TransformOperation):
200
        * platform/graphics/transforms/TransformOperations.cpp:
201
        (WebCore::TransformOperations::blendByMatchingOperations):
202
        (WebCore::TransformOperations::blendByUsingMatrixInterpolation):
203
        (WebCore::TransformOperations::blend):
204
        * platform/graphics/transforms/TransformOperations.h:
205
        (WebCore::TransformOperations::apply):
206
        (TransformOperations):
207
        * platform/graphics/transforms/TranslateTransformOperation.cpp:
208
        (WebCore::TranslateTransformOperation::blend):
209
        * platform/graphics/transforms/TranslateTransformOperation.h:
210
        (WebCore::TranslateTransformOperation::x):
211
        (WebCore::TranslateTransformOperation::y):
212
        (WebCore::TranslateTransformOperation::z):
213
        (WebCore::TranslateTransformOperation::isIdentity):
214
        (WebCore::TranslateTransformOperation::apply):
215
        (TranslateTransformOperation):
216
        * rendering/AutoTableLayout.cpp:
217
        (WebCore::AutoTableLayout::layout):
218
        * rendering/ClipPathOperation.h:
219
        (WebCore::ShapeClipPathOperation::path):
220
        * rendering/ExclusionShape.cpp:
221
        (WebCore::ExclusionShape::createExclusionShape):
222
        * rendering/ExclusionShape.h:
223
        (ExclusionShape):
224
        * rendering/ExclusionShapeInfo.cpp:
225
        (WebCore::::computedShape):
226
        * rendering/FilterEffectRenderer.cpp:
227
        (WebCore::FilterEffectRenderer::build):
228
        * rendering/FixedTableLayout.cpp:
229
        (WebCore::FixedTableLayout::layout):
230
        * rendering/RenderBlock.cpp:
231
        (WebCore::RenderBlock::textIndentOffset):
232
        (WebCore::RenderBlock::computeInlinePreferredLogicalWidths):
233
        * rendering/RenderBox.cpp:
234
        (WebCore::RenderBox::reflectionOffset):
235
        (WebCore::RenderBox::paintBoxDecorations):
236
        (WebCore::RenderBox::pushContentsClip):
237
        (WebCore::RenderBox::clipRect):
238
        (WebCore::RenderBox::computeLogicalWidthInRegion):
239
        (WebCore::RenderBox::fillAvailableMeasure):
240
        (WebCore::RenderBox::computeLogicalWidthInRegionUsing):
241
        (WebCore::RenderBox::computeInlineDirectionMargins):
242
        (WebCore::RenderBox::computeContentAndScrollbarLogicalHeightUsing):
243
        (WebCore::RenderBox::computeReplacedLogicalWidthUsing):
244
        (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
245
        (WebCore::RenderBox::computeBlockDirectionMargins):
246
        (WebCore::RenderBox::computePositionedLogicalWidthUsing):
247
        (WebCore::RenderBox::computePositionedLogicalHeightUsing):
248
        (WebCore::RenderBox::computePositionedLogicalWidthReplaced):
249
        (WebCore::RenderBox::computePositionedLogicalHeightReplaced):
250
        * rendering/RenderBoxModelObject.cpp:
251
        (WebCore::RenderBoxModelObject::relativePositionOffset):
252
        (WebCore::RenderBoxModelObject::computeStickyPositionConstraints):
253
        (WebCore::RenderBoxModelObject::computedCSSPadding):
254
        (WebCore::RenderBoxModelObject::getBackgroundRoundedRect):
255
        (WebCore::RenderBoxModelObject::backgroundRoundedRectAdjustedForBleedAvoidance):
256
        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
257
        (WebCore::RenderBoxModelObject::calculateFillTileSize):
258
        (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
259
        (WebCore::computeBorderImageSide):
260
        (WebCore::RenderBoxModelObject::paintNinePieceImage):
261
        (WebCore::RenderBoxModelObject::paintBorder):
262
        (WebCore::RenderBoxModelObject::drawBoxSideFromPath):
263
        (WebCore::RenderBoxModelObject::paintBoxShadow):
264
        * rendering/RenderFlexibleBox.cpp:
265
        (WebCore::RenderFlexibleBox::computeMainAxisExtentForChild):
266
        (WebCore::RenderFlexibleBox::computeChildMarginValue):
267
        * rendering/RenderGrid.cpp:
268
        (WebCore::RenderGrid::computeUsedBreadthOfSpecifiedLength):
269
        * rendering/RenderInline.cpp:
270
        (WebCore::computeMargin):
271
        * rendering/RenderLayer.cpp:
272
        (WebCore::RenderLayer::updateTransform):
273
        (WebCore::RenderLayer::currentTransform):
274
        (WebCore::RenderLayer::perspectiveTransform):
275
        (WebCore::RenderLayer::perspectiveOrigin):
276
        (WebCore::RenderLayer::clipToRect):
277
        (WebCore::RenderLayer::paintLayerContents):
278
        * rendering/RenderLayerBacking.cpp:
279
        (WebCore::RenderLayerBacking::updateTransform):
280
        (WebCore::RenderLayerBacking::computeTransformOrigin):
281
        (WebCore::RenderLayerBacking::computePerspectiveOrigin):
282
        (WebCore::RenderLayerBacking::startAnimation):
283
        (WebCore::RenderLayerBacking::startTransition):
284
        * rendering/RenderMarquee.cpp:
285
        (WebCore::RenderMarquee::timerFired):
286
        * rendering/RenderMenuList.cpp:
287
        (WebCore::RenderMenuList::updateOptionsWidth):
288
        * rendering/RenderObject.cpp:
289
        (WebCore::RenderObject::repaintAfterLayoutIfNeeded):
290
        (WebCore::optionalViewportSize):
291
        (WebCore):
292
        (WebCore::RenderObject::minimumIntValueForLength):
293
        (WebCore::RenderObject::intValueForLength):
294
        (WebCore::RenderObject::minimumValueForLength):
295
        (WebCore::RenderObject::valueForLength):
296
        (WebCore::RenderObject::floatValueForLength):
297
        * rendering/RenderObject.h:
298
        (RenderObject):
299
        * rendering/RenderReplaced.cpp:
300
        (WebCore::RenderReplaced::paint):
301
        * rendering/RenderScrollbarPart.cpp:
302
        (WebCore::calcScrollbarThicknessUsing):
303
        (WebCore::RenderScrollbarPart::computeScrollbarWidth):
304
        (WebCore::RenderScrollbarPart::computeScrollbarHeight):
305
        * rendering/RenderTable.cpp:
306
        (WebCore::RenderTable::updateLogicalWidth):
307
        (WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth):
308
        (WebCore::RenderTable::convertStyleLogicalHeightToComputedHeight):
309
        * rendering/RenderTableCell.h:
310
        (WebCore::RenderTableCell::logicalHeightForRowSizing):
311
        * rendering/RenderTableSection.cpp:
312
        (WebCore::RenderTableSection::calcRowLogicalHeight):
313
        * rendering/RenderText.h:
314
        (WebCore::RenderText::marginLeft):
315
        (WebCore::RenderText::marginRight):
316
        * rendering/RenderThemeMacShared.mm:
317
        (WebCore::RenderThemeMacShared::paintMenuListButtonGradients):
318
        * rendering/RenderWidget.cpp:
319
        (WebCore::RenderWidget::paint):
320
        * rendering/RootInlineBox.cpp:
321
        (WebCore::RootInlineBox::verticalPositionForBox):
322
        * rendering/style/BasicShapes.cpp:
323
        (WebCore::BasicShapeRectangle::path):
324
        (WebCore::BasicShapeCircle::path):
325
        (WebCore::BasicShapeEllipse::path):
326
        (WebCore::BasicShapePolygon::path):
327
        * rendering/style/BasicShapes.h:
328
        (BasicShapeRectangle):
329
        (BasicShapeCircle):
330
        (BasicShapeEllipse):
331
        (BasicShapePolygon):
332
        * rendering/style/RenderStyle.cpp:
333
        (WebCore::RenderStyle::applyTransform):
334
        (WebCore::calcRadiiFor):
335
        (WebCore::RenderStyle::getRoundedBorderFor):
336
        (WebCore::RenderStyle::getRoundedInnerBorderFor):
337
        (WebCore::RenderStyle::computedLineHeight):
338
        * rendering/style/RenderStyle.h:
339
        * rendering/svg/RenderSVGRoot.cpp:
340
        (WebCore::resolveLengthAttributeForSVG):
341
        (WebCore::RenderSVGRoot::computeReplacedLogicalWidth):
342
        (WebCore::RenderSVGRoot::computeReplacedLogicalHeight):
343
        * rendering/svg/SVGRenderingContext.cpp:
344
        (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
345
        * svg/SVGSVGElement.cpp:
346
        (WebCore::SVGSVGElement::currentViewBoxRect):
347
        (WebCore::SVGSVGElement::currentViewportSize):
348
        * svg/SVGStyledTransformableElement.cpp:
349
        (WebCore::SVGStyledTransformableElement::animatedLocalTransform):
350
        * svg/SVGTextElement.cpp:
351
        (WebCore::SVGTextElement::animatedLocalTransform):
352
        * svg/graphics/SVGImage.cpp:
353
        (WebCore::SVGImage::computeIntrinsicDimensions):
354
1
2013-03-10  Andreas Kling  <akling@apple.com>
355
2013-03-10  Andreas Kling  <akling@apple.com>
2
356
3
        SVGDocumentExtensions should use OwnPtr for pending resource maps.
357
        SVGDocumentExtensions should use OwnPtr for pending resource maps.
- a/Source/WebKit/chromium/ChangeLog +10 lines
Lines 1-3 a/Source/WebKit/chromium/ChangeLog_sec1
1
2013-03-11  Timothy Loh  <timloh@chromium.org>
2
3
        viewport units (vw, vh) don't work in CSS transforms
4
        https://bugs.webkit.org/show_bug.cgi?id=91554
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * tests/AnimationTranslationUtilTest.cpp:
9
        (WebKit::animationCanBeTranslated):
10
1
2013-03-09  Sadrul Habib Chowdhury  <sadrul@chromium.org>
11
2013-03-09  Sadrul Habib Chowdhury  <sadrul@chromium.org>
2
12
3
        [chromium] Remove deprecated flingStart.sourceDevice from WebGestureEvent
13
        [chromium] Remove deprecated flingStart.sourceDevice from WebGestureEvent
- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp -1 / +1 lines
Lines 246-252 static AtkAttributeSet* getAttributeSetForAccessibilityObject(const Accessibilit a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp_sec1
246
    }
246
    }
247
247
248
    if (!style->textIndent().isUndefined()) {
248
    if (!style->textIndent().isUndefined()) {
249
        int indentation = valueForLength(style->textIndent(), object->size().width(), renderer->view());
249
        int indentation = renderer->valueForLength(style->textIndent(), object->size().width(), renderer);
250
        buffer.set(g_strdup_printf("%i", indentation));
250
        buffer.set(g_strdup_printf("%i", indentation));
251
        result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_INDENT), buffer.get());
251
        result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_INDENT), buffer.get());
252
    }
252
    }
- a/Source/WebCore/css/CSSCalculationValue.cpp -8 / +13 lines
Lines 31-36 a/Source/WebCore/css/CSSCalculationValue.cpp_sec1
31
#include "config.h"
31
#include "config.h"
32
#include "CSSCalculationValue.h"
32
#include "CSSCalculationValue.h"
33
33
34
#include "CSSPrimitiveValueMappings.h"
34
#include "CSSValueList.h"
35
#include "CSSValueList.h"
35
#include "Length.h"
36
#include "Length.h"
36
#include "StyleResolver.h"
37
#include "StyleResolver.h"
Lines 68-73 static CalculationCategory unitCategory(CSSPrimitiveValue::UnitTypes type) a/Source/WebCore/css/CSSCalculationValue.cpp_sec2
68
    case CSSPrimitiveValue::CSS_PC:
69
    case CSSPrimitiveValue::CSS_PC:
69
    case CSSPrimitiveValue::CSS_REMS:
70
    case CSSPrimitiveValue::CSS_REMS:
70
    case CSSPrimitiveValue::CSS_CHS:
71
    case CSSPrimitiveValue::CSS_CHS:
72
    case CSSPrimitiveValue::CSS_VW:
73
    case CSSPrimitiveValue::CSS_VH:
74
    case CSSPrimitiveValue::CSS_VMIN:
75
    case CSSPrimitiveValue::CSS_VMAX:
71
        return CalcLength;
76
        return CalcLength;
72
#if ENABLE(CSS_VARIABLES)
77
#if ENABLE(CSS_VARIABLES)
73
    case CSSPrimitiveValue::CSS_VARIABLE_NAME:
78
    case CSSPrimitiveValue::CSS_VARIABLE_NAME:
Lines 128-136 double CSSCalcValue::doubleValue() const a/Source/WebCore/css/CSSCalculationValue.cpp_sec3
128
    return clampToPermittedRange(m_expression->doubleValue());
133
    return clampToPermittedRange(m_expression->doubleValue());
129
}
134
}
130
135
131
double CSSCalcValue::computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier, bool computingFontSize) const
136
double CSSCalcValue::computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, const IntSize& viewportSize, double multiplier, bool computingFontSize) const
132
{
137
{
133
    return clampToPermittedRange(m_expression->computeLengthPx(currentStyle, rootStyle, multiplier, computingFontSize));
138
    return clampToPermittedRange(m_expression->computeLengthPx(currentStyle, rootStyle, viewportSize, multiplier, computingFontSize));
134
}
139
}
135
    
140
    
136
CSSCalcExpressionNode::~CSSCalcExpressionNode() 
141
CSSCalcExpressionNode::~CSSCalcExpressionNode() 
Lines 174-180 public: a/Source/WebCore/css/CSSCalculationValue.cpp_sec4
174
        case CalcNumber:
179
        case CalcNumber:
175
            return adoptPtr(new CalcExpressionNumber(m_value->getFloatValue()));
180
            return adoptPtr(new CalcExpressionNumber(m_value->getFloatValue()));
176
        case CalcLength:
181
        case CalcLength:
177
            return adoptPtr(new CalcExpressionNumber(m_value->computeLength<float>(style, rootStyle, zoom)));
182
            return adoptPtr(new CalcExpressionLength(m_value->convertToLength<AnyConversion & ~FixedIntegerConversion>(style, rootStyle, zoom)));
178
        case CalcPercent:
183
        case CalcPercent:
179
        case CalcPercentLength:
184
        case CalcPercentLength:
180
            return adoptPtr(new CalcExpressionLength(StyleResolver::convertToFloatLength(m_value.get(), style, rootStyle, zoom)));
185
            return adoptPtr(new CalcExpressionLength(StyleResolver::convertToFloatLength(m_value.get(), style, rootStyle, zoom)));
Lines 209-219 public: a/Source/WebCore/css/CSSCalculationValue.cpp_sec5
209
        return 0;
214
        return 0;
210
    }
215
    }
211
    
216
    
212
    virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier, bool computingFontSize) const
217
    virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, const IntSize& viewportSize, double multiplier, bool computingFontSize) const
213
    {
218
    {
214
        switch (m_category) {
219
        switch (m_category) {
215
        case CalcLength:
220
        case CalcLength:
216
            return m_value->computeLength<double>(currentStyle, rootStyle, multiplier, computingFontSize);
221
            return m_value->computeLength<double>(currentStyle, rootStyle, viewportSize, multiplier, computingFontSize);
217
        case CalcPercent:
222
        case CalcPercent:
218
        case CalcNumber:
223
        case CalcNumber:
219
            return m_value->getDoubleValue();
224
            return m_value->getDoubleValue();
Lines 330-339 public: a/Source/WebCore/css/CSSCalculationValue.cpp_sec6
330
        return evaluate(m_leftSide->doubleValue(), m_rightSide->doubleValue());
335
        return evaluate(m_leftSide->doubleValue(), m_rightSide->doubleValue());
331
    }
336
    }
332
    
337
    
333
    virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier, bool computingFontSize) const
338
    virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, const IntSize& viewportSize, double multiplier, bool computingFontSize) const
334
    {
339
    {
335
        const double leftValue = m_leftSide->computeLengthPx(currentStyle, rootStyle, multiplier, computingFontSize);
340
        const double leftValue = m_leftSide->computeLengthPx(currentStyle, rootStyle, viewportSize, multiplier, computingFontSize);
336
        const double rightValue = m_rightSide->computeLengthPx(currentStyle, rootStyle, multiplier, computingFontSize);
341
        const double rightValue = m_rightSide->computeLengthPx(currentStyle, rootStyle, viewportSize, multiplier, computingFontSize);
337
        return evaluate(leftValue, rightValue);
342
        return evaluate(leftValue, rightValue);
338
    }
343
    }
339
344
- a/Source/WebCore/css/CSSCalculationValue.h -2 / +2 lines
Lines 69-75 public: a/Source/WebCore/css/CSSCalculationValue.h_sec1
69
    virtual bool isZero() const = 0;
69
    virtual bool isZero() const = 0;
70
    virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle*, RenderStyle* rootStyle, double zoom = 1.0) const = 0;    
70
    virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle*, RenderStyle* rootStyle, double zoom = 1.0) const = 0;    
71
    virtual double doubleValue() const = 0;
71
    virtual double doubleValue() const = 0;
72
    virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const = 0;
72
    virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, const IntSize& viewportSize, double multiplier = 1.0, bool computingFontSize = false) const = 0;
73
    virtual String customCssText() const = 0;
73
    virtual String customCssText() const = 0;
74
#if ENABLE(CSS_VARIABLES)
74
#if ENABLE(CSS_VARIABLES)
75
    virtual String serializeResolvingVariables(const HashMap<AtomicString, String>&) const = 0;
75
    virtual String serializeResolvingVariables(const HashMap<AtomicString, String>&) const = 0;
Lines 106-112 public: a/Source/WebCore/css/CSSCalculationValue.h_sec2
106
    bool isInt() const { return m_expression->isInteger(); }    
106
    bool isInt() const { return m_expression->isInteger(); }    
107
    double doubleValue() const;
107
    double doubleValue() const;
108
    bool isNegative() const { return m_expression->doubleValue() < 0; }
108
    bool isNegative() const { return m_expression->doubleValue() < 0; }
109
    double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const;
109
    double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, const IntSize& viewportSize, double multiplier = 1.0, bool computingFontSize = false) const;
110
        
110
        
111
    String customCssText() const;
111
    String customCssText() const;
112
    bool equals(const CSSCalcValue&) const;
112
    bool equals(const CSSCalcValue&) const;
- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp -47 / +45 lines
Lines 641-647 static PassRefPtr<CSSValueList> createPositionListForLayer(CSSPropertyID propert a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec1
641
    return positionList.release();
641
    return positionList.release();
642
}
642
}
643
643
644
static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, CSSPropertyID propertyID, RenderView* renderView)
644
static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, CSSPropertyID propertyID, const IntSize& viewportSize)
645
{
645
{
646
    if (!style)
646
    if (!style)
647
        return 0;
647
        return 0;
Lines 668-674 static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, CSSProper a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec2
668
        if (l.type() == WebCore::Fixed)
668
        if (l.type() == WebCore::Fixed)
669
            return zoomAdjustedPixelValue(l.value(), style);
669
            return zoomAdjustedPixelValue(l.value(), style);
670
        else if (l.isViewportPercentage())
670
        else if (l.isViewportPercentage())
671
            return zoomAdjustedPixelValue(valueForLength(l, 0, renderView), style);
671
            return zoomAdjustedPixelValue(valueForLength(l, 0, viewportSize), style);
672
        return cssValuePool().createValue(l);
672
        return cssValuePool().createValue(l);
673
    }
673
    }
674
674
Lines 690-720 PassRefPtr<CSSPrimitiveValue> CSSComputedStyleDeclaration::currentColorOrValidCo a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec3
690
    return cssValuePool().createColorValue(color.rgb());
690
    return cssValuePool().createColorValue(color.rgb());
691
}
691
}
692
692
693
static PassRefPtr<CSSValueList> getBorderRadiusCornerValues(LengthSize radius, const RenderStyle* style, RenderView* renderView)
693
static PassRefPtr<CSSValueList> getBorderRadiusCornerValues(LengthSize radius, const RenderStyle* style, const IntSize& viewportSize)
694
{
694
{
695
    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
695
    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
696
    if (radius.width().type() == Percent)
696
    if (radius.width().type() == Percent)
697
        list->append(cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
697
        list->append(cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
698
    else
698
    else
699
        list->append(zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style));
699
        list->append(zoomAdjustedPixelValue(valueForLength(radius.width(), 0, viewportSize), style));
700
    if (radius.height().type() == Percent)
700
    if (radius.height().type() == Percent)
701
        list->append(cssValuePool().createValue(radius.height().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
701
        list->append(cssValuePool().createValue(radius.height().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
702
    else
702
    else
703
        list->append(zoomAdjustedPixelValue(valueForLength(radius.height(), 0, renderView), style));
703
        list->append(zoomAdjustedPixelValue(valueForLength(radius.height(), 0, viewportSize), style));
704
    return list.release();
704
    return list.release();
705
}
705
}
706
706
707
static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius, const RenderStyle* style, RenderView* renderView)
707
static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius, const RenderStyle* style, const IntSize& viewportSize)
708
{
708
{
709
    if (radius.width() == radius.height()) {
709
    if (radius.width() == radius.height()) {
710
        if (radius.width().type() == Percent)
710
        if (radius.width().type() == Percent)
711
            return cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
711
            return cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
712
        return zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style);
712
        return zoomAdjustedPixelValue(valueForLength(radius.width(), 0, viewportSize), style);
713
    }
713
    }
714
    return getBorderRadiusCornerValues(radius, style, renderView);
714
    return getBorderRadiusCornerValues(radius, style, viewportSize);
715
}
715
}
716
716
717
static PassRefPtr<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle* style, RenderView* renderView)
717
static PassRefPtr<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle* style, const IntSize& viewportSize)
718
{
718
{
719
    RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
719
    RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
720
    bool showHorizontalBottomLeft = style->borderTopRightRadius().width() != style->borderBottomLeftRadius().width();
720
    bool showHorizontalBottomLeft = style->borderTopRightRadius().width() != style->borderBottomLeftRadius().width();
Lines 726-735 static PassRefPtr<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle* a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec4
726
    bool showVerticalTopRight = (style->borderTopRightRadius().height() != style->borderTopLeftRadius().height()) || showVerticalBottomRight;
726
    bool showVerticalTopRight = (style->borderTopRightRadius().height() != style->borderTopLeftRadius().height()) || showVerticalBottomRight;
727
    bool showVerticalTopLeft = (style->borderTopLeftRadius().width() != style->borderTopLeftRadius().height());
727
    bool showVerticalTopLeft = (style->borderTopLeftRadius().width() != style->borderTopLeftRadius().height());
728
728
729
    RefPtr<CSSValueList> topLeftRadius = getBorderRadiusCornerValues(style->borderTopLeftRadius(), style, renderView);
729
    RefPtr<CSSValueList> topLeftRadius = getBorderRadiusCornerValues(style->borderTopLeftRadius(), style, viewportSize);
730
    RefPtr<CSSValueList> topRightRadius = getBorderRadiusCornerValues(style->borderTopRightRadius(), style, renderView);
730
    RefPtr<CSSValueList> topRightRadius = getBorderRadiusCornerValues(style->borderTopRightRadius(), style, viewportSize);
731
    RefPtr<CSSValueList> bottomRightRadius = getBorderRadiusCornerValues(style->borderBottomRightRadius(), style, renderView);
731
    RefPtr<CSSValueList> bottomRightRadius = getBorderRadiusCornerValues(style->borderBottomRightRadius(), style, viewportSize);
732
    RefPtr<CSSValueList> bottomLeftRadius = getBorderRadiusCornerValues(style->borderBottomLeftRadius(), style, renderView);
732
    RefPtr<CSSValueList> bottomLeftRadius = getBorderRadiusCornerValues(style->borderBottomLeftRadius(), style, viewportSize);
733
733
734
    RefPtr<CSSValueList> horizontalRadii = CSSValueList::createSpaceSeparated();
734
    RefPtr<CSSValueList> horizontalRadii = CSSValueList::createSpaceSeparated();
735
    horizontalRadii->append(topLeftRadius->item(0));
735
    horizontalRadii->append(topLeftRadius->item(0));
Lines 814-820 static PassRefPtr<CSSValue> computedTransform(RenderObject* renderer, const Rend a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec5
814
        box = pixelSnappedIntRect(toRenderBox(renderer)->borderBoxRect());
814
        box = pixelSnappedIntRect(toRenderBox(renderer)->borderBoxRect());
815
815
816
    TransformationMatrix transform;
816
    TransformationMatrix transform;
817
    style->applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOrigin);
817
    style->applyTransform(transform, box.size(), renderer, RenderStyle::ExcludeTransformOrigin);
818
    // Note that this does not flatten to an affine transform if ENABLE(3D_RENDERING) is off, by design.
818
    // Note that this does not flatten to an affine transform if ENABLE(3D_RENDERING) is off, by design.
819
819
820
    // FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924)
820
    // FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924)
Lines 845-851 static PassRefPtr<CSSValue> valueForCustomFilterTransformParameter(const RenderO a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec6
845
{
845
{
846
    IntSize size = renderer ? pixelSnappedIntRect(toRenderBox(renderer)->borderBoxRect()).size() : IntSize();
846
    IntSize size = renderer ? pixelSnappedIntRect(toRenderBox(renderer)->borderBoxRect()).size() : IntSize();
847
    TransformationMatrix transform;
847
    TransformationMatrix transform;
848
    transformParameter->applyTransform(transform, size);
848
    transformParameter->applyTransform(transform, size, renderer->view()->viewportSize());
849
    // FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924)
849
    // FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924)
850
    return matrixTransformValue(transform, style);
850
    return matrixTransformValue(transform, style);
851
}
851
}
Lines 1028-1072 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForFilter(const RenderObj a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec7
1028
}
1028
}
1029
#endif
1029
#endif
1030
1030
1031
static PassRefPtr<CSSValue> valueForGridTrackBreadth(const Length& trackBreadth, const RenderStyle* style, RenderView *renderView)
1031
static PassRefPtr<CSSValue> valueForGridTrackBreadth(const Length& trackBreadth, const RenderStyle* style, const IntSize& viewportSize)
1032
{
1032
{
1033
    if (trackBreadth.isAuto())
1033
    if (trackBreadth.isAuto())
1034
        return cssValuePool().createIdentifierValue(CSSValueAuto);
1034
        return cssValuePool().createIdentifierValue(CSSValueAuto);
1035
    if (trackBreadth.isViewportPercentage())
1035
    if (trackBreadth.isViewportPercentage())
1036
        return zoomAdjustedPixelValue(valueForLength(trackBreadth, 0, renderView), style);
1036
        return zoomAdjustedPixelValue(valueForLength(trackBreadth, 0, viewportSize), style);
1037
    return zoomAdjustedPixelValueForLength(trackBreadth, style);
1037
    return zoomAdjustedPixelValueForLength(trackBreadth, style);
1038
}
1038
}
1039
1039
1040
static PassRefPtr<CSSValue> valueForGridTrackMinMax(const GridTrackSize& trackSize, const RenderStyle* style, RenderView* renderView)
1040
static PassRefPtr<CSSValue> valueForGridTrackMinMax(const GridTrackSize& trackSize, const RenderStyle* style, const IntSize& viewportSize)
1041
{
1041
{
1042
    switch (trackSize.type()) {
1042
    switch (trackSize.type()) {
1043
    case LengthTrackSizing:
1043
    case LengthTrackSizing:
1044
        return valueForGridTrackBreadth(trackSize.length(), style, renderView);
1044
        return valueForGridTrackBreadth(trackSize.length(), style, viewportSize);
1045
    case MinMaxTrackSizing:
1045
    case MinMaxTrackSizing:
1046
        RefPtr<CSSValueList> minMaxTrackBreadths = CSSValueList::createCommaSeparated();
1046
        RefPtr<CSSValueList> minMaxTrackBreadths = CSSValueList::createCommaSeparated();
1047
        minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.minTrackBreadth(), style, renderView));
1047
        minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.minTrackBreadth(), style, viewportSize));
1048
        minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.maxTrackBreadth(), style, renderView));
1048
        minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.maxTrackBreadth(), style, viewportSize));
1049
        return CSSFunctionValue::create("minmax(", minMaxTrackBreadths);
1049
        return CSSFunctionValue::create("minmax(", minMaxTrackBreadths);
1050
    }
1050
    }
1051
    ASSERT_NOT_REACHED();
1051
    ASSERT_NOT_REACHED();
1052
    return 0;
1052
    return 0;
1053
}
1053
}
1054
1054
1055
static PassRefPtr<CSSValue> valueForGridTrackGroup(const Vector<GridTrackSize>& trackSizes, const RenderStyle* style, RenderView* renderView)
1055
static PassRefPtr<CSSValue> valueForGridTrackGroup(const Vector<GridTrackSize>& trackSizes, const RenderStyle* style, const IntSize& viewportSize)
1056
{
1056
{
1057
    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1057
    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1058
    for (size_t i = 0; i < trackSizes.size(); ++i)
1058
    for (size_t i = 0; i < trackSizes.size(); ++i)
1059
        list->append(valueForGridTrackMinMax(trackSizes[i], style, renderView));
1059
        list->append(valueForGridTrackMinMax(trackSizes[i], style, viewportSize));
1060
    return list.release();
1060
    return list.release();
1061
}
1061
}
1062
1062
1063
static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<GridTrackSize>& trackSizes, const RenderStyle* style, RenderView *renderView)
1063
static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<GridTrackSize>& trackSizes, const RenderStyle* style, const IntSize& viewportSize)
1064
{
1064
{
1065
    // Handle the 'none' case here.
1065
    // Handle the 'none' case here.
1066
    if (!trackSizes.size())
1066
    if (!trackSizes.size())
1067
        return cssValuePool().createIdentifierValue(CSSValueNone);
1067
        return cssValuePool().createIdentifierValue(CSSValueNone);
1068
1068
1069
    return valueForGridTrackGroup(trackSizes, style, renderView);
1069
    return valueForGridTrackGroup(trackSizes, style, viewportSize);
1070
}
1070
}
1071
1071
1072
static PassRefPtr<CSSValue> valueForGridPosition(const GridPosition& position)
1072
static PassRefPtr<CSSValue> valueForGridPosition(const GridPosition& position)
Lines 1434-1440 static PassRefPtr<CSSValueList> fontFamilyFromStyle(RenderStyle* style) a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec8
1434
    return list.release();
1434
    return list.release();
1435
}
1435
}
1436
1436
1437
static PassRefPtr<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle* style, RenderView* renderView)
1437
static PassRefPtr<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle* style, const IntSize& viewportSize)
1438
{
1438
{
1439
    Length length = style->lineHeight();
1439
    Length length = style->lineHeight();
1440
    if (length.isNegative())
1440
    if (length.isNegative())
Lines 1445-1451 static PassRefPtr<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle* style, Ren a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec9
1445
        // On the other hand, since font-size doesn't include the zoom factor, we really can't do
1445
        // On the other hand, since font-size doesn't include the zoom factor, we really can't do
1446
        // that here either.
1446
        // that here either.
1447
        return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, style);
1447
        return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, style);
1448
    return zoomAdjustedPixelValue(valueForLength(length, 0, renderView), style);
1448
    return zoomAdjustedPixelValue(valueForLength(length, 0, viewportSize), style);
1449
}
1449
}
1450
1450
1451
static PassRefPtr<CSSPrimitiveValue> fontSizeFromStyle(RenderStyle* style)
1451
static PassRefPtr<CSSPrimitiveValue> fontSizeFromStyle(RenderStyle* style)
Lines 1756-1762 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec10
1756
        case CSSPropertyBorderLeftWidth:
1756
        case CSSPropertyBorderLeftWidth:
1757
            return zoomAdjustedPixelValue(style->borderLeftWidth(), style.get());
1757
            return zoomAdjustedPixelValue(style->borderLeftWidth(), style.get());
1758
        case CSSPropertyBottom:
1758
        case CSSPropertyBottom:
1759
            return getPositionOffsetValue(style.get(), CSSPropertyBottom, m_node->document()->renderView());
1759
            return getPositionOffsetValue(style.get(), CSSPropertyBottom, m_node->document()->viewportSize());
1760
        case CSSPropertyWebkitBoxAlign:
1760
        case CSSPropertyWebkitBoxAlign:
1761
            return cssValuePool().createValue(style->boxAlign());
1761
            return cssValuePool().createValue(style->boxAlign());
1762
#if ENABLE(CSS_BOX_DECORATION_BREAK)
1762
#if ENABLE(CSS_BOX_DECORATION_BREAK)
Lines 1898-1904 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec11
1898
            computedFont->variant = fontVariantFromStyle(style.get());
1898
            computedFont->variant = fontVariantFromStyle(style.get());
1899
            computedFont->weight = fontWeightFromStyle(style.get());
1899
            computedFont->weight = fontWeightFromStyle(style.get());
1900
            computedFont->size = fontSizeFromStyle(style.get());
1900
            computedFont->size = fontSizeFromStyle(style.get());
1901
            computedFont->lineHeight = lineHeightFromStyle(style.get(), m_node->document()->renderView());
1901
            computedFont->lineHeight = lineHeightFromStyle(style.get(), m_node->document()->viewportSize());
1902
            computedFont->family = fontFamilyFromStyle(style.get());
1902
            computedFont->family = fontFamilyFromStyle(style.get());
1903
            return computedFont.release();
1903
            return computedFont.release();
1904
        }
1904
        }
Lines 1933-1941 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec12
1933
        case CSSPropertyWebkitGridAutoFlow:
1933
        case CSSPropertyWebkitGridAutoFlow:
1934
            return cssValuePool().createValue(style->gridAutoFlow());
1934
            return cssValuePool().createValue(style->gridAutoFlow());
1935
        case CSSPropertyWebkitGridColumns:
1935
        case CSSPropertyWebkitGridColumns:
1936
            return valueForGridTrackList(style->gridColumns(), style.get(), m_node->document()->renderView());
1936
            return valueForGridTrackList(style->gridColumns(), style.get(), m_node->document()->viewportSize());
1937
        case CSSPropertyWebkitGridRows:
1937
        case CSSPropertyWebkitGridRows:
1938
            return valueForGridTrackList(style->gridRows(), style.get(), m_node->document()->renderView());
1938
            return valueForGridTrackList(style->gridRows(), style.get(), m_node->document()->viewportSize());
1939
1939
1940
        case CSSPropertyWebkitGridStart:
1940
        case CSSPropertyWebkitGridStart:
1941
            return valueForGridPosition(style->gridItemStart());
1941
            return valueForGridPosition(style->gridItemStart());
Lines 1996-2002 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec13
1996
            return cssValuePool().createValue(style->imageResolution(), CSSPrimitiveValue::CSS_DPPX);
1996
            return cssValuePool().createValue(style->imageResolution(), CSSPrimitiveValue::CSS_DPPX);
1997
#endif
1997
#endif
1998
        case CSSPropertyLeft:
1998
        case CSSPropertyLeft:
1999
            return getPositionOffsetValue(style.get(), CSSPropertyLeft, m_node->document()->renderView());
1999
            return getPositionOffsetValue(style.get(), CSSPropertyLeft, m_node->document()->viewportSize());
2000
        case CSSPropertyLetterSpacing:
2000
        case CSSPropertyLetterSpacing:
2001
            if (!style->letterSpacing())
2001
            if (!style->letterSpacing())
2002
                return cssValuePool().createIdentifierValue(CSSValueNormal);
2002
                return cssValuePool().createIdentifierValue(CSSValueNormal);
Lines 2006-2012 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec14
2006
                return cssValuePool().createIdentifierValue(CSSValueNone);
2006
                return cssValuePool().createIdentifierValue(CSSValueNone);
2007
            return cssValuePool().createValue(style->lineClamp().value(), style->lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveValue::CSS_NUMBER);
2007
            return cssValuePool().createValue(style->lineClamp().value(), style->lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveValue::CSS_NUMBER);
2008
        case CSSPropertyLineHeight:
2008
        case CSSPropertyLineHeight:
2009
            return lineHeightFromStyle(style.get(), m_node->document()->renderView());
2009
            return lineHeightFromStyle(style.get(), m_node->document()->viewportSize());
2010
        case CSSPropertyListStyleImage:
2010
        case CSSPropertyListStyleImage:
2011
            if (style->listStyleImage())
2011
            if (style->listStyleImage())
2012
                return style->listStyleImage()->cssValue();
2012
                return style->listStyleImage()->cssValue();
Lines 2034-2040 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec15
2034
                // RenderBox gives a marginRight() that is the distance between the right-edge of the child box
2034
                // RenderBox gives a marginRight() that is the distance between the right-edge of the child box
2035
                // and the right-edge of the containing box, when display == BLOCK. Let's calculate the absolute
2035
                // and the right-edge of the containing box, when display == BLOCK. Let's calculate the absolute
2036
                // value of the specified margin-right % instead of relying on RenderBox's marginRight() value.
2036
                // value of the specified margin-right % instead of relying on RenderBox's marginRight() value.
2037
                value = minimumValueForLength(marginRight, toRenderBox(renderer)->containingBlockLogicalWidthForContent(), m_node->document()->renderView());
2037
                value = renderer->minimumValueForLength(marginRight, toRenderBox(renderer)->containingBlockLogicalWidthForContent());
2038
            else
2038
            else
2039
                value = toRenderBox(renderer)->marginRight();
2039
                value = toRenderBox(renderer)->marginRight();
2040
            return zoomAdjustedPixelValue(value, style.get());
2040
            return zoomAdjustedPixelValue(value, style.get());
Lines 2139-2145 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec16
2139
        case CSSPropertyPosition:
2139
        case CSSPropertyPosition:
2140
            return cssValuePool().createValue(style->position());
2140
            return cssValuePool().createValue(style->position());
2141
        case CSSPropertyRight:
2141
        case CSSPropertyRight:
2142
            return getPositionOffsetValue(style.get(), CSSPropertyRight, m_node->document()->renderView());
2142
            return getPositionOffsetValue(style.get(), CSSPropertyRight, m_node->document()->viewportSize());
2143
        case CSSPropertyWebkitRubyPosition:
2143
        case CSSPropertyWebkitRubyPosition:
2144
            return cssValuePool().createValue(style->rubyPosition());
2144
            return cssValuePool().createValue(style->rubyPosition());
2145
        case CSSPropertyTableLayout:
2145
        case CSSPropertyTableLayout:
Lines 2203-2209 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec17
2203
        case CSSPropertyTextTransform:
2203
        case CSSPropertyTextTransform:
2204
            return cssValuePool().createValue(style->textTransform());
2204
            return cssValuePool().createValue(style->textTransform());
2205
        case CSSPropertyTop:
2205
        case CSSPropertyTop:
2206
            return getPositionOffsetValue(style.get(), CSSPropertyTop, m_node->document()->renderView());
2206
            return getPositionOffsetValue(style.get(), CSSPropertyTop, m_node->document()->viewportSize());
2207
        case CSSPropertyUnicodeBidi:
2207
        case CSSPropertyUnicodeBidi:
2208
            return cssValuePool().createValue(style->unicodeBidi());
2208
            return cssValuePool().createValue(style->unicodeBidi());
2209
        case CSSPropertyVerticalAlign:
2209
        case CSSPropertyVerticalAlign:
Lines 2469-2477 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec18
2469
                if (renderer->isBox())
2469
                if (renderer->isBox())
2470
                    box = toRenderBox(renderer)->borderBoxRect();
2470
                    box = toRenderBox(renderer)->borderBoxRect();
2471
2471
2472
                RenderView* renderView = m_node->document()->renderView();
2472
                list->append(zoomAdjustedPixelValue(renderer->minimumValueForLength(style->perspectiveOriginX(), box.width()), style.get()));
2473
                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginX(), box.width(), renderView), style.get()));
2473
                list->append(zoomAdjustedPixelValue(renderer->minimumValueForLength(style->perspectiveOriginY(), box.height()), style.get()));
2474
                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginY(), box.height(), renderView), style.get()));
2475
            }
2474
            }
2476
            else {
2475
            else {
2477
                list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginX(), style.get()));
2476
                list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginX(), style.get()));
Lines 2491-2503 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec19
2491
        case CSSPropertyWebkitUserSelect:
2490
        case CSSPropertyWebkitUserSelect:
2492
            return cssValuePool().createValue(style->userSelect());
2491
            return cssValuePool().createValue(style->userSelect());
2493
        case CSSPropertyBorderBottomLeftRadius:
2492
        case CSSPropertyBorderBottomLeftRadius:
2494
            return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), style.get(), m_node->document()->renderView());
2493
            return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), style.get(), m_node->document()->viewportSize());
2495
        case CSSPropertyBorderBottomRightRadius:
2494
        case CSSPropertyBorderBottomRightRadius:
2496
            return getBorderRadiusCornerValue(style->borderBottomRightRadius(), style.get(), m_node->document()->renderView());
2495
            return getBorderRadiusCornerValue(style->borderBottomRightRadius(), style.get(), m_node->document()->viewportSize());
2497
        case CSSPropertyBorderTopLeftRadius:
2496
        case CSSPropertyBorderTopLeftRadius:
2498
            return getBorderRadiusCornerValue(style->borderTopLeftRadius(), style.get(), m_node->document()->renderView());
2497
            return getBorderRadiusCornerValue(style->borderTopLeftRadius(), style.get(), m_node->document()->viewportSize());
2499
        case CSSPropertyBorderTopRightRadius:
2498
        case CSSPropertyBorderTopRightRadius:
2500
            return getBorderRadiusCornerValue(style->borderTopRightRadius(), style.get(), m_node->document()->renderView());
2499
            return getBorderRadiusCornerValue(style->borderTopRightRadius(), style.get(), m_node->document()->viewportSize());
2501
        case CSSPropertyClip: {
2500
        case CSSPropertyClip: {
2502
            if (!style->hasClip())
2501
            if (!style->hasClip())
2503
                return cssValuePool().createIdentifierValue(CSSValueAuto);
2502
                return cssValuePool().createIdentifierValue(CSSValueAuto);
Lines 2519-2527 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec20
2519
                if (renderer->isBox())
2518
                if (renderer->isBox())
2520
                    box = toRenderBox(renderer)->borderBoxRect();
2519
                    box = toRenderBox(renderer)->borderBoxRect();
2521
2520
2522
                RenderView* renderView = m_node->document()->renderView();
2521
                list->append(zoomAdjustedPixelValue(renderer->minimumValueForLength(style->transformOriginX(), box.width()), style.get()));
2523
                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginX(), box.width(), renderView), style.get()));
2522
                list->append(zoomAdjustedPixelValue(renderer->minimumValueForLength(style->transformOriginY(), box.height()), style.get()));
2524
                list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginY(), box.height(), renderView), style.get()));
2525
                if (style->transformOriginZ() != 0)
2523
                if (style->transformOriginZ() != 0)
2526
                    list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get()));
2524
                    list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get()));
2527
            } else {
2525
            } else {
Lines 2684-2690 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec21
2684
        case CSSPropertyBorderImage:
2682
        case CSSPropertyBorderImage:
2685
            return valueForNinePieceImage(style->borderImage());
2683
            return valueForNinePieceImage(style->borderImage());
2686
        case CSSPropertyBorderRadius:
2684
        case CSSPropertyBorderRadius:
2687
            return getBorderRadiusShorthandValue(style.get(), m_node->document()->renderView());
2685
            return getBorderRadiusShorthandValue(style.get(), m_node->document()->viewportSize());
2688
        case CSSPropertyBorderRight:
2686
        case CSSPropertyBorderRight:
2689
            return getCSSPropertyValuesForShorthandProperties(borderRightShorthand());
2687
            return getCSSPropertyValuesForShorthandProperties(borderRightShorthand());
2690
        case CSSPropertyBorderStyle:
2688
        case CSSPropertyBorderStyle:
- a/Source/WebCore/css/CSSGradientValue.cpp -20 / +24 lines
Lines 35-40 a/Source/WebCore/css/CSSGradientValue.cpp_sec1
35
#include "IntSizeHash.h"
35
#include "IntSizeHash.h"
36
#include "NodeRenderStyle.h"
36
#include "NodeRenderStyle.h"
37
#include "RenderObject.h"
37
#include "RenderObject.h"
38
#include "RenderView.h"
38
#include "StyleResolver.h"
39
#include "StyleResolver.h"
39
#include "WebCoreMemoryInstrumentation.h"
40
#include "WebCoreMemoryInstrumentation.h"
40
#include <wtf/MemoryInstrumentationVector.h>
41
#include <wtf/MemoryInstrumentationVector.h>
Lines 168-173 void CSSGradientValue::addStops(Gradient* gradient, RenderObject* renderer, Rend a/Source/WebCore/css/CSSGradientValue.cpp_sec2
168
    }
169
    }
169
170
170
    size_t numStops = m_stops.size();
171
    size_t numStops = m_stops.size();
172
    const IntSize& viewportSize = renderer->view()->viewportSize();
171
173
172
    Vector<GradientStop> stops(numStops);
174
    Vector<GradientStop> stops(numStops);
173
175
Lines 196-204 void CSSGradientValue::addStops(Gradient* gradient, RenderObject* renderer, Rend a/Source/WebCore/css/CSSGradientValue.cpp_sec3
196
                }
198
                }
197
                float length;
199
                float length;
198
                if (stop.m_position->isLength())
200
                if (stop.m_position->isLength())
199
                    length = stop.m_position->computeLength<float>(style, rootStyle, style->effectiveZoom());
201
                    length = stop.m_position->computeLength<float>(style, rootStyle, viewportSize, style->effectiveZoom());
200
                else 
202
                else 
201
                    length = stop.m_position->cssCalcValue()->toCalcValue(style, rootStyle, style->effectiveZoom())->evaluate(gradientLength);
203
                    length = stop.m_position->cssCalcValue()->toCalcValue(style, rootStyle, style->effectiveZoom())->evaluate(gradientLength, viewportSize);
202
                stops[i].offset = (gradientLength > 0) ? length / gradientLength : 0;
204
                stops[i].offset = (gradientLength > 0) ? length / gradientLength : 0;
203
            } else {
205
            } else {
204
                ASSERT_NOT_REACHED();
206
                ASSERT_NOT_REACHED();
Lines 399-405 void CSSGradientValue::addStops(Gradient* gradient, RenderObject* renderer, Rend a/Source/WebCore/css/CSSGradientValue.cpp_sec4
399
    gradient->setStopsSorted(true);
401
    gradient->setStopsSorted(true);
400
}
402
}
401
403
402
static float positionFromValue(CSSPrimitiveValue* value, RenderStyle* style, RenderStyle* rootStyle, const IntSize& size, bool isHorizontal)
404
static float positionFromValue(CSSPrimitiveValue* value, RenderStyle* style, RenderStyle* rootStyle, const IntSize& size, bool isHorizontal, const IntSize& viewportSize)
403
{
405
{
404
    float zoomFactor = style->effectiveZoom();
406
    float zoomFactor = style->effectiveZoom();
405
407
Lines 411-417 static float positionFromValue(CSSPrimitiveValue* value, RenderStyle* style, Ren a/Source/WebCore/css/CSSGradientValue.cpp_sec5
411
        return value->getFloatValue() / 100.f * edgeDistance;
413
        return value->getFloatValue() / 100.f * edgeDistance;
412
414
413
    if (value->isCalculatedPercentageWithLength())
415
    if (value->isCalculatedPercentageWithLength())
414
        return value->cssCalcValue()->toCalcValue(style, rootStyle, style->effectiveZoom())->evaluate(edgeDistance);
416
        return value->cssCalcValue()->toCalcValue(style, rootStyle, style->effectiveZoom())->evaluate(edgeDistance, viewportSize);
415
417
416
    switch (value->getIdent()) {
418
    switch (value->getIdent()) {
417
    case CSSValueTop:
419
    case CSSValueTop:
Lines 428-445 static float positionFromValue(CSSPrimitiveValue* value, RenderStyle* style, Ren a/Source/WebCore/css/CSSGradientValue.cpp_sec6
428
        return size.width();
430
        return size.width();
429
    }
431
    }
430
432
431
    return value->computeLength<float>(style, rootStyle, zoomFactor);
433
    return value->computeLength<float>(style, rootStyle, viewportSize, zoomFactor);
432
}
434
}
433
435
434
FloatPoint CSSGradientValue::computeEndPoint(CSSPrimitiveValue* horizontal, CSSPrimitiveValue* vertical, RenderStyle* style, RenderStyle* rootStyle, const IntSize& size)
436
FloatPoint CSSGradientValue::computeEndPoint(CSSPrimitiveValue* horizontal, CSSPrimitiveValue* vertical, RenderStyle* style, RenderStyle* rootStyle, const IntSize& size, const IntSize& viewportSize)
435
{
437
{
436
    FloatPoint result;
438
    FloatPoint result;
437
439
438
    if (horizontal)
440
    if (horizontal)
439
        result.setX(positionFromValue(horizontal, style, rootStyle, size, true));
441
        result.setX(positionFromValue(horizontal, style, rootStyle, size, true, viewportSize));
440
442
441
    if (vertical)
443
    if (vertical)
442
        result.setY(positionFromValue(vertical, style, rootStyle, size, false));
444
        result.setY(positionFromValue(vertical, style, rootStyle, size, false, viewportSize));
443
445
444
    return result;
446
    return result;
445
}
447
}
Lines 669-679 PassRefPtr<Gradient> CSSLinearGradientValue::createGradient(RenderObject* render a/Source/WebCore/css/CSSGradientValue.cpp_sec7
669
        float angle = m_angle->getFloatValue(CSSPrimitiveValue::CSS_DEG);
671
        float angle = m_angle->getFloatValue(CSSPrimitiveValue::CSS_DEG);
670
        endPointsFromAngle(angle, size, firstPoint, secondPoint, m_gradientType);
672
        endPointsFromAngle(angle, size, firstPoint, secondPoint, m_gradientType);
671
    } else {
673
    } else {
674
        const IntSize& viewportSize = renderer->view()->viewportSize();
672
        switch (m_gradientType) {
675
        switch (m_gradientType) {
673
        case CSSDeprecatedLinearGradient:
676
        case CSSDeprecatedLinearGradient:
674
            firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size);
677
            firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size, viewportSize);
675
            if (m_secondX || m_secondY)
678
            if (m_secondX || m_secondY)
676
                secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), renderer->style(), rootStyle, size);
679
                secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), renderer->style(), rootStyle, size, viewportSize);
677
            else {
680
            else {
678
                if (m_firstX)
681
                if (m_firstX)
679
                    secondPoint.setX(size.width() - firstPoint.x());
682
                    secondPoint.setX(size.width() - firstPoint.x());
Lines 682-688 PassRefPtr<Gradient> CSSLinearGradientValue::createGradient(RenderObject* render a/Source/WebCore/css/CSSGradientValue.cpp_sec8
682
            }
685
            }
683
            break;
686
            break;
684
        case CSSPrefixedLinearGradient:
687
        case CSSPrefixedLinearGradient:
685
            firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size);
688
            firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size, viewportSize);
686
            if (m_firstX)
689
            if (m_firstX)
687
                secondPoint.setX(size.width() - firstPoint.x());
690
                secondPoint.setX(size.width() - firstPoint.x());
688
            if (m_firstY)
691
            if (m_firstY)
Lines 701-707 PassRefPtr<Gradient> CSSLinearGradientValue::createGradient(RenderObject* render a/Source/WebCore/css/CSSGradientValue.cpp_sec9
701
                float angle = 90 - rad2deg(atan2(rise, run));
704
                float angle = 90 - rad2deg(atan2(rise, run));
702
                endPointsFromAngle(angle, size, firstPoint, secondPoint, m_gradientType);
705
                endPointsFromAngle(angle, size, firstPoint, secondPoint, m_gradientType);
703
            } else if (m_firstX || m_firstY) { 
706
            } else if (m_firstX || m_firstY) { 
704
                secondPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size);
707
                secondPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size, viewportSize);
705
                if (m_firstX)
708
                if (m_firstX)
706
                    firstPoint.setX(size.width() - secondPoint.x());
709
                    firstPoint.setX(size.width() - secondPoint.x());
707
                if (m_firstY)
710
                if (m_firstY)
Lines 912-918 String CSSRadialGradientValue::customCssText() const a/Source/WebCore/css/CSSGradientValue.cpp_sec10
912
    return result.toString();
915
    return result.toString();
913
}
916
}
914
917
915
float CSSRadialGradientValue::resolveRadius(CSSPrimitiveValue* radius, RenderStyle* style, RenderStyle* rootStyle, float* widthOrHeight)
918
float CSSRadialGradientValue::resolveRadius(CSSPrimitiveValue* radius, RenderStyle* style, RenderStyle* rootStyle, const IntSize& viewportSize, float* widthOrHeight)
916
{
919
{
917
    float zoomFactor = style->effectiveZoom();
920
    float zoomFactor = style->effectiveZoom();
918
921
Lines 922-928 float CSSRadialGradientValue::resolveRadius(CSSPrimitiveValue* radius, RenderSty a/Source/WebCore/css/CSSGradientValue.cpp_sec11
922
    else if (widthOrHeight && radius->isPercentage())
925
    else if (widthOrHeight && radius->isPercentage())
923
        result = *widthOrHeight * radius->getFloatValue() / 100;
926
        result = *widthOrHeight * radius->getFloatValue() / 100;
924
    else
927
    else
925
        result = radius->computeLength<float>(style, rootStyle, zoomFactor);
928
        result = radius->computeLength<float>(style, rootStyle, viewportSize, zoomFactor);
926
929
927
    return result;
930
    return result;
928
}
931
}
Lines 1009-1022 PassRefPtr<Gradient> CSSRadialGradientValue::createGradient(RenderObject* render a/Source/WebCore/css/CSSGradientValue.cpp_sec12
1009
    ASSERT(!size.isEmpty());
1012
    ASSERT(!size.isEmpty());
1010
1013
1011
    RenderStyle* rootStyle = renderer->document()->documentElement()->renderStyle();
1014
    RenderStyle* rootStyle = renderer->document()->documentElement()->renderStyle();
1015
    const IntSize& viewportSize = renderer->view()->viewportSize();
1012
1016
1013
    FloatPoint firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size);
1017
    FloatPoint firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size, viewportSize);
1014
    if (!m_firstX)
1018
    if (!m_firstX)
1015
        firstPoint.setX(size.width() / 2);
1019
        firstPoint.setX(size.width() / 2);
1016
    if (!m_firstY)
1020
    if (!m_firstY)
1017
        firstPoint.setY(size.height() / 2);
1021
        firstPoint.setY(size.height() / 2);
1018
1022
1019
    FloatPoint secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), renderer->style(), rootStyle, size);
1023
    FloatPoint secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), renderer->style(), rootStyle, size, viewportSize);
1020
    if (!m_secondX)
1024
    if (!m_secondX)
1021
        secondPoint.setX(size.width() / 2);
1025
        secondPoint.setX(size.width() / 2);
1022
    if (!m_secondY)
1026
    if (!m_secondY)
Lines 1024-1041 PassRefPtr<Gradient> CSSRadialGradientValue::createGradient(RenderObject* render a/Source/WebCore/css/CSSGradientValue.cpp_sec13
1024
1028
1025
    float firstRadius = 0;
1029
    float firstRadius = 0;
1026
    if (m_firstRadius)
1030
    if (m_firstRadius)
1027
        firstRadius = resolveRadius(m_firstRadius.get(), renderer->style(), rootStyle);
1031
        firstRadius = resolveRadius(m_firstRadius.get(), renderer->style(), rootStyle, viewportSize);
1028
1032
1029
    float secondRadius = 0;
1033
    float secondRadius = 0;
1030
    float aspectRatio = 1; // width / height.
1034
    float aspectRatio = 1; // width / height.
1031
    if (m_secondRadius)
1035
    if (m_secondRadius)
1032
        secondRadius = resolveRadius(m_secondRadius.get(), renderer->style(), rootStyle);
1036
        secondRadius = resolveRadius(m_secondRadius.get(), renderer->style(), rootStyle, viewportSize);
1033
    else if (m_endHorizontalSize) {
1037
    else if (m_endHorizontalSize) {
1034
        float width = size.width();
1038
        float width = size.width();
1035
        float height = size.height();
1039
        float height = size.height();
1036
        secondRadius = resolveRadius(m_endHorizontalSize.get(), renderer->style(), rootStyle, &width);
1040
        secondRadius = resolveRadius(m_endHorizontalSize.get(), renderer->style(), rootStyle, viewportSize, &width);
1037
        if (m_endVerticalSize)
1041
        if (m_endVerticalSize)
1038
            aspectRatio = secondRadius / resolveRadius(m_endVerticalSize.get(), renderer->style(), rootStyle, &height);
1042
            aspectRatio = secondRadius / resolveRadius(m_endVerticalSize.get(), renderer->style(), rootStyle, viewportSize, &height);
1039
        else
1043
        else
1040
            aspectRatio = 1;
1044
            aspectRatio = 1;
1041
    } else {
1045
    } else {
- a/Source/WebCore/css/CSSGradientValue.h -2 / +2 lines
Lines 116-122 protected: a/Source/WebCore/css/CSSGradientValue.h_sec1
116
    void addStops(Gradient*, RenderObject*, RenderStyle* rootStyle, float maxLengthForRepeat = 0);
116
    void addStops(Gradient*, RenderObject*, RenderStyle* rootStyle, float maxLengthForRepeat = 0);
117
117
118
    // Resolve points/radii to front end values.
118
    // Resolve points/radii to front end values.
119
    FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, const IntSize&);
119
    FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, const IntSize&, const IntSize& viewportSize);
120
120
121
    bool isCacheable() const;
121
    bool isCacheable() const;
122
122
Lines 225-231 private: a/Source/WebCore/css/CSSGradientValue.h_sec2
225
225
226
226
227
    // Resolve points/radii to front end values.
227
    // Resolve points/radii to front end values.
228
    float resolveRadius(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, float* widthOrHeight = 0);
228
    float resolveRadius(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, const IntSize& viewportSize, float* widthOrHeight = 0);
229
229
230
    // These may be null for non-deprecated gradients.
230
    // These may be null for non-deprecated gradients.
231
    RefPtr<CSSPrimitiveValue> m_firstRadius;
231
    RefPtr<CSSPrimitiveValue> m_firstRadius;
- a/Source/WebCore/css/CSSPrimitiveValue.cpp -17 / +30 lines
Lines 481-530 double CSSPrimitiveValue::computeDegrees() a/Source/WebCore/css/CSSPrimitiveValue.cpp_sec1
481
    }
481
    }
482
}
482
}
483
483
484
template<> int CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
484
template<> int CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, const IntSize& viewportSize, float multiplier, bool computingFontSize)
485
{
485
{
486
    return roundForImpreciseConversion<int>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
486
    return roundForImpreciseConversion<int>(computeLengthDouble(style, rootStyle, viewportSize, multiplier, computingFontSize));
487
}
487
}
488
488
489
template<> unsigned CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
489
template<> unsigned CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, const IntSize& viewportSize, float multiplier, bool computingFontSize)
490
{
490
{
491
    return roundForImpreciseConversion<unsigned>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
491
    return roundForImpreciseConversion<unsigned>(computeLengthDouble(style, rootStyle, viewportSize, multiplier, computingFontSize));
492
}
492
}
493
493
494
template<> Length CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
494
template<> Length CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, const IntSize& viewportSize, float multiplier, bool computingFontSize)
495
{
495
{
496
#if ENABLE(SUBPIXEL_LAYOUT)
496
#if ENABLE(SUBPIXEL_LAYOUT)
497
    return Length(clampTo<float>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize), minValueForCssLength, maxValueForCssLength), Fixed);
497
    return Length(clampTo<float>(computeLengthDouble(style, rootStyle, viewportSize, multiplier, computingFontSize), minValueForCssLength, maxValueForCssLength), Fixed);
498
#else
498
#else
499
    return Length(clampTo<float>(roundForImpreciseConversion<float>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)), minValueForCssLength, maxValueForCssLength), Fixed);
499
    return Length(clampTo<float>(roundForImpreciseConversion<float>(computeLengthDouble(style, rootStyle, viewportSize, multiplier, computingFontSize)), minValueForCssLength, maxValueForCssLength), Fixed);
500
#endif
500
#endif
501
}
501
}
502
502
503
template<> short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
503
template<> short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, const IntSize& viewportSize, float multiplier, bool computingFontSize)
504
{
504
{
505
    return roundForImpreciseConversion<short>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
505
    return roundForImpreciseConversion<short>(computeLengthDouble(style, rootStyle, viewportSize, multiplier, computingFontSize));
506
}
506
}
507
507
508
template<> unsigned short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
508
template<> unsigned short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, const IntSize& viewportSize, float multiplier, bool computingFontSize)
509
{
509
{
510
    return roundForImpreciseConversion<unsigned short>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
510
    return roundForImpreciseConversion<unsigned short>(computeLengthDouble(style, rootStyle, viewportSize, multiplier, computingFontSize));
511
}
511
}
512
512
513
template<> float CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
513
template<> float CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, const IntSize& viewportSize, float multiplier, bool computingFontSize)
514
{
514
{
515
    return static_cast<float>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
515
    return static_cast<float>(computeLengthDouble(style, rootStyle, viewportSize, multiplier, computingFontSize));
516
}
516
}
517
517
518
template<> double CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
518
template<> double CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, const IntSize& viewportSize, float multiplier, bool computingFontSize)
519
{
519
{
520
    return computeLengthDouble(style, rootStyle, multiplier, computingFontSize);
520
    return computeLengthDouble(style, rootStyle, viewportSize, multiplier, computingFontSize);
521
}
521
}
522
522
523
double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
523
double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* rootStyle, const IntSize& viewportSize, float multiplier, bool computingFontSize)
524
{
524
{
525
    if (m_primitiveUnitType == CSS_CALC)
525
    if (m_primitiveUnitType == CSS_CALC)
526
        // The multiplier and factor is applied to each value in the calc expression individually
526
        // The multiplier and factor is applied to each value in the calc expression individually
527
        return m_value.calc->computeLengthPx(style, rootStyle, multiplier, computingFontSize);
527
        return m_value.calc->computeLengthPx(style, rootStyle, viewportSize, multiplier, computingFontSize);
528
        
528
        
529
    double factor;
529
    double factor;
530
530
Lines 569-574 double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* r a/Source/WebCore/css/CSSPrimitiveValue.cpp_sec2
569
            // 1 pc == 12 pt
569
            // 1 pc == 12 pt
570
            factor = cssPixelsPerInch * 12.0 / 72.0;
570
            factor = cssPixelsPerInch * 12.0 / 72.0;
571
            break;
571
            break;
572
        case CSS_VW:
573
            factor = viewportSize.width() / 100.0;
574
            break;
575
        case CSS_VH:
576
            factor = viewportSize.height() / 100.0;
577
            break;
578
        case CSS_VMIN:
579
            factor = std::min(viewportSize.width(), viewportSize.height()) / 100.0;
580
            break;
581
        case CSS_VMAX:
582
            factor = std::max(viewportSize.width(), viewportSize.height()) / 100.0;
583
            break;
572
        case CSS_CALC_PERCENTAGE_WITH_LENGTH:
584
        case CSS_CALC_PERCENTAGE_WITH_LENGTH:
573
        case CSS_CALC_PERCENTAGE_WITH_NUMBER:
585
        case CSS_CALC_PERCENTAGE_WITH_NUMBER:
574
            ASSERT_NOT_REACHED();
586
            ASSERT_NOT_REACHED();
Lines 1318-1323 bool CSSPrimitiveValue::equals(const CSSPrimitiveValue& other) const a/Source/WebCore/css/CSSPrimitiveValue.cpp_sec3
1318
    case CSS_VW:
1330
    case CSS_VW:
1319
    case CSS_VH:
1331
    case CSS_VH:
1320
    case CSS_VMIN:
1332
    case CSS_VMIN:
1333
    case CSS_VMAX:
1321
    case CSS_DIMENSION:
1334
    case CSS_DIMENSION:
1322
        return m_value.num == other.m_value.num;
1335
        return m_value.num == other.m_value.num;
1323
    case CSS_IDENT:
1336
    case CSS_IDENT:
- a/Source/WebCore/css/CSSPrimitiveValue.h -2 / +2 lines
Lines 249-255 public: a/Source/WebCore/css/CSSPrimitiveValue.h_sec1
249
     * this is screen/printer dependent, so we probably need a config option for this,
249
     * this is screen/printer dependent, so we probably need a config option for this,
250
     * and some tool to calibrate.
250
     * and some tool to calibrate.
251
     */
251
     */
252
    template<typename T> T computeLength(RenderStyle* currStyle, RenderStyle* rootStyle, float multiplier = 1.0f, bool computingFontSize = false);
252
    template<typename T> T computeLength(RenderStyle* currStyle, RenderStyle* rootStyle, const IntSize& viewportSize, float multiplier = 1.0f, bool computingFontSize = false);
253
253
254
    // Converts to a Length, mapping various unit types appropriately.
254
    // Converts to a Length, mapping various unit types appropriately.
255
    template<int> Length convertToLength(RenderStyle* currStyle, RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false);
255
    template<int> Length convertToLength(RenderStyle* currStyle, RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false);
Lines 360-366 private: a/Source/WebCore/css/CSSPrimitiveValue.h_sec2
360
    void init(PassRefPtr<CSSCalcValue>);
360
    void init(PassRefPtr<CSSCalcValue>);
361
    bool getDoubleValueInternal(UnitTypes targetUnitType, double* result) const;
361
    bool getDoubleValueInternal(UnitTypes targetUnitType, double* result) const;
362
362
363
    double computeLengthDouble(RenderStyle* currentStyle, RenderStyle* rootStyle, float multiplier, bool computingFontSize);
363
    double computeLengthDouble(RenderStyle* currentStyle, RenderStyle* rootStyle, const IntSize& viewportSize, float multiplier, bool computingFontSize);
364
364
365
    union {
365
    union {
366
        int ident;
366
        int ident;
- a/Source/WebCore/css/CSSPrimitiveValueMappings.h -4 / +4 lines
Lines 4183-4200 template<int supported> Length CSSPrimitiveValue::convertToLength(RenderStyle* s a/Source/WebCore/css/CSSPrimitiveValueMappings.h_sec1
4183
#endif
4183
#endif
4184
    if ((supported & (FixedIntegerConversion | FixedFloatConversion)) && isFontRelativeLength() && (!style || !rootStyle))
4184
    if ((supported & (FixedIntegerConversion | FixedFloatConversion)) && isFontRelativeLength() && (!style || !rootStyle))
4185
        return Length(Undefined);
4185
        return Length(Undefined);
4186
    if ((supported & CalculatedConversion) && isCalculated())
4187
        return Length(cssCalcValue()->toCalcValue(style, rootStyle, multiplier));
4186
    if ((supported & FixedIntegerConversion) && isLength())
4188
    if ((supported & FixedIntegerConversion) && isLength())
4187
        return computeLength<Length>(style, rootStyle, multiplier, computingFontSize);
4189
        return computeLength<Length>(style, rootStyle, IntSize(), multiplier, computingFontSize);
4188
    if ((supported & FixedFloatConversion) && isLength())
4190
    if ((supported & FixedFloatConversion) && isLength())
4189
        return Length(computeLength<double>(style, rootStyle, multiplier), Fixed);
4191
        return Length(computeLength<double>(style, rootStyle, IntSize(), multiplier), Fixed);
4190
    if ((supported & PercentConversion) && isPercentage())
4192
    if ((supported & PercentConversion) && isPercentage())
4191
        return Length(getDoubleValue(), Percent);
4193
        return Length(getDoubleValue(), Percent);
4192
    if ((supported & FractionConversion) && isNumber())
4194
    if ((supported & FractionConversion) && isNumber())
4193
        return Length(getDoubleValue() * 100.0, Percent);
4195
        return Length(getDoubleValue() * 100.0, Percent);
4194
    if ((supported & AutoConversion) && getIdent() == CSSValueAuto)
4196
    if ((supported & AutoConversion) && getIdent() == CSSValueAuto)
4195
        return Length(Auto);
4197
        return Length(Auto);
4196
    if ((supported & CalculatedConversion) && isCalculated())
4197
        return Length(cssCalcValue()->toCalcValue(style, rootStyle, multiplier));
4198
    if ((supported & ViewportPercentageConversion) && isViewportPercentageLength())
4198
    if ((supported & ViewportPercentageConversion) && isViewportPercentageLength())
4199
        return viewportPercentageLength();
4199
        return viewportPercentageLength();
4200
    return Length(Undefined);
4200
    return Length(Undefined);
- a/Source/WebCore/css/CSSToStyleMap.cpp -6 / +6 lines
Lines 248-254 void CSSToStyleMap::mapFillXPosition(CSSPropertyID propertyID, FillLayer* layer, a/Source/WebCore/css/CSSToStyleMap.cpp_sec1
248
248
249
    Length length;
249
    Length length;
250
    if (primitiveValue->isLength())
250
    if (primitiveValue->isLength())
251
        length = primitiveValue->computeLength<Length>(style(), rootElementStyle(), zoomFactor);
251
        length = primitiveValue->computeLength<Length>(style(), rootElementStyle(), IntSize(), zoomFactor);
252
    else if (primitiveValue->isPercentage())
252
    else if (primitiveValue->isPercentage())
253
        length = Length(primitiveValue->getDoubleValue(), Percent);
253
        length = Length(primitiveValue->getDoubleValue(), Percent);
254
    else if (primitiveValue->isCalculatedPercentageWithLength())
254
    else if (primitiveValue->isCalculatedPercentageWithLength())
Lines 284-290 void CSSToStyleMap::mapFillYPosition(CSSPropertyID propertyID, FillLayer* layer, a/Source/WebCore/css/CSSToStyleMap.cpp_sec2
284
284
285
    Length length;
285
    Length length;
286
    if (primitiveValue->isLength())
286
    if (primitiveValue->isLength())
287
        length = primitiveValue->computeLength<Length>(style(), rootElementStyle(), zoomFactor);
287
        length = primitiveValue->computeLength<Length>(style(), rootElementStyle(), IntSize(), zoomFactor);
288
    else if (primitiveValue->isPercentage())
288
    else if (primitiveValue->isPercentage())
289
        length = Length(primitiveValue->getDoubleValue(), Percent);
289
        length = Length(primitiveValue->getDoubleValue(), Percent);
290
    else if (primitiveValue->isCalculatedPercentageWithLength())
290
    else if (primitiveValue->isCalculatedPercentageWithLength())
Lines 614-641 LengthBox CSSToStyleMap::mapNinePieceImageQuad(CSSValue* value) a/Source/WebCore/css/CSSToStyleMap.cpp_sec3
614
    else if (slices->top()->isPercentage())
614
    else if (slices->top()->isPercentage())
615
        box.m_top = Length(slices->top()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
615
        box.m_top = Length(slices->top()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
616
    else if (slices->top()->getIdent() != CSSValueAuto)
616
    else if (slices->top()->getIdent() != CSSValueAuto)
617
        box.m_top = slices->top()->computeLength<Length>(style(), rootElementStyle(), zoom);
617
        box.m_top = slices->top()->convertToLength<FixedFloatConversion | ViewportPercentageConversion>(style(), rootElementStyle(), zoom);
618
618
619
    if (slices->right()->isNumber())
619
    if (slices->right()->isNumber())
620
        box.m_right = Length(slices->right()->getIntValue(), Relative);
620
        box.m_right = Length(slices->right()->getIntValue(), Relative);
621
    else if (slices->right()->isPercentage())
621
    else if (slices->right()->isPercentage())
622
        box.m_right = Length(slices->right()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
622
        box.m_right = Length(slices->right()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
623
    else if (slices->right()->getIdent() != CSSValueAuto)
623
    else if (slices->right()->getIdent() != CSSValueAuto)
624
        box.m_right = slices->right()->computeLength<Length>(style(), rootElementStyle(), zoom);
624
        box.m_right = slices->right()->convertToLength<FixedFloatConversion | ViewportPercentageConversion>(style(), rootElementStyle(), zoom);
625
625
626
    if (slices->bottom()->isNumber())
626
    if (slices->bottom()->isNumber())
627
        box.m_bottom = Length(slices->bottom()->getIntValue(), Relative);
627
        box.m_bottom = Length(slices->bottom()->getIntValue(), Relative);
628
    else if (slices->bottom()->isPercentage())
628
    else if (slices->bottom()->isPercentage())
629
        box.m_bottom = Length(slices->bottom()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
629
        box.m_bottom = Length(slices->bottom()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
630
    else if (slices->bottom()->getIdent() != CSSValueAuto)
630
    else if (slices->bottom()->getIdent() != CSSValueAuto)
631
        box.m_bottom = slices->bottom()->computeLength<Length>(style(), rootElementStyle(), zoom);
631
        box.m_bottom = slices->bottom()->convertToLength<FixedFloatConversion | ViewportPercentageConversion>(style(), rootElementStyle(), zoom);
632
632
633
    if (slices->left()->isNumber())
633
    if (slices->left()->isNumber())
634
        box.m_left = Length(slices->left()->getIntValue(), Relative);
634
        box.m_left = Length(slices->left()->getIntValue(), Relative);
635
    else if (slices->left()->isPercentage())
635
    else if (slices->left()->isPercentage())
636
        box.m_left = Length(slices->left()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
636
        box.m_left = Length(slices->left()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
637
    else if (slices->left()->getIdent() != CSSValueAuto)
637
    else if (slices->left()->getIdent() != CSSValueAuto)
638
        box.m_left = slices->left()->computeLength<Length>(style(), rootElementStyle(), zoom);
638
        box.m_left = slices->left()->convertToLength<FixedFloatConversion | ViewportPercentageConversion>(style(), rootElementStyle(), zoom);
639
639
640
    return box;
640
    return box;
641
}
641
}
- a/Source/WebCore/css/LengthFunctions.cpp -60 / +24 lines
Lines 30-46 a/Source/WebCore/css/LengthFunctions.cpp_sec1
30
30
31
namespace WebCore {
31
namespace WebCore {
32
32
33
int minimumIntValueForLength(const Length& length, LayoutUnit maximumValue, RenderView* renderView, bool roundPercentages)
33
int minimumIntValueForLength(const Length& length, LayoutUnit maximumValue, const IntSize& viewportSize, bool roundPercentages)
34
{
34
{
35
    return static_cast<int>(minimumValueForLength(length, maximumValue, renderView, roundPercentages));
35
    return static_cast<int>(minimumValueForLength(length, maximumValue, viewportSize, roundPercentages));
36
}
36
}
37
37
38
int intValueForLength(const Length& length, LayoutUnit maximumValue, RenderView* renderView, bool roundPercentages)
38
int intValueForLength(const Length& length, LayoutUnit maximumValue, const IntSize& viewportSize, bool roundPercentages)
39
{
39
{
40
    return static_cast<int>(valueForLength(length, maximumValue, renderView, roundPercentages));
40
    return static_cast<int>(valueForLength(length, maximumValue, viewportSize, roundPercentages));
41
}
41
}
42
42
43
LayoutUnit minimumValueForLength(const Length& length, LayoutUnit maximumValue, RenderView* renderView, bool roundPercentages)
43
LayoutUnit minimumValueForLength(const Length& length, LayoutUnit maximumValue, const IntSize& viewportSize, bool roundPercentages)
44
{
44
{
45
    switch (length.type()) {
45
    switch (length.type()) {
46
    case Fixed:
46
    case Fixed:
Lines 51-77 LayoutUnit minimumValueForLength(const Length& length, LayoutUnit maximumValue, a/Source/WebCore/css/LengthFunctions.cpp_sec2
51
        // Don't remove the extra cast to float. It is needed for rounding on 32-bit Intel machines that use the FPU stack.
51
        // Don't remove the extra cast to float. It is needed for rounding on 32-bit Intel machines that use the FPU stack.
52
        return static_cast<LayoutUnit>(static_cast<float>(maximumValue * length.percent() / 100.0f));
52
        return static_cast<LayoutUnit>(static_cast<float>(maximumValue * length.percent() / 100.0f));
53
    case Calculated:
53
    case Calculated:
54
        return length.nonNanCalculatedValue(maximumValue);
54
        return length.nonNanCalculatedValue(maximumValue, viewportSize);
55
    case ViewportPercentageWidth:
55
    case ViewportPercentageWidth:
56
        if (renderView)
56
        return static_cast<LayoutUnit>(viewportSize.width() * length.viewportPercentageLength() / 100.0f);
57
            return static_cast<LayoutUnit>(renderView->viewportSize().width() * length.viewportPercentageLength() / 100.0f);
58
        return 0;
59
    case ViewportPercentageHeight:
57
    case ViewportPercentageHeight:
60
        if (renderView)
58
        return static_cast<LayoutUnit>(viewportSize.height() * length.viewportPercentageLength() / 100.0f);
61
            return static_cast<LayoutUnit>(renderView->viewportSize().height() * length.viewportPercentageLength() / 100.0f);
62
        return 0;
63
    case ViewportPercentageMin:
59
    case ViewportPercentageMin:
64
        if (renderView) {
60
        return static_cast<LayoutUnit>(std::min(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
65
            IntSize viewportSize = renderView->viewportSize();
66
            return static_cast<LayoutUnit>(std::min(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
67
        }
68
        return 0;
69
    case ViewportPercentageMax:
61
    case ViewportPercentageMax:
70
        if (renderView) {
62
        return static_cast<LayoutUnit>(std::max(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
71
            IntSize viewportSize = renderView->viewportSize();
72
            return static_cast<LayoutUnit>(std::max(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
73
        }
74
        return 0;
75
    case FillAvailable:
63
    case FillAvailable:
76
    case Auto:
64
    case Auto:
77
        return 0;
65
        return 0;
Lines 89-95 LayoutUnit minimumValueForLength(const Length& length, LayoutUnit maximumValue, a/Source/WebCore/css/LengthFunctions.cpp_sec3
89
    return 0;
77
    return 0;
90
}
78
}
91
79
92
LayoutUnit valueForLength(const Length& length, LayoutUnit maximumValue, RenderView* renderView, bool roundPercentages)
80
LayoutUnit valueForLength(const Length& length, LayoutUnit maximumValue, const IntSize& viewportSize, bool roundPercentages)
93
{
81
{
94
    switch (length.type()) {
82
    switch (length.type()) {
95
    case Fixed:
83
    case Fixed:
Lines 99-105 LayoutUnit valueForLength(const Length& length, LayoutUnit maximumValue, RenderV a/Source/WebCore/css/LengthFunctions.cpp_sec4
99
    case ViewportPercentageHeight:
87
    case ViewportPercentageHeight:
100
    case ViewportPercentageMin:
88
    case ViewportPercentageMin:
101
    case ViewportPercentageMax:
89
    case ViewportPercentageMax:
102
        return minimumValueForLength(length, maximumValue, renderView, roundPercentages);
90
        return minimumValueForLength(length, maximumValue, viewportSize, roundPercentages);
103
    case FillAvailable:
91
    case FillAvailable:
104
    case Auto:
92
    case Auto:
105
        return maximumValue;
93
        return maximumValue;
Lines 118-124 LayoutUnit valueForLength(const Length& length, LayoutUnit maximumValue, RenderV a/Source/WebCore/css/LengthFunctions.cpp_sec5
118
}
106
}
119
107
120
// FIXME: when subpixel layout is supported this copy of floatValueForLength() can be removed. See bug 71143.
108
// FIXME: when subpixel layout is supported this copy of floatValueForLength() can be removed. See bug 71143.
121
float floatValueForLength(const Length& length, LayoutUnit maximumValue, RenderView* renderView)
109
float floatValueForLength(const Length& length, LayoutUnit maximumValue, const IntSize& viewportSize)
122
{
110
{
123
    switch (length.type()) {
111
    switch (length.type()) {
124
    case Fixed:
112
    case Fixed:
Lines 129-155 float floatValueForLength(const Length& length, LayoutUnit maximumValue, RenderV a/Source/WebCore/css/LengthFunctions.cpp_sec6
129
    case Auto:
117
    case Auto:
130
        return static_cast<float>(maximumValue);
118
        return static_cast<float>(maximumValue);
131
    case Calculated:
119
    case Calculated:
132
        return length.nonNanCalculatedValue(maximumValue);                
120
        return length.nonNanCalculatedValue(maximumValue, viewportSize);
133
    case ViewportPercentageWidth:
121
    case ViewportPercentageWidth:
134
        if (renderView)
122
        return static_cast<int>(viewportSize.width() * length.viewportPercentageLength() / 100.0f);
135
            return static_cast<int>(renderView->viewportSize().width() * length.viewportPercentageLength() / 100.0f);
136
        return 0;
137
    case ViewportPercentageHeight:
123
    case ViewportPercentageHeight:
138
        if (renderView)
124
        return static_cast<float>(viewportSize.height() * length.viewportPercentageLength() / 100.0f);
139
            return static_cast<int>(renderView->viewportSize().height() * length.viewportPercentageLength() / 100.0f);
140
        return 0;
141
    case ViewportPercentageMin:
125
    case ViewportPercentageMin:
142
        if (renderView) {
126
        return static_cast<float>(std::min(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
143
            IntSize viewportSize = renderView->viewportSize();
144
            return static_cast<int>(std::min(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
145
        }
146
        return 0;
147
    case ViewportPercentageMax:
127
    case ViewportPercentageMax:
148
        if (renderView) {
128
        return static_cast<float>(std::max(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
149
            IntSize viewportSize = renderView->viewportSize();
150
            return static_cast<int>(std::max(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
151
        }
152
        return 0;
153
    case Relative:
129
    case Relative:
154
    case Intrinsic:
130
    case Intrinsic:
155
    case MinIntrinsic:
131
    case MinIntrinsic:
Lines 164-170 float floatValueForLength(const Length& length, LayoutUnit maximumValue, RenderV a/Source/WebCore/css/LengthFunctions.cpp_sec7
164
    return 0;
140
    return 0;
165
}
141
}
166
142
167
float floatValueForLength(const Length& length, float maximumValue, RenderView* renderView)
143
float floatValueForLength(const Length& length, float maximumValue, const IntSize& viewportSize)
168
{
144
{
169
    switch (length.type()) {
145
    switch (length.type()) {
170
    case Fixed:
146
    case Fixed:
Lines 175-201 float floatValueForLength(const Length& length, float maximumValue, RenderView* a/Source/WebCore/css/LengthFunctions.cpp_sec8
175
    case Auto:
151
    case Auto:
176
        return static_cast<float>(maximumValue);
152
        return static_cast<float>(maximumValue);
177
    case Calculated:
153
    case Calculated:
178
        return length.nonNanCalculatedValue(maximumValue);
154
        return length.nonNanCalculatedValue(maximumValue, viewportSize);
179
    case ViewportPercentageWidth:
155
    case ViewportPercentageWidth:
180
        if (renderView)
156
        return static_cast<float>(viewportSize.width() * length.viewportPercentageLength() / 100.0f);
181
            return static_cast<int>(renderView->viewportSize().width() * length.viewportPercentageLength() / 100.0f);
182
        return 0;
183
    case ViewportPercentageHeight:
157
    case ViewportPercentageHeight:
184
        if (renderView)
158
        return static_cast<float>(viewportSize.height() * length.viewportPercentageLength() / 100.0f);
185
            return static_cast<int>(renderView->viewportSize().height() * length.viewportPercentageLength() / 100.0f);
186
        return 0;
187
    case ViewportPercentageMin:
159
    case ViewportPercentageMin:
188
        if (renderView) {
160
        return static_cast<float>(std::min(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
189
            IntSize viewportSize = renderView->viewportSize();
190
            return static_cast<int>(std::min(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
191
        }
192
        return 0;
193
    case ViewportPercentageMax:
161
    case ViewportPercentageMax:
194
        if (renderView) {
162
        return static_cast<float>(std::max(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
195
            IntSize viewportSize = renderView->viewportSize();
196
            return static_cast<int>(std::max(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
197
        }
198
        return 0;
199
    case Relative:
163
    case Relative:
200
    case Intrinsic:
164
    case Intrinsic:
201
    case MinIntrinsic:
165
    case MinIntrinsic:
- a/Source/WebCore/css/LengthFunctions.h -7 / +7 lines
Lines 26-41 a/Source/WebCore/css/LengthFunctions.h_sec1
26
26
27
namespace WebCore {
27
namespace WebCore {
28
28
29
class IntSize;
29
class LayoutUnit;
30
class LayoutUnit;
30
class RenderView;
31
struct Length;
31
struct Length;
32
32
33
int minimumIntValueForLength(const Length&, LayoutUnit maximumValue, RenderView* = 0, bool roundPercentages = false);
33
int minimumIntValueForLength(const Length&, LayoutUnit maximumValue, const IntSize& viewportSize, bool roundPercentages = false);
34
int intValueForLength(const Length&, LayoutUnit maximumValue, RenderView* = 0, bool roundPercentages = false);
34
int intValueForLength(const Length&, LayoutUnit maximumValue, const IntSize& viewportSize, bool roundPercentages = false);
35
LayoutUnit minimumValueForLength(const Length&, LayoutUnit maximumValue, RenderView* = 0, bool roundPercentages = false);
35
LayoutUnit minimumValueForLength(const Length&, LayoutUnit maximumValue, const IntSize& viewportSize, bool roundPercentages = false);
36
LayoutUnit valueForLength(const Length&, LayoutUnit maximumValue, RenderView* = 0, bool roundPercentages = false);
36
LayoutUnit valueForLength(const Length&, LayoutUnit maximumValue, const IntSize& viewportSize, bool roundPercentages = false);
37
float floatValueForLength(const Length&, LayoutUnit maximumValue, RenderView* = 0);
37
float floatValueForLength(const Length&, LayoutUnit maximumValue, const IntSize& viewportSize);
38
float floatValueForLength(const Length&, float maximumValue, RenderView* = 0);
38
float floatValueForLength(const Length&, float maximumValue, const IntSize& viewportSize);
39
39
40
} // namespace WebCore
40
} // namespace WebCore
41
41
- a/Source/WebCore/css/MediaQueryEvaluator.cpp -6 / +6 lines
Lines 424-430 static bool gridMediaFeatureEval(CSSValue* value, RenderStyle*, Frame*, MediaFea a/Source/WebCore/css/MediaQueryEvaluator.cpp_sec1
424
    return false;
424
    return false;
425
}
425
}
426
426
427
static bool computeLength(CSSValue* value, bool strict, RenderStyle* style, RenderStyle* rootStyle, int& result)
427
static bool computeLength(CSSValue* value, bool strict, RenderStyle* style, RenderStyle* rootStyle, const IntSize& viewportSize, int& result)
428
{
428
{
429
    if (!value->isPrimitiveValue())
429
    if (!value->isPrimitiveValue())
430
        return false;
430
        return false;
Lines 437-443 static bool computeLength(CSSValue* value, bool strict, RenderStyle* style, Rend a/Source/WebCore/css/MediaQueryEvaluator.cpp_sec2
437
    }
437
    }
438
438
439
    if (primitiveValue->isLength()) {
439
    if (primitiveValue->isLength()) {
440
        result = primitiveValue->computeLength<int>(style, rootStyle);
440
        result = primitiveValue->computeLength<int>(style, rootStyle, viewportSize);
441
        return true;
441
        return true;
442
    }
442
    }
443
443
Lines 452-458 static bool device_heightMediaFeatureEval(CSSValue* value, RenderStyle* style, F a/Source/WebCore/css/MediaQueryEvaluator.cpp_sec3
452
        int length;
452
        int length;
453
        long height = sg.height();
453
        long height = sg.height();
454
        InspectorInstrumentation::applyScreenHeightOverride(frame, &height);
454
        InspectorInstrumentation::applyScreenHeightOverride(frame, &height);
455
        return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(static_cast<int>(height), length, op);
455
        return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, frame->document()->viewportSize(), length) && compareValue(static_cast<int>(height), length, op);
456
    }
456
    }
457
    // ({,min-,max-}device-height)
457
    // ({,min-,max-}device-height)
458
    // assume if we have a device, assume non-zero
458
    // assume if we have a device, assume non-zero
Lines 467-473 static bool device_widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Fr a/Source/WebCore/css/MediaQueryEvaluator.cpp_sec4
467
        int length;
467
        int length;
468
        long width = sg.width();
468
        long width = sg.width();
469
        InspectorInstrumentation::applyScreenWidthOverride(frame, &width);
469
        InspectorInstrumentation::applyScreenWidthOverride(frame, &width);
470
        return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(static_cast<int>(width), length, op);
470
        return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, frame->document()->viewportSize(), length) && compareValue(static_cast<int>(width), length, op);
471
    }
471
    }
472
    // ({,min-,max-}device-width)
472
    // ({,min-,max-}device-width)
473
    // assume if we have a device, assume non-zero
473
    // assume if we have a device, assume non-zero
Lines 484-490 static bool heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* f a/Source/WebCore/css/MediaQueryEvaluator.cpp_sec5
484
            height = adjustForAbsoluteZoom(height, renderView);
484
            height = adjustForAbsoluteZoom(height, renderView);
485
        RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
485
        RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
486
        int length;
486
        int length;
487
        return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(height, length, op);
487
        return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, frame->document()->viewportSize(), length) && compareValue(height, length, op);
488
    }
488
    }
489
489
490
    return view->layoutHeight() != 0;
490
    return view->layoutHeight() != 0;
Lines 500-506 static bool widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* fr a/Source/WebCore/css/MediaQueryEvaluator.cpp_sec6
500
            width = adjustForAbsoluteZoom(width, renderView);
500
            width = adjustForAbsoluteZoom(width, renderView);
501
        RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
501
        RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
502
        int length;
502
        int length;
503
        return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(width, length, op);
503
        return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, frame->document()->viewportSize(), length) && compareValue(width, length, op);
504
    }
504
    }
505
505
506
    return view->layoutWidth() != 0;
506
    return view->layoutWidth() != 0;
- a/Source/WebCore/css/SVGCSSStyleSelector.cpp -3 / +5 lines
Lines 564-573 void StyleResolver::applySVGProperty(CSSPropertyID id, CSSValue* value) a/Source/WebCore/css/SVGCSSStyleSelector.cpp_sec1
564
            CSSValue* firstValue = list->itemWithoutBoundsCheck(0);
564
            CSSValue* firstValue = list->itemWithoutBoundsCheck(0);
565
            if (!firstValue->isShadowValue())
565
            if (!firstValue->isShadowValue())
566
                return;
566
                return;
567
567
            ShadowValue* item = static_cast<ShadowValue*>(firstValue);
568
            ShadowValue* item = static_cast<ShadowValue*>(firstValue);
568
            IntPoint location(item->x->computeLength<int>(state.style(), state.rootElementStyle()),
569
            const IntSize& viewportSize = state.document()->viewportSize();
569
                item->y->computeLength<int>(state.style(), state.rootElementStyle()));
570
            IntPoint location(item->x->computeLength<int>(state.style(), state.rootElementStyle(), viewportSize),
570
            int blur = item->blur ? item->blur->computeLength<int>(state.style(), state.rootElementStyle()) : 0;
571
                item->y->computeLength<int>(state.style(), state.rootElementStyle(), viewportSize));
572
            int blur = item->blur ? item->blur->computeLength<int>(state.style(), state.rootElementStyle(), viewportSize) : 0;
571
            Color color;
573
            Color color;
572
            if (item->color)
574
            if (item->color)
573
                color = colorFromPrimitiveValue(item->color.get());
575
                color = colorFromPrimitiveValue(item->color.get());
- a/Source/WebCore/css/StyleBuilder.cpp -15 / +16 lines
Lines 219-225 public: a/Source/WebCore/css/StyleBuilder.cpp_sec1
219
        else if (valueType == Number)
219
        else if (valueType == Number)
220
            setValue(styleResolver->style(), *primitiveValue);
220
            setValue(styleResolver->style(), *primitiveValue);
221
        else if (valueType == ComputeLength)
221
        else if (valueType == ComputeLength)
222
            setValue(styleResolver->style(), primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()));
222
            setValue(styleResolver->style(), primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->document()->viewportSize(), styleResolver->style()->effectiveZoom()));
223
    }
223
    }
224
224
225
    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
225
    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
Lines 386-392 public: a/Source/WebCore/css/StyleBuilder.cpp_sec2
386
        if (autoEnabled && primitiveValue->getIdent() == CSSValueAuto)
386
        if (autoEnabled && primitiveValue->getIdent() == CSSValueAuto)
387
            setValue(styleResolver->style(), Length());
387
            setValue(styleResolver->style(), Length());
388
        else if (primitiveValue->isLength()) {
388
        else if (primitiveValue->isLength()) {
389
            Length length = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
389
            Length length = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->document()->viewportSize(), styleResolver->style()->effectiveZoom());
390
            length.setQuirk(primitiveValue->isQuirkValue());
390
            length.setQuirk(primitiveValue->isQuirkValue());
391
            setValue(styleResolver->style(), length);
391
            setValue(styleResolver->style(), length);
392
        } else if (primitiveValue->isPercentage())
392
        } else if (primitiveValue->isPercentage())
Lines 450-456 public: a/Source/WebCore/css/StyleBuilder.cpp_sec3
450
        else if (pair->first()->isCalculatedPercentageWithLength())
450
        else if (pair->first()->isCalculatedPercentageWithLength())
451
            radiusWidth = Length((pair->first()->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
451
            radiusWidth = Length((pair->first()->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
452
        else
452
        else
453
            radiusWidth = pair->first()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
453
            radiusWidth = pair->first()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->document()->viewportSize(), styleResolver->style()->effectiveZoom());
454
        if (pair->second()->isPercentage())
454
        if (pair->second()->isPercentage())
455
            radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
455
            radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
456
        else if (pair->second()->isViewportPercentageLength())
456
        else if (pair->second()->isViewportPercentageLength())
Lines 458-464 public: a/Source/WebCore/css/StyleBuilder.cpp_sec4
458
        else if (pair->second()->isCalculatedPercentageWithLength())
458
        else if (pair->second()->isCalculatedPercentageWithLength())
459
            radiusHeight = Length((pair->second()->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
459
            radiusHeight = Length((pair->second()->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
460
        else
460
        else
461
            radiusHeight = pair->second()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
461
            radiusHeight = pair->second()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->document()->viewportSize(), styleResolver->style()->effectiveZoom());
462
        int width = radiusWidth.value();
462
        int width = radiusWidth.value();
463
        int height = radiusHeight.value();
463
        int height = radiusHeight.value();
464
        if (width < 0 || height < 0)
464
        if (width < 0 || height < 0)
Lines 603-614 public: a/Source/WebCore/css/StyleBuilder.cpp_sec5
603
            length = 5;
603
            length = 5;
604
        } else if (ident == CSSValueInvalid) {
604
        } else if (ident == CSSValueInvalid) {
605
            float zoom = (svgZoomEnabled && styleResolver->useSVGZoomRules()) ? 1.0f : styleResolver->style()->effectiveZoom();
605
            float zoom = (svgZoomEnabled && styleResolver->useSVGZoomRules()) ? 1.0f : styleResolver->style()->effectiveZoom();
606
            const IntSize& viewportSize = styleResolver->document()->viewportSize();
606
607
607
            // Any original result that was >= 1 should not be allowed to fall below 1.
608
            // Any original result that was >= 1 should not be allowed to fall below 1.
608
            // This keeps border lines from vanishing.
609
            // This keeps border lines from vanishing.
609
            length = primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), zoom);
610
            length = primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), viewportSize, zoom);
610
            if (zoom < 1.0f && length < 1.0) {
611
            if (zoom < 1.0f && length < 1.0) {
611
                T originalLength = primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), 1.0);
612
                T originalLength = primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), viewportSize, 1.0);
612
                if (originalLength >= 1.0)
613
                if (originalLength >= 1.0)
613
                    length = 1.0;
614
                    length = 1.0;
614
            }
615
            }
Lines 751-763 public: a/Source/WebCore/css/StyleBuilder.cpp_sec6
751
            fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize
752
            fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize
752
                                              || !(primitiveValue->isPercentage() || primitiveValue->isFontRelativeLength()));
753
                                              || !(primitiveValue->isPercentage() || primitiveValue->isFontRelativeLength()));
753
            if (primitiveValue->isLength())
754
            if (primitiveValue->isLength())
754
                size = primitiveValue->computeLength<float>(styleResolver->parentStyle(), styleResolver->rootElementStyle(), 1.0, true);
755
                size = primitiveValue->computeLength<float>(styleResolver->parentStyle(), styleResolver->rootElementStyle(), styleResolver->document()->viewportSize(), 1.0, true);
755
            else if (primitiveValue->isPercentage())
756
            else if (primitiveValue->isPercentage())
756
                size = (primitiveValue->getFloatValue() * parentSize) / 100.0f;
757
                size = (primitiveValue->getFloatValue() * parentSize) / 100.0f;
757
            else if (primitiveValue->isCalculatedPercentageWithLength())
758
            else if (primitiveValue->isCalculatedPercentageWithLength())
758
                size = primitiveValue->cssCalcValue()->toCalcValue(styleResolver->parentStyle(), styleResolver->rootElementStyle())->evaluate(parentSize);
759
                size = primitiveValue->cssCalcValue()->toCalcValue(styleResolver->parentStyle(), styleResolver->rootElementStyle())->evaluate(parentSize, styleResolver->document()->viewportSize());
759
            else if (primitiveValue->isViewportPercentageLength())
760
            else if (primitiveValue->isViewportPercentageLength())
760
                size = valueForLength(primitiveValue->viewportPercentageLength(), 0, styleResolver->document()->renderView());
761
                size = valueForLength(primitiveValue->viewportPercentageLength(), 0, styleResolver->document()->viewportSize());
761
            else
762
            else
762
                return;
763
                return;
763
        }
764
        }
Lines 1165-1171 public: a/Source/WebCore/css/StyleBuilder.cpp_sec7
1165
            double multiplier = styleResolver->style()->effectiveZoom();
1166
            double multiplier = styleResolver->style()->effectiveZoom();
1166
            if (Frame* frame = styleResolver->document()->frame())
1167
            if (Frame* frame = styleResolver->document()->frame())
1167
                multiplier *= frame->textZoomFactor();
1168
                multiplier *= frame->textZoomFactor();
1168
            lineHeight = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), multiplier);
1169
            lineHeight = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->document()->viewportSize(), multiplier);
1169
        } else if (primitiveValue->isPercentage()) {
1170
        } else if (primitiveValue->isPercentage()) {
1170
            // FIXME: percentage should not be restricted to an integer here.
1171
            // FIXME: percentage should not be restricted to an integer here.
1171
            lineHeight = Length((styleResolver->style()->fontSize() * primitiveValue->getIntValue()) / 100, Fixed);
1172
            lineHeight = Length((styleResolver->style()->fontSize() * primitiveValue->getIntValue()) / 100, Fixed);
Lines 1187-1194 public: a/Source/WebCore/css/StyleBuilder.cpp_sec8
1187
1188
1188
class ApplyPropertyPageSize {
1189
class ApplyPropertyPageSize {
1189
private:
1190
private:
1190
    static Length mmLength(double mm) { return CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM)->computeLength<Length>(0, 0); }
1191
    static Length mmLength(double mm) { return CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM)->computeLength<Length>(0, 0, IntSize()); }
1191
    static Length inchLength(double inch) { return CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLength<Length>(0, 0); }
1192
    static Length inchLength(double inch) { return CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLength<Length>(0, 0, IntSize()); }
1192
    static bool getPageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height)
1193
    static bool getPageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height)
1193
    {
1194
    {
1194
        DEFINE_STATIC_LOCAL(Length, a5Width, (mmLength(148)));
1195
        DEFINE_STATIC_LOCAL(Length, a5Width, (mmLength(148)));
Lines 1283-1290 public: a/Source/WebCore/css/StyleBuilder.cpp_sec9
1283
                // <length>{2}
1284
                // <length>{2}
1284
                if (!second->isLength())
1285
                if (!second->isLength())
1285
                    return;
1286
                    return;
1286
                width = first->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
1287
                width = first->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->document()->viewportSize());
1287
                height = second->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
1288
                height = second->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->document()->viewportSize());
1288
            } else {
1289
            } else {
1289
                // <page-size> <orientation>
1290
                // <page-size> <orientation>
1290
                // The value order is guaranteed. See CSSParser::parseSizeParameter.
1291
                // The value order is guaranteed. See CSSParser::parseSizeParameter.
Lines 1302-1308 public: a/Source/WebCore/css/StyleBuilder.cpp_sec10
1302
            if (primitiveValue->isLength()) {
1303
            if (primitiveValue->isLength()) {
1303
                // <length>
1304
                // <length>
1304
                pageSizeType = PAGE_SIZE_RESOLVED;
1305
                pageSizeType = PAGE_SIZE_RESOLVED;
1305
                width = height = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
1306
                width = height = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->document()->viewportSize());
1306
            } else {
1307
            } else {
1307
                switch (primitiveValue->getIdent()) {
1308
                switch (primitiveValue->getIdent()) {
1308
                case 0:
1309
                case 0:
- a/Source/WebCore/css/StyleResolver.cpp -13 / +14 lines
Lines 3164-3173 void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value) a/Source/WebCore/css/StyleResolver.cpp_sec1
3164
            if (!currValue->isShadowValue())
3164
            if (!currValue->isShadowValue())
3165
                continue;
3165
                continue;
3166
            ShadowValue* item = static_cast<ShadowValue*>(currValue);
3166
            ShadowValue* item = static_cast<ShadowValue*>(currValue);
3167
            int x = item->x->computeLength<int>(state.style(), state.rootElementStyle(), zoomFactor);
3167
            const IntSize& viewportSize = state.document()->viewportSize();
3168
            int y = item->y->computeLength<int>(state.style(), state.rootElementStyle(), zoomFactor);
3168
            int x = item->x->computeLength<int>(state.style(), state.rootElementStyle(), viewportSize, zoomFactor);
3169
            int blur = item->blur ? item->blur->computeLength<int>(state.style(), state.rootElementStyle(), zoomFactor) : 0;
3169
            int y = item->y->computeLength<int>(state.style(), state.rootElementStyle(), viewportSize, zoomFactor);
3170
            int spread = item->spread ? item->spread->computeLength<int>(state.style(), state.rootElementStyle(), zoomFactor) : 0;
3170
            int blur = item->blur ? item->blur->computeLength<int>(state.style(), state.rootElementStyle(), viewportSize, zoomFactor) : 0;
3171
            int spread = item->spread ? item->spread->computeLength<int>(state.style(), state.rootElementStyle(), viewportSize, zoomFactor) : 0;
3171
            ShadowStyle shadowStyle = item->style && item->style->getIdent() == CSSValueInset ? Inset : Normal;
3172
            ShadowStyle shadowStyle = item->style && item->style->getIdent() == CSSValueInset ? Inset : Normal;
3172
            Color color;
3173
            Color color;
3173
            if (item->color)
3174
            if (item->color)
Lines 3343-3353 void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value) a/Source/WebCore/css/StyleResolver.cpp_sec2
3343
                result *= 3;
3344
                result *= 3;
3344
            else if (primitiveValue->getIdent() == CSSValueThick)
3345
            else if (primitiveValue->getIdent() == CSSValueThick)
3345
                result *= 5;
3346
                result *= 5;
3346
            width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS)->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
3347
            width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS)->computeLength<float>(state.style(), state.rootElementStyle(), IntSize(), zoomFactor);
3347
            break;
3348
            break;
3348
        }
3349
        }
3349
        default:
3350
        default:
3350
            width = primitiveValue->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
3351
            width = primitiveValue->computeLength<float>(state.style(), state.rootElementStyle(), state.document()->viewportSize(), zoomFactor);
3351
            break;
3352
            break;
3352
        }
3353
        }
3353
        state.style()->setTextStrokeWidth(width);
3354
        state.style()->setTextStrokeWidth(width);
Lines 3373-3382 void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value) a/Source/WebCore/css/StyleResolver.cpp_sec3
3373
3374
3374
        float perspectiveValue;
3375
        float perspectiveValue;
3375
        if (primitiveValue->isLength())
3376
        if (primitiveValue->isLength())
3376
            perspectiveValue = primitiveValue->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
3377
            perspectiveValue = primitiveValue->computeLength<float>(state.style(), state.rootElementStyle(), IntSize(), zoomFactor);
3377
        else if (primitiveValue->isNumber()) {
3378
        else if (primitiveValue->isNumber()) {
3378
            // For backward compatibility, treat valueless numbers as px.
3379
            // For backward compatibility, treat valueless numbers as px.
3379
            perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
3380
            perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(state.style(), state.rootElementStyle(), IntSize(), zoomFactor);
3380
        } else
3381
        } else
3381
            return;
3382
            return;
3382
3383
Lines 3530-3536 void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value) a/Source/WebCore/css/StyleResolver.cpp_sec4
3530
    case CSSPropertyWebkitFilter: {
3531
    case CSSPropertyWebkitFilter: {
3531
        HANDLE_INHERIT_AND_INITIAL(filter, Filter);
3532
        HANDLE_INHERIT_AND_INITIAL(filter, Filter);
3532
        FilterOperations operations;
3533
        FilterOperations operations;
3533
        if (createFilterOperations(value, state.style(), state.rootElementStyle(), operations))
3534
        if (createFilterOperations(value, state.style(), state.rootElementStyle(), state.document()->viewportSize(), operations))
3534
            state.style()->setFilter(operations);
3535
            state.style()->setFilter(operations);
3535
        return;
3536
        return;
3536
    }
3537
    }
Lines 4841-4847 PassRefPtr<CustomFilterOperation> StyleResolver::createCustomFilterOperation(Web a/Source/WebCore/css/StyleResolver.cpp_sec5
4841
4842
4842
#endif
4843
#endif
4843
4844
4844
bool StyleResolver::createFilterOperations(CSSValue* inValue, RenderStyle* style, RenderStyle* rootStyle, FilterOperations& outOperations)
4845
bool StyleResolver::createFilterOperations(CSSValue* inValue, RenderStyle* style, RenderStyle* rootStyle, const IntSize& viewportSize, FilterOperations& outOperations)
4845
{
4846
{
4846
    ASSERT(outOperations.isEmpty());
4847
    ASSERT(outOperations.isEmpty());
4847
    
4848
    
Lines 4976-4984 bool StyleResolver::createFilterOperations(CSSValue* inValue, RenderStyle* style a/Source/WebCore/css/StyleResolver.cpp_sec6
4976
                continue;
4977
                continue;
4977
4978
4978
            ShadowValue* item = static_cast<ShadowValue*>(cssValue);
4979
            ShadowValue* item = static_cast<ShadowValue*>(cssValue);
4979
            IntPoint location(item->x->computeLength<int>(style, rootStyle, zoomFactor),
4980
            IntPoint location(item->x->computeLength<int>(style, rootStyle, viewportSize, zoomFactor),
4980
                              item->y->computeLength<int>(style, rootStyle, zoomFactor));
4981
                              item->y->computeLength<int>(style, rootStyle, viewportSize, zoomFactor));
4981
            int blur = item->blur ? item->blur->computeLength<int>(style, rootStyle, zoomFactor) : 0;
4982
            int blur = item->blur ? item->blur->computeLength<int>(style, rootStyle, viewportSize, zoomFactor) : 0;
4982
            Color color;
4983
            Color color;
4983
            if (item->color)
4984
            if (item->color)
4984
                color = colorFromPrimitiveValue(item->color.get());
4985
                color = colorFromPrimitiveValue(item->color.get());
- a/Source/WebCore/css/StyleResolver.h -1 / +1 lines
Lines 304-310 public: a/Source/WebCore/css/StyleResolver.h_sec1
304
    void invalidateMatchedPropertiesCache();
304
    void invalidateMatchedPropertiesCache();
305
305
306
#if ENABLE(CSS_FILTERS)
306
#if ENABLE(CSS_FILTERS)
307
    bool createFilterOperations(CSSValue* inValue, RenderStyle* inStyle, RenderStyle* rootStyle, FilterOperations& outOperations);
307
    bool createFilterOperations(CSSValue* inValue, RenderStyle* inStyle, RenderStyle* rootStyle, const IntSize& viewportSize, FilterOperations& outOperations);
308
#if ENABLE(CSS_SHADERS)
308
#if ENABLE(CSS_SHADERS)
309
    StyleShader* styleShader(CSSValue*);
309
    StyleShader* styleShader(CSSValue*);
310
    StyleShader* cachedOrPendingStyleShaderFromValue(WebKitCSSShaderValue*);
310
    StyleShader* cachedOrPendingStyleShaderFromValue(WebKitCSSShaderValue*);
- a/Source/WebCore/css/WebKitCSSMatrix.cpp -1 / +1 lines
Lines 75-81 void WebKitCSSMatrix::setMatrixValue(const String& string, ExceptionCode& ec) a/Source/WebCore/css/WebKitCSSMatrix.cpp_sec1
75
        // if a param has a percentage ('%')
75
        // if a param has a percentage ('%')
76
        TransformationMatrix t;
76
        TransformationMatrix t;
77
        for (unsigned i = 0; i < operations.operations().size(); ++i) {
77
        for (unsigned i = 0; i < operations.operations().size(); ++i) {
78
            if (operations.operations()[i].get()->apply(t, IntSize(0, 0))) {
78
            if (operations.operations()[i].get()->apply(t, IntSize(), IntSize())) {
79
                ec = SYNTAX_ERR;
79
                ec = SYNTAX_ERR;
80
                return;
80
                return;
81
            }
81
            }
- a/Source/WebCore/dom/Document.cpp -7 / +6 lines
Lines 1966-1972 bool Document::isPageBoxVisible(int pageIndex) a/Source/WebCore/dom/Document.cpp_sec1
1966
void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft)
1966
void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft)
1967
{
1967
{
1968
    RefPtr<RenderStyle> style = styleForPage(pageIndex);
1968
    RefPtr<RenderStyle> style = styleForPage(pageIndex);
1969
    RenderView* view = renderView();
1970
1969
1971
    int width = pageSize.width();
1970
    int width = pageSize.width();
1972
    int height = pageSize.height();
1971
    int height = pageSize.height();
Lines 1985-1992 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int& a/Source/WebCore/dom/Document.cpp_sec2
1985
        LengthSize size = style->pageSize();
1984
        LengthSize size = style->pageSize();
1986
        ASSERT(size.width().isFixed());
1985
        ASSERT(size.width().isFixed());
1987
        ASSERT(size.height().isFixed());
1986
        ASSERT(size.height().isFixed());
1988
        width = valueForLength(size.width(), 0, view);
1987
        width = renderer()->valueForLength(size.width(), 0);
1989
        height = valueForLength(size.height(), 0, view);
1988
        height = renderer()->valueForLength(size.height(), 0);
1990
        break;
1989
        break;
1991
    }
1990
    }
1992
    default:
1991
    default:
Lines 1996-2005 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int& a/Source/WebCore/dom/Document.cpp_sec3
1996
1995
1997
    // The percentage is calculated with respect to the width even for margin top and bottom.
1996
    // The percentage is calculated with respect to the width even for margin top and bottom.
1998
    // http://www.w3.org/TR/CSS2/box.html#margin-properties
1997
    // http://www.w3.org/TR/CSS2/box.html#margin-properties
1999
    marginTop = style->marginTop().isAuto() ? marginTop : intValueForLength(style->marginTop(), width, view);
1998
    marginTop = style->marginTop().isAuto() ? marginTop : renderer()->intValueForLength(style->marginTop(), width);
2000
    marginRight = style->marginRight().isAuto() ? marginRight : intValueForLength(style->marginRight(), width, view);
1999
    marginRight = style->marginRight().isAuto() ? marginRight : renderer()->intValueForLength(style->marginRight(), width);
2001
    marginBottom = style->marginBottom().isAuto() ? marginBottom : intValueForLength(style->marginBottom(), width, view);
2000
    marginBottom = style->marginBottom().isAuto() ? marginBottom : renderer()->intValueForLength(style->marginBottom(), width);
2002
    marginLeft = style->marginLeft().isAuto() ? marginLeft : intValueForLength(style->marginLeft(), width, view);
2001
    marginLeft = style->marginLeft().isAuto() ? marginLeft : renderer()->intValueForLength(style->marginLeft(), width);
2003
}
2002
}
2004
2003
2005
void Document::setIsViewSource(bool isViewSource)
2004
void Document::setIsViewSource(bool isViewSource)
- a/Source/WebCore/html/HTMLAreaElement.cpp -9 / +9 lines
Lines 144-173 Path HTMLAreaElement::getRegion(const LayoutSize& size) const a/Source/WebCore/html/HTMLAreaElement.cpp_sec1
144
    }
144
    }
145
145
146
    Path path;
146
    Path path;
147
    RenderView* renderView = document()->renderView();
147
    const RenderObject* renderer = document()->renderer();
148
    switch (shape) {
148
    switch (shape) {
149
        case Poly:
149
        case Poly:
150
            if (m_coordsLen >= 6) {
150
            if (m_coordsLen >= 6) {
151
                int numPoints = m_coordsLen / 2;
151
                int numPoints = m_coordsLen / 2;
152
                path.moveTo(FloatPoint(minimumValueForLength(m_coords[0], width, renderView), minimumValueForLength(m_coords[1], height, renderView)));
152
                path.moveTo(FloatPoint(renderer->minimumValueForLength(m_coords[0], width), renderer->minimumValueForLength(m_coords[1], height)));
153
                for (int i = 1; i < numPoints; ++i)
153
                for (int i = 1; i < numPoints; ++i)
154
                    path.addLineTo(FloatPoint(minimumValueForLength(m_coords[i * 2], width, renderView), minimumValueForLength(m_coords[i * 2 + 1], height, renderView)));
154
                    path.addLineTo(FloatPoint(renderer->minimumValueForLength(m_coords[i * 2], width), renderer->minimumValueForLength(m_coords[i * 2 + 1], height)));
155
                path.closeSubpath();
155
                path.closeSubpath();
156
            }
156
            }
157
            break;
157
            break;
158
        case Circle:
158
        case Circle:
159
            if (m_coordsLen >= 3) {
159
            if (m_coordsLen >= 3) {
160
                Length radius = m_coords[2];
160
                Length radius = m_coords[2];
161
                int r = min(minimumValueForLength(radius, width, renderView), minimumValueForLength(radius, height, renderView));
161
                int r = min(renderer->minimumValueForLength(radius, width), renderer->minimumValueForLength(radius, height));
162
                path.addEllipse(FloatRect(minimumValueForLength(m_coords[0], width, renderView) - r, minimumValueForLength(m_coords[1], height, renderView) - r, 2 * r, 2 * r));
162
                path.addEllipse(FloatRect(renderer->minimumValueForLength(m_coords[0], width) - r, renderer->minimumValueForLength(m_coords[1], height) - r, 2 * r, 2 * r));
163
            }
163
            }
164
            break;
164
            break;
165
        case Rect:
165
        case Rect:
166
            if (m_coordsLen >= 4) {
166
            if (m_coordsLen >= 4) {
167
                int x0 = minimumValueForLength(m_coords[0], width, renderView);
167
                int x0 = renderer->minimumValueForLength(m_coords[0], width);
168
                int y0 = minimumValueForLength(m_coords[1], height, renderView);
168
                int y0 = renderer->minimumValueForLength(m_coords[1], height);
169
                int x1 = minimumValueForLength(m_coords[2], width, renderView);
169
                int x1 = renderer->minimumValueForLength(m_coords[2], width);
170
                int y1 = minimumValueForLength(m_coords[3], height, renderView);
170
                int y1 = renderer->minimumValueForLength(m_coords[3], height);
171
                path.addRect(FloatRect(x0, y0, x1 - x0, y1 - y0));
171
                path.addRect(FloatRect(x0, y0, x1 - x0, y1 - y0));
172
            }
172
            }
173
            break;
173
            break;
- a/Source/WebCore/page/animation/CSSPropertyAnimation.cpp -3 / +4 lines
Lines 44-49 a/Source/WebCore/page/animation/CSSPropertyAnimation.cpp_sec1
44
#include "MatrixTransformOperation.h"
44
#include "MatrixTransformOperation.h"
45
#include "RenderBox.h"
45
#include "RenderBox.h"
46
#include "RenderStyle.h"
46
#include "RenderStyle.h"
47
#include "RenderView.h"
47
#include "StyleCachedImage.h"
48
#include "StyleCachedImage.h"
48
#include "StyleGeneratedImage.h"
49
#include "StyleGeneratedImage.h"
49
#include "StylePropertyShorthand.h"
50
#include "StylePropertyShorthand.h"
Lines 124-131 static inline PassOwnPtr<ShadowData> blendFunc(const AnimationBase* anim, const a/Source/WebCore/page/animation/CSSPropertyAnimation.cpp_sec2
124
static inline TransformOperations blendFunc(const AnimationBase* anim, const TransformOperations& from, const TransformOperations& to, double progress)
125
static inline TransformOperations blendFunc(const AnimationBase* anim, const TransformOperations& from, const TransformOperations& to, double progress)
125
{
126
{
126
    if (anim->isTransformFunctionListValid())
127
    if (anim->isTransformFunctionListValid())
127
        return to.blendByMatchingOperations(from, progress);
128
        return to.blendByMatchingOperations(from, progress, anim->renderer()->view()->viewportSize());
128
    return to.blendByUsingMatrixInterpolation(from, progress, anim->renderer()->isBox() ? toRenderBox(anim->renderer())->borderBoxRect().size() : LayoutSize());
129
    return to.blendByUsingMatrixInterpolation(from, progress, anim->renderer()->isBox() ? toRenderBox(anim->renderer())->borderBoxRect().size() : LayoutSize(), anim->renderer()->view()->viewportSize());
129
}
130
}
130
131
131
static inline PassRefPtr<ClipPathOperation> blendFunc(const AnimationBase*, ClipPathOperation* from, ClipPathOperation* to, double progress)
132
static inline PassRefPtr<ClipPathOperation> blendFunc(const AnimationBase*, ClipPathOperation* from, ClipPathOperation* to, double progress)
Lines 166-172 static inline PassRefPtr<FilterOperation> blendFunc(const AnimationBase* anim, F a/Source/WebCore/page/animation/CSSPropertyAnimation.cpp_sec3
166
    ASSERT(toOp);
167
    ASSERT(toOp);
167
    if (toOp->blendingNeedsRendererSize()) {
168
    if (toOp->blendingNeedsRendererSize()) {
168
        LayoutSize size = anim->renderer()->isBox() ? toRenderBox(anim->renderer())->borderBoxRect().size() : LayoutSize();
169
        LayoutSize size = anim->renderer()->isBox() ? toRenderBox(anim->renderer())->borderBoxRect().size() : LayoutSize();
169
        return toOp->blend(fromOp, progress, size, blendToPassthrough);
170
        return toOp->blend(fromOp, progress, size, anim->renderer()->view()->viewportSize(), blendToPassthrough);
170
    }
171
    }
171
    return toOp->blend(fromOp, progress, blendToPassthrough);
172
    return toOp->blend(fromOp, progress, blendToPassthrough);
172
}
173
}
- a/Source/WebCore/platform/CalculationValue.cpp -5 / +5 lines
Lines 35-44 a/Source/WebCore/platform/CalculationValue.cpp_sec1
35
35
36
namespace WebCore {
36
namespace WebCore {
37
37
38
float CalcExpressionBinaryOperation::evaluate(float maxValue) const
38
float CalcExpressionBinaryOperation::evaluate(float maxValue, const IntSize& viewportSize) const
39
{
39
{
40
    float left = m_leftSide->evaluate(maxValue);
40
    float left = m_leftSide->evaluate(maxValue, viewportSize);
41
    float right = m_rightSide->evaluate(maxValue);
41
    float right = m_rightSide->evaluate(maxValue, viewportSize);
42
    switch (m_operator) {
42
    switch (m_operator) {
43
    case CalcAdd:
43
    case CalcAdd:
44
        return left + right;
44
        return left + right;
Lines 60-68 PassRefPtr<CalculationValue> CalculationValue::create(PassOwnPtr<CalcExpressionN a/Source/WebCore/platform/CalculationValue.cpp_sec2
60
    return adoptRef(new CalculationValue(value, range));
60
    return adoptRef(new CalculationValue(value, range));
61
}
61
}
62
62
63
float CalculationValue::evaluate(float maxValue) const
63
float CalculationValue::evaluate(float maxValue, const IntSize& viewportSize) const
64
{
64
{
65
    float result = m_value->evaluate(maxValue);
65
    float result = m_value->evaluate(maxValue, viewportSize);
66
    // FIXME calc https://webkit.org/b/80411 : result is NaN when there is a division 
66
    // FIXME calc https://webkit.org/b/80411 : result is NaN when there is a division 
67
    // by zero which isn't found at parse time. 
67
    // by zero which isn't found at parse time. 
68
    if (std::isnan(result))
68
    if (std::isnan(result))
- a/Source/WebCore/platform/CalculationValue.h -8 / +8 lines
Lines 72-78 public: a/Source/WebCore/platform/CalculationValue.h_sec1
72
    {
72
    {
73
    }
73
    }
74
    
74
    
75
    virtual float evaluate(float maxValue) const = 0;
75
    virtual float evaluate(float maxValue, const IntSize& viewportSize) const = 0;
76
    virtual bool operator==(const CalcExpressionNode&) const = 0;
76
    virtual bool operator==(const CalcExpressionNode&) const = 0;
77
77
78
    CalcExpressionNodeType type() const { return m_type; }
78
    CalcExpressionNodeType type() const { return m_type; }
Lines 84-90 protected: a/Source/WebCore/platform/CalculationValue.h_sec2
84
class CalculationValue : public RefCounted<CalculationValue> {
84
class CalculationValue : public RefCounted<CalculationValue> {
85
public:
85
public:
86
    static PassRefPtr<CalculationValue> create(PassOwnPtr<CalcExpressionNode> value, CalculationPermittedValueRange);
86
    static PassRefPtr<CalculationValue> create(PassOwnPtr<CalcExpressionNode> value, CalculationPermittedValueRange);
87
    float evaluate(float maxValue) const;
87
    float evaluate(float maxValue, const IntSize& viewportSize) const;
88
88
89
    bool operator==(const CalculationValue& o) const 
89
    bool operator==(const CalculationValue& o) const 
90
    { 
90
    { 
Lines 120-126 public: a/Source/WebCore/platform/CalculationValue.h_sec3
120
        return type() == o.type() && *this == static_cast<const CalcExpressionNumber&>(o);
120
        return type() == o.type() && *this == static_cast<const CalcExpressionNumber&>(o);
121
    }
121
    }
122
    
122
    
123
    virtual float evaluate(float) const 
123
    virtual float evaluate(float, const IntSize&) const 
124
    {
124
    {
125
        return m_value;
125
        return m_value;
126
    }
126
    }
Lines 147-155 public: a/Source/WebCore/platform/CalculationValue.h_sec4
147
        return type() == o.type() && *this == static_cast<const CalcExpressionLength&>(o);
147
        return type() == o.type() && *this == static_cast<const CalcExpressionLength&>(o);
148
    }
148
    }
149
    
149
    
150
    virtual float evaluate(float maxValue) const
150
    virtual float evaluate(float maxValue, const IntSize& viewportSize) const
151
    {
151
    {
152
        return floatValueForLength(m_length, maxValue);
152
        return floatValueForLength(m_length, maxValue, viewportSize);
153
    }
153
    }
154
    
154
    
155
private:
155
private:
Lines 177-183 public: a/Source/WebCore/platform/CalculationValue.h_sec5
177
    }
177
    }
178
    
178
    
179
    
179
    
180
    virtual float evaluate(float) const;
180
    virtual float evaluate(float, const IntSize&) const;
181
181
182
private:
182
private:
183
    OwnPtr<CalcExpressionNode> m_leftSide;
183
    OwnPtr<CalcExpressionNode> m_leftSide;
Lines 205-213 public: a/Source/WebCore/platform/CalculationValue.h_sec6
205
        return type() == o.type() && *this == static_cast<const CalcExpressionBlendLength&>(o);
205
        return type() == o.type() && *this == static_cast<const CalcExpressionBlendLength&>(o);
206
    }
206
    }
207
    
207
    
208
    virtual float evaluate(float maxValue) const
208
    virtual float evaluate(float maxValue, const IntSize& viewportSize) const
209
    {
209
    {
210
        return (1.0f - m_progress) * floatValueForLength(m_from, maxValue) + m_progress * floatValueForLength(m_to, maxValue);
210
        return (1.0f - m_progress) * floatValueForLength(m_from, maxValue, viewportSize) + m_progress * floatValueForLength(m_to, maxValue, viewportSize);
211
    }
211
    }
212
    
212
    
213
private:  
213
private:  
- a/Source/WebCore/platform/Length.cpp -2 / +2 lines
Lines 236-245 void Length::decrementCalculatedRef() const a/Source/WebCore/platform/Length.cpp_sec1
236
    calcLength->deref();
236
    calcLength->deref();
237
}    
237
}    
238
238
239
float Length::nonNanCalculatedValue(int maxValue) const
239
float Length::nonNanCalculatedValue(int maxValue, const IntSize& viewportSize) const
240
{
240
{
241
    ASSERT(isCalculated());
241
    ASSERT(isCalculated());
242
    float result = calculationValue()->evaluate(maxValue);
242
    float result = calculationValue()->evaluate(maxValue, viewportSize);
243
    if (std::isnan(result))
243
    if (std::isnan(result))
244
        return 0;
244
        return 0;
245
    return result;
245
    return result;
- a/Source/WebCore/platform/Length.h -1 / +1 lines
Lines 260-266 public: a/Source/WebCore/platform/Length.h_sec1
260
        ASSERT(!isUndefined());
260
        ASSERT(!isUndefined());
261
        return m_isFloat ? m_floatValue : m_intValue;
261
        return m_isFloat ? m_floatValue : m_intValue;
262
    }
262
    }
263
    float nonNanCalculatedValue(int maxValue) const;
263
    float nonNanCalculatedValue(int maxValue, const IntSize& viewportSize) const;
264
264
265
    bool isViewportPercentage() const
265
    bool isViewportPercentage() const
266
    {
266
    {
- a/Source/WebCore/platform/graphics/GraphicsLayer.h -1 / +1 lines
Lines 336-342 public: a/Source/WebCore/platform/graphics/GraphicsLayer.h_sec1
336
    // Return true if the animation is handled by the compositing system. If this returns
336
    // Return true if the animation is handled by the compositing system. If this returns
337
    // false, the animation will be run by AnimationController.
337
    // false, the animation will be run by AnimationController.
338
    // These methods handle both transitions and keyframe animations.
338
    // These methods handle both transitions and keyframe animations.
339
    virtual bool addAnimation(const KeyframeValueList&, const IntSize& /*boxSize*/, const Animation*, const String& /*animationName*/, double /*timeOffset*/)  { return false; }
339
    virtual bool addAnimation(const KeyframeValueList&, const IntSize& /*boxSize*/, const IntSize& /*viewportSize*/, const Animation*, const String& /*animationName*/, double /*timeOffset*/)  { return false; }
340
    virtual void pauseAnimation(const String& /*animationName*/, double /*timeOffset*/) { }
340
    virtual void pauseAnimation(const String& /*animationName*/, double /*timeOffset*/) { }
341
    virtual void removeAnimation(const String& /*animationName*/) { }
341
    virtual void removeAnimation(const String& /*animationName*/) { }
342
342
- a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp -22 / +22 lines
Lines 29-45 a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp_sec1
29
namespace WebCore {
29
namespace WebCore {
30
30
31
#if ENABLE(CSS_FILTERS)
31
#if ENABLE(CSS_FILTERS)
32
static inline PassRefPtr<FilterOperation> blendFunc(FilterOperation* fromOp, FilterOperation* toOp, double progress, const IntSize& size, bool blendToPassthrough = false)
32
static inline PassRefPtr<FilterOperation> blendFunc(FilterOperation* fromOp, FilterOperation* toOp, double progress, const IntSize& size, const IntSize& viewportSize, bool blendToPassthrough = false)
33
{
33
{
34
    ASSERT(toOp);
34
    ASSERT(toOp);
35
    if (toOp->blendingNeedsRendererSize())
35
    if (toOp->blendingNeedsRendererSize())
36
        return toOp->blend(fromOp, progress, LayoutSize(size.width(), size.height()), blendToPassthrough);
36
        return toOp->blend(fromOp, progress, LayoutSize(size.width(), size.height()), viewportSize, blendToPassthrough);
37
37
38
    return toOp->blend(fromOp, progress, blendToPassthrough);
38
    return toOp->blend(fromOp, progress, blendToPassthrough);
39
}
39
}
40
40
41
41
42
static FilterOperations applyFilterAnimation(const FilterOperations* from, const FilterOperations* to, double progress, const IntSize& boxSize)
42
static FilterOperations applyFilterAnimation(const FilterOperations* from, const FilterOperations* to, double progress, const IntSize& boxSize, const IntSize& viewportSize)
43
{
43
{
44
    // First frame of an animation.
44
    // First frame of an animation.
45
    if (!progress)
45
    if (!progress)
Lines 60-66 static FilterOperations applyFilterAnimation(const FilterOperations* from, const a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp_sec2
60
    for (size_t i = 0; i < size; i++) {
60
    for (size_t i = 0; i < size; i++) {
61
        RefPtr<FilterOperation> fromOp = (i < fromSize) ? from->operations()[i].get() : 0;
61
        RefPtr<FilterOperation> fromOp = (i < fromSize) ? from->operations()[i].get() : 0;
62
        RefPtr<FilterOperation> toOp = (i < toSize) ? to->operations()[i].get() : 0;
62
        RefPtr<FilterOperation> toOp = (i < toSize) ? to->operations()[i].get() : 0;
63
        RefPtr<FilterOperation> blendedOp = toOp ? blendFunc(fromOp.get(), toOp.get(), progress, boxSize) : (fromOp ? blendFunc(0, fromOp.get(), progress, boxSize, true) : 0);
63
        RefPtr<FilterOperation> blendedOp = toOp ? blendFunc(fromOp.get(), toOp.get(), progress, boxSize, viewportSize) : (fromOp ? blendFunc(0, fromOp.get(), progress, boxSize, viewportSize, true) : 0);
64
        if (blendedOp)
64
        if (blendedOp)
65
            result.operations().append(blendedOp);
65
            result.operations().append(blendedOp);
66
        else {
66
        else {
Lines 155-181 static inline float applyTimingFunction(const TimingFunction* timingFunction, fl a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp_sec3
155
    return progress;
155
    return progress;
156
}
156
}
157
157
158
static TransformationMatrix applyTransformAnimation(const TransformOperations* from, const TransformOperations* to, double progress, const IntSize& boxSize, bool listsMatch)
158
static TransformationMatrix applyTransformAnimation(const TransformOperations* from, const TransformOperations* to, double progress, const IntSize& boxSize, const IntSize& viewportSize, bool listsMatch)
159
{
159
{
160
    TransformationMatrix matrix;
160
    TransformationMatrix matrix;
161
161
162
    // First frame of an animation.
162
    // First frame of an animation.
163
    if (!progress) {
163
    if (!progress) {
164
        from->apply(boxSize, matrix);
164
        from->apply(boxSize, viewportSize, matrix);
165
        return matrix;
165
        return matrix;
166
    }
166
    }
167
167
168
    // Last frame of an animation.
168
    // Last frame of an animation.
169
    if (progress == 1) {
169
    if (progress == 1) {
170
        to->apply(boxSize, matrix);
170
        to->apply(boxSize, viewportSize, matrix);
171
        return matrix;
171
        return matrix;
172
    }
172
    }
173
173
174
    // If we have incompatible operation lists, we blend the resulting matrices.
174
    // If we have incompatible operation lists, we blend the resulting matrices.
175
    if (!listsMatch) {
175
    if (!listsMatch) {
176
        TransformationMatrix fromMatrix;
176
        TransformationMatrix fromMatrix;
177
        to->apply(boxSize, matrix);
177
        to->apply(boxSize, viewportSize, matrix);
178
        from->apply(boxSize, fromMatrix);
178
        from->apply(boxSize, viewportSize, fromMatrix);
179
        matrix.blend(fromMatrix, progress);
179
        matrix.blend(fromMatrix, progress);
180
        return matrix;
180
        return matrix;
181
    }
181
    }
Lines 184-190 static TransformationMatrix applyTransformAnimation(const TransformOperations* f a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp_sec4
184
    if (!to->size()) {
184
    if (!to->size()) {
185
        TransformOperations blended(*from);
185
        TransformOperations blended(*from);
186
        for (size_t i = 0; i < blended.operations().size(); ++i)
186
        for (size_t i = 0; i < blended.operations().size(); ++i)
187
            blended.operations()[i]->blend(0, progress, true)->apply(matrix, boxSize);
187
            blended.operations()[i]->blend(0, progress, viewportSize, true)->apply(matrix, viewportSize, boxSize);
188
        return matrix;
188
        return matrix;
189
    }
189
    }
190
190
Lines 192-205 static TransformationMatrix applyTransformAnimation(const TransformOperations* f a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp_sec5
192
    if (!from->size()) {
192
    if (!from->size()) {
193
        TransformOperations blended(*to);
193
        TransformOperations blended(*to);
194
        for (size_t i = 0; i < blended.operations().size(); ++i)
194
        for (size_t i = 0; i < blended.operations().size(); ++i)
195
            blended.operations()[i]->blend(0, 1. - progress, true)->apply(matrix, boxSize);
195
            blended.operations()[i]->blend(0, 1. - progress, viewportSize, true)->apply(matrix, viewportSize, boxSize);
196
        return matrix;
196
        return matrix;
197
    }
197
    }
198
198
199
    // Normal animation with a matching operation list.
199
    // Normal animation with a matching operation list.
200
    TransformOperations blended(*to);
200
    TransformOperations blended(*to);
201
    for (size_t i = 0; i < blended.operations().size(); ++i)
201
    for (size_t i = 0; i < blended.operations().size(); ++i)
202
        blended.operations()[i]->blend(from->at(i), progress, !from->at(i))->apply(matrix, boxSize);
202
        blended.operations()[i]->blend(from->at(i), progress, viewportSize, !from->at(i))->apply(matrix, viewportSize, boxSize);
203
    return matrix;
203
    return matrix;
204
}
204
}
205
205
Lines 227-244 GraphicsLayerAnimation::GraphicsLayerAnimation(const String& name, const Keyfram a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp_sec6
227
{
227
{
228
}
228
}
229
229
230
void GraphicsLayerAnimation::applyInternal(Client* client, const AnimationValue* from, const AnimationValue* to, float progress)
230
void GraphicsLayerAnimation::applyInternal(Client* client, const AnimationValue* from, const AnimationValue* to, float progress, const IntSize& viewportSize)
231
{
231
{
232
    switch (m_keyframes.property()) {
232
    switch (m_keyframes.property()) {
233
    case AnimatedPropertyOpacity:
233
    case AnimatedPropertyOpacity:
234
        client->setAnimatedOpacity(applyOpacityAnimation((static_cast<const FloatAnimationValue*>(from)->value()), (static_cast<const FloatAnimationValue*>(to)->value()), progress));
234
        client->setAnimatedOpacity(applyOpacityAnimation((static_cast<const FloatAnimationValue*>(from)->value()), (static_cast<const FloatAnimationValue*>(to)->value()), progress));
235
        return;
235
        return;
236
    case AnimatedPropertyWebkitTransform:
236
    case AnimatedPropertyWebkitTransform:
237
        client->setAnimatedTransform(applyTransformAnimation(static_cast<const TransformAnimationValue*>(from)->value(), static_cast<const TransformAnimationValue*>(to)->value(), progress, m_boxSize, m_listsMatch));
237
        client->setAnimatedTransform(applyTransformAnimation(static_cast<const TransformAnimationValue*>(from)->value(), static_cast<const TransformAnimationValue*>(to)->value(), progress, m_boxSize, viewportSize, m_listsMatch));
238
        return;
238
        return;
239
#if ENABLE(CSS_FILTERS)
239
#if ENABLE(CSS_FILTERS)
240
    case AnimatedPropertyWebkitFilter:
240
    case AnimatedPropertyWebkitFilter:
241
        client->setAnimatedFilters(applyFilterAnimation(static_cast<const FilterAnimationValue*>(from)->value(), static_cast<const FilterAnimationValue*>(to)->value(), progress, m_boxSize));
241
        client->setAnimatedFilters(applyFilterAnimation(static_cast<const FilterAnimationValue*>(from)->value(), static_cast<const FilterAnimationValue*>(to)->value(), progress, m_boxSize, viewportSize));
242
        return;
242
        return;
243
#endif
243
#endif
244
    default:
244
    default:
Lines 273-279 bool GraphicsLayerAnimations::hasRunningAnimations() const a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp_sec7
273
    return false;
273
    return false;
274
}
274
}
275
275
276
void GraphicsLayerAnimation::apply(Client* client)
276
void GraphicsLayerAnimation::apply(Client* client, const IntSize& viewportSize)
277
{
277
{
278
    if (!isActive())
278
    if (!isActive())
279
        return;
279
        return;
Lines 288-305 void GraphicsLayerAnimation::apply(Client* client) a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp_sec8
288
    }
288
    }
289
289
290
    if (!normalizedValue) {
290
    if (!normalizedValue) {
291
        applyInternal(client, m_keyframes.at(0), m_keyframes.at(1), 0);
291
        applyInternal(client, m_keyframes.at(0), m_keyframes.at(1), 0, viewportSize);
292
        return;
292
        return;
293
    }
293
    }
294
294
295
    if (normalizedValue == 1.0) {
295
    if (normalizedValue == 1.0) {
296
        applyInternal(client, m_keyframes.at(m_keyframes.size() - 2), m_keyframes.at(m_keyframes.size() - 1), 1);
296
        applyInternal(client, m_keyframes.at(m_keyframes.size() - 2), m_keyframes.at(m_keyframes.size() - 1), 1, viewportSize);
297
        return;
297
        return;
298
    }
298
    }
299
    if (m_keyframes.size() == 2) {
299
    if (m_keyframes.size() == 2) {
300
        const TimingFunction* timingFunction = timingFunctionForAnimationValue(m_keyframes.at(0), m_animation.get());
300
        const TimingFunction* timingFunction = timingFunctionForAnimationValue(m_keyframes.at(0), m_animation.get());
301
        normalizedValue = applyTimingFunction(timingFunction, normalizedValue, m_animation->duration());
301
        normalizedValue = applyTimingFunction(timingFunction, normalizedValue, m_animation->duration());
302
        applyInternal(client, m_keyframes.at(0), m_keyframes.at(1), normalizedValue);
302
        applyInternal(client, m_keyframes.at(0), m_keyframes.at(1), normalizedValue, viewportSize);
303
        return;
303
        return;
304
    }
304
    }
305
305
Lines 312-318 void GraphicsLayerAnimation::apply(Client* client) a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp_sec9
312
        normalizedValue = (normalizedValue - from->keyTime()) / (to->keyTime() - from->keyTime());
312
        normalizedValue = (normalizedValue - from->keyTime()) / (to->keyTime() - from->keyTime());
313
        const TimingFunction* timingFunction = timingFunctionForAnimationValue(from, m_animation.get());
313
        const TimingFunction* timingFunction = timingFunctionForAnimationValue(from, m_animation.get());
314
        normalizedValue = applyTimingFunction(timingFunction, normalizedValue, m_animation->duration());
314
        normalizedValue = applyTimingFunction(timingFunction, normalizedValue, m_animation->duration());
315
        applyInternal(client, from, to, normalizedValue);
315
        applyInternal(client, from, to, normalizedValue, viewportSize);
316
        break;
316
        break;
317
    }
317
    }
318
}
318
}
Lines 385-394 void GraphicsLayerAnimations::remove(const String& name, AnimatedPropertyID prop a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp_sec10
385
    }
385
    }
386
}
386
}
387
387
388
void GraphicsLayerAnimations::apply(GraphicsLayerAnimation::Client* client)
388
void GraphicsLayerAnimations::apply(GraphicsLayerAnimation::Client* client, const IntSize& viewportSize)
389
{
389
{
390
    for (size_t i = 0; i < m_animations.size(); ++i)
390
    for (size_t i = 0; i < m_animations.size(); ++i)
391
        m_animations[i].apply(client);
391
        m_animations[i].apply(client, viewportSize);
392
}
392
}
393
393
394
GraphicsLayerAnimations GraphicsLayerAnimations::getActiveAnimations() const
394
GraphicsLayerAnimations GraphicsLayerAnimations::getActiveAnimations() const
- a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h -3 / +3 lines
Lines 45-51 public: a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h_sec1
45
        : m_keyframes(AnimatedPropertyInvalid)
45
        : m_keyframes(AnimatedPropertyInvalid)
46
    { }
46
    { }
47
    GraphicsLayerAnimation(const String&, const KeyframeValueList&, const IntSize&, const Animation*, double, bool);
47
    GraphicsLayerAnimation(const String&, const KeyframeValueList&, const IntSize&, const Animation*, double, bool);
48
    void apply(Client*);
48
    void apply(Client*, const IntSize& viewportSize);
49
    void pause(double);
49
    void pause(double);
50
    void resume();
50
    void resume();
51
    double computeTotalRunningTime();
51
    double computeTotalRunningTime();
Lines 66-72 public: a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h_sec2
66
    bool listsMatch() const { return m_listsMatch; }
66
    bool listsMatch() const { return m_listsMatch; }
67
67
68
private:
68
private:
69
    void applyInternal(Client*, const AnimationValue* from, const AnimationValue* to, float progress);
69
    void applyInternal(Client*, const AnimationValue* from, const AnimationValue* to, float progress, const IntSize& viewportSize);
70
    KeyframeValueList m_keyframes;
70
    KeyframeValueList m_keyframes;
71
    IntSize m_boxSize;
71
    IntSize m_boxSize;
72
    RefPtr<Animation> m_animation;
72
    RefPtr<Animation> m_animation;
Lines 89-95 public: a/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h_sec3
89
    void pause(const String&, double);
89
    void pause(const String&, double);
90
    void suspend(double);
90
    void suspend(double);
91
    void resume();
91
    void resume();
92
    void apply(GraphicsLayerAnimation::Client*);
92
    void apply(GraphicsLayerAnimation::Client*, const IntSize& viewportSize);
93
    bool isEmpty() const { return m_animations.isEmpty(); }
93
    bool isEmpty() const { return m_animations.isEmpty(); }
94
    size_t size() const { return m_animations.size(); }
94
    size_t size() const { return m_animations.size(); }
95
    const Vector<GraphicsLayerAnimation>& animations() const { return m_animations; }
95
    const Vector<GraphicsLayerAnimation>& animations() const { return m_animations; }
- a/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp -17 / +17 lines
Lines 57-63 using namespace WebKit; a/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp_sec1
57
57
58
namespace WebCore {
58
namespace WebCore {
59
59
60
PassOwnPtr<WebTransformOperations> toWebTransformOperations(const TransformOperations& transformOperations, const FloatSize& boxSize)
60
PassOwnPtr<WebTransformOperations> toWebTransformOperations(const TransformOperations& transformOperations, const FloatSize& boxSize, const IntSize& viewportSize)
61
{
61
{
62
    // We need to do a deep copy the transformOperations may contain ref pointers to TransformOperation objects.
62
    // We need to do a deep copy the transformOperations may contain ref pointers to TransformOperation objects.
63
    OwnPtr<WebTransformOperations> webTransformOperations = adoptPtr(Platform::current()->compositorSupport()->createTransformOperations());
63
    OwnPtr<WebTransformOperations> webTransformOperations = adoptPtr(Platform::current()->compositorSupport()->createTransformOperations());
Lines 81-87 PassOwnPtr<WebTransformOperations> toWebTransformOperations(const TransformOpera a/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp_sec2
81
        case TransformOperation::TRANSLATE_3D:
81
        case TransformOperation::TRANSLATE_3D:
82
        case TransformOperation::TRANSLATE: {
82
        case TransformOperation::TRANSLATE: {
83
            TranslateTransformOperation* transform = static_cast<TranslateTransformOperation*>(transformOperations.operations()[j].get());
83
            TranslateTransformOperation* transform = static_cast<TranslateTransformOperation*>(transformOperations.operations()[j].get());
84
            webTransformOperations->appendTranslate(floatValueForLength(transform->x(), boxSize.width()), floatValueForLength(transform->y(), boxSize.height()), floatValueForLength(transform->z(), 1));
84
            webTransformOperations->appendTranslate(floatValueForLength(transform->x(), boxSize.width(), viewportSize), floatValueForLength(transform->y(), boxSize.height(), viewportSize), floatValueForLength(transform->z(), 1, viewportSize));
85
            break;
85
            break;
86
        }
86
        }
87
        case TransformOperation::ROTATE_X:
87
        case TransformOperation::ROTATE_X:
Lines 113-119 PassOwnPtr<WebTransformOperations> toWebTransformOperations(const TransformOpera a/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp_sec3
113
        }
113
        }
114
        case TransformOperation::PERSPECTIVE: {
114
        case TransformOperation::PERSPECTIVE: {
115
            PerspectiveTransformOperation* transform = static_cast<PerspectiveTransformOperation*>(transformOperations.operations()[j].get());
115
            PerspectiveTransformOperation* transform = static_cast<PerspectiveTransformOperation*>(transformOperations.operations()[j].get());
116
            webTransformOperations->appendPerspective(floatValueForLength(transform->perspective(), 0));
116
            webTransformOperations->appendPerspective(floatValueForLength(transform->perspective(), 0, viewportSize));
117
            break;
117
            break;
118
        }
118
        }
119
        case TransformOperation::IDENTITY:
119
        case TransformOperation::IDENTITY:
Lines 129-142 PassOwnPtr<WebTransformOperations> toWebTransformOperations(const TransformOpera a/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp_sec4
129
}
129
}
130
130
131
template <class Value, class Keyframe, class Curve>
131
template <class Value, class Keyframe, class Curve>
132
bool appendKeyframeWithStandardTimingFunction(Curve* curve, double keyTime, const Value* value, const Value* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize&)
132
bool appendKeyframeWithStandardTimingFunction(Curve* curve, double keyTime, const Value* value, const Value* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize&, const IntSize& viewportSize)
133
{
133
{
134
    curve->add(Keyframe(keyTime, value->value()), timingFunctionType);
134
    curve->add(Keyframe(keyTime, value->value()), timingFunctionType);
135
    return true;
135
    return true;
136
}
136
}
137
137
138
template <class Value, class Keyframe, class Curve>
138
template <class Value, class Keyframe, class Curve>
139
bool appendKeyframeWithCustomBezierTimingFunction(Curve* curve, double keyTime, const Value* value, const Value* lastValue, double x1, double y1, double x2, double y2, const FloatSize&)
139
bool appendKeyframeWithCustomBezierTimingFunction(Curve* curve, double keyTime, const Value* value, const Value* lastValue, double x1, double y1, double x2, double y2, const FloatSize&, const IntSize& viewportSize)
140
{
140
{
141
    curve->add(Keyframe(keyTime, value->value()), x1, y1, x2, y2);
141
    curve->add(Keyframe(keyTime, value->value()), x1, y1, x2, y2);
142
    return true;
142
    return true;
Lines 152-165 bool isRotationType(TransformOperation::OperationType transformType) a/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp_sec5
152
}
152
}
153
153
154
template <>
154
template <>
155
bool appendKeyframeWithStandardTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize& boxSize)
155
bool appendKeyframeWithStandardTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize& boxSize, const IntSize& viewportSize)
156
{
156
{
157
    bool canBlend = !lastValue;
157
    bool canBlend = !lastValue;
158
    OwnPtr<WebTransformOperations> operations(toWebTransformOperations(*value->value(), boxSize));
158
    OwnPtr<WebTransformOperations> operations(toWebTransformOperations(*value->value(), boxSize, viewportSize));
159
    if (!operations)
159
    if (!operations)
160
        return false;
160
        return false;
161
    if (!canBlend) {
161
    if (!canBlend) {
162
        OwnPtr<WebTransformOperations> lastOperations(toWebTransformOperations(*lastValue->value(), boxSize));
162
        OwnPtr<WebTransformOperations> lastOperations(toWebTransformOperations(*lastValue->value(), boxSize, viewportSize));
163
        if (!lastOperations)
163
        if (!lastOperations)
164
            return false;
164
            return false;
165
        canBlend = lastOperations->canBlendWith(*operations);
165
        canBlend = lastOperations->canBlendWith(*operations);
Lines 172-185 bool appendKeyframeWithStandardTimingFunction<TransformAnimationValue, WebTransf a/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp_sec6
172
}
172
}
173
173
174
template <>
174
template <>
175
bool appendKeyframeWithCustomBezierTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, double x1, double y1, double x2, double y2, const FloatSize& boxSize)
175
bool appendKeyframeWithCustomBezierTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, double x1, double y1, double x2, double y2, const FloatSize& boxSize, const IntSize& viewportSize)
176
{
176
{
177
    bool canBlend = !lastValue;
177
    bool canBlend = !lastValue;
178
    OwnPtr<WebTransformOperations> operations(toWebTransformOperations(*value->value(), boxSize));
178
    OwnPtr<WebTransformOperations> operations(toWebTransformOperations(*value->value(), boxSize, viewportSize));
179
    if (!operations)
179
    if (!operations)
180
        return false;
180
        return false;
181
    if (!canBlend) {
181
    if (!canBlend) {
182
        OwnPtr<WebTransformOperations> lastOperations(toWebTransformOperations(*lastValue->value(), boxSize));
182
        OwnPtr<WebTransformOperations> lastOperations(toWebTransformOperations(*lastValue->value(), boxSize, viewportSize));
183
        if (!lastOperations)
183
        if (!lastOperations)
184
            return false;
184
            return false;
185
        canBlend = lastOperations->canBlendWith(*operations);
185
        canBlend = lastOperations->canBlendWith(*operations);
Lines 192-198 bool appendKeyframeWithCustomBezierTimingFunction<TransformAnimationValue, WebTr a/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp_sec7
192
}
192
}
193
193
194
template <class Value, class Keyframe, class Curve>
194
template <class Value, class Keyframe, class Curve>
195
PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& valueList, const Animation* animation, int animationId, double timeOffset, Curve* curve, WebKit::WebAnimation::TargetProperty targetProperty, const FloatSize& boxSize)
195
PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& valueList, const Animation* animation, int animationId, double timeOffset, Curve* curve, WebKit::WebAnimation::TargetProperty targetProperty, const FloatSize& boxSize, const IntSize& viewportSize)
196
{
196
{
197
    bool alternate = false;
197
    bool alternate = false;
198
    bool reverse = false;
198
    bool reverse = false;
Lines 254-262 PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& val a/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp_sec8
254
254
255
        bool addedKeyframe = false;
255
        bool addedKeyframe = false;
256
        if (isUsingCustomBezierTimingFunction)
256
        if (isUsingCustomBezierTimingFunction)
257
            addedKeyframe = appendKeyframeWithCustomBezierTimingFunction<Value, Keyframe, Curve>(curve, keyTime, originalValue, lastOriginalValue, x1, y1, x2, y2, boxSize);
257
            addedKeyframe = appendKeyframeWithCustomBezierTimingFunction<Value, Keyframe, Curve>(curve, keyTime, originalValue, lastOriginalValue, x1, y1, x2, y2, boxSize, viewportSize);
258
        else
258
        else
259
            addedKeyframe = appendKeyframeWithStandardTimingFunction<Value, Keyframe, Curve>(curve, keyTime, originalValue, lastOriginalValue, timingFunctionType, boxSize);
259
            addedKeyframe = appendKeyframeWithStandardTimingFunction<Value, Keyframe, Curve>(curve, keyTime, originalValue, lastOriginalValue, timingFunctionType, boxSize, viewportSize);
260
        if (!addedKeyframe)
260
        if (!addedKeyframe)
261
            return nullptr;
261
            return nullptr;
262
    }
262
    }
Lines 273-290 PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& val a/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp_sec9
273
    return webAnimation.release();
273
    return webAnimation.release();
274
}
274
}
275
275
276
PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& values, const Animation* animation, int animationId, double timeOffset, const FloatSize& boxSize)
276
PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& values, const Animation* animation, int animationId, double timeOffset, const FloatSize& boxSize, const IntSize& viewportSize)
277
{
277
{
278
278
279
279
280
    if (values.property() == AnimatedPropertyWebkitTransform) {
280
    if (values.property() == AnimatedPropertyWebkitTransform) {
281
        OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(Platform::current()->compositorSupport()->createTransformAnimationCurve());
281
        OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(Platform::current()->compositorSupport()->createTransformAnimationCurve());
282
        return createWebAnimation<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), WebKit::WebAnimation::TargetPropertyTransform, FloatSize(boxSize));
282
        return createWebAnimation<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), WebKit::WebAnimation::TargetPropertyTransform, FloatSize(boxSize), viewportSize);
283
    }
283
    }
284
284
285
    if (values.property() == AnimatedPropertyOpacity) {
285
    if (values.property() == AnimatedPropertyOpacity) {
286
        OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(Platform::current()->compositorSupport()->createFloatAnimationCurve());
286
        OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(Platform::current()->compositorSupport()->createFloatAnimationCurve());
287
        return createWebAnimation<FloatAnimationValue, WebFloatKeyframe, WebFloatAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), WebKit::WebAnimation::TargetPropertyOpacity, FloatSize());
287
        return createWebAnimation<FloatAnimationValue, WebFloatKeyframe, WebFloatAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), WebKit::WebAnimation::TargetPropertyOpacity, FloatSize(), viewportSize);
288
    }
288
    }
289
289
290
    return nullptr;
290
    return nullptr;
- a/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.h -1 / +2 lines
Lines 42-47 namespace WebCore { a/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.h_sec1
42
class KeyframeValueList;
42
class KeyframeValueList;
43
class Animation;
43
class Animation;
44
class FloatSize;
44
class FloatSize;
45
class IntSize;
45
46
46
47
47
// Translates WebCore animation data into a WebAnimation. If we are unable
48
// Translates WebCore animation data into a WebAnimation. If we are unable
Lines 49-55 class FloatSize; a/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.h_sec2
49
//   - a steps timing function is used,
50
//   - a steps timing function is used,
50
//   - a property other than AnimatedPropertyWebkitTransform, or AnimatedPropertyOpacity is animated, or
51
//   - a property other than AnimatedPropertyWebkitTransform, or AnimatedPropertyOpacity is animated, or
51
//   - a transform animation involves a non-invertable transform.
52
//   - a transform animation involves a non-invertable transform.
52
PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList&, const Animation*, int animationId, double timeOffset, const FloatSize& boxSize);
53
PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList&, const Animation*, int animationId, double timeOffset, const FloatSize& boxSize, const IntSize& viewportSize);
53
54
54
} // namespace WebCore
55
} // namespace WebCore
55
56
- a/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp -2 / +2 lines
Lines 582-588 void GraphicsLayerChromium::setContentsTo(ContentsLayerPurpose purpose, WebLayer a/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp_sec1
582
        updateChildList();
582
        updateChildList();
583
}
583
}
584
584
585
bool GraphicsLayerChromium::addAnimation(const KeyframeValueList& values, const IntSize& boxSize, const Animation* animation, const String& animationName, double timeOffset)
585
bool GraphicsLayerChromium::addAnimation(const KeyframeValueList& values, const IntSize& boxSize, const IntSize& viewportSize, const Animation* animation, const String& animationName, double timeOffset)
586
{
586
{
587
    platformLayer()->setAnimationDelegate(this);
587
    platformLayer()->setAnimationDelegate(this);
588
588
Lines 591-597 bool GraphicsLayerChromium::addAnimation(const KeyframeValueList& values, const a/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp_sec2
591
    if (m_animationIdMap.contains(animationName))
591
    if (m_animationIdMap.contains(animationName))
592
        animationId = m_animationIdMap.get(animationName);
592
        animationId = m_animationIdMap.get(animationName);
593
593
594
    OwnPtr<WebAnimation> toAdd(createWebAnimation(values, animation, animationId, timeOffset, boxSize));
594
    OwnPtr<WebAnimation> toAdd(createWebAnimation(values, animation, animationId, timeOffset, boxSize, viewportSize));
595
595
596
    if (toAdd) {
596
    if (toAdd) {
597
        animationId = toAdd->id();
597
        animationId = toAdd->id();
- a/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h -1 / +1 lines
Lines 118-124 public: a/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h_sec1
118
    virtual void setContentsToCanvas(PlatformLayer*);
118
    virtual void setContentsToCanvas(PlatformLayer*);
119
    virtual bool hasContentsLayer() const { return m_contentsLayer; }
119
    virtual bool hasContentsLayer() const { return m_contentsLayer; }
120
120
121
    virtual bool addAnimation(const KeyframeValueList&, const IntSize& boxSize, const Animation*, const String&, double timeOffset);
121
    virtual bool addAnimation(const KeyframeValueList&, const IntSize& boxSize, const IntSize& viewportSize, const Animation*, const String&, double timeOffset);
122
    virtual void pauseAnimation(const String& animationName, double timeOffset);
122
    virtual void pauseAnimation(const String& animationName, double timeOffset);
123
    virtual void removeAnimation(const String& animationName);
123
    virtual void removeAnimation(const String& animationName);
124
    virtual void suspendAnimations(double wallClockTime);
124
    virtual void suspendAnimations(double wallClockTime);
- a/Source/WebCore/platform/graphics/filters/CustomFilterArrayParameter.h -1 / +1 lines
Lines 49-55 public: a/Source/WebCore/platform/graphics/filters/CustomFilterArrayParameter.h_sec1
49
49
50
    void addValue(double value) { m_data.append(value); }
50
    void addValue(double value) { m_data.append(value); }
51
51
52
    virtual PassRefPtr<CustomFilterParameter> blend(const CustomFilterParameter* from, double progress, const LayoutSize&)
52
    virtual PassRefPtr<CustomFilterParameter> blend(const CustomFilterParameter* from, double progress, const LayoutSize&, const IntSize& viewportSize)
53
    {
53
    {
54
        if (!from || !isSameType(*from))
54
        if (!from || !isSameType(*from))
55
            return this;
55
            return this;
- a/Source/WebCore/platform/graphics/filters/CustomFilterNumberParameter.h -1 / +1 lines
Lines 49-55 public: a/Source/WebCore/platform/graphics/filters/CustomFilterNumberParameter.h_sec1
49
49
50
    void addValue(double value) { m_data.append(value); }
50
    void addValue(double value) { m_data.append(value); }
51
    
51
    
52
    virtual PassRefPtr<CustomFilterParameter> blend(const CustomFilterParameter* from, double progress, const LayoutSize&)
52
    virtual PassRefPtr<CustomFilterParameter> blend(const CustomFilterParameter* from, double progress, const LayoutSize&, const IntSize& viewportSize)
53
    {
53
    {
54
        if (!from || !isSameType(*from))
54
        if (!from || !isSameType(*from))
55
            return this;
55
            return this;
- a/Source/WebCore/platform/graphics/filters/CustomFilterOperation.cpp -2 / +2 lines
Lines 54-60 CustomFilterOperation::~CustomFilterOperation() a/Source/WebCore/platform/graphics/filters/CustomFilterOperation.cpp_sec1
54
{
54
{
55
}
55
}
56
56
57
PassRefPtr<FilterOperation> CustomFilterOperation::blend(const FilterOperation* from, double progress, const LayoutSize& size, bool blendToPassthrough)
57
PassRefPtr<FilterOperation> CustomFilterOperation::blend(const FilterOperation* from, double progress, const LayoutSize& size, const IntSize& viewportSize, bool blendToPassthrough)
58
{
58
{
59
    // FIXME: There's no way to decide what is the "passthrough filter" for shaders using the current CSS Syntax.
59
    // FIXME: There's no way to decide what is the "passthrough filter" for shaders using the current CSS Syntax.
60
    // https://bugs.webkit.org/show_bug.cgi?id=84903
60
    // https://bugs.webkit.org/show_bug.cgi?id=84903
Lines 70-76 PassRefPtr<FilterOperation> CustomFilterOperation::blend(const FilterOperation* a/Source/WebCore/platform/graphics/filters/CustomFilterOperation.cpp_sec2
70
        return this;
70
        return this;
71
    
71
    
72
    CustomFilterParameterList animatedParameters;
72
    CustomFilterParameterList animatedParameters;
73
    m_parameters.blend(fromOp->m_parameters, progress, size, animatedParameters);
73
    m_parameters.blend(fromOp->m_parameters, progress, size, viewportSize, animatedParameters);
74
    return CustomFilterOperation::create(m_program, animatedParameters, m_meshRows, m_meshColumns, m_meshType);
74
    return CustomFilterOperation::create(m_program, animatedParameters, m_meshRows, m_meshColumns, m_meshType);
75
}
75
}
76
76
- a/Source/WebCore/platform/graphics/filters/CustomFilterOperation.h -1 / +1 lines
Lines 64-70 public: a/Source/WebCore/platform/graphics/filters/CustomFilterOperation.h_sec1
64
    virtual bool movesPixels() const { return true; }
64
    virtual bool movesPixels() const { return true; }
65
    virtual bool blendingNeedsRendererSize() const { return true; }
65
    virtual bool blendingNeedsRendererSize() const { return true; }
66
    
66
    
67
    virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, double progress, const LayoutSize&, bool blendToPassthrough = false);
67
    virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, double progress, const LayoutSize&, const IntSize& viewportSize, bool blendToPassthrough = false);
68
68
69
protected:
69
protected:
70
    CustomFilterOperation(PassRefPtr<CustomFilterProgram>, const CustomFilterParameterList&, unsigned meshRows, unsigned meshColumns, CustomFilterMeshType);
70
    CustomFilterOperation(PassRefPtr<CustomFilterProgram>, const CustomFilterParameterList&, unsigned meshRows, unsigned meshColumns, CustomFilterMeshType);
- a/Source/WebCore/platform/graphics/filters/CustomFilterParameter.h -1 / +1 lines
Lines 57-63 public: a/Source/WebCore/platform/graphics/filters/CustomFilterParameter.h_sec1
57
    
57
    
58
    bool isSameType(const CustomFilterParameter& other) const { return parameterType() == other.parameterType(); }
58
    bool isSameType(const CustomFilterParameter& other) const { return parameterType() == other.parameterType(); }
59
    
59
    
60
    virtual PassRefPtr<CustomFilterParameter> blend(const CustomFilterParameter*, double progress, const LayoutSize&) = 0;
60
    virtual PassRefPtr<CustomFilterParameter> blend(const CustomFilterParameter*, double progress, const LayoutSize&, const IntSize& viewportSize) = 0;
61
    virtual bool operator==(const CustomFilterParameter&) const = 0;
61
    virtual bool operator==(const CustomFilterParameter&) const = 0;
62
    bool operator!=(const CustomFilterParameter& o) const { return !(*this == o); }
62
    bool operator!=(const CustomFilterParameter& o) const { return !(*this == o); }
63
protected:
63
protected:
- a/Source/WebCore/platform/graphics/filters/CustomFilterParameterList.cpp -2 / +2 lines
Lines 69-75 bool CustomFilterParameterList::checkAlphabeticalOrder() const a/Source/WebCore/platform/graphics/filters/CustomFilterParameterList.cpp_sec1
69
}
69
}
70
70
71
void CustomFilterParameterList::blend(const CustomFilterParameterList& fromList, 
71
void CustomFilterParameterList::blend(const CustomFilterParameterList& fromList, 
72
    double progress, const LayoutSize& frameSize, CustomFilterParameterList& resultList) const
72
    double progress, const LayoutSize& frameSize, const IntSize& viewportSize, CustomFilterParameterList& resultList) const
73
{
73
{
74
    // This method expects both lists to be sorted by parameter name and the result list is also sorted.
74
    // This method expects both lists to be sorted by parameter name and the result list is also sorted.
75
    ASSERT(checkAlphabeticalOrder());
75
    ASSERT(checkAlphabeticalOrder());
Lines 79-85 void CustomFilterParameterList::blend(const CustomFilterParameterList& fromList, a/Source/WebCore/platform/graphics/filters/CustomFilterParameterList.cpp_sec2
79
        CustomFilterParameter* paramFrom = fromList.at(fromListIndex).get();
79
        CustomFilterParameter* paramFrom = fromList.at(fromListIndex).get();
80
        CustomFilterParameter* paramTo = at(toListIndex).get();
80
        CustomFilterParameter* paramTo = at(toListIndex).get();
81
        if (paramFrom->name() == paramTo->name()) {
81
        if (paramFrom->name() == paramTo->name()) {
82
            resultList.append(paramTo->blend(paramFrom, progress, frameSize));
82
            resultList.append(paramTo->blend(paramFrom, progress, frameSize, viewportSize));
83
            ++fromListIndex;
83
            ++fromListIndex;
84
            ++toListIndex;
84
            ++toListIndex;
85
            continue;
85
            continue;
- a/Source/WebCore/platform/graphics/filters/CustomFilterParameterList.h -1 / +1 lines
Lines 45-51 public: a/Source/WebCore/platform/graphics/filters/CustomFilterParameterList.h_sec1
45
    explicit CustomFilterParameterList(size_t);
45
    explicit CustomFilterParameterList(size_t);
46
46
47
    bool checkAlphabeticalOrder() const;
47
    bool checkAlphabeticalOrder() const;
48
    void blend(const CustomFilterParameterList& from, double progress, const LayoutSize&, CustomFilterParameterList& resultList) const;
48
    void blend(const CustomFilterParameterList& from, double progress, const LayoutSize&, const IntSize& viewportSize, CustomFilterParameterList& resultList) const;
49
    bool operator==(const CustomFilterParameterList&) const;
49
    bool operator==(const CustomFilterParameterList&) const;
50
};
50
};
51
51
- a/Source/WebCore/platform/graphics/filters/CustomFilterRenderer.cpp -1 / +1 lines
Lines 191-197 void CustomFilterRenderer::bindProgramTransformParameter(int uniformLocation, Cu a/Source/WebCore/platform/graphics/filters/CustomFilterRenderer.cpp_sec1
191
        // Note that the origin (0, 0) of the viewport is in the middle of the context, so there's no need to change the origin of the transform
191
        // Note that the origin (0, 0) of the viewport is in the middle of the context, so there's no need to change the origin of the transform
192
        // in order to rotate around the middle of mesh.
192
        // in order to rotate around the middle of mesh.
193
        matrix.scale3d(1.0 / m_contextSize.width(), 1.0 / m_contextSize.height(), 1);
193
        matrix.scale3d(1.0 / m_contextSize.width(), 1.0 / m_contextSize.height(), 1);
194
        transformParameter->applyTransform(matrix, m_contextSize);
194
        transformParameter->applyTransform(matrix, m_contextSize, IntSize());
195
        matrix.scale3d(m_contextSize.width(), m_contextSize.height(), 1);
195
        matrix.scale3d(m_contextSize.width(), m_contextSize.height(), 1);
196
    }
196
    }
197
    float glMatrix[16];
197
    float glMatrix[16];
- a/Source/WebCore/platform/graphics/filters/CustomFilterTransformParameter.h -4 / +4 lines
Lines 47-53 public: a/Source/WebCore/platform/graphics/filters/CustomFilterTransformParameter.h_sec1
47
        return adoptRef(new CustomFilterTransformParameter(name));
47
        return adoptRef(new CustomFilterTransformParameter(name));
48
    }
48
    }
49
49
50
    virtual PassRefPtr<CustomFilterParameter> blend(const CustomFilterParameter* fromParameter, double progress, const LayoutSize& size)
50
    virtual PassRefPtr<CustomFilterParameter> blend(const CustomFilterParameter* fromParameter, double progress, const LayoutSize& size, const IntSize& viewportSize)
51
    {
51
    {
52
        if (!fromParameter || !isSameType(*fromParameter))
52
        if (!fromParameter || !isSameType(*fromParameter))
53
            return this;
53
            return this;
Lines 60-66 public: a/Source/WebCore/platform/graphics/filters/CustomFilterTransformParameter.h_sec2
60
       
60
       
61
        RefPtr<CustomFilterTransformParameter> result = CustomFilterTransformParameter::create(name());
61
        RefPtr<CustomFilterTransformParameter> result = CustomFilterTransformParameter::create(name());
62
        if (from.size() && to.size())
62
        if (from.size() && to.size())
63
            result->setOperations(to.blend(from, progress, size));
63
            result->setOperations(to.blend(from, progress, size, viewportSize));
64
        else
64
        else
65
            result->setOperations(progress > 0.5 ? to : from);
65
            result->setOperations(progress > 0.5 ? to : from);
66
        return result;
66
        return result;
Lines 74-83 public: a/Source/WebCore/platform/graphics/filters/CustomFilterTransformParameter.h_sec3
74
        return m_operations == other->m_operations;
74
        return m_operations == other->m_operations;
75
    }
75
    }
76
76
77
    void applyTransform(TransformationMatrix& transform, const FloatSize& boxSize) const
77
    void applyTransform(TransformationMatrix& transform, const FloatSize& boxSize, const IntSize& viewportSize) const
78
    {
78
    {
79
        for (unsigned i = 0, size = m_operations.size(); i < size; ++i)
79
        for (unsigned i = 0, size = m_operations.size(); i < size; ++i)
80
            m_operations.at(i)->apply(transform, boxSize);
80
            m_operations.at(i)->apply(transform, boxSize, viewportSize);
81
    }
81
    }
82
82
83
    const TransformOperations& operations() const { return m_operations; }
83
    const TransformOperations& operations() const { return m_operations; }
- a/Source/WebCore/platform/graphics/filters/FilterOperation.h -1 / +1 lines
Lines 91-97 public: a/Source/WebCore/platform/graphics/filters/FilterOperation.h_sec1
91
        return 0; 
91
        return 0; 
92
    }
92
    }
93
93
94
    virtual PassRefPtr<FilterOperation> blend(const FilterOperation* /*from*/, double /*progress*/, const LayoutSize&, bool /*blendToPassthrough*/ = false)
94
    virtual PassRefPtr<FilterOperation> blend(const FilterOperation* /*from*/, double /*progress*/, const LayoutSize&, const IntSize& /*viewportSize*/, bool /*blendToPassthrough*/ = false)
95
    { 
95
    { 
96
        ASSERT(blendingNeedsRendererSize());
96
        ASSERT(blendingNeedsRendererSize());
97
        return 0; 
97
        return 0; 
- a/Source/WebCore/platform/graphics/filters/FilterOperations.cpp -1 / +1 lines
Lines 126-132 FilterOutsets FilterOperations::outsets() const a/Source/WebCore/platform/graphics/filters/FilterOperations.cpp_sec1
126
        switch (filterOperation->getOperationType()) {
126
        switch (filterOperation->getOperationType()) {
127
        case FilterOperation::BLUR: {
127
        case FilterOperation::BLUR: {
128
            BlurFilterOperation* blurOperation = static_cast<BlurFilterOperation*>(filterOperation);
128
            BlurFilterOperation* blurOperation = static_cast<BlurFilterOperation*>(filterOperation);
129
            float stdDeviation = floatValueForLength(blurOperation->stdDeviation(), 0);
129
            float stdDeviation = floatValueForLength(blurOperation->stdDeviation(), 0, IntSize());
130
            IntSize outsetSize = outsetSizeForBlur(stdDeviation);
130
            IntSize outsetSize = outsetSizeForBlur(stdDeviation);
131
            FilterOutsets outsets(outsetSize.height(), outsetSize.width(), outsetSize.height(), outsetSize.width());
131
            FilterOutsets outsets(outsetSize.height(), outsetSize.width(), outsetSize.height(), outsetSize.width());
132
            totalOutsets += outsets;
132
            totalOutsets += outsets;
- a/Source/WebCore/platform/graphics/filters/ValidatedCustomFilterOperation.cpp -1 / +1 lines
Lines 54-60 ValidatedCustomFilterOperation::~ValidatedCustomFilterOperation() a/Source/WebCore/platform/graphics/filters/ValidatedCustomFilterOperation.cpp_sec1
54
{
54
{
55
}
55
}
56
56
57
PassRefPtr<FilterOperation> ValidatedCustomFilterOperation::blend(const FilterOperation*, double progress, const LayoutSize& size, bool blendToPassthrough)
57
PassRefPtr<FilterOperation> ValidatedCustomFilterOperation::blend(const FilterOperation*, double progress, const LayoutSize& size, const IntSize& viewportSize, bool blendToPassthrough)
58
{
58
{
59
    UNUSED_PARAM(progress);
59
    UNUSED_PARAM(progress);
60
    UNUSED_PARAM(size);
60
    UNUSED_PARAM(size);
- a/Source/WebCore/platform/graphics/filters/ValidatedCustomFilterOperation.h -1 / +1 lines
Lines 54-60 public: a/Source/WebCore/platform/graphics/filters/ValidatedCustomFilterOperation.h_sec1
54
    virtual bool movesPixels() const { return true; }
54
    virtual bool movesPixels() const { return true; }
55
    virtual bool blendingNeedsRendererSize() const { return true; }
55
    virtual bool blendingNeedsRendererSize() const { return true; }
56
56
57
    virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, double progress, const LayoutSize&, bool blendToPassthrough = false);
57
    virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, double progress, const LayoutSize&, const IntSize& viewportSize, bool blendToPassthrough = false);
58
58
59
    CustomFilterValidatedProgram* validatedProgram() const { return m_validatedProgram.get(); }
59
    CustomFilterValidatedProgram* validatedProgram() const { return m_validatedProgram.get(); }
60
    const CustomFilterParameterList& parameters() const { return m_parameters; }
60
    const CustomFilterParameterList& parameters() const { return m_parameters; }
- a/Source/WebCore/platform/graphics/transforms/IdentityTransformOperation.h -2 / +2 lines
Lines 46-57 private: a/Source/WebCore/platform/graphics/transforms/IdentityTransformOperation.h_sec1
46
        return isSameType(o);
46
        return isSameType(o);
47
    }
47
    }
48
48
49
    virtual bool apply(TransformationMatrix&, const FloatSize&) const
49
    virtual bool apply(TransformationMatrix&, const FloatSize&, const IntSize&) const
50
    {
50
    {
51
        return false;
51
        return false;
52
    }
52
    }
53
53
54
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation*, double, bool = false)
54
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation*, double, const IntSize&, bool = false)
55
    {
55
    {
56
        return this;
56
        return this;
57
    }
57
    }
- a/Source/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.cpp -3 / +3 lines
Lines 32-38 using namespace std; a/Source/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.cpp_sec1
32
32
33
namespace WebCore {
33
namespace WebCore {
34
34
35
PassRefPtr<TransformOperation> Matrix3DTransformOperation::blend(const TransformOperation* from, double progress, bool blendToIdentity)
35
PassRefPtr<TransformOperation> Matrix3DTransformOperation::blend(const TransformOperation* from, double progress, const IntSize& viewportSize, bool blendToIdentity)
36
{
36
{
37
    if (from && !from->isSameType(*this))
37
    if (from && !from->isSameType(*this))
38
        return this;
38
        return this;
Lines 42-50 PassRefPtr<TransformOperation> Matrix3DTransformOperation::blend(const Transform a/Source/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.cpp_sec2
42
    TransformationMatrix fromT;
42
    TransformationMatrix fromT;
43
    TransformationMatrix toT;
43
    TransformationMatrix toT;
44
    if (from)
44
    if (from)
45
        from->apply(fromT, size);
45
        from->apply(fromT, size, viewportSize);
46
46
47
    apply(toT, size);
47
    apply(toT, size, viewportSize);
48
48
49
    if (blendToIdentity)
49
    if (blendToIdentity)
50
        std::swap(fromT, toT);
50
        std::swap(fromT, toT);
- a/Source/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h -2 / +2 lines
Lines 53-65 private: a/Source/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h_sec1
53
        return m_matrix == m->m_matrix;
53
        return m_matrix == m->m_matrix;
54
    }
54
    }
55
55
56
    virtual bool apply(TransformationMatrix& transform, const FloatSize&) const
56
    virtual bool apply(TransformationMatrix& transform, const FloatSize&, const IntSize&) const
57
    {
57
    {
58
        transform.multiply(TransformationMatrix(m_matrix));
58
        transform.multiply(TransformationMatrix(m_matrix));
59
        return false;
59
        return false;
60
    }
60
    }
61
61
62
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
62
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, const IntSize& viewportSize, bool blendToIdentity = false);
63
    
63
    
64
    Matrix3DTransformOperation(const TransformationMatrix& mat)
64
    Matrix3DTransformOperation(const TransformationMatrix& mat)
65
    {
65
    {
- a/Source/WebCore/platform/graphics/transforms/MatrixTransformOperation.cpp -1 / +1 lines
Lines 28-34 using namespace std; a/Source/WebCore/platform/graphics/transforms/MatrixTransformOperation.cpp_sec1
28
28
29
namespace WebCore {
29
namespace WebCore {
30
30
31
PassRefPtr<TransformOperation> MatrixTransformOperation::blend(const TransformOperation* from, double progress, bool blendToIdentity)
31
PassRefPtr<TransformOperation> MatrixTransformOperation::blend(const TransformOperation* from, double progress, const IntSize& viewportSize, bool blendToIdentity)
32
{
32
{
33
    if (from && !from->isSameType(*this))
33
    if (from && !from->isSameType(*this))
34
        return this;
34
        return this;
- a/Source/WebCore/platform/graphics/transforms/MatrixTransformOperation.h -2 / +2 lines
Lines 59-72 private: a/Source/WebCore/platform/graphics/transforms/MatrixTransformOperation.h_sec1
59
        return m_a == m->m_a && m_b == m->m_b && m_c == m->m_c && m_d == m->m_d && m_e == m->m_e && m_f == m->m_f;
59
        return m_a == m->m_a && m_b == m->m_b && m_c == m->m_c && m_d == m->m_d && m_e == m->m_e && m_f == m->m_f;
60
    }
60
    }
61
61
62
    virtual bool apply(TransformationMatrix& transform, const FloatSize&) const
62
    virtual bool apply(TransformationMatrix& transform, const FloatSize&, const IntSize&) const
63
    {
63
    {
64
        TransformationMatrix matrix(m_a, m_b, m_c, m_d, m_e, m_f);
64
        TransformationMatrix matrix(m_a, m_b, m_c, m_d, m_e, m_f);
65
        transform.multiply(matrix);
65
        transform.multiply(matrix);
66
        return false;
66
        return false;
67
    }
67
    }
68
68
69
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
69
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, const IntSize& viewportSize, bool blendToIdentity = false);
70
    
70
    
71
    MatrixTransformOperation(double a, double b, double c, double d, double e, double f)
71
    MatrixTransformOperation(double a, double b, double c, double d, double e, double f)
72
        : m_a(a)
72
        : m_a(a)
- a/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp -4 / +4 lines
Lines 33-45 using namespace std; a/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp_sec1
33
33
34
namespace WebCore {
34
namespace WebCore {
35
35
36
PassRefPtr<TransformOperation> PerspectiveTransformOperation::blend(const TransformOperation* from, double progress, bool blendToIdentity)
36
PassRefPtr<TransformOperation> PerspectiveTransformOperation::blend(const TransformOperation* from, double progress, const IntSize& viewportSize, bool blendToIdentity)
37
{
37
{
38
    if (from && !from->isSameType(*this))
38
    if (from && !from->isSameType(*this))
39
        return this;
39
        return this;
40
    
40
    
41
    if (blendToIdentity) {
41
    if (blendToIdentity) {
42
        double p = floatValueForLength(m_p, 1);
42
        double p = floatValueForLength(m_p, 1, viewportSize);
43
        p = WebCore::blend(p, 1.0, progress); // FIXME: this seems wrong. https://bugs.webkit.org/show_bug.cgi?id=52700
43
        p = WebCore::blend(p, 1.0, progress); // FIXME: this seems wrong. https://bugs.webkit.org/show_bug.cgi?id=52700
44
        return PerspectiveTransformOperation::create(Length(clampToPositiveInteger(p), Fixed));
44
        return PerspectiveTransformOperation::create(Length(clampToPositiveInteger(p), Fixed));
45
    }
45
    }
Lines 50-57 PassRefPtr<TransformOperation> PerspectiveTransformOperation::blend(const Transf a/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp_sec2
50
50
51
    TransformationMatrix fromT;
51
    TransformationMatrix fromT;
52
    TransformationMatrix toT;
52
    TransformationMatrix toT;
53
    fromT.applyPerspective(floatValueForLength(fromP, 1));
53
    fromT.applyPerspective(floatValueForLength(fromP, 1, viewportSize));
54
    toT.applyPerspective(floatValueForLength(toP, 1));
54
    toT.applyPerspective(floatValueForLength(toP, 1, viewportSize));
55
    toT.blend(fromT, progress);
55
    toT.blend(fromT, progress);
56
    TransformationMatrix::DecomposedType decomp;
56
    TransformationMatrix::DecomposedType decomp;
57
    toT.decompose(decomp);
57
    toT.decompose(decomp);
- a/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h -4 / +4 lines
Lines 42-48 public: a/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h_sec1
42
    Length perspective() const { return m_p; }
42
    Length perspective() const { return m_p; }
43
    
43
    
44
private:
44
private:
45
    virtual bool isIdentity() const { return !floatValueForLength(m_p, 1); }
45
    virtual bool isIdentity() const { return !floatValueForLength(m_p, 1, IntSize(1, 1)); }
46
    virtual OperationType getOperationType() const { return PERSPECTIVE; }
46
    virtual OperationType getOperationType() const { return PERSPECTIVE; }
47
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == PERSPECTIVE; }
47
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == PERSPECTIVE; }
48
48
Lines 54-66 private: a/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h_sec2
54
        return m_p == p->m_p;
54
        return m_p == p->m_p;
55
    }
55
    }
56
56
57
    virtual bool apply(TransformationMatrix& transform, const FloatSize&) const
57
    virtual bool apply(TransformationMatrix& transform, const FloatSize&, const IntSize& viewportSize) const
58
    {
58
    {
59
        transform.applyPerspective(floatValueForLength(m_p, 1));
59
        transform.applyPerspective(floatValueForLength(m_p, 1, viewportSize));
60
        return false;
60
        return false;
61
    }
61
    }
62
62
63
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
63
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, const IntSize& viewportSize, bool blendToIdentity = false);
64
64
65
    PerspectiveTransformOperation(const Length& p)
65
    PerspectiveTransformOperation(const Length& p)
66
        : m_p(p)
66
        : m_p(p)
- a/Source/WebCore/platform/graphics/transforms/RotateTransformOperation.cpp -1 / +1 lines
Lines 30-36 using namespace std; a/Source/WebCore/platform/graphics/transforms/RotateTransformOperation.cpp_sec1
30
30
31
namespace WebCore {
31
namespace WebCore {
32
32
33
PassRefPtr<TransformOperation> RotateTransformOperation::blend(const TransformOperation* from, double progress, bool blendToIdentity)
33
PassRefPtr<TransformOperation> RotateTransformOperation::blend(const TransformOperation* from, double progress, const IntSize& viewportSize, bool blendToIdentity)
34
{
34
{
35
    if (from && !from->isSameType(*this))
35
    if (from && !from->isSameType(*this))
36
        return this;
36
        return this;
- a/Source/WebCore/platform/graphics/transforms/RotateTransformOperation.h -2 / +2 lines
Lines 60-72 private: a/Source/WebCore/platform/graphics/transforms/RotateTransformOperation.h_sec1
60
        return m_x == r->m_x && m_y == r->m_y && m_z == r->m_z && m_angle == r->m_angle;
60
        return m_x == r->m_x && m_y == r->m_y && m_z == r->m_z && m_angle == r->m_angle;
61
    }
61
    }
62
62
63
    virtual bool apply(TransformationMatrix& transform, const FloatSize& /*borderBoxSize*/) const
63
    virtual bool apply(TransformationMatrix& transform, const FloatSize&, const IntSize&) const
64
    {
64
    {
65
        transform.rotate3d(m_x, m_y, m_z, m_angle);
65
        transform.rotate3d(m_x, m_y, m_z, m_angle);
66
        return false;
66
        return false;
67
    }
67
    }
68
68
69
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
69
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, const IntSize& viewportSize, bool blendToIdentity = false);
70
70
71
    RotateTransformOperation(double x, double y, double z, double angle, OperationType type)
71
    RotateTransformOperation(double x, double y, double z, double angle, OperationType type)
72
        : m_x(x)
72
        : m_x(x)
- a/Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.cpp -1 / +1 lines
Lines 26-32 a/Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.cpp_sec1
26
26
27
namespace WebCore {
27
namespace WebCore {
28
28
29
PassRefPtr<TransformOperation> ScaleTransformOperation::blend(const TransformOperation* from, double progress, bool blendToIdentity)
29
PassRefPtr<TransformOperation> ScaleTransformOperation::blend(const TransformOperation* from, double progress, const IntSize& viewportSize, bool blendToIdentity)
30
{
30
{
31
    if (from && !from->isSameType(*this))
31
    if (from && !from->isSameType(*this))
32
        return this;
32
        return this;
- a/Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.h -2 / +2 lines
Lines 59-71 private: a/Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.h_sec1
59
        return m_x == s->m_x && m_y == s->m_y && m_z == s->m_z;
59
        return m_x == s->m_x && m_y == s->m_y && m_z == s->m_z;
60
    }
60
    }
61
61
62
    virtual bool apply(TransformationMatrix& transform, const FloatSize&) const
62
    virtual bool apply(TransformationMatrix& transform, const FloatSize&, const IntSize&) const
63
    {
63
    {
64
        transform.scale3d(m_x, m_y, m_z);
64
        transform.scale3d(m_x, m_y, m_z);
65
        return false;
65
        return false;
66
    }
66
    }
67
67
68
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
68
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, const IntSize& viewportSize, bool blendToIdentity = false);
69
69
70
    ScaleTransformOperation(double sx, double sy, double sz, OperationType type)
70
    ScaleTransformOperation(double sx, double sy, double sz, OperationType type)
71
        : m_x(sx)
71
        : m_x(sx)
- a/Source/WebCore/platform/graphics/transforms/SkewTransformOperation.cpp -1 / +1 lines
Lines 26-32 a/Source/WebCore/platform/graphics/transforms/SkewTransformOperation.cpp_sec1
26
26
27
namespace WebCore {
27
namespace WebCore {
28
28
29
PassRefPtr<TransformOperation> SkewTransformOperation::blend(const TransformOperation* from, double progress, bool blendToIdentity)
29
PassRefPtr<TransformOperation> SkewTransformOperation::blend(const TransformOperation* from, double progress, const IntSize& viewportSize, bool blendToIdentity)
30
{
30
{
31
    if (from && !from->isSameType(*this))
31
    if (from && !from->isSameType(*this))
32
        return this;
32
        return this;
- a/Source/WebCore/platform/graphics/transforms/SkewTransformOperation.h -2 / +2 lines
Lines 52-64 private: a/Source/WebCore/platform/graphics/transforms/SkewTransformOperation.h_sec1
52
        return m_angleX == s->m_angleX && m_angleY == s->m_angleY;
52
        return m_angleX == s->m_angleX && m_angleY == s->m_angleY;
53
    }
53
    }
54
54
55
    virtual bool apply(TransformationMatrix& transform, const FloatSize&) const
55
    virtual bool apply(TransformationMatrix& transform, const FloatSize&, const IntSize&) const
56
    {
56
    {
57
        transform.skew(m_angleX, m_angleY);
57
        transform.skew(m_angleX, m_angleY);
58
        return false;
58
        return false;
59
    }
59
    }
60
60
61
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
61
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, const IntSize& viewportSize, bool blendToIdentity = false);
62
    
62
    
63
    SkewTransformOperation(double angleX, double angleY, OperationType type)
63
    SkewTransformOperation(double angleX, double angleY, OperationType type)
64
        : m_angleX(angleX)
64
        : m_angleX(angleX)
- a/Source/WebCore/platform/graphics/transforms/TransformOperation.h -2 / +2 lines
Lines 59-67 public: a/Source/WebCore/platform/graphics/transforms/TransformOperation.h_sec1
59
    virtual bool isIdentity() const = 0;
59
    virtual bool isIdentity() const = 0;
60
60
61
    // Return true if the borderBoxSize was used in the computation, false otherwise.
61
    // Return true if the borderBoxSize was used in the computation, false otherwise.
62
    virtual bool apply(TransformationMatrix&, const FloatSize& borderBoxSize) const = 0;
62
    virtual bool apply(TransformationMatrix&, const FloatSize& borderBoxSize, const IntSize& viewportSize) const = 0;
63
63
64
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false) = 0;
64
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, const IntSize& viewportSize, bool blendToIdentity = false) = 0;
65
65
66
    virtual OperationType getOperationType() const = 0;
66
    virtual OperationType getOperationType() const = 0;
67
    virtual bool isSameType(const TransformOperation&) const { return false; }
67
    virtual bool isSameType(const TransformOperation&) const { return false; }
- a/Source/WebCore/platform/graphics/transforms/TransformOperations.cpp -8 / +8 lines
Lines 65-71 bool TransformOperations::operationsMatch(const TransformOperations& other) cons a/Source/WebCore/platform/graphics/transforms/TransformOperations.cpp_sec1
65
    return true;
65
    return true;
66
}
66
}
67
67
68
TransformOperations TransformOperations::blendByMatchingOperations(const TransformOperations& from, const double& progress) const
68
TransformOperations TransformOperations::blendByMatchingOperations(const TransformOperations& from, const double& progress, const IntSize& viewportSize) const
69
{
69
{
70
    TransformOperations result;
70
    TransformOperations result;
71
71
Lines 75-81 TransformOperations TransformOperations::blendByMatchingOperations(const Transfo a/Source/WebCore/platform/graphics/transforms/TransformOperations.cpp_sec2
75
    for (unsigned i = 0; i < size; i++) {
75
    for (unsigned i = 0; i < size; i++) {
76
        RefPtr<TransformOperation> fromOperation = (i < fromSize) ? from.operations()[i].get() : 0;
76
        RefPtr<TransformOperation> fromOperation = (i < fromSize) ? from.operations()[i].get() : 0;
77
        RefPtr<TransformOperation> toOperation = (i < toSize) ? operations()[i].get() : 0;
77
        RefPtr<TransformOperation> toOperation = (i < toSize) ? operations()[i].get() : 0;
78
        RefPtr<TransformOperation> blendedOperation = toOperation ? toOperation->blend(fromOperation.get(), progress) : (fromOperation ? fromOperation->blend(0, progress, true) : 0);
78
        RefPtr<TransformOperation> blendedOperation = toOperation ? toOperation->blend(fromOperation.get(), progress, viewportSize) : (fromOperation ? fromOperation->blend(0, progress, viewportSize, true) : 0);
79
        if (blendedOperation)
79
        if (blendedOperation)
80
            result.operations().append(blendedOperation);
80
            result.operations().append(blendedOperation);
81
        else {
81
        else {
Lines 90-104 TransformOperations TransformOperations::blendByMatchingOperations(const Transfo a/Source/WebCore/platform/graphics/transforms/TransformOperations.cpp_sec3
90
    return result;
90
    return result;
91
}
91
}
92
92
93
TransformOperations TransformOperations::blendByUsingMatrixInterpolation(const TransformOperations& from, double progress, const LayoutSize& size) const
93
TransformOperations TransformOperations::blendByUsingMatrixInterpolation(const TransformOperations& from, double progress, const LayoutSize& size, const IntSize& viewportSize) const
94
{
94
{
95
    TransformOperations result;
95
    TransformOperations result;
96
96
97
    // Convert the TransformOperations into matrices
97
    // Convert the TransformOperations into matrices
98
    TransformationMatrix fromTransform;
98
    TransformationMatrix fromTransform;
99
    TransformationMatrix toTransform;
99
    TransformationMatrix toTransform;
100
    from.apply(size, fromTransform);
100
    from.apply(size, viewportSize, fromTransform);
101
    apply(size, toTransform);
101
    apply(size, viewportSize, toTransform);
102
102
103
    toTransform.blend(fromTransform, progress);
103
    toTransform.blend(fromTransform, progress);
104
104
Lines 108-122 TransformOperations TransformOperations::blendByUsingMatrixInterpolation(const T a/Source/WebCore/platform/graphics/transforms/TransformOperations.cpp_sec4
108
    return result;
108
    return result;
109
}
109
}
110
110
111
TransformOperations TransformOperations::blend(const TransformOperations& from, double progress, const LayoutSize& size) const
111
TransformOperations TransformOperations::blend(const TransformOperations& from, double progress, const LayoutSize& size, const IntSize& viewportSize) const
112
{
112
{
113
    if (from == *this)
113
    if (from == *this)
114
        return *this;
114
        return *this;
115
115
116
    if (from.size() && from.operationsMatch(*this))
116
    if (from.size() && from.operationsMatch(*this))
117
        return blendByMatchingOperations(from, progress);
117
        return blendByMatchingOperations(from, progress, viewportSize);
118
118
119
    return blendByUsingMatrixInterpolation(from, progress, size);
119
    return blendByUsingMatrixInterpolation(from, progress, size, viewportSize);
120
}
120
}
121
121
122
} // namespace WebCore
122
} // namespace WebCore
- a/Source/WebCore/platform/graphics/transforms/TransformOperations.h -5 / +5 lines
Lines 43-52 public: a/Source/WebCore/platform/graphics/transforms/TransformOperations.h_sec1
43
        return !(*this == o);
43
        return !(*this == o);
44
    }
44
    }
45
    
45
    
46
    void apply(const FloatSize& sz, TransformationMatrix& t) const
46
    void apply(const FloatSize& sz, const IntSize& viewportSize, TransformationMatrix& t) const
47
    {
47
    {
48
        for (unsigned i = 0; i < m_operations.size(); ++i)
48
        for (unsigned i = 0; i < m_operations.size(); ++i)
49
            m_operations[i]->apply(t, sz);
49
            m_operations[i]->apply(t, sz, viewportSize);
50
    }
50
    }
51
    
51
    
52
    // Return true if any of the operation types are 3D operation types (even if the
52
    // Return true if any of the operation types are 3D operation types (even if the
Lines 72-80 public: a/Source/WebCore/platform/graphics/transforms/TransformOperations.h_sec2
72
    size_t size() const { return m_operations.size(); }
72
    size_t size() const { return m_operations.size(); }
73
    const TransformOperation* at(size_t index) const { return index < m_operations.size() ? m_operations.at(index).get() : 0; }
73
    const TransformOperation* at(size_t index) const { return index < m_operations.size() ? m_operations.at(index).get() : 0; }
74
74
75
    TransformOperations blendByMatchingOperations(const TransformOperations& from, const double& progress) const;
75
    TransformOperations blendByMatchingOperations(const TransformOperations& from, const double& progress, const IntSize& viewportSize) const;
76
    TransformOperations blendByUsingMatrixInterpolation(const TransformOperations& from, double progress, const LayoutSize&) const;
76
    TransformOperations blendByUsingMatrixInterpolation(const TransformOperations& from, double progress, const LayoutSize&, const IntSize& viewportSize) const;
77
    TransformOperations blend(const TransformOperations& from, double progress, const LayoutSize&) const;
77
    TransformOperations blend(const TransformOperations& from, double progress, const LayoutSize&, const IntSize& viewportSize) const;
78
78
79
private:
79
private:
80
    Vector<RefPtr<TransformOperation> > m_operations;
80
    Vector<RefPtr<TransformOperation> > m_operations;
- a/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.cpp -1 / +1 lines
Lines 25-31 a/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.cpp_sec1
25
25
26
namespace WebCore {
26
namespace WebCore {
27
27
28
PassRefPtr<TransformOperation> TranslateTransformOperation::blend(const TransformOperation* from, double progress, bool blendToIdentity)
28
PassRefPtr<TransformOperation> TranslateTransformOperation::blend(const TransformOperation* from, double progress, const IntSize& viewportSize, bool blendToIdentity)
29
{
29
{
30
    if (from && !from->isSameType(*this))
30
    if (from && !from->isSameType(*this))
31
        return this;
31
        return this;
- a/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h -7 / +11 lines
Lines 43-58 public: a/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h_sec1
43
        return adoptRef(new TranslateTransformOperation(tx, ty, tz, type));
43
        return adoptRef(new TranslateTransformOperation(tx, ty, tz, type));
44
    }
44
    }
45
45
46
    double x(const FloatSize& borderBoxSize) const { return floatValueForLength(m_x, borderBoxSize.width()); }
46
    double x(const FloatSize& borderBoxSize, const IntSize& viewportSize) const { return floatValueForLength(m_x, borderBoxSize.width(), viewportSize); }
47
    double y(const FloatSize& borderBoxSize) const { return floatValueForLength(m_y, borderBoxSize.height()); }
47
    double y(const FloatSize& borderBoxSize, const IntSize& viewportSize) const { return floatValueForLength(m_y, borderBoxSize.height(), viewportSize); }
48
    double z(const FloatSize&) const { return floatValueForLength(m_z, 1); }
48
    double z(const FloatSize&, const IntSize& viewportSize) const { return floatValueForLength(m_z, 1, viewportSize); }
49
49
50
    Length x() const { return m_x; }
50
    Length x() const { return m_x; }
51
    Length y() const { return m_y; }
51
    Length y() const { return m_y; }
52
    Length z() const { return m_z; }
52
    Length z() const { return m_z; }
53
53
54
private:
54
private:
55
    virtual bool isIdentity() const { return !floatValueForLength(m_x, 1) && !floatValueForLength(m_y, 1) && !floatValueForLength(m_z, 1); }
55
    virtual bool isIdentity() const
56
    {
57
        IntSize viewportSize(1, 1);
58
        return !floatValueForLength(m_x, 1, viewportSize) && !floatValueForLength(m_y, 1, viewportSize) && !floatValueForLength(m_z, 1, viewportSize);
59
    }
56
60
57
    virtual OperationType getOperationType() const { return m_type; }
61
    virtual OperationType getOperationType() const { return m_type; }
58
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
62
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
Lines 65-77 private: a/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h_sec2
65
        return m_x == t->m_x && m_y == t->m_y && m_z == t->m_z;
69
        return m_x == t->m_x && m_y == t->m_y && m_z == t->m_z;
66
    }
70
    }
67
71
68
    virtual bool apply(TransformationMatrix& transform, const FloatSize& borderBoxSize) const
72
    virtual bool apply(TransformationMatrix& transform, const FloatSize& borderBoxSize, const IntSize& viewportSize) const
69
    {
73
    {
70
        transform.translate3d(x(borderBoxSize), y(borderBoxSize), z(borderBoxSize));
74
        transform.translate3d(x(borderBoxSize, viewportSize), y(borderBoxSize, viewportSize), z(borderBoxSize, viewportSize));
71
        return m_x.type() == Percent || m_y.type() == Percent;
75
        return m_x.type() == Percent || m_y.type() == Percent;
72
    }
76
    }
73
77
74
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
78
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, const IntSize& viewportSize, bool blendToIdentity = false);
75
79
76
    TranslateTransformOperation(const Length& tx, const Length& ty, const Length& tz, OperationType type)
80
    TranslateTransformOperation(const Length& tx, const Length& ty, const Length& tz, OperationType type)
77
        : m_x(tx)
81
        : m_x(tx)
- a/Source/WebCore/rendering/AutoTableLayout.cpp -1 / +1 lines
Lines 543-549 void AutoTableLayout::layout() a/Source/WebCore/rendering/AutoTableLayout.cpp_sec1
543
        for (size_t i = 0; i < nEffCols; ++i) {
543
        for (size_t i = 0; i < nEffCols; ++i) {
544
            Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
544
            Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
545
            if (logicalWidth.isPercent()) {
545
            if (logicalWidth.isPercent()) {
546
                int cellLogicalWidth = max<int>(m_layoutStruct[i].effectiveMinLogicalWidth, minimumValueForLength(logicalWidth, tableLogicalWidth));
546
                int cellLogicalWidth = max<int>(m_layoutStruct[i].effectiveMinLogicalWidth, minimumValueForLength(logicalWidth, tableLogicalWidth, IntSize()));
547
                available += m_layoutStruct[i].computedLogicalWidth - cellLogicalWidth;
547
                available += m_layoutStruct[i].computedLogicalWidth - cellLogicalWidth;
548
                m_layoutStruct[i].computedLogicalWidth = cellLogicalWidth;
548
                m_layoutStruct[i].computedLogicalWidth = cellLogicalWidth;
549
            }
549
            }
- a/Source/WebCore/rendering/ClipPathOperation.h -2 / +2 lines
Lines 102-113 public: a/Source/WebCore/rendering/ClipPathOperation.h_sec1
102
102
103
    const BasicShape* basicShape() const { return m_shape.get(); }
103
    const BasicShape* basicShape() const { return m_shape.get(); }
104
    WindRule windRule() const { return m_shape->windRule(); }
104
    WindRule windRule() const { return m_shape->windRule(); }
105
    const Path& path(const FloatRect& boundingRect)
105
    const Path& path(const FloatRect& boundingRect, const IntSize& viewportSize)
106
    {
106
    {
107
        ASSERT(m_shape);
107
        ASSERT(m_shape);
108
        m_path.clear();
108
        m_path.clear();
109
        m_path = adoptPtr(new Path);
109
        m_path = adoptPtr(new Path);
110
        m_shape->path(*m_path, boundingRect);
110
        m_shape->path(*m_path, boundingRect, viewportSize);
111
        return *m_path;
111
        return *m_path;
112
    }
112
    }
113
113
- a/Source/WebCore/rendering/ExclusionShape.cpp -18 / +18 lines
Lines 90-96 static inline FloatSize physicalSizeToLogical(const FloatSize& size, WritingMode a/Source/WebCore/rendering/ExclusionShape.cpp_sec1
90
    return size.transposedSize();
90
    return size.transposedSize();
91
}
91
}
92
92
93
PassOwnPtr<ExclusionShape> ExclusionShape::createExclusionShape(const BasicShape* basicShape, float logicalBoxWidth, float logicalBoxHeight, WritingMode writingMode, Length margin, Length padding)
93
PassOwnPtr<ExclusionShape> ExclusionShape::createExclusionShape(const BasicShape* basicShape, float logicalBoxWidth, float logicalBoxHeight, const IntSize& viewportSize, WritingMode writingMode, Length margin, Length padding)
94
{
94
{
95
    ASSERT(basicShape);
95
    ASSERT(basicShape);
96
96
Lines 104-118 PassOwnPtr<ExclusionShape> ExclusionShape::createExclusionShape(const BasicShape a/Source/WebCore/rendering/ExclusionShape.cpp_sec2
104
    case BasicShape::BASIC_SHAPE_RECTANGLE: {
104
    case BasicShape::BASIC_SHAPE_RECTANGLE: {
105
        const BasicShapeRectangle* rectangle = static_cast<const BasicShapeRectangle*>(basicShape);
105
        const BasicShapeRectangle* rectangle = static_cast<const BasicShapeRectangle*>(basicShape);
106
        FloatRect bounds(
106
        FloatRect bounds(
107
            floatValueForLength(rectangle->x(), boxWidth),
107
            floatValueForLength(rectangle->x(), boxWidth, viewportSize),
108
            floatValueForLength(rectangle->y(), boxHeight),
108
            floatValueForLength(rectangle->y(), boxHeight, viewportSize),
109
            floatValueForLength(rectangle->width(), boxWidth),
109
            floatValueForLength(rectangle->width(), boxWidth, viewportSize),
110
            floatValueForLength(rectangle->height(), boxHeight));
110
            floatValueForLength(rectangle->height(), boxHeight, viewportSize));
111
        Length radiusXLength = rectangle->cornerRadiusX();
111
        Length radiusXLength = rectangle->cornerRadiusX();
112
        Length radiusYLength = rectangle->cornerRadiusY();
112
        Length radiusYLength = rectangle->cornerRadiusY();
113
        FloatSize cornerRadii(
113
        FloatSize cornerRadii(
114
            radiusXLength.isUndefined() ? 0 : floatValueForLength(radiusXLength, boxWidth),
114
            radiusXLength.isUndefined() ? 0 : floatValueForLength(radiusXLength, boxWidth, viewportSize),
115
            radiusYLength.isUndefined() ? 0 : floatValueForLength(radiusYLength, boxHeight));
115
            radiusYLength.isUndefined() ? 0 : floatValueForLength(radiusYLength, boxHeight, viewportSize));
116
        FloatRect logicalBounds = physicalRectToLogical(bounds, logicalBoxHeight, writingMode);
116
        FloatRect logicalBounds = physicalRectToLogical(bounds, logicalBoxHeight, writingMode);
117
117
118
        exclusionShape = createExclusionRectangle(logicalBounds, physicalSizeToLogical(cornerRadii, writingMode));
118
        exclusionShape = createExclusionRectangle(logicalBounds, physicalSizeToLogical(cornerRadii, writingMode));
Lines 122-130 PassOwnPtr<ExclusionShape> ExclusionShape::createExclusionShape(const BasicShape a/Source/WebCore/rendering/ExclusionShape.cpp_sec3
122
122
123
    case BasicShape::BASIC_SHAPE_CIRCLE: {
123
    case BasicShape::BASIC_SHAPE_CIRCLE: {
124
        const BasicShapeCircle* circle = static_cast<const BasicShapeCircle*>(basicShape);
124
        const BasicShapeCircle* circle = static_cast<const BasicShapeCircle*>(basicShape);
125
        float centerX = floatValueForLength(circle->centerX(), boxWidth);
125
        float centerX = floatValueForLength(circle->centerX(), boxWidth, viewportSize);
126
        float centerY = floatValueForLength(circle->centerY(), boxHeight);
126
        float centerY = floatValueForLength(circle->centerY(), boxHeight, viewportSize);
127
        float radius =  floatValueForLength(circle->radius(), std::max(boxHeight, boxWidth));
127
        float radius =  floatValueForLength(circle->radius(), std::max(boxHeight, boxWidth), viewportSize);
128
        FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, centerY), logicalBoxHeight, writingMode);
128
        FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, centerY), logicalBoxHeight, writingMode);
129
129
130
        exclusionShape = createExclusionCircle(logicalCenter, radius);
130
        exclusionShape = createExclusionCircle(logicalCenter, radius);
Lines 134-143 PassOwnPtr<ExclusionShape> ExclusionShape::createExclusionShape(const BasicShape a/Source/WebCore/rendering/ExclusionShape.cpp_sec4
134
134
135
    case BasicShape::BASIC_SHAPE_ELLIPSE: {
135
    case BasicShape::BASIC_SHAPE_ELLIPSE: {
136
        const BasicShapeEllipse* ellipse = static_cast<const BasicShapeEllipse*>(basicShape);
136
        const BasicShapeEllipse* ellipse = static_cast<const BasicShapeEllipse*>(basicShape);
137
        float centerX = floatValueForLength(ellipse->centerX(), boxWidth);
137
        float centerX = floatValueForLength(ellipse->centerX(), boxWidth, viewportSize);
138
        float centerY = floatValueForLength(ellipse->centerY(), boxHeight);
138
        float centerY = floatValueForLength(ellipse->centerY(), boxHeight, viewportSize);
139
        float radiusX = floatValueForLength(ellipse->radiusX(), boxWidth);
139
        float radiusX = floatValueForLength(ellipse->radiusX(), boxWidth, viewportSize);
140
        float radiusY = floatValueForLength(ellipse->radiusY(), boxHeight);
140
        float radiusY = floatValueForLength(ellipse->radiusY(), boxHeight, viewportSize);
141
        FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, centerY), logicalBoxHeight, writingMode);
141
        FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, centerY), logicalBoxHeight, writingMode);
142
        FloatSize logicalRadii = physicalSizeToLogical(FloatSize(radiusX, radiusY), writingMode);
142
        FloatSize logicalRadii = physicalSizeToLogical(FloatSize(radiusX, radiusY), writingMode);
143
143
Lines 155-162 PassOwnPtr<ExclusionShape> ExclusionShape::createExclusionShape(const BasicShape a/Source/WebCore/rendering/ExclusionShape.cpp_sec5
155
        Vector<FloatPoint>* vertices = new Vector<FloatPoint>(valuesSize / 2);
155
        Vector<FloatPoint>* vertices = new Vector<FloatPoint>(valuesSize / 2);
156
        for (unsigned i = 0; i < valuesSize; i += 2) {
156
        for (unsigned i = 0; i < valuesSize; i += 2) {
157
            FloatPoint vertex(
157
            FloatPoint vertex(
158
                floatValueForLength(values.at(i), boxWidth),
158
                floatValueForLength(values.at(i), boxWidth, viewportSize),
159
                floatValueForLength(values.at(i + 1), boxHeight));
159
                floatValueForLength(values.at(i + 1), boxHeight, viewportSize));
160
            (*vertices)[i / 2] = physicalPointToLogical(vertex, logicalBoxHeight, writingMode);
160
            (*vertices)[i / 2] = physicalPointToLogical(vertex, logicalBoxHeight, writingMode);
161
            if (!i)
161
            if (!i)
162
                boundingBox.setLocation(vertex);
162
                boundingBox.setLocation(vertex);
Lines 175-182 PassOwnPtr<ExclusionShape> ExclusionShape::createExclusionShape(const BasicShape a/Source/WebCore/rendering/ExclusionShape.cpp_sec6
175
    exclusionShape->m_logicalBoxWidth = logicalBoxWidth;
175
    exclusionShape->m_logicalBoxWidth = logicalBoxWidth;
176
    exclusionShape->m_logicalBoxHeight = logicalBoxHeight;
176
    exclusionShape->m_logicalBoxHeight = logicalBoxHeight;
177
    exclusionShape->m_writingMode = writingMode;
177
    exclusionShape->m_writingMode = writingMode;
178
    exclusionShape->m_margin = floatValueForLength(margin, 0);
178
    exclusionShape->m_margin = floatValueForLength(margin, 0, viewportSize);
179
    exclusionShape->m_padding = floatValueForLength(padding, 0);
179
    exclusionShape->m_padding = floatValueForLength(padding, 0, viewportSize);
180
180
181
    return exclusionShape.release();
181
    return exclusionShape.release();
182
}
182
}
- a/Source/WebCore/rendering/ExclusionShape.h -1 / +1 lines
Lines 59-65 typedef Vector<LineSegment> SegmentList; a/Source/WebCore/rendering/ExclusionShape.h_sec1
59
59
60
class ExclusionShape {
60
class ExclusionShape {
61
public:
61
public:
62
    static PassOwnPtr<ExclusionShape> createExclusionShape(const BasicShape*, float logicalBoxWidth, float logicalBoxHeight, WritingMode, Length margin, Length padding);
62
    static PassOwnPtr<ExclusionShape> createExclusionShape(const BasicShape*, float logicalBoxWidth, float logicalBoxHeight, const IntSize& viewportSize, WritingMode, Length margin, Length padding);
63
63
64
    virtual ~ExclusionShape() { }
64
    virtual ~ExclusionShape() { }
65
65
- a/Source/WebCore/rendering/ExclusionShapeInfo.cpp -1 / +2 lines
Lines 37-42 a/Source/WebCore/rendering/ExclusionShapeInfo.cpp_sec1
37
#include "RenderBox.h"
37
#include "RenderBox.h"
38
#include "RenderRegion.h"
38
#include "RenderRegion.h"
39
#include "RenderStyle.h"
39
#include "RenderStyle.h"
40
#include "RenderView.h"
40
41
41
namespace WebCore {
42
namespace WebCore {
42
template<class RenderType, ExclusionShapeValue* (RenderStyle::*shapeGetter)() const, void (ExclusionShape::*intervalGetter)(float, float, SegmentList&) const>
43
template<class RenderType, ExclusionShapeValue* (RenderStyle::*shapeGetter)() const, void (ExclusionShape::*intervalGetter)(float, float, SegmentList&) const>
Lines 50-56 const ExclusionShape* ExclusionShapeInfo<RenderType, shapeGetter, intervalGetter a/Source/WebCore/rendering/ExclusionShapeInfo.cpp_sec2
50
51
51
    ASSERT(shape);
52
    ASSERT(shape);
52
53
53
    m_shape = ExclusionShape::createExclusionShape(shape, m_shapeLogicalWidth, m_shapeLogicalHeight, m_renderer->style()->writingMode(), m_renderer->style()->shapeMargin(), m_renderer->style()->shapePadding());
54
    m_shape = ExclusionShape::createExclusionShape(shape, m_shapeLogicalWidth, m_shapeLogicalHeight, m_renderer->view()->viewportSize(), m_renderer->style()->writingMode(), m_renderer->style()->shapeMargin(), m_renderer->style()->shapePadding());
54
    ASSERT(m_shape);
55
    ASSERT(m_shape);
55
    return m_shape.get();
56
    return m_shape.get();
56
}
57
}
- a/Source/WebCore/rendering/FilterEffectRenderer.cpp -1 / +1 lines
Lines 331-337 bool FilterEffectRenderer::build(RenderObject* renderer, const FilterOperations& a/Source/WebCore/rendering/FilterEffectRenderer.cpp_sec1
331
        }
331
        }
332
        case FilterOperation::BLUR: {
332
        case FilterOperation::BLUR: {
333
            BlurFilterOperation* blurOperation = static_cast<BlurFilterOperation*>(filterOperation);
333
            BlurFilterOperation* blurOperation = static_cast<BlurFilterOperation*>(filterOperation);
334
            float stdDeviation = floatValueForLength(blurOperation->stdDeviation(), 0);
334
            float stdDeviation = renderer->floatValueForLength(blurOperation->stdDeviation(), 0);
335
            effect = FEGaussianBlur::create(this, stdDeviation, stdDeviation);
335
            effect = FEGaussianBlur::create(this, stdDeviation, stdDeviation);
336
            break;
336
            break;
337
        }
337
        }
- a/Source/WebCore/rendering/FixedTableLayout.cpp -1 / +1 lines
Lines 233-239 void FixedTableLayout::layout() a/Source/WebCore/rendering/FixedTableLayout.cpp_sec1
233
            calcWidth[i] = m_width[i].value();
233
            calcWidth[i] = m_width[i].value();
234
            totalFixedWidth += calcWidth[i];
234
            totalFixedWidth += calcWidth[i];
235
        } else if (m_width[i].isPercent()) {
235
        } else if (m_width[i].isPercent()) {
236
            calcWidth[i] = valueForLength(m_width[i], tableLogicalWidth);
236
            calcWidth[i] = valueForLength(m_width[i], tableLogicalWidth, IntSize());
237
            totalPercentWidth += calcWidth[i];
237
            totalPercentWidth += calcWidth[i];
238
            totalPercent += m_width[i].percent();
238
            totalPercent += m_width[i].percent();
239
        } else if (m_width[i].isAuto()) {
239
        } else if (m_width[i].isAuto()) {
- a/Source/WebCore/rendering/RenderBlock.cpp -5 / +2 lines
Lines 4290-4301 inline void RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::collectIfNe a/Source/WebCore/rendering/RenderBlock.cpp_sec1
4290
LayoutUnit RenderBlock::textIndentOffset() const
4290
LayoutUnit RenderBlock::textIndentOffset() const
4291
{
4291
{
4292
    LayoutUnit cw = 0;
4292
    LayoutUnit cw = 0;
4293
    RenderView* renderView = 0;
4294
    if (style()->textIndent().isPercent())
4293
    if (style()->textIndent().isPercent())
4295
        cw = containingBlock()->availableLogicalWidth();
4294
        cw = containingBlock()->availableLogicalWidth();
4296
    else if (style()->textIndent().isViewportPercentage())
4295
    return minimumValueForLength(style()->textIndent(), cw);
4297
        renderView = view();
4298
    return minimumValueForLength(style()->textIndent(), cw, renderView);
4299
}
4296
}
4300
4297
4301
LayoutUnit RenderBlock::logicalLeftOffsetForContent(RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const
4298
LayoutUnit RenderBlock::logicalLeftOffsetForContent(RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const
Lines 5965-5971 void RenderBlock::computeInlinePreferredLogicalWidths() a/Source/WebCore/rendering/RenderBlock.cpp_sec2
5965
    // Signals the text indent was more negative than the min preferred width
5962
    // Signals the text indent was more negative than the min preferred width
5966
    bool hasRemainingNegativeTextIndent = false;
5963
    bool hasRemainingNegativeTextIndent = false;
5967
5964
5968
    LayoutUnit textIndent = minimumValueForLength(styleToUse->textIndent(), cw, view());
5965
    LayoutUnit textIndent = minimumValueForLength(styleToUse->textIndent(), cw);
5969
    RenderObject* prevFloat = 0;
5966
    RenderObject* prevFloat = 0;
5970
    bool isPrevChildInlineFlow = false;
5967
    bool isPrevChildInlineFlow = false;
5971
    bool shouldBreakLineAfterText = false;
5968
    bool shouldBreakLineAfterText = false;
- a/Source/WebCore/rendering/RenderBox.cpp -108 / +97 lines
Lines 576-585 int RenderBox::reflectionOffset() const a/Source/WebCore/rendering/RenderBox.cpp_sec1
576
{
576
{
577
    if (!style()->boxReflect())
577
    if (!style()->boxReflect())
578
        return 0;
578
        return 0;
579
    RenderView* renderView = view();
580
    if (style()->boxReflect()->direction() == ReflectionLeft || style()->boxReflect()->direction() == ReflectionRight)
579
    if (style()->boxReflect()->direction() == ReflectionLeft || style()->boxReflect()->direction() == ReflectionRight)
581
        return valueForLength(style()->boxReflect()->offset(), borderBoxRect().width(), renderView);
580
        return valueForLength(style()->boxReflect()->offset(), borderBoxRect().width());
582
    return valueForLength(style()->boxReflect()->offset(), borderBoxRect().height(), renderView);
581
    return valueForLength(style()->boxReflect()->offset(), borderBoxRect().height());
583
}
582
}
584
583
585
LayoutRect RenderBox::reflectedRect(const LayoutRect& r) const
584
LayoutRect RenderBox::reflectedRect(const LayoutRect& r) const
Lines 1089-1095 void RenderBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& pai a/Source/WebCore/rendering/RenderBox.cpp_sec2
1089
        // To avoid the background color bleeding out behind the border, we'll render background and border
1088
        // To avoid the background color bleeding out behind the border, we'll render background and border
1090
        // into a transparency layer, and then clip that in one go (which requires setting up the clip before
1089
        // into a transparency layer, and then clip that in one go (which requires setting up the clip before
1091
        // beginning the layer).
1090
        // beginning the layer).
1092
        RoundedRect border = style()->getRoundedBorderFor(paintRect, view());
1091
        RoundedRect border = style()->getRoundedBorderFor(paintRect, this);
1093
        stateSaver.save();
1092
        stateSaver.save();
1094
        paintInfo.context->clipRoundedRect(border);
1093
        paintInfo.context->clipRoundedRect(border);
1095
        paintInfo.context->beginTransparencyLayer(1);
1094
        paintInfo.context->beginTransparencyLayer(1);
Lines 1408-1414 bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu a/Source/WebCore/rendering/RenderBox.cpp_sec3
1408
    IntRect clipRect = pixelSnappedIntRect(isControlClip ? controlClipRect(accumulatedOffset) : overflowClipRect(accumulatedOffset, paintInfo.renderRegion));
1407
    IntRect clipRect = pixelSnappedIntRect(isControlClip ? controlClipRect(accumulatedOffset) : overflowClipRect(accumulatedOffset, paintInfo.renderRegion));
1409
    paintInfo.context->save();
1408
    paintInfo.context->save();
1410
    if (style()->hasBorderRadius())
1409
    if (style()->hasBorderRadius())
1411
        paintInfo.context->clipRoundedRect(style()->getRoundedInnerBorderFor(LayoutRect(accumulatedOffset, size())));
1410
        paintInfo.context->clipRoundedRect(style()->getRoundedInnerBorderFor(LayoutRect(accumulatedOffset, size()), this));
1412
    paintInfo.context->clip(clipRect);
1411
    paintInfo.context->clip(clipRect);
1413
    return true;
1412
    return true;
1414
}
1413
}
Lines 1448-1457 LayoutRect RenderBox::clipRect(const LayoutPoint& location, RenderRegion* region a/Source/WebCore/rendering/RenderBox.cpp_sec4
1448
{
1447
{
1449
    LayoutRect borderBoxRect = borderBoxRectInRegion(region);
1448
    LayoutRect borderBoxRect = borderBoxRectInRegion(region);
1450
    LayoutRect clipRect = LayoutRect(borderBoxRect.location() + location, borderBoxRect.size());
1449
    LayoutRect clipRect = LayoutRect(borderBoxRect.location() + location, borderBoxRect.size());
1451
    RenderView* renderView = view();
1452
1450
1453
    if (!style()->clipLeft().isAuto()) {
1451
    if (!style()->clipLeft().isAuto()) {
1454
        LayoutUnit c = valueForLength(style()->clipLeft(), borderBoxRect.width(), renderView);
1452
        LayoutUnit c = valueForLength(style()->clipLeft(), borderBoxRect.width());
1455
        clipRect.move(c, 0);
1453
        clipRect.move(c, 0);
1456
        clipRect.contract(c, 0);
1454
        clipRect.contract(c, 0);
1457
    }
1455
    }
Lines 1460-1475 LayoutRect RenderBox::clipRect(const LayoutPoint& location, RenderRegion* region a/Source/WebCore/rendering/RenderBox.cpp_sec5
1460
    // from the left and top edges. Therefore it's better to avoid constraining to smaller widths and heights.
1458
    // from the left and top edges. Therefore it's better to avoid constraining to smaller widths and heights.
1461
1459
1462
    if (!style()->clipRight().isAuto())
1460
    if (!style()->clipRight().isAuto())
1463
        clipRect.contract(width() - valueForLength(style()->clipRight(), width(), renderView), 0);
1461
        clipRect.contract(width() - valueForLength(style()->clipRight(), width()), 0);
1464
1462
1465
    if (!style()->clipTop().isAuto()) {
1463
    if (!style()->clipTop().isAuto()) {
1466
        LayoutUnit c = valueForLength(style()->clipTop(), borderBoxRect.height(), renderView);
1464
        LayoutUnit c = valueForLength(style()->clipTop(), borderBoxRect.height());
1467
        clipRect.move(0, c);
1465
        clipRect.move(0, c);
1468
        clipRect.contract(0, c);
1466
        clipRect.contract(0, c);
1469
    }
1467
    }
1470
1468
1471
    if (!style()->clipBottom().isAuto())
1469
    if (!style()->clipBottom().isAuto())
1472
        clipRect.contract(0, height() - valueForLength(style()->clipBottom(), height(), renderView));
1470
        clipRect.contract(0, height() - valueForLength(style()->clipBottom(), height()));
1473
1471
1474
    return clipRect;
1472
    return clipRect;
1475
}
1473
}
Lines 1994-2002 void RenderBox::computeLogicalWidthInRegion(LogicalExtentComputedValues& compute a/Source/WebCore/rendering/RenderBox.cpp_sec6
1994
    
1992
    
1995
    if (isInline() && !isInlineBlockOrInlineTable()) {
1993
    if (isInline() && !isInlineBlockOrInlineTable()) {
1996
        // just calculate margins
1994
        // just calculate margins
1997
        RenderView* renderView = view();
1995
        computedValues.m_margins.m_start = minimumValueForLength(styleToUse->marginStart(), containerLogicalWidth);
1998
        computedValues.m_margins.m_start = minimumValueForLength(styleToUse->marginStart(), containerLogicalWidth, renderView);
1996
        computedValues.m_margins.m_end = minimumValueForLength(styleToUse->marginEnd(), containerLogicalWidth);
1999
        computedValues.m_margins.m_end = minimumValueForLength(styleToUse->marginEnd(), containerLogicalWidth, renderView);
2000
        if (treatAsReplaced)
1997
        if (treatAsReplaced)
2001
            computedValues.m_extent = max<LayoutUnit>(floatValueForLength(logicalWidthLength, 0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth());
1998
            computedValues.m_extent = max<LayoutUnit>(floatValueForLength(logicalWidthLength, 0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth());
2002
        return;
1999
        return;
Lines 2015-2023 void RenderBox::computeLogicalWidthInRegion(LogicalExtentComputedValues& compute a/Source/WebCore/rendering/RenderBox.cpp_sec7
2015
2012
2016
    // Margin calculations.
2013
    // Margin calculations.
2017
    if (hasPerpendicularContainingBlock || isFloating() || isInline()) {
2014
    if (hasPerpendicularContainingBlock || isFloating() || isInline()) {
2018
        RenderView* renderView = view();
2015
        computedValues.m_margins.m_start = minimumValueForLength(styleToUse->marginStart(), containerLogicalWidth);
2019
        computedValues.m_margins.m_start = minimumValueForLength(styleToUse->marginStart(), containerLogicalWidth, renderView);
2016
        computedValues.m_margins.m_end = minimumValueForLength(styleToUse->marginEnd(), containerLogicalWidth);
2020
        computedValues.m_margins.m_end = minimumValueForLength(styleToUse->marginEnd(), containerLogicalWidth, renderView);
2021
    } else {
2017
    } else {
2022
        LayoutUnit containerLogicalWidthForAutoMargins = containerLogicalWidth;
2018
        LayoutUnit containerLogicalWidthForAutoMargins = containerLogicalWidth;
2023
        if (avoidsFloats() && cb->containsFloats())
2019
        if (avoidsFloats() && cb->containsFloats())
Lines 2048-2056 LayoutUnit RenderBox::fillAvailableMeasure(LayoutUnit availableLogicalWidth) con a/Source/WebCore/rendering/RenderBox.cpp_sec8
2048
2044
2049
LayoutUnit RenderBox::fillAvailableMeasure(LayoutUnit availableLogicalWidth, LayoutUnit& marginStart, LayoutUnit& marginEnd) const
2045
LayoutUnit RenderBox::fillAvailableMeasure(LayoutUnit availableLogicalWidth, LayoutUnit& marginStart, LayoutUnit& marginEnd) const
2050
{
2046
{
2051
    RenderView* renderView = view();
2047
    marginStart = minimumValueForLength(style()->marginStart(), availableLogicalWidth);
2052
    marginStart = minimumValueForLength(style()->marginStart(), availableLogicalWidth, renderView);
2048
    marginEnd = minimumValueForLength(style()->marginEnd(), availableLogicalWidth);
2053
    marginEnd = minimumValueForLength(style()->marginEnd(), availableLogicalWidth, renderView);
2054
    return availableLogicalWidth - marginStart - marginEnd;
2049
    return availableLogicalWidth - marginStart - marginEnd;
2055
}
2050
}
2056
2051
Lines 2100-2106 LayoutUnit RenderBox::computeLogicalWidthInRegionUsing(SizeType widthType, Layou a/Source/WebCore/rendering/RenderBox.cpp_sec9
2100
    
2095
    
2101
    if (!logicalWidth.isIntrinsicOrAuto()) {
2096
    if (!logicalWidth.isIntrinsicOrAuto()) {
2102
        // FIXME: If the containing block flow is perpendicular to our direction we need to use the available logical height instead.
2097
        // FIXME: If the containing block flow is perpendicular to our direction we need to use the available logical height instead.
2103
        return adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(logicalWidth, availableLogicalWidth, view()));
2098
        return adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(logicalWidth, availableLogicalWidth));
2104
    }
2099
    }
2105
2100
2106
    if (logicalWidth.isIntrinsic())
2101
    if (logicalWidth.isIntrinsic())
Lines 2196-2207 void RenderBox::computeInlineDirectionMargins(RenderBlock* containingBlock, Layo a/Source/WebCore/rendering/RenderBox.cpp_sec10
2196
    const RenderStyle* containingBlockStyle = containingBlock->style();
2191
    const RenderStyle* containingBlockStyle = containingBlock->style();
2197
    Length marginStartLength = style()->marginStartUsing(containingBlockStyle);
2192
    Length marginStartLength = style()->marginStartUsing(containingBlockStyle);
2198
    Length marginEndLength = style()->marginEndUsing(containingBlockStyle);
2193
    Length marginEndLength = style()->marginEndUsing(containingBlockStyle);
2199
    RenderView* renderView = view();
2200
2194
2201
    if (isFloating() || isInline()) {
2195
    if (isFloating() || isInline()) {
2202
        // Inline blocks/tables and floats don't have their margins increased.
2196
        // Inline blocks/tables and floats don't have their margins increased.
2203
        marginStart = minimumValueForLength(marginStartLength, containerWidth, renderView);
2197
        marginStart = minimumValueForLength(marginStartLength, containerWidth);
2204
        marginEnd = minimumValueForLength(marginEndLength, containerWidth, renderView);
2198
        marginEnd = minimumValueForLength(marginEndLength, containerWidth);
2205
        return;
2199
        return;
2206
    }
2200
    }
2207
2201
Lines 2209-2216 void RenderBox::computeInlineDirectionMargins(RenderBlock* containingBlock, Layo a/Source/WebCore/rendering/RenderBox.cpp_sec11
2209
    if ((marginStartLength.isAuto() && marginEndLength.isAuto() && childWidth < containerWidth)
2203
    if ((marginStartLength.isAuto() && marginEndLength.isAuto() && childWidth < containerWidth)
2210
        || (!marginStartLength.isAuto() && !marginEndLength.isAuto() && containingBlock->style()->textAlign() == WEBKIT_CENTER)) {
2204
        || (!marginStartLength.isAuto() && !marginEndLength.isAuto() && containingBlock->style()->textAlign() == WEBKIT_CENTER)) {
2211
        // Other browsers center the margin box for align=center elements so we match them here.
2205
        // Other browsers center the margin box for align=center elements so we match them here.
2212
        LayoutUnit marginStartWidth = minimumValueForLength(marginStartLength, containerWidth, renderView);
2206
        LayoutUnit marginStartWidth = minimumValueForLength(marginStartLength, containerWidth);
2213
        LayoutUnit marginEndWidth = minimumValueForLength(marginEndLength, containerWidth, renderView);
2207
        LayoutUnit marginEndWidth = minimumValueForLength(marginEndLength, containerWidth);
2214
        LayoutUnit centeredMarginBoxStart = max<LayoutUnit>(0, (containerWidth - childWidth - marginStartWidth - marginEndWidth) / 2);
2208
        LayoutUnit centeredMarginBoxStart = max<LayoutUnit>(0, (containerWidth - childWidth - marginStartWidth - marginEndWidth) / 2);
2215
        marginStart = centeredMarginBoxStart + marginStartWidth;
2209
        marginStart = centeredMarginBoxStart + marginStartWidth;
2216
        marginEnd = containerWidth - childWidth - marginStart + marginEndWidth;
2210
        marginEnd = containerWidth - childWidth - marginStart + marginEndWidth;
Lines 2219-2225 void RenderBox::computeInlineDirectionMargins(RenderBlock* containingBlock, Layo a/Source/WebCore/rendering/RenderBox.cpp_sec12
2219
    
2213
    
2220
    // Case Two: The object is being pushed to the start of the containing block's available logical width.
2214
    // Case Two: The object is being pushed to the start of the containing block's available logical width.
2221
    if (marginEndLength.isAuto() && childWidth < containerWidth) {
2215
    if (marginEndLength.isAuto() && childWidth < containerWidth) {
2222
        marginStart = valueForLength(marginStartLength, containerWidth, renderView);
2216
        marginStart = valueForLength(marginStartLength, containerWidth);
2223
        marginEnd = containerWidth - childWidth - marginStart;
2217
        marginEnd = containerWidth - childWidth - marginStart;
2224
        return;
2218
        return;
2225
    } 
2219
    } 
Lines 2228-2242 void RenderBox::computeInlineDirectionMargins(RenderBlock* containingBlock, Layo a/Source/WebCore/rendering/RenderBox.cpp_sec13
2228
    bool pushToEndFromTextAlign = !marginEndLength.isAuto() && ((!containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_LEFT)
2222
    bool pushToEndFromTextAlign = !marginEndLength.isAuto() && ((!containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_LEFT)
2229
        || (containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_RIGHT));
2223
        || (containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_RIGHT));
2230
    if ((marginStartLength.isAuto() && childWidth < containerWidth) || pushToEndFromTextAlign) {
2224
    if ((marginStartLength.isAuto() && childWidth < containerWidth) || pushToEndFromTextAlign) {
2231
        marginEnd = valueForLength(marginEndLength, containerWidth, renderView);
2225
        marginEnd = valueForLength(marginEndLength, containerWidth);
2232
        marginStart = containerWidth - childWidth - marginEnd;
2226
        marginStart = containerWidth - childWidth - marginEnd;
2233
        return;
2227
        return;
2234
    } 
2228
    } 
2235
    
2229
    
2236
    // Case Four: Either no auto margins, or our width is >= the container width (css2.1, 10.3.3).  In that case
2230
    // Case Four: Either no auto margins, or our width is >= the container width (css2.1, 10.3.3).  In that case
2237
    // auto margins will just turn into 0.
2231
    // auto margins will just turn into 0.
2238
    marginStart = minimumValueForLength(marginStartLength, containerWidth, renderView);
2232
    marginStart = minimumValueForLength(marginStartLength, containerWidth);
2239
    marginEnd = minimumValueForLength(marginEndLength, containerWidth, renderView);
2233
    marginEnd = minimumValueForLength(marginEndLength, containerWidth);
2240
}
2234
}
2241
2235
2242
RenderBoxRegionInfo* RenderBox::renderBoxRegionInfo(RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, RenderBoxRegionInfoFlags cacheFlag) const
2236
RenderBoxRegionInfo* RenderBox::renderBoxRegionInfo(RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, RenderBoxRegionInfoFlags cacheFlag) const
Lines 2479-2485 LayoutUnit RenderBox::computeContentAndScrollbarLogicalHeightUsing(SizeType heig a/Source/WebCore/rendering/RenderBox.cpp_sec14
2479
    if (height.isPercent())
2473
    if (height.isPercent())
2480
        return computePercentageLogicalHeight(height);
2474
        return computePercentageLogicalHeight(height);
2481
    if (height.isViewportPercentage())
2475
    if (height.isViewportPercentage())
2482
        return valueForLength(height, 0, view());
2476
        return valueForLength(height, 0);
2483
    return -1;
2477
    return -1;
2484
}
2478
}
2485
2479
Lines 2615-2621 LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(SizeType sizeType, Length a/Source/WebCore/rendering/RenderBox.cpp_sec15
2615
        case ViewportPercentageHeight:
2609
        case ViewportPercentageHeight:
2616
        case ViewportPercentageMin:
2610
        case ViewportPercentageMin:
2617
        case ViewportPercentageMax:
2611
        case ViewportPercentageMax:
2618
            return adjustContentBoxLogicalWidthForBoxSizing(valueForLength(logicalWidth, 0, view()));
2612
            return adjustContentBoxLogicalWidthForBoxSizing(valueForLength(logicalWidth, 0));
2619
        case FitContent:
2613
        case FitContent:
2620
        case FillAvailable:
2614
        case FillAvailable:
2621
        case Percent: 
2615
        case Percent: 
Lines 2716-2722 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(SizeType sizeType, Lengt a/Source/WebCore/rendering/RenderBox.cpp_sec16
2716
        case ViewportPercentageHeight:
2710
        case ViewportPercentageHeight:
2717
        case ViewportPercentageMin:
2711
        case ViewportPercentageMin:
2718
        case ViewportPercentageMax:
2712
        case ViewportPercentageMax:
2719
            return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeight, 0, view()));
2713
            return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeight, 0));
2720
        default:
2714
        default:
2721
            return intrinsicLogicalHeight();
2715
            return intrinsicLogicalHeight();
2722
    }
2716
    }
Lines 2783-2792 void RenderBox::computeBlockDirectionMargins(const RenderBlock* containingBlock, a/Source/WebCore/rendering/RenderBox.cpp_sec17
2783
    // Margins are calculated with respect to the logical width of
2777
    // Margins are calculated with respect to the logical width of
2784
    // the containing block (8.3)
2778
    // the containing block (8.3)
2785
    LayoutUnit cw = containingBlockLogicalWidthForContent();
2779
    LayoutUnit cw = containingBlockLogicalWidthForContent();
2786
    RenderView* renderView = view();
2787
    RenderStyle* containingBlockStyle = containingBlock->style();
2780
    RenderStyle* containingBlockStyle = containingBlock->style();
2788
    marginBefore = minimumValueForLength(style()->marginBeforeUsing(containingBlockStyle), cw, renderView);
2781
    marginBefore = minimumValueForLength(style()->marginBeforeUsing(containingBlockStyle), cw);
2789
    marginAfter = minimumValueForLength(style()->marginAfterUsing(containingBlockStyle), cw, renderView);
2782
    marginAfter = minimumValueForLength(style()->marginAfterUsing(containingBlockStyle), cw);
2790
}
2783
}
2791
2784
2792
void RenderBox::computeAndSetBlockDirectionMargins(const RenderBlock* containingBlock)
2785
void RenderBox::computeAndSetBlockDirectionMargins(const RenderBlock* containingBlock)
Lines 3112-3118 void RenderBox::computePositionedLogicalWidthUsing(SizeType widthSizeType, Lengt a/Source/WebCore/rendering/RenderBox.cpp_sec18
3112
    bool logicalWidthIsAuto = logicalWidth.isIntrinsicOrAuto();
3105
    bool logicalWidthIsAuto = logicalWidth.isIntrinsicOrAuto();
3113
    bool logicalLeftIsAuto = logicalLeft.isAuto();
3106
    bool logicalLeftIsAuto = logicalLeft.isAuto();
3114
    bool logicalRightIsAuto = logicalRight.isAuto();
3107
    bool logicalRightIsAuto = logicalRight.isAuto();
3115
    RenderView* renderView = view();
3116
    LayoutUnit& marginLogicalLeftValue = style()->isLeftToRightDirection() ? computedValues.m_margins.m_start : computedValues.m_margins.m_end;
3108
    LayoutUnit& marginLogicalLeftValue = style()->isLeftToRightDirection() ? computedValues.m_margins.m_start : computedValues.m_margins.m_end;
3117
    LayoutUnit& marginLogicalRightValue = style()->isLeftToRightDirection() ? computedValues.m_margins.m_end : computedValues.m_margins.m_start;
3109
    LayoutUnit& marginLogicalRightValue = style()->isLeftToRightDirection() ? computedValues.m_margins.m_end : computedValues.m_margins.m_start;
3118
3110
Lines 3132-3141 void RenderBox::computePositionedLogicalWidthUsing(SizeType widthSizeType, Lengt a/Source/WebCore/rendering/RenderBox.cpp_sec19
3132
        // NOTE:  It is not necessary to solve for 'right' in the over constrained
3124
        // NOTE:  It is not necessary to solve for 'right' in the over constrained
3133
        // case because the value is not used for any further calculations.
3125
        // case because the value is not used for any further calculations.
3134
3126
3135
        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
3127
        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
3136
        computedValues.m_extent = adjustContentBoxLogicalWidthForBoxSizing(valueForLength(logicalWidth, containerLogicalWidth, renderView));
3128
        computedValues.m_extent = adjustContentBoxLogicalWidthForBoxSizing(valueForLength(logicalWidth, containerLogicalWidth));
3137
3129
3138
        const LayoutUnit availableSpace = containerLogicalWidth - (logicalLeftValue + computedValues.m_extent + valueForLength(logicalRight, containerLogicalWidth, renderView) + bordersPlusPadding);
3130
        const LayoutUnit availableSpace = containerLogicalWidth - (logicalLeftValue + computedValues.m_extent + valueForLength(logicalRight, containerLogicalWidth) + bordersPlusPadding);
3139
3131
3140
        // Margins are now the only unknown
3132
        // Margins are now the only unknown
3141
        if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) {
3133
        if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) {
Lines 3156-3171 void RenderBox::computePositionedLogicalWidthUsing(SizeType widthSizeType, Lengt a/Source/WebCore/rendering/RenderBox.cpp_sec20
3156
            }
3148
            }
3157
        } else if (marginLogicalLeft.isAuto()) {
3149
        } else if (marginLogicalLeft.isAuto()) {
3158
            // Solve for left margin
3150
            // Solve for left margin
3159
            marginLogicalRightValue = valueForLength(marginLogicalRight, containerRelativeLogicalWidth, renderView);
3151
            marginLogicalRightValue = valueForLength(marginLogicalRight, containerRelativeLogicalWidth);
3160
            marginLogicalLeftValue = availableSpace - marginLogicalRightValue;
3152
            marginLogicalLeftValue = availableSpace - marginLogicalRightValue;
3161
        } else if (marginLogicalRight.isAuto()) {
3153
        } else if (marginLogicalRight.isAuto()) {
3162
            // Solve for right margin
3154
            // Solve for right margin
3163
            marginLogicalLeftValue = valueForLength(marginLogicalLeft, containerRelativeLogicalWidth, renderView);
3155
            marginLogicalLeftValue = valueForLength(marginLogicalLeft, containerRelativeLogicalWidth);
3164
            marginLogicalRightValue = availableSpace - marginLogicalLeftValue;
3156
            marginLogicalRightValue = availableSpace - marginLogicalLeftValue;
3165
        } else {
3157
        } else {
3166
            // Over-constrained, solve for left if direction is RTL
3158
            // Over-constrained, solve for left if direction is RTL
3167
            marginLogicalLeftValue = valueForLength(marginLogicalLeft, containerRelativeLogicalWidth, renderView);
3159
            marginLogicalLeftValue = valueForLength(marginLogicalLeft, containerRelativeLogicalWidth);
3168
            marginLogicalRightValue = valueForLength(marginLogicalRight, containerRelativeLogicalWidth, renderView);
3160
            marginLogicalRightValue = valueForLength(marginLogicalRight, containerRelativeLogicalWidth);
3169
3161
3170
            // Use the containing block's direction rather than the parent block's
3162
            // Use the containing block's direction rather than the parent block's
3171
            // per CSS 2.1 reference test abspos-non-replaced-width-margin-000.
3163
            // per CSS 2.1 reference test abspos-non-replaced-width-margin-000.
Lines 3215-3222 void RenderBox::computePositionedLogicalWidthUsing(SizeType widthSizeType, Lengt a/Source/WebCore/rendering/RenderBox.cpp_sec21
3215
        // because the value is not used for any further calculations.
3207
        // because the value is not used for any further calculations.
3216
3208
3217
        // Calculate margins, 'auto' margins are ignored.
3209
        // Calculate margins, 'auto' margins are ignored.
3218
        marginLogicalLeftValue = minimumValueForLength(marginLogicalLeft, containerRelativeLogicalWidth, renderView);
3210
        marginLogicalLeftValue = minimumValueForLength(marginLogicalLeft, containerRelativeLogicalWidth);
3219
        marginLogicalRightValue = minimumValueForLength(marginLogicalRight, containerRelativeLogicalWidth, renderView);
3211
        marginLogicalRightValue = minimumValueForLength(marginLogicalRight, containerRelativeLogicalWidth);
3220
3212
3221
        const LayoutUnit availableSpace = containerLogicalWidth - (marginLogicalLeftValue + marginLogicalRightValue + bordersPlusPadding);
3213
        const LayoutUnit availableSpace = containerLogicalWidth - (marginLogicalLeftValue + marginLogicalRightValue + bordersPlusPadding);
3222
3214
Lines 3224-3230 void RenderBox::computePositionedLogicalWidthUsing(SizeType widthSizeType, Lengt a/Source/WebCore/rendering/RenderBox.cpp_sec22
3224
        // Use rule/case that applies.
3216
        // Use rule/case that applies.
3225
        if (logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) {
3217
        if (logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) {
3226
            // RULE 1: (use shrink-to-fit for width, and solve of left)
3218
            // RULE 1: (use shrink-to-fit for width, and solve of left)
3227
            LayoutUnit logicalRightValue = valueForLength(logicalRight, containerLogicalWidth, renderView);
3219
            LayoutUnit logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
3228
3220
3229
            // FIXME: would it be better to have shrink-to-fit in one step?
3221
            // FIXME: would it be better to have shrink-to-fit in one step?
3230
            LayoutUnit preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding;
3222
            LayoutUnit preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding;
Lines 3234-3240 void RenderBox::computePositionedLogicalWidthUsing(SizeType widthSizeType, Lengt a/Source/WebCore/rendering/RenderBox.cpp_sec23
3234
            logicalLeftValue = availableSpace - (computedValues.m_extent + logicalRightValue);
3226
            logicalLeftValue = availableSpace - (computedValues.m_extent + logicalRightValue);
3235
        } else if (!logicalLeftIsAuto && logicalWidthIsAuto && logicalRightIsAuto) {
3227
        } else if (!logicalLeftIsAuto && logicalWidthIsAuto && logicalRightIsAuto) {
3236
            // RULE 3: (use shrink-to-fit for width, and no need solve of right)
3228
            // RULE 3: (use shrink-to-fit for width, and no need solve of right)
3237
            logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
3229
            logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
3238
3230
3239
            // FIXME: would it be better to have shrink-to-fit in one step?
3231
            // FIXME: would it be better to have shrink-to-fit in one step?
3240
            LayoutUnit preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding;
3232
            LayoutUnit preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding;
Lines 3243-3258 void RenderBox::computePositionedLogicalWidthUsing(SizeType widthSizeType, Lengt a/Source/WebCore/rendering/RenderBox.cpp_sec24
3243
            computedValues.m_extent = min(max(preferredMinWidth, availableWidth), preferredWidth);
3235
            computedValues.m_extent = min(max(preferredMinWidth, availableWidth), preferredWidth);
3244
        } else if (logicalLeftIsAuto && !logicalWidthIsAuto && !logicalRightIsAuto) {
3236
        } else if (logicalLeftIsAuto && !logicalWidthIsAuto && !logicalRightIsAuto) {
3245
            // RULE 4: (solve for left)
3237
            // RULE 4: (solve for left)
3246
            computedValues.m_extent = adjustContentBoxLogicalWidthForBoxSizing(valueForLength(logicalWidth, containerLogicalWidth, renderView));
3238
            computedValues.m_extent = adjustContentBoxLogicalWidthForBoxSizing(valueForLength(logicalWidth, containerLogicalWidth));
3247
            logicalLeftValue = availableSpace - (computedValues.m_extent + valueForLength(logicalRight, containerLogicalWidth, renderView));
3239
            logicalLeftValue = availableSpace - (computedValues.m_extent + valueForLength(logicalRight, containerLogicalWidth));
3248
        } else if (!logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) {
3240
        } else if (!logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) {
3249
            // RULE 5: (solve for width)
3241
            // RULE 5: (solve for width)
3250
            logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
3242
            logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
3251
            computedValues.m_extent = availableSpace - (logicalLeftValue + valueForLength(logicalRight, containerLogicalWidth, renderView));
3243
            computedValues.m_extent = availableSpace - (logicalLeftValue + valueForLength(logicalRight, containerLogicalWidth));
3252
        } else if (!logicalLeftIsAuto && !logicalWidthIsAuto && logicalRightIsAuto) {
3244
        } else if (!logicalLeftIsAuto && !logicalWidthIsAuto && logicalRightIsAuto) {
3253
            // RULE 6: (no need solve for right)
3245
            // RULE 6: (no need solve for right)
3254
            logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
3246
            logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
3255
            computedValues.m_extent = adjustContentBoxLogicalWidthForBoxSizing(valueForLength(logicalWidth, containerLogicalWidth, renderView));
3247
            computedValues.m_extent = adjustContentBoxLogicalWidthForBoxSizing(valueForLength(logicalWidth, containerLogicalWidth));
3256
        }
3248
        }
3257
    }
3249
    }
3258
3250
Lines 3445-3451 void RenderBox::computePositionedLogicalHeightUsing(SizeType heightSizeType, Len a/Source/WebCore/rendering/RenderBox.cpp_sec25
3445
    bool logicalHeightIsAuto = logicalHeightLength.isAuto();
3437
    bool logicalHeightIsAuto = logicalHeightLength.isAuto();
3446
    bool logicalTopIsAuto = logicalTop.isAuto();
3438
    bool logicalTopIsAuto = logicalTop.isAuto();
3447
    bool logicalBottomIsAuto = logicalBottom.isAuto();
3439
    bool logicalBottomIsAuto = logicalBottom.isAuto();
3448
    RenderView* renderView = view();
3449
3440
3450
    // Height is never unsolved for tables.
3441
    // Height is never unsolved for tables.
3451
    if (isTable()) {
3442
    if (isTable()) {
Lines 3465-3474 void RenderBox::computePositionedLogicalHeightUsing(SizeType heightSizeType, Len a/Source/WebCore/rendering/RenderBox.cpp_sec26
3465
        // NOTE:  It is not necessary to solve for 'bottom' in the over constrained
3456
        // NOTE:  It is not necessary to solve for 'bottom' in the over constrained
3466
        // case because the value is not used for any further calculations.
3457
        // case because the value is not used for any further calculations.
3467
3458
3468
        logicalHeightValue = adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeightLength, containerLogicalHeight, renderView));
3459
        logicalHeightValue = adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeightLength, containerLogicalHeight));
3469
        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
3460
        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
3470
3461
3471
        const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopValue + logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight, renderView) + bordersPlusPadding);
3462
        const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopValue + logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight) + bordersPlusPadding);
3472
3463
3473
        // Margins are now the only unknown
3464
        // Margins are now the only unknown
3474
        if (marginBefore.isAuto() && marginAfter.isAuto()) {
3465
        if (marginBefore.isAuto() && marginAfter.isAuto()) {
Lines 3478-3493 void RenderBox::computePositionedLogicalHeightUsing(SizeType heightSizeType, Len a/Source/WebCore/rendering/RenderBox.cpp_sec27
3478
            computedValues.m_margins.m_after = availableSpace - computedValues.m_margins.m_before; // account for odd valued differences
3469
            computedValues.m_margins.m_after = availableSpace - computedValues.m_margins.m_before; // account for odd valued differences
3479
        } else if (marginBefore.isAuto()) {
3470
        } else if (marginBefore.isAuto()) {
3480
            // Solve for top margin
3471
            // Solve for top margin
3481
            computedValues.m_margins.m_after = valueForLength(marginAfter, containerRelativeLogicalWidth, renderView);
3472
            computedValues.m_margins.m_after = valueForLength(marginAfter, containerRelativeLogicalWidth);
3482
            computedValues.m_margins.m_before = availableSpace - computedValues.m_margins.m_after;
3473
            computedValues.m_margins.m_before = availableSpace - computedValues.m_margins.m_after;
3483
        } else if (marginAfter.isAuto()) {
3474
        } else if (marginAfter.isAuto()) {
3484
            // Solve for bottom margin
3475
            // Solve for bottom margin
3485
            computedValues.m_margins.m_before = valueForLength(marginBefore, containerRelativeLogicalWidth, renderView);
3476
            computedValues.m_margins.m_before = valueForLength(marginBefore, containerRelativeLogicalWidth);
3486
            computedValues.m_margins.m_after = availableSpace - computedValues.m_margins.m_before;
3477
            computedValues.m_margins.m_after = availableSpace - computedValues.m_margins.m_before;
3487
        } else {
3478
        } else {
3488
            // Over-constrained, (no need solve for bottom)
3479
            // Over-constrained, (no need solve for bottom)
3489
            computedValues.m_margins.m_before = valueForLength(marginBefore, containerRelativeLogicalWidth, renderView);
3480
            computedValues.m_margins.m_before = valueForLength(marginBefore, containerRelativeLogicalWidth);
3490
            computedValues.m_margins.m_after = valueForLength(marginAfter, containerRelativeLogicalWidth, renderView);
3481
            computedValues.m_margins.m_after = valueForLength(marginAfter, containerRelativeLogicalWidth);
3491
        }
3482
        }
3492
    } else {
3483
    } else {
3493
        /*--------------------------------------------------------------------*\
3484
        /*--------------------------------------------------------------------*\
Lines 3516-3523 void RenderBox::computePositionedLogicalHeightUsing(SizeType heightSizeType, Len a/Source/WebCore/rendering/RenderBox.cpp_sec28
3516
        // because the value is not used for any further calculations.
3507
        // because the value is not used for any further calculations.
3517
3508
3518
        // Calculate margins, 'auto' margins are ignored.
3509
        // Calculate margins, 'auto' margins are ignored.
3519
        computedValues.m_margins.m_before = minimumValueForLength(marginBefore, containerRelativeLogicalWidth, renderView);
3510
        computedValues.m_margins.m_before = minimumValueForLength(marginBefore, containerRelativeLogicalWidth);
3520
        computedValues.m_margins.m_after = minimumValueForLength(marginAfter, containerRelativeLogicalWidth, renderView);
3511
        computedValues.m_margins.m_after = minimumValueForLength(marginAfter, containerRelativeLogicalWidth);
3521
3512
3522
        const LayoutUnit availableSpace = containerLogicalHeight - (computedValues.m_margins.m_before + computedValues.m_margins.m_after + bordersPlusPadding);
3513
        const LayoutUnit availableSpace = containerLogicalHeight - (computedValues.m_margins.m_before + computedValues.m_margins.m_after + bordersPlusPadding);
3523
3514
Lines 3525-3547 void RenderBox::computePositionedLogicalHeightUsing(SizeType heightSizeType, Len a/Source/WebCore/rendering/RenderBox.cpp_sec29
3525
        if (logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) {
3516
        if (logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) {
3526
            // RULE 1: (height is content based, solve of top)
3517
            // RULE 1: (height is content based, solve of top)
3527
            logicalHeightValue = contentLogicalHeight;
3518
            logicalHeightValue = contentLogicalHeight;
3528
            logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight, renderView));
3519
            logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight));
3529
        } else if (!logicalTopIsAuto && logicalHeightIsAuto && logicalBottomIsAuto) {
3520
        } else if (!logicalTopIsAuto && logicalHeightIsAuto && logicalBottomIsAuto) {
3530
            // RULE 3: (height is content based, no need solve of bottom)
3521
            // RULE 3: (height is content based, no need solve of bottom)
3531
            logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
3522
            logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
3532
            logicalHeightValue = contentLogicalHeight;
3523
            logicalHeightValue = contentLogicalHeight;
3533
        } else if (logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsAuto) {
3524
        } else if (logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsAuto) {
3534
            // RULE 4: (solve of top)
3525
            // RULE 4: (solve of top)
3535
            logicalHeightValue = adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeightLength, containerLogicalHeight, renderView));
3526
            logicalHeightValue = adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeightLength, containerLogicalHeight));
3536
            logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight, renderView));
3527
            logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight));
3537
        } else if (!logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) {
3528
        } else if (!logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) {
3538
            // RULE 5: (solve of height)
3529
            // RULE 5: (solve of height)
3539
            logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
3530
            logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
3540
            logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTopValue + valueForLength(logicalBottom, containerLogicalHeight, renderView)));
3531
            logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTopValue + valueForLength(logicalBottom, containerLogicalHeight)));
3541
        } else if (!logicalTopIsAuto && !logicalHeightIsAuto && logicalBottomIsAuto) {
3532
        } else if (!logicalTopIsAuto && !logicalHeightIsAuto && logicalBottomIsAuto) {
3542
            // RULE 6: (no need solve of bottom)
3533
            // RULE 6: (no need solve of bottom)
3543
            logicalHeightValue = adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeightLength, containerLogicalHeight, renderView));
3534
            logicalHeightValue = adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeightLength, containerLogicalHeight));
3544
            logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
3535
            logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
3545
        }
3536
        }
3546
    }
3537
    }
3547
    computedValues.m_extent = logicalHeightValue;
3538
    computedValues.m_extent = logicalHeightValue;
Lines 3619-3632 void RenderBox::computePositionedLogicalWidthReplaced(LogicalExtentComputedValue a/Source/WebCore/rendering/RenderBox.cpp_sec30
3619
    \*-----------------------------------------------------------------------*/
3610
    \*-----------------------------------------------------------------------*/
3620
    LayoutUnit logicalLeftValue = 0;
3611
    LayoutUnit logicalLeftValue = 0;
3621
    LayoutUnit logicalRightValue = 0;
3612
    LayoutUnit logicalRightValue = 0;
3622
    RenderView* renderView = view();
3623
3613
3624
    if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) {
3614
    if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) {
3625
        // 'left' and 'right' cannot be 'auto' due to step 3
3615
        // 'left' and 'right' cannot be 'auto' due to step 3
3626
        ASSERT(!(logicalLeft.isAuto() && logicalRight.isAuto()));
3616
        ASSERT(!(logicalLeft.isAuto() && logicalRight.isAuto()));
3627
3617
3628
        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
3618
        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
3629
        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth, renderView);
3619
        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
3630
3620
3631
        LayoutUnit difference = availableSpace - (logicalLeftValue + logicalRightValue);
3621
        LayoutUnit difference = availableSpace - (logicalLeftValue + logicalRightValue);
3632
        if (difference > 0) {
3622
        if (difference > 0) {
Lines 3649-3687 void RenderBox::computePositionedLogicalWidthReplaced(LogicalExtentComputedValue a/Source/WebCore/rendering/RenderBox.cpp_sec31
3649
     *    that value.
3639
     *    that value.
3650
    \*-----------------------------------------------------------------------*/
3640
    \*-----------------------------------------------------------------------*/
3651
    } else if (logicalLeft.isAuto()) {
3641
    } else if (logicalLeft.isAuto()) {
3652
        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerRelativeLogicalWidth, renderView);
3642
        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerRelativeLogicalWidth);
3653
        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerRelativeLogicalWidth, renderView);
3643
        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerRelativeLogicalWidth);
3654
        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth, renderView);
3644
        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
3655
3645
3656
        // Solve for 'left'
3646
        // Solve for 'left'
3657
        logicalLeftValue = availableSpace - (logicalRightValue + marginLogicalLeftAlias + marginLogicalRightAlias);
3647
        logicalLeftValue = availableSpace - (logicalRightValue + marginLogicalLeftAlias + marginLogicalRightAlias);
3658
    } else if (logicalRight.isAuto()) {
3648
    } else if (logicalRight.isAuto()) {
3659
        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerRelativeLogicalWidth, renderView);
3649
        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerRelativeLogicalWidth);
3660
        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerRelativeLogicalWidth, renderView);
3650
        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerRelativeLogicalWidth);
3661
        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
3651
        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
3662
3652
3663
        // Solve for 'right'
3653
        // Solve for 'right'
3664
        logicalRightValue = availableSpace - (logicalLeftValue + marginLogicalLeftAlias + marginLogicalRightAlias);
3654
        logicalRightValue = availableSpace - (logicalLeftValue + marginLogicalLeftAlias + marginLogicalRightAlias);
3665
    } else if (marginLogicalLeft.isAuto()) {
3655
    } else if (marginLogicalLeft.isAuto()) {
3666
        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerRelativeLogicalWidth, renderView);
3656
        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerRelativeLogicalWidth);
3667
        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
3657
        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
3668
        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth, renderView);
3658
        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
3669
3659
3670
        // Solve for 'margin-left'
3660
        // Solve for 'margin-left'
3671
        marginLogicalLeftAlias = availableSpace - (logicalLeftValue + logicalRightValue + marginLogicalRightAlias);
3661
        marginLogicalLeftAlias = availableSpace - (logicalLeftValue + logicalRightValue + marginLogicalRightAlias);
3672
    } else if (marginLogicalRight.isAuto()) {
3662
    } else if (marginLogicalRight.isAuto()) {
3673
        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerRelativeLogicalWidth, renderView);
3663
        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerRelativeLogicalWidth);
3674
        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
3664
        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
3675
        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth, renderView);
3665
        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
3676
3666
3677
        // Solve for 'margin-right'
3667
        // Solve for 'margin-right'
3678
        marginLogicalRightAlias = availableSpace - (logicalLeftValue + logicalRightValue + marginLogicalLeftAlias);
3668
        marginLogicalRightAlias = availableSpace - (logicalLeftValue + logicalRightValue + marginLogicalLeftAlias);
3679
    } else {
3669
    } else {
3680
        // Nothing is 'auto', just calculate the values.
3670
        // Nothing is 'auto', just calculate the values.
3681
        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerRelativeLogicalWidth, renderView);
3671
        marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerRelativeLogicalWidth);
3682
        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerRelativeLogicalWidth, renderView);
3672
        marginLogicalRightAlias = valueForLength(marginLogicalRight, containerRelativeLogicalWidth);
3683
        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth, renderView);
3673
        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
3684
        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth, renderView);
3674
        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
3685
        // If the containing block is right-to-left, then push the left position as far to the right as possible
3675
        // If the containing block is right-to-left, then push the left position as far to the right as possible
3686
        if (containerDirection == RTL) {
3676
        if (containerDirection == RTL) {
3687
            int totalLogicalWidth = computedValues.m_extent + logicalLeftValue + logicalRightValue +  marginLogicalLeftAlias + marginLogicalRightAlias;
3677
            int totalLogicalWidth = computedValues.m_extent + logicalLeftValue + logicalRightValue +  marginLogicalLeftAlias + marginLogicalRightAlias;
Lines 3743-3749 void RenderBox::computePositionedLogicalHeightReplaced(LogicalExtentComputedValu a/Source/WebCore/rendering/RenderBox.cpp_sec32
3743
3733
3744
    Length logicalTop = style()->logicalTop();
3734
    Length logicalTop = style()->logicalTop();
3745
    Length logicalBottom = style()->logicalBottom();
3735
    Length logicalBottom = style()->logicalBottom();
3746
    RenderView* renderView = view();
3747
3736
3748
    /*-----------------------------------------------------------------------*\
3737
    /*-----------------------------------------------------------------------*\
3749
     * 1. The used value of 'height' is determined as for inline replaced
3738
     * 1. The used value of 'height' is determined as for inline replaced
Lines 3787-3794 void RenderBox::computePositionedLogicalHeightReplaced(LogicalExtentComputedValu a/Source/WebCore/rendering/RenderBox.cpp_sec33
3787
        // 'top' and 'bottom' cannot be 'auto' due to step 2 and 3 combined.
3776
        // 'top' and 'bottom' cannot be 'auto' due to step 2 and 3 combined.
3788
        ASSERT(!(logicalTop.isAuto() || logicalBottom.isAuto()));
3777
        ASSERT(!(logicalTop.isAuto() || logicalBottom.isAuto()));
3789
3778
3790
        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
3779
        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
3791
        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight, renderView);
3780
        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight);
3792
3781
3793
        LayoutUnit difference = availableSpace - (logicalTopValue + logicalBottomValue);
3782
        LayoutUnit difference = availableSpace - (logicalTopValue + logicalBottomValue);
3794
        // NOTE: This may result in negative values.
3783
        // NOTE: This may result in negative values.
Lines 3800-3838 void RenderBox::computePositionedLogicalHeightReplaced(LogicalExtentComputedValu a/Source/WebCore/rendering/RenderBox.cpp_sec34
3800
     *    for that value.
3789
     *    for that value.
3801
    \*-----------------------------------------------------------------------*/
3790
    \*-----------------------------------------------------------------------*/
3802
    } else if (logicalTop.isAuto()) {
3791
    } else if (logicalTop.isAuto()) {
3803
        marginBeforeAlias = valueForLength(marginBefore, containerRelativeLogicalWidth, renderView);
3792
        marginBeforeAlias = valueForLength(marginBefore, containerRelativeLogicalWidth);
3804
        marginAfterAlias = valueForLength(marginAfter, containerRelativeLogicalWidth, renderView);
3793
        marginAfterAlias = valueForLength(marginAfter, containerRelativeLogicalWidth);
3805
        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight, renderView);
3794
        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight);
3806
3795
3807
        // Solve for 'top'
3796
        // Solve for 'top'
3808
        logicalTopValue = availableSpace - (logicalBottomValue + marginBeforeAlias + marginAfterAlias);
3797
        logicalTopValue = availableSpace - (logicalBottomValue + marginBeforeAlias + marginAfterAlias);
3809
    } else if (logicalBottom.isAuto()) {
3798
    } else if (logicalBottom.isAuto()) {
3810
        marginBeforeAlias = valueForLength(marginBefore, containerRelativeLogicalWidth, renderView);
3799
        marginBeforeAlias = valueForLength(marginBefore, containerRelativeLogicalWidth);
3811
        marginAfterAlias = valueForLength(marginAfter, containerRelativeLogicalWidth, renderView);
3800
        marginAfterAlias = valueForLength(marginAfter, containerRelativeLogicalWidth);
3812
        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
3801
        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
3813
3802
3814
        // Solve for 'bottom'
3803
        // Solve for 'bottom'
3815
        // NOTE: It is not necessary to solve for 'bottom' because we don't ever
3804
        // NOTE: It is not necessary to solve for 'bottom' because we don't ever
3816
        // use the value.
3805
        // use the value.
3817
    } else if (marginBefore.isAuto()) {
3806
    } else if (marginBefore.isAuto()) {
3818
        marginAfterAlias = valueForLength(marginAfter, containerRelativeLogicalWidth, renderView);
3807
        marginAfterAlias = valueForLength(marginAfter, containerRelativeLogicalWidth);
3819
        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
3808
        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
3820
        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight, renderView);
3809
        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight);
3821
3810
3822
        // Solve for 'margin-top'
3811
        // Solve for 'margin-top'
3823
        marginBeforeAlias = availableSpace - (logicalTopValue + logicalBottomValue + marginAfterAlias);
3812
        marginBeforeAlias = availableSpace - (logicalTopValue + logicalBottomValue + marginAfterAlias);
3824
    } else if (marginAfter.isAuto()) {
3813
    } else if (marginAfter.isAuto()) {
3825
        marginBeforeAlias = valueForLength(marginBefore, containerRelativeLogicalWidth, renderView);
3814
        marginBeforeAlias = valueForLength(marginBefore, containerRelativeLogicalWidth);
3826
        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
3815
        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
3827
        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight, renderView);
3816
        logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeight);
3828
3817
3829
        // Solve for 'margin-bottom'
3818
        // Solve for 'margin-bottom'
3830
        marginAfterAlias = availableSpace - (logicalTopValue + logicalBottomValue + marginBeforeAlias);
3819
        marginAfterAlias = availableSpace - (logicalTopValue + logicalBottomValue + marginBeforeAlias);
3831
    } else {
3820
    } else {
3832
        // Nothing is 'auto', just calculate the values.
3821
        // Nothing is 'auto', just calculate the values.
3833
        marginBeforeAlias = valueForLength(marginBefore, containerRelativeLogicalWidth, renderView);
3822
        marginBeforeAlias = valueForLength(marginBefore, containerRelativeLogicalWidth);
3834
        marginAfterAlias = valueForLength(marginAfter, containerRelativeLogicalWidth, renderView);
3823
        marginAfterAlias = valueForLength(marginAfter, containerRelativeLogicalWidth);
3835
        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView);
3824
        logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
3836
        // NOTE: It is not necessary to solve for 'bottom' because we don't ever
3825
        // NOTE: It is not necessary to solve for 'bottom' because we don't ever
3837
        // use the value.
3826
        // use the value.
3838
     }
3827
     }
- a/Source/WebCore/rendering/RenderBoxModelObject.cpp -48 / +41 lines
Lines 405-415 LayoutSize RenderBoxModelObject::relativePositionOffset() const a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec1
405
    // call availableWidth on our containing block.
405
    // call availableWidth on our containing block.
406
    if (!style()->left().isAuto()) {
406
    if (!style()->left().isAuto()) {
407
        if (!style()->right().isAuto() && !containingBlock->style()->isLeftToRightDirection())
407
        if (!style()->right().isAuto() && !containingBlock->style()->isLeftToRightDirection())
408
            offset.setWidth(-valueForLength(style()->right(), containingBlock->availableWidth(), view()));
408
            offset.setWidth(-valueForLength(style()->right(), containingBlock->availableWidth()));
409
        else
409
        else
410
            offset.expand(valueForLength(style()->left(), containingBlock->availableWidth(), view()), 0);
410
            offset.expand(valueForLength(style()->left(), containingBlock->availableWidth()), 0);
411
    } else if (!style()->right().isAuto()) {
411
    } else if (!style()->right().isAuto()) {
412
        offset.expand(-valueForLength(style()->right(), containingBlock->availableWidth(), view()), 0);
412
        offset.expand(-valueForLength(style()->right(), containingBlock->availableWidth()), 0);
413
    }
413
    }
414
414
415
    // If the containing block of a relatively positioned element does not
415
    // If the containing block of a relatively positioned element does not
Lines 422-434 LayoutSize RenderBoxModelObject::relativePositionOffset() const a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec2
422
        && (!containingBlock->hasAutoHeightOrContainingBlockWithAutoHeight()
422
        && (!containingBlock->hasAutoHeightOrContainingBlockWithAutoHeight()
423
            || !style()->top().isPercent()
423
            || !style()->top().isPercent()
424
            || containingBlock->stretchesToViewport()))
424
            || containingBlock->stretchesToViewport()))
425
        offset.expand(0, valueForLength(style()->top(), containingBlock->availableHeight(), view()));
425
        offset.expand(0, valueForLength(style()->top(), containingBlock->availableHeight()));
426
426
427
    else if (!style()->bottom().isAuto()
427
    else if (!style()->bottom().isAuto()
428
        && (!containingBlock->hasAutoHeightOrContainingBlockWithAutoHeight()
428
        && (!containingBlock->hasAutoHeightOrContainingBlockWithAutoHeight()
429
            || !style()->bottom().isPercent()
429
            || !style()->bottom().isPercent()
430
            || containingBlock->stretchesToViewport()))
430
            || containingBlock->stretchesToViewport()))
431
        offset.expand(0, -valueForLength(style()->bottom(), containingBlock->availableHeight(), view()));
431
        offset.expand(0, -valueForLength(style()->bottom(), containingBlock->availableHeight()));
432
432
433
    return offset;
433
    return offset;
434
}
434
}
Lines 479-488 void RenderBoxModelObject::computeStickyPositionConstraints(StickyPositionViewpo a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec3
479
479
480
    // Sticky positioned element ignore any override logical width on the containing block (as they don't call
480
    // Sticky positioned element ignore any override logical width on the containing block (as they don't call
481
    // containingBlockLogicalWidthForContent). It's unclear whether this is totally fine.
481
    // containingBlockLogicalWidthForContent). It's unclear whether this is totally fine.
482
    LayoutBoxExtent minMargin(minimumValueForLength(style()->marginTop(), maxWidth, view()),
482
    LayoutBoxExtent minMargin(minimumValueForLength(style()->marginTop(), maxWidth),
483
        minimumValueForLength(style()->marginRight(), maxWidth, view()),
483
        minimumValueForLength(style()->marginRight(), maxWidth),
484
        minimumValueForLength(style()->marginBottom(), maxWidth, view()),
484
        minimumValueForLength(style()->marginBottom(), maxWidth),
485
        minimumValueForLength(style()->marginLeft(), maxWidth, view()));
485
        minimumValueForLength(style()->marginLeft(), maxWidth));
486
486
487
    // Compute the container-relative area within which the sticky element is allowed to move.
487
    // Compute the container-relative area within which the sticky element is allowed to move.
488
    containerContentRect.contract(minMargin);
488
    containerContentRect.contract(minMargin);
Lines 503-524 void RenderBoxModelObject::computeStickyPositionConstraints(StickyPositionViewpo a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec4
503
    constraints.setAbsoluteStickyBoxRect(absoluteStickyBoxRect);
503
    constraints.setAbsoluteStickyBoxRect(absoluteStickyBoxRect);
504
504
505
    if (!style()->left().isAuto()) {
505
    if (!style()->left().isAuto()) {
506
        constraints.setLeftOffset(valueForLength(style()->left(), viewportRect.width(), view()));
506
        constraints.setLeftOffset(valueForLength(style()->left(), viewportRect.width()));
507
        constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeLeft);
507
        constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeLeft);
508
    }
508
    }
509
509
510
    if (!style()->right().isAuto()) {
510
    if (!style()->right().isAuto()) {
511
        constraints.setRightOffset(valueForLength(style()->right(), viewportRect.width(), view()));
511
        constraints.setRightOffset(valueForLength(style()->right(), viewportRect.width()));
512
        constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeRight);
512
        constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeRight);
513
    }
513
    }
514
514
515
    if (!style()->top().isAuto()) {
515
    if (!style()->top().isAuto()) {
516
        constraints.setTopOffset(valueForLength(style()->top(), viewportRect.height(), view()));
516
        constraints.setTopOffset(valueForLength(style()->top(), viewportRect.height()));
517
        constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeTop);
517
        constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeTop);
518
    }
518
    }
519
519
520
    if (!style()->bottom().isAuto()) {
520
    if (!style()->bottom().isAuto()) {
521
        constraints.setBottomOffset(valueForLength(style()->bottom(), viewportRect.height(), view()));
521
        constraints.setBottomOffset(valueForLength(style()->bottom(), viewportRect.height()));
522
        constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeBottom);
522
        constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeBottom);
523
    }
523
    }
524
}
524
}
Lines 590-610 int RenderBoxModelObject::pixelSnappedOffsetHeight() const a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec5
590
LayoutUnit RenderBoxModelObject::computedCSSPadding(Length padding) const
590
LayoutUnit RenderBoxModelObject::computedCSSPadding(Length padding) const
591
{
591
{
592
    LayoutUnit w = 0;
592
    LayoutUnit w = 0;
593
    RenderView* renderView = 0;
594
    if (padding.isPercent())
593
    if (padding.isPercent())
595
        w = containingBlockLogicalWidthForContent();
594
        w = containingBlockLogicalWidthForContent();
596
    else if (padding.isViewportPercentage())
595
    return minimumValueForLength(padding, w);
597
        renderView = view();
598
    return minimumValueForLength(padding, w, renderView);
599
}
596
}
600
597
601
RoundedRect RenderBoxModelObject::getBackgroundRoundedRect(const LayoutRect& borderRect, InlineFlowBox* box, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight,
598
RoundedRect RenderBoxModelObject::getBackgroundRoundedRect(const LayoutRect& borderRect, InlineFlowBox* box, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight,
602
    bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
599
    bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
603
{
600
{
604
    RenderView* renderView = view();
601
    RoundedRect border = style()->getRoundedBorderFor(borderRect, this, includeLogicalLeftEdge, includeLogicalRightEdge);
605
    RoundedRect border = style()->getRoundedBorderFor(borderRect, renderView, includeLogicalLeftEdge, includeLogicalRightEdge);
606
    if (box && (box->nextLineBox() || box->prevLineBox())) {
602
    if (box && (box->nextLineBox() || box->prevLineBox())) {
607
        RoundedRect segmentBorder = style()->getRoundedBorderFor(LayoutRect(0, 0, inlineBoxWidth, inlineBoxHeight), renderView, includeLogicalLeftEdge, includeLogicalRightEdge);
603
        RoundedRect segmentBorder = style()->getRoundedBorderFor(LayoutRect(0, 0, inlineBoxWidth, inlineBoxHeight), this, includeLogicalLeftEdge, includeLogicalRightEdge);
608
        border.setRadii(segmentBorder.radii());
604
        border.setRadii(segmentBorder.radii());
609
    }
605
    }
610
606
Lines 665-671 RoundedRect RenderBoxModelObject::backgroundRoundedRectAdjustedForBleedAvoidance a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec6
665
        return getBackgroundRoundedRect(shrinkRectByOnePixel(context, borderRect), box, boxSize.width(), boxSize.height(), includeLogicalLeftEdge, includeLogicalRightEdge);
661
        return getBackgroundRoundedRect(shrinkRectByOnePixel(context, borderRect), box, boxSize.width(), boxSize.height(), includeLogicalLeftEdge, includeLogicalRightEdge);
666
    }
662
    }
667
    if (bleedAvoidance == BackgroundBleedBackgroundOverBorder)
663
    if (bleedAvoidance == BackgroundBleedBackgroundOverBorder)
668
        return style()->getRoundedInnerBorderFor(borderRect, includeLogicalLeftEdge, includeLogicalRightEdge);
664
        return style()->getRoundedInnerBorderFor(borderRect, this, includeLogicalLeftEdge, includeLogicalRightEdge);
669
665
670
    return getBackgroundRoundedRect(borderRect, box, boxSize.width(), boxSize.height(), includeLogicalLeftEdge, includeLogicalRightEdge);
666
    return getBackgroundRoundedRect(borderRect, box, boxSize.width(), boxSize.height(), includeLogicalLeftEdge, includeLogicalRightEdge);
671
}
667
}
Lines 762-771 void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec7
762
758
763
        // Clip to the padding or content boxes as necessary.
759
        // Clip to the padding or content boxes as necessary.
764
        if (bgLayer->clip() == ContentFillBox) {
760
        if (bgLayer->clip() == ContentFillBox) {
765
            border = style()->getRoundedInnerBorderFor(border.rect(),
761
            border = style()->getRoundedInnerBorderFor(border.rect(), this,
766
                paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddingLeft() + borderLeft(), paddingRight() + borderRight(), includeLeftEdge, includeRightEdge);
762
                paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddingLeft() + borderLeft(), paddingRight() + borderRight(), includeLeftEdge, includeRightEdge);
767
        } else if (bgLayer->clip() == PaddingFillBox)
763
        } else if (bgLayer->clip() == PaddingFillBox)
768
            border = style()->getRoundedInnerBorderFor(border.rect(), includeLeftEdge, includeRightEdge);
764
            border = style()->getRoundedInnerBorderFor(border.rect(), this, includeLeftEdge, includeRightEdge);
769
765
770
        clipRoundedInnerRect(context, rect, border);
766
        clipRoundedInnerRect(context, rect, border);
771
    }
767
    }
Lines 1035-1041 IntSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer, a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec8
1035
1031
1036
    IntSize imageIntrinsicSize = calculateImageIntrinsicDimensions(image, positioningAreaSize, ScaleByEffectiveZoom);
1032
    IntSize imageIntrinsicSize = calculateImageIntrinsicDimensions(image, positioningAreaSize, ScaleByEffectiveZoom);
1037
    imageIntrinsicSize.scale(1 / image->imageScaleFactor(), 1 / image->imageScaleFactor());
1033
    imageIntrinsicSize.scale(1 / image->imageScaleFactor(), 1 / image->imageScaleFactor());
1038
    RenderView* renderView = view();
1039
    switch (type) {
1034
    switch (type) {
1040
        case SizeLength: {
1035
        case SizeLength: {
1041
            LayoutSize tileSize = positioningAreaSize;
1036
            LayoutSize tileSize = positioningAreaSize;
Lines 1046-1057 IntSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer, a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec9
1046
            if (layerWidth.isFixed())
1041
            if (layerWidth.isFixed())
1047
                tileSize.setWidth(layerWidth.value());
1042
                tileSize.setWidth(layerWidth.value());
1048
            else if (layerWidth.isPercent() || layerWidth.isViewportPercentage())
1043
            else if (layerWidth.isPercent() || layerWidth.isViewportPercentage())
1049
                tileSize.setWidth(valueForLength(layerWidth, positioningAreaSize.width(), renderView));
1044
                tileSize.setWidth(valueForLength(layerWidth, positioningAreaSize.width()));
1050
            
1045
            
1051
            if (layerHeight.isFixed())
1046
            if (layerHeight.isFixed())
1052
                tileSize.setHeight(layerHeight.value());
1047
                tileSize.setHeight(layerHeight.value());
1053
            else if (layerHeight.isPercent() || layerHeight.isViewportPercentage())
1048
            else if (layerHeight.isPercent() || layerHeight.isViewportPercentage())
1054
                tileSize.setHeight(valueForLength(layerHeight, positioningAreaSize.height(), renderView));
1049
                tileSize.setHeight(valueForLength(layerHeight, positioningAreaSize.height()));
1055
1050
1056
            applySubPixelHeuristicForTileSize(tileSize, positioningAreaSize);
1051
            applySubPixelHeuristicForTileSize(tileSize, positioningAreaSize);
1057
1052
Lines 1211-1228 void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec10
1211
1206
1212
    EFillRepeat backgroundRepeatX = fillLayer->repeatX();
1207
    EFillRepeat backgroundRepeatX = fillLayer->repeatX();
1213
    EFillRepeat backgroundRepeatY = fillLayer->repeatY();
1208
    EFillRepeat backgroundRepeatY = fillLayer->repeatY();
1214
    RenderView* renderView = view();
1215
    int availableWidth = positioningAreaSize.width() - geometry.tileSize().width();
1209
    int availableWidth = positioningAreaSize.width() - geometry.tileSize().width();
1216
    int availableHeight = positioningAreaSize.height() - geometry.tileSize().height();
1210
    int availableHeight = positioningAreaSize.height() - geometry.tileSize().height();
1217
1211
1218
    LayoutUnit computedXPosition = minimumValueForLength(fillLayer->xPosition(), availableWidth, renderView, true);
1212
    LayoutUnit computedXPosition = minimumValueForLength(fillLayer->xPosition(), availableWidth, true);
1219
    if (backgroundRepeatX == RepeatFill)
1213
    if (backgroundRepeatX == RepeatFill)
1220
        geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - roundToInt(computedXPosition + left) % geometry.tileSize().width() : 0);
1214
        geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - roundToInt(computedXPosition + left) % geometry.tileSize().width() : 0);
1221
    else {
1215
    else {
1222
        int xOffset = fillLayer->backgroundXOrigin() == RightEdge ? availableWidth - computedXPosition : computedXPosition;
1216
        int xOffset = fillLayer->backgroundXOrigin() == RightEdge ? availableWidth - computedXPosition : computedXPosition;
1223
        geometry.setNoRepeatX(left + xOffset);
1217
        geometry.setNoRepeatX(left + xOffset);
1224
    }
1218
    }
1225
    LayoutUnit computedYPosition = minimumValueForLength(fillLayer->yPosition(), availableHeight, renderView, true);
1219
    LayoutUnit computedYPosition = minimumValueForLength(fillLayer->yPosition(), availableHeight, true);
1226
    if (backgroundRepeatY == RepeatFill)
1220
    if (backgroundRepeatY == RepeatFill)
1227
        geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0);
1221
        geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0);
1228
    else {
1222
    else {
Lines 1237-1249 void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec11
1237
    geometry.setDestOrigin(geometry.destRect().location());
1231
    geometry.setDestOrigin(geometry.destRect().location());
1238
}
1232
}
1239
1233
1240
static LayoutUnit computeBorderImageSide(Length borderSlice, LayoutUnit borderSide, LayoutUnit imageSide, LayoutUnit boxExtent, RenderView* renderView)
1234
static LayoutUnit computeBorderImageSide(Length borderSlice, LayoutUnit borderSide, LayoutUnit imageSide, LayoutUnit boxExtent, const RenderObject* renderer)
1241
{
1235
{
1242
    if (borderSlice.isRelative())
1236
    if (borderSlice.isRelative())
1243
        return borderSlice.value() * borderSide;
1237
        return borderSlice.value() * borderSide;
1244
    if (borderSlice.isAuto())
1238
    if (borderSlice.isAuto())
1245
        return imageSide;
1239
        return imageSide;
1246
    return valueForLength(borderSlice, boxExtent, renderView);
1240
    return renderer->valueForLength(borderSlice, boxExtent);
1247
}
1241
}
1248
1242
1249
bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, const LayoutRect& rect, const RenderStyle* style,
1243
bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, const LayoutRect& rect, const RenderStyle* style,
Lines 1272-1292 bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec12
1272
1266
1273
    int imageWidth = imageSize.width();
1267
    int imageWidth = imageSize.width();
1274
    int imageHeight = imageSize.height();
1268
    int imageHeight = imageSize.height();
1275
    RenderView* renderView = view();
1276
1269
1277
    float imageScaleFactor = styleImage->imageScaleFactor();
1270
    float imageScaleFactor = styleImage->imageScaleFactor();
1278
    int topSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().top(), imageHeight, renderView)) * imageScaleFactor;
1271
    int topSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().top(), imageHeight)) * imageScaleFactor;
1279
    int rightSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().right(), imageWidth, renderView)) * imageScaleFactor;
1272
    int rightSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().right(), imageWidth)) * imageScaleFactor;
1280
    int bottomSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().bottom(), imageHeight, renderView)) * imageScaleFactor;
1273
    int bottomSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().bottom(), imageHeight)) * imageScaleFactor;
1281
    int leftSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().left(), imageWidth, renderView)) * imageScaleFactor;
1274
    int leftSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().left(), imageWidth)) * imageScaleFactor;
1282
1275
1283
    ENinePieceImageRule hRule = ninePieceImage.horizontalRule();
1276
    ENinePieceImageRule hRule = ninePieceImage.horizontalRule();
1284
    ENinePieceImageRule vRule = ninePieceImage.verticalRule();
1277
    ENinePieceImageRule vRule = ninePieceImage.verticalRule();
1285
1278
1286
    int topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), style->borderTopWidth(), topSlice, borderImageRect.height(), renderView);
1279
    int topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), style->borderTopWidth(), topSlice, borderImageRect.height(), this);
1287
    int rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(), style->borderRightWidth(), rightSlice, borderImageRect.width(), renderView);
1280
    int rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(), style->borderRightWidth(), rightSlice, borderImageRect.width(), this);
1288
    int bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().bottom(), style->borderBottomWidth(), bottomSlice, borderImageRect.height(), renderView);
1281
    int bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().bottom(), style->borderBottomWidth(), bottomSlice, borderImageRect.height(), this);
1289
    int leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(), style->borderLeftWidth(), leftSlice, borderImageRect.width(), renderView);
1282
    int leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(), style->borderLeftWidth(), leftSlice, borderImageRect.width(), this);
1290
    
1283
    
1291
    // Reduce the widths if they're too large.
1284
    // Reduce the widths if they're too large.
1292
    // The spec says: Given Lwidth as the width of the border image area, Lheight as its height, and Wside as the border image width
1285
    // The spec says: Given Lwidth as the width of the border image area, Lheight as its height, and Wside as the border image width
Lines 1834-1841 void RenderBoxModelObject::paintBorder(const PaintInfo& info, const LayoutRect& a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec13
1834
1827
1835
    BorderEdge edges[4];
1828
    BorderEdge edges[4];
1836
    getBorderEdgeInfo(edges, style, includeLogicalLeftEdge, includeLogicalRightEdge);
1829
    getBorderEdgeInfo(edges, style, includeLogicalLeftEdge, includeLogicalRightEdge);
1837
    RoundedRect outerBorder = style->getRoundedBorderFor(rect, view(), includeLogicalLeftEdge, includeLogicalRightEdge);
1830
    RoundedRect outerBorder = style->getRoundedBorderFor(rect, this, includeLogicalLeftEdge, includeLogicalRightEdge);
1838
    RoundedRect innerBorder = style->getRoundedInnerBorderFor(borderInnerRectAdjustedForBleedAvoidance(graphicsContext, rect, bleedAvoidance), includeLogicalLeftEdge, includeLogicalRightEdge);
1831
    RoundedRect innerBorder = style->getRoundedInnerBorderFor(borderInnerRectAdjustedForBleedAvoidance(graphicsContext, rect, bleedAvoidance), this, includeLogicalLeftEdge, includeLogicalRightEdge);
1839
1832
1840
    bool haveAlphaColor = false;
1833
    bool haveAlphaColor = false;
1841
    bool haveAllSolidEdges = true;
1834
    bool haveAllSolidEdges = true;
Lines 1976-1982 void RenderBoxModelObject::paintBorder(const PaintInfo& info, const LayoutRect& a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec14
1976
1969
1977
    // If only one edge visible antialiasing doesn't create seams
1970
    // If only one edge visible antialiasing doesn't create seams
1978
    bool antialias = shouldAntialiasLines(graphicsContext) || numEdgesVisible == 1;
1971
    bool antialias = shouldAntialiasLines(graphicsContext) || numEdgesVisible == 1;
1979
    RoundedRect unadjustedInnerBorder = (bleedAvoidance == BackgroundBleedBackgroundOverBorder) ? style->getRoundedInnerBorderFor(rect, includeLogicalLeftEdge, includeLogicalRightEdge) : innerBorder;
1972
    RoundedRect unadjustedInnerBorder = (bleedAvoidance == BackgroundBleedBackgroundOverBorder) ? style->getRoundedInnerBorderFor(rect, this, includeLogicalLeftEdge, includeLogicalRightEdge) : innerBorder;
1980
    IntPoint innerBorderAdjustment(innerBorder.rect().x() - unadjustedInnerBorder.rect().x(), innerBorder.rect().y() - unadjustedInnerBorder.rect().y());
1973
    IntPoint innerBorderAdjustment(innerBorder.rect().x() - unadjustedInnerBorder.rect().x(), innerBorder.rect().y() - unadjustedInnerBorder.rect().y());
1981
    if (haveAlphaColor)
1974
    if (haveAlphaColor)
1982
        paintTranslucentBorderSides(graphicsContext, style, outerBorder, unadjustedInnerBorder, innerBorderAdjustment, edges, edgesToDraw, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias);
1975
        paintTranslucentBorderSides(graphicsContext, style, outerBorder, unadjustedInnerBorder, innerBorderAdjustment, edges, edgesToDraw, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias);
Lines 2060-2066 void RenderBoxModelObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec15
2060
        // Draw inner border line
2053
        // Draw inner border line
2061
        {
2054
        {
2062
            GraphicsContextStateSaver stateSaver(*graphicsContext);
2055
            GraphicsContextStateSaver stateSaver(*graphicsContext);
2063
            RoundedRect innerClip = style->getRoundedInnerBorderFor(borderRect,
2056
            RoundedRect innerClip = style->getRoundedInnerBorderFor(borderRect, this,
2064
                innerBorderTopWidth, innerBorderBottomWidth, innerBorderLeftWidth, innerBorderRightWidth,
2057
                innerBorderTopWidth, innerBorderBottomWidth, innerBorderLeftWidth, innerBorderRightWidth,
2065
                includeLogicalLeftEdge, includeLogicalRightEdge);
2058
                includeLogicalLeftEdge, includeLogicalRightEdge);
2066
            
2059
            
Lines 2080-2086 void RenderBoxModelObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec16
2080
                ++outerBorderRightWidth;
2073
                ++outerBorderRightWidth;
2081
            }
2074
            }
2082
                
2075
                
2083
            RoundedRect outerClip = style->getRoundedInnerBorderFor(outerRect,
2076
            RoundedRect outerClip = style->getRoundedInnerBorderFor(outerRect, this,
2084
                outerBorderTopWidth, outerBorderBottomWidth, outerBorderLeftWidth, outerBorderRightWidth,
2077
                outerBorderTopWidth, outerBorderBottomWidth, outerBorderLeftWidth, outerBorderRightWidth,
2085
                includeLogicalLeftEdge, includeLogicalRightEdge);
2078
                includeLogicalLeftEdge, includeLogicalRightEdge);
2086
            graphicsContext->clipOutRoundedRect(outerClip);
2079
            graphicsContext->clipOutRoundedRect(outerClip);
Lines 2111-2117 void RenderBoxModelObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec17
2111
        LayoutUnit leftWidth = edges[BSLeft].usedWidth() / 2;
2104
        LayoutUnit leftWidth = edges[BSLeft].usedWidth() / 2;
2112
        LayoutUnit rightWidth = edges[BSRight].usedWidth() / 2;
2105
        LayoutUnit rightWidth = edges[BSRight].usedWidth() / 2;
2113
2106
2114
        RoundedRect clipRect = style->getRoundedInnerBorderFor(borderRect,
2107
        RoundedRect clipRect = style->getRoundedInnerBorderFor(borderRect, this,
2115
            topWidth, bottomWidth, leftWidth, rightWidth,
2108
            topWidth, bottomWidth, leftWidth, rightWidth,
2116
            includeLogicalLeftEdge, includeLogicalRightEdge);
2109
            includeLogicalLeftEdge, includeLogicalRightEdge);
2117
2110
Lines 2503-2510 void RenderBoxModelObject::paintBoxShadow(const PaintInfo& info, const LayoutRec a/Source/WebCore/rendering/RenderBoxModelObject.cpp_sec18
2503
    if (context->paintingDisabled() || !s->boxShadow())
2496
    if (context->paintingDisabled() || !s->boxShadow())
2504
        return;
2497
        return;
2505
2498
2506
    RoundedRect border = (shadowStyle == Inset) ? s->getRoundedInnerBorderFor(paintRect, includeLogicalLeftEdge, includeLogicalRightEdge)
2499
    RoundedRect border = (shadowStyle == Inset) ? s->getRoundedInnerBorderFor(paintRect, this, includeLogicalLeftEdge, includeLogicalRightEdge)
2507
                                                   : s->getRoundedBorderFor(paintRect, view(), includeLogicalLeftEdge, includeLogicalRightEdge);
2500
                                                   : s->getRoundedBorderFor(paintRect, this, includeLogicalLeftEdge, includeLogicalRightEdge);
2508
2501
2509
    bool hasBorderRadius = s->hasBorderRadius();
2502
    bool hasBorderRadius = s->hasBorderRadius();
2510
    bool isHorizontal = s->isHorizontalWritingMode();
2503
    bool isHorizontal = s->isHorizontalWritingMode();
- a/Source/WebCore/rendering/RenderFlexibleBox.cpp -2 / +2 lines
Lines 525-531 LayoutUnit RenderFlexibleBox::computeMainAxisExtentForChild(RenderBox* child, Si a/Source/WebCore/rendering/RenderFlexibleBox.cpp_sec1
525
    // to figure out the logical height/width.
525
    // to figure out the logical height/width.
526
    if (isColumnFlow())
526
    if (isColumnFlow())
527
        return child->computeContentLogicalHeight(sizeType, size);
527
        return child->computeContentLogicalHeight(sizeType, size);
528
    return child->adjustContentBoxLogicalWidthForBoxSizing(valueForLength(size, contentLogicalWidth(), view()));
528
    return child->adjustContentBoxLogicalWidthForBoxSizing(valueForLength(size, contentLogicalWidth()));
529
}
529
}
530
530
531
WritingMode RenderFlexibleBox::transformedWritingMode() const
531
WritingMode RenderFlexibleBox::transformedWritingMode() const
Lines 875-881 LayoutUnit RenderFlexibleBox::computeChildMarginValue(Length margin, RenderView* a/Source/WebCore/rendering/RenderFlexibleBox.cpp_sec2
875
    // When resolving the margins, we use the content size for resolving percent and calc (for percents in calc expressions) margins.
875
    // When resolving the margins, we use the content size for resolving percent and calc (for percents in calc expressions) margins.
876
    // Fortunately, percent margins are always computed with respect to the block's width, even for margin-top and margin-bottom.
876
    // Fortunately, percent margins are always computed with respect to the block's width, even for margin-top and margin-bottom.
877
    LayoutUnit availableSize = contentLogicalWidth();
877
    LayoutUnit availableSize = contentLogicalWidth();
878
    return minimumValueForLength(margin, availableSize, view);
878
    return minimumValueForLength(margin, availableSize);
879
}
879
}
880
880
881
void RenderFlexibleBox::computeMainAxisPreferredSizes(OrderHashSet& orderValues)
881
void RenderFlexibleBox::computeMainAxisPreferredSizes(OrderHashSet& orderValues)
- a/Source/WebCore/rendering/RenderGrid.cpp -1 / +1 lines
Lines 313-319 LayoutUnit RenderGrid::computeUsedBreadthOfSpecifiedLength(TrackSizingDirection a/Source/WebCore/rendering/RenderGrid.cpp_sec1
313
{
313
{
314
    // FIXME: We still need to support calc() here (https://webkit.org/b/103761).
314
    // FIXME: We still need to support calc() here (https://webkit.org/b/103761).
315
    ASSERT(trackLength.isFixed() || trackLength.isPercent() || trackLength.isViewportPercentage());
315
    ASSERT(trackLength.isFixed() || trackLength.isPercent() || trackLength.isViewportPercentage());
316
    return valueForLength(trackLength, direction == ForColumns ? logicalWidth() : computeContentLogicalHeight(MainOrPreferredSize, style()->logicalHeight()), view());
316
    return valueForLength(trackLength, direction == ForColumns ? logicalWidth() : computeContentLogicalHeight(MainOrPreferredSize, style()->logicalHeight()));
317
}
317
}
318
318
319
const GridTrackSize& RenderGrid::gridTrackSize(TrackSizingDirection direction, size_t i)
319
const GridTrackSize& RenderGrid::gridTrackSize(TrackSizingDirection direction, size_t i)
- a/Source/WebCore/rendering/RenderInline.cpp -2 / +2 lines
Lines 688-696 static LayoutUnit computeMargin(const RenderInline* renderer, const Length& marg a/Source/WebCore/rendering/RenderInline.cpp_sec1
688
    if (margin.isFixed())
688
    if (margin.isFixed())
689
        return margin.value();
689
        return margin.value();
690
    if (margin.isPercent())
690
    if (margin.isPercent())
691
        return minimumValueForLength(margin, max<LayoutUnit>(0, renderer->containingBlock()->availableLogicalWidth()));
691
        return renderer->minimumValueForLength(margin, max<LayoutUnit>(0, renderer->containingBlock()->availableLogicalWidth()));
692
    if (margin.isViewportPercentage())
692
    if (margin.isViewportPercentage())
693
        return valueForLength(margin, 0, renderer->view());
693
        return renderer->valueForLength(margin, 0);
694
    return 0;
694
    return 0;
695
}
695
}
696
696
- a/Source/WebCore/rendering/RenderLayer.cpp -9 / +9 lines
Lines 852-858 void RenderLayer::updateTransform() a/Source/WebCore/rendering/RenderLayer.cpp_sec1
852
        RenderBox* box = renderBox();
852
        RenderBox* box = renderBox();
853
        ASSERT(box);
853
        ASSERT(box);
854
        m_transform->makeIdentity();
854
        m_transform->makeIdentity();
855
        box->style()->applyTransform(*m_transform, box->pixelSnappedBorderBoxRect().size(), RenderStyle::IncludeTransformOrigin);
855
        box->style()->applyTransform(*m_transform, box->pixelSnappedBorderBoxRect().size(), renderer(), RenderStyle::IncludeTransformOrigin);
856
        makeMatrixRenderable(*m_transform, canRender3DTransforms());
856
        makeMatrixRenderable(*m_transform, canRender3DTransforms());
857
    }
857
    }
858
858
Lines 869-875 TransformationMatrix RenderLayer::currentTransform(RenderStyle::ApplyTransformOr a/Source/WebCore/rendering/RenderLayer.cpp_sec2
869
    if (renderer()->style()->isRunningAcceleratedAnimation()) {
869
    if (renderer()->style()->isRunningAcceleratedAnimation()) {
870
        TransformationMatrix currTransform;
870
        TransformationMatrix currTransform;
871
        RefPtr<RenderStyle> style = renderer()->animation()->getAnimatedStyleForRenderer(renderer());
871
        RefPtr<RenderStyle> style = renderer()->animation()->getAnimatedStyleForRenderer(renderer());
872
        style->applyTransform(currTransform, renderBox()->pixelSnappedBorderBoxRect().size(), applyOrigin);
872
        style->applyTransform(currTransform, renderBox()->pixelSnappedBorderBoxRect().size(), renderer(), applyOrigin);
873
        makeMatrixRenderable(currTransform, canRender3DTransforms());
873
        makeMatrixRenderable(currTransform, canRender3DTransforms());
874
        return currTransform;
874
        return currTransform;
875
    }
875
    }
Lines 878-884 TransformationMatrix RenderLayer::currentTransform(RenderStyle::ApplyTransformOr a/Source/WebCore/rendering/RenderLayer.cpp_sec3
878
    if (applyOrigin == RenderStyle::ExcludeTransformOrigin) {
878
    if (applyOrigin == RenderStyle::ExcludeTransformOrigin) {
879
        RenderBox* box = renderBox();
879
        RenderBox* box = renderBox();
880
        TransformationMatrix currTransform;
880
        TransformationMatrix currTransform;
881
        box->style()->applyTransform(currTransform, box->pixelSnappedBorderBoxRect().size(), RenderStyle::ExcludeTransformOrigin);
881
        box->style()->applyTransform(currTransform, box->pixelSnappedBorderBoxRect().size(), renderer(), RenderStyle::ExcludeTransformOrigin);
882
        makeMatrixRenderable(currTransform, canRender3DTransforms());
882
        makeMatrixRenderable(currTransform, canRender3DTransforms());
883
        return currTransform;
883
        return currTransform;
884
    }
884
    }
Lines 1283-1290 TransformationMatrix RenderLayer::perspectiveTransform() const a/Source/WebCore/rendering/RenderLayer.cpp_sec4
1283
    const float boxWidth = borderBox.width();
1283
    const float boxWidth = borderBox.width();
1284
    const float boxHeight = borderBox.height();
1284
    const float boxHeight = borderBox.height();
1285
1285
1286
    float perspectiveOriginX = floatValueForLength(style->perspectiveOriginX(), boxWidth);
1286
    float perspectiveOriginX = renderer()->floatValueForLength(style->perspectiveOriginX(), boxWidth);
1287
    float perspectiveOriginY = floatValueForLength(style->perspectiveOriginY(), boxHeight);
1287
    float perspectiveOriginY = renderer()->floatValueForLength(style->perspectiveOriginY(), boxHeight);
1288
1288
1289
    // A perspective origin of 0,0 makes the vanishing point in the center of the element.
1289
    // A perspective origin of 0,0 makes the vanishing point in the center of the element.
1290
    // We want it to be in the top-left, so subtract half the height and width.
1290
    // We want it to be in the top-left, so subtract half the height and width.
Lines 1307-1314 FloatPoint RenderLayer::perspectiveOrigin() const a/Source/WebCore/rendering/RenderLayer.cpp_sec5
1307
    const LayoutRect borderBox = toRenderBox(renderer())->borderBoxRect();
1307
    const LayoutRect borderBox = toRenderBox(renderer())->borderBoxRect();
1308
    RenderStyle* style = renderer()->style();
1308
    RenderStyle* style = renderer()->style();
1309
1309
1310
    return FloatPoint(floatValueForLength(style->perspectiveOriginX(), borderBox.width()),
1310
    return FloatPoint(renderer()->floatValueForLength(style->perspectiveOriginX(), borderBox.width()),
1311
                      floatValueForLength(style->perspectiveOriginY(), borderBox.height()));
1311
                      renderer()->floatValueForLength(style->perspectiveOriginY(), borderBox.height()));
1312
}
1312
}
1313
1313
1314
RenderLayer* RenderLayer::stackingContainer() const
1314
RenderLayer* RenderLayer::stackingContainer() const
Lines 3498-3504 void RenderLayer::clipToRect(RenderLayer* rootLayer, GraphicsContext* context, c a/Source/WebCore/rendering/RenderLayer.cpp_sec6
3498
        if (layer->renderer()->hasOverflowClip() && layer->renderer()->style()->hasBorderRadius() && inContainingBlockChain(this, layer)) {
3498
        if (layer->renderer()->hasOverflowClip() && layer->renderer()->style()->hasBorderRadius() && inContainingBlockChain(this, layer)) {
3499
                LayoutPoint delta;
3499
                LayoutPoint delta;
3500
                layer->convertToLayerCoords(rootLayer, delta);
3500
                layer->convertToLayerCoords(rootLayer, delta);
3501
                context->clipRoundedRect(layer->renderer()->style()->getRoundedInnerBorderFor(LayoutRect(delta, layer->size())));
3501
                context->clipRoundedRect(layer->renderer()->style()->getRoundedInnerBorderFor(LayoutRect(delta, layer->size()), renderer()));
3502
        }
3502
        }
3503
3503
3504
        if (layer == rootLayer)
3504
        if (layer == rootLayer)
Lines 3723-3729 void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti a/Source/WebCore/rendering/RenderLayer.cpp_sec7
3723
                rootRelativeBoundsComputed = true;
3723
                rootRelativeBoundsComputed = true;
3724
            }
3724
            }
3725
3725
3726
            context->clipPath(clipPath->path(rootRelativeBounds), clipPath->windRule());
3726
            context->clipPath(clipPath->path(rootRelativeBounds, renderer()->view()->viewportSize()), clipPath->windRule());
3727
        }
3727
        }
3728
#if ENABLE(SVG)
3728
#if ENABLE(SVG)
3729
        else if (style->clipPath()->getOperationType() == ClipPathOperation::REFERENCE) {
3729
        else if (style->clipPath()->getOperationType() == ClipPathOperation::REFERENCE) {
- a/Source/WebCore/rendering/RenderLayerBacking.cpp -11 / +14 lines
Lines 336-342 void RenderLayerBacking::updateTransform(const RenderStyle* style) a/Source/WebCore/rendering/RenderLayerBacking.cpp_sec1
336
    // baked into it, and we don't want that.
336
    // baked into it, and we don't want that.
337
    TransformationMatrix t;
337
    TransformationMatrix t;
338
    if (m_owningLayer->hasTransform()) {
338
    if (m_owningLayer->hasTransform()) {
339
        style->applyTransform(t, toRenderBox(renderer())->pixelSnappedBorderBoxRect().size(), RenderStyle::ExcludeTransformOrigin);
339
        style->applyTransform(t, toRenderBox(renderer())->pixelSnappedBorderBoxRect().size(), renderer(), RenderStyle::ExcludeTransformOrigin);
340
        makeMatrixRenderable(t, compositor()->canRender3DTransforms());
340
        makeMatrixRenderable(t, compositor()->canRender3DTransforms());
341
    }
341
    }
342
    
342
    
Lines 1617-1625 FloatPoint3D RenderLayerBacking::computeTransformOrigin(const IntRect& borderBox a/Source/WebCore/rendering/RenderLayerBacking.cpp_sec2
1617
{
1617
{
1618
    RenderStyle* style = renderer()->style();
1618
    RenderStyle* style = renderer()->style();
1619
1619
1620
    const IntSize& viewportSize = renderer()->view()->viewportSize();
1621
1620
    FloatPoint3D origin;
1622
    FloatPoint3D origin;
1621
    origin.setX(floatValueForLength(style->transformOriginX(), borderBox.width()));
1623
    origin.setX(floatValueForLength(style->transformOriginX(), borderBox.width(), viewportSize));
1622
    origin.setY(floatValueForLength(style->transformOriginY(), borderBox.height()));
1624
    origin.setY(floatValueForLength(style->transformOriginY(), borderBox.height(), viewportSize));
1623
    origin.setZ(style->transformOriginZ());
1625
    origin.setZ(style->transformOriginZ());
1624
1626
1625
    return origin;
1627
    return origin;
Lines 1631-1640 FloatPoint RenderLayerBacking::computePerspectiveOrigin(const IntRect& borderBox a/Source/WebCore/rendering/RenderLayerBacking.cpp_sec3
1631
1633
1632
    float boxWidth = borderBox.width();
1634
    float boxWidth = borderBox.width();
1633
    float boxHeight = borderBox.height();
1635
    float boxHeight = borderBox.height();
1636
    const IntSize& viewportSize = renderer()->view()->viewportSize();
1634
1637
1635
    FloatPoint origin;
1638
    FloatPoint origin;
1636
    origin.setX(floatValueForLength(style->perspectiveOriginX(), boxWidth));
1639
    origin.setX(floatValueForLength(style->perspectiveOriginX(), boxWidth, viewportSize));
1637
    origin.setY(floatValueForLength(style->perspectiveOriginY(), boxHeight));
1640
    origin.setY(floatValueForLength(style->perspectiveOriginY(), boxHeight, viewportSize));
1638
1641
1639
    return origin;
1642
    return origin;
1640
}
1643
}
Lines 1995-2008 bool RenderLayerBacking::startAnimation(double timeOffset, const Animation* anim a/Source/WebCore/rendering/RenderLayerBacking.cpp_sec4
1995
    bool didAnimateFilter = false;
1998
    bool didAnimateFilter = false;
1996
#endif
1999
#endif
1997
    
2000
    
1998
    if (hasTransform && m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->pixelSnappedBorderBoxRect().size(), anim, keyframes.animationName(), timeOffset))
2001
    if (hasTransform && m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->pixelSnappedBorderBoxRect().size(), renderer()->view()->viewportSize(), anim, keyframes.animationName(), timeOffset))
1999
        didAnimateTransform = true;
2002
        didAnimateTransform = true;
2000
2003
2001
    if (hasOpacity && m_graphicsLayer->addAnimation(opacityVector, IntSize(), anim, keyframes.animationName(), timeOffset))
2004
    if (hasOpacity && m_graphicsLayer->addAnimation(opacityVector, IntSize(), IntSize(), anim, keyframes.animationName(), timeOffset))
2002
        didAnimateOpacity = true;
2005
        didAnimateOpacity = true;
2003
2006
2004
#if ENABLE(CSS_FILTERS)
2007
#if ENABLE(CSS_FILTERS)
2005
    if (hasFilter && m_graphicsLayer->addAnimation(filterVector, IntSize(), anim, keyframes.animationName(), timeOffset))
2008
    if (hasFilter && m_graphicsLayer->addAnimation(filterVector, IntSize(), IntSize(), anim, keyframes.animationName(), timeOffset))
2006
        didAnimateFilter = true;
2009
        didAnimateFilter = true;
2007
#endif
2010
#endif
2008
2011
Lines 2040-2046 bool RenderLayerBacking::startTransition(double timeOffset, CSSPropertyID proper a/Source/WebCore/rendering/RenderLayerBacking.cpp_sec5
2040
            opacityVector.insert(new FloatAnimationValue(0, compositingOpacity(fromStyle->opacity())));
2043
            opacityVector.insert(new FloatAnimationValue(0, compositingOpacity(fromStyle->opacity())));
2041
            opacityVector.insert(new FloatAnimationValue(1, compositingOpacity(toStyle->opacity())));
2044
            opacityVector.insert(new FloatAnimationValue(1, compositingOpacity(toStyle->opacity())));
2042
            // The boxSize param is only used for transform animations (which can only run on RenderBoxes), so we pass an empty size here.
2045
            // The boxSize param is only used for transform animations (which can only run on RenderBoxes), so we pass an empty size here.
2043
            if (m_graphicsLayer->addAnimation(opacityVector, IntSize(), opacityAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyOpacity), timeOffset)) {
2046
            if (m_graphicsLayer->addAnimation(opacityVector, IntSize(), IntSize(), opacityAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyOpacity), timeOffset)) {
2044
                // To ensure that the correct opacity is visible when the animation ends, also set the final opacity.
2047
                // To ensure that the correct opacity is visible when the animation ends, also set the final opacity.
2045
                updateOpacity(toStyle);
2048
                updateOpacity(toStyle);
2046
                didAnimateOpacity = true;
2049
                didAnimateOpacity = true;
Lines 2054-2060 bool RenderLayerBacking::startTransition(double timeOffset, CSSPropertyID proper a/Source/WebCore/rendering/RenderLayerBacking.cpp_sec6
2054
            KeyframeValueList transformVector(AnimatedPropertyWebkitTransform);
2057
            KeyframeValueList transformVector(AnimatedPropertyWebkitTransform);
2055
            transformVector.insert(new TransformAnimationValue(0, &fromStyle->transform()));
2058
            transformVector.insert(new TransformAnimationValue(0, &fromStyle->transform()));
2056
            transformVector.insert(new TransformAnimationValue(1, &toStyle->transform()));
2059
            transformVector.insert(new TransformAnimationValue(1, &toStyle->transform()));
2057
            if (m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->pixelSnappedBorderBoxRect().size(), transformAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitTransform), timeOffset)) {
2060
            if (m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->pixelSnappedBorderBoxRect().size(), renderer()->view()->viewportSize(), transformAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitTransform), timeOffset)) {
2058
                // To ensure that the correct transform is visible when the animation ends, also set the final transform.
2061
                // To ensure that the correct transform is visible when the animation ends, also set the final transform.
2059
                updateTransform(toStyle);
2062
                updateTransform(toStyle);
2060
                didAnimateTransform = true;
2063
                didAnimateTransform = true;
Lines 2069-2075 bool RenderLayerBacking::startTransition(double timeOffset, CSSPropertyID proper a/Source/WebCore/rendering/RenderLayerBacking.cpp_sec7
2069
            KeyframeValueList filterVector(AnimatedPropertyWebkitFilter);
2072
            KeyframeValueList filterVector(AnimatedPropertyWebkitFilter);
2070
            filterVector.insert(new FilterAnimationValue(0, &fromStyle->filter()));
2073
            filterVector.insert(new FilterAnimationValue(0, &fromStyle->filter()));
2071
            filterVector.insert(new FilterAnimationValue(1, &toStyle->filter()));
2074
            filterVector.insert(new FilterAnimationValue(1, &toStyle->filter()));
2072
            if (m_graphicsLayer->addAnimation(filterVector, IntSize(), filterAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitFilter), timeOffset)) {
2075
            if (m_graphicsLayer->addAnimation(filterVector, IntSize(), IntSize(), filterAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitFilter), timeOffset)) {
2073
                // To ensure that the correct filter is visible when the animation ends, also set the final filter.
2076
                // To ensure that the correct filter is visible when the animation ends, also set the final filter.
2074
                updateFilters(toStyle);
2077
                updateFilters(toStyle);
2075
                didAnimateFilter = true;
2078
                didAnimateFilter = true;
- a/Source/WebCore/rendering/RenderMarquee.cpp -1 / +1 lines
Lines 285-291 void RenderMarquee::timerFired(Timer<RenderMarquee>*) a/Source/WebCore/rendering/RenderMarquee.cpp_sec1
285
        }
285
        }
286
        bool positive = range > 0;
286
        bool positive = range > 0;
287
        int clientSize = (isHorizontal() ? m_layer->renderBox()->clientWidth() : m_layer->renderBox()->clientHeight());
287
        int clientSize = (isHorizontal() ? m_layer->renderBox()->clientWidth() : m_layer->renderBox()->clientHeight());
288
        int increment = abs(intValueForLength(m_layer->renderer()->style()->marqueeIncrement(), clientSize));
288
        int increment = abs(m_layer->renderer()->intValueForLength(m_layer->renderer()->style()->marqueeIncrement(), clientSize));
289
        int currentPos = (isHorizontal() ? m_layer->scrollXOffset() : m_layer->scrollYOffset());
289
        int currentPos = (isHorizontal() ? m_layer->scrollXOffset() : m_layer->scrollYOffset());
290
        newPos =  currentPos + (addIncrement ? increment : -increment);
290
        newPos =  currentPos + (addIncrement ? increment : -increment);
291
        if (positive)
291
        if (positive)
- a/Source/WebCore/rendering/RenderMenuList.cpp -1 / +1 lines
Lines 175-181 void RenderMenuList::updateOptionsWidth() a/Source/WebCore/rendering/RenderMenuList.cpp_sec1
175
            // Add in the option's text indent.  We can't calculate percentage values for now.
175
            // Add in the option's text indent.  We can't calculate percentage values for now.
176
            float optionWidth = 0;
176
            float optionWidth = 0;
177
            if (RenderStyle* optionStyle = element->renderStyle())
177
            if (RenderStyle* optionStyle = element->renderStyle())
178
                optionWidth += minimumValueForLength(optionStyle->textIndent(), 0, view());
178
                optionWidth += minimumValueForLength(optionStyle->textIndent(), 0);
179
            if (!text.isEmpty())
179
            if (!text.isEmpty())
180
                optionWidth += style()->font().width(text);
180
                optionWidth += style()->font().width(text);
181
            maxOptionWidth = max(maxOptionWidth, optionWidth);
181
            maxOptionWidth = max(maxOptionWidth, optionWidth);
- a/Source/WebCore/rendering/RenderObject.cpp -3 / +38 lines
Lines 40-46 a/Source/WebCore/rendering/RenderObject.cpp_sec1
40
#include "GraphicsContext.h"
40
#include "GraphicsContext.h"
41
#include "HTMLElement.h"
41
#include "HTMLElement.h"
42
#include "HTMLNames.h"
42
#include "HTMLNames.h"
43
#include "HitTestResult.h"
43
#include "LengthFunctions.h"
44
#include "Page.h"
44
#include "Page.h"
45
#include "RenderArena.h"
45
#include "RenderArena.h"
46
#include "RenderCounter.h"
46
#include "RenderCounter.h"
Lines 1475-1481 bool RenderObject::repaintAfterLayoutIfNeeded(const RenderLayerModelObject* repa a/Source/WebCore/rendering/RenderObject.cpp_sec2
1475
        int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0;
1475
        int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0;
1476
        LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : LayoutUnit();
1476
        LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : LayoutUnit();
1477
        LayoutUnit minInsetRightShadowExtent = min<LayoutUnit>(-insetShadowExtent.right(), min<LayoutUnit>(newBounds.width(), oldBounds.width()));
1477
        LayoutUnit minInsetRightShadowExtent = min<LayoutUnit>(-insetShadowExtent.right(), min<LayoutUnit>(newBounds.width(), oldBounds.width()));
1478
        LayoutUnit borderWidth = max<LayoutUnit>(borderRight, max<LayoutUnit>(valueForLength(style()->borderTopRightRadius().width(), boxWidth, v), valueForLength(style()->borderBottomRightRadius().width(), boxWidth, v)));
1478
        LayoutUnit borderWidth = max<LayoutUnit>(borderRight, max<LayoutUnit>(valueForLength(style()->borderTopRightRadius().width(), boxWidth), valueForLength(style()->borderBottomRightRadius().width(), boxWidth)));
1479
        LayoutUnit decorationsWidth = max<LayoutUnit>(-outlineStyle->outlineOffset(), borderWidth + minInsetRightShadowExtent) + max<LayoutUnit>(outlineWidth, shadowRight);
1479
        LayoutUnit decorationsWidth = max<LayoutUnit>(-outlineStyle->outlineOffset(), borderWidth + minInsetRightShadowExtent) + max<LayoutUnit>(outlineWidth, shadowRight);
1480
        LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - decorationsWidth,
1480
        LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - decorationsWidth,
1481
            newOutlineBox.y(),
1481
            newOutlineBox.y(),
Lines 1495-1501 bool RenderObject::repaintAfterLayoutIfNeeded(const RenderLayerModelObject* repa a/Source/WebCore/rendering/RenderObject.cpp_sec3
1495
        int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0;
1495
        int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0;
1496
        LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : LayoutUnit();
1496
        LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : LayoutUnit();
1497
        LayoutUnit minInsetBottomShadowExtent = min<LayoutUnit>(-insetShadowExtent.bottom(), min<LayoutUnit>(newBounds.height(), oldBounds.height()));
1497
        LayoutUnit minInsetBottomShadowExtent = min<LayoutUnit>(-insetShadowExtent.bottom(), min<LayoutUnit>(newBounds.height(), oldBounds.height()));
1498
        LayoutUnit borderHeight = max<LayoutUnit>(borderBottom, max<LayoutUnit>(valueForLength(style()->borderBottomLeftRadius().height(), boxHeight, v), valueForLength(style()->borderBottomRightRadius().height(), boxHeight, v)));
1498
        LayoutUnit borderHeight = max<LayoutUnit>(borderBottom, max<LayoutUnit>(valueForLength(style()->borderBottomLeftRadius().height(), boxHeight), valueForLength(style()->borderBottomRightRadius().height(), boxHeight)));
1499
        LayoutUnit decorationsHeight = max<LayoutUnit>(-outlineStyle->outlineOffset(), borderHeight + minInsetBottomShadowExtent) + max<LayoutUnit>(outlineWidth, shadowBottom);
1499
        LayoutUnit decorationsHeight = max<LayoutUnit>(-outlineStyle->outlineOffset(), borderHeight + minInsetBottomShadowExtent) + max<LayoutUnit>(outlineWidth, shadowBottom);
1500
        LayoutRect bottomRect(newOutlineBox.x(),
1500
        LayoutRect bottomRect(newOutlineBox.x(),
1501
            min(newOutlineBox.maxY(), oldOutlineBox.maxY()) - decorationsHeight,
1501
            min(newOutlineBox.maxY(), oldOutlineBox.maxY()) - decorationsHeight,
Lines 3137-3142 void RenderObject::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const a/Source/WebCore/rendering/RenderObject.cpp_sec4
3137
    info.setCustomAllocation(true);
3137
    info.setCustomAllocation(true);
3138
}
3138
}
3139
3139
3140
static IntSize optionalViewportSize(const RenderObject* renderer, const Length& length)
3141
{
3142
    return length.isViewportPercentage() ? renderer->view()->viewportSize() : IntSize();
3143
}
3144
3145
int RenderObject::minimumIntValueForLength(const Length& length, LayoutUnit maximumValue, bool roundPercentages) const
3146
{
3147
    return WebCore::minimumIntValueForLength(length, maximumValue, optionalViewportSize(this, length), roundPercentages);
3148
}
3149
3150
int RenderObject::intValueForLength(const Length& length, LayoutUnit maximumValue, bool roundPercentages) const
3151
{
3152
    return WebCore::intValueForLength(length, maximumValue, optionalViewportSize(this, length), roundPercentages);
3153
}
3154
3155
LayoutUnit RenderObject::minimumValueForLength(const Length& length, LayoutUnit maximumValue, bool roundPercentages) const
3156
{
3157
    return WebCore::minimumValueForLength(length, maximumValue, optionalViewportSize(this, length), roundPercentages);
3158
}
3159
3160
LayoutUnit RenderObject::valueForLength(const Length& length, LayoutUnit maximumValue, bool roundPercentages) const
3161
{
3162
    return WebCore::valueForLength(length, maximumValue, optionalViewportSize(this, length), roundPercentages);
3163
}
3164
3165
float RenderObject::floatValueForLength(const Length& length, LayoutUnit maximumValue) const
3166
{
3167
    return WebCore::valueForLength(length, maximumValue, optionalViewportSize(this, length));
3168
}
3169
3170
float RenderObject::floatValueForLength(const Length& length, float maximumValue) const
3171
{
3172
    return WebCore::valueForLength(length, maximumValue, optionalViewportSize(this, length));
3173
}
3174
3140
#if ENABLE(SVG)
3175
#if ENABLE(SVG)
3141
3176
3142
RenderSVGResourceContainer* RenderObject::toRenderSVGResourceContainer()
3177
RenderSVGResourceContainer* RenderObject::toRenderSVGResourceContainer()
- a/Source/WebCore/rendering/RenderObject.h +7 lines
Lines 267-272 public: a/Source/WebCore/rendering/RenderObject.h_sec1
267
267
268
    virtual void reportMemoryUsage(MemoryObjectInfo*) const;
268
    virtual void reportMemoryUsage(MemoryObjectInfo*) const;
269
269
270
    int minimumIntValueForLength(const Length&, LayoutUnit maximumValue, bool roundPercentages = false) const;
271
    int intValueForLength(const Length&, LayoutUnit maximumValue, bool roundPercentages = false) const;
272
    LayoutUnit minimumValueForLength(const Length&, LayoutUnit maximumValue, bool roundPercentages = false) const;
273
    LayoutUnit valueForLength(const Length&, LayoutUnit maximumValue, bool roundPercentages = false) const;
274
    float floatValueForLength(const Length&, LayoutUnit maximumValue) const;
275
    float floatValueForLength(const Length&, float maximumValue) const;
276
270
protected:
277
protected:
271
    //////////////////////////////////////////
278
    //////////////////////////////////////////
272
    // Helper functions. Dangerous to use!
279
    // Helper functions. Dangerous to use!
- a/Source/WebCore/rendering/RenderReplaced.cpp -1 / +1 lines
Lines 147-153 void RenderReplaced::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) a/Source/WebCore/rendering/RenderReplaced.cpp_sec1
147
        else {
147
        else {
148
            // Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
148
            // Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
149
            paintInfo.context->save();
149
            paintInfo.context->save();
150
            RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(paintRect,
150
            RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(paintRect, this,
151
                paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true);
151
                paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true);
152
            clipRoundedInnerRect(paintInfo.context, paintRect, roundedInnerRect);
152
            clipRoundedInnerRect(paintInfo.context, paintRect, roundedInnerRect);
153
        }
153
        }
- a/Source/WebCore/rendering/RenderScrollbarPart.cpp -14 / +14 lines
Lines 87-96 void RenderScrollbarPart::layoutVerticalPart() a/Source/WebCore/rendering/RenderScrollbarPart.cpp_sec1
87
    } 
87
    } 
88
}
88
}
89
89
90
static int calcScrollbarThicknessUsing(SizeType sizeType, const Length& length, int containingLength, RenderView* renderView)
90
static int calcScrollbarThicknessUsing(SizeType sizeType, const Length& length, int containingLength, const IntSize& viewportSize)
91
{
91
{
92
    if (!length.isIntrinsicOrAuto() || (sizeType == MinSize && length.isAuto()))
92
    if (!length.isIntrinsicOrAuto() || (sizeType == MinSize && length.isAuto()))
93
        return minimumValueForLength(length, containingLength, renderView);
93
        return minimumValueForLength(length, containingLength, viewportSize);
94
    return ScrollbarTheme::theme()->scrollbarThickness();
94
    return ScrollbarTheme::theme()->scrollbarThickness();
95
}
95
}
96
96
Lines 98-133 void RenderScrollbarPart::computeScrollbarWidth() a/Source/WebCore/rendering/RenderScrollbarPart.cpp_sec2
98
{
98
{
99
    if (!m_scrollbar->owningRenderer())
99
    if (!m_scrollbar->owningRenderer())
100
        return;
100
        return;
101
    RenderView* renderView = view();
101
    const IntSize& viewportSize = view()->viewportSize();
102
    // FIXME: We are querying layout information but nothing guarantees that it's up-to-date, especially since we are called at style change.
102
    // FIXME: We are querying layout information but nothing guarantees that it's up-to-date, especially since we are called at style change.
103
    // FIXME: Querying the style's border information doesn't work on table cells with collapsing borders.
103
    // FIXME: Querying the style's border information doesn't work on table cells with collapsing borders.
104
    int visibleSize = m_scrollbar->owningRenderer()->width() - m_scrollbar->owningRenderer()->style()->borderLeftWidth() - m_scrollbar->owningRenderer()->style()->borderRightWidth();
104
    int visibleSize = m_scrollbar->owningRenderer()->width() - m_scrollbar->owningRenderer()->style()->borderLeftWidth() - m_scrollbar->owningRenderer()->style()->borderRightWidth();
105
    int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->width(), visibleSize, renderView);
105
    int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->width(), visibleSize, viewportSize);
106
    int minWidth = calcScrollbarThicknessUsing(MinSize, style()->minWidth(), visibleSize, renderView);
106
    int minWidth = calcScrollbarThicknessUsing(MinSize, style()->minWidth(), visibleSize, viewportSize);
107
    int maxWidth = style()->maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing(MaxSize, style()->maxWidth(), visibleSize, renderView);
107
    int maxWidth = style()->maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing(MaxSize, style()->maxWidth(), visibleSize, viewportSize);
108
    setWidth(max(minWidth, min(maxWidth, w)));
108
    setWidth(max(minWidth, min(maxWidth, w)));
109
    
109
    
110
    // Buttons and track pieces can all have margins along the axis of the scrollbar. 
110
    // Buttons and track pieces can all have margins along the axis of the scrollbar. 
111
    m_marginBox.setLeft(minimumValueForLength(style()->marginLeft(), visibleSize, renderView));
111
    m_marginBox.setLeft(minimumValueForLength(style()->marginLeft(), visibleSize));
112
    m_marginBox.setRight(minimumValueForLength(style()->marginRight(), visibleSize, renderView));
112
    m_marginBox.setRight(minimumValueForLength(style()->marginRight(), visibleSize));
113
}
113
}
114
114
115
void RenderScrollbarPart::computeScrollbarHeight()
115
void RenderScrollbarPart::computeScrollbarHeight()
116
{
116
{
117
    if (!m_scrollbar->owningRenderer())
117
    if (!m_scrollbar->owningRenderer())
118
        return;
118
        return;
119
    RenderView* renderView = view();
119
    const IntSize& viewportSize = view()->viewportSize();
120
    // FIXME: We are querying layout information but nothing guarantees that it's up-to-date, especially since we are called at style change.
120
    // FIXME: We are querying layout information but nothing guarantees that it's up-to-date, especially since we are called at style change.
121
    // FIXME: Querying the style's border information doesn't work on table cells with collapsing borders.
121
    // FIXME: Querying the style's border information doesn't work on table cells with collapsing borders.
122
    int visibleSize = m_scrollbar->owningRenderer()->height() -  m_scrollbar->owningRenderer()->style()->borderTopWidth() - m_scrollbar->owningRenderer()->style()->borderBottomWidth();
122
    int visibleSize = m_scrollbar->owningRenderer()->height() -  m_scrollbar->owningRenderer()->style()->borderTopWidth() - m_scrollbar->owningRenderer()->style()->borderBottomWidth();
123
    int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->height(), visibleSize, renderView);
123
    int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->height(), visibleSize, viewportSize);
124
    int minHeight = calcScrollbarThicknessUsing(MinSize, style()->minHeight(), visibleSize, renderView);
124
    int minHeight = calcScrollbarThicknessUsing(MinSize, style()->minHeight(), visibleSize, viewportSize);
125
    int maxHeight = style()->maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing(MaxSize, style()->maxHeight(), visibleSize, renderView);
125
    int maxHeight = style()->maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing(MaxSize, style()->maxHeight(), visibleSize, viewportSize);
126
    setHeight(max(minHeight, min(maxHeight, h)));
126
    setHeight(max(minHeight, min(maxHeight, h)));
127
127
128
    // Buttons and track pieces can all have margins along the axis of the scrollbar. 
128
    // Buttons and track pieces can all have margins along the axis of the scrollbar. 
129
    m_marginBox.setTop(minimumValueForLength(style()->marginTop(), visibleSize, renderView));
129
    m_marginBox.setTop(minimumValueForLength(style()->marginTop(), visibleSize));
130
    m_marginBox.setBottom(minimumValueForLength(style()->marginBottom(), visibleSize, renderView));
130
    m_marginBox.setBottom(minimumValueForLength(style()->marginBottom(), visibleSize));
131
}
131
}
132
132
133
void RenderScrollbarPart::computePreferredLogicalWidths()
133
void RenderScrollbarPart::computePreferredLogicalWidths()
- a/Source/WebCore/rendering/RenderTable.cpp -7 / +6 lines
Lines 246-252 void RenderTable::updateLogicalWidth() a/Source/WebCore/rendering/RenderTable.cpp_sec1
246
    }
246
    }
247
247
248
    RenderBlock* cb = containingBlock();
248
    RenderBlock* cb = containingBlock();
249
    RenderView* renderView = view();
250
249
251
    LayoutUnit availableLogicalWidth = containingBlockLogicalWidthForContent();
250
    LayoutUnit availableLogicalWidth = containingBlockLogicalWidthForContent();
252
    bool hasPerpendicularContainingBlock = cb->style()->isHorizontalWritingMode() != style()->isHorizontalWritingMode();
251
    bool hasPerpendicularContainingBlock = cb->style()->isHorizontalWritingMode() != style()->isHorizontalWritingMode();
Lines 257-264 void RenderTable::updateLogicalWidth() a/Source/WebCore/rendering/RenderTable.cpp_sec2
257
        setLogicalWidth(convertStyleLogicalWidthToComputedWidth(styleLogicalWidth, containerWidthInInlineDirection));
256
        setLogicalWidth(convertStyleLogicalWidthToComputedWidth(styleLogicalWidth, containerWidthInInlineDirection));
258
    else {
257
    else {
259
        // Subtract out any fixed margins from our available width for auto width tables.
258
        // Subtract out any fixed margins from our available width for auto width tables.
260
        LayoutUnit marginStart = minimumValueForLength(style()->marginStart(), availableLogicalWidth, renderView);
259
        LayoutUnit marginStart = minimumValueForLength(style()->marginStart(), availableLogicalWidth);
261
        LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd(), availableLogicalWidth, renderView);
260
        LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd(), availableLogicalWidth);
262
        LayoutUnit marginTotal = marginStart + marginEnd;
261
        LayoutUnit marginTotal = marginStart + marginEnd;
263
262
264
        // Subtract out our margins to get the available content width.
263
        // Subtract out our margins to get the available content width.
Lines 305-312 void RenderTable::updateLogicalWidth() a/Source/WebCore/rendering/RenderTable.cpp_sec3
305
        setMarginStart(marginValues.m_start);
304
        setMarginStart(marginValues.m_start);
306
        setMarginEnd(marginValues.m_end);
305
        setMarginEnd(marginValues.m_end);
307
    } else {
306
    } else {
308
        setMarginStart(minimumValueForLength(style()->marginStart(), availableLogicalWidth, renderView));
307
        setMarginStart(minimumValueForLength(style()->marginStart(), availableLogicalWidth));
309
        setMarginEnd(minimumValueForLength(style()->marginEnd(), availableLogicalWidth, renderView));
308
        setMarginEnd(minimumValueForLength(style()->marginEnd(), availableLogicalWidth));
310
    }
309
    }
311
}
310
}
312
311
Lines 319-325 LayoutUnit RenderTable::convertStyleLogicalWidthToComputedWidth(const Length& st a/Source/WebCore/rendering/RenderTable.cpp_sec4
319
    if (isCSSTable && styleLogicalWidth.isSpecified() && styleLogicalWidth.isPositive() && style()->boxSizing() == CONTENT_BOX)
318
    if (isCSSTable && styleLogicalWidth.isSpecified() && styleLogicalWidth.isPositive() && style()->boxSizing() == CONTENT_BOX)
320
            borders = borderStart() + borderEnd() + (collapseBorders() ? LayoutUnit() : paddingStart() + paddingEnd());
319
            borders = borderStart() + borderEnd() + (collapseBorders() ? LayoutUnit() : paddingStart() + paddingEnd());
321
320
322
    return minimumValueForLength(styleLogicalWidth, availableWidth, view()) + borders;
321
    return minimumValueForLength(styleLogicalWidth, availableWidth) + borders;
323
}
322
}
324
323
325
LayoutUnit RenderTable::convertStyleLogicalHeightToComputedHeight(const Length& styleLogicalHeight)
324
LayoutUnit RenderTable::convertStyleLogicalHeightToComputedHeight(const Length& styleLogicalHeight)
Lines 338-344 LayoutUnit RenderTable::convertStyleLogicalHeightToComputedHeight(const Length& a/Source/WebCore/rendering/RenderTable.cpp_sec5
338
    } else if (styleLogicalHeight.isPercent())
337
    } else if (styleLogicalHeight.isPercent())
339
        computedLogicalHeight = computePercentageLogicalHeight(styleLogicalHeight);
338
        computedLogicalHeight = computePercentageLogicalHeight(styleLogicalHeight);
340
    else if (styleLogicalHeight.isViewportPercentage())
339
    else if (styleLogicalHeight.isViewportPercentage())
341
        computedLogicalHeight = minimumValueForLength(styleLogicalHeight, 0, view());
340
        computedLogicalHeight = minimumValueForLength(styleLogicalHeight, 0);
342
    else
341
    else
343
        ASSERT_NOT_REACHED();
342
        ASSERT_NOT_REACHED();
344
    return max<LayoutUnit>(0, computedLogicalHeight);
343
    return max<LayoutUnit>(0, computedLogicalHeight);
- a/Source/WebCore/rendering/RenderTableCell.h -1 / +2 lines
Lines 27-32 a/Source/WebCore/rendering/RenderTableCell.h_sec1
27
27
28
#include "RenderTableRow.h"
28
#include "RenderTableRow.h"
29
#include "RenderTableSection.h"
29
#include "RenderTableSection.h"
30
#include "RenderView.h"
30
31
31
namespace WebCore {
32
namespace WebCore {
32
33
Lines 94-100 public: a/Source/WebCore/rendering/RenderTableCell.h_sec2
94
    {
95
    {
95
        // FIXME: This function does too much work, and is very hot during table layout!
96
        // FIXME: This function does too much work, and is very hot during table layout!
96
        int adjustedLogicalHeight = pixelSnappedLogicalHeight() - (intrinsicPaddingBefore() + intrinsicPaddingAfter());
97
        int adjustedLogicalHeight = pixelSnappedLogicalHeight() - (intrinsicPaddingBefore() + intrinsicPaddingAfter());
97
        int styleLogicalHeight = valueForLength(style()->logicalHeight(), 0, view());
98
        int styleLogicalHeight = valueForLength(style()->logicalHeight(), 0);
98
        // In strict mode, box-sizing: content-box do the right thing and actually add in the border and padding.
99
        // In strict mode, box-sizing: content-box do the right thing and actually add in the border and padding.
99
        // Call computedCSSPadding* directly to avoid including implicitPadding.
100
        // Call computedCSSPadding* directly to avoid including implicitPadding.
100
        if (!document()->inQuirksMode() && style()->boxSizing() != BORDER_BOX)
101
        if (!document()->inQuirksMode() && style()->boxSizing() != BORDER_BOX)
- a/Source/WebCore/rendering/RenderTableSection.cpp -1 / +1 lines
Lines 283-289 int RenderTableSection::calcRowLogicalHeight() a/Source/WebCore/rendering/RenderTableSection.cpp_sec1
283
        LayoutUnit baselineDescent = 0;
283
        LayoutUnit baselineDescent = 0;
284
284
285
        // Our base size is the biggest logical height from our cells' styles (excluding row spanning cells).
285
        // Our base size is the biggest logical height from our cells' styles (excluding row spanning cells).
286
        m_rowPos[r + 1] = max(m_rowPos[r] + minimumValueForLength(m_grid[r].logicalHeight, 0, viewRenderer).round(), 0);
286
        m_rowPos[r + 1] = max(m_rowPos[r] + minimumValueForLength(m_grid[r].logicalHeight, 0).round(), 0);
287
287
288
        Row& row = m_grid[r].row;
288
        Row& row = m_grid[r].row;
289
        unsigned totalCols = row.size();
289
        unsigned totalCols = row.size();
- a/Source/WebCore/rendering/RenderText.h -2 / +2 lines
Lines 105-112 public: a/Source/WebCore/rendering/RenderText.h_sec1
105
    virtual LayoutRect selectionRectForRepaint(const RenderLayerModelObject* repaintContainer, bool clipToVisibleContent = true) OVERRIDE;
105
    virtual LayoutRect selectionRectForRepaint(const RenderLayerModelObject* repaintContainer, bool clipToVisibleContent = true) OVERRIDE;
106
    virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0);
106
    virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0);
107
107
108
    virtual LayoutUnit marginLeft() const { return minimumValueForLength(style()->marginLeft(), 0, view()); }
108
    virtual LayoutUnit marginLeft() const { return minimumValueForLength(style()->marginLeft(), 0); }
109
    virtual LayoutUnit marginRight() const { return minimumValueForLength(style()->marginRight(), 0, view()); }
109
    virtual LayoutUnit marginRight() const { return minimumValueForLength(style()->marginRight(), 0); }
110
110
111
    virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const OVERRIDE;
111
    virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const OVERRIDE;
112
112
- a/Source/WebCore/rendering/RenderThemeMacShared.mm -1 / +1 lines
Lines 1093-1099 void RenderThemeMacShared::paintMenuListButtonGradients(RenderObject* o, const P a/Source/WebCore/rendering/RenderThemeMacShared.mm_sec1
1093
1093
1094
    GraphicsContextStateSaver stateSaver(*paintInfo.context);
1094
    GraphicsContextStateSaver stateSaver(*paintInfo.context);
1095
1095
1096
    RoundedRect border = o->style()->getRoundedBorderFor(r, o->view());
1096
    RoundedRect border = o->style()->getRoundedBorderFor(r, o);
1097
    int radius = border.radii().topLeft().width();
1097
    int radius = border.radii().topLeft().width();
1098
1098
1099
    CGColorSpaceRef cspace = deviceRGBColorSpaceRef();
1099
    CGColorSpaceRef cspace = deviceRGBColorSpaceRef();
- a/Source/WebCore/rendering/RenderWidget.cpp -1 / +1 lines
Lines 305-311 void RenderWidget::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) a/Source/WebCore/rendering/RenderWidget.cpp_sec1
305
305
306
        // Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
306
        // Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
307
        paintInfo.context->save();
307
        paintInfo.context->save();
308
        RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(borderRect,
308
        RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(borderRect, this,
309
            paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true);
309
            paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true);
310
        clipRoundedInnerRect(paintInfo.context, borderRect, roundedInnerRect);
310
        clipRoundedInnerRect(paintInfo.context, borderRect, roundedInnerRect);
311
    }
311
    }
- a/Source/WebCore/rendering/RootInlineBox.cpp -2 / +2 lines
Lines 918-927 LayoutUnit RootInlineBox::verticalPositionForBox(InlineBox* box, VerticalPositio a/Source/WebCore/rendering/RootInlineBox.cpp_sec1
918
            LayoutUnit lineHeight;
918
            LayoutUnit lineHeight;
919
            //Per http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align: 'Percentages: refer to the 'line-height' of the element itself'.
919
            //Per http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align: 'Percentages: refer to the 'line-height' of the element itself'.
920
            if (renderer->style()->verticalAlignLength().isPercent())
920
            if (renderer->style()->verticalAlignLength().isPercent())
921
                lineHeight = renderer->style()->computedLineHeight();
921
                lineHeight = renderer->style()->computedLineHeight(renderer);
922
            else
922
            else
923
                lineHeight = renderer->lineHeight(firstLine, lineDirection);
923
                lineHeight = renderer->lineHeight(firstLine, lineDirection);
924
            verticalPosition -= valueForLength(renderer->style()->verticalAlignLength(), lineHeight, renderer->view());
924
            verticalPosition -= renderer->valueForLength(renderer->style()->verticalAlignLength(), lineHeight);
925
        }
925
        }
926
    }
926
    }
927
927
- a/Source/WebCore/rendering/style/BasicShapes.cpp -21 / +21 lines
Lines 50-64 bool BasicShape::canBlend(const BasicShape* other) const a/Source/WebCore/rendering/style/BasicShapes.cpp_sec1
50
    return true;
50
    return true;
51
}
51
}
52
52
53
void BasicShapeRectangle::path(Path& path, const FloatRect& boundingBox)
53
void BasicShapeRectangle::path(Path& path, const FloatRect& boundingBox, const IntSize& viewportSize)
54
{
54
{
55
    ASSERT(path.isEmpty());
55
    ASSERT(path.isEmpty());
56
    path.addRoundedRect(FloatRect(floatValueForLength(m_x, boundingBox.width()) + boundingBox.x(),
56
    path.addRoundedRect(FloatRect(floatValueForLength(m_x, boundingBox.width(), viewportSize) + boundingBox.x(),
57
                                  floatValueForLength(m_y, boundingBox.height()) + boundingBox.y(),
57
                                  floatValueForLength(m_y, boundingBox.height(), viewportSize) + boundingBox.y(),
58
                                  floatValueForLength(m_width, boundingBox.width()),
58
                                  floatValueForLength(m_width, boundingBox.width(), viewportSize),
59
                                  floatValueForLength(m_height, boundingBox.height())),
59
                                  floatValueForLength(m_height, boundingBox.height(), viewportSize)),
60
                        FloatSize(m_cornerRadiusX.isUndefined() ? 0 : floatValueForLength(m_cornerRadiusX, boundingBox.width()),
60
                        FloatSize(m_cornerRadiusX.isUndefined() ? 0 : floatValueForLength(m_cornerRadiusX, boundingBox.width(), viewportSize),
61
                                  m_cornerRadiusY.isUndefined() ? 0 : floatValueForLength(m_cornerRadiusY, boundingBox.height())));
61
                                  m_cornerRadiusY.isUndefined() ? 0 : floatValueForLength(m_cornerRadiusY, boundingBox.height(), viewportSize)));
62
}
62
}
63
63
64
PassRefPtr<BasicShape> BasicShapeRectangle::blend(const BasicShape* other, double progress) const
64
PassRefPtr<BasicShape> BasicShapeRectangle::blend(const BasicShape* other, double progress) const
Lines 78-90 PassRefPtr<BasicShape> BasicShapeRectangle::blend(const BasicShape* other, doubl a/Source/WebCore/rendering/style/BasicShapes.cpp_sec2
78
    return result.release();
78
    return result.release();
79
}
79
}
80
80
81
void BasicShapeCircle::path(Path& path, const FloatRect& boundingBox)
81
void BasicShapeCircle::path(Path& path, const FloatRect& boundingBox, const IntSize& viewportSize)
82
{
82
{
83
    ASSERT(path.isEmpty());
83
    ASSERT(path.isEmpty());
84
    float diagonal = sqrtf((boundingBox.width() * boundingBox.width() + boundingBox.height() * boundingBox.height()) / 2);
84
    float diagonal = sqrtf((boundingBox.width() * boundingBox.width() + boundingBox.height() * boundingBox.height()) / 2);
85
    float centerX = floatValueForLength(m_centerX, boundingBox.width());
85
    float centerX = floatValueForLength(m_centerX, boundingBox.width(), viewportSize);
86
    float centerY = floatValueForLength(m_centerY, boundingBox.height());
86
    float centerY = floatValueForLength(m_centerY, boundingBox.height(), viewportSize);
87
    float radius = floatValueForLength(m_radius, diagonal);
87
    float radius = floatValueForLength(m_radius, diagonal, viewportSize);
88
    path.addEllipse(FloatRect(centerX - radius + boundingBox.x(),
88
    path.addEllipse(FloatRect(centerX - radius + boundingBox.x(),
89
                              centerY - radius + boundingBox.y(),
89
                              centerY - radius + boundingBox.y(),
90
                              radius * 2,
90
                              radius * 2,
Lines 103-115 PassRefPtr<BasicShape> BasicShapeCircle::blend(const BasicShape* other, double p a/Source/WebCore/rendering/style/BasicShapes.cpp_sec3
103
    return result.release();
103
    return result.release();
104
}
104
}
105
105
106
void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox)
106
void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox, const IntSize& viewportSize)
107
{
107
{
108
    ASSERT(path.isEmpty());
108
    ASSERT(path.isEmpty());
109
    float centerX = floatValueForLength(m_centerX, boundingBox.width());
109
    float centerX = floatValueForLength(m_centerX, boundingBox.width(), viewportSize);
110
    float centerY = floatValueForLength(m_centerY, boundingBox.height());
110
    float centerY = floatValueForLength(m_centerY, boundingBox.height(), viewportSize);
111
    float radiusX = floatValueForLength(m_radiusX, boundingBox.width());
111
    float radiusX = floatValueForLength(m_radiusX, boundingBox.width(), viewportSize);
112
    float radiusY = floatValueForLength(m_radiusY, boundingBox.height());
112
    float radiusY = floatValueForLength(m_radiusY, boundingBox.height(), viewportSize);
113
    path.addEllipse(FloatRect(centerX - radiusX + boundingBox.x(),
113
    path.addEllipse(FloatRect(centerX - radiusX + boundingBox.x(),
114
                              centerY - radiusY + boundingBox.y(),
114
                              centerY - radiusY + boundingBox.y(),
115
                              radiusX * 2,
115
                              radiusX * 2,
Lines 129-135 PassRefPtr<BasicShape> BasicShapeEllipse::blend(const BasicShape* other, double a/Source/WebCore/rendering/style/BasicShapes.cpp_sec4
129
    return result.release();
129
    return result.release();
130
}
130
}
131
131
132
void BasicShapePolygon::path(Path& path, const FloatRect& boundingBox)
132
void BasicShapePolygon::path(Path& path, const FloatRect& boundingBox, const IntSize& viewportSize)
133
{
133
{
134
    ASSERT(path.isEmpty());
134
    ASSERT(path.isEmpty());
135
    ASSERT(!(m_values.size() % 2));
135
    ASSERT(!(m_values.size() % 2));
Lines 138-148 void BasicShapePolygon::path(Path& path, const FloatRect& boundingBox) a/Source/WebCore/rendering/style/BasicShapes.cpp_sec5
138
    if (!length)
138
    if (!length)
139
        return;
139
        return;
140
140
141
    path.moveTo(FloatPoint(floatValueForLength(m_values.at(0), boundingBox.width()) + boundingBox.x(),
141
    path.moveTo(FloatPoint(floatValueForLength(m_values.at(0), boundingBox.width(), viewportSize) + boundingBox.x(),
142
        floatValueForLength(m_values.at(1), boundingBox.height()) + boundingBox.y()));
142
        floatValueForLength(m_values.at(1), boundingBox.height(), viewportSize) + boundingBox.y()));
143
    for (size_t i = 2; i < length; i = i + 2) {
143
    for (size_t i = 2; i < length; i = i + 2) {
144
        path.addLineTo(FloatPoint(floatValueForLength(m_values.at(i), boundingBox.width()) + boundingBox.x(),
144
        path.addLineTo(FloatPoint(floatValueForLength(m_values.at(i), boundingBox.width(), viewportSize) + boundingBox.x(),
145
            floatValueForLength(m_values.at(i + 1), boundingBox.height()) + boundingBox.y()));
145
            floatValueForLength(m_values.at(i + 1), boundingBox.height(), viewportSize) + boundingBox.y()));
146
    }
146
    }
147
    path.closeSubpath();
147
    path.closeSubpath();
148
}
148
}
- a/Source/WebCore/rendering/style/BasicShapes.h -5 / +5 lines
Lines 54-60 public: a/Source/WebCore/rendering/style/BasicShapes.h_sec1
54
54
55
    bool canBlend(const BasicShape*) const;
55
    bool canBlend(const BasicShape*) const;
56
56
57
    virtual void path(Path&, const FloatRect&) = 0;
57
    virtual void path(Path&, const FloatRect&, const IntSize& viewportSize) = 0;
58
    virtual WindRule windRule() const { return RULE_NONZERO; }
58
    virtual WindRule windRule() const { return RULE_NONZERO; }
59
    virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const = 0;
59
    virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const = 0;
60
60
Lines 81-87 public: a/Source/WebCore/rendering/style/BasicShapes.h_sec2
81
    void setCornerRadiusX(Length radiusX) { m_cornerRadiusX = radiusX; }
81
    void setCornerRadiusX(Length radiusX) { m_cornerRadiusX = radiusX; }
82
    void setCornerRadiusY(Length radiusY) { m_cornerRadiusY = radiusY; }
82
    void setCornerRadiusY(Length radiusY) { m_cornerRadiusY = radiusY; }
83
83
84
    virtual void path(Path&, const FloatRect&) OVERRIDE;
84
    virtual void path(Path&, const FloatRect&, const IntSize& viewportSize) OVERRIDE;
85
    virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
85
    virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
86
86
87
    virtual Type type() const { return BASIC_SHAPE_RECTANGLE; }
87
    virtual Type type() const { return BASIC_SHAPE_RECTANGLE; }
Lines 111-117 public: a/Source/WebCore/rendering/style/BasicShapes.h_sec3
111
    void setCenterY(Length centerY) { m_centerY = centerY; }
111
    void setCenterY(Length centerY) { m_centerY = centerY; }
112
    void setRadius(Length radius) { m_radius = radius; }
112
    void setRadius(Length radius) { m_radius = radius; }
113
113
114
    virtual void path(Path&, const FloatRect&) OVERRIDE;
114
    virtual void path(Path&, const FloatRect&, const IntSize& viewportSize) OVERRIDE;
115
    virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
115
    virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
116
116
117
    virtual Type type() const { return BASIC_SHAPE_CIRCLE; }
117
    virtual Type type() const { return BASIC_SHAPE_CIRCLE; }
Lines 137-143 public: a/Source/WebCore/rendering/style/BasicShapes.h_sec4
137
    void setRadiusX(Length radiusX) { m_radiusX = radiusX; }
137
    void setRadiusX(Length radiusX) { m_radiusX = radiusX; }
138
    void setRadiusY(Length radiusY) { m_radiusY = radiusY; }
138
    void setRadiusY(Length radiusY) { m_radiusY = radiusY; }
139
139
140
    virtual void path(Path&, const FloatRect&) OVERRIDE;
140
    virtual void path(Path&, const FloatRect&, const IntSize& viewportSize) OVERRIDE;
141
    virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
141
    virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
142
142
143
    virtual Type type() const { return BASIC_SHAPE_ELLIPSE; } 
143
    virtual Type type() const { return BASIC_SHAPE_ELLIPSE; } 
Lines 161-167 public: a/Source/WebCore/rendering/style/BasicShapes.h_sec5
161
    void setWindRule(WindRule windRule) { m_windRule = windRule; }
161
    void setWindRule(WindRule windRule) { m_windRule = windRule; }
162
    void appendPoint(Length x, Length y) { m_values.append(x); m_values.append(y); }
162
    void appendPoint(Length x, Length y) { m_values.append(x); m_values.append(y); }
163
163
164
    virtual void path(Path&, const FloatRect&) OVERRIDE;
164
    virtual void path(Path&, const FloatRect&, const IntSize& viewportSize) OVERRIDE;
165
    virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
165
    virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
166
166
167
    virtual WindRule windRule() const { return m_windRule; }
167
    virtual WindRule windRule() const { return m_windRule; }
- a/Source/WebCore/rendering/style/RenderStyle.cpp -29 / +34 lines
Lines 31-36 a/Source/WebCore/rendering/style/RenderStyle.cpp_sec1
31
#include "QuotesData.h"
31
#include "QuotesData.h"
32
#include "RenderArena.h"
32
#include "RenderArena.h"
33
#include "RenderObject.h"
33
#include "RenderObject.h"
34
#include "RenderView.h"
34
#include "ScaleTransformOperation.h"
35
#include "ScaleTransformOperation.h"
35
#include "ShadowData.h"
36
#include "ShadowData.h"
36
#include "StyleImage.h"
37
#include "StyleImage.h"
Lines 855-861 inline bool requireTransformOrigin(const Vector<RefPtr<TransformOperation> >& tr a/Source/WebCore/rendering/style/RenderStyle.cpp_sec2
855
    return false;
856
    return false;
856
}
857
}
857
858
858
void RenderStyle::applyTransform(TransformationMatrix& transform, const LayoutSize& borderBoxSize, ApplyTransformOrigin applyOrigin) const
859
void RenderStyle::applyTransform(TransformationMatrix& transform, const LayoutSize& borderBoxSize, const RenderObject* renderer, ApplyTransformOrigin applyOrigin) const
859
{
860
{
860
    // FIXME: when subpixel layout is supported (bug 71143) the body of this function could be replaced by
861
    // FIXME: when subpixel layout is supported (bug 71143) the body of this function could be replaced by
861
    // applyTransform(transform, FloatRect(FloatPoint(), borderBoxSize), applyOrigin);
862
    // applyTransform(transform, FloatRect(FloatPoint(), borderBoxSize), applyOrigin);
Lines 864-880 void RenderStyle::applyTransform(TransformationMatrix& transform, const LayoutSi a/Source/WebCore/rendering/style/RenderStyle.cpp_sec3
864
    bool applyTransformOrigin = requireTransformOrigin(transformOperations, applyOrigin);
865
    bool applyTransformOrigin = requireTransformOrigin(transformOperations, applyOrigin);
865
866
866
    if (applyTransformOrigin)
867
    if (applyTransformOrigin)
867
        transform.translate3d(floatValueForLength(transformOriginX(), borderBoxSize.width()), floatValueForLength(transformOriginY(), borderBoxSize.height()), transformOriginZ());
868
        transform.translate3d(renderer->floatValueForLength(transformOriginX(), borderBoxSize.width()), renderer->floatValueForLength(transformOriginY(), borderBoxSize.height()), transformOriginZ());
869
870
    const IntSize& viewportSize = renderer->view()->viewportSize();
868
871
869
    unsigned size = transformOperations.size();
872
    unsigned size = transformOperations.size();
870
    for (unsigned i = 0; i < size; ++i)
873
    for (unsigned i = 0; i < size; ++i)
871
        transformOperations[i]->apply(transform, borderBoxSize);
874
        transformOperations[i]->apply(transform, borderBoxSize, viewportSize);
872
875
873
    if (applyTransformOrigin)
876
    if (applyTransformOrigin)
874
        transform.translate3d(-floatValueForLength(transformOriginX(), borderBoxSize.width()), -floatValueForLength(transformOriginY(), borderBoxSize.height()), -transformOriginZ()); 
877
        transform.translate3d(-renderer->floatValueForLength(transformOriginX(), borderBoxSize.width()), -renderer->floatValueForLength(transformOriginY(), borderBoxSize.height()), -transformOriginZ()); 
875
}
878
}
876
879
877
void RenderStyle::applyTransform(TransformationMatrix& transform, const FloatRect& boundingBox, ApplyTransformOrigin applyOrigin) const
880
void RenderStyle::applyTransform(TransformationMatrix& transform, const FloatRect& boundingBox, const RenderObject* renderer, ApplyTransformOrigin applyOrigin) const
878
{
881
{
879
    const Vector<RefPtr<TransformOperation> >& transformOperations = rareNonInheritedData->m_transform->m_operations.operations();
882
    const Vector<RefPtr<TransformOperation> >& transformOperations = rareNonInheritedData->m_transform->m_operations.operations();
880
    bool applyTransformOrigin = requireTransformOrigin(transformOperations, applyOrigin);
883
    bool applyTransformOrigin = requireTransformOrigin(transformOperations, applyOrigin);
Lines 883-900 void RenderStyle::applyTransform(TransformationMatrix& transform, const FloatRec a/Source/WebCore/rendering/style/RenderStyle.cpp_sec4
883
    float offsetY = transformOriginY().type() == Percent ? boundingBox.y() : 0;
886
    float offsetY = transformOriginY().type() == Percent ? boundingBox.y() : 0;
884
    
887
    
885
    if (applyTransformOrigin) {
888
    if (applyTransformOrigin) {
886
        transform.translate3d(floatValueForLength(transformOriginX(), boundingBox.width()) + offsetX,
889
        transform.translate3d(renderer->floatValueForLength(transformOriginX(), boundingBox.width()) + offsetX,
887
                              floatValueForLength(transformOriginY(), boundingBox.height()) + offsetY,
890
                              renderer->floatValueForLength(transformOriginY(), boundingBox.height()) + offsetY,
888
                              transformOriginZ());
891
                              transformOriginZ());
889
    }
892
    }
890
    
893
894
    const IntSize& viewportSize = renderer->view()->viewportSize();
895
891
    unsigned size = transformOperations.size();
896
    unsigned size = transformOperations.size();
892
    for (unsigned i = 0; i < size; ++i)
897
    for (unsigned i = 0; i < size; ++i)
893
        transformOperations[i]->apply(transform, boundingBox.size());
898
        transformOperations[i]->apply(transform, boundingBox.size(), viewportSize);
894
    
899
    
895
    if (applyTransformOrigin) {
900
    if (applyTransformOrigin) {
896
        transform.translate3d(-floatValueForLength(transformOriginX(), boundingBox.width()) - offsetX,
901
        transform.translate3d(-renderer->floatValueForLength(transformOriginX(), boundingBox.width()) - offsetX,
897
                              -floatValueForLength(transformOriginY(), boundingBox.height()) - offsetY,
902
                              -renderer->floatValueForLength(transformOriginY(), boundingBox.height()) - offsetY,
898
                              -transformOriginZ());
903
                              -transformOriginZ());
899
    }
904
    }
900
}
905
}
Lines 936-952 void RenderStyle::setBoxShadow(PassOwnPtr<ShadowData> shadowData, bool add) a/Source/WebCore/rendering/style/RenderStyle.cpp_sec5
936
    rareData->m_boxShadow = shadowData;
941
    rareData->m_boxShadow = shadowData;
937
}
942
}
938
943
939
static RoundedRect::Radii calcRadiiFor(const BorderData& border, IntSize size, RenderView* renderView)
944
static RoundedRect::Radii calcRadiiFor(const BorderData& border, IntSize size, const RenderObject* renderer)
940
{
945
{
941
    return RoundedRect::Radii(
946
    return RoundedRect::Radii(
942
        IntSize(valueForLength(border.topLeft().width(), size.width(), renderView), 
947
        IntSize(renderer->valueForLength(border.topLeft().width(), size.width()), 
943
                valueForLength(border.topLeft().height(), size.height(), renderView)),
948
                renderer->valueForLength(border.topLeft().height(), size.height())),
944
        IntSize(valueForLength(border.topRight().width(), size.width(), renderView),
949
        IntSize(renderer->valueForLength(border.topRight().width(), size.width()),
945
                valueForLength(border.topRight().height(), size.height(), renderView)),
950
                renderer->valueForLength(border.topRight().height(), size.height())),
946
        IntSize(valueForLength(border.bottomLeft().width(), size.width(), renderView), 
951
        IntSize(renderer->valueForLength(border.bottomLeft().width(), size.width()), 
947
                valueForLength(border.bottomLeft().height(), size.height(), renderView)),
952
                renderer->valueForLength(border.bottomLeft().height(), size.height())),
948
        IntSize(valueForLength(border.bottomRight().width(), size.width(), renderView), 
953
        IntSize(renderer->valueForLength(border.bottomRight().width(), size.width()), 
949
                valueForLength(border.bottomRight().height(), size.height(), renderView)));
954
                renderer->valueForLength(border.bottomRight().height(), size.height())));
950
}
955
}
951
956
952
static float calcConstraintScaleFor(const IntRect& rect, const RoundedRect::Radii& radii)
957
static float calcConstraintScaleFor(const IntRect& rect, const RoundedRect::Radii& radii)
Lines 998-1016 short RenderStyle::verticalBorderSpacing() const { return inherited->vertical_bo a/Source/WebCore/rendering/style/RenderStyle.cpp_sec6
998
void RenderStyle::setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horizontal_border_spacing, v); }
1003
void RenderStyle::setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horizontal_border_spacing, v); }
999
void RenderStyle::setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertical_border_spacing, v); }
1004
void RenderStyle::setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertical_border_spacing, v); }
1000
1005
1001
RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, RenderView* renderView, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
1006
RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, const RenderObject* renderer, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
1002
{
1007
{
1003
    IntRect snappedBorderRect(pixelSnappedIntRect(borderRect));
1008
    IntRect snappedBorderRect(pixelSnappedIntRect(borderRect));
1004
    RoundedRect roundedRect(snappedBorderRect);
1009
    RoundedRect roundedRect(snappedBorderRect);
1005
    if (hasBorderRadius()) {
1010
    if (hasBorderRadius()) {
1006
        RoundedRect::Radii radii = calcRadiiFor(surround->border, snappedBorderRect.size(), renderView);
1011
        RoundedRect::Radii radii = calcRadiiFor(surround->border, snappedBorderRect.size(), renderer);
1007
        radii.scale(calcConstraintScaleFor(snappedBorderRect, radii));
1012
        radii.scale(calcConstraintScaleFor(snappedBorderRect, radii));
1008
        roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includeLogicalLeftEdge, includeLogicalRightEdge);
1013
        roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includeLogicalLeftEdge, includeLogicalRightEdge);
1009
    }
1014
    }
1010
    return roundedRect;
1015
    return roundedRect;
1011
}
1016
}
1012
1017
1013
RoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
1018
RoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderRect, const RenderObject* renderer, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
1014
{
1019
{
1015
    bool horizontal = isHorizontalWritingMode();
1020
    bool horizontal = isHorizontalWritingMode();
1016
1021
Lines 1019-1028 RoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderRect, a/Source/WebCore/rendering/style/RenderStyle.cpp_sec7
1019
    int topWidth = (horizontal || includeLogicalLeftEdge) ? borderTopWidth() : 0;
1024
    int topWidth = (horizontal || includeLogicalLeftEdge) ? borderTopWidth() : 0;
1020
    int bottomWidth = (horizontal || includeLogicalRightEdge) ? borderBottomWidth() : 0;
1025
    int bottomWidth = (horizontal || includeLogicalRightEdge) ? borderBottomWidth() : 0;
1021
1026
1022
    return getRoundedInnerBorderFor(borderRect, topWidth, bottomWidth, leftWidth, rightWidth, includeLogicalLeftEdge, includeLogicalRightEdge);
1027
    return getRoundedInnerBorderFor(borderRect, renderer, topWidth, bottomWidth, leftWidth, rightWidth, includeLogicalLeftEdge, includeLogicalRightEdge);
1023
}
1028
}
1024
1029
1025
RoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderRect,
1030
RoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderRect, const RenderObject* renderer,
1026
    int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
1031
    int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
1027
{
1032
{
1028
    LayoutRect innerRect(borderRect.x() + leftWidth, 
1033
    LayoutRect innerRect(borderRect.x() + leftWidth, 
Lines 1033-1039 RoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderRect, a/Source/WebCore/rendering/style/RenderStyle.cpp_sec8
1033
    RoundedRect roundedRect(pixelSnappedIntRect(innerRect));
1038
    RoundedRect roundedRect(pixelSnappedIntRect(innerRect));
1034
1039
1035
    if (hasBorderRadius()) {
1040
    if (hasBorderRadius()) {
1036
        RoundedRect::Radii radii = getRoundedBorderFor(borderRect).radii();
1041
        RoundedRect::Radii radii = getRoundedBorderFor(borderRect, renderer).radii();
1037
        radii.shrink(topWidth, bottomWidth, leftWidth, rightWidth);
1042
        radii.shrink(topWidth, bottomWidth, leftWidth, rightWidth);
1038
        roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includeLogicalLeftEdge, includeLogicalRightEdge);
1043
        roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includeLogicalLeftEdge, includeLogicalRightEdge);
1039
    }
1044
    }
Lines 1278-1284 Length RenderStyle::lineHeight() const a/Source/WebCore/rendering/style/RenderStyle.cpp_sec9
1278
}
1283
}
1279
void RenderStyle::setLineHeight(Length specifiedLineHeight) { SET_VAR(inherited, line_height, specifiedLineHeight); }
1284
void RenderStyle::setLineHeight(Length specifiedLineHeight) { SET_VAR(inherited, line_height, specifiedLineHeight); }
1280
1285
1281
int RenderStyle::computedLineHeight(RenderView* renderView) const
1286
int RenderStyle::computedLineHeight(const RenderObject* renderer) const
1282
{
1287
{
1283
    const Length& lh = lineHeight();
1288
    const Length& lh = lineHeight();
1284
1289
Lines 1287-1296 int RenderStyle::computedLineHeight(RenderView* renderView) const a/Source/WebCore/rendering/style/RenderStyle.cpp_sec10
1287
        return fontMetrics().lineSpacing();
1292
        return fontMetrics().lineSpacing();
1288
1293
1289
    if (lh.isPercent())
1294
    if (lh.isPercent())
1290
        return minimumValueForLength(lh, fontSize());
1295
        return renderer->minimumValueForLength(lh, fontSize());
1291
1296
1292
    if (lh.isViewportPercentage())
1297
    if (lh.isViewportPercentage())
1293
        return valueForLength(lh, 0, renderView);
1298
        return renderer->valueForLength(lh, 0);
1294
1299
1295
    return lh.value();
1300
    return lh.value();
1296
}
1301
}
- a/Source/WebCore/rendering/style/RenderStyle.h -6 / +6 lines
Lines 589-595 public: a/Source/WebCore/rendering/style/RenderStyle.h_sec1
589
589
590
    Length specifiedLineHeight() const;
590
    Length specifiedLineHeight() const;
591
    Length lineHeight() const;
591
    Length lineHeight() const;
592
    int computedLineHeight(RenderView* = 0) const;
592
    int computedLineHeight(const RenderObject* renderer) const;
593
593
594
    EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_flags._white_space); }
594
    EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_flags._white_space); }
595
    static bool autoWrap(EWhiteSpace ws)
595
    static bool autoWrap(EWhiteSpace ws)
Lines 863-870 public: a/Source/WebCore/rendering/style/RenderStyle.h_sec2
863
    bool hasTransformRelatedProperty() const { return hasTransform() || preserves3D() || hasPerspective(); }
863
    bool hasTransformRelatedProperty() const { return hasTransform() || preserves3D() || hasPerspective(); }
864
864
865
    enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin };
865
    enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin };
866
    void applyTransform(TransformationMatrix&, const LayoutSize& borderBoxSize, ApplyTransformOrigin = IncludeTransformOrigin) const;
866
    void applyTransform(TransformationMatrix&, const LayoutSize& borderBoxSize, const RenderObject* renderer, ApplyTransformOrigin = IncludeTransformOrigin) const;
867
    void applyTransform(TransformationMatrix&, const FloatRect& boundingBox, ApplyTransformOrigin = IncludeTransformOrigin) const;
867
    void applyTransform(TransformationMatrix&, const FloatRect& boundingBox, const RenderObject* renderer, ApplyTransformOrigin = IncludeTransformOrigin) const;
868
    void setPageScaleTransform(float);
868
    void setPageScaleTransform(float);
869
869
870
    bool hasMask() const { return rareNonInheritedData->m_mask.hasImage() || rareNonInheritedData->m_maskBoxImage.hasImage(); }
870
    bool hasMask() const { return rareNonInheritedData->m_mask.hasImage() || rareNonInheritedData->m_maskBoxImage.hasImage(); }
Lines 1054-1063 public: a/Source/WebCore/rendering/style/RenderStyle.h_sec3
1054
        setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed)));
1054
        setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed)));
1055
    }
1055
    }
1056
    
1056
    
1057
    RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, RenderView* = 0, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
1057
    RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, const RenderObject* renderer, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
1058
    RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
1058
    RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, const RenderObject* renderer, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
1059
1059
1060
    RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect,
1060
    RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, const RenderObject* renderer,
1061
        int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const;
1061
        int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const;
1062
1062
1063
    void setBorderLeftWidth(unsigned v) { SET_VAR(surround, border.m_left.m_width, v); }
1063
    void setBorderLeftWidth(unsigned v) { SET_VAR(surround, border.m_left.m_width, v); }
- a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp -4 / +4 lines
Lines 154-162 bool RenderSVGRoot::isEmbeddedThroughFrameContainingSVGDocument() const a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp_sec1
154
    return frame->document()->isSVGDocument();
154
    return frame->document()->isSVGDocument();
155
}
155
}
156
156
157
static inline LayoutUnit resolveLengthAttributeForSVG(const Length& length, float scale, float maxSize, RenderView* renderView)
157
static inline LayoutUnit resolveLengthAttributeForSVG(const Length& length, float scale, float maxSize, const IntSize& viewportSize)
158
{
158
{
159
    return static_cast<LayoutUnit>(valueForLength(length, maxSize, renderView) * (length.isFixed() ? scale : 1));
159
    return static_cast<LayoutUnit>(valueForLength(length, maxSize, viewportSize) * (length.isFixed() ? scale : 1));
160
}
160
}
161
161
162
LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const
162
LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const
Lines 172-178 LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth(ShouldComputePreferred sho a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp_sec2
172
        return RenderReplaced::computeReplacedLogicalWidth(shouldComputePreferred);
172
        return RenderReplaced::computeReplacedLogicalWidth(shouldComputePreferred);
173
173
174
    if (svg->widthAttributeEstablishesViewport())
174
    if (svg->widthAttributeEstablishesViewport())
175
        return resolveLengthAttributeForSVG(svg->intrinsicWidth(SVGSVGElement::IgnoreCSSProperties), style()->effectiveZoom(), containingBlock()->availableLogicalWidth(), view());
175
        return resolveLengthAttributeForSVG(svg->intrinsicWidth(SVGSVGElement::IgnoreCSSProperties), style()->effectiveZoom(), containingBlock()->availableLogicalWidth(), view()->viewportSize());
176
176
177
    // SVG embedded through object/embed/iframe.
177
    // SVG embedded through object/embed/iframe.
178
    if (isEmbeddedThroughFrameContainingSVGDocument())
178
    if (isEmbeddedThroughFrameContainingSVGDocument())
Lines 206-212 LayoutUnit RenderSVGRoot::computeReplacedLogicalHeight() const a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp_sec3
206
        } else
206
        } else
207
            RenderBlock::removePercentHeightDescendant(const_cast<RenderSVGRoot*>(this));
207
            RenderBlock::removePercentHeightDescendant(const_cast<RenderSVGRoot*>(this));
208
208
209
        return resolveLengthAttributeForSVG(height, style()->effectiveZoom(), containingBlock()->availableLogicalHeight(IncludeMarginBorderPadding), view());
209
        return resolveLengthAttributeForSVG(height, style()->effectiveZoom(), containingBlock()->availableLogicalHeight(IncludeMarginBorderPadding), view()->viewportSize());
210
    }
210
    }
211
211
212
    // SVG embedded through object/embed/iframe.
212
    // SVG embedded through object/embed/iframe.
- a/Source/WebCore/rendering/svg/SVGRenderingContext.cpp -1 / +2 lines
Lines 34-39 a/Source/WebCore/rendering/svg/SVGRenderingContext.cpp_sec1
34
#include "RenderSVGResourceClipper.h"
34
#include "RenderSVGResourceClipper.h"
35
#include "RenderSVGResourceFilter.h"
35
#include "RenderSVGResourceFilter.h"
36
#include "RenderSVGResourceMasker.h"
36
#include "RenderSVGResourceMasker.h"
37
#include "RenderView.h"
37
#include "SVGResources.h"
38
#include "SVGResources.h"
38
#include "SVGResourcesCache.h"
39
#include "SVGResourcesCache.h"
39
40
Lines 127-133 void SVGRenderingContext::prepareToRenderSVGContent(RenderObject* object, PaintI a/Source/WebCore/rendering/svg/SVGRenderingContext.cpp_sec2
127
    ClipPathOperation* clipPathOperation = style->clipPath();
128
    ClipPathOperation* clipPathOperation = style->clipPath();
128
    if (clipPathOperation && clipPathOperation->getOperationType() == ClipPathOperation::SHAPE) {
129
    if (clipPathOperation && clipPathOperation->getOperationType() == ClipPathOperation::SHAPE) {
129
        ShapeClipPathOperation* clipPath = static_cast<ShapeClipPathOperation*>(clipPathOperation);
130
        ShapeClipPathOperation* clipPath = static_cast<ShapeClipPathOperation*>(clipPathOperation);
130
        m_paintInfo->context->clipPath(clipPath->path(object->objectBoundingBox()), clipPath->windRule());
131
        m_paintInfo->context->clipPath(clipPath->path(object->objectBoundingBox(), m_object->view()->viewportSize()), clipPath->windRule());
131
    }
132
    }
132
133
133
    SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(m_object);
134
    SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(m_object);
- a/Source/WebCore/svg/SVGSVGElement.cpp -2 / +2 lines
Lines 579-585 FloatRect SVGSVGElement::currentViewBoxRect() const a/Source/WebCore/svg/SVGSVGElement.cpp_sec1
579
579
580
    // If no viewBox is specified but non-relative width/height values, then we
580
    // If no viewBox is specified but non-relative width/height values, then we
581
    // should always synthesize a viewBox if we're embedded through a SVGImage.    
581
    // should always synthesize a viewBox if we're embedded through a SVGImage.    
582
    return FloatRect(FloatPoint(), FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0)));
582
    return FloatRect(FloatPoint(), FloatSize(floatValueForLength(intrinsicWidth, 0, IntSize()), floatValueForLength(intrinsicHeight, 0, IntSize())));
583
}
583
}
584
584
585
FloatSize SVGSVGElement::currentViewportSize() const
585
FloatSize SVGSVGElement::currentViewportSize() const
Lines 587-593 FloatSize SVGSVGElement::currentViewportSize() const a/Source/WebCore/svg/SVGSVGElement.cpp_sec2
587
    Length intrinsicWidth = this->intrinsicWidth();
587
    Length intrinsicWidth = this->intrinsicWidth();
588
    Length intrinsicHeight = this->intrinsicHeight();
588
    Length intrinsicHeight = this->intrinsicHeight();
589
    if (intrinsicWidth.isFixed() && intrinsicHeight.isFixed())
589
    if (intrinsicWidth.isFixed() && intrinsicHeight.isFixed())
590
        return FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0));
590
        return FloatSize(floatValueForLength(intrinsicWidth, 0, IntSize()), floatValueForLength(intrinsicHeight, 0, IntSize()));
591
591
592
    if (!renderer())
592
    if (!renderer())
593
        return FloatSize();
593
        return FloatSize();
- a/Source/WebCore/svg/SVGStyledTransformableElement.cpp -1 / +1 lines
Lines 71-77 AffineTransform SVGStyledTransformableElement::animatedLocalTransform() const a/Source/WebCore/svg/SVGStyledTransformableElement.cpp_sec1
71
        // Note: objectBoundingBox is an emptyRect for elements like pattern or clipPath.
71
        // Note: objectBoundingBox is an emptyRect for elements like pattern or clipPath.
72
        // See the "Object bounding box units" section of http://dev.w3.org/csswg/css3-transforms/
72
        // See the "Object bounding box units" section of http://dev.w3.org/csswg/css3-transforms/
73
        TransformationMatrix transform;
73
        TransformationMatrix transform;
74
        style->applyTransform(transform, renderer()->objectBoundingBox());
74
        style->applyTransform(transform, renderer()->objectBoundingBox(), renderer());
75
75
76
        // Flatten any 3D transform.
76
        // Flatten any 3D transform.
77
        matrix = transform.toAffineTransform();
77
        matrix = transform.toAffineTransform();
- a/Source/WebCore/svg/SVGTextElement.cpp -1 / +1 lines
Lines 117-123 AffineTransform SVGTextElement::animatedLocalTransform() const a/Source/WebCore/svg/SVGTextElement.cpp_sec1
117
        TransformationMatrix t;
117
        TransformationMatrix t;
118
        // For now, the transform-origin is not taken into account
118
        // For now, the transform-origin is not taken into account
119
        // Also, any percentage values will not be taken into account
119
        // Also, any percentage values will not be taken into account
120
        style->applyTransform(t, IntSize(0, 0), RenderStyle::ExcludeTransformOrigin);
120
        style->applyTransform(t, IntSize(), renderer(), RenderStyle::ExcludeTransformOrigin);
121
        // Flatten any 3D transform
121
        // Flatten any 3D transform
122
        matrix = t.toAffineTransform();
122
        matrix = t.toAffineTransform();
123
    } else
123
    } else
- a/Source/WebCore/svg/graphics/SVGImage.cpp -1 / +1 lines
Lines 265-271 void SVGImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrin a/Source/WebCore/svg/graphics/SVGImage.cpp_sec1
265
265
266
    intrinsicRatio = rootElement->viewBox().size();
266
    intrinsicRatio = rootElement->viewBox().size();
267
    if (intrinsicRatio.isEmpty() && intrinsicWidth.isFixed() && intrinsicHeight.isFixed())
267
    if (intrinsicRatio.isEmpty() && intrinsicWidth.isFixed() && intrinsicHeight.isFixed())
268
        intrinsicRatio = FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0));
268
        intrinsicRatio = FloatSize(floatValueForLength(intrinsicWidth, 0, IntSize()), floatValueForLength(intrinsicHeight, 0, IntSize()));
269
}
269
}
270
270
271
// FIXME: support catchUpIfNecessary.
271
// FIXME: support catchUpIfNecessary.
- a/Source/WebKit/chromium/tests/AnimationTranslationUtilTest.cpp -2 / +2 lines
Lines 45-52 namespace { a/Source/WebKit/chromium/tests/AnimationTranslationUtilTest.cpp_sec1
45
45
46
bool animationCanBeTranslated(const KeyframeValueList& values, Animation* animation)
46
bool animationCanBeTranslated(const KeyframeValueList& values, Animation* animation)
47
{
47
{
48
    IntSize boxSize;
48
    IntSize boxSize, viewportSize;
49
    return createWebAnimation(values, animation, 0, 0, boxSize);
49
    return createWebAnimation(values, animation, 0, 0, boxSize, viewportSize);
50
}
50
}
51
51
52
TEST(AnimationTranslationUtilTest, createOpacityAnimation)
52
TEST(AnimationTranslationUtilTest, createOpacityAnimation)
- a/LayoutTests/ChangeLog +16 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2013-03-11  Timothy Loh  <timloh@chromium.org>
2
3
        viewport units (vw, vh) don't work in CSS transforms
4
        https://bugs.webkit.org/show_bug.cgi?id=91554
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        WIP
9
10
        * css3/calc/simple-calcs-expected.txt:
11
        * css3/calc/simple-calcs-prefixed-expected.txt:
12
        * css3/calc/simple-calcs-prefixed.html:
13
        * css3/calc/simple-calcs.html:
14
        * transforms/2d/transform-2d-expected.txt:
15
        * transforms/2d/transform-2d.html:
16
1
2013-03-09  Sheriff Bot  <webkit.review.bot@gmail.com>
17
2013-03-09  Sheriff Bot  <webkit.review.bot@gmail.com>
2
18
3
        Unreviewed, rolling out r145299.
19
        Unreviewed, rolling out r145299.
- a/LayoutTests/css3/calc/simple-calcs-expected.txt +5 lines
Lines 44-46 control => PASS a/LayoutTests/css3/calc/simple-calcs-expected.txt_sec1
44
(((((((100px))))))) => PASS
44
(((((((100px))))))) => PASS
45
100px => PASS
45
100px => PASS
46
100% * 2 => PASS
46
100% * 2 => PASS
47
12.5vw => PASS
48
20vh - 20px => PASS
49
10vmax + 20px => PASS
50
50vmin / 3 => PASS
51
(4vw + 3vh)*2 => PASS
- a/LayoutTests/css3/calc/simple-calcs-prefixed-expected.txt +5 lines
Lines 46-48 control => PASS a/LayoutTests/css3/calc/simple-calcs-prefixed-expected.txt_sec1
46
(((((((100px))))))) => PASS
46
(((((((100px))))))) => PASS
47
100px => PASS
47
100px => PASS
48
100% * 2 => PASS
48
100% * 2 => PASS
49
12.5vw => PASS
50
20vh - 20px => PASS
51
10vmax + 20px => PASS
52
50vmin / 3 => PASS
53
(4vw + 3vh)*2 => PASS
- a/LayoutTests/css3/calc/simple-calcs-prefixed.html +5 lines
Lines 85-90 a/LayoutTests/css3/calc/simple-calcs-prefixed.html_sec1
85
<div style="height: 50px; background-color: white;" class="wrapper">
85
<div style="height: 50px; background-color: white;" class="wrapper">
86
  <div class="height-test" style="height: -webkit-calc(100% * 2);">100% * 2</div>
86
  <div class="height-test" style="height: -webkit-calc(100% * 2);">100% * 2</div>
87
</div>
87
</div>
88
<div class="width-test" style="width: -webkit-calc(12.5vw);">12.5vw</div>
89
<div class="width-test" style="width: -webkit-calc(20vh - 20px);">20vh - 20px</div>
90
<div class="width-test" style="width: -webkit-calc(10vmax + 20px);">10vmax + 20px</div>
91
<div class="width-test" style="width: -webkit-calc(50vmin / 3);">50vmin / 3</div>
92
<div class="width-test" style="width: -webkit-calc((4vw + 3vh)*2);">(4vw + 3vh)*2</div>
88
</div>
93
</div>
89
94
90
<script>
95
<script>
- a/LayoutTests/css3/calc/simple-calcs.html +5 lines
Lines 82-87 a/LayoutTests/css3/calc/simple-calcs.html_sec1
82
<div style="height: 50px; background-color: white;" class="wrapper">
82
<div style="height: 50px; background-color: white;" class="wrapper">
83
  <div class="height-test" style="height: calc(100% * 2);">100% * 2</div>
83
  <div class="height-test" style="height: calc(100% * 2);">100% * 2</div>
84
</div>
84
</div>
85
<div class="width-test" style="width: -webkit-calc(12.5vw);">12.5vw</div>
86
<div class="width-test" style="width: -webkit-calc(20vh - 20px);">20vh - 20px</div>
87
<div class="width-test" style="width: -webkit-calc(10vmax + 20px);">10vmax + 20px</div>
88
<div class="width-test" style="width: -webkit-calc(50vmin / 3);">50vmin / 3</div>
89
<div class="width-test" style="width: -webkit-calc((4vw + 3vh)*2);">(4vw + 3vh)*2</div>
85
</div>
90
</div>
86
91
87
<script>
92
<script>
- a/LayoutTests/transforms/2d/transform-2d-expected.txt +3 lines
Lines 3-13 transform "" expected "matrix(5.96046e-08, 1, -1, 5.96046e-08, 0, 0)" : PASS a/LayoutTests/transforms/2d/transform-2d-expected.txt_sec1
3
transform "inherit" expected "none" : PASS
3
transform "inherit" expected "none" : PASS
4
transform "translate(80px, 90px)" expected "matrix(1, 0, 0, 1, 80, 90)" : PASS
4
transform "translate(80px, 90px)" expected "matrix(1, 0, 0, 1, 80, 90)" : PASS
5
transform "translate(100%, 3em)" expected "matrix(1, 0, 0, 1, 200, 48)" : PASS
5
transform "translate(100%, 3em)" expected "matrix(1, 0, 0, 1, 200, 48)" : PASS
6
transform "translate(30vw, -60vh)" expected "matrix(1, 0, 0, 1, 240, -360)" : PASS
6
transform "translate(50px)" expected "matrix(1, 0, 0, 1, 50, 0)" : PASS
7
transform "translate(50px)" expected "matrix(1, 0, 0, 1, 50, 0)" : PASS
7
transform "translatex(-20px)" expected "matrix(1, 0, 0, 1, -20, 0)" : PASS
8
transform "translatex(-20px)" expected "matrix(1, 0, 0, 1, -20, 0)" : PASS
8
transform "translateX(-20px)" expected "matrix(1, 0, 0, 1, -20, 0)" : PASS
9
transform "translateX(-20px)" expected "matrix(1, 0, 0, 1, -20, 0)" : PASS
10
transform "translateX(20vmax)" expected "matrix(1, 0, 0, 1, 160, 0)" : PASS
9
transform "translatey(23px)" expected "matrix(1, 0, 0, 1, 0, 23)" : PASS
11
transform "translatey(23px)" expected "matrix(1, 0, 0, 1, 0, 23)" : PASS
10
transform "translateY(-3em)" expected "matrix(1, 0, 0, 1, 0, -48)" : PASS
12
transform "translateY(-3em)" expected "matrix(1, 0, 0, 1, 0, -48)" : PASS
13
transform "translateY(20vmin)" expected "matrix(1, 0, 0, 1, 0, 120)" : PASS
11
transform "scale(1.2)" expected "matrix(1.2, 0, 0, 1.2, 0, 0)" : PASS
14
transform "scale(1.2)" expected "matrix(1.2, 0, 0, 1.2, 0, 0)" : PASS
12
transform "scalex(1.5)" expected "matrix(1.5, 0, 0, 1, 0, 0)" : PASS
15
transform "scalex(1.5)" expected "matrix(1.5, 0, 0, 1, 0, 0)" : PASS
13
transform "scaleX(1.5)" expected "matrix(1.5, 0, 0, 1, 0, 0)" : PASS
16
transform "scaleX(1.5)" expected "matrix(1.5, 0, 0, 1, 0, 0)" : PASS
- a/LayoutTests/transforms/2d/transform-2d.html +3 lines
Lines 38-48 a/LayoutTests/transforms/2d/transform-2d.html_sec1
38
      // translate
38
      // translate
39
      { 'transform' : 'translate(80px, 90px)',  'result' : 'matrix(1, 0, 0, 1, 80, 90)' },
39
      { 'transform' : 'translate(80px, 90px)',  'result' : 'matrix(1, 0, 0, 1, 80, 90)' },
40
      { 'transform' : 'translate(100%, 3em)',   'result' : 'matrix(1, 0, 0, 1, 200, 48)' },  // depends on font size
40
      { 'transform' : 'translate(100%, 3em)',   'result' : 'matrix(1, 0, 0, 1, 200, 48)' },  // depends on font size
41
      { 'transform' : 'translate(30vw, -60vh)', 'result' : 'matrix(1, 0, 0, 1, 240, -360)' },
41
      { 'transform' : 'translate(50px)',        'result' : 'matrix(1, 0, 0, 1, 50, 0)' },
42
      { 'transform' : 'translate(50px)',        'result' : 'matrix(1, 0, 0, 1, 50, 0)' },
42
      { 'transform' : 'translatex(-20px)',      'result' : 'matrix(1, 0, 0, 1, -20, 0)' },
43
      { 'transform' : 'translatex(-20px)',      'result' : 'matrix(1, 0, 0, 1, -20, 0)' },
43
      { 'transform' : 'translateX(-20px)',      'result' : 'matrix(1, 0, 0, 1, -20, 0)' },
44
      { 'transform' : 'translateX(-20px)',      'result' : 'matrix(1, 0, 0, 1, -20, 0)' },
45
      { 'transform' : 'translateX(20vmax)',     'result' : 'matrix(1, 0, 0, 1, 160, 0)' },
44
      { 'transform' : 'translatey(23px)',       'result' : 'matrix(1, 0, 0, 1, 0, 23)' },
46
      { 'transform' : 'translatey(23px)',       'result' : 'matrix(1, 0, 0, 1, 0, 23)' },
45
      { 'transform' : 'translateY(-3em)',       'result' : 'matrix(1, 0, 0, 1, 0, -48)' },  // depends on font size
47
      { 'transform' : 'translateY(-3em)',       'result' : 'matrix(1, 0, 0, 1, 0, -48)' },  // depends on font size
48
      { 'transform' : 'translateY(20vmin)',     'result' : 'matrix(1, 0, 0, 1, 0, 120)' },
46
49
47
      // scale
50
      // scale
48
      { 'transform' : 'scale(1.2)',             'result' : 'matrix(1.2, 0, 0, 1.2, 0, 0)' },
51
      { 'transform' : 'scale(1.2)',             'result' : 'matrix(1.2, 0, 0, 1.2, 0, 0)' },

Return to Bug 91554