diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/css/CSSProperty.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/css/CSSProperty.cpp')
-rw-r--r-- | Source/WebCore/css/CSSProperty.cpp | 138 |
1 files changed, 26 insertions, 112 deletions
diff --git a/Source/WebCore/css/CSSProperty.cpp b/Source/WebCore/css/CSSProperty.cpp index 0dd27c102..9d48b1d04 100644 --- a/Source/WebCore/css/CSSProperty.cpp +++ b/Source/WebCore/css/CSSProperty.cpp @@ -1,6 +1,6 @@ /** * (C) 1999-2003 Lars Knoll (knoll@kde.org) - * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. + * Copyright (C) 2004, 2005, 2006 Apple Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -24,8 +24,8 @@ #include "CSSValueList.h" #include "RenderStyleConstants.h" #include "StylePropertyShorthand.h" - -#include <wtf/text/StringBuilder.h> +#include "StylePropertyShorthandFunctions.h" +#include <wtf/NeverDestroyed.h> namespace WebCore { @@ -41,124 +41,21 @@ CSSPropertyID StylePropertyMetadata::shorthandID() const if (!m_isSetFromShorthand) return CSSPropertyInvalid; - Vector<StylePropertyShorthand> shorthands = matchingShorthandsForLonghand(static_cast<CSSPropertyID>(m_propertyID)); + auto shorthands = matchingShorthandsForLonghand(static_cast<CSSPropertyID>(m_propertyID)); ASSERT(shorthands.size() && m_indexInShorthandsVector >= 0 && m_indexInShorthandsVector < shorthands.size()); return shorthands[m_indexInShorthandsVector].id(); } void CSSProperty::wrapValueInCommaSeparatedList() { - RefPtr<CSSValue> value = m_value.release(); - m_value = CSSValueList::createCommaSeparated(); - toCSSValueList(m_value.get())->append(value.release()); + auto list = CSSValueList::createCommaSeparated(); + list.get().append(m_value.releaseNonNull()); + m_value = WTFMove(list); } -enum LogicalBoxSide { BeforeSide, EndSide, AfterSide, StartSide }; -enum PhysicalBoxSide { TopSide, RightSide, BottomSide, LeftSide }; - static CSSPropertyID resolveToPhysicalProperty(TextDirection direction, WritingMode writingMode, LogicalBoxSide logicalSide, const StylePropertyShorthand& shorthand) { - if (direction == LTR) { - if (writingMode == TopToBottomWritingMode) { - // The common case. The logical and physical box sides match. - // Left = Start, Right = End, Before = Top, After = Bottom - return shorthand.properties()[logicalSide]; - } - - if (writingMode == BottomToTopWritingMode) { - // Start = Left, End = Right, Before = Bottom, After = Top. - switch (logicalSide) { - case StartSide: - return shorthand.properties()[LeftSide]; - case EndSide: - return shorthand.properties()[RightSide]; - case BeforeSide: - return shorthand.properties()[BottomSide]; - default: - return shorthand.properties()[TopSide]; - } - } - - if (writingMode == LeftToRightWritingMode) { - // Start = Top, End = Bottom, Before = Left, After = Right. - switch (logicalSide) { - case StartSide: - return shorthand.properties()[TopSide]; - case EndSide: - return shorthand.properties()[BottomSide]; - case BeforeSide: - return shorthand.properties()[LeftSide]; - default: - return shorthand.properties()[RightSide]; - } - } - - // Start = Top, End = Bottom, Before = Right, After = Left - switch (logicalSide) { - case StartSide: - return shorthand.properties()[TopSide]; - case EndSide: - return shorthand.properties()[BottomSide]; - case BeforeSide: - return shorthand.properties()[RightSide]; - default: - return shorthand.properties()[LeftSide]; - } - } - - if (writingMode == TopToBottomWritingMode) { - // Start = Right, End = Left, Before = Top, After = Bottom - switch (logicalSide) { - case StartSide: - return shorthand.properties()[RightSide]; - case EndSide: - return shorthand.properties()[LeftSide]; - case BeforeSide: - return shorthand.properties()[TopSide]; - default: - return shorthand.properties()[BottomSide]; - } - } - - if (writingMode == BottomToTopWritingMode) { - // Start = Right, End = Left, Before = Bottom, After = Top - switch (logicalSide) { - case StartSide: - return shorthand.properties()[RightSide]; - case EndSide: - return shorthand.properties()[LeftSide]; - case BeforeSide: - return shorthand.properties()[BottomSide]; - default: - return shorthand.properties()[TopSide]; - } - } - - if (writingMode == LeftToRightWritingMode) { - // Start = Bottom, End = Top, Before = Left, After = Right - switch (logicalSide) { - case StartSide: - return shorthand.properties()[BottomSide]; - case EndSide: - return shorthand.properties()[TopSide]; - case BeforeSide: - return shorthand.properties()[LeftSide]; - default: - return shorthand.properties()[RightSide]; - } - } - - // Start = Bottom, End = Top, Before = Right, After = Left - switch (logicalSide) { - case StartSide: - return shorthand.properties()[BottomSide]; - case EndSide: - return shorthand.properties()[TopSide]; - case BeforeSide: - return shorthand.properties()[RightSide]; - default: - return shorthand.properties()[LeftSide]; - } + return shorthand.properties()[mapLogicalSideToPhysicalSide(makeTextFlow(writingMode, direction), logicalSide)]; } enum LogicalExtent { LogicalWidth, LogicalHeight }; @@ -173,7 +70,7 @@ static CSSPropertyID resolveToPhysicalProperty(WritingMode writingMode, LogicalE static const StylePropertyShorthand& borderDirections() { static const CSSPropertyID properties[4] = { CSSPropertyBorderTop, CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft }; - DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderDirections, (CSSPropertyBorder, properties, WTF_ARRAY_LENGTH(properties))); + static NeverDestroyed<StylePropertyShorthand> borderDirections(CSSPropertyBorder, properties); return borderDirections; } @@ -257,6 +154,23 @@ CSSPropertyID CSSProperty::resolveDirectionAwareProperty(CSSPropertyID propertyI } } +bool CSSProperty::isDescriptorOnly(CSSPropertyID propertyID) +{ + switch (propertyID) { +#if ENABLE(CSS_DEVICE_ADAPTATION) + case CSSPropertyMinZoom: + case CSSPropertyMaxZoom: + case CSSPropertyOrientation: + case CSSPropertyUserZoom: +#endif + case CSSPropertySrc: + case CSSPropertyUnicodeRange: + return true; + default: + return false; + } +} + bool CSSProperty::isDirectionAwareProperty(CSSPropertyID propertyID) { switch (propertyID) { |