author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 12 Mar 2010 15:46:37 +0200 | |
branch | RCL_3 |
changeset 5 | d3bac044e0f0 |
parent 3 | 41300fa6a67c |
child 30 | 5dc02b23752f |
permissions | -rw-r--r-- |
0 | 1 |
/* |
2 |
* Copyright (C) 2004 Zack Rusin <zack@kde.org> |
|
3 |
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
|
4 |
* Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
|
5 |
* Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
|
6 |
* |
|
7 |
* This library is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU Lesser General Public |
|
9 |
* License as published by the Free Software Foundation; either |
|
10 |
* version 2 of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This library is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
15 |
* Lesser General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU Lesser General Public |
|
18 |
* License along with this library; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 |
* 02110-1301 USA |
|
21 |
*/ |
|
22 |
||
23 |
#include "config.h" |
|
24 |
#include "CSSComputedStyleDeclaration.h" |
|
25 |
||
26 |
#include "AnimationController.h" |
|
27 |
#include "CSSBorderImageValue.h" |
|
28 |
#include "CSSMutableStyleDeclaration.h" |
|
29 |
#include "CSSPrimitiveValue.h" |
|
30 |
#include "CSSPrimitiveValueMappings.h" |
|
31 |
#include "CSSProperty.h" |
|
32 |
#include "CSSPropertyNames.h" |
|
33 |
#include "CSSReflectValue.h" |
|
34 |
#include "CSSTimingFunctionValue.h" |
|
35 |
#include "CSSValueList.h" |
|
36 |
#include "CachedImage.h" |
|
37 |
#include "Document.h" |
|
38 |
#include "ExceptionCode.h" |
|
39 |
#include "Pair.h" |
|
40 |
#include "Rect.h" |
|
41 |
#include "RenderBox.h" |
|
42 |
#include "RenderLayer.h" |
|
43 |
#include "ShadowValue.h" |
|
44 |
#include "WebKitCSSTransformValue.h" |
|
45 |
||
46 |
#if ENABLE(DASHBOARD_SUPPORT) |
|
47 |
#include "DashboardRegion.h" |
|
48 |
#endif |
|
49 |
||
50 |
namespace WebCore { |
|
51 |
||
52 |
// List of all properties we know how to compute, omitting shorthands. |
|
53 |
static const int computedProperties[] = { |
|
54 |
CSSPropertyBackgroundAttachment, |
|
55 |
CSSPropertyBackgroundClip, |
|
56 |
CSSPropertyBackgroundColor, |
|
57 |
CSSPropertyBackgroundImage, |
|
58 |
CSSPropertyBackgroundOrigin, |
|
59 |
CSSPropertyBackgroundPosition, // more-specific background-position-x/y are non-standard |
|
60 |
CSSPropertyBackgroundRepeat, |
|
61 |
CSSPropertyBackgroundSize, |
|
62 |
CSSPropertyBorderBottomColor, |
|
63 |
CSSPropertyBorderBottomLeftRadius, |
|
64 |
CSSPropertyBorderBottomRightRadius, |
|
65 |
CSSPropertyBorderBottomStyle, |
|
66 |
CSSPropertyBorderBottomWidth, |
|
67 |
CSSPropertyBorderCollapse, |
|
68 |
CSSPropertyBorderLeftColor, |
|
69 |
CSSPropertyBorderLeftStyle, |
|
70 |
CSSPropertyBorderLeftWidth, |
|
71 |
CSSPropertyBorderRightColor, |
|
72 |
CSSPropertyBorderRightStyle, |
|
73 |
CSSPropertyBorderRightWidth, |
|
74 |
CSSPropertyBorderTopColor, |
|
75 |
CSSPropertyBorderTopLeftRadius, |
|
76 |
CSSPropertyBorderTopRightRadius, |
|
77 |
CSSPropertyBorderTopStyle, |
|
78 |
CSSPropertyBorderTopWidth, |
|
79 |
CSSPropertyBottom, |
|
80 |
CSSPropertyCaptionSide, |
|
81 |
CSSPropertyClear, |
|
82 |
CSSPropertyClip, |
|
83 |
CSSPropertyColor, |
|
84 |
CSSPropertyCursor, |
|
85 |
CSSPropertyDirection, |
|
86 |
CSSPropertyDisplay, |
|
87 |
CSSPropertyEmptyCells, |
|
88 |
CSSPropertyFloat, |
|
89 |
CSSPropertyFontFamily, |
|
90 |
CSSPropertyFontSize, |
|
91 |
CSSPropertyFontStyle, |
|
92 |
CSSPropertyFontVariant, |
|
93 |
CSSPropertyFontWeight, |
|
94 |
CSSPropertyHeight, |
|
95 |
CSSPropertyLeft, |
|
96 |
CSSPropertyLetterSpacing, |
|
97 |
CSSPropertyLineHeight, |
|
98 |
CSSPropertyListStyleImage, |
|
99 |
CSSPropertyListStylePosition, |
|
100 |
CSSPropertyListStyleType, |
|
101 |
CSSPropertyMarginBottom, |
|
102 |
CSSPropertyMarginLeft, |
|
103 |
CSSPropertyMarginRight, |
|
104 |
CSSPropertyMarginTop, |
|
105 |
CSSPropertyMaxHeight, |
|
106 |
CSSPropertyMaxWidth, |
|
107 |
CSSPropertyMinHeight, |
|
108 |
CSSPropertyMinWidth, |
|
109 |
CSSPropertyOpacity, |
|
110 |
CSSPropertyOrphans, |
|
111 |
CSSPropertyOutlineColor, |
|
112 |
CSSPropertyOutlineStyle, |
|
113 |
CSSPropertyOutlineWidth, |
|
114 |
CSSPropertyOverflowX, |
|
115 |
CSSPropertyOverflowY, |
|
116 |
CSSPropertyPaddingBottom, |
|
117 |
CSSPropertyPaddingLeft, |
|
118 |
CSSPropertyPaddingRight, |
|
119 |
CSSPropertyPaddingTop, |
|
120 |
CSSPropertyPageBreakAfter, |
|
121 |
CSSPropertyPageBreakBefore, |
|
122 |
CSSPropertyPageBreakInside, |
|
123 |
CSSPropertyPointerEvents, |
|
124 |
CSSPropertyPosition, |
|
125 |
CSSPropertyResize, |
|
126 |
CSSPropertyRight, |
|
127 |
CSSPropertyTableLayout, |
|
128 |
CSSPropertyTextAlign, |
|
129 |
CSSPropertyTextDecoration, |
|
130 |
CSSPropertyTextIndent, |
|
131 |
CSSPropertyTextRendering, |
|
132 |
CSSPropertyTextShadow, |
|
133 |
CSSPropertyTextOverflow, |
|
134 |
CSSPropertyTextTransform, |
|
135 |
CSSPropertyTop, |
|
136 |
CSSPropertyUnicodeBidi, |
|
137 |
CSSPropertyVerticalAlign, |
|
138 |
CSSPropertyVisibility, |
|
139 |
CSSPropertyWhiteSpace, |
|
140 |
CSSPropertyWidows, |
|
141 |
CSSPropertyWidth, |
|
142 |
CSSPropertyWordBreak, |
|
143 |
CSSPropertyWordSpacing, |
|
144 |
CSSPropertyWordWrap, |
|
145 |
CSSPropertyZIndex, |
|
146 |
CSSPropertyZoom, |
|
147 |
||
148 |
CSSPropertyWebkitAnimationDelay, |
|
149 |
CSSPropertyWebkitAnimationDirection, |
|
150 |
CSSPropertyWebkitAnimationDuration, |
|
151 |
CSSPropertyWebkitAnimationIterationCount, |
|
152 |
CSSPropertyWebkitAnimationName, |
|
153 |
CSSPropertyWebkitAnimationPlayState, |
|
154 |
CSSPropertyWebkitAnimationTimingFunction, |
|
155 |
CSSPropertyWebkitAppearance, |
|
156 |
CSSPropertyWebkitBackfaceVisibility, |
|
157 |
CSSPropertyWebkitBackgroundClip, |
|
158 |
CSSPropertyWebkitBackgroundComposite, |
|
159 |
CSSPropertyWebkitBackgroundOrigin, |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
160 |
CSSPropertyWebkitBackgroundSize, |
0 | 161 |
CSSPropertyWebkitBorderFit, |
162 |
CSSPropertyWebkitBorderHorizontalSpacing, |
|
163 |
CSSPropertyWebkitBorderImage, |
|
164 |
CSSPropertyWebkitBorderVerticalSpacing, |
|
165 |
CSSPropertyWebkitBoxAlign, |
|
166 |
CSSPropertyWebkitBoxDirection, |
|
167 |
CSSPropertyWebkitBoxFlex, |
|
168 |
CSSPropertyWebkitBoxFlexGroup, |
|
169 |
CSSPropertyWebkitBoxLines, |
|
170 |
CSSPropertyWebkitBoxOrdinalGroup, |
|
171 |
CSSPropertyWebkitBoxOrient, |
|
172 |
CSSPropertyWebkitBoxPack, |
|
173 |
CSSPropertyWebkitBoxReflect, |
|
174 |
CSSPropertyWebkitBoxShadow, |
|
175 |
CSSPropertyWebkitBoxSizing, |
|
176 |
CSSPropertyWebkitColumnBreakAfter, |
|
177 |
CSSPropertyWebkitColumnBreakBefore, |
|
178 |
CSSPropertyWebkitColumnBreakInside, |
|
179 |
CSSPropertyWebkitColumnCount, |
|
180 |
CSSPropertyWebkitColumnGap, |
|
181 |
CSSPropertyWebkitColumnRuleColor, |
|
182 |
CSSPropertyWebkitColumnRuleStyle, |
|
183 |
CSSPropertyWebkitColumnRuleWidth, |
|
184 |
CSSPropertyWebkitColumnWidth, |
|
185 |
#if ENABLE(DASHBOARD_SUPPORT) |
|
186 |
CSSPropertyWebkitDashboardRegion, |
|
187 |
#endif |
|
188 |
CSSPropertyWebkitFontSmoothing, |
|
189 |
CSSPropertyWebkitHighlight, |
|
190 |
CSSPropertyWebkitLineBreak, |
|
191 |
CSSPropertyWebkitLineClamp, |
|
192 |
CSSPropertyWebkitMarginBottomCollapse, |
|
193 |
CSSPropertyWebkitMarginTopCollapse, |
|
194 |
CSSPropertyWebkitMarqueeDirection, |
|
195 |
CSSPropertyWebkitMarqueeIncrement, |
|
196 |
CSSPropertyWebkitMarqueeRepetition, |
|
197 |
CSSPropertyWebkitMarqueeStyle, |
|
198 |
CSSPropertyWebkitMaskAttachment, |
|
199 |
CSSPropertyWebkitMaskBoxImage, |
|
200 |
CSSPropertyWebkitMaskClip, |
|
201 |
CSSPropertyWebkitMaskComposite, |
|
202 |
CSSPropertyWebkitMaskImage, |
|
203 |
CSSPropertyWebkitMaskOrigin, |
|
204 |
CSSPropertyWebkitMaskPosition, |
|
205 |
CSSPropertyWebkitMaskRepeat, |
|
206 |
CSSPropertyWebkitMaskSize, |
|
207 |
CSSPropertyWebkitNbspMode, |
|
208 |
CSSPropertyWebkitPerspective, |
|
209 |
CSSPropertyWebkitPerspectiveOrigin, |
|
210 |
CSSPropertyWebkitRtlOrdering, |
|
211 |
CSSPropertyWebkitTextDecorationsInEffect, |
|
212 |
CSSPropertyWebkitTextFillColor, |
|
213 |
CSSPropertyWebkitTextSecurity, |
|
214 |
CSSPropertyWebkitTextStrokeColor, |
|
215 |
CSSPropertyWebkitTextStrokeWidth, |
|
216 |
CSSPropertyWebkitTransform, |
|
217 |
CSSPropertyWebkitTransformOrigin, |
|
218 |
CSSPropertyWebkitTransformStyle, |
|
219 |
CSSPropertyWebkitTransitionDelay, |
|
220 |
CSSPropertyWebkitTransitionDuration, |
|
221 |
CSSPropertyWebkitTransitionProperty, |
|
222 |
CSSPropertyWebkitTransitionTimingFunction, |
|
223 |
CSSPropertyWebkitUserDrag, |
|
224 |
CSSPropertyWebkitUserModify, |
|
225 |
CSSPropertyWebkitUserSelect |
|
226 |
||
227 |
#if ENABLE(SVG) |
|
228 |
, |
|
229 |
CSSPropertyClipPath, |
|
230 |
CSSPropertyClipRule, |
|
231 |
CSSPropertyMask, |
|
232 |
CSSPropertyFilter, |
|
233 |
CSSPropertyFloodColor, |
|
234 |
CSSPropertyFloodOpacity, |
|
235 |
CSSPropertyLightingColor, |
|
236 |
CSSPropertyStopColor, |
|
237 |
CSSPropertyStopOpacity, |
|
238 |
CSSPropertyColorInterpolation, |
|
239 |
CSSPropertyColorInterpolationFilters, |
|
240 |
CSSPropertyColorRendering, |
|
241 |
CSSPropertyFill, |
|
242 |
CSSPropertyFillOpacity, |
|
243 |
CSSPropertyFillRule, |
|
244 |
CSSPropertyImageRendering, |
|
245 |
CSSPropertyMarkerEnd, |
|
246 |
CSSPropertyMarkerMid, |
|
247 |
CSSPropertyMarkerStart, |
|
248 |
CSSPropertyShapeRendering, |
|
249 |
CSSPropertyStroke, |
|
250 |
CSSPropertyStrokeDasharray, |
|
251 |
CSSPropertyStrokeDashoffset, |
|
252 |
CSSPropertyStrokeLinecap, |
|
253 |
CSSPropertyStrokeLinejoin, |
|
254 |
CSSPropertyStrokeMiterlimit, |
|
255 |
CSSPropertyStrokeOpacity, |
|
256 |
CSSPropertyStrokeWidth, |
|
257 |
CSSPropertyAlignmentBaseline, |
|
258 |
CSSPropertyBaselineShift, |
|
259 |
CSSPropertyDominantBaseline, |
|
260 |
CSSPropertyKerning, |
|
261 |
CSSPropertyTextAnchor, |
|
262 |
CSSPropertyWritingMode, |
|
263 |
CSSPropertyGlyphOrientationHorizontal, |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
264 |
CSSPropertyGlyphOrientationVertical, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
265 |
CSSPropertyWebkitShadow |
0 | 266 |
#endif |
267 |
}; |
|
268 |
||
269 |
const unsigned numComputedProperties = sizeof(computedProperties) / sizeof(computedProperties[0]); |
|
270 |
||
271 |
static int valueForRepeatRule(int rule) |
|
272 |
{ |
|
273 |
switch (rule) { |
|
274 |
case RepeatImageRule: |
|
275 |
return CSSValueRepeat; |
|
276 |
case RoundImageRule: |
|
277 |
return CSSValueRound; |
|
278 |
default: |
|
279 |
return CSSValueStretch; |
|
280 |
} |
|
281 |
} |
|
282 |
||
283 |
static PassRefPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image) |
|
284 |
{ |
|
285 |
if (!image.hasImage()) |
|
286 |
return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
|
287 |
||
288 |
// Image first. |
|
289 |
RefPtr<CSSValue> imageValue; |
|
290 |
if (image.image()) |
|
291 |
imageValue = image.image()->cssValue(); |
|
292 |
||
293 |
// Create the slices. |
|
294 |
RefPtr<CSSPrimitiveValue> top; |
|
295 |
if (image.m_slices.top().isPercent()) |
|
296 |
top = CSSPrimitiveValue::create(image.m_slices.top().value(), CSSPrimitiveValue::CSS_PERCENTAGE); |
|
297 |
else |
|
298 |
top = CSSPrimitiveValue::create(image.m_slices.top().value(), CSSPrimitiveValue::CSS_NUMBER); |
|
299 |
||
300 |
RefPtr<CSSPrimitiveValue> right; |
|
301 |
if (image.m_slices.right().isPercent()) |
|
302 |
right = CSSPrimitiveValue::create(image.m_slices.right().value(), CSSPrimitiveValue::CSS_PERCENTAGE); |
|
303 |
else |
|
304 |
right = CSSPrimitiveValue::create(image.m_slices.right().value(), CSSPrimitiveValue::CSS_NUMBER); |
|
305 |
||
306 |
RefPtr<CSSPrimitiveValue> bottom; |
|
307 |
if (image.m_slices.bottom().isPercent()) |
|
308 |
bottom = CSSPrimitiveValue::create(image.m_slices.bottom().value(), CSSPrimitiveValue::CSS_PERCENTAGE); |
|
309 |
else |
|
310 |
bottom = CSSPrimitiveValue::create(image.m_slices.bottom().value(), CSSPrimitiveValue::CSS_NUMBER); |
|
311 |
||
312 |
RefPtr<CSSPrimitiveValue> left; |
|
313 |
if (image.m_slices.left().isPercent()) |
|
314 |
left = CSSPrimitiveValue::create(image.m_slices.left().value(), CSSPrimitiveValue::CSS_PERCENTAGE); |
|
315 |
else |
|
316 |
left = CSSPrimitiveValue::create(image.m_slices.left().value(), CSSPrimitiveValue::CSS_NUMBER); |
|
317 |
||
318 |
RefPtr<Rect> rect = Rect::create(); |
|
319 |
rect->setTop(top); |
|
320 |
rect->setRight(right); |
|
321 |
rect->setBottom(bottom); |
|
322 |
rect->setLeft(left); |
|
323 |
||
324 |
return CSSBorderImageValue::create(imageValue, rect, valueForRepeatRule(image.m_horizontalRule), valueForRepeatRule(image.m_verticalRule)); |
|
325 |
} |
|
326 |
||
327 |
static PassRefPtr<CSSValue> valueForReflection(const StyleReflection* reflection) |
|
328 |
{ |
|
329 |
if (!reflection) |
|
330 |
return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
|
331 |
||
332 |
RefPtr<CSSPrimitiveValue> offset; |
|
333 |
if (reflection->offset().isPercent()) |
|
334 |
offset = CSSPrimitiveValue::create(reflection->offset().percent(), CSSPrimitiveValue::CSS_PERCENTAGE); |
|
335 |
else |
|
336 |
offset = CSSPrimitiveValue::create(reflection->offset().value(), CSSPrimitiveValue::CSS_PX); |
|
337 |
||
338 |
return CSSReflectValue::create(reflection->direction(), offset.release(), valueForNinePieceImage(reflection->mask())); |
|
339 |
} |
|
340 |
||
341 |
static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, int propertyID) |
|
342 |
{ |
|
343 |
if (!style) |
|
344 |
return 0; |
|
345 |
||
346 |
Length l; |
|
347 |
switch (propertyID) { |
|
348 |
case CSSPropertyLeft: |
|
349 |
l = style->left(); |
|
350 |
break; |
|
351 |
case CSSPropertyRight: |
|
352 |
l = style->right(); |
|
353 |
break; |
|
354 |
case CSSPropertyTop: |
|
355 |
l = style->top(); |
|
356 |
break; |
|
357 |
case CSSPropertyBottom: |
|
358 |
l = style->bottom(); |
|
359 |
break; |
|
360 |
default: |
|
361 |
return 0; |
|
362 |
} |
|
363 |
||
364 |
if (style->position() == AbsolutePosition || style->position() == FixedPosition) |
|
365 |
return CSSPrimitiveValue::create(l); |
|
366 |
||
367 |
if (style->position() == RelativePosition) |
|
368 |
// FIXME: It's not enough to simply return "auto" values for one offset if the other side is defined. |
|
369 |
// In other words if left is auto and right is not auto, then left's computed value is negative right(). |
|
370 |
// So we should get the opposite length unit and see if it is auto. |
|
371 |
return CSSPrimitiveValue::create(l); |
|
372 |
||
373 |
return CSSPrimitiveValue::createIdentifier(CSSValueAuto); |
|
374 |
} |
|
375 |
||
376 |
static PassRefPtr<CSSPrimitiveValue> currentColorOrValidColor(RenderStyle* style, const Color& color) |
|
377 |
{ |
|
378 |
if (!color.isValid()) |
|
379 |
return CSSPrimitiveValue::createColor(style->color().rgb()); |
|
380 |
return CSSPrimitiveValue::createColor(color.rgb()); |
|
381 |
} |
|
382 |
||
383 |
static PassRefPtr<CSSValue> getBorderRadiusCornerValue(IntSize radius) |
|
384 |
{ |
|
385 |
if (radius.width() == radius.height()) |
|
386 |
return CSSPrimitiveValue::create(radius.width(), CSSPrimitiveValue::CSS_PX); |
|
387 |
||
388 |
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
|
389 |
list->append(CSSPrimitiveValue::create(radius.width(), CSSPrimitiveValue::CSS_PX)); |
|
390 |
list->append(CSSPrimitiveValue::create(radius.height(), CSSPrimitiveValue::CSS_PX)); |
|
391 |
return list.release(); |
|
392 |
} |
|
393 |
||
394 |
static IntRect sizingBox(RenderObject* renderer) |
|
395 |
{ |
|
396 |
if (!renderer->isBox()) |
|
397 |
return IntRect(); |
|
398 |
||
399 |
RenderBox* box = toRenderBox(renderer); |
|
400 |
return box->style()->boxSizing() == CONTENT_BOX ? box->contentBoxRect() : box->borderBoxRect(); |
|
401 |
} |
|
402 |
||
403 |
static inline bool hasCompositedLayer(RenderObject* renderer) |
|
404 |
{ |
|
405 |
return renderer && renderer->hasLayer() && toRenderBoxModelObject(renderer)->layer()->isComposited(); |
|
406 |
} |
|
407 |
||
408 |
static PassRefPtr<CSSValue> computedTransform(RenderObject* renderer, const RenderStyle* style) |
|
409 |
{ |
|
410 |
if (!renderer || style->transform().operations().isEmpty()) |
|
411 |
return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
|
412 |
||
413 |
IntRect box = sizingBox(renderer); |
|
414 |
||
415 |
TransformationMatrix transform; |
|
416 |
style->applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOrigin); |
|
417 |
// Note that this does not flatten to an affine transform if ENABLE(3D_RENDERING) is off, by design. |
|
418 |
||
419 |
RefPtr<WebKitCSSTransformValue> transformVal; |
|
420 |
||
421 |
// FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924) |
|
422 |
if (transform.isAffine()) { |
|
423 |
transformVal = WebKitCSSTransformValue::create(WebKitCSSTransformValue::MatrixTransformOperation); |
|
424 |
||
425 |
transformVal->append(CSSPrimitiveValue::create(transform.a(), CSSPrimitiveValue::CSS_NUMBER)); |
|
426 |
transformVal->append(CSSPrimitiveValue::create(transform.b(), CSSPrimitiveValue::CSS_NUMBER)); |
|
427 |
transformVal->append(CSSPrimitiveValue::create(transform.c(), CSSPrimitiveValue::CSS_NUMBER)); |
|
428 |
transformVal->append(CSSPrimitiveValue::create(transform.d(), CSSPrimitiveValue::CSS_NUMBER)); |
|
429 |
transformVal->append(CSSPrimitiveValue::create(transform.e(), CSSPrimitiveValue::CSS_NUMBER)); |
|
430 |
transformVal->append(CSSPrimitiveValue::create(transform.f(), CSSPrimitiveValue::CSS_NUMBER)); |
|
431 |
} else { |
|
432 |
transformVal = WebKitCSSTransformValue::create(WebKitCSSTransformValue::Matrix3DTransformOperation); |
|
433 |
||
434 |
transformVal->append(CSSPrimitiveValue::create(transform.m11(), CSSPrimitiveValue::CSS_NUMBER)); |
|
435 |
transformVal->append(CSSPrimitiveValue::create(transform.m12(), CSSPrimitiveValue::CSS_NUMBER)); |
|
436 |
transformVal->append(CSSPrimitiveValue::create(transform.m13(), CSSPrimitiveValue::CSS_NUMBER)); |
|
437 |
transformVal->append(CSSPrimitiveValue::create(transform.m14(), CSSPrimitiveValue::CSS_NUMBER)); |
|
438 |
||
439 |
transformVal->append(CSSPrimitiveValue::create(transform.m21(), CSSPrimitiveValue::CSS_NUMBER)); |
|
440 |
transformVal->append(CSSPrimitiveValue::create(transform.m22(), CSSPrimitiveValue::CSS_NUMBER)); |
|
441 |
transformVal->append(CSSPrimitiveValue::create(transform.m23(), CSSPrimitiveValue::CSS_NUMBER)); |
|
442 |
transformVal->append(CSSPrimitiveValue::create(transform.m24(), CSSPrimitiveValue::CSS_NUMBER)); |
|
443 |
||
444 |
transformVal->append(CSSPrimitiveValue::create(transform.m31(), CSSPrimitiveValue::CSS_NUMBER)); |
|
445 |
transformVal->append(CSSPrimitiveValue::create(transform.m32(), CSSPrimitiveValue::CSS_NUMBER)); |
|
446 |
transformVal->append(CSSPrimitiveValue::create(transform.m33(), CSSPrimitiveValue::CSS_NUMBER)); |
|
447 |
transformVal->append(CSSPrimitiveValue::create(transform.m34(), CSSPrimitiveValue::CSS_NUMBER)); |
|
448 |
||
449 |
transformVal->append(CSSPrimitiveValue::create(transform.m41(), CSSPrimitiveValue::CSS_NUMBER)); |
|
450 |
transformVal->append(CSSPrimitiveValue::create(transform.m42(), CSSPrimitiveValue::CSS_NUMBER)); |
|
451 |
transformVal->append(CSSPrimitiveValue::create(transform.m43(), CSSPrimitiveValue::CSS_NUMBER)); |
|
452 |
transformVal->append(CSSPrimitiveValue::create(transform.m44(), CSSPrimitiveValue::CSS_NUMBER)); |
|
453 |
} |
|
454 |
||
455 |
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
|
456 |
list->append(transformVal); |
|
457 |
||
458 |
return list.release(); |
|
459 |
} |
|
460 |
||
461 |
static PassRefPtr<CSSValue> getDelayValue(const AnimationList* animList) |
|
462 |
{ |
|
463 |
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
|
464 |
if (animList) { |
|
465 |
for (size_t i = 0; i < animList->size(); ++i) |
|
466 |
list->append(CSSPrimitiveValue::create(animList->animation(i)->delay(), CSSPrimitiveValue::CSS_S)); |
|
467 |
} else { |
|
468 |
// Note that initialAnimationDelay() is used for both transitions and animations |
|
469 |
list->append(CSSPrimitiveValue::create(Animation::initialAnimationDelay(), CSSPrimitiveValue::CSS_S)); |
|
470 |
} |
|
471 |
return list.release(); |
|
472 |
} |
|
473 |
||
474 |
static PassRefPtr<CSSValue> getDurationValue(const AnimationList* animList) |
|
475 |
{ |
|
476 |
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
|
477 |
if (animList) { |
|
478 |
for (size_t i = 0; i < animList->size(); ++i) |
|
479 |
list->append(CSSPrimitiveValue::create(animList->animation(i)->duration(), CSSPrimitiveValue::CSS_S)); |
|
480 |
} else { |
|
481 |
// Note that initialAnimationDuration() is used for both transitions and animations |
|
482 |
list->append(CSSPrimitiveValue::create(Animation::initialAnimationDuration(), CSSPrimitiveValue::CSS_S)); |
|
483 |
} |
|
484 |
return list.release(); |
|
485 |
} |
|
486 |
||
487 |
static PassRefPtr<CSSValue> getTimingFunctionValue(const AnimationList* animList) |
|
488 |
{ |
|
489 |
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
|
490 |
if (animList) { |
|
491 |
for (size_t i = 0; i < animList->size(); ++i) { |
|
492 |
const TimingFunction& tf = animList->animation(i)->timingFunction(); |
|
493 |
list->append(CSSTimingFunctionValue::create(tf.x1(), tf.y1(), tf.x2(), tf.y2())); |
|
494 |
} |
|
495 |
} else { |
|
496 |
// Note that initialAnimationTimingFunction() is used for both transitions and animations |
|
497 |
const TimingFunction& tf = Animation::initialAnimationTimingFunction(); |
|
498 |
list->append(CSSTimingFunctionValue::create(tf.x1(), tf.y1(), tf.x2(), tf.y2())); |
|
499 |
} |
|
500 |
return list.release(); |
|
501 |
} |
|
502 |
||
503 |
CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(PassRefPtr<Node> n) |
|
504 |
: m_node(n) |
|
505 |
{ |
|
506 |
} |
|
507 |
||
508 |
CSSComputedStyleDeclaration::~CSSComputedStyleDeclaration() |
|
509 |
{ |
|
510 |
} |
|
511 |
||
512 |
String CSSComputedStyleDeclaration::cssText() const |
|
513 |
{ |
|
514 |
String result(""); |
|
515 |
||
516 |
for (unsigned i = 0; i < numComputedProperties; i++) { |
|
517 |
if (i) |
|
518 |
result += " "; |
|
519 |
result += getPropertyName(static_cast<CSSPropertyID>(computedProperties[i])); |
|
520 |
result += ": "; |
|
521 |
result += getPropertyValue(computedProperties[i]); |
|
522 |
result += ";"; |
|
523 |
} |
|
524 |
||
525 |
return result; |
|
526 |
} |
|
527 |
||
528 |
void CSSComputedStyleDeclaration::setCssText(const String&, ExceptionCode& ec) |
|
529 |
{ |
|
530 |
ec = NO_MODIFICATION_ALLOWED_ERR; |
|
531 |
} |
|
532 |
||
533 |
static int cssIdentifierForFontSizeKeyword(int keywordSize) |
|
534 |
{ |
|
535 |
ASSERT_ARG(keywordSize, keywordSize); |
|
536 |
ASSERT_ARG(keywordSize, keywordSize <= 8); |
|
537 |
return CSSValueXxSmall + keywordSize - 1; |
|
538 |
} |
|
539 |
||
540 |
PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringKeyword() const |
|
541 |
{ |
|
542 |
Node* node = m_node.get(); |
|
543 |
if (!node) |
|
544 |
return 0; |
|
545 |
||
546 |
node->document()->updateLayoutIgnorePendingStylesheets(); |
|
547 |
||
548 |
RefPtr<RenderStyle> style = node->computedStyle(); |
|
549 |
if (!style) |
|
550 |
return 0; |
|
551 |
||
552 |
if (int keywordSize = style->fontDescription().keywordSize()) |
|
553 |
return CSSPrimitiveValue::createIdentifier(cssIdentifierForFontSizeKeyword(keywordSize)); |
|
554 |
||
555 |
return CSSPrimitiveValue::create(style->fontDescription().computedPixelSize(), CSSPrimitiveValue::CSS_PX); |
|
556 |
} |
|
557 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
558 |
PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const ShadowData* shadow, int id) const |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
559 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
560 |
if (!shadow) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
561 |
return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
562 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
563 |
CSSPropertyID propertyID = static_cast<CSSPropertyID>(id); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
564 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
565 |
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
566 |
for (const ShadowData* s = shadow; s; s = s->next) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
567 |
RefPtr<CSSPrimitiveValue> x = CSSPrimitiveValue::create(s->x, CSSPrimitiveValue::CSS_PX); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
568 |
RefPtr<CSSPrimitiveValue> y = CSSPrimitiveValue::create(s->y, CSSPrimitiveValue::CSS_PX); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
569 |
RefPtr<CSSPrimitiveValue> blur = CSSPrimitiveValue::create(s->blur, CSSPrimitiveValue::CSS_PX); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
570 |
RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? 0 : CSSPrimitiveValue::create(s->spread, CSSPrimitiveValue::CSS_PX); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
571 |
RefPtr<CSSPrimitiveValue> style = propertyID == CSSPropertyTextShadow || s->style == Normal ? 0 : CSSPrimitiveValue::createIdentifier(CSSValueInset); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
572 |
RefPtr<CSSPrimitiveValue> color = CSSPrimitiveValue::createColor(s->color.rgb()); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
573 |
list->prepend(ShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release())); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
574 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
575 |
return list.release(); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
576 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
577 |
|
0 | 578 |
PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int propertyID) const |
579 |
{ |
|
580 |
return getPropertyCSSValue(propertyID, UpdateLayout); |
|
581 |
} |
|
582 |
||
583 |
static int identifierForFamily(const AtomicString& family) |
|
584 |
{ |
|
585 |
DEFINE_STATIC_LOCAL(AtomicString, cursiveFamily, ("-webkit-cursive")); |
|
586 |
DEFINE_STATIC_LOCAL(AtomicString, fantasyFamily, ("-webkit-fantasy")); |
|
587 |
DEFINE_STATIC_LOCAL(AtomicString, monospaceFamily, ("-webkit-monospace")); |
|
588 |
DEFINE_STATIC_LOCAL(AtomicString, sansSerifFamily, ("-webkit-sans-serif")); |
|
589 |
DEFINE_STATIC_LOCAL(AtomicString, serifFamily, ("-webkit-serif")); |
|
590 |
if (family == cursiveFamily) |
|
591 |
return CSSValueCursive; |
|
592 |
if (family == fantasyFamily) |
|
593 |
return CSSValueFantasy; |
|
594 |
if (family == monospaceFamily) |
|
595 |
return CSSValueMonospace; |
|
596 |
if (family == sansSerifFamily) |
|
597 |
return CSSValueSansSerif; |
|
598 |
if (family == serifFamily) |
|
599 |
return CSSValueSerif; |
|
600 |
return 0; |
|
601 |
} |
|
602 |
||
603 |
static PassRefPtr<CSSPrimitiveValue> valueForFamily(const AtomicString& family) |
|
604 |
{ |
|
605 |
if (int familyIdentifier = identifierForFamily(family)) |
|
606 |
return CSSPrimitiveValue::createIdentifier(familyIdentifier); |
|
607 |
return CSSPrimitiveValue::create(family.string(), CSSPrimitiveValue::CSS_STRING); |
|
608 |
} |
|
609 |
||
610 |
static PassRefPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration) |
|
611 |
{ |
|
612 |
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
|
613 |
if (textDecoration & UNDERLINE) |
|
614 |
list->append(CSSPrimitiveValue::createIdentifier(CSSValueUnderline)); |
|
615 |
if (textDecoration & OVERLINE) |
|
616 |
list->append(CSSPrimitiveValue::createIdentifier(CSSValueOverline)); |
|
617 |
if (textDecoration & LINE_THROUGH) |
|
618 |
list->append(CSSPrimitiveValue::createIdentifier(CSSValueLineThrough)); |
|
619 |
if (textDecoration & BLINK) |
|
620 |
list->append(CSSPrimitiveValue::createIdentifier(CSSValueBlink)); |
|
621 |
||
622 |
if (!list->length()) |
|
623 |
return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
|
624 |
return list; |
|
625 |
} |
|
626 |
||
627 |
static PassRefPtr<CSSValue> fillRepeatToCSSValue(EFillRepeat xRepeat, EFillRepeat yRepeat) |
|
628 |
{ |
|
629 |
// For backwards compatibility, if both values are equal, just return one of them. And |
|
630 |
// if the two values are equivalent to repeat-x or repeat-y, just return the shorthand. |
|
631 |
if (xRepeat == yRepeat) |
|
632 |
return CSSPrimitiveValue::create(xRepeat); |
|
633 |
if (xRepeat == CSSValueRepeat && yRepeat == CSSValueNoRepeat) |
|
634 |
return CSSPrimitiveValue::createIdentifier(CSSValueRepeatX); |
|
635 |
if (xRepeat == CSSValueNoRepeat && yRepeat == CSSValueRepeat) |
|
636 |
return CSSPrimitiveValue::createIdentifier(CSSValueRepeatY); |
|
637 |
||
638 |
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
|
639 |
list->append(CSSPrimitiveValue::create(xRepeat)); |
|
640 |
list->append(CSSPrimitiveValue::create(yRepeat)); |
|
641 |
return list.release(); |
|
642 |
} |
|
643 |
||
644 |
static void logUnimplementedPropertyID(int propertyID) |
|
645 |
{ |
|
646 |
DEFINE_STATIC_LOCAL(HashSet<int>, propertyIDSet, ()); |
|
647 |
if (!propertyIDSet.add(propertyID).second) |
|
648 |
return; |
|
649 |
||
650 |
LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", getPropertyName(static_cast<CSSPropertyID>(propertyID))); |
|
651 |
} |
|
652 |
||
653 |
PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int propertyID, EUpdateLayout updateLayout) const |
|
654 |
{ |
|
655 |
Node* node = m_node.get(); |
|
656 |
if (!node) |
|
657 |
return 0; |
|
658 |
||
659 |
// Make sure our layout is up to date before we allow a query on these attributes. |
|
660 |
if (updateLayout) |
|
661 |
node->document()->updateLayoutIgnorePendingStylesheets(); |
|
662 |
||
663 |
RenderObject* renderer = node->renderer(); |
|
664 |
||
665 |
RefPtr<RenderStyle> style; |
|
666 |
if (renderer && hasCompositedLayer(renderer) && AnimationController::supportsAcceleratedAnimationOfProperty(static_cast<CSSPropertyID>(propertyID))) |
|
667 |
style = renderer->animation()->getAnimatedStyleForRenderer(renderer); |
|
668 |
else |
|
669 |
style = node->computedStyle(); |
|
670 |
if (!style) |
|
671 |
return 0; |
|
672 |
||
673 |
switch (static_cast<CSSPropertyID>(propertyID)) { |
|
674 |
case CSSPropertyInvalid: |
|
675 |
break; |
|
676 |
||
677 |
case CSSPropertyBackgroundColor: |
|
678 |
return CSSPrimitiveValue::createColor(style->backgroundColor().rgb()); |
|
679 |
case CSSPropertyBackgroundImage: |
|
680 |
if (style->backgroundImage()) |
|
681 |
return style->backgroundImage()->cssValue(); |
|
682 |
return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
683 |
case CSSPropertyBackgroundSize: |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
684 |
case CSSPropertyWebkitBackgroundSize: { |
0 | 685 |
EFillSizeType size = style->backgroundSizeType(); |
686 |
if (size == Contain) |
|
687 |
return CSSPrimitiveValue::createIdentifier(CSSValueContain); |
|
688 |
if (size == Cover) |
|
689 |
return CSSPrimitiveValue::createIdentifier(CSSValueCover); |
|
690 |
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
|
691 |
list->append(CSSPrimitiveValue::create(style->backgroundSizeLength().width())); |
|
692 |
list->append(CSSPrimitiveValue::create(style->backgroundSizeLength().height())); |
|
693 |
return list.release(); |
|
694 |
} |
|
695 |
case CSSPropertyBackgroundRepeat: |
|
696 |
return fillRepeatToCSSValue(style->backgroundRepeatX(), style->backgroundRepeatY()); |
|
697 |
case CSSPropertyWebkitBackgroundComposite: |
|
698 |
return CSSPrimitiveValue::create(style->backgroundComposite()); |
|
699 |
case CSSPropertyBackgroundAttachment: |
|
700 |
return CSSPrimitiveValue::create(style->backgroundAttachment()); |
|
701 |
case CSSPropertyBackgroundClip: |
|
702 |
case CSSPropertyBackgroundOrigin: |
|
703 |
case CSSPropertyWebkitBackgroundClip: |
|
704 |
case CSSPropertyWebkitBackgroundOrigin: { |
|
705 |
EFillBox box = (propertyID == CSSPropertyWebkitBackgroundClip || propertyID == CSSPropertyBackgroundClip) ? style->backgroundClip() : style->backgroundOrigin(); |
|
706 |
return CSSPrimitiveValue::create(box); |
|
707 |
} |
|
708 |
case CSSPropertyBackgroundPosition: { |
|
709 |
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
|
710 |
||
711 |
list->append(CSSPrimitiveValue::create(style->backgroundXPosition())); |
|
712 |
list->append(CSSPrimitiveValue::create(style->backgroundYPosition())); |
|
713 |
||
714 |
return list.release(); |
|
715 |
} |
|
716 |
case CSSPropertyBackgroundPositionX: |
|
717 |
return CSSPrimitiveValue::create(style->backgroundXPosition()); |
|
718 |
case CSSPropertyBackgroundPositionY: |
|
719 |
return CSSPrimitiveValue::create(style->backgroundYPosition()); |
|
720 |
case CSSPropertyBorderCollapse: |
|
721 |
if (style->borderCollapse()) |
|
722 |
return CSSPrimitiveValue::createIdentifier(CSSValueCollapse); |
|
723 |
return CSSPrimitiveValue::createIdentifier(CSSValueSeparate); |
|
724 |
case CSSPropertyBorderSpacing: { |
|
725 |
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
|
726 |
list->append(CSSPrimitiveValue::create(style->horizontalBorderSpacing(), CSSPrimitiveValue::CSS_PX)); |
|
727 |
list->append(CSSPrimitiveValue::create(style->verticalBorderSpacing(), CSSPrimitiveValue::CSS_PX)); |
|
728 |
return list.release(); |
|
729 |
} |
|
730 |
case CSSPropertyWebkitBorderHorizontalSpacing: |
|
731 |
return CSSPrimitiveValue::create(style->horizontalBorderSpacing(), CSSPrimitiveValue::CSS_PX); |
|
732 |
case CSSPropertyWebkitBorderVerticalSpacing: |
|
733 |
return CSSPrimitiveValue::create(style->verticalBorderSpacing(), CSSPrimitiveValue::CSS_PX); |
|
734 |
case CSSPropertyBorderTopColor: |
|
735 |
return currentColorOrValidColor(style.get(), style->borderTopColor()); |
|
736 |
case CSSPropertyBorderRightColor: |
|
737 |
return currentColorOrValidColor(style.get(), style->borderRightColor()); |
|
738 |
case CSSPropertyBorderBottomColor: |
|
739 |
return currentColorOrValidColor(style.get(), style->borderBottomColor()); |
|
740 |
case CSSPropertyBorderLeftColor: |
|
741 |
return currentColorOrValidColor(style.get(), style->borderLeftColor()); |
|
742 |
case CSSPropertyBorderTopStyle: |
|
743 |
return CSSPrimitiveValue::create(style->borderTopStyle()); |
|
744 |
case CSSPropertyBorderRightStyle: |
|
745 |
return CSSPrimitiveValue::create(style->borderRightStyle()); |
|
746 |
case CSSPropertyBorderBottomStyle: |
|
747 |
return CSSPrimitiveValue::create(style->borderBottomStyle()); |
|
748 |
case CSSPropertyBorderLeftStyle: |
|
749 |
return CSSPrimitiveValue::create(style->borderLeftStyle()); |
|
750 |
case CSSPropertyBorderTopWidth: |
|
751 |
return CSSPrimitiveValue::create(style->borderTopWidth(), CSSPrimitiveValue::CSS_PX); |
|
752 |
case CSSPropertyBorderRightWidth: |
|
753 |
return CSSPrimitiveValue::create(style->borderRightWidth(), CSSPrimitiveValue::CSS_PX); |
|
754 |
case CSSPropertyBorderBottomWidth: |
|
755 |
return CSSPrimitiveValue::create(style->borderBottomWidth(), CSSPrimitiveValue::CSS_PX); |
|
756 |
case CSSPropertyBorderLeftWidth: |
|
757 |
return CSSPrimitiveValue::create(style->borderLeftWidth(), CSSPrimitiveValue::CSS_PX); |
|
758 |
case CSSPropertyBottom: |
|
759 |
return getPositionOffsetValue(style.get(), CSSPropertyBottom); |
|
760 |
case CSSPropertyWebkitBoxAlign: |
|
761 |
return CSSPrimitiveValue::create(style->boxAlign()); |
|
762 |
case CSSPropertyWebkitBoxDirection: |
|
763 |
return CSSPrimitiveValue::create(style->boxDirection()); |
|
764 |
case CSSPropertyWebkitBoxFlex: |
|
765 |
return CSSPrimitiveValue::create(style->boxFlex(), CSSPrimitiveValue::CSS_NUMBER); |
|
766 |
case CSSPropertyWebkitBoxFlexGroup: |
|
767 |
return CSSPrimitiveValue::create(style->boxFlexGroup(), CSSPrimitiveValue::CSS_NUMBER); |
|
768 |
case CSSPropertyWebkitBoxLines: |
|
769 |
return CSSPrimitiveValue::create(style->boxLines()); |
|
770 |
case CSSPropertyWebkitBoxOrdinalGroup: |
|
771 |
return CSSPrimitiveValue::create(style->boxOrdinalGroup(), CSSPrimitiveValue::CSS_NUMBER); |
|
772 |
case CSSPropertyWebkitBoxOrient: |
|
773 |
return CSSPrimitiveValue::create(style->boxOrient()); |
|
774 |
case CSSPropertyWebkitBoxPack: { |
|
775 |
EBoxAlignment boxPack = style->boxPack(); |
|
776 |
ASSERT(boxPack != BSTRETCH); |
|
777 |
ASSERT(boxPack != BBASELINE); |
|
778 |
if (boxPack == BJUSTIFY || boxPack== BBASELINE) |
|
779 |
return 0; |
|
780 |
return CSSPrimitiveValue::create(boxPack); |
|
781 |
} |
|
782 |
case CSSPropertyWebkitBoxReflect: |
|
783 |
return valueForReflection(style->boxReflect()); |
|
784 |
case CSSPropertyWebkitBoxShadow: |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
785 |
return valueForShadow(style->boxShadow(), propertyID); |
0 | 786 |
case CSSPropertyCaptionSide: |
787 |
return CSSPrimitiveValue::create(style->captionSide()); |
|
788 |
case CSSPropertyClear: |
|
789 |
return CSSPrimitiveValue::create(style->clear()); |
|
790 |
case CSSPropertyColor: |
|
791 |
return CSSPrimitiveValue::createColor(style->color().rgb()); |
|
792 |
case CSSPropertyWebkitColumnCount: |
|
793 |
if (style->hasAutoColumnCount()) |
|
794 |
return CSSPrimitiveValue::createIdentifier(CSSValueAuto); |
|
795 |
return CSSPrimitiveValue::create(style->columnCount(), CSSPrimitiveValue::CSS_NUMBER); |
|
796 |
case CSSPropertyWebkitColumnGap: |
|
797 |
if (style->hasNormalColumnGap()) |
|
798 |
return CSSPrimitiveValue::createIdentifier(CSSValueNormal); |
|
799 |
return CSSPrimitiveValue::create(style->columnGap(), CSSPrimitiveValue::CSS_NUMBER); |
|
800 |
case CSSPropertyWebkitColumnRuleColor: |
|
801 |
return currentColorOrValidColor(style.get(), style->columnRuleColor()); |
|
802 |
case CSSPropertyWebkitColumnRuleStyle: |
|
803 |
return CSSPrimitiveValue::create(style->columnRuleStyle()); |
|
804 |
case CSSPropertyWebkitColumnRuleWidth: |
|
805 |
return CSSPrimitiveValue::create(style->columnRuleWidth(), CSSPrimitiveValue::CSS_PX); |
|
806 |
case CSSPropertyWebkitColumnBreakAfter: |
|
807 |
return CSSPrimitiveValue::create(style->columnBreakAfter()); |
|
808 |
case CSSPropertyWebkitColumnBreakBefore: |
|
809 |
return CSSPrimitiveValue::create(style->columnBreakBefore()); |
|
810 |
case CSSPropertyWebkitColumnBreakInside: |
|
811 |
return CSSPrimitiveValue::create(style->columnBreakInside()); |
|
812 |
case CSSPropertyWebkitColumnWidth: |
|
813 |
if (style->hasAutoColumnWidth()) |
|
814 |
return CSSPrimitiveValue::createIdentifier(CSSValueAuto); |
|
815 |
return CSSPrimitiveValue::create(style->columnWidth(), CSSPrimitiveValue::CSS_NUMBER); |
|
816 |
case CSSPropertyCursor: { |
|
817 |
RefPtr<CSSValueList> list; |
|
818 |
CursorList* cursors = style->cursors(); |
|
819 |
if (cursors && cursors->size() > 0) { |
|
820 |
list = CSSValueList::createCommaSeparated(); |
|
821 |
for (unsigned i = 0; i < cursors->size(); ++i) |
|
822 |
list->append(CSSPrimitiveValue::create((*cursors)[i].cursorImage->url(), CSSPrimitiveValue::CSS_URI)); |
|
823 |
} |
|
824 |
RefPtr<CSSValue> value = CSSPrimitiveValue::create(style->cursor()); |
|
825 |
if (list) { |
|
826 |
list->append(value); |
|
827 |
return list.release(); |
|
828 |
} |
|
829 |
return value.release(); |
|
830 |
} |
|
831 |
case CSSPropertyDirection: |
|
832 |
return CSSPrimitiveValue::create(style->direction()); |
|
833 |
case CSSPropertyDisplay: |
|
834 |
return CSSPrimitiveValue::create(style->display()); |
|
835 |
case CSSPropertyEmptyCells: |
|
836 |
return CSSPrimitiveValue::create(style->emptyCells()); |
|
837 |
case CSSPropertyFloat: |
|
838 |
return CSSPrimitiveValue::create(style->floating()); |
|
839 |
case CSSPropertyFontFamily: { |
|
840 |
const FontFamily& firstFamily = style->fontDescription().family(); |
|
841 |
if (!firstFamily.next()) |
|
842 |
return valueForFamily(firstFamily.family()); |
|
843 |
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
|
844 |
for (const FontFamily* family = &firstFamily; family; family = family->next()) |
|
845 |
list->append(valueForFamily(family->family())); |
|
846 |
return list.release(); |
|
847 |
} |
|
848 |
case CSSPropertyFontSize: |
|
849 |
return CSSPrimitiveValue::create(style->fontDescription().computedPixelSize(), CSSPrimitiveValue::CSS_PX); |
|
850 |
case CSSPropertyWebkitBinding: |
|
851 |
break; |
|
852 |
case CSSPropertyFontStyle: |
|
853 |
if (style->fontDescription().italic()) |
|
854 |
return CSSPrimitiveValue::createIdentifier(CSSValueItalic); |
|
855 |
return CSSPrimitiveValue::createIdentifier(CSSValueNormal); |
|
856 |
case CSSPropertyFontVariant: |
|
857 |
if (style->fontDescription().smallCaps()) |
|
858 |
return CSSPrimitiveValue::createIdentifier(CSSValueSmallCaps); |
|
859 |
return CSSPrimitiveValue::createIdentifier(CSSValueNormal); |
|
860 |
case CSSPropertyFontWeight: |
|
861 |
switch (style->fontDescription().weight()) { |
|
862 |
case FontWeight100: |
|
863 |
return CSSPrimitiveValue::createIdentifier(CSSValue100); |
|
864 |
case FontWeight200: |
|
865 |
return CSSPrimitiveValue::createIdentifier(CSSValue200); |
|
866 |
case FontWeight300: |
|
867 |
return CSSPrimitiveValue::createIdentifier(CSSValue300); |
|
868 |
case FontWeightNormal: |
|
869 |
return CSSPrimitiveValue::createIdentifier(CSSValueNormal); |
|
870 |
case FontWeight500: |
|
871 |
return CSSPrimitiveValue::createIdentifier(CSSValue500); |
|
872 |
case FontWeight600: |
|
873 |
return CSSPrimitiveValue::createIdentifier(CSSValue600); |
|
874 |
case FontWeightBold: |
|
875 |
return CSSPrimitiveValue::createIdentifier(CSSValueBold); |
|
876 |
case FontWeight800: |
|
877 |
return CSSPrimitiveValue::createIdentifier(CSSValue800); |
|
878 |
case FontWeight900: |
|
879 |
return CSSPrimitiveValue::createIdentifier(CSSValue900); |
|
880 |
} |
|
881 |
ASSERT_NOT_REACHED(); |
|
882 |
return CSSPrimitiveValue::createIdentifier(CSSValueNormal); |
|
883 |
case CSSPropertyHeight: |
|
884 |
if (renderer) |
|
885 |
return CSSPrimitiveValue::create(sizingBox(renderer).height(), CSSPrimitiveValue::CSS_PX); |
|
886 |
return CSSPrimitiveValue::create(style->height()); |
|
887 |
case CSSPropertyWebkitHighlight: |
|
888 |
if (style->highlight() == nullAtom) |
|
889 |
return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
|
890 |
return CSSPrimitiveValue::create(style->highlight(), CSSPrimitiveValue::CSS_STRING); |
|
891 |
case CSSPropertyWebkitBorderFit: |
|
892 |
if (style->borderFit() == BorderFitBorder) |
|
893 |
return CSSPrimitiveValue::createIdentifier(CSSValueBorder); |
|
894 |
return CSSPrimitiveValue::createIdentifier(CSSValueLines); |
|
895 |
case CSSPropertyLeft: |
|
896 |
return getPositionOffsetValue(style.get(), CSSPropertyLeft); |
|
897 |
case CSSPropertyLetterSpacing: |
|
898 |
if (!style->letterSpacing()) |
|
899 |
return CSSPrimitiveValue::createIdentifier(CSSValueNormal); |
|
900 |
return CSSPrimitiveValue::create(style->letterSpacing(), CSSPrimitiveValue::CSS_PX); |
|
901 |
case CSSPropertyWebkitLineClamp: |
|
902 |
if (style->lineClamp() == -1) |
|
903 |
return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
|
904 |
return CSSPrimitiveValue::create(style->lineClamp(), CSSPrimitiveValue::CSS_PERCENTAGE); |
|
905 |
case CSSPropertyLineHeight: { |
|
906 |
Length length = style->lineHeight(); |
|
907 |
if (length.isNegative()) |
|
908 |
return CSSPrimitiveValue::createIdentifier(CSSValueNormal); |
|
909 |
if (length.isPercent()) |
|
910 |
// This is imperfect, because it doesn't include the zoom factor and the real computation |
|
911 |
// for how high to be in pixels does include things like minimum font size and the zoom factor. |
|
912 |
// On the other hand, since font-size doesn't include the zoom factor, we really can't do |
|
913 |
// that here either. |
|
914 |
// The line height returned is rounded to the nearest integer. |
|
915 |
return CSSPrimitiveValue::create(length.calcMinValue(style->fontDescription().specifiedSize(), true), CSSPrimitiveValue::CSS_PX); |
|
916 |
return CSSPrimitiveValue::create(length.value(), CSSPrimitiveValue::CSS_PX); |
|
917 |
} |
|
918 |
case CSSPropertyListStyleImage: |
|
919 |
if (style->listStyleImage()) |
|
920 |
return style->listStyleImage()->cssValue(); |
|
921 |
return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
|
922 |
case CSSPropertyListStylePosition: |
|
923 |
return CSSPrimitiveValue::create(style->listStylePosition()); |
|
924 |
case CSSPropertyListStyleType: |
|
925 |
return CSSPrimitiveValue::create(style->listStyleType()); |
|
926 |
case CSSPropertyMarginTop: |
|
927 |
if (renderer && renderer->isBox()) |
|
928 |
// FIXME: Supposed to return the percentage if percentage was specified. |
|
929 |
return CSSPrimitiveValue::create(toRenderBox(renderer)->marginTop(), CSSPrimitiveValue::CSS_PX); |
|
930 |
return CSSPrimitiveValue::create(style->marginTop()); |
|
931 |
case CSSPropertyMarginRight: |
|
932 |
if (renderer && renderer->isBox()) |
|
933 |
// FIXME: Supposed to return the percentage if percentage was specified. |
|
934 |
return CSSPrimitiveValue::create(toRenderBox(renderer)->marginRight(), CSSPrimitiveValue::CSS_PX); |
|
935 |
return CSSPrimitiveValue::create(style->marginRight()); |
|
936 |
case CSSPropertyMarginBottom: |
|
937 |
if (renderer && renderer->isBox()) |
|
938 |
// FIXME: Supposed to return the percentage if percentage was specified. |
|
939 |
return CSSPrimitiveValue::create(toRenderBox(renderer)->marginBottom(), CSSPrimitiveValue::CSS_PX); |
|
940 |
return CSSPrimitiveValue::create(style->marginBottom()); |
|
941 |
case CSSPropertyMarginLeft: |
|
942 |
if (renderer && renderer->isBox()) |
|
943 |
// FIXME: Supposed to return the percentage if percentage was specified. |
|
944 |
return CSSPrimitiveValue::create(toRenderBox(renderer)->marginLeft(), CSSPrimitiveValue::CSS_PX); |
|
945 |
return CSSPrimitiveValue::create(style->marginLeft()); |
|
946 |
case CSSPropertyWebkitMarqueeDirection: |
|
947 |
return CSSPrimitiveValue::create(style->marqueeDirection()); |
|
948 |
case CSSPropertyWebkitMarqueeIncrement: |
|
949 |
return CSSPrimitiveValue::create(style->marqueeIncrement()); |
|
950 |
case CSSPropertyWebkitMarqueeRepetition: |
|
951 |
if (style->marqueeLoopCount() < 0) |
|
952 |
return CSSPrimitiveValue::createIdentifier(CSSValueInfinite); |
|
953 |
return CSSPrimitiveValue::create(style->marqueeLoopCount(), CSSPrimitiveValue::CSS_NUMBER); |
|
954 |
case CSSPropertyWebkitMarqueeStyle: |
|
955 |
return CSSPrimitiveValue::create(style->marqueeBehavior()); |
|
956 |
case CSSPropertyWebkitMaskImage: |
|
957 |
if (style->maskImage()) |
|
958 |
return style->maskImage()->cssValue(); |
|
959 |
return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
|
960 |
case CSSPropertyWebkitMaskSize: { |
|
961 |
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
|
962 |
list->append(CSSPrimitiveValue::create(style->maskSize().width())); |
|
963 |
list->append(CSSPrimitiveValue::create(style->maskSize().height())); |
|
964 |
return list.release(); |
|
965 |
} |
|
966 |
case CSSPropertyWebkitMaskRepeat: |
|
967 |
return fillRepeatToCSSValue(style->maskRepeatX(), style->maskRepeatY()); |
|
968 |
case CSSPropertyWebkitMaskAttachment: |
|
969 |
return CSSPrimitiveValue::create(style->maskAttachment()); |
|
970 |
case CSSPropertyWebkitMaskComposite: |
|
971 |
return CSSPrimitiveValue::create(style->maskComposite()); |
|
972 |
case CSSPropertyWebkitMaskClip: |
|
973 |
case CSSPropertyWebkitMaskOrigin: { |
|
974 |
EFillBox box = (propertyID == CSSPropertyWebkitMaskClip ? style->maskClip() : style->maskOrigin()); |
|
975 |
return CSSPrimitiveValue::create(box); |
|
976 |
} |
|
977 |
case CSSPropertyWebkitMaskPosition: { |
|
978 |
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
|
979 |
||
980 |
list->append(CSSPrimitiveValue::create(style->maskXPosition())); |
|
981 |
list->append(CSSPrimitiveValue::create(style->maskYPosition())); |
|
982 |
||
983 |
return list.release(); |
|
984 |
} |
|
985 |
case CSSPropertyWebkitMaskPositionX: |
|
986 |
return CSSPrimitiveValue::create(style->maskXPosition()); |
|
987 |
case CSSPropertyWebkitMaskPositionY: |
|
988 |
return CSSPrimitiveValue::create(style->maskYPosition()); |
|
989 |
case CSSPropertyWebkitUserModify: |
|
990 |
return CSSPrimitiveValue::create(style->userModify()); |
|
991 |
case CSSPropertyMaxHeight: { |
|
992 |
const Length& maxHeight = style->maxHeight(); |
|
993 |
if (maxHeight.isFixed() && maxHeight.value() == undefinedLength) |
|
994 |
return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
|
995 |
return CSSPrimitiveValue::create(maxHeight); |
|
996 |
} |
|
997 |
case CSSPropertyMaxWidth: { |
|
998 |
const Length& maxWidth = style->maxWidth(); |
|
999 |
if (maxWidth.isFixed() && maxWidth.value() == undefinedLength) |
|
1000 |
return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
|
1001 |
return CSSPrimitiveValue::create(maxWidth); |
|
1002 |
} |
|
1003 |
case CSSPropertyMinHeight: |
|
1004 |
return CSSPrimitiveValue::create(style->minHeight()); |
|
1005 |
case CSSPropertyMinWidth: |
|
1006 |
return CSSPrimitiveValue::create(style->minWidth()); |
|
1007 |
case CSSPropertyOpacity: |
|
1008 |
return CSSPrimitiveValue::create(style->opacity(), CSSPrimitiveValue::CSS_NUMBER); |
|
1009 |
case CSSPropertyOrphans: |
|
1010 |
return CSSPrimitiveValue::create(style->orphans(), CSSPrimitiveValue::CSS_NUMBER); |
|
1011 |
case CSSPropertyOutlineColor: |
|
1012 |
return currentColorOrValidColor(style.get(), style->outlineColor()); |
|
1013 |
case CSSPropertyOutlineStyle: |
|
1014 |
if (style->outlineStyleIsAuto()) |
|
1015 |
return CSSPrimitiveValue::createIdentifier(CSSValueAuto); |
|
1016 |
return CSSPrimitiveValue::create(style->outlineStyle()); |
|
1017 |
case CSSPropertyOutlineWidth: |
|
1018 |
return CSSPrimitiveValue::create(style->outlineWidth(), CSSPrimitiveValue::CSS_PX); |
|
1019 |
case CSSPropertyOverflow: |
|
1020 |
return CSSPrimitiveValue::create(max(style->overflowX(), style->overflowY())); |
|
1021 |
case CSSPropertyOverflowX: |
|
1022 |
return CSSPrimitiveValue::create(style->overflowX()); |
|
1023 |
case CSSPropertyOverflowY: |
|
1024 |
return CSSPrimitiveValue::create(style->overflowY()); |
|
1025 |
case CSSPropertyPaddingTop: |
|
1026 |
if (renderer && renderer->isBox()) |
|
1027 |
return CSSPrimitiveValue::create(toRenderBox(renderer)->paddingTop(false), CSSPrimitiveValue::CSS_PX); |
|
1028 |
return CSSPrimitiveValue::create(style->paddingTop()); |
|
1029 |
case CSSPropertyPaddingRight: |
|
1030 |
if (renderer && renderer->isBox()) |
|
1031 |
return CSSPrimitiveValue::create(toRenderBox(renderer)->paddingRight(false), CSSPrimitiveValue::CSS_PX); |
|
1032 |
return CSSPrimitiveValue::create(style->paddingRight()); |
|
1033 |
case CSSPropertyPaddingBottom: |
|
1034 |
if (renderer && renderer->isBox()) |
|
1035 |
return CSSPrimitiveValue::create(toRenderBox(renderer)->paddingBottom(false), CSSPrimitiveValue::CSS_PX); |
|
1036 |
return CSSPrimitiveValue::create(style->paddingBottom()); |
|
1037 |
case CSSPropertyPaddingLeft: |
|
1038 |
if (renderer && renderer->isBox()) |
|
1039 |
return CSSPrimitiveValue::create(toRenderBox(renderer)->paddingLeft(false), CSSPrimitiveValue::CSS_PX); |
|
1040 |
return CSSPrimitiveValue::create(style->paddingLeft()); |
|
1041 |
case CSSPropertyPageBreakAfter: |
|
1042 |
return CSSPrimitiveValue::create(style->pageBreakAfter()); |
|
1043 |
case CSSPropertyPageBreakBefore: |
|
1044 |
return CSSPrimitiveValue::create(style->pageBreakBefore()); |
|
1045 |
case CSSPropertyPageBreakInside: { |
|
1046 |
EPageBreak pageBreak = style->pageBreakInside(); |
|
1047 |
ASSERT(pageBreak != PBALWAYS); |
|
1048 |
if (pageBreak == PBALWAYS) |
|
1049 |
return 0; |
|
1050 |
return CSSPrimitiveValue::create(style->pageBreakInside()); |
|
1051 |
} |
|
1052 |
case CSSPropertyPosition: |
|
1053 |
return CSSPrimitiveValue::create(style->position()); |
|
1054 |
case CSSPropertyRight: |
|
1055 |
return getPositionOffsetValue(style.get(), CSSPropertyRight); |
|
1056 |
case CSSPropertyTableLayout: |
|
1057 |
return CSSPrimitiveValue::create(style->tableLayout()); |
|
1058 |
case CSSPropertyTextAlign: |
|
1059 |
return CSSPrimitiveValue::create(style->textAlign()); |
|
1060 |
case CSSPropertyTextDecoration: |
|
1061 |
return renderTextDecorationFlagsToCSSValue(style->textDecoration()); |
|
1062 |
case CSSPropertyWebkitTextDecorationsInEffect: |
|
1063 |
return renderTextDecorationFlagsToCSSValue(style->textDecorationsInEffect()); |
|
1064 |
case CSSPropertyWebkitTextFillColor: |
|
1065 |
return currentColorOrValidColor(style.get(), style->textFillColor()); |
|
1066 |
case CSSPropertyTextIndent: |
|
1067 |
return CSSPrimitiveValue::create(style->textIndent()); |
|
1068 |
case CSSPropertyTextShadow: |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1069 |
return valueForShadow(style->textShadow(), propertyID); |
0 | 1070 |
case CSSPropertyTextRendering: |
1071 |
return CSSPrimitiveValue::create(style->fontDescription().textRenderingMode()); |
|
1072 |
case CSSPropertyTextOverflow: |
|
1073 |
if (style->textOverflow()) |
|
1074 |
return CSSPrimitiveValue::createIdentifier(CSSValueEllipsis); |
|
1075 |
return CSSPrimitiveValue::createIdentifier(CSSValueClip); |
|
1076 |
case CSSPropertyWebkitTextSecurity: |
|
1077 |
return CSSPrimitiveValue::create(style->textSecurity()); |
|
1078 |
case CSSPropertyWebkitTextSizeAdjust: |
|
1079 |
if (style->textSizeAdjust()) |
|
1080 |
return CSSPrimitiveValue::createIdentifier(CSSValueAuto); |
|
1081 |
return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
|
1082 |
case CSSPropertyWebkitTextStrokeColor: |
|
1083 |
return currentColorOrValidColor(style.get(), style->textStrokeColor()); |
|
1084 |
case CSSPropertyWebkitTextStrokeWidth: |
|
1085 |
return CSSPrimitiveValue::create(style->textStrokeWidth(), CSSPrimitiveValue::CSS_PX); |
|
1086 |
case CSSPropertyTextTransform: |
|
1087 |
return CSSPrimitiveValue::create(style->textTransform()); |
|
1088 |
case CSSPropertyTop: |
|
1089 |
return getPositionOffsetValue(style.get(), CSSPropertyTop); |
|
1090 |
case CSSPropertyUnicodeBidi: |
|
1091 |
return CSSPrimitiveValue::create(style->unicodeBidi()); |
|
1092 |
case CSSPropertyVerticalAlign: |
|
1093 |
switch (style->verticalAlign()) { |
|
1094 |
case BASELINE: |
|
1095 |
return CSSPrimitiveValue::createIdentifier(CSSValueBaseline); |
|
1096 |
case MIDDLE: |
|
1097 |
return CSSPrimitiveValue::createIdentifier(CSSValueMiddle); |
|
1098 |
case SUB: |
|
1099 |
return CSSPrimitiveValue::createIdentifier(CSSValueSub); |
|
1100 |
case SUPER: |
|
1101 |
return CSSPrimitiveValue::createIdentifier(CSSValueSuper); |
|
1102 |
case TEXT_TOP: |
|
1103 |
return CSSPrimitiveValue::createIdentifier(CSSValueTextTop); |
|
1104 |
case TEXT_BOTTOM: |
|
1105 |
return CSSPrimitiveValue::createIdentifier(CSSValueTextBottom); |
|
1106 |
case TOP: |
|
1107 |
return CSSPrimitiveValue::createIdentifier(CSSValueTop); |
|
1108 |
case BOTTOM: |
|
1109 |
return CSSPrimitiveValue::createIdentifier(CSSValueBottom); |
|
1110 |
case BASELINE_MIDDLE: |
|
1111 |
return CSSPrimitiveValue::createIdentifier(CSSValueWebkitBaselineMiddle); |
|
1112 |
case LENGTH: |
|
1113 |
return CSSPrimitiveValue::create(style->verticalAlignLength()); |
|
1114 |
} |
|
1115 |
ASSERT_NOT_REACHED(); |
|
1116 |
return 0; |
|
1117 |
case CSSPropertyVisibility: |
|
1118 |
return CSSPrimitiveValue::create(style->visibility()); |
|
1119 |
case CSSPropertyWhiteSpace: |
|
1120 |
return CSSPrimitiveValue::create(style->whiteSpace()); |
|
1121 |
case CSSPropertyWidows: |
|
1122 |
return CSSPrimitiveValue::create(style->widows(), CSSPrimitiveValue::CSS_NUMBER); |
|
1123 |
case CSSPropertyWidth: |
|
1124 |
if (renderer) |
|
1125 |
return CSSPrimitiveValue::create(sizingBox(renderer).width(), CSSPrimitiveValue::CSS_PX); |
|
1126 |
return CSSPrimitiveValue::create(style->width()); |
|
1127 |
case CSSPropertyWordBreak: |
|
1128 |
return CSSPrimitiveValue::create(style->wordBreak()); |
|
1129 |
case CSSPropertyWordSpacing: |
|
1130 |
return CSSPrimitiveValue::create(style->wordSpacing(), CSSPrimitiveValue::CSS_PX); |
|
1131 |
case CSSPropertyWordWrap: |
|
1132 |
return CSSPrimitiveValue::create(style->wordWrap()); |
|
1133 |
case CSSPropertyWebkitLineBreak: |
|
1134 |
return CSSPrimitiveValue::create(style->khtmlLineBreak()); |
|
1135 |
case CSSPropertyWebkitNbspMode: |
|
1136 |
return CSSPrimitiveValue::create(style->nbspMode()); |
|
1137 |
case CSSPropertyWebkitMatchNearestMailBlockquoteColor: |
|
1138 |
return CSSPrimitiveValue::create(style->matchNearestMailBlockquoteColor()); |
|
1139 |
case CSSPropertyResize: |
|
1140 |
return CSSPrimitiveValue::create(style->resize()); |
|
1141 |
case CSSPropertyWebkitFontSmoothing: |
|
1142 |
return CSSPrimitiveValue::create(style->fontDescription().fontSmoothing()); |
|
1143 |
case CSSPropertyZIndex: |
|
1144 |
if (style->hasAutoZIndex()) |
|
1145 |
return CSSPrimitiveValue::createIdentifier(CSSValueAuto); |
|
1146 |
return CSSPrimitiveValue::create(style->zIndex(), CSSPrimitiveValue::CSS_NUMBER); |
|
1147 |
case CSSPropertyZoom: |
|
1148 |
return CSSPrimitiveValue::create(style->zoom(), CSSPrimitiveValue::CSS_NUMBER); |
|
1149 |
case CSSPropertyWebkitBoxSizing: |
|
1150 |
if (style->boxSizing() == CONTENT_BOX) |
|
1151 |
return CSSPrimitiveValue::createIdentifier(CSSValueContentBox); |
|
1152 |
return CSSPrimitiveValue::createIdentifier(CSSValueBorderBox); |
|
1153 |
#if ENABLE(DASHBOARD_SUPPORT) |
|
1154 |
case CSSPropertyWebkitDashboardRegion: |
|
1155 |
{ |
|
1156 |
const Vector<StyleDashboardRegion>& regions = style->dashboardRegions(); |
|
1157 |
unsigned count = regions.size(); |
|
1158 |
if (count == 1 && regions[0].type == StyleDashboardRegion::None) |
|
1159 |
return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
|
1160 |
||
1161 |
RefPtr<DashboardRegion> firstRegion; |
|
1162 |
DashboardRegion* previousRegion = 0; |
|
1163 |
for (unsigned i = 0; i < count; i++) { |
|
1164 |
RefPtr<DashboardRegion> region = DashboardRegion::create(); |
|
1165 |
StyleDashboardRegion styleRegion = regions[i]; |
|
1166 |
||
1167 |
region->m_label = styleRegion.label; |
|
1168 |
LengthBox offset = styleRegion.offset; |
|
1169 |
region->setTop(CSSPrimitiveValue::create(offset.top().value(), CSSPrimitiveValue::CSS_PX)); |
|
1170 |
region->setRight(CSSPrimitiveValue::create(offset.right().value(), CSSPrimitiveValue::CSS_PX)); |
|
1171 |
region->setBottom(CSSPrimitiveValue::create(offset.bottom().value(), CSSPrimitiveValue::CSS_PX)); |
|
1172 |
region->setLeft(CSSPrimitiveValue::create(offset.left().value(), CSSPrimitiveValue::CSS_PX)); |
|
1173 |
region->m_isRectangle = (styleRegion.type == StyleDashboardRegion::Rectangle); |
|
1174 |
region->m_isCircle = (styleRegion.type == StyleDashboardRegion::Circle); |
|
1175 |
||
1176 |
if (previousRegion) |
|
1177 |
previousRegion->m_next = region; |
|
1178 |
else |
|
1179 |
firstRegion = region; |
|
1180 |
previousRegion = region.get(); |
|
1181 |
} |
|
1182 |
return CSSPrimitiveValue::create(firstRegion.release()); |
|
1183 |
} |
|
1184 |
#endif |
|
1185 |
case CSSPropertyWebkitAnimationDelay: |
|
1186 |
return getDelayValue(style->animations()); |
|
1187 |
case CSSPropertyWebkitAnimationDirection: { |
|
1188 |
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
|
1189 |
const AnimationList* t = style->animations(); |
|
1190 |
if (t) { |
|
1191 |
for (size_t i = 0; i < t->size(); ++i) { |
|
1192 |
if (t->animation(i)->direction()) |
|
1193 |
list->append(CSSPrimitiveValue::createIdentifier(CSSValueAlternate)); |
|
1194 |
else |
|
1195 |
list->append(CSSPrimitiveValue::createIdentifier(CSSValueNormal)); |
|
1196 |
} |
|
1197 |
} else |
|
1198 |
list->append(CSSPrimitiveValue::createIdentifier(CSSValueNormal)); |
|
1199 |
return list.release(); |
|
1200 |
} |
|
1201 |
case CSSPropertyWebkitAnimationDuration: |
|
1202 |
return getDurationValue(style->animations()); |
|
1203 |
case CSSPropertyWebkitAnimationIterationCount: { |
|
1204 |
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
|
1205 |
const AnimationList* t = style->animations(); |
|
1206 |
if (t) { |
|
1207 |
for (size_t i = 0; i < t->size(); ++i) { |
|
1208 |
int iterationCount = t->animation(i)->iterationCount(); |
|
1209 |
if (iterationCount == Animation::IterationCountInfinite) |
|
1210 |
list->append(CSSPrimitiveValue::createIdentifier(CSSValueInfinite)); |
|
1211 |
else |
|
1212 |
list->append(CSSPrimitiveValue::create(iterationCount, CSSPrimitiveValue::CSS_NUMBER)); |
|
1213 |
} |
|
1214 |
} else |
|
1215 |
list->append(CSSPrimitiveValue::create(Animation::initialAnimationIterationCount(), CSSPrimitiveValue::CSS_NUMBER)); |
|
1216 |
return list.release(); |
|
1217 |
} |
|
1218 |
case CSSPropertyWebkitAnimationName: { |
|
1219 |
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
|
1220 |
const AnimationList* t = style->animations(); |
|
1221 |
if (t) { |
|
1222 |
for (size_t i = 0; i < t->size(); ++i) { |
|
1223 |
list->append(CSSPrimitiveValue::create(t->animation(i)->name(), CSSPrimitiveValue::CSS_STRING)); |
|
1224 |
} |
|
1225 |
} else |
|
1226 |
list->append(CSSPrimitiveValue::createIdentifier(CSSValueNone)); |
|
1227 |
return list.release(); |
|
1228 |
} |
|
1229 |
case CSSPropertyWebkitAnimationPlayState: { |
|
1230 |
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
|
1231 |
const AnimationList* t = style->animations(); |
|
1232 |
if (t) { |
|
1233 |
for (size_t i = 0; i < t->size(); ++i) { |
|
1234 |
int prop = t->animation(i)->playState(); |
|
1235 |
if (prop == AnimPlayStatePlaying) |
|
1236 |
list->append(CSSPrimitiveValue::createIdentifier(CSSValueRunning)); |
|
1237 |
else |
|
1238 |
list->append(CSSPrimitiveValue::createIdentifier(CSSValuePaused)); |
|
1239 |
} |
|
1240 |
} else |
|
1241 |
list->append(CSSPrimitiveValue::createIdentifier(CSSValueRunning)); |
|
1242 |
return list.release(); |
|
1243 |
} |
|
1244 |
case CSSPropertyWebkitAnimationTimingFunction: |
|
1245 |
return getTimingFunctionValue(style->animations()); |
|
1246 |
case CSSPropertyWebkitAppearance: |
|
1247 |
return CSSPrimitiveValue::create(style->appearance()); |
|
1248 |
case CSSPropertyWebkitBackfaceVisibility: |
|
1249 |
return CSSPrimitiveValue::createIdentifier((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible); |
|
1250 |
case CSSPropertyWebkitBorderImage: |
|
1251 |
return valueForNinePieceImage(style->borderImage()); |
|
1252 |
case CSSPropertyWebkitMaskBoxImage: |
|
1253 |
return valueForNinePieceImage(style->maskBoxImage()); |
|
1254 |
case CSSPropertyWebkitFontSizeDelta: |
|
1255 |
// Not a real style property -- used by the editing engine -- so has no computed value. |
|
1256 |
break; |
|
1257 |
case CSSPropertyWebkitMarginBottomCollapse: |
|
1258 |
return CSSPrimitiveValue::create(style->marginBottomCollapse()); |
|
1259 |
case CSSPropertyWebkitMarginTopCollapse: |
|
1260 |
return CSSPrimitiveValue::create(style->marginTopCollapse()); |
|
1261 |
case CSSPropertyWebkitPerspective: |
|
1262 |
if (!style->hasPerspective()) |
|
1263 |
return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
|
1264 |
return CSSPrimitiveValue::create(style->perspective(), CSSPrimitiveValue::CSS_NUMBER); |
|
1265 |
case CSSPropertyWebkitPerspectiveOrigin: { |
|
1266 |
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
|
1267 |
if (renderer) { |
|
1268 |
IntRect box = sizingBox(renderer); |
|
1269 |
list->append(CSSPrimitiveValue::create(style->perspectiveOriginX().calcMinValue(box.width()), CSSPrimitiveValue::CSS_PX)); |
|
1270 |
list->append(CSSPrimitiveValue::create(style->perspectiveOriginY().calcMinValue(box.height()), CSSPrimitiveValue::CSS_PX)); |
|
1271 |
} |
|
1272 |
else { |
|
1273 |
list->append(CSSPrimitiveValue::create(style->perspectiveOriginX())); |
|
1274 |
list->append(CSSPrimitiveValue::create(style->perspectiveOriginY())); |
|
1275 |
} |
|
1276 |
return list.release(); |
|
1277 |
} |
|
1278 |
case CSSPropertyWebkitRtlOrdering: |
|
1279 |
if (style->visuallyOrdered()) |
|
1280 |
return CSSPrimitiveValue::createIdentifier(CSSValueVisual); |
|
1281 |
return CSSPrimitiveValue::createIdentifier(CSSValueLogical); |
|
1282 |
case CSSPropertyWebkitUserDrag: |
|
1283 |
return CSSPrimitiveValue::create(style->userDrag()); |
|
1284 |
case CSSPropertyWebkitUserSelect: |
|
1285 |
return CSSPrimitiveValue::create(style->userSelect()); |
|
1286 |
case CSSPropertyBorderBottomLeftRadius: |
|
1287 |
return getBorderRadiusCornerValue(style->borderBottomLeftRadius()); |
|
1288 |
case CSSPropertyBorderBottomRightRadius: |
|
1289 |
return getBorderRadiusCornerValue(style->borderBottomRightRadius()); |
|
1290 |
case CSSPropertyBorderTopLeftRadius: |
|
1291 |
return getBorderRadiusCornerValue(style->borderTopLeftRadius()); |
|
1292 |
case CSSPropertyBorderTopRightRadius: |
|
1293 |
return getBorderRadiusCornerValue(style->borderTopRightRadius()); |
|
1294 |
case CSSPropertyClip: { |
|
1295 |
if (!style->hasClip()) |
|
1296 |
return CSSPrimitiveValue::createIdentifier(CSSValueAuto); |
|
1297 |
RefPtr<Rect> rect = Rect::create(); |
|
1298 |
rect->setTop(CSSPrimitiveValue::create(style->clip().top().value(), CSSPrimitiveValue::CSS_PX)); |
|
1299 |
rect->setRight(CSSPrimitiveValue::create(style->clip().right().value(), CSSPrimitiveValue::CSS_PX)); |
|
1300 |
rect->setBottom(CSSPrimitiveValue::create(style->clip().bottom().value(), CSSPrimitiveValue::CSS_PX)); |
|
1301 |
rect->setLeft(CSSPrimitiveValue::create(style->clip().left().value(), CSSPrimitiveValue::CSS_PX)); |
|
1302 |
return CSSPrimitiveValue::create(rect.release()); |
|
1303 |
} |
|
1304 |
case CSSPropertyWebkitTransform: |
|
1305 |
return computedTransform(renderer, style.get()); |
|
1306 |
case CSSPropertyWebkitTransformOrigin: { |
|
1307 |
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
|
1308 |
if (renderer) { |
|
1309 |
IntRect box = sizingBox(renderer); |
|
1310 |
list->append(CSSPrimitiveValue::create(style->transformOriginX().calcMinValue(box.width()), CSSPrimitiveValue::CSS_PX)); |
|
1311 |
list->append(CSSPrimitiveValue::create(style->transformOriginY().calcMinValue(box.height()), CSSPrimitiveValue::CSS_PX)); |
|
1312 |
if (style->transformOriginZ() != 0) |
|
1313 |
list->append(CSSPrimitiveValue::create(style->transformOriginZ(), CSSPrimitiveValue::CSS_PX)); |
|
1314 |
} else { |
|
1315 |
list->append(CSSPrimitiveValue::create(style->transformOriginX())); |
|
1316 |
list->append(CSSPrimitiveValue::create(style->transformOriginY())); |
|
1317 |
if (style->transformOriginZ() != 0) |
|
1318 |
list->append(CSSPrimitiveValue::create(style->transformOriginZ(), CSSPrimitiveValue::CSS_PX)); |
|
1319 |
} |
|
1320 |
return list.release(); |
|
1321 |
} |
|
1322 |
case CSSPropertyWebkitTransformStyle: |
|
1323 |
return CSSPrimitiveValue::createIdentifier((style->transformStyle3D() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat); |
|
1324 |
case CSSPropertyWebkitTransitionDelay: |
|
1325 |
return getDelayValue(style->transitions()); |
|
1326 |
case CSSPropertyWebkitTransitionDuration: |
|
1327 |
return getDurationValue(style->transitions()); |
|
1328 |
case CSSPropertyWebkitTransitionProperty: { |
|
1329 |
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
|
1330 |
const AnimationList* t = style->transitions(); |
|
1331 |
if (t) { |
|
1332 |
for (size_t i = 0; i < t->size(); ++i) { |
|
1333 |
int prop = t->animation(i)->property(); |
|
1334 |
RefPtr<CSSValue> propertyValue; |
|
1335 |
if (prop == cAnimateNone) |
|
1336 |
propertyValue = CSSPrimitiveValue::createIdentifier(CSSValueNone); |
|
1337 |
else if (prop == cAnimateAll) |
|
1338 |
propertyValue = CSSPrimitiveValue::createIdentifier(CSSValueAll); |
|
1339 |
else |
|
1340 |
propertyValue = CSSPrimitiveValue::create(getPropertyName(static_cast<CSSPropertyID>(prop)), CSSPrimitiveValue::CSS_STRING); |
|
1341 |
list->append(propertyValue); |
|
1342 |
} |
|
1343 |
} else |
|
1344 |
list->append(CSSPrimitiveValue::createIdentifier(CSSValueAll)); |
|
1345 |
return list.release(); |
|
1346 |
} |
|
1347 |
case CSSPropertyWebkitTransitionTimingFunction: |
|
1348 |
return getTimingFunctionValue(style->transitions()); |
|
1349 |
case CSSPropertyPointerEvents: |
|
1350 |
return CSSPrimitiveValue::create(style->pointerEvents()); |
|
1351 |
||
1352 |
/* Shorthand properties, currently not supported see bug 13658*/ |
|
1353 |
case CSSPropertyBackground: |
|
1354 |
case CSSPropertyBorder: |
|
1355 |
case CSSPropertyBorderBottom: |
|
1356 |
case CSSPropertyBorderColor: |
|
1357 |
case CSSPropertyBorderLeft: |
|
1358 |
case CSSPropertyBorderRadius: |
|
1359 |
case CSSPropertyBorderRight: |
|
1360 |
case CSSPropertyBorderStyle: |
|
1361 |
case CSSPropertyBorderTop: |
|
1362 |
case CSSPropertyBorderWidth: |
|
1363 |
case CSSPropertyFont: |
|
1364 |
case CSSPropertyListStyle: |
|
1365 |
case CSSPropertyMargin: |
|
1366 |
case CSSPropertyPadding: |
|
1367 |
break; |
|
1368 |
||
1369 |
/* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */ |
|
1370 |
case CSSPropertyTextLineThrough: |
|
1371 |
case CSSPropertyTextLineThroughColor: |
|
1372 |
case CSSPropertyTextLineThroughMode: |
|
1373 |
case CSSPropertyTextLineThroughStyle: |
|
1374 |
case CSSPropertyTextLineThroughWidth: |
|
1375 |
case CSSPropertyTextOverline: |
|
1376 |
case CSSPropertyTextOverlineColor: |
|
1377 |
case CSSPropertyTextOverlineMode: |
|
1378 |
case CSSPropertyTextOverlineStyle: |
|
1379 |
case CSSPropertyTextOverlineWidth: |
|
1380 |
case CSSPropertyTextUnderline: |
|
1381 |
case CSSPropertyTextUnderlineColor: |
|
1382 |
case CSSPropertyTextUnderlineMode: |
|
1383 |
case CSSPropertyTextUnderlineStyle: |
|
1384 |
case CSSPropertyTextUnderlineWidth: |
|
1385 |
break; |
|
1386 |
||
1387 |
/* Unimplemented @font-face properties */ |
|
1388 |
case CSSPropertyFontStretch: |
|
1389 |
case CSSPropertySrc: |
|
1390 |
case CSSPropertyUnicodeRange: |
|
1391 |
break; |
|
1392 |
||
1393 |
/* Other unimplemented properties */ |
|
1394 |
case CSSPropertyContent: // FIXME: needs implementation, bug 23668 |
|
1395 |
case CSSPropertyCounterIncrement: |
|
1396 |
case CSSPropertyCounterReset: |
|
1397 |
case CSSPropertyOutline: // FIXME: needs implementation |
|
1398 |
case CSSPropertyOutlineOffset: // FIXME: needs implementation |
|
1399 |
case CSSPropertyPage: // for @page |
|
1400 |
case CSSPropertyQuotes: // FIXME: needs implementation |
|
1401 |
case CSSPropertySize: // for @page |
|
1402 |
break; |
|
1403 |
||
1404 |
/* Unimplemented -webkit- properties */ |
|
1405 |
case CSSPropertyWebkitAnimation: |
|
1406 |
case CSSPropertyWebkitBorderRadius: |
|
1407 |
case CSSPropertyWebkitColumns: |
|
1408 |
case CSSPropertyWebkitColumnRule: |
|
1409 |
case CSSPropertyWebkitMarginCollapse: |
|
1410 |
case CSSPropertyWebkitMarginStart: |
|
1411 |
case CSSPropertyWebkitMarquee: |
|
1412 |
case CSSPropertyWebkitMarqueeSpeed: |
|
1413 |
case CSSPropertyWebkitMask: |
|
1414 |
case CSSPropertyWebkitPaddingStart: |
|
1415 |
case CSSPropertyWebkitPerspectiveOriginX: |
|
1416 |
case CSSPropertyWebkitPerspectiveOriginY: |
|
1417 |
case CSSPropertyWebkitTextStroke: |
|
1418 |
case CSSPropertyWebkitTransformOriginX: |
|
1419 |
case CSSPropertyWebkitTransformOriginY: |
|
1420 |
case CSSPropertyWebkitTransformOriginZ: |
|
1421 |
case CSSPropertyWebkitTransition: |
|
1422 |
case CSSPropertyWebkitVariableDeclarationBlock: |
|
1423 |
break; |
|
1424 |
#if ENABLE(SVG) |
|
1425 |
// FIXME: This default case ruins the point of using an enum for |
|
1426 |
// properties -- it prevents us from getting a warning when we |
|
1427 |
// forget to list a property above. |
|
1428 |
default: |
|
1429 |
return getSVGPropertyCSSValue(propertyID, DoNotUpdateLayout); |
|
1430 |
#endif |
|
1431 |
} |
|
1432 |
||
1433 |
logUnimplementedPropertyID(propertyID); |
|
1434 |
return 0; |
|
1435 |
} |
|
1436 |
||
1437 |
String CSSComputedStyleDeclaration::getPropertyValue(int propertyID) const |
|
1438 |
{ |
|
1439 |
RefPtr<CSSValue> value = getPropertyCSSValue(propertyID); |
|
1440 |
if (value) |
|
1441 |
return value->cssText(); |
|
1442 |
return ""; |
|
1443 |
} |
|
1444 |
||
1445 |
bool CSSComputedStyleDeclaration::getPropertyPriority(int /*propertyID*/) const |
|
1446 |
{ |
|
1447 |
// All computed styles have a priority of false (not "important"). |
|
1448 |
return false; |
|
1449 |
} |
|
1450 |
||
1451 |
String CSSComputedStyleDeclaration::removeProperty(int /*propertyID*/, ExceptionCode& ec) |
|
1452 |
{ |
|
1453 |
ec = NO_MODIFICATION_ALLOWED_ERR; |
|
1454 |
return String(); |
|
1455 |
} |
|
1456 |
||
1457 |
void CSSComputedStyleDeclaration::setProperty(int /*propertyID*/, const String& /*value*/, bool /*important*/, ExceptionCode& ec) |
|
1458 |
{ |
|
1459 |
ec = NO_MODIFICATION_ALLOWED_ERR; |
|
1460 |
} |
|
1461 |
||
1462 |
unsigned CSSComputedStyleDeclaration::length() const |
|
1463 |
{ |
|
1464 |
Node* node = m_node.get(); |
|
1465 |
if (!node) |
|
1466 |
return 0; |
|
1467 |
||
1468 |
RenderStyle* style = node->computedStyle(); |
|
1469 |
if (!style) |
|
1470 |
return 0; |
|
1471 |
||
1472 |
return numComputedProperties; |
|
1473 |
} |
|
1474 |
||
1475 |
String CSSComputedStyleDeclaration::item(unsigned i) const |
|
1476 |
{ |
|
1477 |
if (i >= length()) |
|
1478 |
return String(); |
|
1479 |
||
1480 |
return getPropertyName(static_cast<CSSPropertyID>(computedProperties[i])); |
|
1481 |
} |
|
1482 |
||
1483 |
bool CSSComputedStyleDeclaration::cssPropertyMatches(const CSSProperty* property) const |
|
1484 |
{ |
|
1485 |
if (property->id() == CSSPropertyFontSize && property->value()->isPrimitiveValue() && m_node) { |
|
1486 |
m_node->document()->updateLayoutIgnorePendingStylesheets(); |
|
1487 |
RenderStyle* style = m_node->computedStyle(); |
|
1488 |
if (style && style->fontDescription().keywordSize()) { |
|
1489 |
int sizeValue = cssIdentifierForFontSizeKeyword(style->fontDescription().keywordSize()); |
|
1490 |
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(property->value()); |
|
1491 |
if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_IDENT && primitiveValue->getIdent() == sizeValue) |
|
1492 |
return true; |
|
1493 |
} |
|
1494 |
} |
|
1495 |
||
1496 |
return CSSStyleDeclaration::cssPropertyMatches(property); |
|
1497 |
} |
|
1498 |
||
1499 |
PassRefPtr<CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::copy() const |
|
1500 |
{ |
|
1501 |
return copyPropertiesInSet(computedProperties, numComputedProperties); |
|
1502 |
} |
|
1503 |
||
1504 |
PassRefPtr<CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::makeMutable() |
|
1505 |
{ |
|
1506 |
return copy(); |
|
1507 |
} |
|
1508 |
||
1509 |
} // namespace WebCore |