Changeset 18850 in webkit
- Timestamp:
- Jan 14, 2007 5:08:44 PM (17 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r18848 r18850 1 2007-01-14 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Darin and then by Mitz. 4 5 Patch for http://bugs.webkit.org/show_bug.cgi?id=12228 6 Cleanup assorted CSS classes 7 8 * css/CSSBorderImageValue.cpp: 9 (WebCore::CSSBorderImageValue::CSSBorderImageValue): 10 (WebCore::CSSBorderImageValue::cssText): 11 * css/CSSBorderImageValue.h: 12 * css/CSSComputedStyleDeclaration.cpp: 13 (WebCore::valueForLength): 14 (WebCore::valueForBorderStyle): 15 (WebCore::valueForTextAlign): 16 (WebCore::valueForShadow): 17 (WebCore::getPositionOffsetValue): 18 (WebCore::CSSComputedStyleDeclaration::cssText): 19 (WebCore::primitiveValueFromLength): 20 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): 21 (WebCore::CSSComputedStyleDeclaration::getPropertyPriority): 22 (WebCore::CSSComputedStyleDeclaration::removeProperty): 23 (WebCore::CSSComputedStyleDeclaration::setProperty): 24 (WebCore::CSSComputedStyleDeclaration::length): 25 (WebCore::CSSComputedStyleDeclaration::item): 26 * css/CSSComputedStyleDeclaration.h: 27 * css/CSSCursorImageValue.cpp: 28 (WebCore::CSSCursorImageValue::CSSCursorImageValue): 29 * css/CSSCursorImageValue.h: 30 * css/CSSGrammar.y: 31 * css/CSSImageValue.cpp: 32 * css/CSSImageValue.h: 33 * css/CSSInheritedValue.cpp: 34 * css/CSSInheritedValue.h: 35 * css/CSSInitialValue.cpp: 36 * css/CSSInitialValue.h: 37 * css/CSSMutableStyleDeclaration.cpp: 38 (WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration): 39 (WebCore::CSSMutableStyleDeclaration::operator=): 40 (WebCore::CSSMutableStyleDeclaration::getPropertyValue): 41 (WebCore::CSSMutableStyleDeclaration::get4Values): 42 (WebCore::CSSMutableStyleDeclaration::getShorthandValue): 43 (WebCore::CSSMutableStyleDeclaration::getPropertyCSSValue): 44 (WebCore::CSSMutableStyleDeclaration::removeProperty): 45 (WebCore::CSSMutableStyleDeclaration::setChanged): 46 (WebCore::CSSMutableStyleDeclaration::getPropertyPriority): 47 (WebCore::CSSMutableStyleDeclaration::getPropertyShorthand): 48 (WebCore::CSSMutableStyleDeclaration::isPropertyImplicit): 49 (WebCore::CSSMutableStyleDeclaration::setProperty): 50 (WebCore::CSSMutableStyleDeclaration::setImageProperty): 51 (WebCore::CSSMutableStyleDeclaration::parseDeclaration): 52 (WebCore::CSSMutableStyleDeclaration::addParsedProperties): 53 (WebCore::CSSMutableStyleDeclaration::setLengthProperty): 54 (WebCore::CSSMutableStyleDeclaration::cssText): 55 (WebCore::CSSMutableStyleDeclaration::merge): 56 (WebCore::CSSMutableStyleDeclaration::removePropertiesInSet): 57 * css/CSSMutableStyleDeclaration.h: 58 (WebCore::CSSMutableStyleDeclaration::setProperty): 59 (WebCore::CSSMutableStyleDeclaration::removeProperty): 60 * css/CSSNamespace.h: 61 (WebCore::CSSNamespace::CSSNamespace): 62 * css/CSSPrimitiveValue.cpp: 63 (WebCore::isCSSTokenizerIdentifier): 64 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): 65 (WebCore::CSSPrimitiveValue::cleanup): 66 (WebCore::CSSPrimitiveValue::computeLengthInt): 67 (WebCore::CSSPrimitiveValue::computeLengthIntForLength): 68 (WebCore::CSSPrimitiveValue::computeLengthShort): 69 (WebCore::CSSPrimitiveValue::computeLengthFloat): 70 (WebCore::CSSPrimitiveValue::setFloatValue): 71 (WebCore::scaleFactorForConversion): 72 (WebCore::CSSPrimitiveValue::getFloatValue): 73 (WebCore::CSSPrimitiveValue::setStringValue): 74 (WebCore::CSSPrimitiveValue::getStringValue): 75 (WebCore::CSSPrimitiveValue::parseString): 76 (WebCore::CSSPrimitiveValue::getIdent): 77 (WebCore::CSSPrimitiveValue::cssText): 78 * css/CSSPrimitiveValue.h: 79 (WebCore::CSSPrimitiveValue::getCounterValue): 80 (WebCore::CSSPrimitiveValue::getRectValue): 81 (WebCore::CSSPrimitiveValue::getRGBColorValue): 82 (WebCore::CSSPrimitiveValue::getPairValue): 83 (WebCore::CSSPrimitiveValue::getDashboardRegionValue): 84 * css/CSSProperty.cpp: 85 (WebCore::operator==): 86 * css/CSSProperty.h: 87 (WebCore::CSSProperty::operator=): 88 * css/CSSQuirkPrimitiveValue.h: 89 (WebCore::CSSQuirkPrimitiveValue::CSSQuirkPrimitiveValue): 90 * css/CSSRuleList.cpp: 91 (WebCore::CSSRuleList::CSSRuleList): 92 (WebCore::CSSRuleList::deleteRule): 93 (WebCore::CSSRuleList::insertRule): 94 * css/CSSRuleList.h: 95 (WebCore::CSSRuleList::item): 96 * css/CSSSelector.cpp: 97 (WebCore::CSSSelector::print): 98 (WebCore::CSSSelector::specificity): 99 (WebCore::CSSSelector::extractPseudoType): 100 (WebCore::CSSSelector::operator==): 101 (WebCore::CSSSelector::selectorText): 102 * css/CSSSelector.h: 103 (WebCore::CSSSelector::CSSSelector): 104 (WebCore::CSSSelector::~CSSSelector): 105 (WebCore::CSSSelector::append): 106 (WebCore::CSSSelector::next): 107 (WebCore::CSSSelector::pseudoType): 108 (WebCore::CSSSelector::hasTag): 109 (WebCore::CSSSelector::hasAttribute): 110 * css/CSSStyleDeclaration.cpp: 111 (WebCore::propertyID): 112 (WebCore::CSSStyleDeclaration::getPropertyPriority): 113 (WebCore::CSSStyleDeclaration::getPropertyShorthand): 114 (WebCore::CSSStyleDeclaration::isPropertyImplicit): 115 (WebCore::CSSStyleDeclaration::setProperty): 116 (WebCore::CSSStyleDeclaration::isPropertyName): 117 (WebCore::CSSStyleDeclaration::parentRule): 118 (WebCore::CSSStyleDeclaration::diff): 119 (WebCore::CSSStyleDeclaration::copyPropertiesInSet): 120 * css/CSSStyleDeclaration.h: 121 * css/Counter.h: 122 (WebCore::Counter::Counter): 123 (WebCore::Counter::listStyleNumber): 124 * css/csshelper.cpp: 125 (WebCore::parseURL): 126 * css/csshelper.h: 127 * css/cssparser.h: 128 (WebCore::domString): 129 (WebCore::atomicString): 130 (WebCore::CSSParser::operator|): 131 * css/cssstyleselector.cpp: 132 (WebCore::CSSStyleSelector::matchRulesForList): 133 (WebCore::CSSStyleSelector::checkSelector): 134 (WebCore::CSSStyleSelector::checkOneSelector): 135 (WebCore::CSSRuleSet::addRule): 136 1 137 2007-01-14 Mitz Pettel <mitz@webkit.org> 2 138 -
trunk/WebCore/css/CSSBorderImageValue.cpp
r14408 r18850 20 20 * Boston, MA 02111-1307, USA. 21 21 */ 22 22 23 #include "config.h" 23 24 #include "CSSBorderImageValue.h" … … 29 30 namespace WebCore { 30 31 31 CSSBorderImageValue::CSSBorderImageValue(PassRefPtr<CSSImageValue> image, 32 PassRefPtr<RectImpl> imageRect, int horizontalRule, int verticalRule) 32 CSSBorderImageValue::CSSBorderImageValue(PassRefPtr<CSSImageValue> image, PassRefPtr<RectImpl> imageRect, int horizontalRule, int verticalRule) 33 33 : m_image(image) 34 34 , m_imageSliceRect(imageRect) … … 43 43 String text(m_image->cssText()); 44 44 text += " "; 45 45 46 46 // Now the rect, but it isn't really a rect, so we dump manually 47 47 text += m_imageSliceRect->top()->cssText(); … … 52 52 text += " "; 53 53 text += m_imageSliceRect->left()->cssText(); 54 54 55 55 // Now the keywords. 56 56 text += " "; … … 62 62 } 63 63 64 } 64 } // namespace WebCore -
trunk/WebCore/css/CSSBorderImageValue.h
r14408 r18850 21 21 */ 22 22 23 #ifndef CSSBorderImageValue_ H24 #define CSSBorderImageValue_ H23 #ifndef CSSBorderImageValue_h 24 #define CSSBorderImageValue_h 25 25 26 26 #include "CSSValue.h" … … 33 33 class RectImpl; 34 34 35 class CSSBorderImageValue : public CSSValue 36 { 35 class CSSBorderImageValue : public CSSValue { 37 36 public: 38 37 CSSBorderImageValue(); … … 48 47 // or percentages. 49 48 RefPtr<RectImpl> m_imageSliceRect; 50 49 51 50 // Values for how to handle the scaling/stretching/tiling of the image slices. 52 51 int m_horizontalSizeRule; // Rule for how to adjust the widths of the top/middle/bottom … … 54 53 }; 55 54 56 } // namespace 55 } // namespace WebCore 57 56 58 #endif 57 #endif // CSSBorderImageValue_h -
trunk/WebCore/css/CSSComputedStyleDeclaration.cpp
r18838 r18850 1 1 /** 2 * CSSComputedStyleDeclaration.cpp3 2 * 4 3 * Copyright (C) 2004 Zack Rusin <zack@kde.org> … … 24 23 #include "CSSComputedStyleDeclaration.h" 25 24 26 #include "CachedImage.h"27 #include "DashboardRegion.h"28 #include "Document.h"29 #include "ExceptionCode.h"30 25 #include "CSSMutableStyleDeclaration.h" 31 26 #include "CSSPrimitiveValue.h" … … 33 28 #include "CSSValueKeywords.h" 34 29 #include "CSSValueList.h" 30 #include "CachedImage.h" 31 #include "DashboardRegion.h" 32 #include "Document.h" 33 #include "ExceptionCode.h" 35 34 #include "Pair.h" 36 35 #include "RenderObject.h" … … 183 182 case Relative: 184 183 case Static: 185 // Should never be reached.186 184 break; 187 185 } 188 // Should never be reached, but if we do, just return "auto".189 return new CSSPrimitiveValue(CSS_VAL_AUTO);186 ASSERT_NOT_REACHED(); 187 return 0; 190 188 } 191 189 … … 198 196 } 199 197 200 static CSSValue *valueForBorderStyle(EBorderStyle style)198 static CSSValue* valueForBorderStyle(EBorderStyle style) 201 199 { 202 200 switch (style) { … … 226 224 } 227 225 228 static CSSValue *valueForTextAlign(ETextAlign align)226 static CSSValue* valueForTextAlign(ETextAlign align) 229 227 { 230 228 switch (align) { … … 254 252 if (!shadow) 255 253 return new CSSPrimitiveValue(CSS_VAL_NONE); 254 256 255 CSSValueList* list = new CSSValueList; 257 256 for (const ShadowData* s = shadow; s; s = s->next) { … … 265 264 } 266 265 267 static CSSValue *getPositionOffsetValue(RenderObject *renderer, int propertyID)266 static CSSValue* getPositionOffsetValue(RenderObject* renderer, int propertyID) 268 267 { 269 268 if (!renderer) 270 269 return 0; 271 270 272 RenderStyle *style = renderer->style();271 RenderStyle* style = renderer->style(); 273 272 if (!style) 274 273 return 0; … … 276 275 Length l; 277 276 switch (propertyID) { 278 case CSS_PROP_LEFT:279 l = style->left();280 break;281 case CSS_PROP_RIGHT:282 l = style->right();283 break;284 case CSS_PROP_TOP:285 l = style->top();286 break;287 case CSS_PROP_BOTTOM:288 l = style->bottom();289 break;290 default:291 return 0;277 case CSS_PROP_LEFT: 278 l = style->left(); 279 break; 280 case CSS_PROP_RIGHT: 281 l = style->right(); 282 break; 283 case CSS_PROP_TOP: 284 l = style->top(); 285 break; 286 case CSS_PROP_BOTTOM: 287 l = style->bottom(); 288 break; 289 default: 290 return 0; 292 291 } 293 292 294 293 if (renderer->isPositioned()) 295 294 return valueForLength(l); 296 295 297 296 if (renderer->isRelPositioned()) 298 297 // FIXME: It's not enough to simply return "auto" values for one offset if the other side is defined. … … 300 299 // So we should get the opposite length unit and see if it is auto. 301 300 return valueForLength(l); 302 301 303 302 return new CSSPrimitiveValue(CSS_VAL_AUTO); 304 303 } … … 323 322 { 324 323 String result(""); 325 324 326 325 for (unsigned i = 0; i < numComputedProperties; i++) { 327 if (i != 0)326 if (i) 328 327 result += " "; 329 328 result += getPropertyName(computedProperties[i]); … … 332 331 result += ";"; 333 332 } 334 333 335 334 return result; 336 335 } … … 356 355 { 357 356 String string; 358 if (length.isPercent()) 359 string = numberAsString(length.percent()) + "%"; 360 else if (length.isFixed()) 361 string = numberAsString(length.calcMinValue(0)); 362 else if (length.isAuto()) 363 string = "auto"; 357 switch (length.type()) { 358 case Percent: 359 string = numberAsString(length.percent()) + "%"; 360 break; 361 case Fixed: 362 string = numberAsString(length.calcMinValue(0)); 363 break; 364 case Auto: 365 string = "auto"; 366 break; 367 default: 368 break; 369 } 364 370 return new CSSPrimitiveValue(string, CSSPrimitiveValue::CSS_STRING); 365 371 } … … 379 385 if (!renderer) 380 386 return 0; 387 381 388 RenderStyle* style = renderer->style(); 382 389 if (!style) 383 390 return 0; 384 391 385 switch (propertyID) 386 { 387 case CSS_PROP_BACKGROUND_COLOR: 388 return new CSSPrimitiveValue(style->backgroundColor().rgb()); 389 case CSS_PROP_BACKGROUND_IMAGE: 390 if (style->backgroundImage()) 391 return new CSSPrimitiveValue(style->backgroundImage()->url(), CSSPrimitiveValue::CSS_URI); 392 return new CSSPrimitiveValue(CSS_VAL_NONE); 393 case CSS_PROP__WEBKIT_BACKGROUND_SIZE: { 394 Length widthLength = style->backgroundSize().width; 395 Length heightLength = style->backgroundSize().height; 396 CSSPrimitiveValue* bgWidth = primitiveValueFromLength(widthLength, renderer, style); 397 CSSPrimitiveValue* bgHeight = primitiveValueFromLength(heightLength, renderer, style); 398 Pair* pair = new Pair(bgWidth, bgHeight); 399 return new CSSPrimitiveValue(pair); 400 } 401 case CSS_PROP_BACKGROUND_REPEAT: 402 switch (style->backgroundRepeat()) { 403 case REPEAT: 404 return new CSSPrimitiveValue(CSS_VAL_REPEAT); 405 case REPEAT_X: 406 return new CSSPrimitiveValue(CSS_VAL_REPEAT_X); 407 case REPEAT_Y: 408 return new CSSPrimitiveValue(CSS_VAL_REPEAT_Y); 409 case NO_REPEAT: 410 return new CSSPrimitiveValue(CSS_VAL_NO_REPEAT); 392 switch (propertyID) { 393 case CSS_PROP_BACKGROUND_COLOR: 394 return new CSSPrimitiveValue(style->backgroundColor().rgb()); 395 case CSS_PROP_BACKGROUND_IMAGE: 396 if (style->backgroundImage()) 397 return new CSSPrimitiveValue(style->backgroundImage()->url(), CSSPrimitiveValue::CSS_URI); 398 return new CSSPrimitiveValue(CSS_VAL_NONE); 399 case CSS_PROP__WEBKIT_BACKGROUND_SIZE: { 400 Length widthLength = style->backgroundSize().width; 401 Length heightLength = style->backgroundSize().height; 402 CSSPrimitiveValue* bgWidth = primitiveValueFromLength(widthLength, renderer, style); 403 CSSPrimitiveValue* bgHeight = primitiveValueFromLength(heightLength, renderer, style); 404 Pair* pair = new Pair(bgWidth, bgHeight); 405 return new CSSPrimitiveValue(pair); 411 406 } 412 ASSERT_NOT_REACHED(); 413 return 0; 414 case CSS_PROP__WEBKIT_BACKGROUND_COMPOSITE: 415 switch (style->backgroundComposite()) { 416 case CompositeClear: 417 return new CSSPrimitiveValue(CSS_VAL_CLEAR); 418 case CompositeCopy: 419 return new CSSPrimitiveValue(CSS_VAL_COPY); 420 case CompositeSourceOver: 421 return new CSSPrimitiveValue(CSS_VAL_SOURCE_OVER); 422 case CompositeSourceIn: 423 return new CSSPrimitiveValue(CSS_VAL_SOURCE_IN); 424 case CompositeSourceOut: 425 return new CSSPrimitiveValue(CSS_VAL_SOURCE_OUT); 426 case CompositeSourceAtop: 427 return new CSSPrimitiveValue(CSS_VAL_SOURCE_ATOP); 428 case CompositeDestinationOver: 429 return new CSSPrimitiveValue(CSS_VAL_DESTINATION_OVER); 430 case CompositeDestinationIn: 431 return new CSSPrimitiveValue(CSS_VAL_DESTINATION_IN); 432 case CompositeDestinationOut: 433 return new CSSPrimitiveValue(CSS_VAL_DESTINATION_OUT); 434 case CompositeDestinationAtop: 435 return new CSSPrimitiveValue(CSS_VAL_DESTINATION_ATOP); 436 case CompositeXOR: 437 return new CSSPrimitiveValue(CSS_VAL_XOR); 438 case CompositePlusDarker: 439 return new CSSPrimitiveValue(CSS_VAL_PLUS_DARKER); 440 case CompositeHighlight: 441 return new CSSPrimitiveValue(CSS_VAL_HIGHLIGHT); 442 case CompositePlusLighter: 443 return new CSSPrimitiveValue(CSS_VAL_PLUS_LIGHTER); 407 case CSS_PROP_BACKGROUND_REPEAT: 408 switch (style->backgroundRepeat()) { 409 case REPEAT: 410 return new CSSPrimitiveValue(CSS_VAL_REPEAT); 411 case REPEAT_X: 412 return new CSSPrimitiveValue(CSS_VAL_REPEAT_X); 413 case REPEAT_Y: 414 return new CSSPrimitiveValue(CSS_VAL_REPEAT_Y); 415 case NO_REPEAT: 416 return new CSSPrimitiveValue(CSS_VAL_NO_REPEAT); 417 } 418 ASSERT_NOT_REACHED(); 419 return 0; 420 case CSS_PROP__WEBKIT_BACKGROUND_COMPOSITE: 421 switch (style->backgroundComposite()) { 422 case CompositeClear: 423 return new CSSPrimitiveValue(CSS_VAL_CLEAR); 424 case CompositeCopy: 425 return new CSSPrimitiveValue(CSS_VAL_COPY); 426 case CompositeSourceOver: 427 return new CSSPrimitiveValue(CSS_VAL_SOURCE_OVER); 428 case CompositeSourceIn: 429 return new CSSPrimitiveValue(CSS_VAL_SOURCE_IN); 430 case CompositeSourceOut: 431 return new CSSPrimitiveValue(CSS_VAL_SOURCE_OUT); 432 case CompositeSourceAtop: 433 return new CSSPrimitiveValue(CSS_VAL_SOURCE_ATOP); 434 case CompositeDestinationOver: 435 return new CSSPrimitiveValue(CSS_VAL_DESTINATION_OVER); 436 case CompositeDestinationIn: 437 return new CSSPrimitiveValue(CSS_VAL_DESTINATION_IN); 438 case CompositeDestinationOut: 439 return new CSSPrimitiveValue(CSS_VAL_DESTINATION_OUT); 440 case CompositeDestinationAtop: 441 return new CSSPrimitiveValue(CSS_VAL_DESTINATION_ATOP); 442 case CompositeXOR: 443 return new CSSPrimitiveValue(CSS_VAL_XOR); 444 case CompositePlusDarker: 445 return new CSSPrimitiveValue(CSS_VAL_PLUS_DARKER); 446 case CompositeHighlight: 447 return new CSSPrimitiveValue(CSS_VAL_HIGHLIGHT); 448 case CompositePlusLighter: 449 return new CSSPrimitiveValue(CSS_VAL_PLUS_LIGHTER); 450 } 451 ASSERT_NOT_REACHED(); 452 return 0; 453 case CSS_PROP_BACKGROUND_ATTACHMENT: 454 if (style->backgroundAttachment()) 455 return new CSSPrimitiveValue(CSS_VAL_SCROLL); 456 return new CSSPrimitiveValue(CSS_VAL_FIXED); 457 case CSS_PROP__WEBKIT_BACKGROUND_CLIP: 458 case CSS_PROP__WEBKIT_BACKGROUND_ORIGIN: { 459 EBackgroundBox box = (propertyID == CSS_PROP__WEBKIT_BACKGROUND_CLIP ? style->backgroundClip() : style->backgroundOrigin()); 460 switch (box) { 461 case BGBORDER: 462 return new CSSPrimitiveValue(CSS_VAL_BORDER); 463 case BGPADDING: 464 return new CSSPrimitiveValue(CSS_VAL_PADDING); 465 case BGCONTENT: 466 return new CSSPrimitiveValue(CSS_VAL_CONTENT); 467 } 468 ASSERT_NOT_REACHED(); 469 return 0; 444 470 } 445 ASSERT_NOT_REACHED(); 446 return 0; 447 case CSS_PROP_BACKGROUND_ATTACHMENT: 448 if (style->backgroundAttachment()) 449 return new CSSPrimitiveValue(CSS_VAL_SCROLL); 450 return new CSSPrimitiveValue(CSS_VAL_FIXED); 451 case CSS_PROP__WEBKIT_BACKGROUND_CLIP: 452 case CSS_PROP__WEBKIT_BACKGROUND_ORIGIN: { 453 EBackgroundBox box = (propertyID == CSS_PROP__WEBKIT_BACKGROUND_CLIP ? style->backgroundClip() : style->backgroundOrigin()); 454 if (box == BGBORDER) 455 return new CSSPrimitiveValue(CSS_VAL_BORDER); 456 if (box == BGPADDING) 457 return new CSSPrimitiveValue(CSS_VAL_PADDING); 458 return new CSSPrimitiveValue(CSS_VAL_CONTENT); 459 } 460 case CSS_PROP_BACKGROUND_POSITION: 461 { 462 String string; 463 Length length(style->backgroundXPosition()); 464 if (length.isPercent()) 465 string = numberAsString(length.percent()) + "%"; 466 else 467 string = numberAsString(length.calcMinValue(renderer->contentWidth())); 468 string += " "; 469 length = style->backgroundYPosition(); 470 if (length.isPercent()) 471 string += numberAsString(length.percent()) + "%"; 472 else 473 string += numberAsString(length.calcMinValue(renderer->contentWidth())); 474 return new CSSPrimitiveValue(string, CSSPrimitiveValue::CSS_STRING); 475 } 476 case CSS_PROP_BACKGROUND_POSITION_X: 477 return valueForLength(style->backgroundXPosition()); 478 case CSS_PROP_BACKGROUND_POSITION_Y: 479 return valueForLength(style->backgroundYPosition()); 471 case CSS_PROP_BACKGROUND_POSITION: { 472 String string; 473 Length length(style->backgroundXPosition()); 474 if (length.isPercent()) 475 string = numberAsString(length.percent()) + "%"; 476 else 477 string = numberAsString(length.calcMinValue(renderer->contentWidth())); 478 string += " "; 479 length = style->backgroundYPosition(); 480 if (length.isPercent()) 481 string += numberAsString(length.percent()) + "%"; 482 else 483 string += numberAsString(length.calcMinValue(renderer->contentWidth())); 484 return new CSSPrimitiveValue(string, CSSPrimitiveValue::CSS_STRING); 485 } 486 case CSS_PROP_BACKGROUND_POSITION_X: 487 return valueForLength(style->backgroundXPosition()); 488 case CSS_PROP_BACKGROUND_POSITION_Y: 489 return valueForLength(style->backgroundYPosition()); 480 490 #ifdef XBL_SUPPORT 481 case CSS_PROP__WEBKIT_BINDING:482 // FIXME: unimplemented483 break;491 case CSS_PROP__WEBKIT_BINDING: 492 // FIXME: unimplemented 493 break; 484 494 #endif 485 case CSS_PROP_BORDER_COLLAPSE: 486 if (style->borderCollapse()) 487 return new CSSPrimitiveValue(CSS_VAL_COLLAPSE); 488 else 495 case CSS_PROP_BORDER_COLLAPSE: 496 if (style->borderCollapse()) 497 return new CSSPrimitiveValue(CSS_VAL_COLLAPSE); 489 498 return new CSSPrimitiveValue(CSS_VAL_SEPARATE); 490 case CSS_PROP_BORDER_SPACING: 491 { 492 String string(numberAsString(style->horizontalBorderSpacing()) + "px " + numberAsString(style->verticalBorderSpacing()) + "px"); 493 return new CSSPrimitiveValue(string, CSSPrimitiveValue::CSS_STRING); 494 } 495 case CSS_PROP__WEBKIT_BORDER_HORIZONTAL_SPACING: 496 return new CSSPrimitiveValue(style->horizontalBorderSpacing(), CSSPrimitiveValue::CSS_PX); 497 case CSS_PROP__WEBKIT_BORDER_VERTICAL_SPACING: 498 return new CSSPrimitiveValue(style->verticalBorderSpacing(), CSSPrimitiveValue::CSS_PX); 499 case CSS_PROP_BORDER_TOP_COLOR: 500 return currentColorOrValidColor(style, style->borderTopColor()); 501 case CSS_PROP_BORDER_RIGHT_COLOR: 502 return currentColorOrValidColor(style, style->borderRightColor()); 503 case CSS_PROP_BORDER_BOTTOM_COLOR: 504 return currentColorOrValidColor(style, style->borderBottomColor()); 505 case CSS_PROP_BORDER_LEFT_COLOR: 506 return currentColorOrValidColor(style, style->borderLeftColor()); 507 case CSS_PROP_BORDER_TOP_STYLE: 508 return valueForBorderStyle(style->borderTopStyle()); 509 case CSS_PROP_BORDER_RIGHT_STYLE: 510 return valueForBorderStyle(style->borderRightStyle()); 511 case CSS_PROP_BORDER_BOTTOM_STYLE: 512 return valueForBorderStyle(style->borderBottomStyle()); 513 case CSS_PROP_BORDER_LEFT_STYLE: 514 return valueForBorderStyle(style->borderLeftStyle()); 515 case CSS_PROP_BORDER_TOP_WIDTH: 516 return new CSSPrimitiveValue(style->borderTopWidth(), CSSPrimitiveValue::CSS_PX); 517 case CSS_PROP_BORDER_RIGHT_WIDTH: 518 return new CSSPrimitiveValue(style->borderRightWidth(), CSSPrimitiveValue::CSS_PX); 519 case CSS_PROP_BORDER_BOTTOM_WIDTH: 520 return new CSSPrimitiveValue(style->borderBottomWidth(), CSSPrimitiveValue::CSS_PX); 521 case CSS_PROP_BORDER_LEFT_WIDTH: 522 return new CSSPrimitiveValue(style->borderLeftWidth(), CSSPrimitiveValue::CSS_PX); 523 case CSS_PROP_BOTTOM: 524 return getPositionOffsetValue(renderer, CSS_PROP_BOTTOM); 525 case CSS_PROP__WEBKIT_BOX_ALIGN: 526 switch (style->boxAlign()) { 527 case BSTRETCH: 528 return new CSSPrimitiveValue(CSS_VAL_STRETCH); 529 case BSTART: 530 return new CSSPrimitiveValue(CSS_VAL_START); 531 case BCENTER: 532 return new CSSPrimitiveValue(CSS_VAL_CENTER); 533 case BEND: 534 return new CSSPrimitiveValue(CSS_VAL_END); 535 case BBASELINE: 536 return new CSSPrimitiveValue(CSS_VAL_BASELINE); 537 case BJUSTIFY: 538 break; // not allowed 499 case CSS_PROP_BORDER_SPACING: { 500 String string(numberAsString(style->horizontalBorderSpacing()) + "px " + numberAsString(style->verticalBorderSpacing()) + "px"); 501 return new CSSPrimitiveValue(string, CSSPrimitiveValue::CSS_STRING); 539 502 } 540 ASSERT_NOT_REACHED(); 541 return 0; 542 case CSS_PROP__WEBKIT_BOX_DIRECTION: 543 switch (style->boxDirection()) { 544 case BNORMAL: 503 case CSS_PROP__WEBKIT_BORDER_HORIZONTAL_SPACING: 504 return new CSSPrimitiveValue(style->horizontalBorderSpacing(), CSSPrimitiveValue::CSS_PX); 505 case CSS_PROP__WEBKIT_BORDER_VERTICAL_SPACING: 506 return new CSSPrimitiveValue(style->verticalBorderSpacing(), CSSPrimitiveValue::CSS_PX); 507 case CSS_PROP_BORDER_TOP_COLOR: 508 return currentColorOrValidColor(style, style->borderTopColor()); 509 case CSS_PROP_BORDER_RIGHT_COLOR: 510 return currentColorOrValidColor(style, style->borderRightColor()); 511 case CSS_PROP_BORDER_BOTTOM_COLOR: 512 return currentColorOrValidColor(style, style->borderBottomColor()); 513 case CSS_PROP_BORDER_LEFT_COLOR: 514 return currentColorOrValidColor(style, style->borderLeftColor()); 515 case CSS_PROP_BORDER_TOP_STYLE: 516 return valueForBorderStyle(style->borderTopStyle()); 517 case CSS_PROP_BORDER_RIGHT_STYLE: 518 return valueForBorderStyle(style->borderRightStyle()); 519 case CSS_PROP_BORDER_BOTTOM_STYLE: 520 return valueForBorderStyle(style->borderBottomStyle()); 521 case CSS_PROP_BORDER_LEFT_STYLE: 522 return valueForBorderStyle(style->borderLeftStyle()); 523 case CSS_PROP_BORDER_TOP_WIDTH: 524 return new CSSPrimitiveValue(style->borderTopWidth(), CSSPrimitiveValue::CSS_PX); 525 case CSS_PROP_BORDER_RIGHT_WIDTH: 526 return new CSSPrimitiveValue(style->borderRightWidth(), CSSPrimitiveValue::CSS_PX); 527 case CSS_PROP_BORDER_BOTTOM_WIDTH: 528 return new CSSPrimitiveValue(style->borderBottomWidth(), CSSPrimitiveValue::CSS_PX); 529 case CSS_PROP_BORDER_LEFT_WIDTH: 530 return new CSSPrimitiveValue(style->borderLeftWidth(), CSSPrimitiveValue::CSS_PX); 531 case CSS_PROP_BOTTOM: 532 return getPositionOffsetValue(renderer, CSS_PROP_BOTTOM); 533 case CSS_PROP__WEBKIT_BOX_ALIGN: 534 switch (style->boxAlign()) { 535 case BSTRETCH: 536 return new CSSPrimitiveValue(CSS_VAL_STRETCH); 537 case BSTART: 538 return new CSSPrimitiveValue(CSS_VAL_START); 539 case BCENTER: 540 return new CSSPrimitiveValue(CSS_VAL_CENTER); 541 case BEND: 542 return new CSSPrimitiveValue(CSS_VAL_END); 543 case BBASELINE: 544 return new CSSPrimitiveValue(CSS_VAL_BASELINE); 545 case BJUSTIFY: 546 break; // not allowed 547 } 548 ASSERT_NOT_REACHED(); 549 return 0; 550 case CSS_PROP__WEBKIT_BOX_DIRECTION: 551 switch (style->boxDirection()) { 552 case BNORMAL: 553 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 554 case BREVERSE: 555 return new CSSPrimitiveValue(CSS_VAL_REVERSE); 556 } 557 ASSERT_NOT_REACHED(); 558 return 0; 559 case CSS_PROP__WEBKIT_BOX_FLEX: 560 return new CSSPrimitiveValue(style->boxFlex(), CSSPrimitiveValue::CSS_NUMBER); 561 case CSS_PROP__WEBKIT_BOX_FLEX_GROUP: 562 return new CSSPrimitiveValue(style->boxFlexGroup(), CSSPrimitiveValue::CSS_NUMBER); 563 case CSS_PROP__WEBKIT_BOX_LINES: 564 switch (style->boxLines()) { 565 case SINGLE: 566 return new CSSPrimitiveValue(CSS_VAL_SINGLE); 567 case MULTIPLE: 568 return new CSSPrimitiveValue(CSS_VAL_MULTIPLE); 569 } 570 ASSERT_NOT_REACHED(); 571 return 0; 572 case CSS_PROP__WEBKIT_BOX_ORDINAL_GROUP: 573 return new CSSPrimitiveValue(style->boxOrdinalGroup(), CSSPrimitiveValue::CSS_NUMBER); 574 case CSS_PROP__WEBKIT_BOX_ORIENT: 575 switch (style->boxOrient()) { 576 case HORIZONTAL: 577 return new CSSPrimitiveValue(CSS_VAL_HORIZONTAL); 578 case VERTICAL: 579 return new CSSPrimitiveValue(CSS_VAL_VERTICAL); 580 } 581 ASSERT_NOT_REACHED(); 582 return 0; 583 case CSS_PROP__WEBKIT_BOX_PACK: 584 switch (style->boxPack()) { 585 case BSTART: 586 return new CSSPrimitiveValue(CSS_VAL_START); 587 case BEND: 588 return new CSSPrimitiveValue(CSS_VAL_END); 589 case BCENTER: 590 return new CSSPrimitiveValue(CSS_VAL_CENTER); 591 case BJUSTIFY: 592 return new CSSPrimitiveValue(CSS_VAL_JUSTIFY); 593 case BSTRETCH: 594 case BBASELINE: 595 break; // not allowed 596 } 597 ASSERT_NOT_REACHED(); 598 return 0; 599 case CSS_PROP__WEBKIT_BOX_SHADOW: 600 return valueForShadow(style->boxShadow()); 601 case CSS_PROP_CAPTION_SIDE: 602 switch (style->captionSide()) { 603 case CAPLEFT: 604 return new CSSPrimitiveValue(CSS_VAL_LEFT); 605 case CAPRIGHT: 606 return new CSSPrimitiveValue(CSS_VAL_RIGHT); 607 case CAPTOP: 608 return new CSSPrimitiveValue(CSS_VAL_TOP); 609 case CAPBOTTOM: 610 return new CSSPrimitiveValue(CSS_VAL_BOTTOM); 611 } 612 ASSERT_NOT_REACHED(); 613 return 0; 614 case CSS_PROP_CLEAR: 615 switch (style->clear()) { 616 case CNONE: 617 return new CSSPrimitiveValue(CSS_VAL_NONE); 618 case CLEFT: 619 return new CSSPrimitiveValue(CSS_VAL_LEFT); 620 case CRIGHT: 621 return new CSSPrimitiveValue(CSS_VAL_RIGHT); 622 case CBOTH: 623 return new CSSPrimitiveValue(CSS_VAL_BOTH); 624 } 625 ASSERT_NOT_REACHED(); 626 return 0; 627 case CSS_PROP_CLIP: 628 // FIXME: unimplemented 629 break; 630 case CSS_PROP_COLOR: 631 return new CSSPrimitiveValue(style->color().rgb()); 632 case CSS_PROP__WEBKIT_COLUMN_COUNT: 633 if (style->hasAutoColumnCount()) 634 return new CSSPrimitiveValue(CSS_VAL_AUTO); 635 return new CSSPrimitiveValue(style->columnCount(), CSSPrimitiveValue::CSS_NUMBER); 636 case CSS_PROP__WEBKIT_COLUMN_GAP: 637 if (style->hasNormalColumnGap()) 545 638 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 546 case BREVERSE: 547 return new CSSPrimitiveValue(CSS_VAL_REVERSE); 639 return new CSSPrimitiveValue(style->columnGap(), CSSPrimitiveValue::CSS_NUMBER); 640 case CSS_PROP__WEBKIT_COLUMN_RULE_COLOR: 641 return currentColorOrValidColor(style, style->columnRuleColor()); 642 case CSS_PROP__WEBKIT_COLUMN_RULE_STYLE: 643 return valueForBorderStyle(style->columnRuleStyle()); 644 case CSS_PROP__WEBKIT_COLUMN_RULE_WIDTH: 645 return new CSSPrimitiveValue(style->columnRuleWidth(), CSSPrimitiveValue::CSS_PX); 646 case CSS_PROP__WEBKIT_COLUMN_BREAK_AFTER: 647 switch (style->columnBreakAfter()) { 648 case PBAUTO: 649 return new CSSPrimitiveValue(CSS_VAL_AUTO); 650 case PBALWAYS: 651 return new CSSPrimitiveValue(CSS_VAL_ALWAYS); 652 case PBAVOID: 653 return new CSSPrimitiveValue(CSS_VAL_AVOID); 654 } 655 ASSERT_NOT_REACHED(); 656 return 0; 657 case CSS_PROP__WEBKIT_COLUMN_BREAK_BEFORE: 658 switch (style->columnBreakBefore()) { 659 case PBAUTO: 660 return new CSSPrimitiveValue(CSS_VAL_AUTO); 661 case PBALWAYS: 662 return new CSSPrimitiveValue(CSS_VAL_ALWAYS); 663 case PBAVOID: 664 return new CSSPrimitiveValue(CSS_VAL_AVOID); 665 } 666 ASSERT_NOT_REACHED(); 667 return 0; 668 case CSS_PROP__WEBKIT_COLUMN_BREAK_INSIDE: 669 switch (style->columnBreakInside()) { 670 case PBAUTO: 671 return new CSSPrimitiveValue(CSS_VAL_AUTO); 672 case PBAVOID: 673 return new CSSPrimitiveValue(CSS_VAL_AVOID); 674 case PBALWAYS: 675 break; // not allowed 676 } 677 ASSERT_NOT_REACHED(); 678 return 0; 679 case CSS_PROP__WEBKIT_COLUMN_WIDTH: 680 if (style->hasAutoColumnWidth()) 681 return new CSSPrimitiveValue(CSS_VAL_AUTO); 682 return new CSSPrimitiveValue(style->columnWidth(), CSSPrimitiveValue::CSS_NUMBER); 683 case CSS_PROP_CONTENT: 684 // FIXME: unimplemented 685 break; 686 case CSS_PROP_COUNTER_INCREMENT: 687 // FIXME: unimplemented 688 // Specification says "as specified", which means we'd need to keep a copy of the original CSS list around. 689 break; 690 case CSS_PROP_COUNTER_RESET: 691 // FIXME: unimplemented 692 // Specification says "as specified", which means we'd need to keep a copy of the original CSS list around. 693 break; 694 case CSS_PROP_CURSOR: { 695 CSSValueList* list = 0; 696 CursorList* cursors = style->cursors(); 697 if (cursors && cursors->size() > 0) { 698 list = new CSSValueList; 699 for (unsigned i = 0; i < cursors->size(); ++i) 700 list->append(new CSSPrimitiveValue((*cursors)[i].cursorImage->url(), CSSPrimitiveValue::CSS_URI)); 701 } 702 CSSValue* value = 0; 703 switch (style->cursor()) { 704 case CURSOR_AUTO: 705 value = new CSSPrimitiveValue(CSS_VAL_AUTO); 706 break; 707 case CURSOR_CROSS: 708 value = new CSSPrimitiveValue(CSS_VAL_CROSSHAIR); 709 break; 710 case CURSOR_DEFAULT: 711 value = new CSSPrimitiveValue(CSS_VAL_DEFAULT); 712 break; 713 case CURSOR_POINTER: 714 value = new CSSPrimitiveValue(CSS_VAL_POINTER); 715 break; 716 case CURSOR_MOVE: 717 value = new CSSPrimitiveValue(CSS_VAL_MOVE); 718 break; 719 case CURSOR_CELL: 720 value = new CSSPrimitiveValue(CSS_VAL_CELL); 721 break; 722 case CURSOR_VERTICAL_TEXT: 723 value = new CSSPrimitiveValue(CSS_VAL_VERTICAL_TEXT); 724 break; 725 case CURSOR_CONTEXT_MENU: 726 value = new CSSPrimitiveValue(CSS_VAL_CONTEXT_MENU); 727 break; 728 case CURSOR_ALIAS: 729 value = new CSSPrimitiveValue(CSS_VAL_ALIAS); 730 break; 731 case CURSOR_COPY: 732 value = new CSSPrimitiveValue(CSS_VAL_COPY); 733 break; 734 case CURSOR_NONE: 735 value = new CSSPrimitiveValue(CSS_VAL_NONE); 736 break; 737 case CURSOR_PROGRESS: 738 value = new CSSPrimitiveValue(CSS_VAL_PROGRESS); 739 break; 740 case CURSOR_NO_DROP: 741 value = new CSSPrimitiveValue(CSS_VAL_NO_DROP); 742 break; 743 case CURSOR_NOT_ALLOWED: 744 value = new CSSPrimitiveValue(CSS_VAL_NOT_ALLOWED); 745 break; 746 case CURSOR_E_RESIZE: 747 value = new CSSPrimitiveValue(CSS_VAL_E_RESIZE); 748 break; 749 case CURSOR_NE_RESIZE: 750 value = new CSSPrimitiveValue(CSS_VAL_NE_RESIZE); 751 break; 752 case CURSOR_NW_RESIZE: 753 value = new CSSPrimitiveValue(CSS_VAL_NW_RESIZE); 754 break; 755 case CURSOR_N_RESIZE: 756 value = new CSSPrimitiveValue(CSS_VAL_N_RESIZE); 757 break; 758 case CURSOR_SE_RESIZE: 759 value = new CSSPrimitiveValue(CSS_VAL_SE_RESIZE); 760 break; 761 case CURSOR_SW_RESIZE: 762 value = new CSSPrimitiveValue(CSS_VAL_SW_RESIZE); 763 break; 764 case CURSOR_S_RESIZE: 765 value = new CSSPrimitiveValue(CSS_VAL_S_RESIZE); 766 break; 767 case CURSOR_W_RESIZE: 768 value = new CSSPrimitiveValue(CSS_VAL_W_RESIZE); 769 break; 770 case CURSOR_EW_RESIZE: 771 value = new CSSPrimitiveValue(CSS_VAL_EW_RESIZE); 772 break; 773 case CURSOR_NS_RESIZE: 774 value = new CSSPrimitiveValue(CSS_VAL_NS_RESIZE); 775 break; 776 case CURSOR_NESW_RESIZE: 777 value = new CSSPrimitiveValue(CSS_VAL_NESW_RESIZE); 778 break; 779 case CURSOR_NWSE_RESIZE: 780 value = new CSSPrimitiveValue(CSS_VAL_NWSE_RESIZE); 781 break; 782 case CURSOR_COL_RESIZE: 783 value = new CSSPrimitiveValue(CSS_VAL_COL_RESIZE); 784 break; 785 case CURSOR_ROW_RESIZE: 786 value = new CSSPrimitiveValue(CSS_VAL_ROW_RESIZE); 787 break; 788 case CURSOR_TEXT: 789 value = new CSSPrimitiveValue(CSS_VAL_TEXT); 790 break; 791 case CURSOR_WAIT: 792 value = new CSSPrimitiveValue(CSS_VAL_WAIT); 793 break; 794 case CURSOR_HELP: 795 value = new CSSPrimitiveValue(CSS_VAL_HELP); 796 break; 797 case CURSOR_ALL_SCROLL: 798 value = new CSSPrimitiveValue(CSS_VAL_ALL_SCROLL); 799 break; 800 } 801 ASSERT(value); 802 if (list) { 803 list->append(value); 804 return list; 805 } 806 return value; 548 807 } 549 ASSERT_NOT_REACHED(); 550 return 0; 551 case CSS_PROP__WEBKIT_BOX_FLEX: 552 return new CSSPrimitiveValue(style->boxFlex(), CSSPrimitiveValue::CSS_NUMBER); 553 case CSS_PROP__WEBKIT_BOX_FLEX_GROUP: 554 return new CSSPrimitiveValue(style->boxFlexGroup(), CSSPrimitiveValue::CSS_NUMBER); 555 case CSS_PROP__WEBKIT_BOX_LINES: 556 switch (style->boxLines()) { 557 case SINGLE: 558 return new CSSPrimitiveValue(CSS_VAL_SINGLE); 559 case MULTIPLE: 560 return new CSSPrimitiveValue(CSS_VAL_MULTIPLE); 561 } 562 ASSERT_NOT_REACHED(); 563 return 0; 564 case CSS_PROP__WEBKIT_BOX_ORDINAL_GROUP: 565 return new CSSPrimitiveValue(style->boxOrdinalGroup(), CSSPrimitiveValue::CSS_NUMBER); 566 case CSS_PROP__WEBKIT_BOX_ORIENT: 567 switch (style->boxOrient()) { 568 case HORIZONTAL: 569 return new CSSPrimitiveValue(CSS_VAL_HORIZONTAL); 570 case VERTICAL: 571 return new CSSPrimitiveValue(CSS_VAL_VERTICAL); 572 } 573 ASSERT_NOT_REACHED(); 574 return 0; 575 case CSS_PROP__WEBKIT_BOX_PACK: 576 switch (style->boxPack()) { 577 case BSTART: 578 return new CSSPrimitiveValue(CSS_VAL_START); 579 case BEND: 580 return new CSSPrimitiveValue(CSS_VAL_END); 581 case BCENTER: 582 return new CSSPrimitiveValue(CSS_VAL_CENTER); 583 case BJUSTIFY: 584 return new CSSPrimitiveValue(CSS_VAL_JUSTIFY); 585 case BSTRETCH: 586 case BBASELINE: 587 break; // not allowed 588 } 589 ASSERT_NOT_REACHED(); 590 return 0; 591 case CSS_PROP__WEBKIT_BOX_SHADOW: 592 return valueForShadow(style->boxShadow()); 593 case CSS_PROP_CAPTION_SIDE: 594 switch (style->captionSide()) { 595 case CAPLEFT: 596 return new CSSPrimitiveValue(CSS_VAL_LEFT); 597 case CAPRIGHT: 598 return new CSSPrimitiveValue(CSS_VAL_RIGHT); 599 case CAPTOP: 600 return new CSSPrimitiveValue(CSS_VAL_TOP); 601 case CAPBOTTOM: 602 return new CSSPrimitiveValue(CSS_VAL_BOTTOM); 603 } 604 ASSERT_NOT_REACHED(); 605 return 0; 606 case CSS_PROP_CLEAR: 607 switch (style->clear()) { 608 case CNONE: 808 case CSS_PROP_DIRECTION: 809 switch (style->direction()) { 810 case LTR: 811 return new CSSPrimitiveValue(CSS_VAL_LTR); 812 case RTL: 813 return new CSSPrimitiveValue(CSS_VAL_RTL); 814 } 815 ASSERT_NOT_REACHED(); 816 return 0; 817 case CSS_PROP_DISPLAY: 818 switch (style->display()) { 819 case INLINE: 820 return new CSSPrimitiveValue(CSS_VAL_INLINE); 821 case BLOCK: 822 return new CSSPrimitiveValue(CSS_VAL_BLOCK); 823 case LIST_ITEM: 824 return new CSSPrimitiveValue(CSS_VAL_LIST_ITEM); 825 case RUN_IN: 826 return new CSSPrimitiveValue(CSS_VAL_RUN_IN); 827 case COMPACT: 828 return new CSSPrimitiveValue(CSS_VAL_COMPACT); 829 case INLINE_BLOCK: 830 return new CSSPrimitiveValue(CSS_VAL_INLINE_BLOCK); 831 case TABLE: 832 return new CSSPrimitiveValue(CSS_VAL_TABLE); 833 case INLINE_TABLE: 834 return new CSSPrimitiveValue(CSS_VAL_INLINE_TABLE); 835 case TABLE_ROW_GROUP: 836 return new CSSPrimitiveValue(CSS_VAL_TABLE_ROW_GROUP); 837 case TABLE_HEADER_GROUP: 838 return new CSSPrimitiveValue(CSS_VAL_TABLE_HEADER_GROUP); 839 case TABLE_FOOTER_GROUP: 840 return new CSSPrimitiveValue(CSS_VAL_TABLE_FOOTER_GROUP); 841 case TABLE_ROW: 842 return new CSSPrimitiveValue(CSS_VAL_TABLE_ROW); 843 case TABLE_COLUMN_GROUP: 844 return new CSSPrimitiveValue(CSS_VAL_TABLE_COLUMN_GROUP); 845 case TABLE_COLUMN: 846 return new CSSPrimitiveValue(CSS_VAL_TABLE_COLUMN); 847 case TABLE_CELL: 848 return new CSSPrimitiveValue(CSS_VAL_TABLE_CELL); 849 case TABLE_CAPTION: 850 return new CSSPrimitiveValue(CSS_VAL_TABLE_CAPTION); 851 case BOX: 852 return new CSSPrimitiveValue(CSS_VAL__WEBKIT_BOX); 853 case INLINE_BOX: 854 return new CSSPrimitiveValue(CSS_VAL__WEBKIT_INLINE_BOX); 855 case NONE: 856 return new CSSPrimitiveValue(CSS_VAL_NONE); 857 } 858 ASSERT_NOT_REACHED(); 859 return 0; 860 case CSS_PROP_EMPTY_CELLS: 861 switch (style->emptyCells()) { 862 case SHOW: 863 return new CSSPrimitiveValue(CSS_VAL_SHOW); 864 case HIDE: 865 return new CSSPrimitiveValue(CSS_VAL_HIDE); 866 } 867 ASSERT_NOT_REACHED(); 868 return 0; 869 case CSS_PROP_FLOAT: 870 switch (style->floating()) { 871 case FNONE: 872 return new CSSPrimitiveValue(CSS_VAL_NONE); 873 case FLEFT: 874 return new CSSPrimitiveValue(CSS_VAL_LEFT); 875 case FRIGHT: 876 return new CSSPrimitiveValue(CSS_VAL_RIGHT); 877 } 878 ASSERT_NOT_REACHED(); 879 return 0; 880 case CSS_PROP_FONT_FAMILY: 881 // FIXME: This only returns the first family. 882 return new CSSPrimitiveValue(style->fontDescription().family().family().domString(), CSSPrimitiveValue::CSS_STRING); 883 case CSS_PROP_FONT_SIZE: 884 return new CSSPrimitiveValue(style->fontDescription().computedPixelSize(), CSSPrimitiveValue::CSS_PX); 885 case CSS_PROP_FONT_STRETCH: 886 // FIXME: unimplemented 887 break; 888 case CSS_PROP_FONT_STYLE: 889 if (style->fontDescription().italic()) 890 return new CSSPrimitiveValue(CSS_VAL_ITALIC); 891 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 892 case CSS_PROP_FONT_VARIANT: 893 if (style->fontDescription().smallCaps()) 894 return new CSSPrimitiveValue(CSS_VAL_SMALL_CAPS); 895 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 896 case CSS_PROP_FONT_WEIGHT: 897 // FIXME: this does not reflect the full range of weights 898 // that can be expressed with CSS 899 if (style->fontDescription().weight() == cBoldWeight) 900 return new CSSPrimitiveValue(CSS_VAL_BOLD); 901 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 902 case CSS_PROP_HEIGHT: 903 return new CSSPrimitiveValue(renderer->contentHeight(), CSSPrimitiveValue::CSS_PX); 904 case CSS_PROP__WEBKIT_HIGHLIGHT: 905 if (style->highlight() == nullAtom) 609 906 return new CSSPrimitiveValue(CSS_VAL_NONE); 610 case CLEFT: 611 return new CSSPrimitiveValue(CSS_VAL_LEFT); 612 case CRIGHT: 613 return new CSSPrimitiveValue(CSS_VAL_RIGHT); 614 case CBOTH: 615 return new CSSPrimitiveValue(CSS_VAL_BOTH); 616 } 617 ASSERT_NOT_REACHED(); 618 return 0; 619 case CSS_PROP_CLIP: 620 // FIXME: unimplemented 621 break; 622 case CSS_PROP_COLOR: 623 return new CSSPrimitiveValue(style->color().rgb()); 624 case CSS_PROP__WEBKIT_COLUMN_COUNT: 625 if (style->hasAutoColumnCount()) 626 return new CSSPrimitiveValue(CSS_VAL_AUTO); 627 return new CSSPrimitiveValue(style->columnCount(), CSSPrimitiveValue::CSS_NUMBER); 628 case CSS_PROP__WEBKIT_COLUMN_GAP: 629 if (style->hasNormalColumnGap()) 630 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 631 return new CSSPrimitiveValue(style->columnGap(), CSSPrimitiveValue::CSS_NUMBER); 632 case CSS_PROP__WEBKIT_COLUMN_RULE_COLOR: 633 return currentColorOrValidColor(style, style->columnRuleColor()); 634 case CSS_PROP__WEBKIT_COLUMN_RULE_STYLE: 635 return valueForBorderStyle(style->columnRuleStyle()); 636 case CSS_PROP__WEBKIT_COLUMN_RULE_WIDTH: 637 return new CSSPrimitiveValue(style->columnRuleWidth(), CSSPrimitiveValue::CSS_PX); 638 case CSS_PROP__WEBKIT_COLUMN_BREAK_AFTER: 639 switch (style->columnBreakAfter()) { 640 case PBAUTO: 641 return new CSSPrimitiveValue(CSS_VAL_AUTO); 642 case PBALWAYS: 643 return new CSSPrimitiveValue(CSS_VAL_ALWAYS); 644 case PBAVOID: 645 return new CSSPrimitiveValue(CSS_VAL_AVOID); 646 } 647 ASSERT_NOT_REACHED(); 648 return 0; 649 case CSS_PROP__WEBKIT_COLUMN_BREAK_BEFORE: 650 switch (style->columnBreakBefore()) { 651 case PBAUTO: 652 return new CSSPrimitiveValue(CSS_VAL_AUTO); 653 case PBALWAYS: 654 return new CSSPrimitiveValue(CSS_VAL_ALWAYS); 655 case PBAVOID: 656 return new CSSPrimitiveValue(CSS_VAL_AVOID); 657 } 658 ASSERT_NOT_REACHED(); 659 return 0; 660 case CSS_PROP__WEBKIT_COLUMN_BREAK_INSIDE: 661 switch (style->columnBreakInside()) { 662 case PBAUTO: 663 return new CSSPrimitiveValue(CSS_VAL_AUTO); 664 case PBAVOID: 665 return new CSSPrimitiveValue(CSS_VAL_AVOID); 666 case PBALWAYS: 667 break; // not allowed 668 } 669 ASSERT_NOT_REACHED(); 670 return 0; 671 case CSS_PROP__WEBKIT_COLUMN_WIDTH: 672 if (style->hasAutoColumnWidth()) 673 return new CSSPrimitiveValue(CSS_VAL_AUTO); 674 return new CSSPrimitiveValue(style->columnWidth(), CSSPrimitiveValue::CSS_NUMBER); 675 case CSS_PROP_CONTENT: 676 // FIXME: unimplemented 677 break; 678 case CSS_PROP_COUNTER_INCREMENT: 679 // FIXME: unimplemented 680 // Specification says "as specified", which means we'd need to keep a copy of the original CSS list around. 681 break; 682 case CSS_PROP_COUNTER_RESET: 683 // FIXME: unimplemented 684 // Specification says "as specified", which means we'd need to keep a copy of the original CSS list around. 685 break; 686 case CSS_PROP_CURSOR: { 687 CSSValueList* list = 0; 688 CSSValue* value = 0; 689 CursorList* cursors = style->cursors(); 690 if (cursors && cursors->size() > 0) { 691 list = new CSSValueList; 692 for (unsigned i = 0; i < cursors->size(); ++i) 693 list->append(new CSSPrimitiveValue((*cursors)[i].cursorImage->url(), CSSPrimitiveValue::CSS_URI)); 694 } 695 switch (style->cursor()) { 696 case CURSOR_AUTO: 697 value = new CSSPrimitiveValue(CSS_VAL_AUTO); 698 break; 699 case CURSOR_CROSS: 700 value = new CSSPrimitiveValue(CSS_VAL_CROSSHAIR); 701 break; 702 case CURSOR_DEFAULT: 703 value = new CSSPrimitiveValue(CSS_VAL_DEFAULT); 704 break; 705 case CURSOR_POINTER: 706 value = new CSSPrimitiveValue(CSS_VAL_POINTER); 707 break; 708 case CURSOR_MOVE: 709 value = new CSSPrimitiveValue(CSS_VAL_MOVE); 710 break; 711 case CURSOR_CELL: 712 value = new CSSPrimitiveValue(CSS_VAL_CELL); 713 break; 714 case CURSOR_VERTICAL_TEXT: 715 value = new CSSPrimitiveValue(CSS_VAL_VERTICAL_TEXT); 716 break; 717 case CURSOR_CONTEXT_MENU: 718 value = new CSSPrimitiveValue(CSS_VAL_CONTEXT_MENU); 719 break; 720 case CURSOR_ALIAS: 721 value = new CSSPrimitiveValue(CSS_VAL_ALIAS); 722 break; 723 case CURSOR_COPY: 724 value = new CSSPrimitiveValue(CSS_VAL_COPY); 725 break; 726 case CURSOR_NONE: 727 value = new CSSPrimitiveValue(CSS_VAL_NONE); 728 break; 729 case CURSOR_PROGRESS: 730 value = new CSSPrimitiveValue(CSS_VAL_PROGRESS); 731 break; 732 case CURSOR_NO_DROP: 733 value = new CSSPrimitiveValue(CSS_VAL_NO_DROP); 734 break; 735 case CURSOR_NOT_ALLOWED: 736 value = new CSSPrimitiveValue(CSS_VAL_NOT_ALLOWED); 737 break; 738 case CURSOR_E_RESIZE: 739 value = new CSSPrimitiveValue(CSS_VAL_E_RESIZE); 740 break; 741 case CURSOR_NE_RESIZE: 742 value = new CSSPrimitiveValue(CSS_VAL_NE_RESIZE); 743 break; 744 case CURSOR_NW_RESIZE: 745 value = new CSSPrimitiveValue(CSS_VAL_NW_RESIZE); 746 break; 747 case CURSOR_N_RESIZE: 748 value = new CSSPrimitiveValue(CSS_VAL_N_RESIZE); 749 break; 750 case CURSOR_SE_RESIZE: 751 value = new CSSPrimitiveValue(CSS_VAL_SE_RESIZE); 752 break; 753 case CURSOR_SW_RESIZE: 754 value = new CSSPrimitiveValue(CSS_VAL_SW_RESIZE); 755 break; 756 case CURSOR_S_RESIZE: 757 value = new CSSPrimitiveValue(CSS_VAL_S_RESIZE); 758 break; 759 case CURSOR_W_RESIZE: 760 value = new CSSPrimitiveValue(CSS_VAL_W_RESIZE); 761 break; 762 case CURSOR_EW_RESIZE: 763 value = new CSSPrimitiveValue(CSS_VAL_EW_RESIZE); 764 break; 765 case CURSOR_NS_RESIZE: 766 value = new CSSPrimitiveValue(CSS_VAL_NS_RESIZE); 767 break; 768 case CURSOR_NESW_RESIZE: 769 value = new CSSPrimitiveValue(CSS_VAL_NESW_RESIZE); 770 break; 771 case CURSOR_NWSE_RESIZE: 772 value = new CSSPrimitiveValue(CSS_VAL_NWSE_RESIZE); 773 break; 774 case CURSOR_COL_RESIZE: 775 value = new CSSPrimitiveValue(CSS_VAL_COL_RESIZE); 776 break; 777 case CURSOR_ROW_RESIZE: 778 value = new CSSPrimitiveValue(CSS_VAL_ROW_RESIZE); 779 break; 780 case CURSOR_TEXT: 781 value = new CSSPrimitiveValue(CSS_VAL_TEXT); 782 break; 783 case CURSOR_WAIT: 784 value = new CSSPrimitiveValue(CSS_VAL_WAIT); 785 break; 786 case CURSOR_HELP: 787 value = new CSSPrimitiveValue(CSS_VAL_HELP); 788 break; 789 case CURSOR_ALL_SCROLL: 790 value = new CSSPrimitiveValue(CSS_VAL_ALL_SCROLL); 791 break; 792 } 793 ASSERT(value); 794 if (list) { 795 list->append(value); 796 return list; 797 } 798 return value; 799 } 800 case CSS_PROP_DIRECTION: 801 switch (style->direction()) { 802 case LTR: 803 return new CSSPrimitiveValue(CSS_VAL_LTR); 804 case RTL: 805 return new CSSPrimitiveValue(CSS_VAL_RTL); 806 } 807 ASSERT_NOT_REACHED(); 808 return 0; 809 case CSS_PROP_DISPLAY: 810 switch (style->display()) { 811 case INLINE: 812 return new CSSPrimitiveValue(CSS_VAL_INLINE); 813 case BLOCK: 814 return new CSSPrimitiveValue(CSS_VAL_BLOCK); 815 case LIST_ITEM: 816 return new CSSPrimitiveValue(CSS_VAL_LIST_ITEM); 817 case RUN_IN: 818 return new CSSPrimitiveValue(CSS_VAL_RUN_IN); 819 case COMPACT: 820 return new CSSPrimitiveValue(CSS_VAL_COMPACT); 821 case INLINE_BLOCK: 822 return new CSSPrimitiveValue(CSS_VAL_INLINE_BLOCK); 823 case TABLE: 824 return new CSSPrimitiveValue(CSS_VAL_TABLE); 825 case INLINE_TABLE: 826 return new CSSPrimitiveValue(CSS_VAL_INLINE_TABLE); 827 case TABLE_ROW_GROUP: 828 return new CSSPrimitiveValue(CSS_VAL_TABLE_ROW_GROUP); 829 case TABLE_HEADER_GROUP: 830 return new CSSPrimitiveValue(CSS_VAL_TABLE_HEADER_GROUP); 831 case TABLE_FOOTER_GROUP: 832 return new CSSPrimitiveValue(CSS_VAL_TABLE_FOOTER_GROUP); 833 case TABLE_ROW: 834 return new CSSPrimitiveValue(CSS_VAL_TABLE_ROW); 835 case TABLE_COLUMN_GROUP: 836 return new CSSPrimitiveValue(CSS_VAL_TABLE_COLUMN_GROUP); 837 case TABLE_COLUMN: 838 return new CSSPrimitiveValue(CSS_VAL_TABLE_COLUMN); 839 case TABLE_CELL: 840 return new CSSPrimitiveValue(CSS_VAL_TABLE_CELL); 841 case TABLE_CAPTION: 842 return new CSSPrimitiveValue(CSS_VAL_TABLE_CAPTION); 843 case BOX: 844 return new CSSPrimitiveValue(CSS_VAL__WEBKIT_BOX); 845 case INLINE_BOX: 846 return new CSSPrimitiveValue(CSS_VAL__WEBKIT_INLINE_BOX); 847 case NONE: 907 return new CSSPrimitiveValue(style->highlight(), CSSPrimitiveValue::CSS_STRING); 908 case CSS_PROP_LEFT: 909 return getPositionOffsetValue(renderer, CSS_PROP_LEFT); 910 case CSS_PROP_LETTER_SPACING: 911 if (!style->letterSpacing()) 912 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 913 return new CSSPrimitiveValue(style->letterSpacing(), CSSPrimitiveValue::CSS_PX); 914 case CSS_PROP__WEBKIT_LINE_CLAMP: 915 if (style->lineClamp() == -1) 848 916 return new CSSPrimitiveValue(CSS_VAL_NONE); 849 } 850 ASSERT_NOT_REACHED(); 851 return 0; 852 case CSS_PROP_EMPTY_CELLS: 853 switch (style->emptyCells()) { 854 case SHOW: 855 return new CSSPrimitiveValue(CSS_VAL_SHOW); 856 case HIDE: 857 return new CSSPrimitiveValue(CSS_VAL_HIDE); 858 } 859 ASSERT_NOT_REACHED(); 860 return 0; 861 case CSS_PROP_FLOAT: 862 switch (style->floating()) { 863 case FNONE: 864 return new CSSPrimitiveValue(CSS_VAL_NONE); 865 case FLEFT: 866 return new CSSPrimitiveValue(CSS_VAL_LEFT); 867 case FRIGHT: 868 return new CSSPrimitiveValue(CSS_VAL_RIGHT); 869 } 870 ASSERT_NOT_REACHED(); 871 return 0; 872 case CSS_PROP_FONT_FAMILY: 873 { 874 // FIXME: This only returns the first family. 875 const FontDescription& desc = style->fontDescription(); 876 return new CSSPrimitiveValue(desc.family().family().domString(), CSSPrimitiveValue::CSS_STRING); 877 } 878 case CSS_PROP_FONT_SIZE: 879 { 880 FontDescription desc = style->fontDescription(); 881 return new CSSPrimitiveValue(desc.computedPixelSize(), CSSPrimitiveValue::CSS_PX); 882 } 883 case CSS_PROP_FONT_STRETCH: 884 // FIXME: unimplemented 885 break; 886 case CSS_PROP_FONT_STYLE: 887 { 888 // FIXME: handle oblique? 889 const FontDescription& desc = style->fontDescription(); 890 if (desc.italic()) 891 return new CSSPrimitiveValue(CSS_VAL_ITALIC); 892 else 893 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 894 } 895 case CSS_PROP_FONT_VARIANT: 896 { 897 const FontDescription& desc = style->fontDescription(); 898 if (desc.smallCaps()) 899 return new CSSPrimitiveValue(CSS_VAL_SMALL_CAPS); 900 else 901 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 902 } 903 case CSS_PROP_FONT_WEIGHT: 904 { 905 // FIXME: this does not reflect the full range of weights 906 // that can be expressed with CSS 907 const FontDescription& desc = style->fontDescription(); 908 if (desc.weight() == cBoldWeight) 909 return new CSSPrimitiveValue(CSS_VAL_BOLD); 910 else 911 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 912 } 913 case CSS_PROP_HEIGHT: 914 return new CSSPrimitiveValue(renderer->contentHeight(), CSSPrimitiveValue::CSS_PX); 915 case CSS_PROP__WEBKIT_HIGHLIGHT: { 916 if (style->highlight() == nullAtom) 917 return new CSSPrimitiveValue(CSS_VAL_NONE); 918 else 919 return new CSSPrimitiveValue(style->highlight(), CSSPrimitiveValue::CSS_STRING); 920 } 921 case CSS_PROP_LEFT: 922 return getPositionOffsetValue(renderer, CSS_PROP_LEFT); 923 case CSS_PROP_LETTER_SPACING: 924 if (style->letterSpacing() == 0) 925 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 926 return new CSSPrimitiveValue(style->letterSpacing(), CSSPrimitiveValue::CSS_PX); 927 case CSS_PROP__WEBKIT_LINE_CLAMP: 928 if (style->lineClamp() == -1) 929 return new CSSPrimitiveValue(CSS_VAL_NONE); 930 return new CSSPrimitiveValue(style->lineClamp(), CSSPrimitiveValue::CSS_PERCENTAGE); 931 case CSS_PROP_LINE_HEIGHT: { 932 Length length(style->lineHeight()); 933 if (length.isNegative()) 934 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 935 if (length.isPercent()) { 936 // This is imperfect, because it doesn't include the zoom factor and the real computation 937 // for how high to be in pixels does include things like minimum font size and the zoom factor. 938 // On the other hand, since font-size doesn't include the zoom factor, we really can't do 939 // that here either. 940 float fontSize = style->fontDescription().specifiedSize(); 941 return new CSSPrimitiveValue((int)(length.percent() * fontSize) / 100, CSSPrimitiveValue::CSS_PX); 942 } 943 else { 917 return new CSSPrimitiveValue(style->lineClamp(), CSSPrimitiveValue::CSS_PERCENTAGE); 918 case CSS_PROP_LINE_HEIGHT: { 919 Length length = style->lineHeight(); 920 if (length.isNegative()) 921 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 922 if (length.isPercent()) 923 // This is imperfect, because it doesn't include the zoom factor and the real computation 924 // for how high to be in pixels does include things like minimum font size and the zoom factor. 925 // On the other hand, since font-size doesn't include the zoom factor, we really can't do 926 // that here either. 927 return new CSSPrimitiveValue(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, CSSPrimitiveValue::CSS_PX); 944 928 return new CSSPrimitiveValue(length.value(), CSSPrimitiveValue::CSS_PX); 945 929 } 946 } 947 case CSS_PROP_LIST_STYLE_IMAGE: 948 if (style->listStyleImage()) 949 return new CSSPrimitiveValue(style->listStyleImage()->url(), CSSPrimitiveValue::CSS_URI); 950 return new CSSPrimitiveValue(CSS_VAL_NONE); 951 case CSS_PROP_LIST_STYLE_POSITION: 952 switch (style->listStylePosition()) { 953 case OUTSIDE: 954 return new CSSPrimitiveValue(CSS_VAL_OUTSIDE); 955 case INSIDE: 956 return new CSSPrimitiveValue(CSS_VAL_INSIDE); 930 case CSS_PROP_LIST_STYLE_IMAGE: 931 if (style->listStyleImage()) 932 return new CSSPrimitiveValue(style->listStyleImage()->url(), CSSPrimitiveValue::CSS_URI); 933 return new CSSPrimitiveValue(CSS_VAL_NONE); 934 case CSS_PROP_LIST_STYLE_POSITION: 935 switch (style->listStylePosition()) { 936 case OUTSIDE: 937 return new CSSPrimitiveValue(CSS_VAL_OUTSIDE); 938 case INSIDE: 939 return new CSSPrimitiveValue(CSS_VAL_INSIDE); 940 } 941 ASSERT_NOT_REACHED(); 942 return 0; 943 case CSS_PROP_LIST_STYLE_TYPE: 944 switch (style->listStyleType()) { 945 case LNONE: 946 return new CSSPrimitiveValue(CSS_VAL_NONE); 947 case DISC: 948 return new CSSPrimitiveValue(CSS_VAL_DISC); 949 case CIRCLE: 950 return new CSSPrimitiveValue(CSS_VAL_CIRCLE); 951 case SQUARE: 952 return new CSSPrimitiveValue(CSS_VAL_SQUARE); 953 case LDECIMAL: 954 return new CSSPrimitiveValue(CSS_VAL_DECIMAL); 955 case DECIMAL_LEADING_ZERO: 956 return new CSSPrimitiveValue(CSS_VAL_DECIMAL_LEADING_ZERO); 957 case LOWER_ROMAN: 958 return new CSSPrimitiveValue(CSS_VAL_LOWER_ROMAN); 959 case UPPER_ROMAN: 960 return new CSSPrimitiveValue(CSS_VAL_UPPER_ROMAN); 961 case LOWER_GREEK: 962 return new CSSPrimitiveValue(CSS_VAL_LOWER_GREEK); 963 case LOWER_ALPHA: 964 return new CSSPrimitiveValue(CSS_VAL_LOWER_ALPHA); 965 case LOWER_LATIN: 966 return new CSSPrimitiveValue(CSS_VAL_LOWER_LATIN); 967 case UPPER_ALPHA: 968 return new CSSPrimitiveValue(CSS_VAL_UPPER_ALPHA); 969 case UPPER_LATIN: 970 return new CSSPrimitiveValue(CSS_VAL_UPPER_LATIN); 971 case HEBREW: 972 return new CSSPrimitiveValue(CSS_VAL_HEBREW); 973 case ARMENIAN: 974 return new CSSPrimitiveValue(CSS_VAL_ARMENIAN); 975 case GEORGIAN: 976 return new CSSPrimitiveValue(CSS_VAL_GEORGIAN); 977 case CJK_IDEOGRAPHIC: 978 return new CSSPrimitiveValue(CSS_VAL_CJK_IDEOGRAPHIC); 979 case HIRAGANA: 980 return new CSSPrimitiveValue(CSS_VAL_HIRAGANA); 981 case KATAKANA: 982 return new CSSPrimitiveValue(CSS_VAL_KATAKANA); 983 case HIRAGANA_IROHA: 984 return new CSSPrimitiveValue(CSS_VAL_HIRAGANA_IROHA); 985 case KATAKANA_IROHA: 986 return new CSSPrimitiveValue(CSS_VAL_KATAKANA_IROHA); 987 } 988 ASSERT_NOT_REACHED(); 989 return 0; 990 case CSS_PROP_MARGIN_TOP: 991 // FIXME: Supposed to return the percentage if percentage was specified. 992 return new CSSPrimitiveValue(renderer->marginTop(), CSSPrimitiveValue::CSS_PX); 993 case CSS_PROP_MARGIN_RIGHT: 994 // FIXME: Supposed to return the percentage if percentage was specified. 995 return new CSSPrimitiveValue(renderer->marginRight(), CSSPrimitiveValue::CSS_PX); 996 case CSS_PROP_MARGIN_BOTTOM: 997 // FIXME: Supposed to return the percentage if percentage was specified. 998 return new CSSPrimitiveValue(renderer->marginBottom(), CSSPrimitiveValue::CSS_PX); 999 case CSS_PROP_MARGIN_LEFT: 1000 // FIXME: Supposed to return the percentage if percentage was specified. 1001 return new CSSPrimitiveValue(renderer->marginLeft(), CSSPrimitiveValue::CSS_PX); 1002 case CSS_PROP__WEBKIT_MARQUEE: 1003 // FIXME: unimplemented 1004 break; 1005 case CSS_PROP__WEBKIT_MARQUEE_DIRECTION: 1006 switch (style->marqueeDirection()) { 1007 case MFORWARD: 1008 return new CSSPrimitiveValue(CSS_VAL_FORWARDS); 1009 case MBACKWARD: 1010 return new CSSPrimitiveValue(CSS_VAL_BACKWARDS); 1011 case MAUTO: 1012 return new CSSPrimitiveValue(CSS_VAL_AUTO); 1013 case MUP: 1014 return new CSSPrimitiveValue(CSS_VAL_UP); 1015 case MDOWN: 1016 return new CSSPrimitiveValue(CSS_VAL_DOWN); 1017 case MLEFT: 1018 return new CSSPrimitiveValue(CSS_VAL_LEFT); 1019 case MRIGHT: 1020 return new CSSPrimitiveValue(CSS_VAL_RIGHT); 1021 } 1022 ASSERT_NOT_REACHED(); 1023 return 0; 1024 case CSS_PROP__WEBKIT_MARQUEE_INCREMENT: 1025 return valueForLength(style->marqueeIncrement()); 1026 case CSS_PROP__WEBKIT_MARQUEE_REPETITION: 1027 if (style->marqueeLoopCount() < 0) 1028 return new CSSPrimitiveValue(CSS_VAL_INFINITE); 1029 return new CSSPrimitiveValue(style->marqueeLoopCount(), CSSPrimitiveValue::CSS_NUMBER); 1030 case CSS_PROP__WEBKIT_MARQUEE_SPEED: 1031 // FIXME: unimplemented 1032 break; 1033 case CSS_PROP__WEBKIT_MARQUEE_STYLE: 1034 switch (style->marqueeBehavior()) { 1035 case MNONE: 1036 return new CSSPrimitiveValue(CSS_VAL_NONE); 1037 case MSCROLL: 1038 return new CSSPrimitiveValue(CSS_VAL_SCROLL); 1039 case MSLIDE: 1040 return new CSSPrimitiveValue(CSS_VAL_SLIDE); 1041 case MALTERNATE: 1042 return new CSSPrimitiveValue(CSS_VAL_ALTERNATE); 1043 } 1044 ASSERT_NOT_REACHED(); 1045 return 0; 1046 case CSS_PROP__WEBKIT_USER_MODIFY: 1047 switch (style->userModify()) { 1048 case READ_ONLY: 1049 return new CSSPrimitiveValue(CSS_VAL_READ_ONLY); 1050 case READ_WRITE: 1051 return new CSSPrimitiveValue(CSS_VAL_READ_WRITE); 1052 case READ_WRITE_PLAINTEXT_ONLY: 1053 return new CSSPrimitiveValue(CSS_VAL_READ_WRITE_PLAINTEXT_ONLY); 1054 } 1055 ASSERT_NOT_REACHED(); 1056 return 0; 1057 case CSS_PROP_MAX_HEIGHT: 1058 return valueForMaxLength(style->maxHeight()); 1059 case CSS_PROP_MAX_WIDTH: 1060 return valueForMaxLength(style->maxWidth()); 1061 case CSS_PROP_MIN_HEIGHT: 1062 return valueForLength(style->minHeight()); 1063 case CSS_PROP_MIN_WIDTH: 1064 return valueForLength(style->minWidth()); 1065 case CSS_PROP_OPACITY: 1066 return new CSSPrimitiveValue(style->opacity(), CSSPrimitiveValue::CSS_NUMBER); 1067 case CSS_PROP_ORPHANS: 1068 return new CSSPrimitiveValue(style->orphans(), CSSPrimitiveValue::CSS_NUMBER); 1069 case CSS_PROP_OUTLINE_COLOR: 1070 return currentColorOrValidColor(style, style->outlineColor()); 1071 case CSS_PROP_OUTLINE_OFFSET: 1072 // FIXME: unimplemented 1073 break; 1074 case CSS_PROP_OUTLINE_STYLE: 1075 if (style->outlineStyleIsAuto()) 1076 return new CSSPrimitiveValue(CSS_VAL_AUTO); 1077 return valueForBorderStyle(style->outlineStyle()); 1078 case CSS_PROP_OUTLINE_WIDTH: 1079 // FIXME: unimplemented 1080 break; 1081 case CSS_PROP_OVERFLOW: 1082 case CSS_PROP_OVERFLOW_X: 1083 case CSS_PROP_OVERFLOW_Y: { 1084 EOverflow overflow; 1085 switch (propertyID) { 1086 case CSS_PROP_OVERFLOW_X: 1087 overflow = style->overflowX(); 1088 break; 1089 case CSS_PROP_OVERFLOW_Y: 1090 overflow = style->overflowY(); 1091 break; 1092 default: 1093 overflow = max(style->overflowX(), style->overflowY()); 1094 } 1095 switch (overflow) { 1096 case OVISIBLE: 1097 return new CSSPrimitiveValue(CSS_VAL_VISIBLE); 1098 case OHIDDEN: 1099 return new CSSPrimitiveValue(CSS_VAL_HIDDEN); 1100 case OSCROLL: 1101 return new CSSPrimitiveValue(CSS_VAL_SCROLL); 1102 case OAUTO: 1103 return new CSSPrimitiveValue(CSS_VAL_AUTO); 1104 case OMARQUEE: 1105 return new CSSPrimitiveValue(CSS_VAL__WEBKIT_MARQUEE); 1106 case OOVERLAY: 1107 return new CSSPrimitiveValue(CSS_VAL_OVERLAY); 1108 } 1109 ASSERT_NOT_REACHED(); 1110 return 0; 957 1111 } 958 ASSERT_NOT_REACHED(); 959 return 0; 960 case CSS_PROP_LIST_STYLE_TYPE: 961 switch (style->listStyleType()) { 962 case LNONE: 1112 case CSS_PROP_PADDING_TOP: 1113 return new CSSPrimitiveValue(renderer->paddingTop(), CSSPrimitiveValue::CSS_PX); 1114 case CSS_PROP_PADDING_RIGHT: 1115 return new CSSPrimitiveValue(renderer->paddingRight(), CSSPrimitiveValue::CSS_PX); 1116 case CSS_PROP_PADDING_BOTTOM: 1117 return new CSSPrimitiveValue(renderer->paddingBottom(), CSSPrimitiveValue::CSS_PX); 1118 case CSS_PROP_PADDING_LEFT: 1119 return new CSSPrimitiveValue(renderer->paddingLeft(), CSSPrimitiveValue::CSS_PX); 1120 case CSS_PROP_PAGE: 1121 // FIXME: unimplemented 1122 break; 1123 case CSS_PROP_PAGE_BREAK_AFTER: 1124 switch (style->pageBreakAfter()) { 1125 case PBAUTO: 1126 return new CSSPrimitiveValue(CSS_VAL_AUTO); 1127 case PBALWAYS: 1128 return new CSSPrimitiveValue(CSS_VAL_ALWAYS); 1129 case PBAVOID: 1130 return new CSSPrimitiveValue(CSS_VAL_AVOID); 1131 } 1132 ASSERT_NOT_REACHED(); 1133 return 0; 1134 case CSS_PROP_PAGE_BREAK_BEFORE: 1135 switch (style->pageBreakBefore()) { 1136 case PBAUTO: 1137 return new CSSPrimitiveValue(CSS_VAL_AUTO); 1138 case PBALWAYS: 1139 return new CSSPrimitiveValue(CSS_VAL_ALWAYS); 1140 case PBAVOID: 1141 return new CSSPrimitiveValue(CSS_VAL_AVOID); 1142 } 1143 ASSERT_NOT_REACHED(); 1144 return 0; 1145 case CSS_PROP_PAGE_BREAK_INSIDE: 1146 switch (style->pageBreakInside()) { 1147 case PBAUTO: 1148 return new CSSPrimitiveValue(CSS_VAL_AUTO); 1149 case PBAVOID: 1150 return new CSSPrimitiveValue(CSS_VAL_AVOID); 1151 case PBALWAYS: 1152 break; // not allowed 1153 } 1154 ASSERT_NOT_REACHED(); 1155 return 0; 1156 case CSS_PROP_POSITION: 1157 switch (style->position()) { 1158 case StaticPosition: 1159 return new CSSPrimitiveValue(CSS_VAL_STATIC); 1160 case RelativePosition: 1161 return new CSSPrimitiveValue(CSS_VAL_RELATIVE); 1162 case AbsolutePosition: 1163 return new CSSPrimitiveValue(CSS_VAL_ABSOLUTE); 1164 case FixedPosition: 1165 return new CSSPrimitiveValue(CSS_VAL_FIXED); 1166 } 1167 ASSERT_NOT_REACHED(); 1168 return 0; 1169 case CSS_PROP_QUOTES: 1170 // FIXME: unimplemented 1171 break; 1172 case CSS_PROP_RIGHT: 1173 return getPositionOffsetValue(renderer, CSS_PROP_RIGHT); 1174 case CSS_PROP_SIZE: 1175 // FIXME: unimplemented 1176 break; 1177 case CSS_PROP_TABLE_LAYOUT: 1178 switch (style->tableLayout()) { 1179 case TAUTO: 1180 return new CSSPrimitiveValue(CSS_VAL_AUTO); 1181 case TFIXED: 1182 return new CSSPrimitiveValue(CSS_VAL_FIXED); 1183 } 1184 ASSERT_NOT_REACHED(); 1185 return 0; 1186 case CSS_PROP_TEXT_ALIGN: 1187 return valueForTextAlign(style->textAlign()); 1188 case CSS_PROP_TEXT_DECORATION: { 1189 String string; 1190 if (style->textDecoration() & UNDERLINE) 1191 string += "underline"; 1192 if (style->textDecoration() & OVERLINE) { 1193 if (string.length()) 1194 string += " "; 1195 string += "overline"; 1196 } 1197 if (style->textDecoration() & LINE_THROUGH) { 1198 if (string.length()) 1199 string += " "; 1200 string += "line-through"; 1201 } 1202 if (style->textDecoration() & BLINK) { 1203 if (string.length()) 1204 string += " "; 1205 string += "blink"; 1206 } 1207 if (!string.length()) 963 1208 return new CSSPrimitiveValue(CSS_VAL_NONE); 964 case DISC: 965 return new CSSPrimitiveValue(CSS_VAL_DISC); 966 case CIRCLE: 967 return new CSSPrimitiveValue(CSS_VAL_CIRCLE); 968 case SQUARE: 969 return new CSSPrimitiveValue(CSS_VAL_SQUARE); 970 case LDECIMAL: 971 return new CSSPrimitiveValue(CSS_VAL_DECIMAL); 972 case DECIMAL_LEADING_ZERO: 973 return new CSSPrimitiveValue(CSS_VAL_DECIMAL_LEADING_ZERO); 974 case LOWER_ROMAN: 975 return new CSSPrimitiveValue(CSS_VAL_LOWER_ROMAN); 976 case UPPER_ROMAN: 977 return new CSSPrimitiveValue(CSS_VAL_UPPER_ROMAN); 978 case LOWER_GREEK: 979 return new CSSPrimitiveValue(CSS_VAL_LOWER_GREEK); 980 case LOWER_ALPHA: 981 return new CSSPrimitiveValue(CSS_VAL_LOWER_ALPHA); 982 case LOWER_LATIN: 983 return new CSSPrimitiveValue(CSS_VAL_LOWER_LATIN); 984 case UPPER_ALPHA: 985 return new CSSPrimitiveValue(CSS_VAL_UPPER_ALPHA); 986 case UPPER_LATIN: 987 return new CSSPrimitiveValue(CSS_VAL_UPPER_LATIN); 988 case HEBREW: 989 return new CSSPrimitiveValue(CSS_VAL_HEBREW); 990 case ARMENIAN: 991 return new CSSPrimitiveValue(CSS_VAL_ARMENIAN); 992 case GEORGIAN: 993 return new CSSPrimitiveValue(CSS_VAL_GEORGIAN); 994 case CJK_IDEOGRAPHIC: 995 return new CSSPrimitiveValue(CSS_VAL_CJK_IDEOGRAPHIC); 996 case HIRAGANA: 997 return new CSSPrimitiveValue(CSS_VAL_HIRAGANA); 998 case KATAKANA: 999 return new CSSPrimitiveValue(CSS_VAL_KATAKANA); 1000 case HIRAGANA_IROHA: 1001 return new CSSPrimitiveValue(CSS_VAL_HIRAGANA_IROHA); 1002 case KATAKANA_IROHA: 1003 return new CSSPrimitiveValue(CSS_VAL_KATAKANA_IROHA); 1209 return new CSSPrimitiveValue(string, CSSPrimitiveValue::CSS_STRING); 1004 1210 } 1005 ASSERT_NOT_REACHED(); 1006 return 0; 1007 case CSS_PROP_MARGIN_TOP: 1008 // FIXME: Supposed to return the percentage if percentage was specified. 1009 return new CSSPrimitiveValue(renderer->marginTop(), CSSPrimitiveValue::CSS_PX); 1010 case CSS_PROP_MARGIN_RIGHT: 1011 // FIXME: Supposed to return the percentage if percentage was specified. 1012 return new CSSPrimitiveValue(renderer->marginRight(), CSSPrimitiveValue::CSS_PX); 1013 case CSS_PROP_MARGIN_BOTTOM: 1014 // FIXME: Supposed to return the percentage if percentage was specified. 1015 return new CSSPrimitiveValue(renderer->marginBottom(), CSSPrimitiveValue::CSS_PX); 1016 case CSS_PROP_MARGIN_LEFT: 1017 // FIXME: Supposed to return the percentage if percentage was specified. 1018 return new CSSPrimitiveValue(renderer->marginLeft(), CSSPrimitiveValue::CSS_PX); 1019 case CSS_PROP__WEBKIT_MARQUEE: 1020 // FIXME: unimplemented 1021 break; 1022 case CSS_PROP__WEBKIT_MARQUEE_DIRECTION: 1023 switch (style->marqueeDirection()) { 1024 case MFORWARD: 1025 return new CSSPrimitiveValue(CSS_VAL_FORWARDS); 1026 case MBACKWARD: 1027 return new CSSPrimitiveValue(CSS_VAL_BACKWARDS); 1028 case MAUTO: 1211 case CSS_PROP__WEBKIT_TEXT_DECORATIONS_IN_EFFECT: { 1212 String string; 1213 if (style->textDecorationsInEffect() & UNDERLINE) 1214 string += "underline"; 1215 if (style->textDecorationsInEffect() & OVERLINE) { 1216 if (string.length()) 1217 string += " "; 1218 string += "overline"; 1219 } 1220 if (style->textDecorationsInEffect() & LINE_THROUGH) { 1221 if (string.length()) 1222 string += " "; 1223 string += "line-through"; 1224 } 1225 if (style->textDecorationsInEffect() & BLINK) { 1226 if (string.length()) 1227 string += " "; 1228 string += "blink"; 1229 } 1230 if (!string.length()) 1231 return new CSSPrimitiveValue(CSS_VAL_NONE); 1232 return new CSSPrimitiveValue(string, CSSPrimitiveValue::CSS_STRING); 1233 } 1234 case CSS_PROP__WEBKIT_TEXT_FILL_COLOR: 1235 return currentColorOrValidColor(style, style->textFillColor()); 1236 case CSS_PROP_TEXT_INDENT: 1237 return valueForLength(style->textIndent()); 1238 case CSS_PROP_TEXT_SHADOW: 1239 return valueForShadow(style->textShadow()); 1240 case CSS_PROP__WEBKIT_TEXT_SECURITY: 1241 switch (style->textSecurity()) { 1242 case TSNONE: 1243 return new CSSPrimitiveValue(CSS_VAL_NONE); 1244 case TSDISC: 1245 return new CSSPrimitiveValue(CSS_VAL_DISC); 1246 case TSCIRCLE: 1247 return new CSSPrimitiveValue(CSS_VAL_CIRCLE); 1248 case TSSQUARE: 1249 return new CSSPrimitiveValue(CSS_VAL_SQUARE); 1250 } 1251 ASSERT_NOT_REACHED(); 1252 return 0; 1253 case CSS_PROP__WEBKIT_TEXT_SIZE_ADJUST: 1254 if (style->textSizeAdjust()) 1029 1255 return new CSSPrimitiveValue(CSS_VAL_AUTO); 1030 case MUP:1031 return new CSSPrimitiveValue(CSS_VAL_UP);1032 case MDOWN:1033 return new CSSPrimitiveValue(CSS_VAL_DOWN);1034 case MLEFT:1035 return new CSSPrimitiveValue(CSS_VAL_LEFT);1036 case MRIGHT:1037 return new CSSPrimitiveValue(CSS_VAL_RIGHT);1038 }1039 ASSERT_NOT_REACHED();1040 return 0;1041 case CSS_PROP__WEBKIT_MARQUEE_INCREMENT:1042 return valueForLength(style->marqueeIncrement());1043 case CSS_PROP__WEBKIT_MARQUEE_REPETITION:1044 if (style->marqueeLoopCount() < 0)1045 return new CSSPrimitiveValue(CSS_VAL_INFINITE);1046 return new CSSPrimitiveValue(style->marqueeLoopCount(), CSSPrimitiveValue::CSS_NUMBER);1047 case CSS_PROP__WEBKIT_MARQUEE_SPEED:1048 // FIXME: unimplemented1049 break;1050 case CSS_PROP__WEBKIT_MARQUEE_STYLE:1051 switch (style->marqueeBehavior()) {1052 case MNONE:1053 return new CSSPrimitiveValue(CSS_VAL_NONE);1054 case MSCROLL:1055 return new CSSPrimitiveValue(CSS_VAL_SCROLL);1056 case MSLIDE:1057 return new CSSPrimitiveValue(CSS_VAL_SLIDE);1058 case MALTERNATE:1059 return new CSSPrimitiveValue(CSS_VAL_ALTERNATE);1060 }1061 ASSERT_NOT_REACHED();1062 return 0;1063 case CSS_PROP__WEBKIT_USER_MODIFY:1064 switch (style->userModify()) {1065 case READ_ONLY:1066 return new CSSPrimitiveValue(CSS_VAL_READ_ONLY);1067 case READ_WRITE:1068 return new CSSPrimitiveValue(CSS_VAL_READ_WRITE);1069 case READ_WRITE_PLAINTEXT_ONLY:1070 return new CSSPrimitiveValue(CSS_VAL_READ_WRITE_PLAINTEXT_ONLY);1071 }1072 ASSERT_NOT_REACHED();1073 return 0;1074 case CSS_PROP_MAX_HEIGHT:1075 return valueForMaxLength(style->maxHeight());1076 case CSS_PROP_MAX_WIDTH:1077 return valueForMaxLength(style->maxWidth());1078 case CSS_PROP_MIN_HEIGHT:1079 return valueForLength(style->minHeight());1080 case CSS_PROP_MIN_WIDTH:1081 return valueForLength(style->minWidth());1082 case CSS_PROP_OPACITY:1083 return new CSSPrimitiveValue(style->opacity(), CSSPrimitiveValue::CSS_NUMBER);1084 case CSS_PROP_ORPHANS:1085 return new CSSPrimitiveValue(style->orphans(), CSSPrimitiveValue::CSS_NUMBER);1086 case CSS_PROP_OUTLINE_COLOR:1087 return currentColorOrValidColor(style, style->outlineColor());1088 case CSS_PROP_OUTLINE_OFFSET:1089 // FIXME: unimplemented1090 break;1091 case CSS_PROP_OUTLINE_STYLE:1092 if (style->outlineStyleIsAuto())1093 return new CSSPrimitiveValue(CSS_VAL_AUTO);1094 return valueForBorderStyle(style->outlineStyle());1095 case CSS_PROP_OUTLINE_WIDTH:1096 // FIXME: unimplemented1097 break;1098 case CSS_PROP_OVERFLOW:1099 case CSS_PROP_OVERFLOW_X:1100 case CSS_PROP_OVERFLOW_Y:1101 EOverflow overflow;1102 switch (propertyID) {1103 case CSS_PROP_OVERFLOW_X:1104 overflow = style->overflowX();1105 break;1106 case CSS_PROP_OVERFLOW_Y:1107 overflow = style->overflowY();1108 break;1109 default:1110 overflow = max(style->overflowX(), style->overflowY());1111 }1112 switch (overflow) {1113 case OVISIBLE:1114 return new CSSPrimitiveValue(CSS_VAL_VISIBLE);1115 case OHIDDEN:1116 return new CSSPrimitiveValue(CSS_VAL_HIDDEN);1117 case OSCROLL:1118 return new CSSPrimitiveValue(CSS_VAL_SCROLL);1119 case OAUTO:1120 return new CSSPrimitiveValue(CSS_VAL_AUTO);1121 case OMARQUEE:1122 return new CSSPrimitiveValue(CSS_VAL__WEBKIT_MARQUEE);1123 case OOVERLAY:1124 return new CSSPrimitiveValue(CSS_VAL_OVERLAY);1125 }1126 ASSERT_NOT_REACHED();1127 return 0;1128 case CSS_PROP_PADDING_TOP:1129 return new CSSPrimitiveValue(renderer->paddingTop(), CSSPrimitiveValue::CSS_PX);1130 case CSS_PROP_PADDING_RIGHT:1131 return new CSSPrimitiveValue(renderer->paddingRight(), CSSPrimitiveValue::CSS_PX);1132 case CSS_PROP_PADDING_BOTTOM:1133 return new CSSPrimitiveValue(renderer->paddingBottom(), CSSPrimitiveValue::CSS_PX);1134 case CSS_PROP_PADDING_LEFT:1135 return new CSSPrimitiveValue(renderer->paddingLeft(), CSSPrimitiveValue::CSS_PX);1136 case CSS_PROP_PAGE:1137 // FIXME: unimplemented1138 break;1139 case CSS_PROP_PAGE_BREAK_AFTER:1140 switch (style->pageBreakAfter()) {1141 case PBAUTO:1142 return new CSSPrimitiveValue(CSS_VAL_AUTO);1143 case PBALWAYS:1144 return new CSSPrimitiveValue(CSS_VAL_ALWAYS);1145 case PBAVOID:1146 return new CSSPrimitiveValue(CSS_VAL_AVOID);1147 }1148 ASSERT_NOT_REACHED();1149 return 0;1150 case CSS_PROP_PAGE_BREAK_BEFORE:1151 switch (style->pageBreakBefore()) {1152 case PBAUTO:1153 return new CSSPrimitiveValue(CSS_VAL_AUTO);1154 case PBALWAYS:1155 return new CSSPrimitiveValue(CSS_VAL_ALWAYS);1156 case PBAVOID:1157 return new CSSPrimitiveValue(CSS_VAL_AVOID);1158 }1159 ASSERT_NOT_REACHED();1160 return 0;1161 case CSS_PROP_PAGE_BREAK_INSIDE:1162 switch (style->pageBreakInside()) {1163 case PBAUTO:1164 return new CSSPrimitiveValue(CSS_VAL_AUTO);1165 case PBAVOID:1166 return new CSSPrimitiveValue(CSS_VAL_AVOID);1167 case PBALWAYS:1168 break; // not allowed1169 }1170 ASSERT_NOT_REACHED();1171 return 0;1172 case CSS_PROP_POSITION:1173 switch (style->position()) {1174 case StaticPosition:1175 return new CSSPrimitiveValue(CSS_VAL_STATIC);1176 case RelativePosition:1177 return new CSSPrimitiveValue(CSS_VAL_RELATIVE);1178 case AbsolutePosition:1179 return new CSSPrimitiveValue(CSS_VAL_ABSOLUTE);1180 case FixedPosition:1181 return new CSSPrimitiveValue(CSS_VAL_FIXED);1182 }1183 ASSERT_NOT_REACHED();1184 return 0;1185 case CSS_PROP_QUOTES:1186 // FIXME: unimplemented1187 break;1188 case CSS_PROP_RIGHT:1189 return getPositionOffsetValue(renderer, CSS_PROP_RIGHT);1190 case CSS_PROP_SIZE:1191 // FIXME: unimplemented1192 break;1193 case CSS_PROP_TABLE_LAYOUT:1194 switch (style->tableLayout()) {1195 case TAUTO:1196 return new CSSPrimitiveValue(CSS_VAL_AUTO);1197 case TFIXED:1198 return new CSSPrimitiveValue(CSS_VAL_FIXED);1199 }1200 ASSERT_NOT_REACHED();1201 return 0;1202 case CSS_PROP_TEXT_ALIGN:1203 return valueForTextAlign(style->textAlign());1204 case CSS_PROP_TEXT_DECORATION:1205 {1206 String string;1207 if (style->textDecoration() & UNDERLINE)1208 string += "underline";1209 if (style->textDecoration() & OVERLINE) {1210 if (string.length() > 0)1211 string += " ";1212 string += "overline";1213 }1214 if (style->textDecoration() & LINE_THROUGH) {1215 if (string.length() > 0)1216 string += " ";1217 string += "line-through";1218 }1219 if (style->textDecoration() & BLINK) {1220 if (string.length() > 0)1221 string += " ";1222 string += "blink";1223 }1224 if (string.length() == 0)1225 1256 return new CSSPrimitiveValue(CSS_VAL_NONE); 1226 return new CSSPrimitiveValue(string, CSSPrimitiveValue::CSS_STRING); 1227 } 1228 case CSS_PROP__WEBKIT_TEXT_DECORATIONS_IN_EFFECT: 1229 { 1230 String string; 1231 if (style->textDecorationsInEffect() & UNDERLINE) 1232 string += "underline"; 1233 if (style->textDecorationsInEffect() & OVERLINE) { 1234 if (string.length() > 0) 1235 string += " "; 1236 string += "overline"; 1237 } 1238 if (style->textDecorationsInEffect() & LINE_THROUGH) { 1239 if (string.length() > 0) 1240 string += " "; 1241 string += "line-through"; 1242 } 1243 if (style->textDecorationsInEffect() & BLINK) { 1244 if (string.length() > 0) 1245 string += " "; 1246 string += "blink"; 1247 } 1248 if (string.length() == 0) 1249 return new CSSPrimitiveValue(CSS_VAL_NONE); 1250 return new CSSPrimitiveValue(string, CSSPrimitiveValue::CSS_STRING); 1251 } 1252 case CSS_PROP__WEBKIT_TEXT_FILL_COLOR: 1253 return currentColorOrValidColor(style, style->textFillColor()); 1254 case CSS_PROP_TEXT_INDENT: 1255 return valueForLength(style->textIndent()); 1256 case CSS_PROP_TEXT_SHADOW: 1257 return valueForShadow(style->textShadow()); 1258 case CSS_PROP__WEBKIT_TEXT_SECURITY: 1259 { 1260 switch (style->textSecurity()) { 1261 case TSNONE: 1262 return new CSSPrimitiveValue(CSS_VAL_NONE); 1263 case TSDISC: 1264 return new CSSPrimitiveValue(CSS_VAL_DISC); 1265 case TSCIRCLE: 1266 return new CSSPrimitiveValue(CSS_VAL_CIRCLE); 1267 case TSSQUARE: 1268 return new CSSPrimitiveValue(CSS_VAL_SQUARE); 1269 } 1270 ASSERT_NOT_REACHED(); 1271 return 0; 1272 } 1273 case CSS_PROP__WEBKIT_TEXT_SIZE_ADJUST: 1274 if (style->textSizeAdjust()) 1275 return new CSSPrimitiveValue(CSS_VAL_AUTO); 1276 else 1277 return new CSSPrimitiveValue(CSS_VAL_NONE); 1278 case CSS_PROP__WEBKIT_TEXT_STROKE_COLOR: 1279 return currentColorOrValidColor(style, style->textStrokeColor()); 1280 case CSS_PROP__WEBKIT_TEXT_STROKE_WIDTH: 1281 return new CSSPrimitiveValue(style->textStrokeWidth(), CSSPrimitiveValue::CSS_NUMBER); 1282 case CSS_PROP_TEXT_TRANSFORM: 1283 switch (style->textTransform()) { 1284 case CAPITALIZE: 1285 return new CSSPrimitiveValue(CSS_VAL_CAPITALIZE); 1286 case UPPERCASE: 1287 return new CSSPrimitiveValue(CSS_VAL_UPPERCASE); 1288 case LOWERCASE: 1289 return new CSSPrimitiveValue(CSS_VAL_LOWERCASE); 1290 case TTNONE: 1291 return new CSSPrimitiveValue(CSS_VAL_NONE); 1292 } 1293 ASSERT_NOT_REACHED(); 1294 return 0; 1295 case CSS_PROP_TOP: 1296 return getPositionOffsetValue(renderer, CSS_PROP_TOP); 1297 case CSS_PROP_UNICODE_BIDI: 1298 switch (style->unicodeBidi()) { 1299 case UBNormal: 1257 case CSS_PROP__WEBKIT_TEXT_STROKE_COLOR: 1258 return currentColorOrValidColor(style, style->textStrokeColor()); 1259 case CSS_PROP__WEBKIT_TEXT_STROKE_WIDTH: 1260 return new CSSPrimitiveValue(style->textStrokeWidth(), CSSPrimitiveValue::CSS_NUMBER); 1261 case CSS_PROP_TEXT_TRANSFORM: 1262 switch (style->textTransform()) { 1263 case CAPITALIZE: 1264 return new CSSPrimitiveValue(CSS_VAL_CAPITALIZE); 1265 case UPPERCASE: 1266 return new CSSPrimitiveValue(CSS_VAL_UPPERCASE); 1267 case LOWERCASE: 1268 return new CSSPrimitiveValue(CSS_VAL_LOWERCASE); 1269 case TTNONE: 1270 return new CSSPrimitiveValue(CSS_VAL_NONE); 1271 } 1272 ASSERT_NOT_REACHED(); 1273 return 0; 1274 case CSS_PROP_TOP: 1275 return getPositionOffsetValue(renderer, CSS_PROP_TOP); 1276 case CSS_PROP_UNICODE_BIDI: 1277 switch (style->unicodeBidi()) { 1278 case UBNormal: 1279 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 1280 case Embed: 1281 return new CSSPrimitiveValue(CSS_VAL_EMBED); 1282 case Override: 1283 return new CSSPrimitiveValue(CSS_VAL_BIDI_OVERRIDE); 1284 } 1285 ASSERT_NOT_REACHED(); 1286 return 0; 1287 case CSS_PROP_VERTICAL_ALIGN: 1288 switch (style->verticalAlign()) { 1289 case BASELINE: 1290 return new CSSPrimitiveValue(CSS_VAL_BASELINE); 1291 case MIDDLE: 1292 return new CSSPrimitiveValue(CSS_VAL_MIDDLE); 1293 case SUB: 1294 return new CSSPrimitiveValue(CSS_VAL_SUB); 1295 case SUPER: 1296 return new CSSPrimitiveValue(CSS_VAL_SUPER); 1297 case TEXT_TOP: 1298 return new CSSPrimitiveValue(CSS_VAL_TEXT_TOP); 1299 case TEXT_BOTTOM: 1300 return new CSSPrimitiveValue(CSS_VAL_TEXT_BOTTOM); 1301 case TOP: 1302 return new CSSPrimitiveValue(CSS_VAL_TOP); 1303 case BOTTOM: 1304 return new CSSPrimitiveValue(CSS_VAL_BOTTOM); 1305 case BASELINE_MIDDLE: 1306 return new CSSPrimitiveValue(CSS_VAL__WEBKIT_BASELINE_MIDDLE); 1307 case LENGTH: 1308 return valueForLength(style->verticalAlignLength()); 1309 } 1310 ASSERT_NOT_REACHED(); 1311 return 0; 1312 case CSS_PROP_VISIBILITY: 1313 switch (style->visibility()) { 1314 case VISIBLE: 1315 return new CSSPrimitiveValue(CSS_VAL_VISIBLE); 1316 case HIDDEN: 1317 return new CSSPrimitiveValue(CSS_VAL_HIDDEN); 1318 case COLLAPSE: 1319 return new CSSPrimitiveValue(CSS_VAL_COLLAPSE); 1320 } 1321 ASSERT_NOT_REACHED(); 1322 return 0; 1323 case CSS_PROP_WHITE_SPACE: 1324 switch (style->whiteSpace()) { 1325 case NORMAL: 1326 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 1327 case PRE: 1328 return new CSSPrimitiveValue(CSS_VAL_PRE); 1329 case PRE_WRAP: 1330 return new CSSPrimitiveValue(CSS_VAL_PRE_WRAP); 1331 case PRE_LINE: 1332 return new CSSPrimitiveValue(CSS_VAL_PRE_LINE); 1333 case NOWRAP: 1334 return new CSSPrimitiveValue(CSS_VAL_NOWRAP); 1335 case KHTML_NOWRAP: 1336 return new CSSPrimitiveValue(CSS_VAL__WEBKIT_NOWRAP); 1337 } 1338 ASSERT_NOT_REACHED(); 1339 return 0; 1340 case CSS_PROP_WIDOWS: 1341 return new CSSPrimitiveValue(style->widows(), CSSPrimitiveValue::CSS_NUMBER); 1342 case CSS_PROP_WIDTH: 1343 return new CSSPrimitiveValue(renderer->contentWidth(), CSSPrimitiveValue::CSS_PX); 1344 case CSS_PROP_WORD_SPACING: 1345 return new CSSPrimitiveValue(style->wordSpacing(), CSSPrimitiveValue::CSS_PX); 1346 case CSS_PROP_WORD_WRAP: 1347 switch (style->wordWrap()) { 1348 case WBNORMAL: 1349 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 1350 case BREAK_WORD: 1351 return new CSSPrimitiveValue(CSS_VAL_BREAK_WORD); 1352 } 1353 ASSERT_NOT_REACHED(); 1354 return 0; 1355 case CSS_PROP__WEBKIT_LINE_BREAK: 1356 switch (style->khtmlLineBreak()) { 1357 case LBNORMAL: 1358 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 1359 case AFTER_WHITE_SPACE: 1360 return new CSSPrimitiveValue(CSS_VAL_AFTER_WHITE_SPACE); 1361 } 1362 ASSERT_NOT_REACHED(); 1363 return 0; 1364 case CSS_PROP__WEBKIT_NBSP_MODE: 1365 switch (style->nbspMode()) { 1366 case NBNORMAL: 1367 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 1368 case SPACE: 1369 return new CSSPrimitiveValue(CSS_VAL_SPACE); 1370 } 1371 ASSERT_NOT_REACHED(); 1372 return 0; 1373 case CSS_PROP__WEBKIT_MATCH_NEAREST_MAIL_BLOCKQUOTE_COLOR: 1374 switch (style->matchNearestMailBlockquoteColor()) { 1375 case BCNORMAL: 1376 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 1377 case MATCH: 1378 return new CSSPrimitiveValue(CSS_VAL_MATCH); 1379 } 1380 ASSERT_NOT_REACHED(); 1381 return 0; 1382 case CSS_PROP_RESIZE: 1383 switch (style->resize()) { 1384 case RESIZE_BOTH: 1385 return new CSSPrimitiveValue(CSS_VAL_BOTH); 1386 case RESIZE_HORIZONTAL: 1387 return new CSSPrimitiveValue(CSS_VAL_HORIZONTAL); 1388 case RESIZE_VERTICAL: 1389 return new CSSPrimitiveValue(CSS_VAL_VERTICAL); 1390 case RESIZE_NONE: 1391 return new CSSPrimitiveValue(CSS_VAL_NONE); 1392 } 1393 ASSERT_NOT_REACHED(); 1394 return 0; 1395 case CSS_PROP_Z_INDEX: 1396 if (style->hasAutoZIndex()) 1300 1397 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 1301 case Embed: 1302 return new CSSPrimitiveValue(CSS_VAL_EMBED); 1303 case Override: 1304 return new CSSPrimitiveValue(CSS_VAL_BIDI_OVERRIDE); 1305 } 1306 ASSERT_NOT_REACHED(); 1307 return 0; 1308 case CSS_PROP_VERTICAL_ALIGN: 1309 switch (style->verticalAlign()) { 1310 case BASELINE: 1311 return new CSSPrimitiveValue(CSS_VAL_BASELINE); 1312 case MIDDLE: 1313 return new CSSPrimitiveValue(CSS_VAL_MIDDLE); 1314 case SUB: 1315 return new CSSPrimitiveValue(CSS_VAL_SUB); 1316 case SUPER: 1317 return new CSSPrimitiveValue(CSS_VAL_SUPER); 1318 case TEXT_TOP: 1319 return new CSSPrimitiveValue(CSS_VAL_TEXT_TOP); 1320 case TEXT_BOTTOM: 1321 return new CSSPrimitiveValue(CSS_VAL_TEXT_BOTTOM); 1322 case TOP: 1323 return new CSSPrimitiveValue(CSS_VAL_TOP); 1324 case BOTTOM: 1325 return new CSSPrimitiveValue(CSS_VAL_BOTTOM); 1326 case BASELINE_MIDDLE: 1327 return new CSSPrimitiveValue(CSS_VAL__WEBKIT_BASELINE_MIDDLE); 1328 case LENGTH: 1329 return valueForLength(style->verticalAlignLength()); 1330 } 1331 ASSERT_NOT_REACHED(); 1332 return 0; 1333 case CSS_PROP_VISIBILITY: 1334 switch (style->visibility()) { 1335 case VISIBLE: 1336 return new CSSPrimitiveValue(CSS_VAL_VISIBLE); 1337 case HIDDEN: 1338 return new CSSPrimitiveValue(CSS_VAL_HIDDEN); 1339 case COLLAPSE: 1340 return new CSSPrimitiveValue(CSS_VAL_COLLAPSE); 1341 } 1342 ASSERT_NOT_REACHED(); 1343 return 0; 1344 case CSS_PROP_WHITE_SPACE: 1345 switch (style->whiteSpace()) { 1346 case NORMAL: 1347 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 1348 case PRE: 1349 return new CSSPrimitiveValue(CSS_VAL_PRE); 1350 case PRE_WRAP: 1351 return new CSSPrimitiveValue(CSS_VAL_PRE_WRAP); 1352 case PRE_LINE: 1353 return new CSSPrimitiveValue(CSS_VAL_PRE_LINE); 1354 case NOWRAP: 1355 return new CSSPrimitiveValue(CSS_VAL_NOWRAP); 1356 case KHTML_NOWRAP: 1357 return new CSSPrimitiveValue(CSS_VAL__WEBKIT_NOWRAP); 1358 } 1359 ASSERT_NOT_REACHED(); 1360 return 0; 1361 case CSS_PROP_WIDOWS: 1362 return new CSSPrimitiveValue(style->widows(), CSSPrimitiveValue::CSS_NUMBER); 1363 case CSS_PROP_WIDTH: 1364 return new CSSPrimitiveValue(renderer->contentWidth(), CSSPrimitiveValue::CSS_PX); 1365 case CSS_PROP_WORD_SPACING: 1366 return new CSSPrimitiveValue(style->wordSpacing(), CSSPrimitiveValue::CSS_PX); 1367 case CSS_PROP_WORD_WRAP: 1368 switch (style->wordWrap()) { 1369 case WBNORMAL: 1370 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 1371 case BREAK_WORD: 1372 return new CSSPrimitiveValue(CSS_VAL_BREAK_WORD); 1373 } 1374 ASSERT_NOT_REACHED(); 1375 return 0; 1376 case CSS_PROP__WEBKIT_LINE_BREAK: 1377 switch (style->khtmlLineBreak()) { 1378 case LBNORMAL: 1379 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 1380 case AFTER_WHITE_SPACE: 1381 return new CSSPrimitiveValue(CSS_VAL_AFTER_WHITE_SPACE); 1382 } 1383 ASSERT_NOT_REACHED(); 1384 return 0; 1385 case CSS_PROP__WEBKIT_NBSP_MODE: 1386 switch (style->nbspMode()) { 1387 case NBNORMAL: 1388 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 1389 case SPACE: 1390 return new CSSPrimitiveValue(CSS_VAL_SPACE); 1391 } 1392 ASSERT_NOT_REACHED(); 1393 return 0; 1394 case CSS_PROP__WEBKIT_MATCH_NEAREST_MAIL_BLOCKQUOTE_COLOR: 1395 switch (style->matchNearestMailBlockquoteColor()) { 1396 case BCNORMAL: 1397 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 1398 case MATCH: 1399 return new CSSPrimitiveValue(CSS_VAL_MATCH); 1400 } 1401 ASSERT_NOT_REACHED(); 1402 return 0; 1403 case CSS_PROP_RESIZE: 1404 switch (style->resize()) { 1405 case RESIZE_BOTH: 1406 return new CSSPrimitiveValue(CSS_VAL_BOTH); 1407 case RESIZE_HORIZONTAL: 1408 return new CSSPrimitiveValue(CSS_VAL_HORIZONTAL); 1409 case RESIZE_VERTICAL: 1410 return new CSSPrimitiveValue(CSS_VAL_VERTICAL); 1411 case RESIZE_NONE: 1412 default: 1413 return new CSSPrimitiveValue(CSS_VAL_NONE); 1414 } 1415 case CSS_PROP_Z_INDEX: 1416 if (style->hasAutoZIndex()) 1417 return new CSSPrimitiveValue(CSS_VAL_NORMAL); 1418 return new CSSPrimitiveValue(style->zIndex(), CSSPrimitiveValue::CSS_NUMBER); 1419 case CSS_PROP_BACKGROUND: 1420 // FIXME: unimplemented 1421 break; 1422 case CSS_PROP_BORDER: 1423 // FIXME: unimplemented 1424 break; 1425 case CSS_PROP_BORDER_COLOR: 1426 // FIXME: unimplemented 1427 break; 1428 case CSS_PROP_BORDER_STYLE: 1429 // FIXME: unimplemented 1430 break; 1431 case CSS_PROP_BORDER_TOP: 1432 // FIXME: unimplemented 1433 break; 1434 case CSS_PROP_BORDER_RIGHT: 1435 // FIXME: unimplemented 1436 break; 1437 case CSS_PROP_BORDER_BOTTOM: 1438 // FIXME: unimplemented 1439 break; 1440 case CSS_PROP_BORDER_LEFT: 1441 // FIXME: unimplemented 1442 break; 1443 case CSS_PROP_BORDER_WIDTH: 1444 // FIXME: unimplemented 1445 break; 1446 case CSS_PROP_FONT: 1447 // FIXME: unimplemented 1448 break; 1449 case CSS_PROP_LIST_STYLE: 1450 // FIXME: unimplemented 1451 break; 1452 case CSS_PROP_MARGIN: 1453 // FIXME: unimplemented 1454 break; 1455 case CSS_PROP_OUTLINE: 1456 // FIXME: unimplemented 1457 break; 1458 case CSS_PROP_PADDING: 1459 // FIXME: unimplemented 1460 break; 1398 return new CSSPrimitiveValue(style->zIndex(), CSSPrimitiveValue::CSS_NUMBER); 1399 case CSS_PROP_BACKGROUND: 1400 // FIXME: unimplemented 1401 break; 1402 case CSS_PROP_BORDER: 1403 // FIXME: unimplemented 1404 break; 1405 case CSS_PROP_BORDER_COLOR: 1406 // FIXME: unimplemented 1407 break; 1408 case CSS_PROP_BORDER_STYLE: 1409 // FIXME: unimplemented 1410 break; 1411 case CSS_PROP_BORDER_TOP: 1412 // FIXME: unimplemented 1413 break; 1414 case CSS_PROP_BORDER_RIGHT: 1415 // FIXME: unimplemented 1416 break; 1417 case CSS_PROP_BORDER_BOTTOM: 1418 // FIXME: unimplemented 1419 break; 1420 case CSS_PROP_BORDER_LEFT: 1421 // FIXME: unimplemented 1422 break; 1423 case CSS_PROP_BORDER_WIDTH: 1424 // FIXME: unimplemented 1425 break; 1426 case CSS_PROP_FONT: 1427 // FIXME: unimplemented 1428 break; 1429 case CSS_PROP_LIST_STYLE: 1430 // FIXME: unimplemented 1431 break; 1432 case CSS_PROP_MARGIN: 1433 // FIXME: unimplemented 1434 break; 1435 case CSS_PROP_OUTLINE: 1436 // FIXME: unimplemented 1437 break; 1438 case CSS_PROP_PADDING: 1439 // FIXME: unimplemented 1440 break; 1461 1441 #if PLATFORM(MAC) 1462 1442 case CSS_PROP__WEBKIT_DASHBOARD_REGION: { … … 1465 1445 if (count == 1 && regions[0].type == StyleDashboardRegion::None) 1466 1446 return new CSSPrimitiveValue(CSS_VAL_NONE); 1467 1447 1468 1448 RefPtr<DashboardRegion> firstRegion; 1469 1449 DashboardRegion* previousRegion = 0; … … 1478 1458 region->setBottom(new CSSPrimitiveValue(offset.bottom.value(), CSSPrimitiveValue::CSS_PX)); 1479 1459 region->setLeft(new CSSPrimitiveValue(offset.left.value(), CSSPrimitiveValue::CSS_PX)); 1480 region->m_isRectangle = (styleRegion.type == StyleDashboardRegion::Rectangle); 1460 region->m_isRectangle = (styleRegion.type == StyleDashboardRegion::Rectangle); 1481 1461 region->m_isCircle = (styleRegion.type == StyleDashboardRegion::Circle); 1482 1462 … … 1504 1484 } 1505 1485 1506 bool CSSComputedStyleDeclaration::getPropertyPriority(int ) const1486 bool CSSComputedStyleDeclaration::getPropertyPriority(int /*propertyID*/) const 1507 1487 { 1508 1488 // All computed styles have a priority of false (not "important"). … … 1510 1490 } 1511 1491 1512 String CSSComputedStyleDeclaration::removeProperty(int , ExceptionCode& ec)1492 String CSSComputedStyleDeclaration::removeProperty(int /*propertyID*/, ExceptionCode& ec) 1513 1493 { 1514 1494 ec = NO_MODIFICATION_ALLOWED_ERR; … … 1516 1496 } 1517 1497 1518 void CSSComputedStyleDeclaration::setProperty(int , const String&, bool, ExceptionCode& ec)1498 void CSSComputedStyleDeclaration::setProperty(int /*propertyID*/, const String& /*value*/, bool /*important*/, ExceptionCode& ec) 1519 1499 { 1520 1500 ec = NO_MODIFICATION_ALLOWED_ERR; … … 1526 1506 if (!node) 1527 1507 return 0; 1508 1528 1509 RenderObject* renderer = node->renderer(); 1529 1510 if (!renderer) 1530 1511 return 0; 1512 1531 1513 RenderStyle* style = renderer->style(); 1532 1514 if (!style) 1533 1515 return 0; 1516 1534 1517 return numComputedProperties; 1535 1518 } … … 1539 1522 if (i >= length()) 1540 1523 return String(); 1541 1524 1542 1525 return getPropertyName(computedProperties[i]); 1543 1526 } -
trunk/WebCore/css/CSSComputedStyleDeclaration.h
r18676 r18850 1 1 /** 2 * CSSComputedStyleDeclaration.h3 2 * 4 3 * Copyright (C) 2004 Zack Rusin <zack@kde.org> … … 21 20 */ 22 21 23 #ifndef CSS _COMPUTEDSTYLE_H24 #define CSS _COMPUTEDSTYLE_H22 #ifndef CSSComputedStyleDeclaration_h 23 #define CSSComputedStyleDeclaration_h 25 24 26 25 #include "CSSStyleDeclaration.h" … … 63 62 private: 64 63 virtual void setCssText(const String&, ExceptionCode&); 64 65 65 virtual String removeProperty(int propertyID, ExceptionCode&); 66 66 virtual void setProperty(int propertyId, const String& value, bool important, ExceptionCode&); … … 69 69 }; 70 70 71 } 71 } // namespace WebCore 72 72 73 #endif 73 #endif // CSSComputedStyleDeclaration_h -
trunk/WebCore/css/CSSCursorImageValue.cpp
r16549 r18850 19 19 * Boston, MA 02111-1307, USA. 20 20 */ 21 21 22 #include "config.h" 22 23 #include "CSSCursorImageValue.h" … … 24 25 namespace WebCore { 25 26 26 CSSCursorImageValue::CSSCursorImageValue(const String& url, const IntPoint& p, StyleBase* style)27 CSSCursorImageValue::CSSCursorImageValue(const String& url, const IntPoint& hotspot, StyleBase* style) 27 28 : CSSImageValue(url, style) 28 , m_hotspot( p)29 , m_hotspot(hotspot) 29 30 { 30 31 } … … 33 34 { 34 35 } 35 } 36 37 } // namespace WebCore -
trunk/WebCore/css/CSSCursorImageValue.h
r16549 r18850 20 20 */ 21 21 22 #ifndef CSSCursorImageValue_ H23 #define CSSCursorImageValue_ H22 #ifndef CSSCursorImageValue_h 23 #define CSSCursorImageValue_h 24 24 25 #include "CSSImageValue.h" 25 26 #include "IntPoint.h" 26 #include "CSSImageValue.h"27 27 28 28 namespace WebCore { 29 29 30 class CSSCursorImageValue : public CSSImageValue 31 { 30 class CSSCursorImageValue : public CSSImageValue { 32 31 public: 33 CSSCursorImageValue(const String& url, const IntPoint& , StyleBase*);32 CSSCursorImageValue(const String& url, const IntPoint& hotspot, StyleBase*); 34 33 virtual ~CSSCursorImageValue(); 35 34 … … 39 38 IntPoint m_hotspot; 40 39 }; 41 } // namespace42 40 43 #endif 41 } // namespace WebCore 42 43 #endif // CSSCursorImageValue_h -
trunk/WebCore/css/CSSGrammar.y
r17730 r18850 6 6 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 7 7 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * 8 * 9 9 * This library is free software; you can redistribute it and/or 10 10 * modify it under the terms of the GNU Lesser General Public … … 76 76 tagStr = prop.ascii(); 77 77 } 78 78 79 79 // Honor the use of old-style opacity (for Safari 1.1). 80 80 if (prop == "-webkit-opacity") { … … 92 92 } 93 93 94 } 94 } // namespace WebCore 95 95 96 96 static inline int getValueID(const char* tagStr, int len) … … 110 110 } 111 111 112 const struct css_value *val = findValue(tagStr, len);112 const struct css_value* val = findValue(tagStr, len); 113 113 if (!val) 114 114 return 0; … … 153 153 %{ 154 154 155 static inline int cssyyerror(const char 156 static int cssyylex(YYSTYPE *yylval) { return CSSParser::current()->lex(yylval); }155 static inline int cssyyerror(const char*) { return 1; } 156 static int cssyylex(YYSTYPE* yylval) { return CSSParser::current()->lex(yylval); } 157 157 158 158 %} … … 318 318 webkit_value: 319 319 WEBKIT_VALUE_SYM '{' maybe_space expr '}' { 320 CSSParser *p = static_cast<CSSParser*>(parser);320 CSSParser* p = static_cast<CSSParser*>(parser); 321 321 if ($4) { 322 322 p->valueList = p->sinkFloatingValueList($4); … … 357 357 CHARSET_SYM maybe_space STRING maybe_space ';' { 358 358 CSSParser* p = static_cast<CSSParser*>(parser); 359 $$ = static_cast<CSSParser 359 $$ = static_cast<CSSParser*>(parser)->createCharsetRule($3); 360 360 if ($$ && p->styleElement && p->styleElement->isCSSStyleSheet()) 361 361 p->styleElement->append($$); … … 402 402 import: 403 403 IMPORT_SYM maybe_space string_or_uri maybe_space maybe_media_list ';' { 404 $$ = static_cast<CSSParser 404 $$ = static_cast<CSSParser*>(parser)->createImportRule($3, $5); 405 405 } 406 406 | IMPORT_SYM error invalid_block { … … 414 414 namespace: 415 415 NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space ';' { 416 CSSParser *p = static_cast<CSSParser*>(parser);416 CSSParser* p = static_cast<CSSParser*>(parser); 417 417 if (p->styleElement && p->styleElement->isCSSStyleSheet()) 418 418 static_cast<CSSStyleSheet*>(p->styleElement)->addNamespace(p, atomicString($3), atomicString($4)); … … 604 604 $$ = $1; 605 605 $$->append(p->sinkFloatingSelector($4)); 606 } else {606 } else 607 607 $$ = 0; 608 }609 608 } 610 609 | selector_list error { … … 619 618 | selector combinator simple_selector { 620 619 $$ = $3; 621 if (!$1) {620 if (!$1) 622 621 $$ = 0; 623 }624 622 else if ($$) { 625 623 CSSParser* p = static_cast<CSSParser*>(parser); 626 624 CSSSelector* end = $$; 627 while (end-> tagHistory)628 end = end-> tagHistory;625 while (end->m_tagHistory) 626 end = end->m_tagHistory; 629 627 end->m_relation = $2; 630 end-> tagHistory = p->sinkFloatingSelector($1);628 end->m_tagHistory = p->sinkFloatingSelector($1); 631 629 if ($2 == CSSSelector::Descendant || $2 == CSSSelector::Child) { 632 630 if (Document* doc = p->document()) … … 651 649 simple_selector: 652 650 element_name maybe_space { 653 CSSParser *p = static_cast<CSSParser*>(parser);651 CSSParser* p = static_cast<CSSParser*>(parser); 654 652 $$ = p->createFloatingSelector(); 655 $$-> tag = QualifiedName(nullAtom, atomicString($1), p->defaultNamespace);653 $$->m_tag = QualifiedName(nullAtom, atomicString($1), p->defaultNamespace); 656 654 } 657 655 | element_name specifier_list maybe_space { 658 656 $$ = $2; 659 657 if ($$) { 660 CSSParser *p = static_cast<CSSParser*>(parser);661 $$-> tag = QualifiedName(nullAtom, atomicString($1), p->defaultNamespace);658 CSSParser* p = static_cast<CSSParser*>(parser); 659 $$->m_tag = QualifiedName(nullAtom, atomicString($1), p->defaultNamespace); 662 660 } 663 661 } 664 662 | specifier_list maybe_space { 665 663 $$ = $1; 666 CSSParser *p = static_cast<CSSParser*>(parser);664 CSSParser* p = static_cast<CSSParser*>(parser); 667 665 if ($$ && p->defaultNamespace != starAtom) 668 $$-> tag = QualifiedName(nullAtom, starAtom, p->defaultNamespace);666 $$->m_tag = QualifiedName(nullAtom, starAtom, p->defaultNamespace); 669 667 } 670 668 | namespace_selector element_name maybe_space { 671 669 AtomicString namespacePrefix = atomicString($1); 672 CSSParser *p = static_cast<CSSParser*>(parser);670 CSSParser* p = static_cast<CSSParser*>(parser); 673 671 $$ = p->createFloatingSelector(); 674 672 if (p->styleElement && p->styleElement->isCSSStyleSheet()) 675 $$-> tag = QualifiedName(namespacePrefix,673 $$->m_tag = QualifiedName(namespacePrefix, 676 674 atomicString($2), 677 675 static_cast<CSSStyleSheet*>(p->styleElement)->determineNamespace(namespacePrefix)); 678 676 else // FIXME: Shouldn't this case be an error? 679 $$-> tag = QualifiedName(nullAtom, atomicString($2), p->defaultNamespace);677 $$->m_tag = QualifiedName(nullAtom, atomicString($2), p->defaultNamespace); 680 678 } 681 679 | namespace_selector element_name specifier_list maybe_space { … … 683 681 if ($$) { 684 682 AtomicString namespacePrefix = atomicString($1); 685 CSSParser *p = static_cast<CSSParser*>(parser);683 CSSParser* p = static_cast<CSSParser*>(parser); 686 684 if (p->styleElement && p->styleElement->isCSSStyleSheet()) 687 $$-> tag = QualifiedName(namespacePrefix,688 atomicString($2),689 static_cast<CSSStyleSheet*>(p->styleElement)->determineNamespace(namespacePrefix));685 $$->m_tag = QualifiedName(namespacePrefix, 686 atomicString($2), 687 static_cast<CSSStyleSheet*>(p->styleElement)->determineNamespace(namespacePrefix)); 690 688 else // FIXME: Shouldn't this case be an error? 691 $$-> tag = QualifiedName(nullAtom, atomicString($2), p->defaultNamespace);689 $$->m_tag = QualifiedName(nullAtom, atomicString($2), p->defaultNamespace); 692 690 } 693 691 } … … 696 694 if ($$) { 697 695 AtomicString namespacePrefix = atomicString($1); 698 CSSParser *p = static_cast<CSSParser*>(parser);696 CSSParser* p = static_cast<CSSParser*>(parser); 699 697 if (p->styleElement && p->styleElement->isCSSStyleSheet()) 700 $$-> tag = QualifiedName(namespacePrefix,701 starAtom,702 static_cast<CSSStyleSheet*>(p->styleElement)->determineNamespace(namespacePrefix));698 $$->m_tag = QualifiedName(namespacePrefix, 699 starAtom, 700 static_cast<CSSStyleSheet*>(p->styleElement)->determineNamespace(namespacePrefix)); 703 701 } 704 702 } … … 708 706 IDENT { 709 707 ParseString& str = $1; 710 CSSParser *p = static_cast<CSSParser*>(parser);711 Document *doc = p->document();708 CSSParser* p = static_cast<CSSParser*>(parser); 709 Document* doc = p->document(); 712 710 if (doc && doc->isHTMLDocument()) 713 711 str.lower(); … … 730 728 CSSParser* p = static_cast<CSSParser*>(parser); 731 729 CSSSelector* end = $1; 732 while (end-> tagHistory)733 end = end-> tagHistory;730 while (end->m_tagHistory) 731 end = end->m_tagHistory; 734 732 end->m_relation = CSSSelector::SubSelector; 735 end-> tagHistory = p->sinkFloatingSelector($2);733 end->m_tagHistory = p->sinkFloatingSelector($2); 736 734 } 737 735 } … … 743 741 specifier: 744 742 HASH { 745 CSSParser *p = static_cast<CSSParser*>(parser);743 CSSParser* p = static_cast<CSSParser*>(parser); 746 744 $$ = p->createFloatingSelector(); 747 $$->m atch = CSSSelector::Id;745 $$->m_match = CSSSelector::Id; 748 746 if (!p->strict) 749 747 $1.lower(); 750 $$-> attr = idAttr;751 $$-> value = atomicString($1);748 $$->m_attr = idAttr; 749 $$->m_value = atomicString($1); 752 750 } 753 751 | class … … 758 756 class: 759 757 '.' IDENT { 760 CSSParser *p = static_cast<CSSParser*>(parser);758 CSSParser* p = static_cast<CSSParser*>(parser); 761 759 $$ = p->createFloatingSelector(); 762 $$->m atch = CSSSelector::Class;760 $$->m_match = CSSSelector::Class; 763 761 if (!p->strict) 764 762 $2.lower(); 765 $$-> attr = classAttr;766 $$-> value = atomicString($2);763 $$->m_attr = classAttr; 764 $$->m_value = atomicString($2); 767 765 } 768 766 ; … … 771 769 IDENT maybe_space { 772 770 ParseString& str = $1; 773 CSSParser *p = static_cast<CSSParser*>(parser);774 Document *doc = p->document();771 CSSParser* p = static_cast<CSSParser*>(parser); 772 Document* doc = p->document(); 775 773 if (doc && doc->isHTMLDocument()) 776 774 str.lower(); … … 782 780 '[' maybe_space attr_name ']' { 783 781 $$ = static_cast<CSSParser*>(parser)->createFloatingSelector(); 784 $$-> attr = QualifiedName(nullAtom, atomicString($3), nullAtom);785 $$->m atch = CSSSelector::Set;782 $$->m_attr = QualifiedName(nullAtom, atomicString($3), nullAtom); 783 $$->m_match = CSSSelector::Set; 786 784 } 787 785 | '[' maybe_space attr_name match maybe_space ident_or_string maybe_space ']' { 788 786 $$ = static_cast<CSSParser*>(parser)->createFloatingSelector(); 789 $$-> attr = QualifiedName(nullAtom, atomicString($3), nullAtom);790 $$->m atch = (CSSSelector::Match)$4;791 $$-> value = atomicString($6);787 $$->m_attr = QualifiedName(nullAtom, atomicString($3), nullAtom); 788 $$->m_match = (CSSSelector::Match)$4; 789 $$->m_value = atomicString($6); 792 790 } 793 791 | '[' maybe_space namespace_selector attr_name ']' { 794 792 AtomicString namespacePrefix = atomicString($3); 795 CSSParser *p = static_cast<CSSParser*>(parser);793 CSSParser* p = static_cast<CSSParser*>(parser); 796 794 $$ = p->createFloatingSelector(); 797 $$-> attr = QualifiedName(namespacePrefix,798 atomicString($4),799 static_cast<CSSStyleSheet*>(p->styleElement)->determineNamespace(namespacePrefix));800 $$->m atch = CSSSelector::Set;795 $$->m_attr = QualifiedName(namespacePrefix, 796 atomicString($4), 797 static_cast<CSSStyleSheet*>(p->styleElement)->determineNamespace(namespacePrefix)); 798 $$->m_match = CSSSelector::Set; 801 799 } 802 800 | '[' maybe_space namespace_selector attr_name match maybe_space ident_or_string maybe_space ']' { 803 801 AtomicString namespacePrefix = atomicString($3); 804 CSSParser *p = static_cast<CSSParser*>(parser);802 CSSParser* p = static_cast<CSSParser*>(parser); 805 803 $$ = p->createFloatingSelector(); 806 $$-> attr = QualifiedName(namespacePrefix,807 atomicString($4),808 static_cast<CSSStyleSheet*>(p->styleElement)->determineNamespace(namespacePrefix));809 $$->m atch = (CSSSelector::Match)$5;810 $$-> value = atomicString($7);804 $$->m_attr = QualifiedName(namespacePrefix, 805 atomicString($4), 806 static_cast<CSSStyleSheet*>(p->styleElement)->determineNamespace(namespacePrefix)); 807 $$->m_match = (CSSSelector::Match)$5; 808 $$->m_value = atomicString($7); 811 809 } 812 810 ; … … 841 839 ':' IDENT { 842 840 $$ = static_cast<CSSParser*>(parser)->createFloatingSelector(); 843 $$->m atch = CSSSelector::PseudoClass;841 $$->m_match = CSSSelector::PseudoClass; 844 842 $2.lower(); 845 $$-> value = atomicString($2);846 if ($$-> value == "empty" || $$->value == "only-child" ||847 $$-> value == "first-child" || $$->value == "last-child") {848 CSSParser *p = static_cast<CSSParser*>(parser);849 Document *doc = p->document();843 $$->m_value = atomicString($2); 844 if ($$->m_value == "empty" || $$->m_value == "only-child" || 845 $$->m_value == "first-child" || $$->m_value == "last-child") { 846 CSSParser* p = static_cast<CSSParser*>(parser); 847 Document* doc = p->document(); 850 848 if (doc) 851 849 doc->setUsesSiblingRules(true); … … 854 852 | ':' ':' IDENT { 855 853 $$ = static_cast<CSSParser*>(parser)->createFloatingSelector(); 856 $$->m atch = CSSSelector::PseudoElement;854 $$->m_match = CSSSelector::PseudoElement; 857 855 $3.lower(); 858 $$-> value = atomicString($3);856 $$->m_value = atomicString($3); 859 857 } 860 858 // used by :lang 861 859 | ':' FUNCTION IDENT ')' { 862 860 $$ = static_cast<CSSParser*>(parser)->createFloatingSelector(); 863 $$->m atch = CSSSelector::PseudoClass;864 $$-> argument = atomicString($3);861 $$->m_match = CSSSelector::PseudoClass; 862 $$->m_argument = atomicString($3); 865 863 $2.lower(); 866 $$-> value = atomicString($2);864 $$->m_value = atomicString($2); 867 865 } 868 866 // used by :not … … 870 868 CSSParser* p = static_cast<CSSParser*>(parser); 871 869 $$ = p->createFloatingSelector(); 872 $$->m atch = CSSSelector::PseudoClass;873 $$-> simpleSelector = p->sinkFloatingSelector($4);870 $$->m_match = CSSSelector::PseudoClass; 871 $$->m_simpleSelector = p->sinkFloatingSelector($4); 874 872 $2.lower(); 875 $$-> value = atomicString($2);873 $$->m_value = atomicString($2); 876 874 } 877 875 ; … … 915 913 | decl_list declaration ';' maybe_space { 916 914 $$ = $1; 917 if ( $2)915 if ($2) 918 916 $$ = $2; 919 917 } … … 929 927 property ':' maybe_space expr prio { 930 928 $$ = false; 931 CSSParser *p = static_cast<CSSParser*>(parser);929 CSSParser* p = static_cast<CSSParser*>(parser); 932 930 if ($1 && $4) { 933 931 p->valueList = p->sinkFloatingValueList($4); … … 1040 1038 | hexcolor { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_RGBCOLOR; } 1041 1039 | '#' maybe_space { $$.id = 0; $$.string = ParseString(); $$.unit = CSSPrimitiveValue::CSS_RGBCOLOR; } /* Handle error case: "color: #;" */ 1042 /* ###according to the specs a function can have a unary_operator in front. I know no case where this makes sense */1040 /* FIXME: according to the specs a function can have a unary_operator in front. I know no case where this makes sense */ 1043 1041 | function { 1044 1042 $$ = $1; -
trunk/WebCore/css/CSSImageValue.cpp
r17131 r18850 20 20 * Boston, MA 02111-1307, USA. 21 21 */ 22 22 23 #include "config.h" 23 24 #include "CSSImageValue.h" 24 25 26 #include "CSSValueKeywords.h" 25 27 #include "Cache.h" 26 28 #include "CachedImage.h" 27 #include "CSSValueKeywords.h"28 29 #include "DocLoader.h" 29 30 … … 68 69 } 69 70 70 } 71 } // namespace WebCore -
trunk/WebCore/css/CSSImageValue.h
r15269 r18850 21 21 */ 22 22 23 #ifndef CSSImageValue_ H24 #define CSSImageValue_ H23 #ifndef CSSImageValue_h 24 #define CSSImageValue_h 25 25 26 26 #include "CSSPrimitiveValue.h" … … 31 31 class DocLoader; 32 32 33 class CSSImageValue : public CSSPrimitiveValue, public CachedResourceClient 34 { 33 class CSSImageValue : public CSSPrimitiveValue, public CachedResourceClient { 35 34 public: 36 35 CSSImageValue(); … … 45 44 }; 46 45 47 } // namespace 46 } // namespace WebCore 48 47 49 #endif 48 #endif // CSSImageValue_h -
trunk/WebCore/css/CSSInheritedValue.cpp
r14408 r18850 20 20 * Boston, MA 02111-1307, USA. 21 21 */ 22 22 23 #include "config.h" 23 24 #include "CSSInheritedValue.h" … … 37 38 } 38 39 39 } 40 } // namespace WebCore -
trunk/WebCore/css/CSSInheritedValue.h
r14407 r18850 21 21 */ 22 22 23 #ifndef CSSInheritedValue_ H24 #define CSSInheritedValue_ H23 #ifndef CSSInheritedValue_h 24 #define CSSInheritedValue_h 25 25 26 26 #include "CSSValue.h" … … 28 28 namespace WebCore { 29 29 30 class CSSInheritedValue : public CSSValue 31 { 30 class CSSInheritedValue : public CSSValue { 32 31 public: 33 32 virtual unsigned short cssValueType() const; … … 35 34 }; 36 35 37 } // namespace 36 } // namespace WebCore 38 37 39 #endif 38 #endif // CSSInheritedValue_h -
trunk/WebCore/css/CSSInitialValue.cpp
r14408 r18850 20 20 * Boston, MA 02111-1307, USA. 21 21 */ 22 22 23 #include "config.h" 23 24 #include "CSSInitialValue.h" … … 37 38 } 38 39 39 } 40 } // namespace WebCore -
trunk/WebCore/css/CSSInitialValue.h
r14407 r18850 21 21 */ 22 22 23 #ifndef CSSInitialValue_ H24 #define CSSInitialValue_ H23 #ifndef CSSInitialValue_h 24 #define CSSInitialValue_h 25 25 26 26 #include "CSSValue.h" … … 28 28 namespace WebCore { 29 29 30 class CSSInitialValue : public CSSValue 31 { 30 class CSSInitialValue : public CSSValue { 32 31 public: 33 32 virtual unsigned short cssValueType() const; … … 35 34 }; 36 35 37 } // namespace 36 } // namespace WebCore 38 37 39 #endif 38 #endif // CSSInitialValue_h -
trunk/WebCore/css/CSSMutableStyleDeclaration.cpp
r18815 r18850 20 20 * Boston, MA 02111-1307, USA. 21 21 */ 22 22 23 #include "config.h" 23 24 #include "CSSMutableStyleDeclaration.h" … … 57 58 } 58 59 59 CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const CSSProperty * const *properties, int numProperties)60 CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const CSSProperty* const * properties, int numProperties) 60 61 : CSSStyleDeclaration(parent) 61 62 , m_node(0) … … 66 67 } 67 68 68 CSSMutableStyleDeclaration& CSSMutableStyleDeclaration::operator=(const CSSMutableStyleDeclaration& o )69 CSSMutableStyleDeclaration& CSSMutableStyleDeclaration::operator=(const CSSMutableStyleDeclaration& other) 69 70 { 70 71 // don't attach it to the same node, just leave the current m_node value 71 m_values = o .m_values;72 m_values = other.m_values; 72 73 return *this; 73 74 } … … 80 81 81 82 // Shorthand and 4-values properties 82 switch ( propertyID ) { 83 case CSS_PROP_BACKGROUND_POSITION: 84 { 85 // ## Is this correct? The code in cssparser.cpp is confusing 86 const int properties[2] = { CSS_PROP_BACKGROUND_POSITION_X, 87 CSS_PROP_BACKGROUND_POSITION_Y }; 88 return getShortHandValue( properties, 2 ); 89 } 90 case CSS_PROP_BACKGROUND: 91 { 92 const int properties[5] = { CSS_PROP_BACKGROUND_IMAGE, CSS_PROP_BACKGROUND_REPEAT, 93 CSS_PROP_BACKGROUND_ATTACHMENT, CSS_PROP_BACKGROUND_POSITION, 94 CSS_PROP_BACKGROUND_COLOR }; 95 return getShortHandValue( properties, 5 ); 96 } 97 case CSS_PROP_BORDER: 98 { 99 const int properties[3] = { CSS_PROP_BORDER_WIDTH, CSS_PROP_BORDER_STYLE, 100 CSS_PROP_BORDER_COLOR }; 101 return getShortHandValue( properties, 3 ); 102 } 103 case CSS_PROP_BORDER_TOP: 104 { 105 const int properties[3] = { CSS_PROP_BORDER_TOP_WIDTH, CSS_PROP_BORDER_TOP_STYLE, 106 CSS_PROP_BORDER_TOP_COLOR}; 107 return getShortHandValue( properties, 3 ); 108 } 109 case CSS_PROP_BORDER_RIGHT: 110 { 111 const int properties[3] = { CSS_PROP_BORDER_RIGHT_WIDTH, CSS_PROP_BORDER_RIGHT_STYLE, 112 CSS_PROP_BORDER_RIGHT_COLOR}; 113 return getShortHandValue( properties, 3 ); 114 } 115 case CSS_PROP_BORDER_BOTTOM: 116 { 117 const int properties[3] = { CSS_PROP_BORDER_BOTTOM_WIDTH, CSS_PROP_BORDER_BOTTOM_STYLE, 118 CSS_PROP_BORDER_BOTTOM_COLOR}; 119 return getShortHandValue( properties, 3 ); 120 } 121 case CSS_PROP_BORDER_LEFT: 122 { 123 const int properties[3] = { CSS_PROP_BORDER_LEFT_WIDTH, CSS_PROP_BORDER_LEFT_STYLE, 124 CSS_PROP_BORDER_LEFT_COLOR}; 125 return getShortHandValue( properties, 3 ); 126 } 127 case CSS_PROP_OUTLINE: 128 { 129 const int properties[3] = { CSS_PROP_OUTLINE_WIDTH, CSS_PROP_OUTLINE_STYLE, 130 CSS_PROP_OUTLINE_COLOR }; 131 return getShortHandValue( properties, 3 ); 132 } 133 case CSS_PROP_BORDER_COLOR: 134 { 135 const int properties[4] = { CSS_PROP_BORDER_TOP_COLOR, CSS_PROP_BORDER_RIGHT_COLOR, 136 CSS_PROP_BORDER_BOTTOM_COLOR, CSS_PROP_BORDER_LEFT_COLOR }; 137 return get4Values( properties ); 138 } 139 case CSS_PROP_BORDER_WIDTH: 140 { 141 const int properties[4] = { CSS_PROP_BORDER_TOP_WIDTH, CSS_PROP_BORDER_RIGHT_WIDTH, 142 CSS_PROP_BORDER_BOTTOM_WIDTH, CSS_PROP_BORDER_LEFT_WIDTH }; 143 return get4Values( properties ); 144 } 145 case CSS_PROP_BORDER_STYLE: 146 { 147 const int properties[4] = { CSS_PROP_BORDER_TOP_STYLE, CSS_PROP_BORDER_RIGHT_STYLE, 148 CSS_PROP_BORDER_BOTTOM_STYLE, CSS_PROP_BORDER_LEFT_STYLE }; 149 return get4Values( properties ); 150 } 151 case CSS_PROP_MARGIN: 152 { 153 const int properties[4] = { CSS_PROP_MARGIN_TOP, CSS_PROP_MARGIN_RIGHT, 154 CSS_PROP_MARGIN_BOTTOM, CSS_PROP_MARGIN_LEFT }; 155 return get4Values( properties ); 156 } 157 case CSS_PROP_PADDING: 158 { 159 const int properties[4] = { CSS_PROP_PADDING_TOP, CSS_PROP_PADDING_RIGHT, 160 CSS_PROP_PADDING_BOTTOM, CSS_PROP_PADDING_LEFT }; 161 return get4Values( properties ); 162 } 163 case CSS_PROP_LIST_STYLE: 164 { 165 const int properties[3] = { CSS_PROP_LIST_STYLE_TYPE, CSS_PROP_LIST_STYLE_POSITION, 166 CSS_PROP_LIST_STYLE_IMAGE }; 167 return getShortHandValue( properties, 3 ); 168 } 83 switch (propertyID) { 84 case CSS_PROP_BACKGROUND_POSITION: { 85 // FIXME: Is this correct? The code in cssparser.cpp is confusing 86 const int properties[2] = { CSS_PROP_BACKGROUND_POSITION_X, 87 CSS_PROP_BACKGROUND_POSITION_Y }; 88 return getShorthandValue(properties, 2); 89 } 90 case CSS_PROP_BACKGROUND: { 91 const int properties[5] = { CSS_PROP_BACKGROUND_IMAGE, CSS_PROP_BACKGROUND_REPEAT, 92 CSS_PROP_BACKGROUND_ATTACHMENT, CSS_PROP_BACKGROUND_POSITION, 93 CSS_PROP_BACKGROUND_COLOR }; 94 return getShorthandValue(properties, 5); 95 } 96 case CSS_PROP_BORDER: { 97 const int properties[3] = { CSS_PROP_BORDER_WIDTH, CSS_PROP_BORDER_STYLE, 98 CSS_PROP_BORDER_COLOR }; 99 return getShorthandValue(properties, 3); 100 } 101 case CSS_PROP_BORDER_TOP: { 102 const int properties[3] = { CSS_PROP_BORDER_TOP_WIDTH, CSS_PROP_BORDER_TOP_STYLE, 103 CSS_PROP_BORDER_TOP_COLOR}; 104 return getShorthandValue(properties, 3); 105 } 106 case CSS_PROP_BORDER_RIGHT: { 107 const int properties[3] = { CSS_PROP_BORDER_RIGHT_WIDTH, CSS_PROP_BORDER_RIGHT_STYLE, 108 CSS_PROP_BORDER_RIGHT_COLOR}; 109 return getShorthandValue(properties, 3); 110 } 111 case CSS_PROP_BORDER_BOTTOM: { 112 const int properties[3] = { CSS_PROP_BORDER_BOTTOM_WIDTH, CSS_PROP_BORDER_BOTTOM_STYLE, 113 CSS_PROP_BORDER_BOTTOM_COLOR}; 114 return getShorthandValue(properties, 3); 115 } 116 case CSS_PROP_BORDER_LEFT: { 117 const int properties[3] = { CSS_PROP_BORDER_LEFT_WIDTH, CSS_PROP_BORDER_LEFT_STYLE, 118 CSS_PROP_BORDER_LEFT_COLOR}; 119 return getShorthandValue(properties, 3); 120 } 121 case CSS_PROP_OUTLINE: { 122 const int properties[3] = { CSS_PROP_OUTLINE_WIDTH, CSS_PROP_OUTLINE_STYLE, 123 CSS_PROP_OUTLINE_COLOR }; 124 return getShorthandValue(properties, 3); 125 } 126 case CSS_PROP_BORDER_COLOR: { 127 const int properties[4] = { CSS_PROP_BORDER_TOP_COLOR, CSS_PROP_BORDER_RIGHT_COLOR, 128 CSS_PROP_BORDER_BOTTOM_COLOR, CSS_PROP_BORDER_LEFT_COLOR }; 129 return get4Values(properties); 130 } 131 case CSS_PROP_BORDER_WIDTH: { 132 const int properties[4] = { CSS_PROP_BORDER_TOP_WIDTH, CSS_PROP_BORDER_RIGHT_WIDTH, 133 CSS_PROP_BORDER_BOTTOM_WIDTH, CSS_PROP_BORDER_LEFT_WIDTH }; 134 return get4Values(properties); 135 } 136 case CSS_PROP_BORDER_STYLE: { 137 const int properties[4] = { CSS_PROP_BORDER_TOP_STYLE, CSS_PROP_BORDER_RIGHT_STYLE, 138 CSS_PROP_BORDER_BOTTOM_STYLE, CSS_PROP_BORDER_LEFT_STYLE }; 139 return get4Values(properties); 140 } 141 case CSS_PROP_MARGIN: { 142 const int properties[4] = { CSS_PROP_MARGIN_TOP, CSS_PROP_MARGIN_RIGHT, 143 CSS_PROP_MARGIN_BOTTOM, CSS_PROP_MARGIN_LEFT }; 144 return get4Values(properties); 145 } 146 case CSS_PROP_PADDING: { 147 const int properties[4] = { CSS_PROP_PADDING_TOP, CSS_PROP_PADDING_RIGHT, 148 CSS_PROP_PADDING_BOTTOM, CSS_PROP_PADDING_LEFT }; 149 return get4Values(properties); 150 } 151 case CSS_PROP_LIST_STYLE: { 152 const int properties[3] = { CSS_PROP_LIST_STYLE_TYPE, CSS_PROP_LIST_STYLE_POSITION, 153 CSS_PROP_LIST_STYLE_IMAGE }; 154 return getShorthandValue(properties, 3); 155 } 169 156 } 170 157 return String(); … … 177 164 if (!isPropertyImplicit(properties[i])) { 178 165 RefPtr<CSSValue> value = getPropertyCSSValue(properties[i]); 179 if (!value) // apparently all 4 properties must be specified. 166 167 // apparently all 4 properties must be specified. 168 if (!value) 180 169 return String(); 170 181 171 if (!res.isNull()) 182 172 res += " "; … … 187 177 } 188 178 189 String CSSMutableStyleDeclaration::getShort HandValue( const int* properties, int number) const179 String CSSMutableStyleDeclaration::getShorthandValue(const int* properties, int number) const 190 180 { 191 181 String res; … … 193 183 if (!isPropertyImplicit(properties[i])) { 194 184 RefPtr<CSSValue> value = getPropertyCSSValue(properties[i]); 195 if (value) { // TODO provide default value if !value 185 // FIXME: provide default value if !value 186 if (value) { 196 187 if (!res.isNull()) 197 188 res += " "; … … 206 197 { 207 198 DeprecatedValueListConstIterator<CSSProperty> end; 208 for (DeprecatedValueListConstIterator<CSSProperty> it = m_values.fromLast(); it != end; --it) 199 for (DeprecatedValueListConstIterator<CSSProperty> it = m_values.fromLast(); it != end; --it) { 209 200 if (propertyID == (*it).m_id) 210 201 return (*it).value(); 202 } 211 203 return 0; 212 204 } … … 383 375 384 376 DeprecatedValueListIterator<CSSProperty> end; 385 for (DeprecatedValueListIterator<CSSProperty> it = m_values.fromLast(); it != end; --it) 377 for (DeprecatedValueListIterator<CSSProperty> it = m_values.fromLast(); it != end; --it) { 386 378 if (propertyID == (*it).m_id) { 387 379 value = (*it).value()->cssText(); … … 391 383 break; 392 384 } 385 } 393 386 394 387 return value; … … 413 406 } 414 407 415 // ###quick&dirty hack for KDE 3.0... make this MUCH better! (Dirk)408 // FIXME: quick&dirty hack for KDE 3.0... make this MUCH better! (Dirk) 416 409 StyleBase* root = this; 417 while (StyleBase *parent = root->parent())410 while (StyleBase* parent = root->parent()) 418 411 root = parent; 419 412 if (root->isCSSStyleSheet()) … … 424 417 { 425 418 DeprecatedValueListConstIterator<CSSProperty> end; 426 for (DeprecatedValueListConstIterator<CSSProperty> it = m_values.begin(); it != end; ++it) 419 for (DeprecatedValueListConstIterator<CSSProperty> it = m_values.begin(); it != end; ++it) { 427 420 if (propertyID == (*it).id()) 428 421 return (*it).isImportant(); 422 } 429 423 return false; 430 424 } … … 433 427 { 434 428 DeprecatedValueListConstIterator<CSSProperty> end; 435 for (DeprecatedValueListConstIterator<CSSProperty> it = m_values.begin(); it != end; ++it) 429 for (DeprecatedValueListConstIterator<CSSProperty> it = m_values.begin(); it != end; ++it) { 436 430 if (propertyID == (*it).id()) 437 431 return (*it).shorthandID(); 432 } 438 433 return false; 439 434 } … … 442 437 { 443 438 DeprecatedValueListConstIterator<CSSProperty> end; 444 for (DeprecatedValueListConstIterator<CSSProperty> it = m_values.begin(); it != end; ++it) 439 for (DeprecatedValueListConstIterator<CSSProperty> it = m_values.begin(); it != end; ++it) { 445 440 if (propertyID == (*it).id()) 446 441 return (*it).isImplicit(); 442 } 447 443 return false; 448 444 } 449 445 450 void CSSMutableStyleDeclaration::setProperty(int propertyID, const String &value, bool important, ExceptionCode& ec)446 void CSSMutableStyleDeclaration::setProperty(int propertyID, const String& value, bool important, ExceptionCode& ec) 451 447 { 452 448 setProperty(propertyID, value, important, true, ec); … … 458 454 } 459 455 460 bool CSSMutableStyleDeclaration::setProperty(int propertyID, const String &value, bool important, bool notifyChanged, ExceptionCode& ec)456 bool CSSMutableStyleDeclaration::setProperty(int propertyID, const String& value, bool important, bool notifyChanged, ExceptionCode& ec) 461 457 { 462 458 ec = 0; … … 498 494 } 499 495 500 void CSSMutableStyleDeclaration::setImageProperty(int propertyId, const String &URL, bool important)496 void CSSMutableStyleDeclaration::setImageProperty(int propertyId, const String& url, bool important) 501 497 { 502 498 removeProperty(propertyId); 503 m_values.append(CSSProperty(propertyId, new CSSImageValue( URL, this), important));499 m_values.append(CSSProperty(propertyId, new CSSImageValue(url, this), important)); 504 500 setChanged(); 505 501 } 506 502 507 void CSSMutableStyleDeclaration::parseDeclaration(const String &styleDeclaration)503 void CSSMutableStyleDeclaration::parseDeclaration(const String& styleDeclaration) 508 504 { 509 505 m_values.clear(); … … 513 509 } 514 510 515 void CSSMutableStyleDeclaration::addParsedProperties(const CSSProperty * const * properties, int numProperties)511 void CSSMutableStyleDeclaration::addParsedProperties(const CSSProperty * const * properties, int numProperties) 516 512 { 517 513 for (int i = 0; i < numProperties; ++i) { … … 523 519 } 524 520 525 void CSSMutableStyleDeclaration::setLengthProperty(int id, const String &value, bool important, bool /*multiLength*/)521 void CSSMutableStyleDeclaration::setLengthProperty(int propertyId, const String& value, bool important, bool /*multiLength*/) 526 522 { 527 523 bool parseMode = useStrictParsing(); 528 524 setStrictParsing(false); 529 setProperty( id, value, important);525 setProperty(propertyId, value, important); 530 526 setStrictParsing(parseMode); 531 527 } … … 546 542 { 547 543 String result = ""; 548 544 549 545 DeprecatedValueListConstIterator<CSSProperty> end; 550 546 for (DeprecatedValueListConstIterator<CSSProperty> it = m_values.begin(); it != end; ++it) … … 564 560 } 565 561 566 void CSSMutableStyleDeclaration::merge(CSSMutableStyleDeclaration *other, bool argOverridesOnConflict)562 void CSSMutableStyleDeclaration::merge(CSSMutableStyleDeclaration* other, bool argOverridesOnConflict) 567 563 { 568 564 DeprecatedValueListConstIterator<CSSProperty> end; 569 565 for (DeprecatedValueListConstIterator<CSSProperty> it = other->valuesIterator(); it != end; ++it) { 570 const CSSProperty &property = *it;566 const CSSProperty& property = *it; 571 567 RefPtr<CSSValue> value = getPropertyCSSValue(property.id()); 572 568 if (value) { … … 615 611 } 616 612 617 void CSSMutableStyleDeclaration::removePropertiesInSet(const int *set, unsigned length, bool notifyChanged)613 void CSSMutableStyleDeclaration::removePropertiesInSet(const int* set, unsigned length, bool notifyChanged) 618 614 { 619 615 bool changed = false; … … 639 635 } 640 636 641 } 637 } // namespace WebCore -
trunk/WebCore/css/CSSMutableStyleDeclaration.h
r18753 r18850 21 21 */ 22 22 23 #ifndef CSSMutableStyleDeclaration_ H24 #define CSSMutableStyleDeclaration_ H23 #ifndef CSSMutableStyleDeclaration_h 24 #define CSSMutableStyleDeclaration_h 25 25 26 26 #include "CSSStyleDeclaration.h" 27 #include "CSSPrimitiveValue.h" // for CSSPrimitiveValue::UnitTypes27 #include "CSSPrimitiveValue.h" 28 28 #include "DeprecatedValueList.h" 29 29 #include "PlatformString.h" … … 34 34 class Node; 35 35 36 class CSSMutableStyleDeclaration : public CSSStyleDeclaration 37 { 36 class CSSMutableStyleDeclaration : public CSSStyleDeclaration { 38 37 public: 39 38 CSSMutableStyleDeclaration(); 40 39 CSSMutableStyleDeclaration(CSSRule* parentRule); 41 40 CSSMutableStyleDeclaration(CSSRule* parentRule, const DeprecatedValueList<CSSProperty>&); 42 CSSMutableStyleDeclaration(CSSRule* parentRule, const CSSProperty 41 CSSMutableStyleDeclaration(CSSRule* parentRule, const CSSProperty* const *, int numProperties); 43 42 44 CSSMutableStyleDeclaration &operator=(const CSSMutableStyleDeclaration&);43 CSSMutableStyleDeclaration& operator=(const CSSMutableStyleDeclaration&); 45 44 46 45 void setNode(Node* node) { m_node = node; } … … 69 68 bool setProperty(int propertyID, const String& value, bool important, bool notifyChanged, ExceptionCode&); 70 69 bool setProperty(int propertyId, const String& value, bool important = false, bool notifyChanged = true) 71 { ExceptionCode ec; return setProperty(propertyId, value, important, notifyChanged, ec); } 70 { 71 ExceptionCode ec; 72 return setProperty(propertyId, value, important, notifyChanged, ec); 73 } 72 74 73 75 String removeProperty(int propertyID, bool notifyChanged, ExceptionCode&); 74 76 String removeProperty(int propertyID, bool notifyChanged = true) 75 { ExceptionCode ec; return removeProperty(propertyID, notifyChanged, ec); } 77 { 78 ExceptionCode ec; 79 return removeProperty(propertyID, notifyChanged, ec); 80 } 76 81 77 82 void clear(); … … 82 87 void setLengthProperty(int propertyId, const String& value, bool important, bool multiLength = false); 83 88 void setStringProperty(int propertyId, const String& value, CSSPrimitiveValue::UnitTypes, bool important = false); // parsed string value 84 void setImageProperty(int propertyId, const String& URL, bool important = false);89 void setImageProperty(int propertyId, const String& url, bool important = false); 85 90 86 91 // The following parses an entire new style declaration. … … 89 94 // Besides adding the properties, this also removes any existing properties with these IDs. 90 95 // It does no notification since it's called by the parser. 91 void addParsedProperties(const CSSProperty 96 void addParsedProperties(const CSSProperty* const *, int numProperties); 92 97 93 98 PassRefPtr<CSSMutableStyleDeclaration> copyBlockProperties() const; … … 96 101 97 102 void merge(CSSMutableStyleDeclaration*, bool argOverridesOnConflict = true); 98 103 99 104 private: 100 String getShort HandValue(const int* properties, int number) const;105 String getShorthandValue(const int* properties, int number) const; 101 106 String get4Values(const int* properties) const; 102 107 … … 105 110 }; 106 111 107 } // namespace 112 } // namespace WebCore 108 113 109 #endif 114 #endif // CSSMutableStyleDeclaration_h -
trunk/WebCore/css/CSSNamespace.h
r14408 r18850 22 22 */ 23 23 24 #ifndef CSSNamespace_ H25 #define CSSNamespace_ H24 #ifndef CSSNamespace_h 25 #define CSSNamespace_h 26 26 27 27 #include "AtomicString.h" … … 34 34 CSSNamespace* m_parent; 35 35 36 CSSNamespace(const AtomicString& p, const AtomicString& u, CSSNamespace* parent) 37 : m_prefix(p) 38 , m_uri(u) 39 , m_parent(parent) {} 36 CSSNamespace(const AtomicString& prefix, const AtomicString& uri, CSSNamespace* parent) 37 : m_prefix(prefix) 38 , m_uri(uri) 39 , m_parent(parent) 40 { 41 } 40 42 ~CSSNamespace() { delete m_parent; } 41 43 42 44 const AtomicString& uri() { return m_uri; } 43 45 const AtomicString& prefix() { return m_prefix; } 44 46 45 47 CSSNamespace* namespaceForPrefix(const AtomicString& prefix) 46 48 { … … 52 54 } 53 55 }; 54 }55 56 56 #endif 57 } // namespace WebCore 58 59 #endif // CSSNamespace_h -
trunk/WebCore/css/CSSPrimitiveValue.cpp
r17405 r18850 20 20 * Boston, MA 02111-1307, USA. 21 21 */ 22 22 23 #include "config.h" 23 24 #include "CSSPrimitiveValue.h" 24 25 26 #include "CSSValueKeywords.h" 25 27 #include "Color.h" 26 28 #include "Counter.h" 27 #include "CSSValueKeywords.h"28 29 #include "DashboardRegion.h" 29 30 #include "ExceptionCode.h" 30 31 #include "Pair.h" 31 32 #include "RenderStyle.h" 32 33 33 #include <ctype.h> 34 34 … … 51 51 52 52 // {nmchar}* 53 for (; p != end; ++p) 53 for (; p != end; ++p) { 54 54 if (!(p[0] == '_' || p[0] == '-' || isalnum(p[0]) || p[0] >= 128)) 55 55 return false; 56 } 56 57 57 58 return true; … … 107 108 108 109 CSSPrimitiveValue::CSSPrimitiveValue() 109 { 110 m_type = 0; 110 : m_type(0) 111 { 111 112 } 112 113 113 114 CSSPrimitiveValue::CSSPrimitiveValue(int ident) 115 : m_type(CSS_IDENT) 114 116 { 115 117 m_value.ident = ident; 116 m_type = CSS_IDENT;117 118 } 118 119 119 120 CSSPrimitiveValue::CSSPrimitiveValue(double num, UnitTypes type) 121 : m_type(type) 120 122 { 121 123 m_value.num = num; 122 m_type = type;123 124 } 124 125 125 126 CSSPrimitiveValue::CSSPrimitiveValue(const String& str, UnitTypes type) 127 : m_type(type) 126 128 { 127 129 if ((m_value.string = str.impl())) 128 130 m_value.string->ref(); 129 m_type = type;130 131 } 131 132 132 133 CSSPrimitiveValue::CSSPrimitiveValue(PassRefPtr<Counter> c) 134 : m_type(CSS_COUNTER) 133 135 { 134 136 m_value.counter = c.releaseRef(); 135 m_type = CSS_COUNTER;136 137 } 137 138 138 139 CSSPrimitiveValue::CSSPrimitiveValue(PassRefPtr<RectImpl> r) 140 : m_type(CSS_RECT) 139 141 { 140 142 m_value.rect = r.releaseRef(); 141 m_type = CSS_RECT;142 143 } 143 144 144 145 #if PLATFORM(MAC) 145 146 CSSPrimitiveValue::CSSPrimitiveValue(PassRefPtr<DashboardRegion> r) 147 : m_type(CSS_DASHBOARD_REGION) 146 148 { 147 149 m_value.region = r.releaseRef(); 148 m_type = CSS_DASHBOARD_REGION;149 150 } 150 151 #endif 151 152 152 153 CSSPrimitiveValue::CSSPrimitiveValue(RGBA32 color) 154 : m_type(CSS_RGBCOLOR) 153 155 { 154 156 m_value.rgbcolor = color; 155 m_type = CSS_RGBCOLOR;156 157 } 157 158 158 159 CSSPrimitiveValue::CSSPrimitiveValue(PassRefPtr<Pair> p) 160 : m_type(CSS_PAIR) 159 161 { 160 162 m_value.pair = p.releaseRef(); 161 m_type = CSS_PAIR;162 163 } 163 164 … … 169 170 void CSSPrimitiveValue::cleanup() 170 171 { 171 switch (m_type) {172 case CSS_STRING:173 case CSS_URI:174 case CSS_ATTR:175 if (m_value.string)176 m_value.string->deref();177 break;178 case CSS_COUNTER:179 m_value.counter->deref();180 break;181 case CSS_RECT:182 m_value.rect->deref();183 break;184 case CSS_PAIR:185 m_value.pair->deref();186 break;172 switch (m_type) { 173 case CSS_STRING: 174 case CSS_URI: 175 case CSS_ATTR: 176 if (m_value.string) 177 m_value.string->deref(); 178 break; 179 case CSS_COUNTER: 180 m_value.counter->deref(); 181 break; 182 case CSS_RECT: 183 m_value.rect->deref(); 184 break; 185 case CSS_PAIR: 186 m_value.pair->deref(); 187 break; 187 188 #if PLATFORM(MAC) 188 case CSS_DASHBOARD_REGION:189 if (m_value.region)190 m_value.region->deref();191 break;189 case CSS_DASHBOARD_REGION: 190 if (m_value.region) 191 m_value.region->deref(); 192 break; 192 193 #endif 193 default:194 break;194 default: 195 break; 195 196 } 196 197 … … 198 199 } 199 200 200 int CSSPrimitiveValue::computeLengthInt(RenderStyle *style)201 int CSSPrimitiveValue::computeLengthInt(RenderStyle* style) 201 202 { 202 203 double result = computeLengthFloat(style); 203 204 204 205 // This conversion is imprecise, often resulting in values of, e.g., 44.99998. We 205 206 // need to go ahead and round if we're really close to the next integer value. 206 207 result += result < 0 ? -0.01 : +0.01; 207 208 208 209 if (result > INT_MAX || result < INT_MIN) 209 210 return 0; 210 return (int)result;211 } 212 213 int CSSPrimitiveValue::computeLengthInt(RenderStyle *style, double multiplier)211 return static_cast<int>(result); 212 } 213 214 int CSSPrimitiveValue::computeLengthInt(RenderStyle* style, double multiplier) 214 215 { 215 216 double result = multiplier * computeLengthFloat(style); 216 217 217 218 // This conversion is imprecise, often resulting in values of, e.g., 44.99998. We 218 219 // need to go ahead and round if we're really close to the next integer value. 219 220 result += result < 0 ? -0.01 : +0.01; 220 221 221 222 if (result > INT_MAX || result < INT_MIN) 222 223 return 0; 223 return (int)result;224 return static_cast<int>(result); 224 225 } 225 226 226 227 const int intMaxForLength = 0x7ffffff; // max value for a 28-bit int 227 const int intMinForLength = (-0x7ffffff -1); // min value for a 28-bit int228 const int intMinForLength = (-0x7ffffff - 1); // min value for a 28-bit int 228 229 229 230 // Lengths expect an int that is only 28-bits, so we have to check for a different overflow. 230 int CSSPrimitiveValue::computeLengthIntForLength(RenderStyle *style)231 int CSSPrimitiveValue::computeLengthIntForLength(RenderStyle* style) 231 232 { 232 233 double result = computeLengthFloat(style); 233 234 234 235 // This conversion is imprecise, often resulting in values of, e.g., 44.99998. We 235 236 // need to go ahead and round if we're really close to the next integer value. 236 237 result += result < 0 ? -0.01 : +0.01; 237 238 238 239 if (result > intMaxForLength || result < intMinForLength) 239 240 return 0; 240 return (int)result;241 return static_cast<int>(result); 241 242 } 242 243 243 244 // Lengths expect an int that is only 28-bits, so we have to check for a different overflow. 244 int CSSPrimitiveValue::computeLengthIntForLength(RenderStyle *style, double multiplier)245 int CSSPrimitiveValue::computeLengthIntForLength(RenderStyle* style, double multiplier) 245 246 { 246 247 double result = multiplier * computeLengthFloat(style); 247 248 248 249 // This conversion is imprecise, often resulting in values of, e.g., 44.99998. We 249 250 // need to go ahead and round if we're really close to the next integer value. 250 251 result += result < 0 ? -0.01 : +0.01; 251 252 252 253 if (result > intMaxForLength || result < intMinForLength) 253 254 return 0; 254 return (int)result;255 } 256 257 short CSSPrimitiveValue::computeLengthShort(RenderStyle *style)255 return static_cast<int>(result); 256 } 257 258 short CSSPrimitiveValue::computeLengthShort(RenderStyle* style) 258 259 { 259 260 double result = computeLengthFloat(style); 260 261 261 262 // This conversion is imprecise, often resulting in values of, e.g., 44.99998. We 262 263 // need to go ahead and round if we're really close to the next integer value. 263 264 result += result < 0 ? -0.01 : +0.01; 264 265 265 266 if (result > SHRT_MAX || result < SHRT_MIN) 266 267 return 0; 267 return (short)result;268 } 269 270 short CSSPrimitiveValue::computeLengthShort(RenderStyle *style, double multiplier)268 return static_cast<short>(result); 269 } 270 271 short CSSPrimitiveValue::computeLengthShort(RenderStyle* style, double multiplier) 271 272 { 272 273 double result = multiplier * computeLengthFloat(style); 273 274 274 275 // This conversion is imprecise, often resulting in values of, e.g., 44.99998. We 275 276 // need to go ahead and round if we're really close to the next integer value. 276 277 result += result < 0 ? -0.01 : +0.01; 277 278 278 279 if (result > SHRT_MAX || result < SHRT_MIN) 279 280 return 0; 280 return (short)result;281 } 282 283 double CSSPrimitiveValue::computeLengthFloat(RenderStyle *style, bool applyZoomFactor)281 return static_cast<short>(result); 282 } 283 284 double CSSPrimitiveValue::computeLengthFloat(RenderStyle* style, bool applyZoomFactor) 284 285 { 285 286 unsigned short type = primitiveType(); … … 288 289 // At high DPI, we may scale a CSS pixel, but the ratio of the CSS pixel to the so-called 289 290 // "absolute" CSS length units like inch and pt is always fixed and never changes. 290 double cssPixelsPerInch = 96.; 291 292 double factor = 1.; 293 switch(type) { 294 case CSS_EMS: 295 factor = applyZoomFactor ? 296 style->fontDescription().computedSize() : 297 style->fontDescription().specifiedSize(); 298 break; 299 case CSS_EXS: { 300 // FIXME: We have a bug right now where the zoom will be applied multiple times to EX units. 301 // We really need to compute EX using fontMetrics for the original specifiedSize and not use 302 // our actual constructed rendering font. 303 factor = style->font().xHeight(); 304 break; 305 } 306 case CSS_PX: 307 break; 308 case CSS_CM: 309 factor = cssPixelsPerInch/2.54; // (2.54 cm/in) 310 break; 311 case CSS_MM: 312 factor = cssPixelsPerInch/25.4; 313 break; 314 case CSS_IN: 315 factor = cssPixelsPerInch; 316 break; 317 case CSS_PT: 318 factor = cssPixelsPerInch/72.; 319 break; 320 case CSS_PC: 321 // 1 pc == 12 pt 322 factor = cssPixelsPerInch*12./72.; 323 break; 324 default: 325 return -1; 291 const double cssPixelsPerInch = 96.0; 292 293 double factor = 1.0; 294 switch (type) { 295 case CSS_EMS: 296 factor = applyZoomFactor ? style->fontDescription().computedSize() : style->fontDescription().specifiedSize(); 297 break; 298 case CSS_EXS: 299 // FIXME: We have a bug right now where the zoom will be applied multiple times to EX units. 300 // We really need to compute EX using fontMetrics for the original specifiedSize and not use 301 // our actual constructed rendering font. 302 factor = style->font().xHeight(); 303 break; 304 case CSS_PX: 305 break; 306 case CSS_CM: 307 factor = cssPixelsPerInch / 2.54; // (2.54 cm/in) 308 break; 309 case CSS_MM: 310 factor = cssPixelsPerInch / 25.4; 311 break; 312 case CSS_IN: 313 factor = cssPixelsPerInch; 314 break; 315 case CSS_PT: 316 factor = cssPixelsPerInch / 72.0; 317 break; 318 case CSS_PC: 319 // 1 pc == 12 pt 320 factor = cssPixelsPerInch * 12.0 / 72.0; 321 break; 322 default: 323 return -1.0; 326 324 } 327 325 … … 329 327 } 330 328 331 void CSSPrimitiveValue::setFloatValue( 329 void CSSPrimitiveValue::setFloatValue(unsigned short unitType, double floatValue, ExceptionCode& ec) 332 330 { 333 331 ec = 0; 334 335 // ###check if property supports this type332 333 // FIXME: check if property supports this type 336 334 if (m_type > CSS_DIMENSION) { 337 335 ec = SYNTAX_ERR; 338 336 return; 339 337 } 340 338 341 339 cleanup(); 342 340 … … 348 346 double scaleFactorForConversion(unsigned short unitType) 349 347 { 350 double cssPixelsPerInch = 96.0; 348 const double cssPixelsPerInch = 96.0; 349 351 350 double factor = 1.0; 352 353 switch(unitType) { 351 switch (unitType) { 354 352 case CSSPrimitiveValue::CSS_PX: 355 353 break; … … 372 370 break; 373 371 } 374 372 375 373 return factor; 376 374 } … … 380 378 if (unitType == m_type || unitType < CSS_PX || unitType > CSS_PC) 381 379 return m_value.num; 382 380 383 381 double convertedValue = m_value.num; 384 382 385 383 // First convert the value from m_type into CSSPixels 386 384 double factor = scaleFactorForConversion(m_type); 387 385 convertedValue *= factor; 388 386 389 387 // Now convert from CSSPixels to the specified unitType 390 388 factor = scaleFactorForConversion(unitType); 391 389 convertedValue /= factor; 392 390 393 391 return convertedValue; 394 392 } 395 393 396 void CSSPrimitiveValue::setStringValue( unsigned short stringType, const String &stringValue, ExceptionCode& ec)394 void CSSPrimitiveValue::setStringValue(unsigned short stringType, const String& stringValue, ExceptionCode& ec) 397 395 { 398 396 ec = 0; 399 397 400 398 //if(m_type < CSS_STRING) throw DOMException(INVALID_ACCESS_ERR); 401 399 //if(m_type > CSS_ATTR) throw DOMException(INVALID_ACCESS_ERR); … … 404 402 return; 405 403 } 406 404 407 405 cleanup(); 408 406 … … 412 410 m_type = stringType; 413 411 } 414 // ###parse ident412 // FIXME: parse ident 415 413 } 416 414 … … 428 426 break; 429 427 } 430 428 431 429 return String(); 432 430 } … … 437 435 } 438 436 439 bool CSSPrimitiveValue::parseString( const String &/*string*/, bool)440 { 441 // ###437 bool CSSPrimitiveValue::parseString(const String& /*string*/, bool /*strict*/) 438 { 439 // FIXME 442 440 return false; 443 441 } … … 445 443 int CSSPrimitiveValue::getIdent() 446 444 { 447 if(m_type != CSS_IDENT) return 0; 445 if (m_type != CSS_IDENT) 446 return 0; 448 447 return m_value.ident; 449 448 } … … 451 450 String CSSPrimitiveValue::cssText() const 452 451 { 453 // ###return the original value instead of a generated one (e.g. color452 // FIXME: return the original value instead of a generated one (e.g. color 454 453 // name if it was specified) - check what spec says about this 455 454 String text; 456 switch ( m_type) {455 switch (m_type) { 457 456 case CSS_UNKNOWN: 458 // ###457 // FIXME 459 458 break; 460 459 case CSS_NUMBER: … … 510 509 break; 511 510 case CSS_DIMENSION: 512 // ###511 // FIXME 513 512 break; 514 513 case CSS_STRING: … … 522 521 break; 523 522 case CSS_ATTR: 524 // ###523 // FIXME 525 524 break; 526 525 case CSS_COUNTER: … … 541 540 case CSS_RGBCOLOR: { 542 541 Color color(m_value.rgbcolor); 543 if (color.alpha() < 0xFF) 544 text = "rgba("; 545 else 546 text = "rgb("; 542 text = (color.alpha() < 0xFF) ? "rgba(" : "rgb("; 547 543 text += String::number(color.red()) + ", "; 548 544 text += String::number(color.green()) + ", "; 549 545 text += String::number(color.blue()); 550 546 if (color.alpha() < 0xFF) 551 text += ", " + String::number( (float)color.alpha() / 0xFF);547 text += ", " + String::number(static_cast<float>(color.alpha()) / 0xFF); 552 548 text += ")"; 553 549 break; … … 581 577 } 582 578 583 } 579 } // namespace WebCore -
trunk/WebCore/css/CSSPrimitiveValue.h
r17405 r18850 21 21 */ 22 22 23 #ifndef CSSPrimitiveValue_ H24 #define CSSPrimitiveValue_ H23 #ifndef CSSPrimitiveValue_h 24 #define CSSPrimitiveValue_h 25 25 26 26 #include "CSSValue.h" … … 38 38 typedef int ExceptionCode; 39 39 40 class CSSPrimitiveValue : public CSSValue 41 { 40 class CSSPrimitiveValue : public CSSValue { 42 41 public: 43 42 enum UnitTypes { … … 118 117 void setStringValue(unsigned short stringType, const String& stringValue, ExceptionCode&); 119 118 String getStringValue() const; 120 121 Counter* getCounterValue () const {122 return m_type != CSS_COUNTER ? 0 : m_value.counter;123 }124 119 125 RectImpl* getRectValue () const { 126 return m_type != CSS_RECT ? 0 : m_value.rect; 127 } 128 129 unsigned getRGBColorValue() const { 130 return m_type != CSS_RGBCOLOR ? 0 : m_value.rgbcolor; 131 } 132 133 Pair* getPairValue() const { 134 return m_type != CSS_PAIR ? 0 : m_value.pair; 135 } 120 Counter* getCounterValue () const { return m_type != CSS_COUNTER ? 0 : m_value.counter; } 121 RectImpl* getRectValue () const { return m_type != CSS_RECT ? 0 : m_value.rect; } 122 unsigned getRGBColorValue() const { return m_type != CSS_RGBCOLOR ? 0 : m_value.rgbcolor; } 123 Pair* getPairValue() const { return m_type != CSS_PAIR ? 0 : m_value.pair; } 136 124 137 125 #if PLATFORM(MAC) 138 DashboardRegion *getDashboardRegionValue () const { 139 return m_type != CSS_DASHBOARD_REGION ? 0 : m_value.region; 140 } 126 DashboardRegion* getDashboardRegionValue () const { return m_type != CSS_DASHBOARD_REGION ? 0 : m_value.region; } 141 127 #endif 142 128 143 129 virtual bool isPrimitiveValue() const { return true; } 130 144 131 virtual unsigned short cssValueType() const; 145 132 … … 167 154 }; 168 155 169 } // namespace 156 } // namespace WebCore 170 157 171 #endif 158 #endif // CSSPrimitiveValue_h -
trunk/WebCore/css/CSSProperty.cpp
r14408 r18850 20 20 * Boston, MA 02111-1307, USA. 21 21 */ 22 22 23 #include "config.h" 23 24 #include "CSSProperty.h" 25 24 26 #include "PlatformString.h" 25 27 … … 34 36 } 35 37 36 bool operator==(const CSSProperty &a, const CSSProperty &b)38 bool operator==(const CSSProperty& a, const CSSProperty& b) 37 39 { 38 40 return a.m_id == b.m_id && a.m_important == b.m_important && a.m_value == b.m_value; 39 41 } 40 42 41 } 43 } // namespace WebCore -
trunk/WebCore/css/CSSProperty.h
r14408 r18850 21 21 */ 22 22 23 #ifndef CSSProperty_ H24 #define CSSProperty_ H23 #ifndef CSSProperty_h 24 #define CSSProperty_h 25 25 26 26 #include "CSSValue.h" … … 40 40 { 41 41 } 42 43 CSSProperty &operator=(const CSSProperty& o)42 43 CSSProperty& operator=(const CSSProperty& other) 44 44 { 45 m_id = o .m_id;46 m_shorthandID = o .m_shorthandID;47 m_important = o .m_important;48 m_value = o .m_value;45 m_id = other.m_id; 46 m_shorthandID = other.m_shorthandID; 47 m_important = other.m_important; 48 m_value = other.m_value; 49 49 return *this; 50 50 } 51 51 52 52 int id() const { return m_id; } 53 53 int shorthandID() const { return m_shorthandID; } 54 54 55 55 bool isImportant() const { return m_important; } 56 56 bool isImplicit() const { return m_implicit; } … … 60 60 String cssText() const; 61 61 62 friend bool operator==(const CSSProperty&, const CSSProperty&); 63 62 64 // make sure the following fits in 4 bytes. 63 65 int m_id; … … 66 68 bool m_implicit : 1; // Whether or not the property was set implicitly as the result of a shorthand. 67 69 68 friend bool operator==(const CSSProperty &, const CSSProperty &);69 70 70 RefPtr<CSSValue> m_value; 71 71 }; 72 72 73 } // namespace 73 } // namespace WebCore 74 74 75 #endif 75 #endif // CSSProperty_h -
trunk/WebCore/css/CSSQuirkPrimitiveValue.h
r14407 r18850 21 21 */ 22 22 23 #ifndef CSSQuirkPrimitiveValue_ H24 #define CSSQuirkPrimitiveValue_ H23 #ifndef CSSQuirkPrimitiveValue_h 24 #define CSSQuirkPrimitiveValue_h 25 25 26 26 #include "CSSPrimitiveValue.h" … … 32 32 // in a stylesheet. When the quirky value is used, if you're in quirks mode, the margin will 33 33 // collapse away inside a table cell. 34 class CSSQuirkPrimitiveValue : public CSSPrimitiveValue 35 { 34 class CSSQuirkPrimitiveValue : public CSSPrimitiveValue { 36 35 public: 37 36 CSSQuirkPrimitiveValue(double num, UnitTypes type) 38 : CSSPrimitiveValue(num, type) {} 37 : CSSPrimitiveValue(num, type) 38 { 39 } 39 40 40 41 virtual bool isQuirkValue() { return true; } 41 42 }; 42 43 43 } // namespace 44 } // namespace WebCore 44 45 45 #endif 46 #endif // CSSQuirkPrimitiveValue_h -
trunk/WebCore/css/CSSRuleList.cpp
r16217 r18850 21 21 * Boston, MA 02111-1307, USA. 22 22 */ 23 23 24 #include "config.h" 24 25 #include "CSSRuleList.h" … … 33 34 } 34 35 35 CSSRuleList::CSSRuleList(StyleList* l st, bool omitCharsetRules)36 CSSRuleList::CSSRuleList(StyleList* list, bool omitCharsetRules) 36 37 { 37 if (l st) {38 unsigned len = l st->length();38 if (list) { 39 unsigned len = list->length(); 39 40 for (unsigned i = 0; i < len; ++i) { 40 StyleBase* style = l st->item(i);41 StyleBase* style = list->item(i); 41 42 if (style->isRule() && !(omitCharsetRules && style->isCharsetRule())) 42 43 append(static_cast<CSSRule*>(style)); … … 58 59 rule->deref(); 59 60 else 60 ; // ### Throw INDEX_SIZE_ERR exception here (TODO)61 ; // FIXME: Throw INDEX_SIZE_ERR exception here 61 62 } 62 63 … … 73 74 } 74 75 75 // ### Should throw INDEX_SIZE_ERR exception instead! (TODO)76 // FIXME: Should throw INDEX_SIZE_ERR exception instead! 76 77 return 0; 77 78 } 78 79 79 } 80 } // namespace WebCore -
trunk/WebCore/css/CSSRuleList.h
r16217 r18850 22 22 */ 23 23 24 #ifndef CSSRuleList_ H25 #define CSSRuleList_ H24 #ifndef CSSRuleList_h 25 #define CSSRuleList_h 26 26 27 #include "DeprecatedPtrList.h" 27 28 #include "Shared.h" 28 #include "DeprecatedPtrList.h"29 29 30 30 namespace WebCore { … … 33 33 class StyleList; 34 34 35 class CSSRuleList : public Shared<CSSRuleList> 36 { 35 class CSSRuleList : public Shared<CSSRuleList> { 37 36 public: 38 37 CSSRuleList(); … … 41 40 42 41 unsigned length() const { return m_lstCSSRules.count(); } 43 CSSRule* item 42 CSSRule* item(unsigned index) { return m_lstCSSRules.at(index); } 44 43 45 44 /* not part of the DOM */ 46 unsigned insertRule (CSSRule* rule, unsigned index);47 void deleteRule 48 void append(CSSRule* rule);45 unsigned insertRule(CSSRule*, unsigned index); 46 void deleteRule(unsigned index); 47 void append(CSSRule*); 49 48 50 49 protected: … … 52 51 }; 53 52 54 } // namespace 53 } // namespace WebCore 55 54 56 #endif 55 #endif // CSSRuleList_h -
trunk/WebCore/css/CSSSelector.cpp
r18248 r18850 23 23 * Boston, MA 02111-1307, USA. 24 24 */ 25 25 26 #include "config.h" 26 27 #include "CSSSelector.h" … … 30 31 void CSSSelector::print() 31 32 { 32 if ( tagHistory)33 tagHistory->print();33 if (m_tagHistory) 34 m_tagHistory->print(); 34 35 } 35 36 … … 38 39 // FIXME: Pseudo-elements and pseudo-classes do not have the same specificity. This function 39 40 // isn't quite correct. 40 int s = (tag.localName() == starAtom ? 0 : 1); 41 switch(match) 42 { 43 case Id: 44 s += 0x10000; 45 break; 46 case Exact: 47 case Class: 48 case Set: 49 case List: 50 case Hyphen: 51 case PseudoClass: 52 case PseudoElement: 53 case Contain: 54 case Begin: 55 case End: 56 s += 0x100; 57 case None: 58 break; 41 int s = (m_tag.localName() == starAtom ? 0 : 1); 42 switch (m_match) { 43 case Id: 44 s += 0x10000; 45 break; 46 case Exact: 47 case Class: 48 case Set: 49 case List: 50 case Hyphen: 51 case PseudoClass: 52 case PseudoElement: 53 case Contain: 54 case Begin: 55 case End: 56 s += 0x100; 57 case None: 58 break; 59 59 } 60 if (tagHistory) 61 s += tagHistory->specificity(); 60 61 if (m_tagHistory) 62 s += m_tagHistory->specificity(); 63 62 64 // make sure it doesn't overflow 63 65 return s & 0xffffff; … … 66 68 void CSSSelector::extractPseudoType() const 67 69 { 68 if (m atch != PseudoClass &&match != PseudoElement)70 if (m_match != PseudoClass && m_match != PseudoElement) 69 71 return; 70 72 71 73 static AtomicString active("active"); 72 74 static AtomicString after("after"); … … 103 105 static AtomicString target("target"); 104 106 static AtomicString visited("visited"); 105 bool element = false; // pseudo-element 106 bool compat = false; // single colon compatbility mode 107 108 _pseudoType = PseudoOther; 109 if (value == active) 110 _pseudoType = PseudoActive; 111 else if (value == after) { 112 _pseudoType = PseudoAfter; 113 element = compat = true; 114 } else if (value == anyLink) 115 _pseudoType = PseudoAnyLink; 116 else if (value == autofill) 117 _pseudoType = PseudoAutofill; 118 else if (value == before) { 119 _pseudoType = PseudoBefore; 120 element = compat = true; 121 } else if (value == checked) 122 _pseudoType = PseudoChecked; 123 else if (value == fileUploadButton) { 124 _pseudoType = PseudoFileUploadButton; 125 element = true; 126 } else if (value == disabled) 127 _pseudoType = PseudoDisabled; 128 else if (value == drag) 129 _pseudoType = PseudoDrag; 130 else if (value == enabled) 131 _pseudoType = PseudoEnabled; 132 else if (value == empty) 133 _pseudoType = PseudoEmpty; 134 else if (value == firstChild) 135 _pseudoType = PseudoFirstChild; 136 else if (value == firstLetter) { 137 _pseudoType = PseudoFirstLetter; 138 element = compat = true; 139 } else if (value == firstLine) { 140 _pseudoType = PseudoFirstLine; 141 element = compat = true; 142 } else if (value == firstOfType) 143 _pseudoType = PseudoFirstOfType; 144 else if (value == focus) 145 _pseudoType = PseudoFocus; 146 else if (value == hover) 147 _pseudoType = PseudoHover; 148 else if (value == indeterminate) 149 _pseudoType = PseudoIndeterminate; 150 else if (value == link) 151 _pseudoType = PseudoLink; 152 else if (value == lang) 153 _pseudoType = PseudoLang; 154 else if (value == lastChild) 155 _pseudoType = PseudoLastChild; 156 else if (value == lastOfType) 157 _pseudoType = PseudoLastOfType; 158 else if (value == notStr) 159 _pseudoType = PseudoNot; 160 else if (value == onlyChild) 161 _pseudoType = PseudoOnlyChild; 162 else if (value == onlyOfType) 163 _pseudoType = PseudoOnlyOfType; 164 else if (value == root) 165 _pseudoType = PseudoRoot; 166 else if (value == searchCancelButton) { 167 _pseudoType = PseudoSearchCancelButton; 168 element = true; 169 } else if (value == searchDecoration) { 170 _pseudoType = PseudoSearchDecoration; 171 element = true; 172 } else if (value == searchResultsDecoration) { 173 _pseudoType = PseudoSearchResultsDecoration; 174 element = true; 175 } else if (value == searchResultsButton) { 176 _pseudoType = PseudoSearchResultsButton; 177 element = true; 178 } else if (value == selection) { 179 _pseudoType = PseudoSelection; 180 element = true; 181 } else if (value == sliderThumb) { 182 _pseudoType = PseudoSliderThumb; 183 element = true; 184 } else if (value == target) 185 _pseudoType = PseudoTarget; 186 else if (value == visited) 187 _pseudoType = PseudoVisited; 188 189 if (match == PseudoClass && element) 107 108 bool element = false; // pseudo-element 109 bool compat = false; // single colon compatbility mode 110 111 m_pseudoType = PseudoOther; 112 if (m_value == active) 113 m_pseudoType = PseudoActive; 114 else if (m_value == after) { 115 m_pseudoType = PseudoAfter; 116 element = true; 117 compat = true; 118 } else if (m_value == anyLink) 119 m_pseudoType = PseudoAnyLink; 120 else if (m_value == autofill) 121 m_pseudoType = PseudoAutofill; 122 else if (m_value == before) { 123 m_pseudoType = PseudoBefore; 124 element = true; 125 compat = true; 126 } else if (m_value == checked) 127 m_pseudoType = PseudoChecked; 128 else if (m_value == fileUploadButton) { 129 m_pseudoType = PseudoFileUploadButton; 130 element = true; 131 } else if (m_value == disabled) 132 m_pseudoType = PseudoDisabled; 133 else if (m_value == drag) 134 m_pseudoType = PseudoDrag; 135 else if (m_value == enabled) 136 m_pseudoType = PseudoEnabled; 137 else if (m_value == empty) 138 m_pseudoType = PseudoEmpty; 139 else if (m_value == firstChild) 140 m_pseudoType = PseudoFirstChild; 141 else if (m_value == firstLetter) { 142 m_pseudoType = PseudoFirstLetter; 143 element = true; 144 compat = true; 145 } else if (m_value == firstLine) { 146 m_pseudoType = PseudoFirstLine; 147 element = true; 148 compat = true; 149 } else if (m_value == firstOfType) 150 m_pseudoType = PseudoFirstOfType; 151 else if (m_value == focus) 152 m_pseudoType = PseudoFocus; 153 else if (m_value == hover) 154 m_pseudoType = PseudoHover; 155 else if (m_value == indeterminate) 156 m_pseudoType = PseudoIndeterminate; 157 else if (m_value == link) 158 m_pseudoType = PseudoLink; 159 else if (m_value == lang) 160 m_pseudoType = PseudoLang; 161 else if (m_value == lastChild) 162 m_pseudoType = PseudoLastChild; 163 else if (m_value == lastOfType) 164 m_pseudoType = PseudoLastOfType; 165 else if (m_value == notStr) 166 m_pseudoType = PseudoNot; 167 else if (m_value == onlyChild) 168 m_pseudoType = PseudoOnlyChild; 169 else if (m_value == onlyOfType) 170 m_pseudoType = PseudoOnlyOfType; 171 else if (m_value == root) 172 m_pseudoType = PseudoRoot; 173 else if (m_value == searchCancelButton) { 174 m_pseudoType = PseudoSearchCancelButton; 175 element = true; 176 } else if (m_value == searchDecoration) { 177 m_pseudoType = PseudoSearchDecoration; 178 element = true; 179 } else if (m_value == searchResultsDecoration) { 180 m_pseudoType = PseudoSearchResultsDecoration; 181 element = true; 182 } else if (m_value == searchResultsButton) { 183 m_pseudoType = PseudoSearchResultsButton; 184 element = true; 185 } else if (m_value == selection) { 186 m_pseudoType = PseudoSelection; 187 element = true; 188 } else if (m_value == sliderThumb) { 189 m_pseudoType = PseudoSliderThumb; 190 element = true; 191 } else if (m_value == target) 192 m_pseudoType = PseudoTarget; 193 else if (m_value == visited) 194 m_pseudoType = PseudoVisited; 195 196 if (m_match == PseudoClass && element) { 190 197 if (!compat) 191 _pseudoType = PseudoOther;198 m_pseudoType = PseudoOther; 192 199 else 193 m atch = PseudoElement;194 else if (match == PseudoElement && !element)195 _pseudoType = PseudoOther;196 } 197 198 bool CSSSelector::operator == (const CSSSelector &other)199 { 200 const CSSSelector *sel1 = this;201 const CSSSelector *sel2 = &other;200 m_match = PseudoElement; 201 } else if (m_match == PseudoElement && !element) 202 m_pseudoType = PseudoOther; 203 } 204 205 bool CSSSelector::operator==(const CSSSelector& other) 206 { 207 const CSSSelector* sel1 = this; 208 const CSSSelector* sel2 = &other; 202 209 203 210 while (sel1 && sel2) { 204 if (sel1-> tag != sel2->tag || sel1->attr != sel2->attr ||205 sel1->relation() != sel2->relation() || sel1->m atch != sel2->match ||206 sel1-> value != sel2->value ||211 if (sel1->m_tag != sel2->m_tag || sel1->m_attr != sel2->m_attr || 212 sel1->relation() != sel2->relation() || sel1->m_match != sel2->m_match || 213 sel1->m_value != sel2->m_value || 207 214 sel1->pseudoType() != sel2->pseudoType() || 208 sel1-> argument != sel2->argument)215 sel1->m_argument != sel2->m_argument) 209 216 return false; 210 sel1 = sel1-> tagHistory;211 sel2 = sel2-> tagHistory;217 sel1 = sel1->m_tagHistory; 218 sel2 = sel2->m_tagHistory; 212 219 } 220 213 221 if (sel1 || sel2) 214 222 return false; 223 215 224 return true; 216 225 } … … 221 230 String str; 222 231 const CSSSelector* cs = this; 223 const AtomicString& localName = cs->tag.localName(); 224 if (cs->match == CSSSelector::None || localName != starAtom) 232 const AtomicString& localName = cs->m_tag.localName(); 233 234 if (cs->m_match == CSSSelector::None || localName != starAtom) 225 235 str = localName; 236 226 237 while (true) { 227 if (cs->m atch == CSSSelector::Id) {238 if (cs->m_match == CSSSelector::Id) { 228 239 str += "#"; 229 str += cs-> value;230 } else if (cs->m atch == CSSSelector::Class) {240 str += cs->m_value; 241 } else if (cs->m_match == CSSSelector::Class) { 231 242 str += "."; 232 str += cs-> value;233 } else if (cs->m atch == CSSSelector::PseudoClass) {243 str += cs->m_value; 244 } else if (cs->m_match == CSSSelector::PseudoClass) { 234 245 str += ":"; 235 str += cs-> value;236 } else if (cs->m atch == CSSSelector::PseudoElement) {246 str += cs->m_value; 247 } else if (cs->m_match == CSSSelector::PseudoElement) { 237 248 str += "::"; 238 str += cs-> value;249 str += cs->m_value; 239 250 } else if (cs->hasAttribute()) { 240 251 // FIXME: Add support for dumping namespaces. 241 String attrName = cs-> attr.localName();252 String attrName = cs->m_attr.localName(); 242 253 str += "["; 243 254 str += attrName; 244 switch (cs->m atch) {255 switch (cs->m_match) { 245 256 case CSSSelector::Exact: 246 257 str += "="; … … 268 279 break; 269 280 } 270 if (cs->m atch != CSSSelector::Set) {281 if (cs->m_match != CSSSelector::Set) { 271 282 str += "\""; 272 str += cs-> value;283 str += cs->m_value; 273 284 str += "\"]"; 274 285 } 275 286 } 276 if (cs->relation() != CSSSelector::SubSelector || !cs-> tagHistory)287 if (cs->relation() != CSSSelector::SubSelector || !cs->m_tagHistory) 277 288 break; 278 cs = cs-> tagHistory;289 cs = cs->m_tagHistory; 279 290 } 280 if (cs->tagHistory) { 281 String tagHistoryText = cs->tagHistory->selectorText(); 291 292 if (cs->m_tagHistory) { 293 String tagHistoryText = cs->m_tagHistory->selectorText(); 282 294 if (cs->relation() == CSSSelector::DirectAdjacent) 283 295 str = tagHistoryText + " + " + str; … … 286 298 else if (cs->relation() == CSSSelector::Child) 287 299 str = tagHistoryText + " > " + str; 288 else // Descendant 300 else 301 // Descendant 289 302 str = tagHistoryText + " " + str; 290 303 } 304 291 305 return str; 292 306 } 293 307 294 } 308 } // namespace WebCore -
trunk/WebCore/css/CSSSelector.h
r18248 r18850 22 22 */ 23 23 24 #ifndef CSSSelector_ H25 #define CSSSelector_ H24 #ifndef CSSSelector_h 25 #define CSSSelector_h 26 26 27 27 #include "QualifiedName.h" … … 29 29 namespace WebCore { 30 30 31 // this class represents a selector for a StyleRule 32 class CSSSelector 33 { 31 // this class represents a selector for a StyleRule 32 class CSSSelector { 34 33 public: 35 34 CSSSelector() 36 : tagHistory(0)37 , simpleSelector(0)38 , nextSelector(0)39 , argument(nullAtom)40 , attr(anyQName())41 , tag(anyQName())35 : m_tagHistory(0) 36 , m_simpleSelector(0) 37 , m_nextSelector(0) 38 , m_argument(nullAtom) 39 , m_attr(anyQName()) 40 , m_tag(anyQName()) 42 41 , m_relation(Descendant) 43 , match(None) 44 , pseudoId(0) 45 , _pseudoType(PseudoNotParsed) 46 {} 47 48 CSSSelector(const QualifiedName& qName) 49 : tagHistory(0) 50 , simpleSelector(0) 51 , nextSelector(0) 52 , argument(nullAtom) 53 , attr(anyQName()) 54 , tag(qName) 55 , m_relation(Descendant) 56 , match(None) 57 , pseudoId(0) 58 , _pseudoType(PseudoNotParsed) 59 {} 60 61 ~CSSSelector() { 62 delete tagHistory; 63 delete simpleSelector; 64 delete nextSelector; 42 , m_match(None) 43 , m_pseudoType(PseudoNotParsed) 44 { 65 45 } 66 46 67 void append(CSSSelector* n) { 47 CSSSelector(const QualifiedName& qName) 48 : m_tagHistory(0) 49 , m_simpleSelector(0) 50 , m_nextSelector(0) 51 , m_argument(nullAtom) 52 , m_attr(anyQName()) 53 , m_tag(qName) 54 , m_relation(Descendant) 55 , m_match(None) 56 , m_pseudoType(PseudoNotParsed) 57 { 58 } 59 60 ~CSSSelector() 61 { 62 delete m_tagHistory; 63 delete m_simpleSelector; 64 delete m_nextSelector; 65 } 66 67 void append(CSSSelector* n) 68 { 68 69 CSSSelector* end = this; 69 while (end-> nextSelector)70 end = end-> nextSelector;71 end-> nextSelector = n;70 while (end->m_nextSelector) 71 end = end->m_nextSelector; 72 end->m_nextSelector = n; 72 73 } 73 CSSSelector* next() { return nextSelector; } 74 75 CSSSelector* next() { return m_nextSelector; } 74 76 75 77 /** … … 84 86 85 87 // checks if the 2 selectors (including sub selectors) agree. 86 bool operator 88 bool operator==(const CSSSelector&); 87 89 88 90 // tag == -1 means apply to all elements (Selector = *) … … 155 157 PseudoType pseudoType() const 156 158 { 157 if ( _pseudoType == PseudoNotParsed)159 if (m_pseudoType == PseudoNotParsed) 158 160 extractPseudoType(); 159 return static_cast<PseudoType>( _pseudoType);161 return static_cast<PseudoType>(m_pseudoType); 160 162 } 161 163 162 bool hasTag() const { return tag != anyQName(); }163 bool hasAttribute() const { return attr != anyQName(); }164 bool hasTag() const { return m_tag != anyQName(); } 165 bool hasAttribute() const { return m_attr != anyQName(); } 164 166 165 mutable AtomicString value;166 CSSSelector* tagHistory;167 CSSSelector* simpleSelector; // Used for :not.168 CSSSelector* nextSelector; // used for ,-chained selectors169 AtomicString argument; // Used for :contains, :lang and :nth-*170 171 QualifiedName attr;172 QualifiedName tag;173 174 167 Relation relation() const { return static_cast<Relation>(m_relation); } 175 168 176 unsigned m_relation : 3; // enum Relation 177 mutable unsigned match : 4; // enum Match 178 unsigned pseudoId : 4; 179 mutable unsigned _pseudoType : 6; // PseudoType 169 mutable AtomicString m_value; 170 CSSSelector* m_tagHistory; 171 CSSSelector* m_simpleSelector; // Used for :not. 172 CSSSelector* m_nextSelector; // used for ,-chained selectors 173 AtomicString m_argument; // Used for :contains, :lang and :nth-* 174 175 QualifiedName m_attr; 176 QualifiedName m_tag; 177 178 unsigned m_relation : 3; // enum Relation 179 mutable unsigned m_match : 4; // enum Match 180 mutable unsigned m_pseudoType : 6; // PseudoType 180 181 181 182 private: 182 183 void extractPseudoType() const; 183 184 }; 184 }185 185 186 #endif 186 } // namespace WebCore 187 188 #endif // CSSSelector_h -
trunk/WebCore/css/CSSStyleDeclaration.cpp
r17818 r18850 20 20 * Boston, MA 02111-1307, USA. 21 21 */ 22 22 23 #include "config.h" 23 24 #include "CSSStyleDeclaration.h" … … 53 54 } 54 55 55 int id= getPropertyID(buffer, len);56 int propID = getPropertyID(buffer, len); 56 57 #ifdef SVG_SUPPORT 57 if ( id == 0)58 id= SVG::getSVGCSSPropertyID(buffer, len);58 if (!propID) 59 propID = SVG::getSVGCSSPropertyID(buffer, len); 59 60 #endif 60 return id;61 return propID; 61 62 } 62 63 … … 87 88 } 88 89 89 String CSSStyleDeclaration::getPropertyPriority(const String &propertyName)90 String CSSStyleDeclaration::getPropertyPriority(const String& propertyName) 90 91 { 91 92 int propID = propertyID(propertyName); … … 95 96 } 96 97 97 String CSSStyleDeclaration::getPropertyShorthand(const String &propertyName)98 String CSSStyleDeclaration::getPropertyShorthand(const String& propertyName) 98 99 { 99 100 int propID = propertyID(propertyName); … … 106 107 } 107 108 108 bool CSSStyleDeclaration::isPropertyImplicit(const String &propertyName)109 bool CSSStyleDeclaration::isPropertyImplicit(const String& propertyName) 109 110 { 110 111 int propID = propertyID(propertyName); … … 126 127 { 127 128 int propID = propertyID(propertyName); 128 if (!propID) // set exception? 129 if (!propID) 130 // FIXME: set exception? 129 131 return; 130 132 bool important = priority.find("important", 0, false) != -1; … … 140 142 } 141 143 142 bool CSSStyleDeclaration::isPropertyName(const String &propertyName)144 bool CSSStyleDeclaration::isPropertyName(const String& propertyName) 143 145 { 144 146 return propertyID(propertyName); 145 147 } 146 148 147 CSSRule *CSSStyleDeclaration::parentRule() const149 CSSRule* CSSStyleDeclaration::parentRule() const 148 150 { 149 return (parent() && parent()->isRule()) ? static_cast<CSSRule 151 return (parent() && parent()->isRule()) ? static_cast<CSSRule*>(parent()) : 0; 150 152 } 151 153 152 void CSSStyleDeclaration::diff(CSSMutableStyleDeclaration *style) const154 void CSSStyleDeclaration::diff(CSSMutableStyleDeclaration* style) const 153 155 { 154 156 if (!style) … … 168 170 } 169 171 170 PassRefPtr<CSSMutableStyleDeclaration> CSSStyleDeclaration::copyPropertiesInSet(const int *set, unsigned length) const172 PassRefPtr<CSSMutableStyleDeclaration> CSSStyleDeclaration::copyPropertiesInSet(const int* set, unsigned length) const 171 173 { 172 174 DeprecatedValueList<CSSProperty> list; … … 179 181 } 180 182 181 } 183 } // namespace WebCore -
trunk/WebCore/css/CSSStyleDeclaration.h
r14700 r18850 21 21 */ 22 22 23 #ifndef CSSStyleDeclaration_ H24 #define CSSStyleDeclaration_ H23 #ifndef CSSStyleDeclaration_h 24 #define CSSStyleDeclaration_h 25 25 26 26 #include "StyleBase.h" … … 82 82 }; 83 83 84 } // namespace 84 } // namespace WebCore 85 85 86 #endif 86 #endif // CSSStyleDeclaration_h -
trunk/WebCore/css/Counter.h
r18637 r18850 21 21 */ 22 22 23 #ifndef Counter_ H24 #define Counter_ H23 #ifndef Counter_h 24 #define Counter_h 25 25 26 26 #include "CSSPrimitiveValue.h" … … 33 33 class Counter : public Shared<Counter> { 34 34 public: 35 Counter(PassRefPtr<CSSPrimitiveValue> identifier, PassRefPtr<CSSPrimitiveValue> listStyle, 36 PassRefPtr<CSSPrimitiveValue> separator) 37 : m_identifier(identifier), m_listStyle(listStyle), m_separator(separator) { } 35 Counter(PassRefPtr<CSSPrimitiveValue> identifier, PassRefPtr<CSSPrimitiveValue> listStyle, PassRefPtr<CSSPrimitiveValue> separator) 36 : m_identifier(identifier) 37 , m_listStyle(listStyle) 38 , m_separator(separator) 39 { 40 } 38 41 39 42 String identifier() const { return m_identifier ? m_identifier->getStringValue() : String(); } … … 41 44 String separator() const { return m_separator ? m_separator->getStringValue() : String(); } 42 45 43 int listStyleNumber() const { return m_listStyle ? (int) m_listStyle->getFloatValue() : 0; }44 46 int listStyleNumber() const { return m_listStyle ? static_cast<int>(m_listStyle->getFloatValue()) : 0; } 47 45 48 void setIdentifier(PassRefPtr<CSSPrimitiveValue> identifier) { m_identifier = identifier; } 46 49 void setListStyle(PassRefPtr<CSSPrimitiveValue> listStyle) { m_listStyle = listStyle; } 47 50 void setSeparator(PassRefPtr<CSSPrimitiveValue> separator) { m_separator = separator; } 48 51 49 52 protected: 50 53 RefPtr<CSSPrimitiveValue> m_identifier; // String 51 54 RefPtr<CSSPrimitiveValue> m_listStyle; // int 52 55 RefPtr<CSSPrimitiveValue> m_separator; // String 53 56 }; 54 57 55 } // namespace58 } // namespace WebCore 56 59 57 #endif 60 #endif // Counter_h -
trunk/WebCore/css/csshelper.cpp
r14273 r18850 43 43 --l; 44 44 } 45 while (l > 0 && (*i)[o +l-1] <= ' ')45 while (l > 0 && (*i)[o + l - 1] <= ' ') 46 46 --l; 47 47 … … 60 60 --l; 61 61 } 62 while (l > 0 && (*i)[o +l-1] <= ' ')62 while (l > 0 && (*i)[o + l - 1] <= ' ') 63 63 --l; 64 64 65 if (l >= 2 && (*i)[o] == (*i)[o +l-1] && ((*i)[o] == '\'' || (*i)[o] == '\"')) {65 if (l >= 2 && (*i)[o] == (*i)[o + l - 1] && ((*i)[o] == '\'' || (*i)[o] == '\"')) { 66 66 o++; 67 67 l -= 2; … … 72 72 --l; 73 73 } 74 while (l > 0 && (*i)[o +l-1] <= ' ')74 while (l > 0 && (*i)[o + l - 1] <= ' ') 75 75 --l; 76 76 … … 87 87 } 88 88 89 } 89 } // namespace WebCore -
trunk/WebCore/css/csshelper.h
r12953 r18850 21 21 */ 22 22 23 #ifndef css _helper_h24 #define css _helper_h23 #ifndef csshelper_h 24 #define csshelper_h 25 25 26 26 namespace WebCore { … … 31 31 * mostly just removes the url("...") brace 32 32 */ 33 String parseURL(const String &url);33 String parseURL(const String& url); 34 34 35 } 35 } // namespace WebCore 36 36 37 #endif 37 #endif // csshelper_h -
trunk/WebCore/css/cssparser.h
r18722 r18850 21 21 */ 22 22 23 #ifndef CSS_cssparser_h_24 #define CSS_cssparser_h_23 #ifndef cssparser_h 24 #define cssparser_h 25 25 26 26 #include "AtomicString.h" 27 27 #include "Color.h" 28 #include "MediaQuery.h" 28 29 #include <wtf/HashSet.h> 29 30 #include <wtf/Vector.h> 30 #include "MediaQuery.h"31 31 32 32 namespace WebCore { … … 43 43 class Document; 44 44 class MediaList; 45 class MediaList; 46 class MediaQueryExp; 45 47 class StyleBase; 46 48 class StyleList; 47 class MediaList; 48 class MediaQueryExp; 49 49 struct Function; 50 50 51 51 struct ParseString { 52 52 UChar* characters; 53 53 int length; 54 54 55 55 void lower(); 56 56 }; 57 57 58 struct Function;59 60 58 struct Value { 61 59 int id; … … 76 74 77 75 DeprecatedString deprecatedString(const ParseString&); 78 static inline String domString(const ParseString& ps) { 76 77 static inline String domString(const ParseString& ps) 78 { 79 79 return String(ps.characters, ps.length); 80 80 } 81 static inline AtomicString atomicString(const ParseString& ps) { 81 82 static inline AtomicString atomicString(const ParseString& ps) 83 { 82 84 return AtomicString(ps.characters, ps.length); 83 85 } … … 87 89 ValueList() : m_current(0) { } 88 90 ~ValueList(); 91 89 92 void addValue(const Value& v) { m_values.append(v); } 90 93 unsigned size() const { return m_values.size(); } 91 94 Value* current() { return m_current < m_values.size() ? &m_values[m_current] : 0; } 92 95 Value* next() { ++m_current; return current(); } 96 93 97 private: 94 98 Vector<Value, 16> m_values; … … 102 106 ~Function() { delete args; } 103 107 }; 104 105 class CSSParser 106 { 108 109 class CSSParser { 107 110 public: 108 111 CSSParser(bool strictParsing = true); … … 111 114 void parseSheet(CSSStyleSheet*, const String&); 112 115 PassRefPtr<CSSRule> parseRule(CSSStyleSheet*, const String&); 113 bool parseValue(CSSMutableStyleDeclaration*, int id, const String&, bool important);116 bool parseValue(CSSMutableStyleDeclaration*, int propId, const String&, bool important); 114 117 static RGBA32 parseColor(const String&, bool strict = false); 115 118 bool parseColor(CSSMutableStyleDeclaration*, const String&); … … 133 136 CSSValue* parseBackgroundImage(); 134 137 CSSValue* parseBackgroundPositionXY(bool& xFound, bool& yFound); 135 void parseBackgroundPosition(CSSValue*& value1, CSSValue*& value2);138 void parseBackgroundPosition(CSSValue*&, CSSValue*&); 136 139 CSSValue* parseBackgroundSize(); 137 140 138 bool parseBackgroundProperty(int propId, int& propId1, int& propId2, CSSValue*& retValue1, CSSValue*& retValue2);141 bool parseBackgroundProperty(int propId, int& propId1, int& propId2, CSSValue*&, CSSValue*&); 139 142 bool parseBackgroundShorthand(bool important); 140 143 141 144 void addBackgroundValue(CSSValue*& lval, CSSValue* rval); 142 145 143 146 #if PLATFORM(MAC) 144 147 bool parseDashboardRegions(int propId, bool important); … … 146 149 147 150 bool parseShape(int propId, bool important); 151 148 152 bool parseFont(bool important); 153 CSSValueList* parseFontFamily(); 154 149 155 bool parseCounter(int propId, int defaultValue, bool important); 150 CSSValueList* parseFontFamily(); 156 PassRefPtr<CSSValue> parseCounterContent(ValueList* args, bool counters); 157 151 158 bool parseColorParameters(Value*, int* colorValues, bool parseAlpha); 152 159 bool parseHSLParameters(Value*, double* colorValues, bool parseAlpha); 153 160 CSSPrimitiveValue* parseColor(Value* = 0); 154 161 bool parseColorFromValue(Value*, RGBA32&, bool = false); 155 PassRefPtr<CSSValue> parseCounterContent(ValueList* args, bool counters); 156 162 163 static bool parseColor(const String&, RGBA32& rgb, bool strict); 164 157 165 #ifdef SVG_SUPPORT 158 166 bool parseSVGValue(int propId, bool important); … … 161 169 CSSValue* parseSVGStrokeDasharray(); 162 170 #endif 163 164 static bool parseColor(const String&, RGBA32& rgb, bool strict);165 171 166 172 // CSS3 Parsing Routines (for properties specific to CSS3) … … 206 212 int numParsedProperties; 207 213 int maxParsedProperties; 208 214 209 215 int m_inParseShorthand; 210 216 int m_currentShorthand; … … 264 270 265 271 friend inline Units operator|(Units a, Units b) 266 { return static_cast<Units>(static_cast<unsigned>(a) | static_cast<unsigned>(b)); } 272 { 273 return static_cast<Units>(static_cast<unsigned>(a) | static_cast<unsigned>(b)); 274 } 267 275 268 276 static bool validUnit(Value*, Units, bool strict); 269 277 }; 270 278 271 } // namespace 272 273 #endif 279 } // namespace WebCore 280 281 #endif // cssparser_h -
trunk/WebCore/css/cssstyleselector.cpp
r18838 r18850 432 432 CSSStyleRule* rule = d->rule(); 433 433 const AtomicString& localName = element->localName(); 434 const AtomicString& selectorLocalName = d->selector()-> tag.localName();434 const AtomicString& selectorLocalName = d->selector()->m_tag.localName(); 435 435 if ((localName == selectorLocalName || selectorLocalName == starAtom) && checkSelector(d->selector(), element)) { 436 436 // If the rule has no properties to apply, then ignore it. … … 1217 1217 // to apply the rules only to links. 1218 1218 bool onlyHoverActive = (!sel->hasTag() && 1219 (sel->m atch == CSSSelector::PseudoClass &&1219 (sel->m_match == CSSSelector::PseudoClass && 1220 1220 (sel->pseudoType() == CSSSelector::PseudoHover || 1221 1221 sel->pseudoType() == CSSSelector::PseudoActive))); … … 1230 1230 // check the subselectors 1231 1231 CSSSelector::Relation relation = sel->relation(); 1232 while((sel = sel-> tagHistory)) {1232 while((sel = sel->m_tagHistory)) { 1233 1233 if (!n->isElementNode()) 1234 1234 return false; … … 1285 1285 { 1286 1286 if (onlyHoverActive) 1287 onlyHoverActive = (sel->m atch == CSSSelector::PseudoClass &&1287 onlyHoverActive = (sel->m_match == CSSSelector::PseudoClass && 1288 1288 (sel->pseudoType() == CSSSelector::PseudoHover || 1289 1289 sel->pseudoType() == CSSSelector::PseudoActive)); … … 1329 1329 const AtomicString& localName = e->localName(); 1330 1330 const AtomicString& ns = e->namespaceURI(); 1331 const AtomicString& selLocalName = sel-> tag.localName();1332 const AtomicString& selNS = sel-> tag.namespaceURI();1331 const AtomicString& selLocalName = sel->m_tag.localName(); 1332 const AtomicString& selNS = sel->m_tag.namespaceURI(); 1333 1333 1334 1334 if ((selLocalName != starAtom && localName != selLocalName) || … … 1338 1338 1339 1339 if (sel->hasAttribute()) { 1340 if (sel->m atch == CSSSelector::Class) {1340 if (sel->m_match == CSSSelector::Class) { 1341 1341 if (!e->hasClass()) 1342 1342 return false; 1343 1343 for (const AtomicStringList* c = e->getClassList(); c; c = c->next()) 1344 if (c->string() == sel-> value)1344 if (c->string() == sel->m_value) 1345 1345 return true; 1346 1346 return false; 1347 1347 } 1348 else if (sel->m atch == CSSSelector::Id)1349 return e->hasID() && e->getIDAttribute() == sel-> value;1350 else if (style && (e != element || !styledElement || (!styledElement->isMappedAttribute(sel-> attr) && sel->attr != typeAttr && sel->attr != readonlyAttr))) {1348 else if (sel->m_match == CSSSelector::Id) 1349 return e->hasID() && e->getIDAttribute() == sel->m_value; 1350 else if (style && (e != element || !styledElement || (!styledElement->isMappedAttribute(sel->m_attr) && sel->m_attr != typeAttr && sel->m_attr != readonlyAttr))) { 1351 1351 style->setAffectedByAttributeSelectors(); // Special-case the "type" and "readonly" attributes so input form controls can share style. 1352 m_selectorAttrs.add(sel-> attr.localName().impl());1353 } 1354 1355 const AtomicString& value = e->getAttribute(sel-> attr);1352 m_selectorAttrs.add(sel->m_attr.localName().impl()); 1353 } 1354 1355 const AtomicString& value = e->getAttribute(sel->m_attr); 1356 1356 if (value.isNull()) 1357 1357 return false; // attribute is not set 1358 1358 1359 switch(sel->m atch) {1359 switch(sel->m_match) { 1360 1360 case CSSSelector::Exact: 1361 if ((isXMLDoc && sel-> value != value) || (!isXMLDoc && !equalIgnoringCase(sel->value, value)))1361 if ((isXMLDoc && sel->m_value != value) || (!isXMLDoc && !equalIgnoringCase(sel->m_value, value))) 1362 1362 return false; 1363 1363 break; … … 1365 1365 { 1366 1366 // The selector's value can't contain a space, or it's totally bogus. 1367 if (sel-> value.contains(' '))1367 if (sel->m_value.contains(' ')) 1368 1368 return false; 1369 1369 1370 1370 int startSearchAt = 0; 1371 1371 while (true) { 1372 int foundPos = value.find(sel-> value, startSearchAt, isXMLDoc);1372 int foundPos = value.find(sel->m_value, startSearchAt, isXMLDoc); 1373 1373 if (foundPos == -1) 1374 1374 return false; 1375 1375 if (foundPos == 0 || value[foundPos-1] == ' ') { 1376 unsigned endStr = foundPos + sel-> value.length();1376 unsigned endStr = foundPos + sel->m_value.length(); 1377 1377 if (endStr == value.length() || value[endStr] == ' ') 1378 1378 break; // We found a match. … … 1385 1385 } 1386 1386 case CSSSelector::Contain: 1387 if (!value.contains(sel-> value, isXMLDoc))1387 if (!value.contains(sel->m_value, isXMLDoc)) 1388 1388 return false; 1389 1389 break; 1390 1390 case CSSSelector::Begin: 1391 if (!value.startsWith(sel-> value, isXMLDoc))1391 if (!value.startsWith(sel->m_value, isXMLDoc)) 1392 1392 return false; 1393 1393 break; 1394 1394 case CSSSelector::End: 1395 if (!value.endsWith(sel-> value, isXMLDoc))1395 if (!value.endsWith(sel->m_value, isXMLDoc)) 1396 1396 return false; 1397 1397 break; 1398 1398 case CSSSelector::Hyphen: 1399 if (value.length() < sel-> value.length())1399 if (value.length() < sel->m_value.length()) 1400 1400 return false; 1401 if (!value.startsWith(sel-> value, isXMLDoc))1401 if (!value.startsWith(sel->m_value, isXMLDoc)) 1402 1402 return false; 1403 1403 // It they start the same, check for exact match or following '-': 1404 if (value.length() != sel-> value.length() && value[sel->value.length()] != '-')1404 if (value.length() != sel->m_value.length() && value[sel->m_value.length()] != '-') 1405 1405 return false; 1406 1406 break; … … 1411 1411 } 1412 1412 } 1413 if(sel->m atch == CSSSelector::PseudoClass || sel->match == CSSSelector::PseudoElement)1413 if(sel->m_match == CSSSelector::PseudoClass || sel->m_match == CSSSelector::PseudoElement) 1414 1414 { 1415 1415 // Pseudo elements. We need to check first child here. No dynamic pseudo … … 1601 1601 case CSSSelector::PseudoLang: { 1602 1602 const AtomicString& value = e->getAttribute(langAttr); 1603 if (value.isEmpty() || !value.startsWith(sel-> argument, false))1603 if (value.isEmpty() || !value.startsWith(sel->m_argument, false)) 1604 1604 break; 1605 if (value.length() != sel-> argument.length() && value[sel->argument.length()] != '-')1605 if (value.length() != sel->m_argument.length() && value[sel->m_argument.length()] != '-') 1606 1606 break; 1607 1607 return true; … … 1609 1609 case CSSSelector::PseudoNot: { 1610 1610 // check the simple selector 1611 for (CSSSelector* subSel = sel-> simpleSelector; subSel; subSel = subSel->tagHistory) {1611 for (CSSSelector* subSel = sel->m_simpleSelector; subSel; subSel = subSel->m_tagHistory) { 1612 1612 // :not cannot nest. I don't really know why this is a 1613 1613 // restriction in CSS3, but it is, so let's honour it. 1614 if (subSel-> simpleSelector)1614 if (subSel->m_simpleSelector) 1615 1615 break; 1616 1616 if (!checkOneSelector(subSel, e)) … … 1704 1704 void CSSRuleSet::addRule(CSSStyleRule* rule, CSSSelector* sel) 1705 1705 { 1706 if (sel->m atch == CSSSelector::Id) {1707 addToRuleSet(sel-> value.impl(), m_idRules, rule, sel);1708 return; 1709 } 1710 if (sel->m atch == CSSSelector::Class) {1711 addToRuleSet(sel-> value.impl(), m_classRules, rule, sel);1706 if (sel->m_match == CSSSelector::Id) { 1707 addToRuleSet(sel->m_value.impl(), m_idRules, rule, sel); 1708 return; 1709 } 1710 if (sel->m_match == CSSSelector::Class) { 1711 addToRuleSet(sel->m_value.impl(), m_classRules, rule, sel); 1712 1712 return; 1713 1713 } 1714 1714 1715 const AtomicString& localName = sel-> tag.localName();1715 const AtomicString& localName = sel->m_tag.localName(); 1716 1716 if (localName != starAtom) { 1717 1717 addToRuleSet(localName.impl(), m_tagRules, rule, sel);
Note: See TracChangeset
for help on using the changeset viewer.