Changeset 91170 in webkit
- Timestamp:
- Jul 17, 2011 6:59:55 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r91161 r91170 1 2011-07-17 Luke Macpherson <macpherson@chromium.org> 2 3 Implement CSSPropertyCursor in CSSStyleApplyProperty 4 https://bugs.webkit.org/show_bug.cgi?id=64432 5 6 Reviewed by Dimitri Glazkov. 7 8 No new tests / refectoring only. 9 10 * css/CSSStyleApplyProperty.cpp: 11 Add handler for CSSPropertyCursor. 12 * css/CSSStyleSelector.cpp: 13 Remove current handler of CSSPropertyCursor. 14 * css/CSSStyleSelector.h: 15 Make styleImage and cachedOrPendingFromValue public. 16 1 17 2011-07-16 Simon Fraser <simon.fraser@apple.com> 2 18 -
trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp
r91043 r91170 26 26 #include "CSSStyleApplyProperty.h" 27 27 28 #include "CSSCursorImageValue.h" 28 29 #include "CSSPrimitiveValueMappings.h" 29 30 #include "CSSStyleSelector.h" 30 31 #include "CSSValueList.h" 32 #include "CursorList.h" 31 33 #include "Document.h" 32 34 #include "Element.h" … … 505 507 }; 506 508 509 class ApplyPropertyCursor : public ApplyPropertyBase { 510 private: 511 virtual void applyInheritValue(CSSStyleSelector* selector) const 512 { 513 selector->style()->setCursor(selector->parentStyle()->cursor()); 514 selector->style()->setCursorList(selector->parentStyle()->cursors()); 515 } 516 517 virtual void applyInitialValue(CSSStyleSelector* selector) const 518 { 519 selector->style()->clearCursorList(); 520 selector->style()->setCursor(RenderStyle::initialCursor()); 521 } 522 523 virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const 524 { 525 selector->style()->clearCursorList(); 526 if (value->isValueList()) { 527 CSSValueList* list = static_cast<CSSValueList*>(value); 528 int len = list->length(); 529 selector->style()->setCursor(CURSOR_AUTO); 530 for (int i = 0; i < len; i++) { 531 CSSValue* item = list->itemWithoutBoundsCheck(i); 532 if (!item->isPrimitiveValue()) 533 continue; 534 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(item); 535 int type = primitiveValue->primitiveType(); 536 if (type == CSSPrimitiveValue::CSS_URI) { 537 if (primitiveValue->isCursorImageValue()) { 538 CSSCursorImageValue* image = static_cast<CSSCursorImageValue*>(primitiveValue); 539 if (image->updateIfSVGCursorIsUsed(selector->element())) // Elements with SVG cursors are not allowed to share style. 540 selector->style()->setUnique(); 541 selector->style()->addCursor(selector->cachedOrPendingFromValue(CSSPropertyCursor, image), image->hotSpot()); 542 } 543 } else if (type == CSSPrimitiveValue::CSS_IDENT) 544 selector->style()->setCursor(*primitiveValue); 545 } 546 } else if (value->isPrimitiveValue()) { 547 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); 548 int type = primitiveValue->primitiveType(); 549 if (type == CSSPrimitiveValue::CSS_IDENT && selector->style()->cursor() != ECursor(*primitiveValue)) 550 selector->style()->setCursor(*primitiveValue); 551 } 552 } 553 }; 554 507 555 const CSSStyleApplyProperty& CSSStyleApplyProperty::sharedCSSStyleApplyProperty() 508 556 { … … 619 667 setPropertyHandler(CSSPropertyWordSpacing, new ApplyPropertyComputeLength<int, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>(&RenderStyle::wordSpacing, &RenderStyle::setWordSpacing, &RenderStyle::initialLetterWordSpacing)); 620 668 669 setPropertyHandler(CSSPropertyCursor, new ApplyPropertyCursor()); 670 621 671 setPropertyHandler(CSSPropertyFontStyle, new ApplyPropertyFont<FontItalic>(&FontDescription::italic, &FontDescription::setItalic, FontItalicOff)); 622 672 setPropertyHandler(CSSPropertyFontVariant, new ApplyPropertyFont<FontSmallCaps>(&FontDescription::smallCaps, &FontDescription::setSmallCaps, FontSmallCapsOff)); -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r91151 r91170 3814 3814 HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(whiteSpace, WhiteSpace) 3815 3815 return; 3816 case CSSPropertyCursor:3817 if (isInherit) {3818 m_style->setCursor(m_parentStyle->cursor());3819 m_style->setCursorList(m_parentStyle->cursors());3820 return;3821 }3822 m_style->clearCursorList();3823 if (isInitial) {3824 m_style->setCursor(RenderStyle::initialCursor());3825 return;3826 }3827 if (value->isValueList()) {3828 CSSValueList* list = static_cast<CSSValueList*>(value);3829 int len = list->length();3830 m_style->setCursor(CURSOR_AUTO);3831 for (int i = 0; i < len; i++) {3832 CSSValue* item = list->itemWithoutBoundsCheck(i);3833 if (!item->isPrimitiveValue())3834 continue;3835 primitiveValue = static_cast<CSSPrimitiveValue*>(item);3836 int type = primitiveValue->primitiveType();3837 if (type == CSSPrimitiveValue::CSS_URI) {3838 if (primitiveValue->isCursorImageValue()) {3839 CSSCursorImageValue* image = static_cast<CSSCursorImageValue*>(primitiveValue);3840 if (image->updateIfSVGCursorIsUsed(m_element)) // Elements with SVG cursors are not allowed to share style.3841 m_style->setUnique();3842 m_style->addCursor(cachedOrPendingFromValue(CSSPropertyCursor, image), image->hotSpot());3843 }3844 } else if (type == CSSPrimitiveValue::CSS_IDENT)3845 m_style->setCursor(*primitiveValue);3846 }3847 } else if (primitiveValue) {3848 int type = primitiveValue->primitiveType();3849 if (type == CSSPrimitiveValue::CSS_IDENT && m_style->cursor() != ECursor(*primitiveValue))3850 m_style->setCursor(*primitiveValue);3851 }3852 return;3853 3854 3816 // uri || inherit 3855 3817 case CSSPropertyListStyleImage: … … 5429 5391 case CSSPropertyWebkitPerspectiveOriginX: 5430 5392 case CSSPropertyWebkitPerspectiveOriginY: 5393 case CSSPropertyCursor: 5431 5394 ASSERT_NOT_REACHED(); 5432 5395 return; -
trunk/Source/WebCore/css/CSSStyleSelector.h
r91038 r91170 305 305 }; 306 306 307 StyleImage* styleImage(CSSPropertyID, CSSValue*); 308 StyleImage* cachedOrPendingFromValue(CSSPropertyID, CSSImageValue*); 309 307 310 private: 308 311 static RenderStyle* s_styleNotYetAvailable; … … 347 350 348 351 void loadPendingImages(); 349 350 StyleImage* styleImage(CSSPropertyID, CSSValue* value);351 StyleImage* cachedOrPendingFromValue(CSSPropertyID property, CSSImageValue* value);352 352 353 353 // We collect the set of decls that match in |m_matchedDecls|. We then walk the
Note: See TracChangeset
for help on using the changeset viewer.