1 /* 2 * Copyright (C) 2004 Zack Rusin <zack (at) kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2007 Alexey Proskuryakov <ap (at) webkit.org> 5 * Copyright (C) 2007 Nicholas Shanks <webkit (at) nickshanks.com> 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public 10 * License as published by the Free Software Foundation; either 11 * version 2 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21 * 02110-1301 USA 22 */ 23 24 #include "config.h" 25 #include "CSSComputedStyleDeclaration.h" 26 27 #include "AnimationController.h" 28 #include "ContentData.h" 29 #include "CounterContent.h" 30 #include "CursorList.h" 31 #include "CSSBorderImageValue.h" 32 #include "CSSLineBoxContainValue.h" 33 #include "CSSMutableStyleDeclaration.h" 34 #include "CSSPrimitiveValue.h" 35 #include "CSSPrimitiveValueCache.h" 36 #include "CSSPrimitiveValueMappings.h" 37 #include "CSSProperty.h" 38 #include "CSSPropertyNames.h" 39 #include "CSSReflectValue.h" 40 #include "CSSSelector.h" 41 #include "CSSTimingFunctionValue.h" 42 #include "CSSValueList.h" 43 #include "Document.h" 44 #include "ExceptionCode.h" 45 #include "Rect.h" 46 #include "RenderBox.h" 47 #include "RenderLayer.h" 48 #include "ShadowValue.h" 49 #ifdef ANDROID_LAYOUT 50 #include "Frame.h" 51 #include "Settings.h" 52 #endif 53 #include "WebKitCSSTransformValue.h" 54 55 #if ENABLE(DASHBOARD_SUPPORT) 56 #include "DashboardRegion.h" 57 #endif 58 59 namespace WebCore { 60 61 // List of all properties we know how to compute, omitting shorthands. 62 static const int computedProperties[] = { 63 CSSPropertyBackgroundAttachment, 64 CSSPropertyBackgroundClip, 65 CSSPropertyBackgroundColor, 66 CSSPropertyBackgroundImage, 67 CSSPropertyBackgroundOrigin, 68 CSSPropertyBackgroundPosition, // more-specific background-position-x/y are non-standard 69 CSSPropertyBackgroundRepeat, 70 CSSPropertyBackgroundSize, 71 CSSPropertyBorderBottomColor, 72 CSSPropertyBorderBottomLeftRadius, 73 CSSPropertyBorderBottomRightRadius, 74 CSSPropertyBorderBottomStyle, 75 CSSPropertyBorderBottomWidth, 76 CSSPropertyBorderCollapse, 77 CSSPropertyBorderLeftColor, 78 CSSPropertyBorderLeftStyle, 79 CSSPropertyBorderLeftWidth, 80 CSSPropertyBorderRightColor, 81 CSSPropertyBorderRightStyle, 82 CSSPropertyBorderRightWidth, 83 CSSPropertyBorderTopColor, 84 CSSPropertyBorderTopLeftRadius, 85 CSSPropertyBorderTopRightRadius, 86 CSSPropertyBorderTopStyle, 87 CSSPropertyBorderTopWidth, 88 CSSPropertyBottom, 89 CSSPropertyBoxShadow, 90 CSSPropertyBoxSizing, 91 CSSPropertyCaptionSide, 92 CSSPropertyClear, 93 CSSPropertyClip, 94 CSSPropertyColor, 95 CSSPropertyCursor, 96 CSSPropertyDirection, 97 CSSPropertyDisplay, 98 CSSPropertyEmptyCells, 99 CSSPropertyFloat, 100 CSSPropertyFontFamily, 101 CSSPropertyFontSize, 102 CSSPropertyFontStyle, 103 CSSPropertyFontVariant, 104 CSSPropertyFontWeight, 105 CSSPropertyHeight, 106 CSSPropertyLeft, 107 CSSPropertyLetterSpacing, 108 CSSPropertyLineHeight, 109 CSSPropertyListStyleImage, 110 CSSPropertyListStylePosition, 111 CSSPropertyListStyleType, 112 CSSPropertyMarginBottom, 113 CSSPropertyMarginLeft, 114 CSSPropertyMarginRight, 115 CSSPropertyMarginTop, 116 CSSPropertyMaxHeight, 117 CSSPropertyMaxWidth, 118 CSSPropertyMinHeight, 119 CSSPropertyMinWidth, 120 CSSPropertyOpacity, 121 CSSPropertyOrphans, 122 CSSPropertyOutlineColor, 123 CSSPropertyOutlineStyle, 124 CSSPropertyOutlineWidth, 125 CSSPropertyOverflowX, 126 CSSPropertyOverflowY, 127 CSSPropertyPaddingBottom, 128 CSSPropertyPaddingLeft, 129 CSSPropertyPaddingRight, 130 CSSPropertyPaddingTop, 131 CSSPropertyPageBreakAfter, 132 CSSPropertyPageBreakBefore, 133 CSSPropertyPageBreakInside, 134 CSSPropertyPointerEvents, 135 CSSPropertyPosition, 136 CSSPropertyResize, 137 CSSPropertyRight, 138 CSSPropertySpeak, 139 CSSPropertyTableLayout, 140 CSSPropertyTextAlign, 141 CSSPropertyTextDecoration, 142 CSSPropertyTextIndent, 143 CSSPropertyTextRendering, 144 CSSPropertyTextShadow, 145 CSSPropertyTextOverflow, 146 CSSPropertyTextTransform, 147 CSSPropertyTop, 148 CSSPropertyUnicodeBidi, 149 CSSPropertyVerticalAlign, 150 CSSPropertyVisibility, 151 CSSPropertyWhiteSpace, 152 CSSPropertyWidows, 153 CSSPropertyWidth, 154 CSSPropertyWordBreak, 155 CSSPropertyWordSpacing, 156 CSSPropertyWordWrap, 157 CSSPropertyZIndex, 158 CSSPropertyZoom, 159 160 CSSPropertyWebkitAnimationDelay, 161 CSSPropertyWebkitAnimationDirection, 162 CSSPropertyWebkitAnimationDuration, 163 CSSPropertyWebkitAnimationFillMode, 164 CSSPropertyWebkitAnimationIterationCount, 165 CSSPropertyWebkitAnimationName, 166 CSSPropertyWebkitAnimationPlayState, 167 CSSPropertyWebkitAnimationTimingFunction, 168 CSSPropertyWebkitAppearance, 169 CSSPropertyWebkitBackfaceVisibility, 170 CSSPropertyWebkitBackgroundClip, 171 CSSPropertyWebkitBackgroundComposite, 172 CSSPropertyWebkitBackgroundOrigin, 173 CSSPropertyWebkitBackgroundSize, 174 CSSPropertyWebkitBorderFit, 175 CSSPropertyWebkitBorderHorizontalSpacing, 176 CSSPropertyWebkitBorderImage, 177 CSSPropertyWebkitBorderVerticalSpacing, 178 CSSPropertyWebkitBoxAlign, 179 CSSPropertyWebkitBoxDirection, 180 CSSPropertyWebkitBoxFlex, 181 CSSPropertyWebkitBoxFlexGroup, 182 CSSPropertyWebkitBoxLines, 183 CSSPropertyWebkitBoxOrdinalGroup, 184 CSSPropertyWebkitBoxOrient, 185 CSSPropertyWebkitBoxPack, 186 CSSPropertyWebkitBoxReflect, 187 CSSPropertyWebkitBoxShadow, 188 CSSPropertyWebkitColorCorrection, 189 CSSPropertyWebkitColumnBreakAfter, 190 CSSPropertyWebkitColumnBreakBefore, 191 CSSPropertyWebkitColumnBreakInside, 192 CSSPropertyWebkitColumnCount, 193 CSSPropertyWebkitColumnGap, 194 CSSPropertyWebkitColumnRuleColor, 195 CSSPropertyWebkitColumnRuleStyle, 196 CSSPropertyWebkitColumnRuleWidth, 197 CSSPropertyWebkitColumnSpan, 198 CSSPropertyWebkitColumnWidth, 199 #if ENABLE(DASHBOARD_SUPPORT) 200 CSSPropertyWebkitDashboardRegion, 201 #endif 202 CSSPropertyWebkitFontSmoothing, 203 CSSPropertyWebkitHighlight, 204 CSSPropertyWebkitHyphenateCharacter, 205 CSSPropertyWebkitHyphenateLimitAfter, 206 CSSPropertyWebkitHyphenateLimitBefore, 207 CSSPropertyWebkitHyphens, 208 CSSPropertyWebkitLineBoxContain, 209 CSSPropertyWebkitLineBreak, 210 CSSPropertyWebkitLineClamp, 211 CSSPropertyWebkitLocale, 212 CSSPropertyWebkitMarginBeforeCollapse, 213 CSSPropertyWebkitMarginAfterCollapse, 214 CSSPropertyWebkitMarqueeDirection, 215 CSSPropertyWebkitMarqueeIncrement, 216 CSSPropertyWebkitMarqueeRepetition, 217 CSSPropertyWebkitMarqueeStyle, 218 CSSPropertyWebkitMaskAttachment, 219 CSSPropertyWebkitMaskBoxImage, 220 CSSPropertyWebkitMaskClip, 221 CSSPropertyWebkitMaskComposite, 222 CSSPropertyWebkitMaskImage, 223 CSSPropertyWebkitMaskOrigin, 224 CSSPropertyWebkitMaskPosition, 225 CSSPropertyWebkitMaskRepeat, 226 CSSPropertyWebkitMaskSize, 227 CSSPropertyWebkitNbspMode, 228 CSSPropertyWebkitPerspective, 229 CSSPropertyWebkitPerspectiveOrigin, 230 CSSPropertyWebkitRtlOrdering, 231 CSSPropertyWebkitTextCombine, 232 CSSPropertyWebkitTextDecorationsInEffect, 233 CSSPropertyWebkitTextEmphasisColor, 234 CSSPropertyWebkitTextEmphasisPosition, 235 CSSPropertyWebkitTextEmphasisStyle, 236 CSSPropertyWebkitTextFillColor, 237 CSSPropertyWebkitTextOrientation, 238 CSSPropertyWebkitTextSecurity, 239 CSSPropertyWebkitTextStrokeColor, 240 CSSPropertyWebkitTextStrokeWidth, 241 CSSPropertyWebkitTransform, 242 CSSPropertyWebkitTransformOrigin, 243 CSSPropertyWebkitTransformStyle, 244 CSSPropertyWebkitTransitionDelay, 245 CSSPropertyWebkitTransitionDuration, 246 CSSPropertyWebkitTransitionProperty, 247 CSSPropertyWebkitTransitionTimingFunction, 248 CSSPropertyWebkitUserDrag, 249 CSSPropertyWebkitUserModify, 250 CSSPropertyWebkitUserSelect, 251 CSSPropertyWebkitWritingMode 252 253 #if ENABLE(SVG) 254 , 255 CSSPropertyClipPath, 256 CSSPropertyClipRule, 257 CSSPropertyMask, 258 CSSPropertyFilter, 259 CSSPropertyFloodColor, 260 CSSPropertyFloodOpacity, 261 CSSPropertyLightingColor, 262 CSSPropertyStopColor, 263 CSSPropertyStopOpacity, 264 CSSPropertyColorInterpolation, 265 CSSPropertyColorInterpolationFilters, 266 CSSPropertyColorRendering, 267 CSSPropertyFill, 268 CSSPropertyFillOpacity, 269 CSSPropertyFillRule, 270 CSSPropertyImageRendering, 271 CSSPropertyMarkerEnd, 272 CSSPropertyMarkerMid, 273 CSSPropertyMarkerStart, 274 CSSPropertyShapeRendering, 275 CSSPropertyStroke, 276 CSSPropertyStrokeDasharray, 277 CSSPropertyStrokeDashoffset, 278 CSSPropertyStrokeLinecap, 279 CSSPropertyStrokeLinejoin, 280 CSSPropertyStrokeMiterlimit, 281 CSSPropertyStrokeOpacity, 282 CSSPropertyStrokeWidth, 283 CSSPropertyAlignmentBaseline, 284 CSSPropertyBaselineShift, 285 CSSPropertyDominantBaseline, 286 CSSPropertyKerning, 287 CSSPropertyTextAnchor, 288 CSSPropertyWritingMode, 289 CSSPropertyGlyphOrientationHorizontal, 290 CSSPropertyGlyphOrientationVertical, 291 CSSPropertyWebkitSvgShadow, 292 CSSPropertyVectorEffect 293 #endif 294 #ifdef ANDROID_CSS_RING 295 , 296 CSSPropertyWebkitRingFillColor, 297 CSSPropertyWebkitRingInnerWidth, 298 CSSPropertyWebkitRingOuterWidth, 299 CSSPropertyWebkitRingOutset, 300 CSSPropertyWebkitRingPressedInnerColor, 301 CSSPropertyWebkitRingPressedOuterColor, 302 CSSPropertyWebkitRingRadius, 303 CSSPropertyWebkitRingSelectedInnerColor, 304 CSSPropertyWebkitRingSelectedOuterColor 305 #endif 306 #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR 307 , 308 CSSPropertyWebkitTapHighlightColor 309 #endif 310 }; 311 312 const unsigned numComputedProperties = WTF_ARRAY_LENGTH(computedProperties); 313 314 static int valueForRepeatRule(int rule) 315 { 316 switch (rule) { 317 case RepeatImageRule: 318 return CSSValueRepeat; 319 case RoundImageRule: 320 return CSSValueRound; 321 default: 322 return CSSValueStretch; 323 } 324 } 325 326 static PassRefPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image, CSSPrimitiveValueCache* primitiveValueCache) 327 { 328 if (!image.hasImage()) 329 return primitiveValueCache->createIdentifierValue(CSSValueNone); 330 331 // Image first. 332 RefPtr<CSSValue> imageValue; 333 if (image.image()) 334 imageValue = image.image()->cssValue(); 335 336 // Create the slices. 337 RefPtr<CSSPrimitiveValue> top; 338 if (image.slices().top().isPercent()) 339 top = primitiveValueCache->createValue(image.slices().top().value(), CSSPrimitiveValue::CSS_PERCENTAGE); 340 else 341 top = primitiveValueCache->createValue(image.slices().top().value(), CSSPrimitiveValue::CSS_NUMBER); 342 343 RefPtr<CSSPrimitiveValue> right; 344 if (image.slices().right().isPercent()) 345 right = primitiveValueCache->createValue(image.slices().right().value(), CSSPrimitiveValue::CSS_PERCENTAGE); 346 else 347 right = primitiveValueCache->createValue(image.slices().right().value(), CSSPrimitiveValue::CSS_NUMBER); 348 349 RefPtr<CSSPrimitiveValue> bottom; 350 if (image.slices().bottom().isPercent()) 351 bottom = primitiveValueCache->createValue(image.slices().bottom().value(), CSSPrimitiveValue::CSS_PERCENTAGE); 352 else 353 bottom = primitiveValueCache->createValue(image.slices().bottom().value(), CSSPrimitiveValue::CSS_NUMBER); 354 355 RefPtr<CSSPrimitiveValue> left; 356 if (image.slices().left().isPercent()) 357 left = primitiveValueCache->createValue(image.slices().left().value(), CSSPrimitiveValue::CSS_PERCENTAGE); 358 else 359 left = primitiveValueCache->createValue(image.slices().left().value(), CSSPrimitiveValue::CSS_NUMBER); 360 361 RefPtr<Rect> rect = Rect::create(); 362 rect->setTop(top); 363 rect->setRight(right); 364 rect->setBottom(bottom); 365 rect->setLeft(left); 366 367 return CSSBorderImageValue::create(imageValue, rect, valueForRepeatRule(image.horizontalRule()), valueForRepeatRule(image.verticalRule())); 368 } 369 370 inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(int value, const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache) 371 { 372 return primitiveValueCache->createValue(adjustForAbsoluteZoom(value, style), CSSPrimitiveValue::CSS_PX); 373 } 374 375 inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedNumberValue(double value, const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache) 376 { 377 return primitiveValueCache->createValue(value / style->effectiveZoom(), CSSPrimitiveValue::CSS_NUMBER); 378 } 379 380 static PassRefPtr<CSSValue> zoomAdjustedPixelValueForLength(const Length& length, const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache) 381 { 382 if (length.isFixed()) 383 return zoomAdjustedPixelValue(length.value(), style, primitiveValueCache); 384 return primitiveValueCache->createValue(length); 385 } 386 387 static PassRefPtr<CSSValue> valueForReflection(const StyleReflection* reflection, const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache) 388 { 389 if (!reflection) 390 return primitiveValueCache->createIdentifierValue(CSSValueNone); 391 392 RefPtr<CSSPrimitiveValue> offset; 393 if (reflection->offset().isPercent()) 394 offset = primitiveValueCache->createValue(reflection->offset().percent(), CSSPrimitiveValue::CSS_PERCENTAGE); 395 else 396 offset = zoomAdjustedPixelValue(reflection->offset().value(), style, primitiveValueCache); 397 398 return CSSReflectValue::create(reflection->direction(), offset.release(), valueForNinePieceImage(reflection->mask(), primitiveValueCache)); 399 } 400 401 static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, int propertyID, CSSPrimitiveValueCache* primitiveValueCache) 402 { 403 if (!style) 404 return 0; 405 406 Length l; 407 switch (propertyID) { 408 case CSSPropertyLeft: 409 l = style->left(); 410 break; 411 case CSSPropertyRight: 412 l = style->right(); 413 break; 414 case CSSPropertyTop: 415 l = style->top(); 416 break; 417 case CSSPropertyBottom: 418 l = style->bottom(); 419 break; 420 default: 421 return 0; 422 } 423 424 if (style->position() == AbsolutePosition || style->position() == FixedPosition) { 425 if (l.type() == WebCore::Fixed) 426 return zoomAdjustedPixelValue(l.value(), style, primitiveValueCache); 427 return primitiveValueCache->createValue(l); 428 } 429 430 if (style->position() == RelativePosition) 431 // FIXME: It's not enough to simply return "auto" values for one offset if the other side is defined. 432 // In other words if left is auto and right is not auto, then left's computed value is negative right(). 433 // So we should get the opposite length unit and see if it is auto. 434 return primitiveValueCache->createValue(l); 435 436 return primitiveValueCache->createIdentifierValue(CSSValueAuto); 437 } 438 439 PassRefPtr<CSSPrimitiveValue> CSSComputedStyleDeclaration::currentColorOrValidColor(RenderStyle* style, const Color& color) const 440 { 441 // This function does NOT look at visited information, so that computed style doesn't expose that. 442 CSSPrimitiveValueCache* primitiveValueCache = m_node->document()->cssPrimitiveValueCache().get(); 443 if (!color.isValid()) 444 return primitiveValueCache->createColorValue(style->color().rgb()); 445 return primitiveValueCache->createColorValue(color.rgb()); 446 } 447 448 static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius, const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache) 449 { 450 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 451 if (radius.width() == radius.height()) { 452 if (radius.width().type() == Percent) 453 return primitiveValueCache->createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE); 454 return zoomAdjustedPixelValue(radius.width().value(), style, primitiveValueCache); 455 } 456 if (radius.width().type() == Percent) 457 list->append(primitiveValueCache->createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE)); 458 else 459 list->append(zoomAdjustedPixelValue(radius.width().value(), style, primitiveValueCache)); 460 if (radius.height().type() == Percent) 461 list->append(primitiveValueCache->createValue(radius.height().percent(), CSSPrimitiveValue::CSS_PERCENTAGE)); 462 else 463 list->append(zoomAdjustedPixelValue(radius.height().value(), style, primitiveValueCache)); 464 return list.release(); 465 } 466 467 static IntRect sizingBox(RenderObject* renderer) 468 { 469 if (!renderer->isBox()) 470 return IntRect(); 471 472 RenderBox* box = toRenderBox(renderer); 473 return box->style()->boxSizing() == CONTENT_BOX ? box->contentBoxRect() : box->borderBoxRect(); 474 } 475 476 static inline bool hasCompositedLayer(RenderObject* renderer) 477 { 478 return renderer && renderer->hasLayer() && toRenderBoxModelObject(renderer)->layer()->isComposited(); 479 } 480 481 static PassRefPtr<CSSValue> computedTransform(RenderObject* renderer, const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache) 482 { 483 if (!renderer || style->transform().operations().isEmpty()) 484 return primitiveValueCache->createIdentifierValue(CSSValueNone); 485 486 IntRect box = sizingBox(renderer); 487 488 TransformationMatrix transform; 489 style->applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOrigin); 490 // Note that this does not flatten to an affine transform if ENABLE(3D_RENDERING) is off, by design. 491 492 RefPtr<WebKitCSSTransformValue> transformVal; 493 494 // FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924) 495 if (transform.isAffine()) { 496 transformVal = WebKitCSSTransformValue::create(WebKitCSSTransformValue::MatrixTransformOperation); 497 498 transformVal->append(primitiveValueCache->createValue(transform.a(), CSSPrimitiveValue::CSS_NUMBER)); 499 transformVal->append(primitiveValueCache->createValue(transform.b(), CSSPrimitiveValue::CSS_NUMBER)); 500 transformVal->append(primitiveValueCache->createValue(transform.c(), CSSPrimitiveValue::CSS_NUMBER)); 501 transformVal->append(primitiveValueCache->createValue(transform.d(), CSSPrimitiveValue::CSS_NUMBER)); 502 transformVal->append(zoomAdjustedNumberValue(transform.e(), style, primitiveValueCache)); 503 transformVal->append(zoomAdjustedNumberValue(transform.f(), style, primitiveValueCache)); 504 } else { 505 transformVal = WebKitCSSTransformValue::create(WebKitCSSTransformValue::Matrix3DTransformOperation); 506 507 transformVal->append(primitiveValueCache->createValue(transform.m11(), CSSPrimitiveValue::CSS_NUMBER)); 508 transformVal->append(primitiveValueCache->createValue(transform.m12(), CSSPrimitiveValue::CSS_NUMBER)); 509 transformVal->append(primitiveValueCache->createValue(transform.m13(), CSSPrimitiveValue::CSS_NUMBER)); 510 transformVal->append(primitiveValueCache->createValue(transform.m14(), CSSPrimitiveValue::CSS_NUMBER)); 511 512 transformVal->append(primitiveValueCache->createValue(transform.m21(), CSSPrimitiveValue::CSS_NUMBER)); 513 transformVal->append(primitiveValueCache->createValue(transform.m22(), CSSPrimitiveValue::CSS_NUMBER)); 514 transformVal->append(primitiveValueCache->createValue(transform.m23(), CSSPrimitiveValue::CSS_NUMBER)); 515 transformVal->append(primitiveValueCache->createValue(transform.m24(), CSSPrimitiveValue::CSS_NUMBER)); 516 517 transformVal->append(primitiveValueCache->createValue(transform.m31(), CSSPrimitiveValue::CSS_NUMBER)); 518 transformVal->append(primitiveValueCache->createValue(transform.m32(), CSSPrimitiveValue::CSS_NUMBER)); 519 transformVal->append(primitiveValueCache->createValue(transform.m33(), CSSPrimitiveValue::CSS_NUMBER)); 520 transformVal->append(primitiveValueCache->createValue(transform.m34(), CSSPrimitiveValue::CSS_NUMBER)); 521 522 transformVal->append(zoomAdjustedNumberValue(transform.m41(), style, primitiveValueCache)); 523 transformVal->append(zoomAdjustedNumberValue(transform.m42(), style, primitiveValueCache)); 524 transformVal->append(zoomAdjustedNumberValue(transform.m43(), style, primitiveValueCache)); 525 transformVal->append(primitiveValueCache->createValue(transform.m44(), CSSPrimitiveValue::CSS_NUMBER)); 526 } 527 528 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 529 list->append(transformVal); 530 531 return list.release(); 532 } 533 534 static PassRefPtr<CSSValue> getDelayValue(const AnimationList* animList, CSSPrimitiveValueCache* primitiveValueCache) 535 { 536 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 537 if (animList) { 538 for (size_t i = 0; i < animList->size(); ++i) 539 list->append(primitiveValueCache->createValue(animList->animation(i)->delay(), CSSPrimitiveValue::CSS_S)); 540 } else { 541 // Note that initialAnimationDelay() is used for both transitions and animations 542 list->append(primitiveValueCache->createValue(Animation::initialAnimationDelay(), CSSPrimitiveValue::CSS_S)); 543 } 544 return list.release(); 545 } 546 547 static PassRefPtr<CSSValue> getDurationValue(const AnimationList* animList, CSSPrimitiveValueCache* primitiveValueCache) 548 { 549 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 550 if (animList) { 551 for (size_t i = 0; i < animList->size(); ++i) 552 list->append(primitiveValueCache->createValue(animList->animation(i)->duration(), CSSPrimitiveValue::CSS_S)); 553 } else { 554 // Note that initialAnimationDuration() is used for both transitions and animations 555 list->append(primitiveValueCache->createValue(Animation::initialAnimationDuration(), CSSPrimitiveValue::CSS_S)); 556 } 557 return list.release(); 558 } 559 560 static PassRefPtr<CSSValue> getTimingFunctionValue(const AnimationList* animList) 561 { 562 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 563 if (animList) { 564 for (size_t i = 0; i < animList->size(); ++i) { 565 const TimingFunction* tf = animList->animation(i)->timingFunction().get(); 566 if (tf->isCubicBezierTimingFunction()) { 567 const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(tf); 568 list->append(CSSCubicBezierTimingFunctionValue::create(ctf->x1(), ctf->y1(), ctf->x2(), ctf->y2())); 569 } else if (tf->isStepsTimingFunction()) { 570 const StepsTimingFunction* stf = static_cast<const StepsTimingFunction*>(tf); 571 list->append(CSSStepsTimingFunctionValue::create(stf->numberOfSteps(), stf->stepAtStart())); 572 } else { 573 list->append(CSSLinearTimingFunctionValue::create()); 574 } 575 } 576 } else { 577 // Note that initialAnimationTimingFunction() is used for both transitions and animations 578 RefPtr<TimingFunction> tf = Animation::initialAnimationTimingFunction(); 579 if (tf->isCubicBezierTimingFunction()) { 580 const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(tf.get()); 581 list->append(CSSCubicBezierTimingFunctionValue::create(ctf->x1(), ctf->y1(), ctf->x2(), ctf->y2())); 582 } else if (tf->isStepsTimingFunction()) { 583 const StepsTimingFunction* stf = static_cast<const StepsTimingFunction*>(tf.get()); 584 list->append(CSSStepsTimingFunctionValue::create(stf->numberOfSteps(), stf->stepAtStart())); 585 } else { 586 list->append(CSSLinearTimingFunctionValue::create()); 587 } 588 } 589 return list.release(); 590 } 591 592 static PassRefPtr<CSSValue> createLineBoxContainValue(CSSPrimitiveValueCache* primitiveValueCache, unsigned lineBoxContain) 593 { 594 if (!lineBoxContain) 595 return primitiveValueCache->createIdentifierValue(CSSValueNone); 596 return CSSLineBoxContainValue::create(lineBoxContain); 597 } 598 599 CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(PassRefPtr<Node> n, bool allowVisitedStyle, const String& pseudoElementName) 600 : m_node(n) 601 , m_allowVisitedStyle(allowVisitedStyle) 602 { 603 unsigned nameWithoutColonsStart = pseudoElementName[0] == ':' ? (pseudoElementName[1] == ':' ? 2 : 1) : 0; 604 m_pseudoElementSpecifier = CSSSelector::pseudoId(CSSSelector::parsePseudoType( 605 AtomicString(pseudoElementName.substring(nameWithoutColonsStart)))); 606 } 607 608 CSSComputedStyleDeclaration::~CSSComputedStyleDeclaration() 609 { 610 } 611 612 String CSSComputedStyleDeclaration::cssText() const 613 { 614 String result(""); 615 616 for (unsigned i = 0; i < numComputedProperties; i++) { 617 if (i) 618 result += " "; 619 result += getPropertyName(static_cast<CSSPropertyID>(computedProperties[i])); 620 result += ": "; 621 result += getPropertyValue(computedProperties[i]); 622 result += ";"; 623 } 624 625 return result; 626 } 627 628 void CSSComputedStyleDeclaration::setCssText(const String&, ExceptionCode& ec) 629 { 630 ec = NO_MODIFICATION_ALLOWED_ERR; 631 } 632 633 static int cssIdentifierForFontSizeKeyword(int keywordSize) 634 { 635 ASSERT_ARG(keywordSize, keywordSize); 636 ASSERT_ARG(keywordSize, keywordSize <= 8); 637 return CSSValueXxSmall + keywordSize - 1; 638 } 639 640 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringKeyword() const 641 { 642 if (!m_node) 643 return 0; 644 645 m_node->document()->updateLayoutIgnorePendingStylesheets(); 646 647 RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier); 648 if (!style) 649 return 0; 650 651 CSSPrimitiveValueCache* primitiveValueCache = m_node->document()->cssPrimitiveValueCache().get(); 652 653 if (int keywordSize = style->fontDescription().keywordSize()) 654 return primitiveValueCache->createIdentifierValue(cssIdentifierForFontSizeKeyword(keywordSize)); 655 656 657 return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), style.get(), primitiveValueCache); 658 } 659 660 bool CSSComputedStyleDeclaration::useFixedFontDefaultSize() const 661 { 662 if (!m_node) 663 return false; 664 665 RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier); 666 if (!style) 667 return false; 668 669 return style->fontDescription().useFixedDefaultSize(); 670 } 671 672 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const ShadowData* shadow, int id, RenderStyle* style) const 673 { 674 CSSPrimitiveValueCache* primitiveValueCache = m_node->document()->cssPrimitiveValueCache().get(); 675 if (!shadow) 676 return primitiveValueCache->createIdentifierValue(CSSValueNone); 677 678 CSSPropertyID propertyID = static_cast<CSSPropertyID>(id); 679 680 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 681 for (const ShadowData* s = shadow; s; s = s->next()) { 682 RefPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(s->x(), style, primitiveValueCache); 683 RefPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(s->y(), style, primitiveValueCache); 684 RefPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(s->blur(), style, primitiveValueCache); 685 RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? PassRefPtr<CSSPrimitiveValue>() : zoomAdjustedPixelValue(s->spread(), style, primitiveValueCache); 686 RefPtr<CSSPrimitiveValue> style = propertyID == CSSPropertyTextShadow || s->style() == Normal ? PassRefPtr<CSSPrimitiveValue>() : primitiveValueCache->createIdentifierValue(CSSValueInset); 687 RefPtr<CSSPrimitiveValue> color = primitiveValueCache->createColorValue(s->color().rgb()); 688 list->prepend(ShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release())); 689 } 690 return list.release(); 691 } 692 693 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int propertyID) const 694 { 695 return getPropertyCSSValue(propertyID, UpdateLayout); 696 } 697 698 static int identifierForFamily(const AtomicString& family) 699 { 700 DEFINE_STATIC_LOCAL(AtomicString, cursiveFamily, ("-webkit-cursive")); 701 DEFINE_STATIC_LOCAL(AtomicString, fantasyFamily, ("-webkit-fantasy")); 702 DEFINE_STATIC_LOCAL(AtomicString, monospaceFamily, ("-webkit-monospace")); 703 DEFINE_STATIC_LOCAL(AtomicString, sansSerifFamily, ("-webkit-sans-serif")); 704 DEFINE_STATIC_LOCAL(AtomicString, serifFamily, ("-webkit-serif")); 705 if (family == cursiveFamily) 706 return CSSValueCursive; 707 if (family == fantasyFamily) 708 return CSSValueFantasy; 709 if (family == monospaceFamily) 710 return CSSValueMonospace; 711 if (family == sansSerifFamily) 712 return CSSValueSansSerif; 713 if (family == serifFamily) 714 return CSSValueSerif; 715 return 0; 716 } 717 718 static PassRefPtr<CSSPrimitiveValue> valueForFamily(const AtomicString& family, CSSPrimitiveValueCache* primitiveValueCache) 719 { 720 if (int familyIdentifier = identifierForFamily(family)) 721 return primitiveValueCache->createIdentifierValue(familyIdentifier); 722 return primitiveValueCache->createValue(family.string(), CSSPrimitiveValue::CSS_STRING); 723 } 724 725 static PassRefPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration, CSSPrimitiveValueCache* primitiveValueCache) 726 { 727 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 728 if (textDecoration & UNDERLINE) 729 list->append(primitiveValueCache->createIdentifierValue(CSSValueUnderline)); 730 if (textDecoration & OVERLINE) 731 list->append(primitiveValueCache->createIdentifierValue(CSSValueOverline)); 732 if (textDecoration & LINE_THROUGH) 733 list->append(primitiveValueCache->createIdentifierValue(CSSValueLineThrough)); 734 if (textDecoration & BLINK) 735 list->append(primitiveValueCache->createIdentifierValue(CSSValueBlink)); 736 737 if (!list->length()) 738 return primitiveValueCache->createIdentifierValue(CSSValueNone); 739 return list; 740 } 741 742 static PassRefPtr<CSSValue> fillRepeatToCSSValue(EFillRepeat xRepeat, EFillRepeat yRepeat, CSSPrimitiveValueCache* primitiveValueCache) 743 { 744 // For backwards compatibility, if both values are equal, just return one of them. And 745 // if the two values are equivalent to repeat-x or repeat-y, just return the shorthand. 746 if (xRepeat == yRepeat) 747 return primitiveValueCache->createValue(xRepeat); 748 if (xRepeat == RepeatFill && yRepeat == NoRepeatFill) 749 return primitiveValueCache->createIdentifierValue(CSSValueRepeatX); 750 if (xRepeat == NoRepeatFill && yRepeat == RepeatFill) 751 return primitiveValueCache->createIdentifierValue(CSSValueRepeatY); 752 753 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 754 list->append(primitiveValueCache->createValue(xRepeat)); 755 list->append(primitiveValueCache->createValue(yRepeat)); 756 return list.release(); 757 } 758 759 static PassRefPtr<CSSValue> fillSizeToCSSValue(const FillSize& fillSize, CSSPrimitiveValueCache* primitiveValueCache) 760 { 761 if (fillSize.type == Contain) 762 return primitiveValueCache->createIdentifierValue(CSSValueContain); 763 764 if (fillSize.type == Cover) 765 return primitiveValueCache->createIdentifierValue(CSSValueCover); 766 767 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 768 list->append(primitiveValueCache->createValue(fillSize.size.width())); 769 list->append(primitiveValueCache->createValue(fillSize.size.height())); 770 return list.release(); 771 } 772 773 static PassRefPtr<CSSValue> contentToCSSValue(const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache) 774 { 775 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 776 for (const ContentData* contentData = style->contentData(); contentData; contentData = contentData->next()) { 777 if (contentData->isCounter()) { 778 const CounterContent* counter = contentData->counter(); 779 ASSERT(counter); 780 list->append(primitiveValueCache->createValue(counter->identifier(), CSSPrimitiveValue::CSS_COUNTER_NAME)); 781 } else if (contentData->isImage()) { 782 const StyleImage* image = contentData->image(); 783 ASSERT(image); 784 list->append(image->cssValue()); 785 } else if (contentData->isText()) 786 list->append(primitiveValueCache->createValue(contentData->text(), CSSPrimitiveValue::CSS_STRING)); 787 } 788 return list.release(); 789 } 790 791 static PassRefPtr<CSSValue> counterToCSSValue(const RenderStyle* style, int propertyID, CSSPrimitiveValueCache* primitiveValueCache) 792 { 793 const CounterDirectiveMap* map = style->counterDirectives(); 794 if (!map) 795 return 0; 796 797 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 798 for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end(); ++it) { 799 list->append(primitiveValueCache->createValue(it->first.get(), CSSPrimitiveValue::CSS_STRING)); 800 short number = propertyID == CSSPropertyCounterIncrement ? it->second.m_incrementValue : it->second.m_resetValue; 801 list->append(primitiveValueCache->createValue((double)number, CSSPrimitiveValue::CSS_NUMBER)); 802 } 803 return list.release(); 804 } 805 806 static void logUnimplementedPropertyID(int propertyID) 807 { 808 DEFINE_STATIC_LOCAL(HashSet<int>, propertyIDSet, ()); 809 if (!propertyIDSet.add(propertyID).second) 810 return; 811 812 LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", getPropertyName(static_cast<CSSPropertyID>(propertyID))); 813 } 814 815 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int propertyID, EUpdateLayout updateLayout) const 816 { 817 Node* node = m_node.get(); 818 if (!node) 819 return 0; 820 821 // Make sure our layout is up to date before we allow a query on these attributes. 822 if (updateLayout) 823 node->document()->updateLayoutIgnorePendingStylesheets(); 824 825 RenderObject* renderer = node->renderer(); 826 827 RefPtr<RenderStyle> style; 828 if (renderer && hasCompositedLayer(renderer) && AnimationController::supportsAcceleratedAnimationOfProperty(static_cast<CSSPropertyID>(propertyID))) { 829 style = renderer->animation()->getAnimatedStyleForRenderer(renderer); 830 if (m_pseudoElementSpecifier) { 831 // FIXME: This cached pseudo style will only exist if the animation has been run at least once. 832 style = style->getCachedPseudoStyle(m_pseudoElementSpecifier); 833 } 834 } else 835 style = node->computedStyle(m_pseudoElementSpecifier); 836 837 if (!style) 838 return 0; 839 840 CSSPrimitiveValueCache* primitiveValueCache = node->document()->cssPrimitiveValueCache().get(); 841 842 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style->direction(), style->writingMode()); 843 #ifdef ANDROID_LAYOUT 844 const Settings * settings = node->document()->frame() ? node->document()->frame()->settings() : 0; 845 #endif 846 847 switch (static_cast<CSSPropertyID>(propertyID)) { 848 case CSSPropertyInvalid: 849 break; 850 851 case CSSPropertyBackgroundColor: 852 return primitiveValueCache->createColorValue(m_allowVisitedStyle? style->visitedDependentColor(CSSPropertyBackgroundColor).rgb() : style->backgroundColor().rgb()); 853 case CSSPropertyBackgroundImage: 854 case CSSPropertyWebkitMaskImage: { 855 const FillLayer* layers = propertyID == CSSPropertyWebkitMaskImage ? style->maskLayers() : style->backgroundLayers(); 856 if (!layers) 857 return primitiveValueCache->createIdentifierValue(CSSValueNone); 858 859 if (!layers->next()) { 860 if (layers->image()) 861 return layers->image()->cssValue(); 862 863 return primitiveValueCache->createIdentifierValue(CSSValueNone); 864 } 865 866 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 867 for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) { 868 if (currLayer->image()) 869 list->append(currLayer->image()->cssValue()); 870 else 871 list->append(primitiveValueCache->createIdentifierValue(CSSValueNone)); 872 } 873 return list.release(); 874 } 875 case CSSPropertyBackgroundSize: 876 case CSSPropertyWebkitBackgroundSize: 877 case CSSPropertyWebkitMaskSize: { 878 const FillLayer* layers = propertyID == CSSPropertyWebkitMaskSize ? style->maskLayers() : style->backgroundLayers(); 879 if (!layers->next()) 880 return fillSizeToCSSValue(layers->size(), primitiveValueCache); 881 882 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 883 for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) 884 list->append(fillSizeToCSSValue(currLayer->size(), primitiveValueCache)); 885 886 return list.release(); 887 } 888 case CSSPropertyBackgroundRepeat: 889 case CSSPropertyWebkitMaskRepeat: { 890 const FillLayer* layers = propertyID == CSSPropertyWebkitMaskRepeat ? style->maskLayers() : style->backgroundLayers(); 891 if (!layers->next()) 892 return fillRepeatToCSSValue(layers->repeatX(), layers->repeatY(), primitiveValueCache); 893 894 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 895 for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) 896 list->append(fillRepeatToCSSValue(currLayer->repeatX(), currLayer->repeatY(), primitiveValueCache)); 897 898 return list.release(); 899 } 900 case CSSPropertyWebkitBackgroundComposite: 901 case CSSPropertyWebkitMaskComposite: { 902 const FillLayer* layers = propertyID == CSSPropertyWebkitMaskComposite ? style->maskLayers() : style->backgroundLayers(); 903 if (!layers->next()) 904 return primitiveValueCache->createValue(layers->composite()); 905 906 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 907 for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) 908 list->append(primitiveValueCache->createValue(currLayer->composite())); 909 910 return list.release(); 911 } 912 case CSSPropertyBackgroundAttachment: 913 case CSSPropertyWebkitMaskAttachment: { 914 const FillLayer* layers = propertyID == CSSPropertyWebkitMaskAttachment ? style->maskLayers() : style->backgroundLayers(); 915 if (!layers->next()) 916 return primitiveValueCache->createValue(layers->attachment()); 917 918 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 919 for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) 920 list->append(primitiveValueCache->createValue(currLayer->attachment())); 921 922 return list.release(); 923 } 924 case CSSPropertyBackgroundClip: 925 case CSSPropertyBackgroundOrigin: 926 case CSSPropertyWebkitBackgroundClip: 927 case CSSPropertyWebkitBackgroundOrigin: 928 case CSSPropertyWebkitMaskClip: 929 case CSSPropertyWebkitMaskOrigin: { 930 const FillLayer* layers = (propertyID == CSSPropertyWebkitMaskClip || propertyID == CSSPropertyWebkitMaskOrigin) ? style->maskLayers() : style->backgroundLayers(); 931 bool isClip = propertyID == CSSPropertyBackgroundClip || propertyID == CSSPropertyWebkitBackgroundClip || propertyID == CSSPropertyWebkitMaskClip; 932 if (!layers->next()) { 933 EFillBox box = isClip ? layers->clip() : layers->origin(); 934 return primitiveValueCache->createValue(box); 935 } 936 937 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 938 for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) { 939 EFillBox box = isClip ? currLayer->clip() : currLayer->origin(); 940 list->append(primitiveValueCache->createValue(box)); 941 } 942 943 return list.release(); 944 } 945 case CSSPropertyBackgroundPosition: 946 case CSSPropertyWebkitMaskPosition: { 947 const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPosition ? style->maskLayers() : style->backgroundLayers(); 948 if (!layers->next()) { 949 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 950 list->append(primitiveValueCache->createValue(layers->xPosition())); 951 list->append(primitiveValueCache->createValue(layers->yPosition())); 952 return list.release(); 953 } 954 955 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 956 for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) { 957 RefPtr<CSSValueList> positionList = CSSValueList::createSpaceSeparated(); 958 positionList->append(primitiveValueCache->createValue(currLayer->xPosition())); 959 positionList->append(primitiveValueCache->createValue(currLayer->yPosition())); 960 list->append(positionList); 961 } 962 963 return list.release(); 964 } 965 case CSSPropertyBackgroundPositionX: 966 case CSSPropertyWebkitMaskPositionX: { 967 const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPositionX ? style->maskLayers() : style->backgroundLayers(); 968 if (!layers->next()) 969 return primitiveValueCache->createValue(layers->xPosition()); 970 971 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 972 for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) 973 list->append(primitiveValueCache->createValue(currLayer->xPosition())); 974 975 return list.release(); 976 } 977 case CSSPropertyBackgroundPositionY: 978 case CSSPropertyWebkitMaskPositionY: { 979 const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPositionY ? style->maskLayers() : style->backgroundLayers(); 980 if (!layers->next()) 981 return primitiveValueCache->createValue(layers->yPosition()); 982 983 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 984 for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) 985 list->append(primitiveValueCache->createValue(currLayer->yPosition())); 986 987 return list.release(); 988 } 989 case CSSPropertyBorderCollapse: 990 if (style->borderCollapse()) 991 return primitiveValueCache->createIdentifierValue(CSSValueCollapse); 992 return primitiveValueCache->createIdentifierValue(CSSValueSeparate); 993 case CSSPropertyBorderSpacing: { 994 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 995 list->append(zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get(), primitiveValueCache)); 996 list->append(zoomAdjustedPixelValue(style->verticalBorderSpacing(), style.get(), primitiveValueCache)); 997 return list.release(); 998 } 999 case CSSPropertyWebkitBorderHorizontalSpacing: 1000 return zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get(), primitiveValueCache); 1001 case CSSPropertyWebkitBorderVerticalSpacing: 1002 return zoomAdjustedPixelValue(style->verticalBorderSpacing(), style.get(), primitiveValueCache); 1003 case CSSPropertyBorderTopColor: 1004 return m_allowVisitedStyle ? primitiveValueCache->createColorValue(style->visitedDependentColor(CSSPropertyBorderTopColor).rgb()) : currentColorOrValidColor(style.get(), style->borderTopColor()); 1005 case CSSPropertyBorderRightColor: 1006 return m_allowVisitedStyle ? primitiveValueCache->createColorValue(style->visitedDependentColor(CSSPropertyBorderRightColor).rgb()) : currentColorOrValidColor(style.get(), style->borderRightColor()); 1007 case CSSPropertyBorderBottomColor: 1008 return m_allowVisitedStyle ? primitiveValueCache->createColorValue(style->visitedDependentColor(CSSPropertyBorderBottomColor).rgb()) : currentColorOrValidColor(style.get(), style->borderBottomColor()); 1009 case CSSPropertyBorderLeftColor: 1010 return m_allowVisitedStyle ? primitiveValueCache->createColorValue(style->visitedDependentColor(CSSPropertyBorderLeftColor).rgb()) : currentColorOrValidColor(style.get(), style->borderLeftColor()); 1011 case CSSPropertyBorderTopStyle: 1012 return primitiveValueCache->createValue(style->borderTopStyle()); 1013 case CSSPropertyBorderRightStyle: 1014 return primitiveValueCache->createValue(style->borderRightStyle()); 1015 case CSSPropertyBorderBottomStyle: 1016 return primitiveValueCache->createValue(style->borderBottomStyle()); 1017 case CSSPropertyBorderLeftStyle: 1018 return primitiveValueCache->createValue(style->borderLeftStyle()); 1019 case CSSPropertyBorderTopWidth: 1020 return zoomAdjustedPixelValue(style->borderTopWidth(), style.get(), primitiveValueCache); 1021 case CSSPropertyBorderRightWidth: 1022 return zoomAdjustedPixelValue(style->borderRightWidth(), style.get(), primitiveValueCache); 1023 case CSSPropertyBorderBottomWidth: 1024 return zoomAdjustedPixelValue(style->borderBottomWidth(), style.get(), primitiveValueCache); 1025 case CSSPropertyBorderLeftWidth: 1026 return zoomAdjustedPixelValue(style->borderLeftWidth(), style.get(), primitiveValueCache); 1027 case CSSPropertyBottom: 1028 return getPositionOffsetValue(style.get(), CSSPropertyBottom, primitiveValueCache); 1029 case CSSPropertyWebkitBoxAlign: 1030 return primitiveValueCache->createValue(style->boxAlign()); 1031 case CSSPropertyWebkitBoxDirection: 1032 return primitiveValueCache->createValue(style->boxDirection()); 1033 case CSSPropertyWebkitBoxFlex: 1034 return primitiveValueCache->createValue(style->boxFlex(), CSSPrimitiveValue::CSS_NUMBER); 1035 case CSSPropertyWebkitBoxFlexGroup: 1036 return primitiveValueCache->createValue(style->boxFlexGroup(), CSSPrimitiveValue::CSS_NUMBER); 1037 case CSSPropertyWebkitBoxLines: 1038 return primitiveValueCache->createValue(style->boxLines()); 1039 case CSSPropertyWebkitBoxOrdinalGroup: 1040 return primitiveValueCache->createValue(style->boxOrdinalGroup(), CSSPrimitiveValue::CSS_NUMBER); 1041 case CSSPropertyWebkitBoxOrient: 1042 return primitiveValueCache->createValue(style->boxOrient()); 1043 case CSSPropertyWebkitBoxPack: { 1044 EBoxAlignment boxPack = style->boxPack(); 1045 ASSERT(boxPack != BSTRETCH); 1046 ASSERT(boxPack != BBASELINE); 1047 if (boxPack == BJUSTIFY || boxPack== BBASELINE) 1048 return 0; 1049 return primitiveValueCache->createValue(boxPack); 1050 } 1051 case CSSPropertyWebkitBoxReflect: 1052 return valueForReflection(style->boxReflect(), style.get(), primitiveValueCache); 1053 case CSSPropertyBoxShadow: 1054 case CSSPropertyWebkitBoxShadow: 1055 return valueForShadow(style->boxShadow(), propertyID, style.get()); 1056 case CSSPropertyCaptionSide: 1057 return primitiveValueCache->createValue(style->captionSide()); 1058 case CSSPropertyClear: 1059 return primitiveValueCache->createValue(style->clear()); 1060 case CSSPropertyColor: 1061 return primitiveValueCache->createColorValue(m_allowVisitedStyle ? style->visitedDependentColor(CSSPropertyColor).rgb() : style->color().rgb()); 1062 case CSSPropertyWebkitColumnCount: 1063 if (style->hasAutoColumnCount()) 1064 return primitiveValueCache->createIdentifierValue(CSSValueAuto); 1065 return primitiveValueCache->createValue(style->columnCount(), CSSPrimitiveValue::CSS_NUMBER); 1066 case CSSPropertyWebkitColumnGap: 1067 if (style->hasNormalColumnGap()) 1068 return primitiveValueCache->createIdentifierValue(CSSValueNormal); 1069 return primitiveValueCache->createValue(style->columnGap(), CSSPrimitiveValue::CSS_NUMBER); 1070 case CSSPropertyWebkitColumnRuleColor: 1071 return m_allowVisitedStyle ? primitiveValueCache->createColorValue(style->visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style.get(), style->columnRuleColor()); 1072 case CSSPropertyWebkitColumnRuleStyle: 1073 return primitiveValueCache->createValue(style->columnRuleStyle()); 1074 case CSSPropertyWebkitColumnRuleWidth: 1075 return zoomAdjustedPixelValue(style->columnRuleWidth(), style.get(), primitiveValueCache); 1076 case CSSPropertyWebkitColumnSpan: 1077 if (style->columnSpan()) 1078 return primitiveValueCache->createIdentifierValue(CSSValueAll); 1079 return primitiveValueCache->createValue(1, CSSPrimitiveValue::CSS_NUMBER); 1080 case CSSPropertyWebkitColumnBreakAfter: 1081 return primitiveValueCache->createValue(style->columnBreakAfter()); 1082 case CSSPropertyWebkitColumnBreakBefore: 1083 return primitiveValueCache->createValue(style->columnBreakBefore()); 1084 case CSSPropertyWebkitColumnBreakInside: 1085 return primitiveValueCache->createValue(style->columnBreakInside()); 1086 case CSSPropertyWebkitColumnWidth: 1087 if (style->hasAutoColumnWidth()) 1088 return primitiveValueCache->createIdentifierValue(CSSValueAuto); 1089 return primitiveValueCache->createValue(style->columnWidth(), CSSPrimitiveValue::CSS_NUMBER); 1090 case CSSPropertyCursor: { 1091 RefPtr<CSSValueList> list; 1092 CursorList* cursors = style->cursors(); 1093 if (cursors && cursors->size() > 0) { 1094 list = CSSValueList::createCommaSeparated(); 1095 for (unsigned i = 0; i < cursors->size(); ++i) 1096 if (StyleImage* image = cursors->at(i).image()) 1097 list->append(image->cssValue()); 1098 } 1099 RefPtr<CSSValue> value = primitiveValueCache->createValue(style->cursor()); 1100 if (list) { 1101 list->append(value); 1102 return list.release(); 1103 } 1104 return value.release(); 1105 } 1106 case CSSPropertyDirection: 1107 return primitiveValueCache->createValue(style->direction()); 1108 case CSSPropertyDisplay: 1109 return primitiveValueCache->createValue(style->display()); 1110 case CSSPropertyEmptyCells: 1111 return primitiveValueCache->createValue(style->emptyCells()); 1112 case CSSPropertyFloat: 1113 #ifdef ANDROID_LAYOUT 1114 if (settings && settings->layoutAlgorithm() == Settings::kLayoutSSR) 1115 return primitiveValueCache->createIdentifierValue(CSSValueNone); 1116 #endif 1117 return primitiveValueCache->createValue(style->floating()); 1118 case CSSPropertyFontFamily: { 1119 const FontFamily& firstFamily = style->fontDescription().family(); 1120 if (!firstFamily.next()) 1121 return valueForFamily(firstFamily.family(), primitiveValueCache); 1122 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 1123 for (const FontFamily* family = &firstFamily; family; family = family->next()) 1124 list->append(valueForFamily(family->family(), primitiveValueCache)); 1125 return list.release(); 1126 } 1127 case CSSPropertyFontSize: 1128 return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), style.get(), primitiveValueCache); 1129 case CSSPropertyFontStyle: 1130 if (style->fontDescription().italic()) 1131 return primitiveValueCache->createIdentifierValue(CSSValueItalic); 1132 return primitiveValueCache->createIdentifierValue(CSSValueNormal); 1133 case CSSPropertyFontVariant: 1134 if (style->fontDescription().smallCaps()) 1135 return primitiveValueCache->createIdentifierValue(CSSValueSmallCaps); 1136 return primitiveValueCache->createIdentifierValue(CSSValueNormal); 1137 case CSSPropertyFontWeight: 1138 switch (style->fontDescription().weight()) { 1139 case FontWeight100: 1140 return primitiveValueCache->createIdentifierValue(CSSValue100); 1141 case FontWeight200: 1142 return primitiveValueCache->createIdentifierValue(CSSValue200); 1143 case FontWeight300: 1144 return primitiveValueCache->createIdentifierValue(CSSValue300); 1145 case FontWeightNormal: 1146 return primitiveValueCache->createIdentifierValue(CSSValueNormal); 1147 case FontWeight500: 1148 return primitiveValueCache->createIdentifierValue(CSSValue500); 1149 case FontWeight600: 1150 return primitiveValueCache->createIdentifierValue(CSSValue600); 1151 case FontWeightBold: 1152 return primitiveValueCache->createIdentifierValue(CSSValueBold); 1153 case FontWeight800: 1154 return primitiveValueCache->createIdentifierValue(CSSValue800); 1155 case FontWeight900: 1156 return primitiveValueCache->createIdentifierValue(CSSValue900); 1157 } 1158 ASSERT_NOT_REACHED(); 1159 return primitiveValueCache->createIdentifierValue(CSSValueNormal); 1160 case CSSPropertyHeight: 1161 if (renderer) 1162 return zoomAdjustedPixelValue(sizingBox(renderer).height(), style.get(), primitiveValueCache); 1163 return zoomAdjustedPixelValueForLength(style->height(), style.get(), primitiveValueCache); 1164 case CSSPropertyWebkitHighlight: 1165 if (style->highlight() == nullAtom) 1166 return primitiveValueCache->createIdentifierValue(CSSValueNone); 1167 return primitiveValueCache->createValue(style->highlight(), CSSPrimitiveValue::CSS_STRING); 1168 case CSSPropertyWebkitHyphens: 1169 return primitiveValueCache->createValue(style->hyphens()); 1170 case CSSPropertyWebkitHyphenateCharacter: 1171 if (style->hyphenationString().isNull()) 1172 return primitiveValueCache->createIdentifierValue(CSSValueAuto); 1173 return primitiveValueCache->createValue(style->hyphenationString(), CSSPrimitiveValue::CSS_STRING); 1174 case CSSPropertyWebkitHyphenateLimitAfter: 1175 if (style->hyphenationLimitAfter() < 0) 1176 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 1177 return CSSPrimitiveValue::create(style->hyphenationLimitAfter(), CSSPrimitiveValue::CSS_NUMBER); 1178 case CSSPropertyWebkitHyphenateLimitBefore: 1179 if (style->hyphenationLimitBefore() < 0) 1180 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 1181 return CSSPrimitiveValue::create(style->hyphenationLimitBefore(), CSSPrimitiveValue::CSS_NUMBER); 1182 case CSSPropertyWebkitBorderFit: 1183 if (style->borderFit() == BorderFitBorder) 1184 return primitiveValueCache->createIdentifierValue(CSSValueBorder); 1185 return primitiveValueCache->createIdentifierValue(CSSValueLines); 1186 case CSSPropertyLeft: 1187 return getPositionOffsetValue(style.get(), CSSPropertyLeft, primitiveValueCache); 1188 case CSSPropertyLetterSpacing: 1189 if (!style->letterSpacing()) 1190 return primitiveValueCache->createIdentifierValue(CSSValueNormal); 1191 return zoomAdjustedPixelValue(style->letterSpacing(), style.get(), primitiveValueCache); 1192 case CSSPropertyWebkitLineClamp: 1193 if (style->lineClamp().isNone()) 1194 return primitiveValueCache->createIdentifierValue(CSSValueNone); 1195 return primitiveValueCache->createValue(style->lineClamp().value(), style->lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveValue::CSS_NUMBER); 1196 case CSSPropertyLineHeight: { 1197 Length length = style->lineHeight(); 1198 if (length.isNegative()) 1199 return primitiveValueCache->createIdentifierValue(CSSValueNormal); 1200 if (length.isPercent()) 1201 // This is imperfect, because it doesn't include the zoom factor and the real computation 1202 // for how high to be in pixels does include things like minimum font size and the zoom factor. 1203 // On the other hand, since font-size doesn't include the zoom factor, we really can't do 1204 // that here either. 1205 return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, style.get(), primitiveValueCache); 1206 return zoomAdjustedPixelValue(length.value(), style.get(), primitiveValueCache); 1207 } 1208 case CSSPropertyListStyleImage: 1209 if (style->listStyleImage()) 1210 return style->listStyleImage()->cssValue(); 1211 return primitiveValueCache->createIdentifierValue(CSSValueNone); 1212 case CSSPropertyListStylePosition: 1213 return primitiveValueCache->createValue(style->listStylePosition()); 1214 case CSSPropertyListStyleType: 1215 return primitiveValueCache->createValue(style->listStyleType()); 1216 case CSSPropertyWebkitLocale: 1217 if (style->locale().isNull()) 1218 return primitiveValueCache->createIdentifierValue(CSSValueAuto); 1219 return primitiveValueCache->createValue(style->locale(), CSSPrimitiveValue::CSS_STRING); 1220 case CSSPropertyMarginTop: { 1221 Length marginTop = style->marginTop(); 1222 if (marginTop.isPercent()) 1223 return primitiveValueCache->createValue(marginTop); 1224 return zoomAdjustedPixelValue(marginTop.value(), style.get(), primitiveValueCache); 1225 } 1226 case CSSPropertyMarginRight: { 1227 Length marginRight = style->marginRight(); 1228 if (marginRight.isPercent()) 1229 return primitiveValueCache->createValue(marginRight); 1230 return zoomAdjustedPixelValue(marginRight.value(), style.get(), primitiveValueCache); 1231 } 1232 case CSSPropertyMarginBottom: { 1233 Length marginBottom = style->marginBottom(); 1234 if (marginBottom.isPercent()) 1235 return primitiveValueCache->createValue(marginBottom); 1236 return zoomAdjustedPixelValue(marginBottom.value(), style.get(), primitiveValueCache); 1237 } 1238 case CSSPropertyMarginLeft: { 1239 Length marginLeft = style->marginLeft(); 1240 if (marginLeft.isPercent()) 1241 return primitiveValueCache->createValue(marginLeft); 1242 return zoomAdjustedPixelValue(marginLeft.value(), style.get(), primitiveValueCache); 1243 } 1244 case CSSPropertyWebkitMarqueeDirection: 1245 return primitiveValueCache->createValue(style->marqueeDirection()); 1246 case CSSPropertyWebkitMarqueeIncrement: 1247 return primitiveValueCache->createValue(style->marqueeIncrement()); 1248 case CSSPropertyWebkitMarqueeRepetition: 1249 if (style->marqueeLoopCount() < 0) 1250 return primitiveValueCache->createIdentifierValue(CSSValueInfinite); 1251 return primitiveValueCache->createValue(style->marqueeLoopCount(), CSSPrimitiveValue::CSS_NUMBER); 1252 case CSSPropertyWebkitMarqueeStyle: 1253 return primitiveValueCache->createValue(style->marqueeBehavior()); 1254 case CSSPropertyWebkitUserModify: 1255 return primitiveValueCache->createValue(style->userModify()); 1256 case CSSPropertyMaxHeight: { 1257 const Length& maxHeight = style->maxHeight(); 1258 if (maxHeight.isFixed() && maxHeight.value() == undefinedLength) 1259 return primitiveValueCache->createIdentifierValue(CSSValueNone); 1260 return primitiveValueCache->createValue(maxHeight); 1261 } 1262 case CSSPropertyMaxWidth: { 1263 const Length& maxWidth = style->maxWidth(); 1264 if (maxWidth.isFixed() && maxWidth.value() == undefinedLength) 1265 return primitiveValueCache->createIdentifierValue(CSSValueNone); 1266 return primitiveValueCache->createValue(maxWidth); 1267 } 1268 case CSSPropertyMinHeight: 1269 return primitiveValueCache->createValue(style->minHeight()); 1270 case CSSPropertyMinWidth: 1271 return primitiveValueCache->createValue(style->minWidth()); 1272 case CSSPropertyOpacity: 1273 return primitiveValueCache->createValue(style->opacity(), CSSPrimitiveValue::CSS_NUMBER); 1274 case CSSPropertyOrphans: 1275 return primitiveValueCache->createValue(style->orphans(), CSSPrimitiveValue::CSS_NUMBER); 1276 case CSSPropertyOutlineColor: 1277 return m_allowVisitedStyle ? primitiveValueCache->createColorValue(style->visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style.get(), style->outlineColor()); 1278 case CSSPropertyOutlineOffset: 1279 return zoomAdjustedPixelValue(style->outlineOffset(), style.get(), primitiveValueCache); 1280 case CSSPropertyOutlineStyle: 1281 if (style->outlineStyleIsAuto()) 1282 return primitiveValueCache->createIdentifierValue(CSSValueAuto); 1283 return primitiveValueCache->createValue(style->outlineStyle()); 1284 case CSSPropertyOutlineWidth: 1285 return zoomAdjustedPixelValue(style->outlineWidth(), style.get(), primitiveValueCache); 1286 case CSSPropertyOverflow: 1287 return primitiveValueCache->createValue(max(style->overflowX(), style->overflowY())); 1288 case CSSPropertyOverflowX: 1289 return primitiveValueCache->createValue(style->overflowX()); 1290 case CSSPropertyOverflowY: 1291 #ifdef ANDROID_LAYOUT 1292 if (settings && settings->layoutAlgorithm() == Settings::kLayoutSSR) 1293 return primitiveValueCache->createIdentifierValue(CSSValueVisible); 1294 #endif 1295 return primitiveValueCache->createValue(style->overflowY()); 1296 case CSSPropertyPaddingTop: 1297 if (renderer && renderer->isBox()) 1298 return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingTop(false), style.get(), primitiveValueCache); 1299 return primitiveValueCache->createValue(style->paddingTop()); 1300 case CSSPropertyPaddingRight: 1301 if (renderer && renderer->isBox()) 1302 return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingRight(false), style.get(), primitiveValueCache); 1303 return primitiveValueCache->createValue(style->paddingRight()); 1304 case CSSPropertyPaddingBottom: 1305 if (renderer && renderer->isBox()) 1306 return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingBottom(false), style.get(), primitiveValueCache); 1307 return primitiveValueCache->createValue(style->paddingBottom()); 1308 case CSSPropertyPaddingLeft: 1309 if (renderer && renderer->isBox()) 1310 return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingLeft(false), style.get(), primitiveValueCache); 1311 return primitiveValueCache->createValue(style->paddingLeft()); 1312 case CSSPropertyPageBreakAfter: 1313 return primitiveValueCache->createValue(style->pageBreakAfter()); 1314 case CSSPropertyPageBreakBefore: 1315 return primitiveValueCache->createValue(style->pageBreakBefore()); 1316 case CSSPropertyPageBreakInside: { 1317 EPageBreak pageBreak = style->pageBreakInside(); 1318 ASSERT(pageBreak != PBALWAYS); 1319 if (pageBreak == PBALWAYS) 1320 return 0; 1321 return primitiveValueCache->createValue(style->pageBreakInside()); 1322 } 1323 case CSSPropertyPosition: 1324 #ifdef ANDROID_LAYOUT 1325 if (settings && settings->layoutAlgorithm() == Settings::kLayoutSSR) 1326 return primitiveValueCache->createIdentifierValue(CSSValueStatic); 1327 #endif 1328 return primitiveValueCache->createValue(style->position()); 1329 case CSSPropertyRight: 1330 return getPositionOffsetValue(style.get(), CSSPropertyRight, primitiveValueCache); 1331 case CSSPropertyTableLayout: 1332 return primitiveValueCache->createValue(style->tableLayout()); 1333 case CSSPropertyTextAlign: 1334 return primitiveValueCache->createValue(style->textAlign()); 1335 case CSSPropertyTextDecoration: 1336 return renderTextDecorationFlagsToCSSValue(style->textDecoration(), primitiveValueCache); 1337 case CSSPropertyWebkitTextDecorationsInEffect: 1338 return renderTextDecorationFlagsToCSSValue(style->textDecorationsInEffect(), primitiveValueCache); 1339 case CSSPropertyWebkitTextFillColor: 1340 return currentColorOrValidColor(style.get(), style->textFillColor()); 1341 case CSSPropertyWebkitTextEmphasisColor: 1342 return currentColorOrValidColor(style.get(), style->textEmphasisColor()); 1343 case CSSPropertyWebkitTextEmphasisPosition: 1344 return primitiveValueCache->createValue(style->textEmphasisPosition()); 1345 case CSSPropertyWebkitTextEmphasisStyle: 1346 switch (style->textEmphasisMark()) { 1347 case TextEmphasisMarkNone: 1348 return primitiveValueCache->createIdentifierValue(CSSValueNone); 1349 case TextEmphasisMarkCustom: 1350 return primitiveValueCache->createValue(style->textEmphasisCustomMark(), CSSPrimitiveValue::CSS_STRING); 1351 case TextEmphasisMarkAuto: 1352 ASSERT_NOT_REACHED(); 1353 // Fall through 1354 case TextEmphasisMarkDot: 1355 case TextEmphasisMarkCircle: 1356 case TextEmphasisMarkDoubleCircle: 1357 case TextEmphasisMarkTriangle: 1358 case TextEmphasisMarkSesame: { 1359 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 1360 list->append(primitiveValueCache->createValue(style->textEmphasisFill())); 1361 list->append(primitiveValueCache->createValue(style->textEmphasisMark())); 1362 return list.release(); 1363 } 1364 } 1365 case CSSPropertyTextIndent: 1366 return primitiveValueCache->createValue(style->textIndent()); 1367 case CSSPropertyTextShadow: 1368 return valueForShadow(style->textShadow(), propertyID, style.get()); 1369 case CSSPropertyTextRendering: 1370 return primitiveValueCache->createValue(style->fontDescription().textRenderingMode()); 1371 case CSSPropertyTextOverflow: 1372 if (style->textOverflow()) 1373 return primitiveValueCache->createIdentifierValue(CSSValueEllipsis); 1374 return primitiveValueCache->createIdentifierValue(CSSValueClip); 1375 case CSSPropertyWebkitTextSecurity: 1376 return primitiveValueCache->createValue(style->textSecurity()); 1377 case CSSPropertyWebkitTextSizeAdjust: 1378 if (style->textSizeAdjust()) 1379 return primitiveValueCache->createIdentifierValue(CSSValueAuto); 1380 return primitiveValueCache->createIdentifierValue(CSSValueNone); 1381 case CSSPropertyWebkitTextStrokeColor: 1382 return currentColorOrValidColor(style.get(), style->textStrokeColor()); 1383 case CSSPropertyWebkitTextStrokeWidth: 1384 return zoomAdjustedPixelValue(style->textStrokeWidth(), style.get(), primitiveValueCache); 1385 case CSSPropertyTextTransform: 1386 return primitiveValueCache->createValue(style->textTransform()); 1387 case CSSPropertyTop: 1388 return getPositionOffsetValue(style.get(), CSSPropertyTop, primitiveValueCache); 1389 case CSSPropertyUnicodeBidi: 1390 return primitiveValueCache->createValue(style->unicodeBidi()); 1391 case CSSPropertyVerticalAlign: 1392 switch (style->verticalAlign()) { 1393 case BASELINE: 1394 return primitiveValueCache->createIdentifierValue(CSSValueBaseline); 1395 case MIDDLE: 1396 return primitiveValueCache->createIdentifierValue(CSSValueMiddle); 1397 case SUB: 1398 return primitiveValueCache->createIdentifierValue(CSSValueSub); 1399 case SUPER: 1400 return primitiveValueCache->createIdentifierValue(CSSValueSuper); 1401 case TEXT_TOP: 1402 return primitiveValueCache->createIdentifierValue(CSSValueTextTop); 1403 case TEXT_BOTTOM: 1404 return primitiveValueCache->createIdentifierValue(CSSValueTextBottom); 1405 case TOP: 1406 return primitiveValueCache->createIdentifierValue(CSSValueTop); 1407 case BOTTOM: 1408 return primitiveValueCache->createIdentifierValue(CSSValueBottom); 1409 case BASELINE_MIDDLE: 1410 return primitiveValueCache->createIdentifierValue(CSSValueWebkitBaselineMiddle); 1411 case LENGTH: 1412 return primitiveValueCache->createValue(style->verticalAlignLength()); 1413 } 1414 ASSERT_NOT_REACHED(); 1415 return 0; 1416 case CSSPropertyVisibility: 1417 #ifdef ANDROID_LAYOUT 1418 if (settings && settings->layoutAlgorithm() == Settings::kLayoutSSR) 1419 return primitiveValueCache->createIdentifierValue(CSSValueVisible); 1420 #endif 1421 return primitiveValueCache->createValue(style->visibility()); 1422 case CSSPropertyWhiteSpace: 1423 #ifdef ANDROID_LAYOUT 1424 if (settings && settings->layoutAlgorithm() == Settings::kLayoutSSR) 1425 switch (style->whiteSpace()) { 1426 case NORMAL: 1427 case NOWRAP: 1428 case KHTML_NOWRAP: 1429 return primitiveValueCache->createIdentifierValue(CSSValueNormal); 1430 case PRE: 1431 case PRE_WRAP: 1432 return primitiveValueCache->createIdentifierValue(CSSValuePreWrap); 1433 case PRE_LINE: 1434 return primitiveValueCache->createIdentifierValue(CSSValuePreLine); 1435 } 1436 else 1437 #endif 1438 return primitiveValueCache->createValue(style->whiteSpace()); 1439 case CSSPropertyWidows: 1440 return primitiveValueCache->createValue(style->widows(), CSSPrimitiveValue::CSS_NUMBER); 1441 case CSSPropertyWidth: 1442 if (renderer) 1443 return zoomAdjustedPixelValue(sizingBox(renderer).width(), style.get(), primitiveValueCache); 1444 return zoomAdjustedPixelValueForLength(style->width(), style.get(), primitiveValueCache); 1445 case CSSPropertyWordBreak: 1446 return primitiveValueCache->createValue(style->wordBreak()); 1447 case CSSPropertyWordSpacing: 1448 return zoomAdjustedPixelValue(style->wordSpacing(), style.get(), primitiveValueCache); 1449 case CSSPropertyWordWrap: 1450 return primitiveValueCache->createValue(style->wordWrap()); 1451 case CSSPropertyWebkitLineBreak: 1452 return primitiveValueCache->createValue(style->khtmlLineBreak()); 1453 case CSSPropertyWebkitNbspMode: 1454 return primitiveValueCache->createValue(style->nbspMode()); 1455 case CSSPropertyWebkitMatchNearestMailBlockquoteColor: 1456 return primitiveValueCache->createValue(style->matchNearestMailBlockquoteColor()); 1457 case CSSPropertyResize: 1458 return primitiveValueCache->createValue(style->resize()); 1459 case CSSPropertyWebkitFontSmoothing: 1460 return primitiveValueCache->createValue(style->fontDescription().fontSmoothing()); 1461 case CSSPropertyZIndex: 1462 if (style->hasAutoZIndex()) 1463 return primitiveValueCache->createIdentifierValue(CSSValueAuto); 1464 return primitiveValueCache->createValue(style->zIndex(), CSSPrimitiveValue::CSS_NUMBER); 1465 case CSSPropertyZoom: 1466 return primitiveValueCache->createValue(style->zoom(), CSSPrimitiveValue::CSS_NUMBER); 1467 case CSSPropertyBoxSizing: 1468 if (style->boxSizing() == CONTENT_BOX) 1469 return primitiveValueCache->createIdentifierValue(CSSValueContentBox); 1470 return primitiveValueCache->createIdentifierValue(CSSValueBorderBox); 1471 #if ENABLE(DASHBOARD_SUPPORT) 1472 case CSSPropertyWebkitDashboardRegion: 1473 { 1474 const Vector<StyleDashboardRegion>& regions = style->dashboardRegions(); 1475 unsigned count = regions.size(); 1476 if (count == 1 && regions[0].type == StyleDashboardRegion::None) 1477 return primitiveValueCache->createIdentifierValue(CSSValueNone); 1478 1479 RefPtr<DashboardRegion> firstRegion; 1480 DashboardRegion* previousRegion = 0; 1481 for (unsigned i = 0; i < count; i++) { 1482 RefPtr<DashboardRegion> region = DashboardRegion::create(); 1483 StyleDashboardRegion styleRegion = regions[i]; 1484 1485 region->m_label = styleRegion.label; 1486 LengthBox offset = styleRegion.offset; 1487 region->setTop(zoomAdjustedPixelValue(offset.top().value(), style.get(), primitiveValueCache)); 1488 region->setRight(zoomAdjustedPixelValue(offset.right().value(), style.get(), primitiveValueCache)); 1489 region->setBottom(zoomAdjustedPixelValue(offset.bottom().value(), style.get(), primitiveValueCache)); 1490 region->setLeft(zoomAdjustedPixelValue(offset.left().value(), style.get(), primitiveValueCache)); 1491 region->m_isRectangle = (styleRegion.type == StyleDashboardRegion::Rectangle); 1492 region->m_isCircle = (styleRegion.type == StyleDashboardRegion::Circle); 1493 1494 if (previousRegion) 1495 previousRegion->m_next = region; 1496 else 1497 firstRegion = region; 1498 previousRegion = region.get(); 1499 } 1500 return primitiveValueCache->createValue(firstRegion.release()); 1501 } 1502 #endif 1503 case CSSPropertyWebkitAnimationDelay: 1504 return getDelayValue(style->animations(), primitiveValueCache); 1505 case CSSPropertyWebkitAnimationDirection: { 1506 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 1507 const AnimationList* t = style->animations(); 1508 if (t) { 1509 for (size_t i = 0; i < t->size(); ++i) { 1510 if (t->animation(i)->direction()) 1511 list->append(primitiveValueCache->createIdentifierValue(CSSValueAlternate)); 1512 else 1513 list->append(primitiveValueCache->createIdentifierValue(CSSValueNormal)); 1514 } 1515 } else 1516 list->append(primitiveValueCache->createIdentifierValue(CSSValueNormal)); 1517 return list.release(); 1518 } 1519 case CSSPropertyWebkitAnimationDuration: 1520 return getDurationValue(style->animations(), primitiveValueCache); 1521 case CSSPropertyWebkitAnimationFillMode: { 1522 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 1523 const AnimationList* t = style->animations(); 1524 if (t) { 1525 for (size_t i = 0; i < t->size(); ++i) { 1526 switch (t->animation(i)->fillMode()) { 1527 case AnimationFillModeNone: 1528 list->append(primitiveValueCache->createIdentifierValue(CSSValueNone)); 1529 break; 1530 case AnimationFillModeForwards: 1531 list->append(primitiveValueCache->createIdentifierValue(CSSValueForwards)); 1532 break; 1533 case AnimationFillModeBackwards: 1534 list->append(primitiveValueCache->createIdentifierValue(CSSValueBackwards)); 1535 break; 1536 case AnimationFillModeBoth: 1537 list->append(primitiveValueCache->createIdentifierValue(CSSValueBoth)); 1538 break; 1539 } 1540 } 1541 } else 1542 list->append(primitiveValueCache->createIdentifierValue(CSSValueNone)); 1543 return list.release(); 1544 } 1545 case CSSPropertyWebkitAnimationIterationCount: { 1546 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 1547 const AnimationList* t = style->animations(); 1548 if (t) { 1549 for (size_t i = 0; i < t->size(); ++i) { 1550 int iterationCount = t->animation(i)->iterationCount(); 1551 if (iterationCount == Animation::IterationCountInfinite) 1552 list->append(primitiveValueCache->createIdentifierValue(CSSValueInfinite)); 1553 else 1554 list->append(primitiveValueCache->createValue(iterationCount, CSSPrimitiveValue::CSS_NUMBER)); 1555 } 1556 } else 1557 list->append(primitiveValueCache->createValue(Animation::initialAnimationIterationCount(), CSSPrimitiveValue::CSS_NUMBER)); 1558 return list.release(); 1559 } 1560 case CSSPropertyWebkitAnimationName: { 1561 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 1562 const AnimationList* t = style->animations(); 1563 if (t) { 1564 for (size_t i = 0; i < t->size(); ++i) 1565 list->append(primitiveValueCache->createValue(t->animation(i)->name(), CSSPrimitiveValue::CSS_STRING)); 1566 } else 1567 list->append(primitiveValueCache->createIdentifierValue(CSSValueNone)); 1568 return list.release(); 1569 } 1570 case CSSPropertyWebkitAnimationPlayState: { 1571 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 1572 const AnimationList* t = style->animations(); 1573 if (t) { 1574 for (size_t i = 0; i < t->size(); ++i) { 1575 int prop = t->animation(i)->playState(); 1576 if (prop == AnimPlayStatePlaying) 1577 list->append(primitiveValueCache->createIdentifierValue(CSSValueRunning)); 1578 else 1579 list->append(primitiveValueCache->createIdentifierValue(CSSValuePaused)); 1580 } 1581 } else 1582 list->append(primitiveValueCache->createIdentifierValue(CSSValueRunning)); 1583 return list.release(); 1584 } 1585 case CSSPropertyWebkitAnimationTimingFunction: 1586 return getTimingFunctionValue(style->animations()); 1587 case CSSPropertyWebkitAppearance: 1588 return primitiveValueCache->createValue(style->appearance()); 1589 case CSSPropertyWebkitBackfaceVisibility: 1590 return primitiveValueCache->createIdentifierValue((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible); 1591 case CSSPropertyWebkitBorderImage: 1592 return valueForNinePieceImage(style->borderImage(), primitiveValueCache); 1593 case CSSPropertyWebkitMaskBoxImage: 1594 return valueForNinePieceImage(style->maskBoxImage(), primitiveValueCache); 1595 case CSSPropertyWebkitFontSizeDelta: 1596 // Not a real style property -- used by the editing engine -- so has no computed value. 1597 break; 1598 case CSSPropertyWebkitMarginBottomCollapse: 1599 case CSSPropertyWebkitMarginAfterCollapse: 1600 return primitiveValueCache->createValue(style->marginAfterCollapse()); 1601 case CSSPropertyWebkitMarginTopCollapse: 1602 case CSSPropertyWebkitMarginBeforeCollapse: 1603 return primitiveValueCache->createValue(style->marginBeforeCollapse()); 1604 case CSSPropertyWebkitPerspective: 1605 if (!style->hasPerspective()) 1606 return primitiveValueCache->createIdentifierValue(CSSValueNone); 1607 return primitiveValueCache->createValue(style->perspective(), CSSPrimitiveValue::CSS_NUMBER); 1608 case CSSPropertyWebkitPerspectiveOrigin: { 1609 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 1610 if (renderer) { 1611 IntRect box = sizingBox(renderer); 1612 list->append(zoomAdjustedPixelValue(style->perspectiveOriginX().calcMinValue(box.width()), style.get(), primitiveValueCache)); 1613 list->append(zoomAdjustedPixelValue(style->perspectiveOriginY().calcMinValue(box.height()), style.get(), primitiveValueCache)); 1614 } 1615 else { 1616 list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginX(), style.get(), primitiveValueCache)); 1617 list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginY(), style.get(), primitiveValueCache)); 1618 1619 } 1620 return list.release(); 1621 } 1622 case CSSPropertyWebkitRtlOrdering: 1623 if (style->visuallyOrdered()) 1624 return primitiveValueCache->createIdentifierValue(CSSValueVisual); 1625 return primitiveValueCache->createIdentifierValue(CSSValueLogical); 1626 case CSSPropertyWebkitUserDrag: 1627 return primitiveValueCache->createValue(style->userDrag()); 1628 case CSSPropertyWebkitUserSelect: 1629 return primitiveValueCache->createValue(style->userSelect()); 1630 case CSSPropertyBorderBottomLeftRadius: 1631 return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), style.get(), primitiveValueCache); 1632 case CSSPropertyBorderBottomRightRadius: 1633 return getBorderRadiusCornerValue(style->borderBottomRightRadius(), style.get(), primitiveValueCache); 1634 case CSSPropertyBorderTopLeftRadius: 1635 return getBorderRadiusCornerValue(style->borderTopLeftRadius(), style.get(), primitiveValueCache); 1636 case CSSPropertyBorderTopRightRadius: 1637 return getBorderRadiusCornerValue(style->borderTopRightRadius(), style.get(), primitiveValueCache); 1638 case CSSPropertyClip: { 1639 if (!style->hasClip()) 1640 return primitiveValueCache->createIdentifierValue(CSSValueAuto); 1641 RefPtr<Rect> rect = Rect::create(); 1642 rect->setTop(zoomAdjustedPixelValue(style->clip().top().value(), style.get(), primitiveValueCache)); 1643 rect->setRight(zoomAdjustedPixelValue(style->clip().right().value(), style.get(), primitiveValueCache)); 1644 rect->setBottom(zoomAdjustedPixelValue(style->clip().bottom().value(), style.get(), primitiveValueCache)); 1645 rect->setLeft(zoomAdjustedPixelValue(style->clip().left().value(), style.get(), primitiveValueCache)); 1646 return primitiveValueCache->createValue(rect.release()); 1647 } 1648 case CSSPropertySpeak: 1649 return primitiveValueCache->createValue(style->speak()); 1650 case CSSPropertyWebkitTransform: 1651 return computedTransform(renderer, style.get(), primitiveValueCache); 1652 case CSSPropertyWebkitTransformOrigin: { 1653 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 1654 if (renderer) { 1655 IntRect box = sizingBox(renderer); 1656 list->append(zoomAdjustedPixelValue(style->transformOriginX().calcMinValue(box.width()), style.get(), primitiveValueCache)); 1657 list->append(zoomAdjustedPixelValue(style->transformOriginY().calcMinValue(box.height()), style.get(), primitiveValueCache)); 1658 if (style->transformOriginZ() != 0) 1659 list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get(), primitiveValueCache)); 1660 } else { 1661 list->append(zoomAdjustedPixelValueForLength(style->transformOriginX(), style.get(), primitiveValueCache)); 1662 list->append(zoomAdjustedPixelValueForLength(style->transformOriginY(), style.get(), primitiveValueCache)); 1663 if (style->transformOriginZ() != 0) 1664 list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get(), primitiveValueCache)); 1665 } 1666 return list.release(); 1667 } 1668 case CSSPropertyWebkitTransformStyle: 1669 return primitiveValueCache->createIdentifierValue((style->transformStyle3D() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat); 1670 case CSSPropertyWebkitTransitionDelay: 1671 return getDelayValue(style->transitions(), primitiveValueCache); 1672 case CSSPropertyWebkitTransitionDuration: 1673 return getDurationValue(style->transitions(), primitiveValueCache); 1674 case CSSPropertyWebkitTransitionProperty: { 1675 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 1676 const AnimationList* t = style->transitions(); 1677 if (t) { 1678 for (size_t i = 0; i < t->size(); ++i) { 1679 int prop = t->animation(i)->property(); 1680 RefPtr<CSSValue> propertyValue; 1681 if (prop == cAnimateNone) 1682 propertyValue = primitiveValueCache->createIdentifierValue(CSSValueNone); 1683 else if (prop == cAnimateAll) 1684 propertyValue = primitiveValueCache->createIdentifierValue(CSSValueAll); 1685 else 1686 propertyValue = primitiveValueCache->createValue(getPropertyName(static_cast<CSSPropertyID>(prop)), CSSPrimitiveValue::CSS_STRING); 1687 list->append(propertyValue); 1688 } 1689 } else 1690 list->append(primitiveValueCache->createIdentifierValue(CSSValueAll)); 1691 return list.release(); 1692 } 1693 case CSSPropertyWebkitTransitionTimingFunction: 1694 return getTimingFunctionValue(style->transitions()); 1695 case CSSPropertyPointerEvents: 1696 return primitiveValueCache->createValue(style->pointerEvents()); 1697 case CSSPropertyWebkitColorCorrection: 1698 return primitiveValueCache->createValue(style->colorSpace()); 1699 case CSSPropertyWebkitWritingMode: 1700 return primitiveValueCache->createValue(style->writingMode()); 1701 case CSSPropertyWebkitTextCombine: 1702 return primitiveValueCache->createValue(style->textCombine()); 1703 case CSSPropertyWebkitTextOrientation: 1704 return CSSPrimitiveValue::create(style->fontDescription().textOrientation()); 1705 case CSSPropertyWebkitLineBoxContain: 1706 return createLineBoxContainValue(primitiveValueCache, style->lineBoxContain()); 1707 case CSSPropertyContent: 1708 return contentToCSSValue(style.get(), primitiveValueCache); 1709 case CSSPropertyCounterIncrement: 1710 return counterToCSSValue(style.get(), propertyID, primitiveValueCache); 1711 case CSSPropertyCounterReset: 1712 return counterToCSSValue(style.get(), propertyID, primitiveValueCache); 1713 1714 /* Shorthand properties, currently not supported see bug 13658*/ 1715 case CSSPropertyBackground: 1716 case CSSPropertyBorder: 1717 case CSSPropertyBorderBottom: 1718 case CSSPropertyBorderColor: 1719 case CSSPropertyBorderLeft: 1720 case CSSPropertyBorderRadius: 1721 case CSSPropertyBorderRight: 1722 case CSSPropertyBorderStyle: 1723 case CSSPropertyBorderTop: 1724 case CSSPropertyBorderWidth: 1725 case CSSPropertyFont: 1726 case CSSPropertyListStyle: 1727 case CSSPropertyMargin: 1728 case CSSPropertyOutline: 1729 case CSSPropertyPadding: 1730 break; 1731 1732 /* Individual properties not part of the spec */ 1733 case CSSPropertyBackgroundRepeatX: 1734 case CSSPropertyBackgroundRepeatY: 1735 break; 1736 1737 /* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */ 1738 case CSSPropertyWebkitTextEmphasis: 1739 case CSSPropertyTextLineThrough: 1740 case CSSPropertyTextLineThroughColor: 1741 case CSSPropertyTextLineThroughMode: 1742 case CSSPropertyTextLineThroughStyle: 1743 case CSSPropertyTextLineThroughWidth: 1744 case CSSPropertyTextOverline: 1745 case CSSPropertyTextOverlineColor: 1746 case CSSPropertyTextOverlineMode: 1747 case CSSPropertyTextOverlineStyle: 1748 case CSSPropertyTextOverlineWidth: 1749 case CSSPropertyTextUnderline: 1750 case CSSPropertyTextUnderlineColor: 1751 case CSSPropertyTextUnderlineMode: 1752 case CSSPropertyTextUnderlineStyle: 1753 case CSSPropertyTextUnderlineWidth: 1754 break; 1755 1756 /* Directional properties are resolved by resolveDirectionAwareProperty() before the switch. */ 1757 case CSSPropertyWebkitBorderEnd: 1758 case CSSPropertyWebkitBorderEndColor: 1759 case CSSPropertyWebkitBorderEndStyle: 1760 case CSSPropertyWebkitBorderEndWidth: 1761 case CSSPropertyWebkitBorderStart: 1762 case CSSPropertyWebkitBorderStartColor: 1763 case CSSPropertyWebkitBorderStartStyle: 1764 case CSSPropertyWebkitBorderStartWidth: 1765 case CSSPropertyWebkitBorderAfter: 1766 case CSSPropertyWebkitBorderAfterColor: 1767 case CSSPropertyWebkitBorderAfterStyle: 1768 case CSSPropertyWebkitBorderAfterWidth: 1769 case CSSPropertyWebkitBorderBefore: 1770 case CSSPropertyWebkitBorderBeforeColor: 1771 case CSSPropertyWebkitBorderBeforeStyle: 1772 case CSSPropertyWebkitBorderBeforeWidth: 1773 case CSSPropertyWebkitMarginEnd: 1774 case CSSPropertyWebkitMarginStart: 1775 case CSSPropertyWebkitMarginAfter: 1776 case CSSPropertyWebkitMarginBefore: 1777 case CSSPropertyWebkitPaddingEnd: 1778 case CSSPropertyWebkitPaddingStart: 1779 case CSSPropertyWebkitPaddingAfter: 1780 case CSSPropertyWebkitPaddingBefore: 1781 case CSSPropertyWebkitLogicalWidth: 1782 case CSSPropertyWebkitLogicalHeight: 1783 case CSSPropertyWebkitMinLogicalWidth: 1784 case CSSPropertyWebkitMinLogicalHeight: 1785 case CSSPropertyWebkitMaxLogicalWidth: 1786 case CSSPropertyWebkitMaxLogicalHeight: 1787 ASSERT_NOT_REACHED(); 1788 break; 1789 1790 /* Unimplemented @font-face properties */ 1791 case CSSPropertyFontStretch: 1792 case CSSPropertySrc: 1793 case CSSPropertyUnicodeRange: 1794 break; 1795 1796 /* Other unimplemented properties */ 1797 case CSSPropertyPage: // for @page 1798 case CSSPropertyQuotes: // FIXME: needs implementation 1799 case CSSPropertySize: // for @page 1800 break; 1801 1802 /* Unimplemented -webkit- properties */ 1803 case CSSPropertyWebkitAnimation: 1804 case CSSPropertyWebkitBorderRadius: 1805 case CSSPropertyWebkitColumns: 1806 case CSSPropertyWebkitColumnRule: 1807 case CSSPropertyWebkitMarginCollapse: 1808 case CSSPropertyWebkitMarquee: 1809 case CSSPropertyWebkitMarqueeSpeed: 1810 case CSSPropertyWebkitMask: 1811 case CSSPropertyWebkitMaskRepeatX: 1812 case CSSPropertyWebkitMaskRepeatY: 1813 case CSSPropertyWebkitPerspectiveOriginX: 1814 case CSSPropertyWebkitPerspectiveOriginY: 1815 case CSSPropertyWebkitTextStroke: 1816 case CSSPropertyWebkitTransformOriginX: 1817 case CSSPropertyWebkitTransformOriginY: 1818 case CSSPropertyWebkitTransformOriginZ: 1819 case CSSPropertyWebkitTransition: 1820 break; 1821 #ifdef ANDROID_CSS_RING 1822 case CSSPropertyWebkitRing: 1823 // shorthand property currently not supported see bug 13658 1824 break; 1825 case CSSPropertyWebkitRingFillColor: 1826 return primitiveValueCache->createColorValue(style->ringFillColor().rgb()); 1827 case CSSPropertyWebkitRingInnerWidth: 1828 return primitiveValueCache->createValue(style->ringInnerWidth()); 1829 case CSSPropertyWebkitRingOuterWidth: 1830 return primitiveValueCache->createValue(style->ringOuterWidth()); 1831 case CSSPropertyWebkitRingOutset: 1832 return primitiveValueCache->createValue(style->ringOutset()); 1833 case CSSPropertyWebkitRingPressedInnerColor: 1834 return primitiveValueCache->createColorValue(style->ringPressedInnerColor().rgb()); 1835 case CSSPropertyWebkitRingPressedOuterColor: 1836 return primitiveValueCache->createColorValue(style->ringPressedOuterColor().rgb()); 1837 case CSSPropertyWebkitRingRadius: 1838 return primitiveValueCache->createValue(style->ringRadius()); 1839 case CSSPropertyWebkitRingSelectedInnerColor: 1840 return primitiveValueCache->createColorValue(style->ringSelectedInnerColor().rgb()); 1841 case CSSPropertyWebkitRingSelectedOuterColor: 1842 return primitiveValueCache->createColorValue(style->ringSelectedOuterColor().rgb()); 1843 #endif 1844 #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR 1845 case CSSPropertyWebkitTapHighlightColor: 1846 return primitiveValueCache->createColorValue(style->tapHighlightColor().rgb()); 1847 #endif 1848 #if ENABLE(SVG) 1849 case CSSPropertyClipPath: 1850 case CSSPropertyClipRule: 1851 case CSSPropertyMask: 1852 case CSSPropertyEnableBackground: 1853 case CSSPropertyFilter: 1854 case CSSPropertyFloodColor: 1855 case CSSPropertyFloodOpacity: 1856 case CSSPropertyLightingColor: 1857 case CSSPropertyStopColor: 1858 case CSSPropertyStopOpacity: 1859 case CSSPropertyColorInterpolation: 1860 case CSSPropertyColorInterpolationFilters: 1861 case CSSPropertyColorProfile: 1862 case CSSPropertyColorRendering: 1863 case CSSPropertyFill: 1864 case CSSPropertyFillOpacity: 1865 case CSSPropertyFillRule: 1866 case CSSPropertyImageRendering: 1867 case CSSPropertyMarker: 1868 case CSSPropertyMarkerEnd: 1869 case CSSPropertyMarkerMid: 1870 case CSSPropertyMarkerStart: 1871 case CSSPropertyShapeRendering: 1872 case CSSPropertyStroke: 1873 case CSSPropertyStrokeDasharray: 1874 case CSSPropertyStrokeDashoffset: 1875 case CSSPropertyStrokeLinecap: 1876 case CSSPropertyStrokeLinejoin: 1877 case CSSPropertyStrokeMiterlimit: 1878 case CSSPropertyStrokeOpacity: 1879 case CSSPropertyStrokeWidth: 1880 case CSSPropertyAlignmentBaseline: 1881 case CSSPropertyBaselineShift: 1882 case CSSPropertyDominantBaseline: 1883 case CSSPropertyGlyphOrientationHorizontal: 1884 case CSSPropertyGlyphOrientationVertical: 1885 case CSSPropertyKerning: 1886 case CSSPropertyTextAnchor: 1887 case CSSPropertyVectorEffect: 1888 case CSSPropertyWritingMode: 1889 case CSSPropertyWebkitSvgShadow: 1890 return getSVGPropertyCSSValue(propertyID, DoNotUpdateLayout); 1891 #endif 1892 } 1893 1894 logUnimplementedPropertyID(propertyID); 1895 return 0; 1896 } 1897 1898 String CSSComputedStyleDeclaration::getPropertyValue(int propertyID) const 1899 { 1900 RefPtr<CSSValue> value = getPropertyCSSValue(propertyID); 1901 if (value) 1902 return value->cssText(); 1903 return ""; 1904 } 1905 1906 bool CSSComputedStyleDeclaration::getPropertyPriority(int /*propertyID*/) const 1907 { 1908 // All computed styles have a priority of false (not "important"). 1909 return false; 1910 } 1911 1912 String CSSComputedStyleDeclaration::removeProperty(int /*propertyID*/, ExceptionCode& ec) 1913 { 1914 ec = NO_MODIFICATION_ALLOWED_ERR; 1915 return String(); 1916 } 1917 1918 void CSSComputedStyleDeclaration::setProperty(int /*propertyID*/, const String& /*value*/, bool /*important*/, ExceptionCode& ec) 1919 { 1920 ec = NO_MODIFICATION_ALLOWED_ERR; 1921 } 1922 1923 unsigned CSSComputedStyleDeclaration::virtualLength() const 1924 { 1925 Node* node = m_node.get(); 1926 if (!node) 1927 return 0; 1928 1929 RenderStyle* style = node->computedStyle(m_pseudoElementSpecifier); 1930 if (!style) 1931 return 0; 1932 1933 return numComputedProperties; 1934 } 1935 1936 String CSSComputedStyleDeclaration::item(unsigned i) const 1937 { 1938 if (i >= length()) 1939 return ""; 1940 1941 return getPropertyName(static_cast<CSSPropertyID>(computedProperties[i])); 1942 } 1943 1944 bool CSSComputedStyleDeclaration::cssPropertyMatches(const CSSProperty* property) const 1945 { 1946 if (property->id() == CSSPropertyFontSize && property->value()->isPrimitiveValue() && m_node) { 1947 m_node->document()->updateLayoutIgnorePendingStylesheets(); 1948 RenderStyle* style = m_node->computedStyle(m_pseudoElementSpecifier); 1949 if (style && style->fontDescription().keywordSize()) { 1950 int sizeValue = cssIdentifierForFontSizeKeyword(style->fontDescription().keywordSize()); 1951 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(property->value()); 1952 if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_IDENT && primitiveValue->getIdent() == sizeValue) 1953 return true; 1954 } 1955 } 1956 1957 return CSSStyleDeclaration::cssPropertyMatches(property); 1958 } 1959 1960 PassRefPtr<CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::copy() const 1961 { 1962 return copyPropertiesInSet(computedProperties, numComputedProperties); 1963 } 1964 1965 PassRefPtr<CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::makeMutable() 1966 { 1967 return copy(); 1968 } 1969 1970 } // namespace WebCore 1971