Ignore:
Timestamp:
Jun 11, 2012, 10:19:26 AM (13 years ago)
Author:
[email protected]
Message:

Add css3-images image-resolution (dppx only)
https://bugs.webkit.org/show_bug.cgi?id=85332

Patch by David Barr <[email protected]> on 2012-06-11
Reviewed by Tony Chang.

The css3-images module is at candidate recommendation.
http://www.w3.org/TR/2012/CR-css3-images-20120417/#image-resolution

Source/WebCore:

Test: fast/css/image-resolution.html

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

  • css/CSSGrammar.y:
  • css/CSSParser.cpp:

(WebCore::CSSParser::validUnit):
(WebCore::CSSParser::createPrimitiveNumericValue):
(WebCore::unitFromString):
(WebCore::CSSParser::parseValidPrimitive):
(WebCore::CSSParser::parseValue):
(WebCore):
(WebCore::CSSParser::parseImageResolution):
(WebCore::CSSParser::detectNumberToken):

  • css/CSSParser.h:
  • css/CSSPrimitiveValue.cpp:

(WebCore::isValidCSSUnitTypeForDoubleConversion):
(WebCore::unitCategory):
(WebCore::CSSPrimitiveValue::canonicalUnitTypeForCategory):
(WebCore::CSSPrimitiveValue::customCssText):
(WebCore::CSSPrimitiveValue::cloneForCSSOM):

  • css/CSSPrimitiveValue.h:
  • css/CSSProperty.cpp:

(WebCore::CSSProperty::isInheritedProperty):

  • css/CSSPropertyNames.in:
  • css/StyleBuilder.cpp:

(WebCore):
(ApplyPropertyImageResolution):
(WebCore::ApplyPropertyImageResolution::applyInheritValue):
(WebCore::ApplyPropertyImageResolution::applyInitialValue):
(WebCore::ApplyPropertyImageResolution::applyValue):
(WebCore::ApplyPropertyImageResolution::createHandler):
(WebCore::StyleBuilder::StyleBuilder):

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::collectMatchingRulesForList):

  • rendering/RenderImage.cpp:

(WebCore::RenderImage::styleDidChange):
(WebCore::RenderImage::imageDimensionsChanged):

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::diff):

  • rendering/style/RenderStyle.h:
  • rendering/style/StyleRareInheritedData.cpp:

(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator==):

  • rendering/style/StyleRareInheritedData.h:

(StyleRareInheritedData):

LayoutTests:

  • fast/css/image-resolution/image-resolution-expected.txt: Added.
  • fast/css/image-resolution/image-resolution.html: Added.
  • platform/chromium/TestExpectations: Skip tests until image-resolution implementation lands.
  • platform/efl/TestExpectations: Skip tests until image-resolution implementation lands.
  • platform/gtk/TestExpectations: Skip tests until image-resolution implementation lands.
  • platform/mac/TestExpectations: Skip tests until image-resolution implementation lands.
  • platform/qt/TestExpectations: Skip tests until image-resolution implementation lands.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSPrimitiveValue.cpp

    r118963 r119984  
    6161    case CSSPrimitiveValue:: CSS_DEG:
    6262    case CSSPrimitiveValue:: CSS_DIMENSION:
     63#if ENABLE(CSS_IMAGE_RESOLUTION)
     64    case CSSPrimitiveValue:: CSS_DPPX:
     65#endif
    6366    case CSSPrimitiveValue:: CSS_EMS:
    6467    case CSSPrimitiveValue:: CSS_EXS:
     
    8689    case CSSPrimitiveValue:: CSS_COUNTER_NAME:
    8790    case CSSPrimitiveValue:: CSS_DASHBOARD_REGION:
     91#if !ENABLE(CSS_IMAGE_RESOLUTION)
     92    case CSSPrimitiveValue:: CSS_DPPX:
     93#endif
    8894    case CSSPrimitiveValue:: CSS_IDENT:
    8995    case CSSPrimitiveValue:: CSS_PAIR:
     
    138144    case CSSPrimitiveValue::CSS_VMIN:
    139145        return CSSPrimitiveValue::UViewportPercentageLength;
     146#if ENABLE(CSS_IMAGE_RESOLUTION)
     147    case CSSPrimitiveValue:: CSS_DPPX:
     148        return CSSPrimitiveValue::UResolution;
     149#endif
    140150    default:
    141151        return CSSPrimitiveValue::UOther;
     
    628638    case UViewportPercentageLength:
    629639        return CSS_UNKNOWN; // Cannot convert between numbers and relative lengths.
     640#if ENABLE(CSS_IMAGE_RESOLUTION)
     641    case UResolution:
     642        return CSS_DPPX;
     643#endif
    630644    default:
    631645        return CSS_UNKNOWN;
     
    829843            text = formatNumber(m_value.num) + "cm";
    830844            break;
     845#if ENABLE(CSS_IMAGE_RESOLUTION)
     846        case CSS_DPPX:
     847            text = formatNumber(m_value.num) + "dppx";
     848            break;
     849#endif
    831850        case CSS_MM:
    832851            text = formatNumber(m_value.num) + "mm";
     
    11521171    case CSS_VH:
    11531172    case CSS_VMIN:
     1173#if ENABLE(CSS_IMAGE_RESOLUTION)
     1174    case CSS_DPPX:
     1175#endif
    11541176        result = CSSPrimitiveValue::create(m_value.num, static_cast<UnitTypes>(m_primitiveUnitType));
    11551177        break;
Note: See TracChangeset for help on using the changeset viewer.