diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-27 09:28:46 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-27 09:28:46 +0200 |
commit | 6668b07fcd51f86be243b9e08e667224e30c0cf8 (patch) | |
tree | 64f466e09b68a77ae1156c0d35cd5b95e18a34ca /Source/WebCore/css | |
parent | e7923d9de38974f0c6fb7646c898a6ea618261e8 (diff) | |
download | qtwebkit-6668b07fcd51f86be243b9e08e667224e30c0cf8.tar.gz |
Imported WebKit commit 26cd9bd8ab0471ffe987c9b60368f63dc0f1f31b (http://svn.webkit.org/repository/webkit/trunk@121325)
New snapshot with more Windows build fixes
Diffstat (limited to 'Source/WebCore/css')
-rw-r--r-- | Source/WebCore/css/CSSParser.cpp | 77 | ||||
-rw-r--r-- | Source/WebCore/css/CSSParserMode.h | 1 | ||||
-rw-r--r-- | Source/WebCore/css/CSSToStyleMap.cpp | 659 | ||||
-rw-r--r-- | Source/WebCore/css/CSSToStyleMap.h | 88 | ||||
-rw-r--r-- | Source/WebCore/css/CSSValue.h | 2 | ||||
-rw-r--r-- | Source/WebCore/css/CSSVariableValue.h | 1 | ||||
-rw-r--r-- | Source/WebCore/css/StyleBuilder.cpp | 85 | ||||
-rw-r--r-- | Source/WebCore/css/StyleResolver.cpp | 604 | ||||
-rw-r--r-- | Source/WebCore/css/StyleResolver.h | 31 | ||||
-rw-r--r-- | Source/WebCore/css/mediaControlsChromiumAndroid.css | 177 |
10 files changed, 963 insertions, 762 deletions
diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index 63658cbfe..cc96a2d1f 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -1013,6 +1013,74 @@ static bool parseKeywordValue(StylePropertySet* declaration, CSSPropertyID prope return true; } +template <typename CharType> +static bool parseTransformArguments(WebKitCSSTransformValue* transformValue, CharType* characters, unsigned length, unsigned start, unsigned expectedCount) +{ + while (expectedCount) { + size_t end = WTF::find(characters, length, expectedCount == 1 ? ')' : ',', start); + if (end == notFound || (expectedCount == 1 && end != length - 1)) + return false; + unsigned argumentLength = end - start; + CSSPrimitiveValue::UnitTypes unit = CSSPrimitiveValue::CSS_NUMBER; + double number; + if (!parseSimpleLength(characters + start, argumentLength, unit, number)) + return false; + if (unit != CSSPrimitiveValue::CSS_PX && (number || unit != CSSPrimitiveValue::CSS_NUMBER)) + return false; + transformValue->append(cssValuePool().createValue(number, unit)); + start = end + 1; + --expectedCount; + } + return true; +} + +static bool parseTransformValue(StylePropertySet* properties, CSSPropertyID propertyID, const String& string, bool important) +{ + if (propertyID != CSSPropertyWebkitTransform) + return false; + static const unsigned shortestValidTransformStringLength = 12; + static const unsigned likelyMultipartTransformStringLengthCutoff = 32; + if (string.length() < shortestValidTransformStringLength || string.length() > likelyMultipartTransformStringLengthCutoff) + return false; + if (!string.startsWith("translate", false)) + return false; + UChar c9 = toASCIILower(string[9]); + UChar c10 = toASCIILower(string[10]); + + WebKitCSSTransformValue::TransformOperationType transformType; + unsigned expectedArgumentCount = 1; + unsigned argumentStart = 11; + if (c9 == 'x' && c10 == '(') + transformType = WebKitCSSTransformValue::TranslateXTransformOperation; + else if (c9 == 'y' && c10 == '(') + transformType = WebKitCSSTransformValue::TranslateYTransformOperation; + else if (c9 == 'z' && c10 == '(') + transformType = WebKitCSSTransformValue::TranslateZTransformOperation; + else if (c9 == '(') { + transformType = WebKitCSSTransformValue::TranslateTransformOperation; + expectedArgumentCount = 2; + argumentStart = 10; + } else if (c9 == '3' && c10 == 'd' && string[11] == '(') { + transformType = WebKitCSSTransformValue::Translate3DTransformOperation; + expectedArgumentCount = 3; + argumentStart = 12; + } else + return false; + + RefPtr<WebKitCSSTransformValue> transformValue = WebKitCSSTransformValue::create(transformType); + bool success; + if (string.is8Bit()) + success = parseTransformArguments(transformValue.get(), string.characters8(), string.length(), argumentStart, expectedArgumentCount); + else + success = parseTransformArguments(transformValue.get(), string.characters16(), string.length(), argumentStart, expectedArgumentCount); + if (!success) + return false; + RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); + result->append(transformValue.release()); + properties->addParsedProperty(CSSProperty(CSSPropertyWebkitTransform, result.release(), important)); + return true; +} + PassRefPtr<CSSValueList> CSSParser::parseFontFaceValue(const AtomicString& string) { if (string.isEmpty()) @@ -1051,6 +1119,8 @@ bool CSSParser::parseValue(StylePropertySet* declaration, CSSPropertyID property return true; if (parseKeywordValue(declaration, propertyID, string, important, contextStyleSheet->parserContext())) return true; + if (parseTransformValue(declaration, propertyID, string, important)) + return true; CSSParserContext context(cssParserMode); if (contextStyleSheet) { @@ -2621,6 +2691,11 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important) m_valueList->next(); break; #endif +#if ENABLE(CSS_VARIABLES) + case CSSPropertyVariable: + // FIXME: This should have an actual implementation. + return false; +#endif case CSSPropertyBorderBottomStyle: case CSSPropertyBorderCollapse: case CSSPropertyBorderLeftStyle: @@ -8897,7 +8972,7 @@ restartAfterComment: case CharacterDash: #if ENABLE(CSS_VARIABLES) - if (cssVariablesEnabled() && m_currentCharacter[10] == '-' && isEqualToCSSIdentifier(m_currentCharacter, "webkit-var") && isIdentifierStartAfterDash(m_currentCharacter + 11)) { + if (cssVariablesEnabled() && isEqualToCSSIdentifier(m_currentCharacter, "webkit-var") && m_currentCharacter[10] == '-' && isIdentifierStartAfterDash(m_currentCharacter + 11)) { // handle variable declarations m_currentCharacter += 11; parseIdentifier(result, hasEscape); diff --git a/Source/WebCore/css/CSSParserMode.h b/Source/WebCore/css/CSSParserMode.h index d6b211522..5228e9812 100644 --- a/Source/WebCore/css/CSSParserMode.h +++ b/Source/WebCore/css/CSSParserMode.h @@ -26,7 +26,6 @@ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * */ #ifndef CSSParserMode_h diff --git a/Source/WebCore/css/CSSToStyleMap.cpp b/Source/WebCore/css/CSSToStyleMap.cpp new file mode 100644 index 000000000..e154cecd3 --- /dev/null +++ b/Source/WebCore/css/CSSToStyleMap.cpp @@ -0,0 +1,659 @@ +/* + * Copyright (C) 1999 Lars Knoll (knoll@kde.org) + * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) + * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) + * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> + * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> + * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + * Copyright (c) 2011, Code Aurora Forum. All rights reserved. + * Copyright (C) Research In Motion Limited 2011. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "CSSToStyleMap.h" + +#include "Animation.h" +#include "CSSBorderImageSliceValue.h" +#include "CSSPrimitiveValue.h" +#include "CSSPrimitiveValueMappings.h" +#include "CSSTimingFunctionValue.h" +#include "CSSValueKeywords.h" +#include "FillLayer.h" +#include "Pair.h" +#include "Rect.h" +#include "StyleResolver.h" + +namespace WebCore { + +RenderStyle* CSSToStyleMap::style() const +{ + return m_resolver->style(); +} + +RenderStyle* CSSToStyleMap::rootElementStyle() const +{ + return m_resolver->rootElementStyle(); +} + +bool CSSToStyleMap::useSVGZoomRules() const +{ + return m_resolver->useSVGZoomRules(); +} + +PassRefPtr<StyleImage> CSSToStyleMap::styleImage(CSSPropertyID propertyId, CSSValue* value) +{ + return m_resolver->styleImage(propertyId, value); +} + +void CSSToStyleMap::mapFillAttachment(CSSPropertyID, FillLayer* layer, CSSValue* value) +{ + if (value->isInitialValue()) { + layer->setAttachment(FillLayer::initialFillAttachment(layer->type())); + return; + } + + if (!value->isPrimitiveValue()) + return; + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + switch (primitiveValue->getIdent()) { + case CSSValueFixed: + layer->setAttachment(FixedBackgroundAttachment); + break; + case CSSValueScroll: + layer->setAttachment(ScrollBackgroundAttachment); + break; + case CSSValueLocal: + layer->setAttachment(LocalBackgroundAttachment); + break; + default: + return; + } +} + +void CSSToStyleMap::mapFillClip(CSSPropertyID, FillLayer* layer, CSSValue* value) +{ + if (value->isInitialValue()) { + layer->setClip(FillLayer::initialFillClip(layer->type())); + return; + } + + if (!value->isPrimitiveValue()) + return; + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + layer->setClip(*primitiveValue); +} + +void CSSToStyleMap::mapFillComposite(CSSPropertyID, FillLayer* layer, CSSValue* value) +{ + if (value->isInitialValue()) { + layer->setComposite(FillLayer::initialFillComposite(layer->type())); + return; + } + + if (!value->isPrimitiveValue()) + return; + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + layer->setComposite(*primitiveValue); +} + +void CSSToStyleMap::mapFillOrigin(CSSPropertyID, FillLayer* layer, CSSValue* value) +{ + if (value->isInitialValue()) { + layer->setOrigin(FillLayer::initialFillOrigin(layer->type())); + return; + } + + if (!value->isPrimitiveValue()) + return; + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + layer->setOrigin(*primitiveValue); +} + + +void CSSToStyleMap::mapFillImage(CSSPropertyID property, FillLayer* layer, CSSValue* value) +{ + if (value->isInitialValue()) { + layer->setImage(FillLayer::initialFillImage(layer->type())); + return; + } + + layer->setImage(styleImage(property, value)); +} + +void CSSToStyleMap::mapFillRepeatX(CSSPropertyID, FillLayer* layer, CSSValue* value) +{ + if (value->isInitialValue()) { + layer->setRepeatX(FillLayer::initialFillRepeatX(layer->type())); + return; + } + + if (!value->isPrimitiveValue()) + return; + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + layer->setRepeatX(*primitiveValue); +} + +void CSSToStyleMap::mapFillRepeatY(CSSPropertyID, FillLayer* layer, CSSValue* value) +{ + if (value->isInitialValue()) { + layer->setRepeatY(FillLayer::initialFillRepeatY(layer->type())); + return; + } + + if (!value->isPrimitiveValue()) + return; + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + layer->setRepeatY(*primitiveValue); +} + +void CSSToStyleMap::mapFillSize(CSSPropertyID, FillLayer* layer, CSSValue* value) +{ + if (!value->isPrimitiveValue()) { + layer->setSizeType(SizeNone); + return; + } + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + if (primitiveValue->getIdent() == CSSValueContain) + layer->setSizeType(Contain); + else if (primitiveValue->getIdent() == CSSValueCover) + layer->setSizeType(Cover); + else + layer->setSizeType(SizeLength); + + LengthSize b = FillLayer::initialFillSizeLength(layer->type()); + + if (value->isInitialValue() || primitiveValue->getIdent() == CSSValueContain || primitiveValue->getIdent() == CSSValueCover) { + layer->setSizeLength(b); + return; + } + + float zoomFactor = style()->effectiveZoom(); + + Length firstLength; + Length secondLength; + + if (Pair* pair = primitiveValue->getPairValue()) { + CSSPrimitiveValue* first = static_cast<CSSPrimitiveValue*>(pair->first()); + CSSPrimitiveValue* second = static_cast<CSSPrimitiveValue*>(pair->second()); + firstLength = first->convertToLength<AnyConversion>(style(), rootElementStyle(), zoomFactor); + secondLength = second->convertToLength<AnyConversion>(style(), rootElementStyle(), zoomFactor); + } else { + firstLength = primitiveValue->convertToLength<AnyConversion>(style(), rootElementStyle(), zoomFactor); + secondLength = Length(); + } + + if (firstLength.isUndefined() || secondLength.isUndefined()) + return; + + b.setWidth(firstLength); + b.setHeight(secondLength); + layer->setSizeLength(b); +} + +void CSSToStyleMap::mapFillXPosition(CSSPropertyID, FillLayer* layer, CSSValue* value) +{ + if (value->isInitialValue()) { + layer->setXPosition(FillLayer::initialFillXPosition(layer->type())); + return; + } + + if (!value->isPrimitiveValue()) + return; + + float zoomFactor = style()->effectiveZoom(); + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + Length length; + if (primitiveValue->isLength()) + length = primitiveValue->computeLength<Length>(style(), rootElementStyle(), zoomFactor); + else if (primitiveValue->isPercentage()) + length = Length(primitiveValue->getDoubleValue(), Percent); + else if (primitiveValue->isCalculatedPercentageWithLength()) + length = Length(primitiveValue->cssCalcValue()->toCalcValue(style(), rootElementStyle(), zoomFactor)); + else if (primitiveValue->isViewportPercentageLength()) + length = primitiveValue->viewportPercentageLength(); + else + return; + layer->setXPosition(length); +} + +void CSSToStyleMap::mapFillYPosition(CSSPropertyID, FillLayer* layer, CSSValue* value) +{ + if (value->isInitialValue()) { + layer->setYPosition(FillLayer::initialFillYPosition(layer->type())); + return; + } + + if (!value->isPrimitiveValue()) + return; + + float zoomFactor = style()->effectiveZoom(); + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + Length length; + if (primitiveValue->isLength()) + length = primitiveValue->computeLength<Length>(style(), rootElementStyle(), zoomFactor); + else if (primitiveValue->isPercentage()) + length = Length(primitiveValue->getDoubleValue(), Percent); + else if (primitiveValue->isCalculatedPercentageWithLength()) + length = Length(primitiveValue->cssCalcValue()->toCalcValue(style(), rootElementStyle(), zoomFactor)); + else if (primitiveValue->isViewportPercentageLength()) + length = primitiveValue->viewportPercentageLength(); + else + return; + layer->setYPosition(length); +} + +void CSSToStyleMap::mapAnimationDelay(Animation* animation, CSSValue* value) +{ + if (value->isInitialValue()) { + animation->setDelay(Animation::initialAnimationDelay()); + return; + } + + if (!value->isPrimitiveValue()) + return; + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + animation->setDelay(primitiveValue->computeTime<float, CSSPrimitiveValue::Seconds>()); +} + +void CSSToStyleMap::mapAnimationDirection(Animation* layer, CSSValue* value) +{ + if (value->isInitialValue()) { + layer->setDirection(Animation::initialAnimationDirection()); + return; + } + + if (!value->isPrimitiveValue()) + return; + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + switch (primitiveValue->getIdent()) { + case CSSValueNormal: + layer->setDirection(Animation::AnimationDirectionNormal); + break; + case CSSValueAlternate: + layer->setDirection(Animation::AnimationDirectionAlternate); + break; + case CSSValueReverse: + layer->setDirection(Animation::AnimationDirectionReverse); + break; + case CSSValueAlternateReverse: + layer->setDirection(Animation::AnimationDirectionAlternateReverse); + break; + } +} + +void CSSToStyleMap::mapAnimationDuration(Animation* animation, CSSValue* value) +{ + if (value->isInitialValue()) { + animation->setDuration(Animation::initialAnimationDuration()); + return; + } + + if (!value->isPrimitiveValue()) + return; + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + animation->setDuration(primitiveValue->computeTime<float, CSSPrimitiveValue::Seconds>()); +} + +void CSSToStyleMap::mapAnimationFillMode(Animation* layer, CSSValue* value) +{ + if (value->isInitialValue()) { + layer->setFillMode(Animation::initialAnimationFillMode()); + return; + } + + if (!value->isPrimitiveValue()) + return; + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + switch (primitiveValue->getIdent()) { + case CSSValueNone: + layer->setFillMode(AnimationFillModeNone); + break; + case CSSValueForwards: + layer->setFillMode(AnimationFillModeForwards); + break; + case CSSValueBackwards: + layer->setFillMode(AnimationFillModeBackwards); + break; + case CSSValueBoth: + layer->setFillMode(AnimationFillModeBoth); + break; + } +} + +void CSSToStyleMap::mapAnimationIterationCount(Animation* animation, CSSValue* value) +{ + if (value->isInitialValue()) { + animation->setIterationCount(Animation::initialAnimationIterationCount()); + return; + } + + if (!value->isPrimitiveValue()) + return; + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + if (primitiveValue->getIdent() == CSSValueInfinite) + animation->setIterationCount(-1); + else + animation->setIterationCount(primitiveValue->getFloatValue()); +} + +void CSSToStyleMap::mapAnimationName(Animation* layer, CSSValue* value) +{ + if (value->isInitialValue()) { + layer->setName(Animation::initialAnimationName()); + return; + } + + if (!value->isPrimitiveValue()) + return; + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + if (primitiveValue->getIdent() == CSSValueNone) + layer->setIsNoneAnimation(true); + else + layer->setName(primitiveValue->getStringValue()); +} + +void CSSToStyleMap::mapAnimationPlayState(Animation* layer, CSSValue* value) +{ + if (value->isInitialValue()) { + layer->setPlayState(Animation::initialAnimationPlayState()); + return; + } + + if (!value->isPrimitiveValue()) + return; + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + EAnimPlayState playState = (primitiveValue->getIdent() == CSSValuePaused) ? AnimPlayStatePaused : AnimPlayStatePlaying; + layer->setPlayState(playState); +} + +void CSSToStyleMap::mapAnimationProperty(Animation* animation, CSSValue* value) +{ + if (value->isInitialValue()) { + animation->setAnimationMode(Animation::AnimateAll); + animation->setProperty(CSSPropertyInvalid); + return; + } + + if (!value->isPrimitiveValue()) + return; + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + if (primitiveValue->getIdent() == CSSValueAll) { + animation->setAnimationMode(Animation::AnimateAll); + animation->setProperty(CSSPropertyInvalid); + } else if (primitiveValue->getIdent() == CSSValueNone) { + animation->setAnimationMode(Animation::AnimateNone); + animation->setProperty(CSSPropertyInvalid); + } else { + animation->setAnimationMode(Animation::AnimateSingleProperty); + animation->setProperty(static_cast<CSSPropertyID>(primitiveValue->getIdent())); + } +} + +void CSSToStyleMap::mapAnimationTimingFunction(Animation* animation, CSSValue* value) +{ + if (value->isInitialValue()) { + animation->setTimingFunction(Animation::initialAnimationTimingFunction()); + return; + } + + if (value->isPrimitiveValue()) { + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + switch (primitiveValue->getIdent()) { + case CSSValueLinear: + animation->setTimingFunction(LinearTimingFunction::create()); + break; + case CSSValueEase: + animation->setTimingFunction(CubicBezierTimingFunction::create()); + break; + case CSSValueEaseIn: + animation->setTimingFunction(CubicBezierTimingFunction::create(0.42, 0.0, 1.0, 1.0)); + break; + case CSSValueEaseOut: + animation->setTimingFunction(CubicBezierTimingFunction::create(0.0, 0.0, 0.58, 1.0)); + break; + case CSSValueEaseInOut: + animation->setTimingFunction(CubicBezierTimingFunction::create(0.42, 0.0, 0.58, 1.0)); + break; + case CSSValueStepStart: + animation->setTimingFunction(StepsTimingFunction::create(1, true)); + break; + case CSSValueStepEnd: + animation->setTimingFunction(StepsTimingFunction::create(1, false)); + break; + } + return; + } + + if (value->isCubicBezierTimingFunctionValue()) { + CSSCubicBezierTimingFunctionValue* cubicTimingFunction = static_cast<CSSCubicBezierTimingFunctionValue*>(value); + animation->setTimingFunction(CubicBezierTimingFunction::create(cubicTimingFunction->x1(), cubicTimingFunction->y1(), cubicTimingFunction->x2(), cubicTimingFunction->y2())); + } else if (value->isStepsTimingFunctionValue()) { + CSSStepsTimingFunctionValue* stepsTimingFunction = static_cast<CSSStepsTimingFunctionValue*>(value); + animation->setTimingFunction(StepsTimingFunction::create(stepsTimingFunction->numberOfSteps(), stepsTimingFunction->stepAtStart())); + } else if (value->isLinearTimingFunctionValue()) + animation->setTimingFunction(LinearTimingFunction::create()); +} + +void CSSToStyleMap::mapNinePieceImage(CSSPropertyID property, CSSValue* value, NinePieceImage& image) +{ + // If we're not a value list, then we are "none" and don't need to alter the empty image at all. + if (!value || !value->isValueList()) + return; + + // Retrieve the border image value. + CSSValueList* borderImage = static_cast<CSSValueList*>(value); + + // Set the image (this kicks off the load). + CSSPropertyID imageProperty; + if (property == CSSPropertyWebkitBorderImage) + imageProperty = CSSPropertyBorderImageSource; + else if (property == CSSPropertyWebkitMaskBoxImage) + imageProperty = CSSPropertyWebkitMaskBoxImageSource; + else + imageProperty = property; + + for (unsigned i = 0 ; i < borderImage->length() ; ++i) { + CSSValue* current = borderImage->item(i); + + if (current->isImageValue() || current->isImageGeneratorValue() +#if ENABLE(CSS_IMAGE_SET) + || current->isImageSetValue() +#endif + ) + image.setImage(styleImage(imageProperty, current)); + else if (current->isBorderImageSliceValue()) + mapNinePieceImageSlice(current, image); + else if (current->isValueList()) { + CSSValueList* slashList = static_cast<CSSValueList*>(current); + // Map in the image slices. + if (slashList->item(0) && slashList->item(0)->isBorderImageSliceValue()) + mapNinePieceImageSlice(slashList->item(0), image); + + // Map in the border slices. + if (slashList->item(1)) + image.setBorderSlices(mapNinePieceImageQuad(slashList->item(1))); + + // Map in the outset. + if (slashList->item(2)) + image.setOutset(mapNinePieceImageQuad(slashList->item(2))); + } else if (current->isPrimitiveValue()) { + // Set the appropriate rules for stretch/round/repeat of the slices. + mapNinePieceImageRepeat(current, image); + } + } + + if (property == CSSPropertyWebkitBorderImage) { + // We have to preserve the legacy behavior of -webkit-border-image and make the border slices + // also set the border widths. We don't need to worry about percentages, since we don't even support + // those on real borders yet. + if (image.borderSlices().top().isFixed()) + style()->setBorderTopWidth(image.borderSlices().top().value()); + if (image.borderSlices().right().isFixed()) + style()->setBorderRightWidth(image.borderSlices().right().value()); + if (image.borderSlices().bottom().isFixed()) + style()->setBorderBottomWidth(image.borderSlices().bottom().value()); + if (image.borderSlices().left().isFixed()) + style()->setBorderLeftWidth(image.borderSlices().left().value()); + } +} + +void CSSToStyleMap::mapNinePieceImageSlice(CSSValue* value, NinePieceImage& image) +{ + if (!value || !value->isBorderImageSliceValue()) + return; + + // Retrieve the border image value. + CSSBorderImageSliceValue* borderImageSlice = static_cast<CSSBorderImageSliceValue*>(value); + + // Set up a length box to represent our image slices. + LengthBox box; + Quad* slices = borderImageSlice->slices(); + if (slices->top()->isPercentage()) + box.m_top = Length(slices->top()->getDoubleValue(), Percent); + else + box.m_top = Length(slices->top()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed); + if (slices->bottom()->isPercentage()) + box.m_bottom = Length(slices->bottom()->getDoubleValue(), Percent); + else + box.m_bottom = Length((int)slices->bottom()->getFloatValue(CSSPrimitiveValue::CSS_NUMBER), Fixed); + if (slices->left()->isPercentage()) + box.m_left = Length(slices->left()->getDoubleValue(), Percent); + else + box.m_left = Length(slices->left()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed); + if (slices->right()->isPercentage()) + box.m_right = Length(slices->right()->getDoubleValue(), Percent); + else + box.m_right = Length(slices->right()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed); + image.setImageSlices(box); + + // Set our fill mode. + image.setFill(borderImageSlice->m_fill); +} + +LengthBox CSSToStyleMap::mapNinePieceImageQuad(CSSValue* value) +{ + if (!value || !value->isPrimitiveValue()) + return LengthBox(); + + // Get our zoom value. + float zoom = useSVGZoomRules() ? 1.0f : style()->effectiveZoom(); + + // Retrieve the primitive value. + CSSPrimitiveValue* borderWidths = static_cast<CSSPrimitiveValue*>(value); + + // Set up a length box to represent our image slices. + LengthBox box; // Defaults to 'auto' so we don't have to handle that explicitly below. + Quad* slices = borderWidths->getQuadValue(); + if (slices->top()->isNumber()) + box.m_top = Length(slices->top()->getIntValue(), Relative); + else if (slices->top()->isPercentage()) + box.m_top = Length(slices->top()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent); + else if (slices->top()->getIdent() != CSSValueAuto) + box.m_top = slices->top()->computeLength<Length>(style(), rootElementStyle(), zoom); + + if (slices->right()->isNumber()) + box.m_right = Length(slices->right()->getIntValue(), Relative); + else if (slices->right()->isPercentage()) + box.m_right = Length(slices->right()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent); + else if (slices->right()->getIdent() != CSSValueAuto) + box.m_right = slices->right()->computeLength<Length>(style(), rootElementStyle(), zoom); + + if (slices->bottom()->isNumber()) + box.m_bottom = Length(slices->bottom()->getIntValue(), Relative); + else if (slices->bottom()->isPercentage()) + box.m_bottom = Length(slices->bottom()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent); + else if (slices->bottom()->getIdent() != CSSValueAuto) + box.m_bottom = slices->bottom()->computeLength<Length>(style(), rootElementStyle(), zoom); + + if (slices->left()->isNumber()) + box.m_left = Length(slices->left()->getIntValue(), Relative); + else if (slices->left()->isPercentage()) + box.m_left = Length(slices->left()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent); + else if (slices->left()->getIdent() != CSSValueAuto) + box.m_left = slices->left()->computeLength<Length>(style(), rootElementStyle(), zoom); + + return box; +} + +void CSSToStyleMap::mapNinePieceImageRepeat(CSSValue* value, NinePieceImage& image) +{ + if (!value || !value->isPrimitiveValue()) + return; + + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); + Pair* pair = primitiveValue->getPairValue(); + if (!pair || !pair->first() || !pair->second()) + return; + + int firstIdentifier = pair->first()->getIdent(); + int secondIdentifier = pair->second()->getIdent(); + + ENinePieceImageRule horizontalRule; + switch (firstIdentifier) { + case CSSValueStretch: + horizontalRule = StretchImageRule; + break; + case CSSValueRound: + horizontalRule = RoundImageRule; + break; + case CSSValueSpace: + horizontalRule = SpaceImageRule; + break; + default: // CSSValueRepeat + horizontalRule = RepeatImageRule; + break; + } + image.setHorizontalRule(horizontalRule); + + ENinePieceImageRule verticalRule; + switch (secondIdentifier) { + case CSSValueStretch: + verticalRule = StretchImageRule; + break; + case CSSValueRound: + verticalRule = RoundImageRule; + break; + case CSSValueSpace: + verticalRule = SpaceImageRule; + break; + default: // CSSValueRepeat + verticalRule = RepeatImageRule; + break; + } + image.setVerticalRule(verticalRule); +} + +}; diff --git a/Source/WebCore/css/CSSToStyleMap.h b/Source/WebCore/css/CSSToStyleMap.h new file mode 100644 index 000000000..8e0fc953d --- /dev/null +++ b/Source/WebCore/css/CSSToStyleMap.h @@ -0,0 +1,88 @@ +/* + * Copyright (C) 1999 Lars Knoll (knoll@kde.org) + * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef CSSToStyleMap_h +#define CSSToStyleMap_h + +#include "CSSPropertyNames.h" +#include "LengthBox.h" + +namespace WebCore { + +class FillLayer; +class CSSValue; +class Animation; +class StyleImage; +class StyleResolver; +class NinePieceImage; + +class CSSToStyleMap { + WTF_MAKE_NONCOPYABLE(CSSToStyleMap); + WTF_MAKE_FAST_ALLOCATED; + +public: + CSSToStyleMap(StyleResolver* resolver) : m_resolver(resolver) { } + + void mapFillAttachment(CSSPropertyID, FillLayer*, CSSValue*); + void mapFillClip(CSSPropertyID, FillLayer*, CSSValue*); + void mapFillComposite(CSSPropertyID, FillLayer*, CSSValue*); + void mapFillOrigin(CSSPropertyID, FillLayer*, CSSValue*); + void mapFillImage(CSSPropertyID, FillLayer*, CSSValue*); + void mapFillRepeatX(CSSPropertyID, FillLayer*, CSSValue*); + void mapFillRepeatY(CSSPropertyID, FillLayer*, CSSValue*); + void mapFillSize(CSSPropertyID, FillLayer*, CSSValue*); + void mapFillXPosition(CSSPropertyID, FillLayer*, CSSValue*); + void mapFillYPosition(CSSPropertyID, FillLayer*, CSSValue*); + + void mapAnimationDelay(Animation*, CSSValue*); + void mapAnimationDirection(Animation*, CSSValue*); + void mapAnimationDuration(Animation*, CSSValue*); + void mapAnimationFillMode(Animation*, CSSValue*); + void mapAnimationIterationCount(Animation*, CSSValue*); + void mapAnimationName(Animation*, CSSValue*); + void mapAnimationPlayState(Animation*, CSSValue*); + void mapAnimationProperty(Animation*, CSSValue*); + void mapAnimationTimingFunction(Animation*, CSSValue*); + + void mapNinePieceImage(CSSPropertyID, CSSValue*, NinePieceImage&); + void mapNinePieceImageSlice(CSSValue*, NinePieceImage&); + LengthBox mapNinePieceImageQuad(CSSValue*); + void mapNinePieceImageRepeat(CSSValue*, NinePieceImage&); + +private: + // FIXME: These accessors should be replaced by a ResolveState object + // similar to how PaintInfo/LayoutState cache values needed for + // the current paint/layout. + RenderStyle* style() const; + RenderStyle* rootElementStyle() const; + bool useSVGZoomRules() const; + + // FIXME: This should be part of some sort of StyleImageCache object which + // is held by the StyleResolver, and likely provided to this object + // during the resolve. + PassRefPtr<StyleImage> styleImage(CSSPropertyID, CSSValue*); + + StyleResolver* m_resolver; +}; + +} + +#endif diff --git a/Source/WebCore/css/CSSValue.h b/Source/WebCore/css/CSSValue.h index b1e262c67..b4e8a89e7 100644 --- a/Source/WebCore/css/CSSValue.h +++ b/Source/WebCore/css/CSSValue.h @@ -30,7 +30,7 @@ namespace WebCore { class StyleSheetContents; - + // FIXME: The current CSSValue and subclasses should be turned into internal types (StyleValue). // The few subtypes that are actually exposed in CSSOM can be seen in the cloneForCSSOM() function. // They should be handled by separate wrapper classes. diff --git a/Source/WebCore/css/CSSVariableValue.h b/Source/WebCore/css/CSSVariableValue.h index 15dbf9d69..2c5b66a6b 100644 --- a/Source/WebCore/css/CSSVariableValue.h +++ b/Source/WebCore/css/CSSVariableValue.h @@ -24,7 +24,6 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ #ifndef CSSVariableValue_h diff --git a/Source/WebCore/css/StyleBuilder.cpp b/Source/WebCore/css/StyleBuilder.cpp index 2139996bd..20d02cc15 100644 --- a/Source/WebCore/css/StyleBuilder.cpp +++ b/Source/WebCore/css/StyleBuilder.cpp @@ -29,6 +29,7 @@ #include "CSSCalculationValue.h" #include "CSSCursorImageValue.h" #include "CSSPrimitiveValueMappings.h" +#include "CSSToStyleMap.h" #include "CSSValueList.h" #include "CursorList.h" #include "Document.h" @@ -496,7 +497,7 @@ template <typename T, void (FillLayer::*setFunction)(typename FillLayerAccessorTypes<T>::Setter), void (FillLayer::*clearFunction)(), typename FillLayerAccessorTypes<T>::Getter (*initialFunction)(EFillLayerType), - void (StyleResolver::*mapFillFunction)(CSSPropertyID, FillLayer*, CSSValue*)> + void (CSSToStyleMap::*mapFillFunction)(CSSPropertyID, FillLayer*, CSSValue*)> class ApplyPropertyFillLayer { public: static void applyInheritValue(StyleResolver* styleResolver) @@ -548,12 +549,12 @@ public: currChild = new FillLayer(fillLayerType); prevChild->setNext(currChild); } - (styleResolver->*mapFillFunction)(propertyId, currChild, valueList->itemWithoutBoundsCheck(i)); + (styleResolver->styleMap()->*mapFillFunction)(propertyId, currChild, valueList->itemWithoutBoundsCheck(i)); prevChild = currChild; currChild = currChild->next(); } } else { - (styleResolver->*mapFillFunction)(propertyId, currChild, value); + (styleResolver->styleMap()->*mapFillFunction)(propertyId, currChild, value); currChild = currChild->next(); } while (currChild) { @@ -886,7 +887,7 @@ public: NinePieceImage image; if (borderImageType == Mask) image.setMaskDefaults(); - styleResolver->mapNinePieceImage(property, value, image); + styleResolver->styleMap()->mapNinePieceImage(property, value, image); (styleResolver->style()->*setterFunction)(image); } @@ -953,16 +954,16 @@ public: NinePieceImage image(getValue(styleResolver->style())); switch (modifier) { case Outset: - image.setOutset(styleResolver->mapNinePieceImageQuad(value)); + image.setOutset(styleResolver->styleMap()->mapNinePieceImageQuad(value)); break; case Repeat: - styleResolver->mapNinePieceImageRepeat(value, image); + styleResolver->styleMap()->mapNinePieceImageRepeat(value, image); break; case Slice: - styleResolver->mapNinePieceImageSlice(value, image); + styleResolver->styleMap()->mapNinePieceImageSlice(value, image); break; case Width: - image.setBorderSlices(styleResolver->mapNinePieceImageQuad(value)); + image.setBorderSlices(styleResolver->styleMap()->mapNinePieceImageQuad(value)); break; } setValue(styleResolver->style(), image); @@ -1437,7 +1438,7 @@ template <typename T, bool (Animation::*testFunction)() const, void (Animation::*clearFunction)(), T (*initialFunction)(), - void (StyleResolver::*mapFunction)(Animation*, CSSValue*), + void (CSSToStyleMap::*mapFunction)(Animation*, CSSValue*), AnimationList* (RenderStyle::*animationGetterFunction)(), const AnimationList* (RenderStyle::*immutableAnimationGetterFunction)() const> class ApplyPropertyAnimation { @@ -1447,7 +1448,7 @@ public: static bool test(const Animation* animation) { return (animation->*testFunction)(); } static void clear(Animation* animation) { (animation->*clearFunction)(); } static T initial() { return (*initialFunction)(); } - static void map(StyleResolver* styleResolver, Animation* animation, CSSValue* value) { (styleResolver->*mapFunction)(animation, value); } + static void map(StyleResolver* styleResolver, Animation* animation, CSSValue* value) { (styleResolver->styleMap()->*mapFunction)(animation, value); } static AnimationList* accessAnimations(RenderStyle* style) { return (style->*animationGetterFunction)(); } static const AnimationList* animations(RenderStyle* style) { return (style->*immutableAnimationGetterFunction)(); } @@ -1840,18 +1841,18 @@ StyleBuilder::StyleBuilder() m_propertyMap[i] = PropertyHandler(); // Please keep CSS property list in alphabetical order. - setPropertyHandler(CSSPropertyBackgroundAttachment, ApplyPropertyFillLayer<EFillAttachment, CSSPropertyBackgroundAttachment, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isAttachmentSet, &FillLayer::attachment, &FillLayer::setAttachment, &FillLayer::clearAttachment, &FillLayer::initialFillAttachment, &StyleResolver::mapFillAttachment>::createHandler()); - setPropertyHandler(CSSPropertyBackgroundClip, ApplyPropertyFillLayer<EFillBox, CSSPropertyBackgroundClip, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &StyleResolver::mapFillClip>::createHandler()); + setPropertyHandler(CSSPropertyBackgroundAttachment, ApplyPropertyFillLayer<EFillAttachment, CSSPropertyBackgroundAttachment, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isAttachmentSet, &FillLayer::attachment, &FillLayer::setAttachment, &FillLayer::clearAttachment, &FillLayer::initialFillAttachment, &CSSToStyleMap::mapFillAttachment>::createHandler()); + setPropertyHandler(CSSPropertyBackgroundClip, ApplyPropertyFillLayer<EFillBox, CSSPropertyBackgroundClip, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &CSSToStyleMap::mapFillClip>::createHandler()); setPropertyHandler(CSSPropertyBackgroundColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor, &RenderStyle::setVisitedLinkBackgroundColor, &RenderStyle::invalidColor>::createHandler()); - setPropertyHandler(CSSPropertyBackgroundImage, ApplyPropertyFillLayer<StyleImage*, CSSPropertyBackgroundImage, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &StyleResolver::mapFillImage>::createHandler()); - setPropertyHandler(CSSPropertyBackgroundOrigin, ApplyPropertyFillLayer<EFillBox, CSSPropertyBackgroundOrigin, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &StyleResolver::mapFillOrigin>::createHandler()); + setPropertyHandler(CSSPropertyBackgroundImage, ApplyPropertyFillLayer<StyleImage*, CSSPropertyBackgroundImage, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &CSSToStyleMap::mapFillImage>::createHandler()); + setPropertyHandler(CSSPropertyBackgroundOrigin, ApplyPropertyFillLayer<EFillBox, CSSPropertyBackgroundOrigin, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &CSSToStyleMap::mapFillOrigin>::createHandler()); setPropertyHandler(CSSPropertyBackgroundPosition, ApplyPropertyExpanding<SuppressValue, CSSPropertyBackgroundPositionX, CSSPropertyBackgroundPositionY>::createHandler()); - setPropertyHandler(CSSPropertyBackgroundPositionX, ApplyPropertyFillLayer<Length, CSSPropertyBackgroundPositionX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &StyleResolver::mapFillXPosition>::createHandler()); - setPropertyHandler(CSSPropertyBackgroundPositionY, ApplyPropertyFillLayer<Length, CSSPropertyBackgroundPositionY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &StyleResolver::mapFillYPosition>::createHandler()); + setPropertyHandler(CSSPropertyBackgroundPositionX, ApplyPropertyFillLayer<Length, CSSPropertyBackgroundPositionX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &CSSToStyleMap::mapFillXPosition>::createHandler()); + setPropertyHandler(CSSPropertyBackgroundPositionY, ApplyPropertyFillLayer<Length, CSSPropertyBackgroundPositionY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &CSSToStyleMap::mapFillYPosition>::createHandler()); setPropertyHandler(CSSPropertyBackgroundRepeat, ApplyPropertyExpanding<SuppressValue, CSSPropertyBackgroundRepeatX, CSSPropertyBackgroundRepeatY>::createHandler()); - setPropertyHandler(CSSPropertyBackgroundRepeatX, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyBackgroundRepeatX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &StyleResolver::mapFillRepeatX>::createHandler()); - setPropertyHandler(CSSPropertyBackgroundRepeatY, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyBackgroundRepeatY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &StyleResolver::mapFillRepeatY>::createHandler()); - setPropertyHandler(CSSPropertyBackgroundSize, ApplyPropertyFillLayer<FillSize, CSSPropertyBackgroundSize, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &StyleResolver::mapFillSize>::createHandler()); + setPropertyHandler(CSSPropertyBackgroundRepeatX, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyBackgroundRepeatX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &CSSToStyleMap::mapFillRepeatX>::createHandler()); + setPropertyHandler(CSSPropertyBackgroundRepeatY, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyBackgroundRepeatY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSToStyleMap::mapFillRepeatY>::createHandler()); + setPropertyHandler(CSSPropertyBackgroundSize, ApplyPropertyFillLayer<FillSize, CSSPropertyBackgroundSize, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSToStyleMap::mapFillSize>::createHandler()); setPropertyHandler(CSSPropertyBorder, ApplyPropertyExpanding<SuppressValue, CSSPropertyBorderStyle, CSSPropertyBorderWidth, CSSPropertyBorderColor>::createHandler()); setPropertyHandler(CSSPropertyBorderBottom, ApplyPropertyExpanding<SuppressValue, CSSPropertyBorderBottomColor, CSSPropertyBorderBottomStyle, CSSPropertyBorderBottomWidth>::createHandler()); setPropertyHandler(CSSPropertyBorderBottomColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderBottomColor, &RenderStyle::setBorderBottomColor, &RenderStyle::setVisitedLinkBorderBottomColor, &RenderStyle::color>::createHandler()); @@ -1957,19 +1958,19 @@ StyleBuilder::StyleBuilder() setPropertyHandler(CSSPropertyUnicodeBidi, ApplyPropertyUnicodeBidi::createHandler()); setPropertyHandler(CSSPropertyVerticalAlign, ApplyPropertyVerticalAlign::createHandler()); setPropertyHandler(CSSPropertyVisibility, ApplyPropertyDefault<EVisibility, &RenderStyle::visibility, EVisibility, &RenderStyle::setVisibility, EVisibility, &RenderStyle::initialVisibility>::createHandler()); - setPropertyHandler(CSSPropertyWebkitAnimationDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &StyleResolver::mapAnimationDelay, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler()); - setPropertyHandler(CSSPropertyWebkitAnimationDirection, ApplyPropertyAnimation<Animation::AnimationDirection, &Animation::direction, &Animation::setDirection, &Animation::isDirectionSet, &Animation::clearDirection, &Animation::initialAnimationDirection, &StyleResolver::mapAnimationDirection, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler()); - setPropertyHandler(CSSPropertyWebkitAnimationDuration, ApplyPropertyAnimation<double, &Animation::duration, &Animation::setDuration, &Animation::isDurationSet, &Animation::clearDuration, &Animation::initialAnimationDuration, &StyleResolver::mapAnimationDuration, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler()); - setPropertyHandler(CSSPropertyWebkitAnimationFillMode, ApplyPropertyAnimation<unsigned, &Animation::fillMode, &Animation::setFillMode, &Animation::isFillModeSet, &Animation::clearFillMode, &Animation::initialAnimationFillMode, &StyleResolver::mapAnimationFillMode, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler()); - setPropertyHandler(CSSPropertyWebkitAnimationIterationCount, ApplyPropertyAnimation<double, &Animation::iterationCount, &Animation::setIterationCount, &Animation::isIterationCountSet, &Animation::clearIterationCount, &Animation::initialAnimationIterationCount, &StyleResolver::mapAnimationIterationCount, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler()); - setPropertyHandler(CSSPropertyWebkitAnimationName, ApplyPropertyAnimation<const String&, &Animation::name, &Animation::setName, &Animation::isNameSet, &Animation::clearName, &Animation::initialAnimationName, &StyleResolver::mapAnimationName, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler()); - setPropertyHandler(CSSPropertyWebkitAnimationPlayState, ApplyPropertyAnimation<EAnimPlayState, &Animation::playState, &Animation::setPlayState, &Animation::isPlayStateSet, &Animation::clearPlayState, &Animation::initialAnimationPlayState, &StyleResolver::mapAnimationPlayState, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler()); - setPropertyHandler(CSSPropertyWebkitAnimationTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &StyleResolver::mapAnimationTimingFunction, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler()); + setPropertyHandler(CSSPropertyWebkitAnimationDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSToStyleMap::mapAnimationDelay, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler()); + setPropertyHandler(CSSPropertyWebkitAnimationDirection, ApplyPropertyAnimation<Animation::AnimationDirection, &Animation::direction, &Animation::setDirection, &Animation::isDirectionSet, &Animation::clearDirection, &Animation::initialAnimationDirection, &CSSToStyleMap::mapAnimationDirection, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler()); + setPropertyHandler(CSSPropertyWebkitAnimationDuration, ApplyPropertyAnimation<double, &Animation::duration, &Animation::setDuration, &Animation::isDurationSet, &Animation::clearDuration, &Animation::initialAnimationDuration, &CSSToStyleMap::mapAnimationDuration, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler()); + setPropertyHandler(CSSPropertyWebkitAnimationFillMode, ApplyPropertyAnimation<unsigned, &Animation::fillMode, &Animation::setFillMode, &Animation::isFillModeSet, &Animation::clearFillMode, &Animation::initialAnimationFillMode, &CSSToStyleMap::mapAnimationFillMode, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler()); + setPropertyHandler(CSSPropertyWebkitAnimationIterationCount, ApplyPropertyAnimation<double, &Animation::iterationCount, &Animation::setIterationCount, &Animation::isIterationCountSet, &Animation::clearIterationCount, &Animation::initialAnimationIterationCount, &CSSToStyleMap::mapAnimationIterationCount, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler()); + setPropertyHandler(CSSPropertyWebkitAnimationName, ApplyPropertyAnimation<const String&, &Animation::name, &Animation::setName, &Animation::isNameSet, &Animation::clearName, &Animation::initialAnimationName, &CSSToStyleMap::mapAnimationName, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler()); + setPropertyHandler(CSSPropertyWebkitAnimationPlayState, ApplyPropertyAnimation<EAnimPlayState, &Animation::playState, &Animation::setPlayState, &Animation::isPlayStateSet, &Animation::clearPlayState, &Animation::initialAnimationPlayState, &CSSToStyleMap::mapAnimationPlayState, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler()); + setPropertyHandler(CSSPropertyWebkitAnimationTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSToStyleMap::mapAnimationTimingFunction, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler()); setPropertyHandler(CSSPropertyWebkitAppearance, ApplyPropertyDefault<ControlPart, &RenderStyle::appearance, ControlPart, &RenderStyle::setAppearance, ControlPart, &RenderStyle::initialAppearance>::createHandler()); setPropertyHandler(CSSPropertyWebkitAspectRatio, ApplyPropertyAspectRatio::createHandler()); setPropertyHandler(CSSPropertyWebkitBackfaceVisibility, ApplyPropertyDefault<EBackfaceVisibility, &RenderStyle::backfaceVisibility, EBackfaceVisibility, &RenderStyle::setBackfaceVisibility, EBackfaceVisibility, &RenderStyle::initialBackfaceVisibility>::createHandler()); setPropertyHandler(CSSPropertyWebkitBackgroundClip, CSSPropertyBackgroundClip); - setPropertyHandler(CSSPropertyWebkitBackgroundComposite, ApplyPropertyFillLayer<CompositeOperator, CSSPropertyWebkitBackgroundComposite, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &StyleResolver::mapFillComposite>::createHandler()); + setPropertyHandler(CSSPropertyWebkitBackgroundComposite, ApplyPropertyFillLayer<CompositeOperator, CSSPropertyWebkitBackgroundComposite, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSToStyleMap::mapFillComposite>::createHandler()); setPropertyHandler(CSSPropertyWebkitBackgroundOrigin, CSSPropertyBackgroundOrigin); setPropertyHandler(CSSPropertyWebkitBackgroundSize, CSSPropertyBackgroundSize); setPropertyHandler(CSSPropertyWebkitBorderFit, ApplyPropertyDefault<EBorderFit, &RenderStyle::borderFit, EBorderFit, &RenderStyle::setBorderFit, EBorderFit, &RenderStyle::initialBorderFit>::createHandler()); @@ -2037,24 +2038,24 @@ StyleBuilder::StyleBuilder() setPropertyHandler(CSSPropertyWebkitMarginTopCollapse, CSSPropertyWebkitMarginBeforeCollapse); setPropertyHandler(CSSPropertyWebkitMarqueeDirection, ApplyPropertyDefault<EMarqueeDirection, &RenderStyle::marqueeDirection, EMarqueeDirection, &RenderStyle::setMarqueeDirection, EMarqueeDirection, &RenderStyle::initialMarqueeDirection>::createHandler()); setPropertyHandler(CSSPropertyWebkitMarqueeStyle, ApplyPropertyDefault<EMarqueeBehavior, &RenderStyle::marqueeBehavior, EMarqueeBehavior, &RenderStyle::setMarqueeBehavior, EMarqueeBehavior, &RenderStyle::initialMarqueeBehavior>::createHandler()); - setPropertyHandler(CSSPropertyWebkitMaskAttachment, ApplyPropertyFillLayer<EFillAttachment, CSSPropertyWebkitMaskAttachment, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isAttachmentSet, &FillLayer::attachment, &FillLayer::setAttachment, &FillLayer::clearAttachment, &FillLayer::initialFillAttachment, &StyleResolver::mapFillAttachment>::createHandler()); + setPropertyHandler(CSSPropertyWebkitMaskAttachment, ApplyPropertyFillLayer<EFillAttachment, CSSPropertyWebkitMaskAttachment, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isAttachmentSet, &FillLayer::attachment, &FillLayer::setAttachment, &FillLayer::clearAttachment, &FillLayer::initialFillAttachment, &CSSToStyleMap::mapFillAttachment>::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskBoxImage, ApplyPropertyBorderImage<Mask, CSSPropertyWebkitMaskBoxImage, &RenderStyle::maskBoxImage, &RenderStyle::setMaskBoxImage>::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskBoxImageOutset, ApplyPropertyBorderImageModifier<Mask, Outset>::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskBoxImageRepeat, ApplyPropertyBorderImageModifier<Mask, Repeat>::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskBoxImageSlice, ApplyPropertyBorderImageModifier<Mask, Slice>::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskBoxImageSource, ApplyPropertyBorderImageSource<CSSPropertyWebkitMaskBoxImageSource, &RenderStyle::maskBoxImageSource, &RenderStyle::setMaskBoxImageSource, &RenderStyle::initialMaskBoxImageSource>::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskBoxImageWidth, ApplyPropertyBorderImageModifier<Mask, Width>::createHandler()); - setPropertyHandler(CSSPropertyWebkitMaskClip, ApplyPropertyFillLayer<EFillBox, CSSPropertyWebkitMaskClip, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &StyleResolver::mapFillClip>::createHandler()); - setPropertyHandler(CSSPropertyWebkitMaskComposite, ApplyPropertyFillLayer<CompositeOperator, CSSPropertyWebkitMaskComposite, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &StyleResolver::mapFillComposite>::createHandler()); - setPropertyHandler(CSSPropertyWebkitMaskImage, ApplyPropertyFillLayer<StyleImage*, CSSPropertyWebkitMaskImage, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &StyleResolver::mapFillImage>::createHandler()); - setPropertyHandler(CSSPropertyWebkitMaskOrigin, ApplyPropertyFillLayer<EFillBox, CSSPropertyWebkitMaskOrigin, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &StyleResolver::mapFillOrigin>::createHandler()); + setPropertyHandler(CSSPropertyWebkitMaskClip, ApplyPropertyFillLayer<EFillBox, CSSPropertyWebkitMaskClip, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &CSSToStyleMap::mapFillClip>::createHandler()); + setPropertyHandler(CSSPropertyWebkitMaskComposite, ApplyPropertyFillLayer<CompositeOperator, CSSPropertyWebkitMaskComposite, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSToStyleMap::mapFillComposite>::createHandler()); + setPropertyHandler(CSSPropertyWebkitMaskImage, ApplyPropertyFillLayer<StyleImage*, CSSPropertyWebkitMaskImage, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &CSSToStyleMap::mapFillImage>::createHandler()); + setPropertyHandler(CSSPropertyWebkitMaskOrigin, ApplyPropertyFillLayer<EFillBox, CSSPropertyWebkitMaskOrigin, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &CSSToStyleMap::mapFillOrigin>::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskPosition, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitMaskPositionX, CSSPropertyWebkitMaskPositionY>::createHandler()); - setPropertyHandler(CSSPropertyWebkitMaskPositionX, ApplyPropertyFillLayer<Length, CSSPropertyWebkitMaskPositionX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &StyleResolver::mapFillXPosition>::createHandler()); - setPropertyHandler(CSSPropertyWebkitMaskPositionY, ApplyPropertyFillLayer<Length, CSSPropertyWebkitMaskPositionY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &StyleResolver::mapFillYPosition>::createHandler()); + setPropertyHandler(CSSPropertyWebkitMaskPositionX, ApplyPropertyFillLayer<Length, CSSPropertyWebkitMaskPositionX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &CSSToStyleMap::mapFillXPosition>::createHandler()); + setPropertyHandler(CSSPropertyWebkitMaskPositionY, ApplyPropertyFillLayer<Length, CSSPropertyWebkitMaskPositionY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &CSSToStyleMap::mapFillYPosition>::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskRepeat, ApplyPropertyExpanding<SuppressValue, CSSPropertyBackgroundRepeatX, CSSPropertyBackgroundRepeatY>::createHandler()); - setPropertyHandler(CSSPropertyWebkitMaskRepeatX, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyWebkitMaskRepeatX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &StyleResolver::mapFillRepeatX>::createHandler()); - setPropertyHandler(CSSPropertyWebkitMaskRepeatY, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyWebkitMaskRepeatY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &StyleResolver::mapFillRepeatY>::createHandler()); - setPropertyHandler(CSSPropertyWebkitMaskSize, ApplyPropertyFillLayer<FillSize, CSSPropertyWebkitMaskSize, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &StyleResolver::mapFillSize>::createHandler()); + setPropertyHandler(CSSPropertyWebkitMaskRepeatX, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyWebkitMaskRepeatX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &CSSToStyleMap::mapFillRepeatX>::createHandler()); + setPropertyHandler(CSSPropertyWebkitMaskRepeatY, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyWebkitMaskRepeatY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSToStyleMap::mapFillRepeatY>::createHandler()); + setPropertyHandler(CSSPropertyWebkitMaskSize, ApplyPropertyFillLayer<FillSize, CSSPropertyWebkitMaskSize, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSToStyleMap::mapFillSize>::createHandler()); setPropertyHandler(CSSPropertyWebkitNbspMode, ApplyPropertyDefault<ENBSPMode, &RenderStyle::nbspMode, ENBSPMode, &RenderStyle::setNBSPMode, ENBSPMode, &RenderStyle::initialNBSPMode>::createHandler()); setPropertyHandler(CSSPropertyWebkitPerspectiveOrigin, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitPerspectiveOriginX, CSSPropertyWebkitPerspectiveOriginY>::createHandler()); setPropertyHandler(CSSPropertyWebkitPerspectiveOriginX, ApplyPropertyLength<&RenderStyle::perspectiveOriginX, &RenderStyle::setPerspectiveOriginX, &RenderStyle::initialPerspectiveOriginX>::createHandler()); @@ -2080,10 +2081,10 @@ StyleBuilder::StyleBuilder() setPropertyHandler(CSSPropertyWebkitTransformOriginY, ApplyPropertyLength<&RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY, &RenderStyle::initialTransformOriginY>::createHandler()); setPropertyHandler(CSSPropertyWebkitTransformOriginZ, ApplyPropertyComputeLength<float, &RenderStyle::transformOriginZ, &RenderStyle::setTransformOriginZ, &RenderStyle::initialTransformOriginZ>::createHandler()); setPropertyHandler(CSSPropertyWebkitTransformStyle, ApplyPropertyDefault<ETransformStyle3D, &RenderStyle::transformStyle3D, ETransformStyle3D, &RenderStyle::setTransformStyle3D, ETransformStyle3D, &RenderStyle::initialTransformStyle3D>::createHandler()); - setPropertyHandler(CSSPropertyWebkitTransitionDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &StyleResolver::mapAnimationDelay, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler()); - setPropertyHandler(CSSPropertyWebkitTransitionDuration, ApplyPropertyAnimation<double, &Animation::duration, &Animation::setDuration, &Animation::isDurationSet, &Animation::clearDuration, &Animation::initialAnimationDuration, &StyleResolver::mapAnimationDuration, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler()); - setPropertyHandler(CSSPropertyWebkitTransitionProperty, ApplyPropertyAnimation<CSSPropertyID, &Animation::property, &Animation::setProperty, &Animation::isPropertySet, &Animation::clearProperty, &Animation::initialAnimationProperty, &StyleResolver::mapAnimationProperty, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler()); - setPropertyHandler(CSSPropertyWebkitTransitionTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &StyleResolver::mapAnimationTimingFunction, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler()); + setPropertyHandler(CSSPropertyWebkitTransitionDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSToStyleMap::mapAnimationDelay, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler()); + setPropertyHandler(CSSPropertyWebkitTransitionDuration, ApplyPropertyAnimation<double, &Animation::duration, &Animation::setDuration, &Animation::isDurationSet, &Animation::clearDuration, &Animation::initialAnimationDuration, &CSSToStyleMap::mapAnimationDuration, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler()); + setPropertyHandler(CSSPropertyWebkitTransitionProperty, ApplyPropertyAnimation<CSSPropertyID, &Animation::property, &Animation::setProperty, &Animation::isPropertySet, &Animation::clearProperty, &Animation::initialAnimationProperty, &CSSToStyleMap::mapAnimationProperty, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler()); + setPropertyHandler(CSSPropertyWebkitTransitionTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSToStyleMap::mapAnimationTimingFunction, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler()); setPropertyHandler(CSSPropertyWebkitUserDrag, ApplyPropertyDefault<EUserDrag, &RenderStyle::userDrag, EUserDrag, &RenderStyle::setUserDrag, EUserDrag, &RenderStyle::initialUserDrag>::createHandler()); setPropertyHandler(CSSPropertyWebkitUserModify, ApplyPropertyDefault<EUserModify, &RenderStyle::userModify, EUserModify, &RenderStyle::setUserModify, EUserModify, &RenderStyle::initialUserModify>::createHandler()); setPropertyHandler(CSSPropertyWebkitUserSelect, ApplyPropertyDefault<EUserSelect, &RenderStyle::userSelect, EUserSelect, &RenderStyle::setUserSelect, EUserSelect, &RenderStyle::initialUserSelect>::createHandler()); diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp index 252298fc5..de3a0a9bd 100644 --- a/Source/WebCore/css/StyleResolver.cpp +++ b/Source/WebCore/css/StyleResolver.cpp @@ -8,6 +8,7 @@ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * Copyright (c) 2011, Code Aurora Forum. All rights reserved. * Copyright (C) Research In Motion Limited 2011. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -374,6 +375,7 @@ StyleResolver::StyleResolver(Document* document, bool matchAuthorAndUserStyles) , m_scopeStackParent(0) , m_scopeStackParentBoundsIndex(0) #endif + , m_styleMap(this) { Element* root = document->documentElement(); @@ -3740,7 +3742,7 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value) reflection->setOffset(reflectValue->offset()->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(style(), m_rootElementStyle, zoomFactor)); NinePieceImage mask; mask.setMaskDefaults(); - mapNinePieceImage(id, reflectValue->mask(), mask); + m_styleMap.mapNinePieceImage(id, reflectValue->mask(), mask); reflection->setMask(mask); m_style->setBoxReflect(reflection.release()); @@ -4158,7 +4160,11 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value) m_style->setGridItemRow(row); return; } - +#if ENABLE(CSS_VARIABLES) + case CSSPropertyVariable: + // FIXME: This should have an actual implementation. + return; +#endif // These properties are implemented in the StyleBuilder lookup table. case CSSPropertyBackgroundAttachment: case CSSPropertyBackgroundClip: @@ -4428,74 +4434,6 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value) } } -void StyleResolver::mapFillAttachment(CSSPropertyID, FillLayer* layer, CSSValue* value) -{ - if (value->isInitialValue()) { - layer->setAttachment(FillLayer::initialFillAttachment(layer->type())); - return; - } - - if (!value->isPrimitiveValue()) - return; - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - switch (primitiveValue->getIdent()) { - case CSSValueFixed: - layer->setAttachment(FixedBackgroundAttachment); - break; - case CSSValueScroll: - layer->setAttachment(ScrollBackgroundAttachment); - break; - case CSSValueLocal: - layer->setAttachment(LocalBackgroundAttachment); - break; - default: - return; - } -} - -void StyleResolver::mapFillClip(CSSPropertyID, FillLayer* layer, CSSValue* value) -{ - if (value->isInitialValue()) { - layer->setClip(FillLayer::initialFillClip(layer->type())); - return; - } - - if (!value->isPrimitiveValue()) - return; - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - layer->setClip(*primitiveValue); -} - -void StyleResolver::mapFillComposite(CSSPropertyID, FillLayer* layer, CSSValue* value) -{ - if (value->isInitialValue()) { - layer->setComposite(FillLayer::initialFillComposite(layer->type())); - return; - } - - if (!value->isPrimitiveValue()) - return; - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - layer->setComposite(*primitiveValue); -} - -void StyleResolver::mapFillOrigin(CSSPropertyID, FillLayer* layer, CSSValue* value) -{ - if (value->isInitialValue()) { - layer->setOrigin(FillLayer::initialFillOrigin(layer->type())); - return; - } - - if (!value->isPrimitiveValue()) - return; - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - layer->setOrigin(*primitiveValue); -} - PassRefPtr<StyleImage> StyleResolver::styleImage(CSSPropertyID property, CSSValue* value) { if (value->isImageValue()) @@ -4539,532 +4477,6 @@ PassRefPtr<StyleImage> StyleResolver::setOrPendingFromValue(CSSPropertyID proper } #endif -void StyleResolver::mapFillImage(CSSPropertyID property, FillLayer* layer, CSSValue* value) -{ - if (value->isInitialValue()) { - layer->setImage(FillLayer::initialFillImage(layer->type())); - return; - } - - layer->setImage(styleImage(property, value)); -} - -void StyleResolver::mapFillRepeatX(CSSPropertyID, FillLayer* layer, CSSValue* value) -{ - if (value->isInitialValue()) { - layer->setRepeatX(FillLayer::initialFillRepeatX(layer->type())); - return; - } - - if (!value->isPrimitiveValue()) - return; - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - layer->setRepeatX(*primitiveValue); -} - -void StyleResolver::mapFillRepeatY(CSSPropertyID, FillLayer* layer, CSSValue* value) -{ - if (value->isInitialValue()) { - layer->setRepeatY(FillLayer::initialFillRepeatY(layer->type())); - return; - } - - if (!value->isPrimitiveValue()) - return; - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - layer->setRepeatY(*primitiveValue); -} - -void StyleResolver::mapFillSize(CSSPropertyID, FillLayer* layer, CSSValue* value) -{ - if (!value->isPrimitiveValue()) { - layer->setSizeType(SizeNone); - return; - } - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - if (primitiveValue->getIdent() == CSSValueContain) - layer->setSizeType(Contain); - else if (primitiveValue->getIdent() == CSSValueCover) - layer->setSizeType(Cover); - else - layer->setSizeType(SizeLength); - - LengthSize b = FillLayer::initialFillSizeLength(layer->type()); - - if (value->isInitialValue() || primitiveValue->getIdent() == CSSValueContain || primitiveValue->getIdent() == CSSValueCover) { - layer->setSizeLength(b); - return; - } - - float zoomFactor = m_style->effectiveZoom(); - - Length firstLength; - Length secondLength; - - if (Pair* pair = primitiveValue->getPairValue()) { - CSSPrimitiveValue* first = static_cast<CSSPrimitiveValue*>(pair->first()); - CSSPrimitiveValue* second = static_cast<CSSPrimitiveValue*>(pair->second()); - firstLength = first->convertToLength<AnyConversion>(style(), m_rootElementStyle, zoomFactor); - secondLength = second->convertToLength<AnyConversion>(style(), m_rootElementStyle, zoomFactor); - } else { - firstLength = primitiveValue->convertToLength<AnyConversion>(style(), m_rootElementStyle, zoomFactor); - secondLength = Length(); - } - - if (firstLength.isUndefined() || secondLength.isUndefined()) - return; - - b.setWidth(firstLength); - b.setHeight(secondLength); - layer->setSizeLength(b); -} - -void StyleResolver::mapFillXPosition(CSSPropertyID, FillLayer* layer, CSSValue* value) -{ - if (value->isInitialValue()) { - layer->setXPosition(FillLayer::initialFillXPosition(layer->type())); - return; - } - - if (!value->isPrimitiveValue()) - return; - - float zoomFactor = m_style->effectiveZoom(); - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - Length length; - if (primitiveValue->isLength()) - length = primitiveValue->computeLength<Length>(style(), m_rootElementStyle, zoomFactor); - else if (primitiveValue->isPercentage()) - length = Length(primitiveValue->getDoubleValue(), Percent); - else if (primitiveValue->isCalculatedPercentageWithLength()) - length = Length(primitiveValue->cssCalcValue()->toCalcValue(style(), m_rootElementStyle, zoomFactor)); - else if (primitiveValue->isViewportPercentageLength()) - length = primitiveValue->viewportPercentageLength(); - else - return; - layer->setXPosition(length); -} - -void StyleResolver::mapFillYPosition(CSSPropertyID, FillLayer* layer, CSSValue* value) -{ - if (value->isInitialValue()) { - layer->setYPosition(FillLayer::initialFillYPosition(layer->type())); - return; - } - - if (!value->isPrimitiveValue()) - return; - - float zoomFactor = m_style->effectiveZoom(); - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - Length length; - if (primitiveValue->isLength()) - length = primitiveValue->computeLength<Length>(style(), m_rootElementStyle, zoomFactor); - else if (primitiveValue->isPercentage()) - length = Length(primitiveValue->getDoubleValue(), Percent); - else if (primitiveValue->isCalculatedPercentageWithLength()) - length = Length(primitiveValue->cssCalcValue()->toCalcValue(style(), m_rootElementStyle, zoomFactor)); - else if (primitiveValue->isViewportPercentageLength()) - length = primitiveValue->viewportPercentageLength(); - else - return; - layer->setYPosition(length); -} - -void StyleResolver::mapAnimationDelay(Animation* animation, CSSValue* value) -{ - if (value->isInitialValue()) { - animation->setDelay(Animation::initialAnimationDelay()); - return; - } - - if (!value->isPrimitiveValue()) - return; - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - animation->setDelay(primitiveValue->computeTime<float, CSSPrimitiveValue::Seconds>()); -} - -void StyleResolver::mapAnimationDirection(Animation* layer, CSSValue* value) -{ - if (value->isInitialValue()) { - layer->setDirection(Animation::initialAnimationDirection()); - return; - } - - if (!value->isPrimitiveValue()) - return; - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - switch (primitiveValue->getIdent()) { - case CSSValueNormal: - layer->setDirection(Animation::AnimationDirectionNormal); - break; - case CSSValueAlternate: - layer->setDirection(Animation::AnimationDirectionAlternate); - break; - case CSSValueReverse: - layer->setDirection(Animation::AnimationDirectionReverse); - break; - case CSSValueAlternateReverse: - layer->setDirection(Animation::AnimationDirectionAlternateReverse); - break; - } -} - -void StyleResolver::mapAnimationDuration(Animation* animation, CSSValue* value) -{ - if (value->isInitialValue()) { - animation->setDuration(Animation::initialAnimationDuration()); - return; - } - - if (!value->isPrimitiveValue()) - return; - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - animation->setDuration(primitiveValue->computeTime<float, CSSPrimitiveValue::Seconds>()); -} - -void StyleResolver::mapAnimationFillMode(Animation* layer, CSSValue* value) -{ - if (value->isInitialValue()) { - layer->setFillMode(Animation::initialAnimationFillMode()); - return; - } - - if (!value->isPrimitiveValue()) - return; - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - switch (primitiveValue->getIdent()) { - case CSSValueNone: - layer->setFillMode(AnimationFillModeNone); - break; - case CSSValueForwards: - layer->setFillMode(AnimationFillModeForwards); - break; - case CSSValueBackwards: - layer->setFillMode(AnimationFillModeBackwards); - break; - case CSSValueBoth: - layer->setFillMode(AnimationFillModeBoth); - break; - } -} - -void StyleResolver::mapAnimationIterationCount(Animation* animation, CSSValue* value) -{ - if (value->isInitialValue()) { - animation->setIterationCount(Animation::initialAnimationIterationCount()); - return; - } - - if (!value->isPrimitiveValue()) - return; - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - if (primitiveValue->getIdent() == CSSValueInfinite) - animation->setIterationCount(-1); - else - animation->setIterationCount(primitiveValue->getFloatValue()); -} - -void StyleResolver::mapAnimationName(Animation* layer, CSSValue* value) -{ - if (value->isInitialValue()) { - layer->setName(Animation::initialAnimationName()); - return; - } - - if (!value->isPrimitiveValue()) - return; - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - if (primitiveValue->getIdent() == CSSValueNone) - layer->setIsNoneAnimation(true); - else - layer->setName(primitiveValue->getStringValue()); -} - -void StyleResolver::mapAnimationPlayState(Animation* layer, CSSValue* value) -{ - if (value->isInitialValue()) { - layer->setPlayState(Animation::initialAnimationPlayState()); - return; - } - - if (!value->isPrimitiveValue()) - return; - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - EAnimPlayState playState = (primitiveValue->getIdent() == CSSValuePaused) ? AnimPlayStatePaused : AnimPlayStatePlaying; - layer->setPlayState(playState); -} - -void StyleResolver::mapAnimationProperty(Animation* animation, CSSValue* value) -{ - if (value->isInitialValue()) { - animation->setAnimationMode(Animation::AnimateAll); - animation->setProperty(CSSPropertyInvalid); - return; - } - - if (!value->isPrimitiveValue()) - return; - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - if (primitiveValue->getIdent() == CSSValueAll) { - animation->setAnimationMode(Animation::AnimateAll); - animation->setProperty(CSSPropertyInvalid); - } else if (primitiveValue->getIdent() == CSSValueNone) { - animation->setAnimationMode(Animation::AnimateNone); - animation->setProperty(CSSPropertyInvalid); - } else { - animation->setAnimationMode(Animation::AnimateSingleProperty); - animation->setProperty(static_cast<CSSPropertyID>(primitiveValue->getIdent())); - } -} - -void StyleResolver::mapAnimationTimingFunction(Animation* animation, CSSValue* value) -{ - if (value->isInitialValue()) { - animation->setTimingFunction(Animation::initialAnimationTimingFunction()); - return; - } - - if (value->isPrimitiveValue()) { - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - switch (primitiveValue->getIdent()) { - case CSSValueLinear: - animation->setTimingFunction(LinearTimingFunction::create()); - break; - case CSSValueEase: - animation->setTimingFunction(CubicBezierTimingFunction::create()); - break; - case CSSValueEaseIn: - animation->setTimingFunction(CubicBezierTimingFunction::create(0.42, 0.0, 1.0, 1.0)); - break; - case CSSValueEaseOut: - animation->setTimingFunction(CubicBezierTimingFunction::create(0.0, 0.0, 0.58, 1.0)); - break; - case CSSValueEaseInOut: - animation->setTimingFunction(CubicBezierTimingFunction::create(0.42, 0.0, 0.58, 1.0)); - break; - case CSSValueStepStart: - animation->setTimingFunction(StepsTimingFunction::create(1, true)); - break; - case CSSValueStepEnd: - animation->setTimingFunction(StepsTimingFunction::create(1, false)); - break; - } - return; - } - - if (value->isCubicBezierTimingFunctionValue()) { - CSSCubicBezierTimingFunctionValue* cubicTimingFunction = static_cast<CSSCubicBezierTimingFunctionValue*>(value); - animation->setTimingFunction(CubicBezierTimingFunction::create(cubicTimingFunction->x1(), cubicTimingFunction->y1(), cubicTimingFunction->x2(), cubicTimingFunction->y2())); - } else if (value->isStepsTimingFunctionValue()) { - CSSStepsTimingFunctionValue* stepsTimingFunction = static_cast<CSSStepsTimingFunctionValue*>(value); - animation->setTimingFunction(StepsTimingFunction::create(stepsTimingFunction->numberOfSteps(), stepsTimingFunction->stepAtStart())); - } else if (value->isLinearTimingFunctionValue()) - animation->setTimingFunction(LinearTimingFunction::create()); -} - -void StyleResolver::mapNinePieceImage(CSSPropertyID property, CSSValue* value, NinePieceImage& image) -{ - // If we're not a value list, then we are "none" and don't need to alter the empty image at all. - if (!value || !value->isValueList()) - return; - - // Retrieve the border image value. - CSSValueList* borderImage = static_cast<CSSValueList*>(value); - - // Set the image (this kicks off the load). - CSSPropertyID imageProperty; - if (property == CSSPropertyWebkitBorderImage) - imageProperty = CSSPropertyBorderImageSource; - else if (property == CSSPropertyWebkitMaskBoxImage) - imageProperty = CSSPropertyWebkitMaskBoxImageSource; - else - imageProperty = property; - - for (unsigned i = 0 ; i < borderImage->length() ; ++i) { - CSSValue* current = borderImage->item(i); - - if (current->isImageValue() || current->isImageGeneratorValue() -#if ENABLE(CSS_IMAGE_SET) - || current->isImageSetValue() -#endif - ) - image.setImage(styleImage(imageProperty, current)); - else if (current->isBorderImageSliceValue()) - mapNinePieceImageSlice(current, image); - else if (current->isValueList()) { - CSSValueList* slashList = static_cast<CSSValueList*>(current); - // Map in the image slices. - if (slashList->item(0) && slashList->item(0)->isBorderImageSliceValue()) - mapNinePieceImageSlice(slashList->item(0), image); - - // Map in the border slices. - if (slashList->item(1)) - image.setBorderSlices(mapNinePieceImageQuad(slashList->item(1))); - - // Map in the outset. - if (slashList->item(2)) - image.setOutset(mapNinePieceImageQuad(slashList->item(2))); - } else if (current->isPrimitiveValue()) { - // Set the appropriate rules for stretch/round/repeat of the slices. - mapNinePieceImageRepeat(current, image); - } - } - - if (property == CSSPropertyWebkitBorderImage) { - // We have to preserve the legacy behavior of -webkit-border-image and make the border slices - // also set the border widths. We don't need to worry about percentages, since we don't even support - // those on real borders yet. - if (image.borderSlices().top().isFixed()) - style()->setBorderTopWidth(image.borderSlices().top().value()); - if (image.borderSlices().right().isFixed()) - style()->setBorderRightWidth(image.borderSlices().right().value()); - if (image.borderSlices().bottom().isFixed()) - style()->setBorderBottomWidth(image.borderSlices().bottom().value()); - if (image.borderSlices().left().isFixed()) - style()->setBorderLeftWidth(image.borderSlices().left().value()); - } -} - -void StyleResolver::mapNinePieceImageSlice(CSSValue* value, NinePieceImage& image) -{ - if (!value || !value->isBorderImageSliceValue()) - return; - - // Retrieve the border image value. - CSSBorderImageSliceValue* borderImageSlice = static_cast<CSSBorderImageSliceValue*>(value); - - // Set up a length box to represent our image slices. - LengthBox box; - Quad* slices = borderImageSlice->slices(); - if (slices->top()->isPercentage()) - box.m_top = Length(slices->top()->getDoubleValue(), Percent); - else - box.m_top = Length(slices->top()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed); - if (slices->bottom()->isPercentage()) - box.m_bottom = Length(slices->bottom()->getDoubleValue(), Percent); - else - box.m_bottom = Length((int)slices->bottom()->getFloatValue(CSSPrimitiveValue::CSS_NUMBER), Fixed); - if (slices->left()->isPercentage()) - box.m_left = Length(slices->left()->getDoubleValue(), Percent); - else - box.m_left = Length(slices->left()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed); - if (slices->right()->isPercentage()) - box.m_right = Length(slices->right()->getDoubleValue(), Percent); - else - box.m_right = Length(slices->right()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed); - image.setImageSlices(box); - - // Set our fill mode. - image.setFill(borderImageSlice->m_fill); -} - -LengthBox StyleResolver::mapNinePieceImageQuad(CSSValue* value) -{ - if (!value || !value->isPrimitiveValue()) - return LengthBox(); - - // Get our zoom value. - float zoom = useSVGZoomRules() ? 1.0f : style()->effectiveZoom(); - - // Retrieve the primitive value. - CSSPrimitiveValue* borderWidths = static_cast<CSSPrimitiveValue*>(value); - - // Set up a length box to represent our image slices. - LengthBox box; // Defaults to 'auto' so we don't have to handle that explicitly below. - Quad* slices = borderWidths->getQuadValue(); - if (slices->top()->isNumber()) - box.m_top = Length(slices->top()->getIntValue(), Relative); - else if (slices->top()->isPercentage()) - box.m_top = Length(slices->top()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent); - else if (slices->top()->getIdent() != CSSValueAuto) - box.m_top = slices->top()->computeLength<Length>(style(), rootElementStyle(), zoom); - - if (slices->right()->isNumber()) - box.m_right = Length(slices->right()->getIntValue(), Relative); - else if (slices->right()->isPercentage()) - box.m_right = Length(slices->right()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent); - else if (slices->right()->getIdent() != CSSValueAuto) - box.m_right = slices->right()->computeLength<Length>(style(), rootElementStyle(), zoom); - - if (slices->bottom()->isNumber()) - box.m_bottom = Length(slices->bottom()->getIntValue(), Relative); - else if (slices->bottom()->isPercentage()) - box.m_bottom = Length(slices->bottom()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent); - else if (slices->bottom()->getIdent() != CSSValueAuto) - box.m_bottom = slices->bottom()->computeLength<Length>(style(), rootElementStyle(), zoom); - - if (slices->left()->isNumber()) - box.m_left = Length(slices->left()->getIntValue(), Relative); - else if (slices->left()->isPercentage()) - box.m_left = Length(slices->left()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent); - else if (slices->left()->getIdent() != CSSValueAuto) - box.m_left = slices->left()->computeLength<Length>(style(), rootElementStyle(), zoom); - - return box; -} - -void StyleResolver::mapNinePieceImageRepeat(CSSValue* value, NinePieceImage& image) -{ - if (!value || !value->isPrimitiveValue()) - return; - - CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - Pair* pair = primitiveValue->getPairValue(); - if (!pair || !pair->first() || !pair->second()) - return; - - int firstIdentifier = pair->first()->getIdent(); - int secondIdentifier = pair->second()->getIdent(); - - ENinePieceImageRule horizontalRule; - switch (firstIdentifier) { - case CSSValueStretch: - horizontalRule = StretchImageRule; - break; - case CSSValueRound: - horizontalRule = RoundImageRule; - break; - case CSSValueSpace: - horizontalRule = SpaceImageRule; - break; - default: // CSSValueRepeat - horizontalRule = RepeatImageRule; - break; - } - image.setHorizontalRule(horizontalRule); - - ENinePieceImageRule verticalRule; - switch (secondIdentifier) { - case CSSValueStretch: - verticalRule = StretchImageRule; - break; - case CSSValueRound: - verticalRule = RoundImageRule; - break; - case CSSValueSpace: - verticalRule = SpaceImageRule; - break; - default: // CSSValueRepeat - verticalRule = RepeatImageRule; - break; - } - image.setVerticalRule(verticalRule); -} - void StyleResolver::checkForTextSizeAdjust() { if (m_style->textSizeAdjust()) diff --git a/Source/WebCore/css/StyleResolver.h b/Source/WebCore/css/StyleResolver.h index 29f800e0c..4843eb53a 100644 --- a/Source/WebCore/css/StyleResolver.h +++ b/Source/WebCore/css/StyleResolver.h @@ -23,6 +23,7 @@ #define StyleResolver_h #include "CSSRule.h" +#include "CSSToStyleMap.h" #include "CSSValueList.h" #include "LinkHash.h" #include "MediaQueryExp.h" @@ -411,6 +412,8 @@ public: static Length convertToIntLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, double multiplier = 1); static Length convertToFloatLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, double multiplier = 1); + CSSToStyleMap* styleMap() { return &m_styleMap; } + private: static RenderStyle* s_styleNotYetAvailable; @@ -419,32 +422,6 @@ private: void cacheBorderAndBackground(); - void mapFillAttachment(CSSPropertyID, FillLayer*, CSSValue*); - void mapFillClip(CSSPropertyID, FillLayer*, CSSValue*); - void mapFillComposite(CSSPropertyID, FillLayer*, CSSValue*); - void mapFillOrigin(CSSPropertyID, FillLayer*, CSSValue*); - void mapFillImage(CSSPropertyID, FillLayer*, CSSValue*); - void mapFillRepeatX(CSSPropertyID, FillLayer*, CSSValue*); - void mapFillRepeatY(CSSPropertyID, FillLayer*, CSSValue*); - void mapFillSize(CSSPropertyID, FillLayer*, CSSValue*); - void mapFillXPosition(CSSPropertyID, FillLayer*, CSSValue*); - void mapFillYPosition(CSSPropertyID, FillLayer*, CSSValue*); - - void mapAnimationDelay(Animation*, CSSValue*); - void mapAnimationDirection(Animation*, CSSValue*); - void mapAnimationDuration(Animation*, CSSValue*); - void mapAnimationFillMode(Animation*, CSSValue*); - void mapAnimationIterationCount(Animation*, CSSValue*); - void mapAnimationName(Animation*, CSSValue*); - void mapAnimationPlayState(Animation*, CSSValue*); - void mapAnimationProperty(Animation*, CSSValue*); - void mapAnimationTimingFunction(Animation*, CSSValue*); - -public: - void mapNinePieceImage(CSSPropertyID, CSSValue*, NinePieceImage&); - void mapNinePieceImageSlice(CSSValue*, NinePieceImage&); - LengthBox mapNinePieceImageQuad(CSSValue*); - void mapNinePieceImageRepeat(CSSValue*, NinePieceImage&); private: bool canShareStyleWithControl(StyledElement*) const; @@ -546,6 +523,8 @@ private: int m_scopeStackParentBoundsIndex; #endif + CSSToStyleMap m_styleMap; + friend class StyleBuilder; friend bool operator==(const MatchedProperties&, const MatchedProperties&); friend bool operator!=(const MatchedProperties&, const MatchedProperties&); diff --git a/Source/WebCore/css/mediaControlsChromiumAndroid.css b/Source/WebCore/css/mediaControlsChromiumAndroid.css index 92f347840..21b647c38 100644 --- a/Source/WebCore/css/mediaControlsChromiumAndroid.css +++ b/Source/WebCore/css/mediaControlsChromiumAndroid.css @@ -30,7 +30,7 @@ body:-webkit-full-page-media { audio { width: 300px; - height: 32px; + height: 35px; } audio:-webkit-full-page-media, video:-webkit-full-page-media { @@ -39,97 +39,74 @@ audio:-webkit-full-page-media, video:-webkit-full-page-media { } audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel { - -webkit-user-select: none; - position: relative; - overflow: visible; - bottom: 0; - width: 100%; - height: 32px; - z-index: 0; - background-color: rgba(0, 0, 0, 0.6); + display: -webkit-box; + -webkit-box-orient: horizontal; + -webkit-box-align: center; + -webkit-box-pack: center; + bottom: auto; + height: 35px; + background-color: rgba(20, 20, 20, 0.8); } +audio:-webkit-full-page-media::-webkit-media-controls-panel, video:-webkit-full-page-media::-webkit-media-controls-panel { bottom: 0px; } -audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button { - display: none; -} - -audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button { - -webkit-appearance: media-play-button; - - position: absolute; - top: auto; - bottom: 7px; - left: 7px; - right: 6px; - - width: 18px; - height: 19px; -} - -audio::-webkit-media-controls-timeline-container { - -webkit-appearance: media-timeline-container; - -webkit-user-select: none; - -webkit-box-orient: horizontal; +::-webkit-media-controls { + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-box-pack: end; -webkit-box-align: center; - -webkit-box-pack: center; - -webkit-box-flex: 1; +} - position: absolute; - top: auto; +audio::-webkit-media-controls-enclosure, video::-webkit-media-controls-enclosure { + width: 100%; + max-width: 800px; + height: 35px; bottom: 0; - left: 30px; - right: 0; - - width: auto; - height: 32px; - - border-left: 1px solid rgba(255, 255, 255, 0.2); - border-right: 1px solid rgba(255, 255, 255, 0.2); + text-indent: 0; + padding: 0; + box-sizing: border-box; } -video::-webkit-media-controls-timeline-container { - -webkit-appearance: media-timeline-container; - -webkit-user-select: none; - -webkit-box-orient: horizontal; - -webkit-box-align: center; - -webkit-box-pack: center; - -webkit-box-flex: 1; - - position: absolute; - top: auto; - bottom: 0; - left: 30px; - right: 34px; +video::-webkit-media-controls-enclosure { + padding: 0px 5px 5px 5px; + height: 35px; +} - width: auto; - height: 32px; +audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button { + display: none; +} - border-left: 1px solid rgba(255, 255, 255, 0.2); - border-right: 1px solid rgba(255, 255, 255, 0.2); +audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button { + -webkit-appearance: media-play-button; + display: inline; + border: none; + box-sizing: border-box; + width: 35px; + height: 35px; + line-height: 35px; + margin-left: 9px; + margin-right: 9px; + padding: 0; } -audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display { +audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display, +audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display { -webkit-appearance: media-current-time-display; -webkit-user-select: none; - display: -webkit-box; - -webkit-box-flex: 0; - -webkit-box-pack: center; - -webkit-box-align: center; - - overflow: hidden; + display: block; + border: none; cursor: default; - line-height: 21px; - height: 20px; - width: 58px; + height: 35px; + margin: 0 9px 0 0; + padding: 0; - text-align: center; - font-family: Arial; - font-size: 16px; + line-height: 35px; + font-family: Arial, Helvetica, sans-serif; + font-size: 18px; font-weight: bold; color: white; @@ -144,39 +121,51 @@ audio::-webkit-media-controls-current-time-display, video::-webkit-media-control audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline { -webkit-appearance: media-slider; display: -webkit-box; - box-sizing: border-box; -webkit-box-flex: 1; - - padding: 0px; - margin: 0px 6px; - height: 18px; - - border-color: rgba(255, 255, 255, 0.2); - border-style: solid; - border-width: 1px; - border-radius: 2px; - background-color: rgba(255, 255, 255, 0.08); - color: rgb(50, 140, 223); + height: 8px; + margin: 0 15px 0 0; + padding: 0; + background-color: transparent; + min-width: 25px; } video::-webkit-media-controls-fullscreen-button { -webkit-appearance: media-enter-fullscreen-button; - position: absolute; - top: auto; - bottom: 0; - right: 0; - left: auto; + display: inline; + border: none; + box-sizing: border-box; + width: 35px; + height: 35px; + line-height: 35px; + margin-left: -5px; + margin-right: 9px; + padding: 0; +} - width: 34px; - height: 32px; +input[type="range"]::-webkit-media-slider-container { + display: -webkit-box; + -webkit-box-align: center; + -webkit-box-orient: horizontal; + -webkit-box-sizing: border-box; + height: 100%; + width: 100%; + border: 1px solid rgba(230, 230, 230, 0.35); + border-radius: 4px; + background-color: transparent; } -audio::-webkit-media-controls-fullscreen-button { - display: none; +input[type="range"]::-webkit-media-slider-thumb { + display: block; + -webkit-appearance: sliderthumb-horizontal; + -webkit-box-sizing: border-box; + position: relative; + bottom: 1px; + margin-left: -7px; + margin-right: -7px; } -audio::-webkit-media-controls-volume-slider-container, video::-webkit-media-controls-volume-slider-container { +audio::-webkit-media-controls-fullscreen-button { display: none; } |