summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/style
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
commit32761a6cee1d0dee366b885b7b9c777e67885688 (patch)
treed6bec92bebfb216f4126356e55518842c2f476a1 /Source/WebCore/rendering/style
parenta4e969f4965059196ca948db781e52f7cfebf19e (diff)
downloadWebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/WebCore/rendering/style')
-rw-r--r--Source/WebCore/rendering/style/BasicShapes.cpp508
-rw-r--r--Source/WebCore/rendering/style/BasicShapes.h329
-rw-r--r--Source/WebCore/rendering/style/BorderData.h18
-rw-r--r--Source/WebCore/rendering/style/BorderValue.h8
-rw-r--r--Source/WebCore/rendering/style/CollapsedBorderValue.h15
-rw-r--r--Source/WebCore/rendering/style/ContentData.cpp8
-rw-r--r--Source/WebCore/rendering/style/ContentData.h168
-rw-r--r--Source/WebCore/rendering/style/CounterDirectives.cpp7
-rw-r--r--Source/WebCore/rendering/style/CounterDirectives.h3
-rw-r--r--Source/WebCore/rendering/style/CursorList.h4
-rw-r--r--Source/WebCore/rendering/style/DataRef.h11
-rw-r--r--Source/WebCore/rendering/style/FillLayer.cpp179
-rw-r--r--Source/WebCore/rendering/style/FillLayer.h122
-rw-r--r--Source/WebCore/rendering/style/GridCoordinate.h90
-rw-r--r--Source/WebCore/rendering/style/GridLength.h26
-rw-r--r--Source/WebCore/rendering/style/GridPosition.h20
-rw-r--r--Source/WebCore/rendering/style/GridResolvedPosition.cpp340
-rw-r--r--Source/WebCore/rendering/style/GridResolvedPosition.h128
-rw-r--r--Source/WebCore/rendering/style/GridTrackSize.h90
-rw-r--r--Source/WebCore/rendering/style/KeyframeList.cpp17
-rw-r--r--Source/WebCore/rendering/style/KeyframeList.h7
-rw-r--r--Source/WebCore/rendering/style/NinePieceImage.cpp188
-rw-r--r--Source/WebCore/rendering/style/NinePieceImage.h96
-rw-r--r--Source/WebCore/rendering/style/OutlineValue.h9
-rw-r--r--Source/WebCore/rendering/style/RenderStyle.cpp1180
-rw-r--r--Source/WebCore/rendering/style/RenderStyle.h1336
-rw-r--r--Source/WebCore/rendering/style/RenderStyleConstants.cpp104
-rw-r--r--Source/WebCore/rendering/style/RenderStyleConstants.h278
-rw-r--r--Source/WebCore/rendering/style/SVGRenderStyle.cpp67
-rw-r--r--Source/WebCore/rendering/style/SVGRenderStyle.h97
-rw-r--r--Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp76
-rw-r--r--Source/WebCore/rendering/style/SVGRenderStyleDefs.h89
-rw-r--r--Source/WebCore/rendering/style/ShadowData.cpp6
-rw-r--r--Source/WebCore/rendering/style/ShadowData.h6
-rw-r--r--Source/WebCore/rendering/style/ShapeValue.cpp64
-rw-r--r--Source/WebCore/rendering/style/ShapeValue.h60
-rw-r--r--Source/WebCore/rendering/style/StyleAllInOne.cpp60
-rw-r--r--Source/WebCore/rendering/style/StyleBackgroundData.cpp2
-rw-r--r--Source/WebCore/rendering/style/StyleBackgroundData.h4
-rw-r--r--Source/WebCore/rendering/style/StyleBoxData.cpp2
-rw-r--r--Source/WebCore/rendering/style/StyleBoxData.h4
-rw-r--r--Source/WebCore/rendering/style/StyleCachedImage.cpp8
-rw-r--r--Source/WebCore/rendering/style/StyleCachedImage.h15
-rw-r--r--Source/WebCore/rendering/style/StyleCachedImageSet.cpp10
-rw-r--r--Source/WebCore/rendering/style/StyleCachedImageSet.h12
-rw-r--r--Source/WebCore/rendering/style/StyleContentAlignmentData.h69
-rw-r--r--Source/WebCore/rendering/style/StyleCustomPropertyData.h88
-rw-r--r--Source/WebCore/rendering/style/StyleDeprecatedFlexibleBoxData.cpp2
-rw-r--r--Source/WebCore/rendering/style/StyleDeprecatedFlexibleBoxData.h4
-rw-r--r--Source/WebCore/rendering/style/StyleFilterData.cpp11
-rw-r--r--Source/WebCore/rendering/style/StyleFilterData.h12
-rw-r--r--Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp2
-rw-r--r--Source/WebCore/rendering/style/StyleFlexibleBoxData.h4
-rw-r--r--Source/WebCore/rendering/style/StyleGeneratedImage.cpp29
-rw-r--r--Source/WebCore/rendering/style/StyleGeneratedImage.h29
-rw-r--r--Source/WebCore/rendering/style/StyleGridData.cpp13
-rw-r--r--Source/WebCore/rendering/style/StyleGridData.h31
-rw-r--r--Source/WebCore/rendering/style/StyleGridItemData.cpp6
-rw-r--r--Source/WebCore/rendering/style/StyleGridItemData.h7
-rw-r--r--Source/WebCore/rendering/style/StyleImage.h25
-rw-r--r--Source/WebCore/rendering/style/StyleInheritedData.cpp6
-rw-r--r--Source/WebCore/rendering/style/StyleInheritedData.h10
-rw-r--r--Source/WebCore/rendering/style/StyleMarqueeData.cpp2
-rw-r--r--Source/WebCore/rendering/style/StyleMarqueeData.h4
-rw-r--r--Source/WebCore/rendering/style/StyleMultiColData.cpp11
-rw-r--r--Source/WebCore/rendering/style/StyleMultiColData.h7
-rw-r--r--Source/WebCore/rendering/style/StylePendingImage.h28
-rw-r--r--Source/WebCore/rendering/style/StyleRareInheritedData.cpp81
-rw-r--r--Source/WebCore/rendering/style/StyleRareInheritedData.h31
-rw-r--r--Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp211
-rw-r--r--Source/WebCore/rendering/style/StyleRareNonInheritedData.h89
-rw-r--r--Source/WebCore/rendering/style/StyleReflection.h6
-rw-r--r--Source/WebCore/rendering/style/StyleScrollSnapPoints.cpp82
-rw-r--r--Source/WebCore/rendering/style/StyleScrollSnapPoints.h73
-rw-r--r--Source/WebCore/rendering/style/StyleSelfAlignmentData.h70
-rw-r--r--Source/WebCore/rendering/style/StyleSurroundData.cpp2
-rw-r--r--Source/WebCore/rendering/style/StyleSurroundData.h4
-rw-r--r--Source/WebCore/rendering/style/StyleTransformData.cpp2
-rw-r--r--Source/WebCore/rendering/style/StyleTransformData.h6
-rw-r--r--Source/WebCore/rendering/style/StyleVisualData.cpp2
-rw-r--r--Source/WebCore/rendering/style/StyleVisualData.h4
-rw-r--r--Source/WebCore/rendering/style/TextSizeAdjustment.h49
-rw-r--r--Source/WebCore/rendering/style/WillChangeData.cpp150
-rw-r--r--Source/WebCore/rendering/style/WillChangeData.h132
84 files changed, 2327 insertions, 4938 deletions
diff --git a/Source/WebCore/rendering/style/BasicShapes.cpp b/Source/WebCore/rendering/style/BasicShapes.cpp
index eafeff75b..916402a7d 100644
--- a/Source/WebCore/rendering/style/BasicShapes.cpp
+++ b/Source/WebCore/rendering/style/BasicShapes.cpp
@@ -34,15 +34,9 @@
#include "BasicShapeFunctions.h"
#include "CalculationValue.h"
#include "FloatRect.h"
-#include "FloatRoundedRect.h"
#include "LengthFunctions.h"
#include "Path.h"
#include "RenderBox.h"
-#include "SVGPathByteStream.h"
-#include "SVGPathUtilities.h"
-
-#include <wtf/NeverDestroyed.h>
-#include <wtf/TinyLRUCache.h>
namespace WebCore {
@@ -57,105 +51,103 @@ void BasicShapeCenterCoordinate::updateComputedLength()
return;
}
- auto lhs = std::make_unique<CalcExpressionLength>(Length(100, Percent));
- auto rhs = std::make_unique<CalcExpressionLength>(m_length);
- auto op = std::make_unique<CalcExpressionBinaryOperation>(WTFMove(lhs), WTFMove(rhs), CalcSubtract);
- m_computedLength = Length(CalculationValue::create(WTFMove(op), CalculationRangeAll));
+ OwnPtr<CalcExpressionLength> lhs = adoptPtr(new CalcExpressionLength(Length(100, Percent)));
+ OwnPtr<CalcExpressionLength> rhs = adoptPtr(new CalcExpressionLength(m_length));
+ OwnPtr<CalcExpressionBinaryOperation> op = adoptPtr(new CalcExpressionBinaryOperation(lhs.release(), rhs.release(), CalcSubtract));
+ m_computedLength = Length(CalculationValue::create(op.release(), CalculationRangeAll));
}
-struct SVGPathTranslatedByteStream {
- SVGPathTranslatedByteStream(const FloatPoint& offset, const SVGPathByteStream& rawStream)
- : m_offset(offset)
- , m_rawStream(rawStream)
- { }
-
- bool operator==(const SVGPathTranslatedByteStream& other) const { return other.m_offset == m_offset && other.m_rawStream == m_rawStream; }
- bool operator!=(const SVGPathTranslatedByteStream& other) const { return !(*this == other); }
- bool isEmpty() const { return m_rawStream.isEmpty(); }
-
- Path path() const
- {
- Path path;
- buildPathFromByteStream(m_rawStream, path);
- path.translate(toFloatSize(m_offset));
- return path;
- }
-
- FloatPoint m_offset;
- SVGPathByteStream m_rawStream;
-};
-
-struct EllipsePathPolicy : public TinyLRUCachePolicy<FloatRect, Path> {
-public:
- static bool isKeyNull(const FloatRect& rect) { return rect.isEmpty(); }
-
- static Path createValueForKey(const FloatRect& rect)
- {
- Path path;
- path.addEllipse(rect);
- return path;
- }
-};
-
-struct RoundedRectPathPolicy : public TinyLRUCachePolicy<FloatRoundedRect, Path> {
-public:
- static bool isKeyNull(const FloatRoundedRect& rect) { return rect.isEmpty(); }
-
- static Path createValueForKey(const FloatRoundedRect& rect)
- {
- Path path;
- path.addRoundedRect(rect);
- return path;
- }
-};
+bool BasicShape::canBlend(const BasicShape* other) const
+{
+ // FIXME: Support animations between different shapes in the future.
+ if (type() != other->type())
+ return false;
-struct PolygonPathPolicy : public TinyLRUCachePolicy<Vector<FloatPoint>, Path> {
-public:
- static bool isKeyNull(const Vector<FloatPoint>& points) { return !points.size(); }
+ // Both shapes must use the same reference box.
+ if (layoutBox() != other->layoutBox())
+ return false;
- static Path createValueForKey(const Vector<FloatPoint>& points) { return Path::polygonPathFromPoints(points); }
-};
+ // Just polygons with same number of vertices can be animated.
+ if (type() == BasicShape::BasicShapePolygonType
+ && (static_cast<const BasicShapePolygon*>(this)->values().size() != static_cast<const BasicShapePolygon*>(other)->values().size()
+ || static_cast<const BasicShapePolygon*>(this)->windRule() != static_cast<const BasicShapePolygon*>(other)->windRule()))
+ return false;
-struct TranslatedByteStreamPathPolicy : public TinyLRUCachePolicy<SVGPathTranslatedByteStream, Path> {
-public:
- static bool isKeyNull(const SVGPathTranslatedByteStream& stream) { return stream.isEmpty(); }
+ // Circles with keywords for radii coordinates cannot be animated.
+ if (type() == BasicShape::BasicShapeCircleType) {
+ const BasicShapeCircle* thisCircle = static_cast<const BasicShapeCircle*>(this);
+ const BasicShapeCircle* otherCircle = static_cast<const BasicShapeCircle*>(other);
+ if (!thisCircle->radius().canBlend(otherCircle->radius()))
+ return false;
+ }
- static Path createValueForKey(const SVGPathTranslatedByteStream& stream) { return stream.path(); }
-};
+ // Ellipses with keywords for radii coordinates cannot be animated.
+ if (type() != BasicShape::BasicShapeEllipseType)
+ return true;
-static const Path& cachedEllipsePath(const FloatRect& rect)
-{
- static NeverDestroyed<TinyLRUCache<FloatRect, Path, 4, EllipsePathPolicy>> cache;
- return cache.get().get(rect);
+ const BasicShapeEllipse* thisEllipse = static_cast<const BasicShapeEllipse*>(this);
+ const BasicShapeEllipse* otherEllipse = static_cast<const BasicShapeEllipse*>(other);
+ return (thisEllipse->radiusX().canBlend(otherEllipse->radiusX())
+ && thisEllipse->radiusY().canBlend(otherEllipse->radiusY()));
}
-static const Path& cachedRoundedRectPath(const FloatRoundedRect& rect)
+void BasicShapeRectangle::path(Path& path, const FloatRect& boundingBox)
{
- static NeverDestroyed<TinyLRUCache<FloatRoundedRect, Path, 4, RoundedRectPathPolicy>> cache;
- return cache.get().get(rect);
+ ASSERT(path.isEmpty());
+ path.addRoundedRect(
+ FloatRect(
+ floatValueForLength(m_x, boundingBox.width()) + boundingBox.x(),
+ floatValueForLength(m_y, boundingBox.height()) + boundingBox.y(),
+ floatValueForLength(m_width, boundingBox.width()),
+ floatValueForLength(m_height, boundingBox.height())
+ ),
+ FloatSize(
+ floatValueForLength(m_cornerRadiusX, boundingBox.width()),
+ floatValueForLength(m_cornerRadiusY, boundingBox.height())
+ )
+ );
}
-static const Path& cachedPolygonPath(const Vector<FloatPoint>& points)
+PassRefPtr<BasicShape> BasicShapeRectangle::blend(const BasicShape* other, double progress) const
{
- static NeverDestroyed<TinyLRUCache<Vector<FloatPoint>, Path, 4, PolygonPathPolicy>> cache;
- return cache.get().get(points);
+ ASSERT(type() == other->type());
+
+ const BasicShapeRectangle* o = static_cast<const BasicShapeRectangle*>(other);
+ RefPtr<BasicShapeRectangle> result = BasicShapeRectangle::create();
+ result->setX(m_x.blend(o->x(), progress));
+ result->setY(m_y.blend(o->y(), progress));
+ result->setWidth(m_width.blend(o->width(), progress));
+ result->setHeight(m_height.blend(o->height(), progress));
+ result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress));
+ result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress));
+ return result.release();
}
-static const Path& cachedTranslatedByteStreamPath(const SVGPathByteStream& stream, const FloatPoint& offset)
+void DeprecatedBasicShapeCircle::path(Path& path, const FloatRect& boundingBox)
{
- static NeverDestroyed<TinyLRUCache<SVGPathTranslatedByteStream, Path, 4, TranslatedByteStreamPathPolicy>> cache;
- return cache.get().get(SVGPathTranslatedByteStream(offset, stream));
+ ASSERT(path.isEmpty());
+ float diagonal = sqrtf((boundingBox.width() * boundingBox.width() + boundingBox.height() * boundingBox.height()) / 2);
+ float centerX = floatValueForLength(m_centerX, boundingBox.width());
+ float centerY = floatValueForLength(m_centerY, boundingBox.height());
+ float radius = floatValueForLength(m_radius, diagonal);
+ path.addEllipse(FloatRect(
+ centerX - radius + boundingBox.x(),
+ centerY - radius + boundingBox.y(),
+ radius * 2,
+ radius * 2
+ ));
}
-bool BasicShapeCircle::operator==(const BasicShape& other) const
+PassRefPtr<BasicShape> DeprecatedBasicShapeCircle::blend(const BasicShape* other, double progress) const
{
- if (type() != other.type())
- return false;
-
- auto& otherCircle = downcast<BasicShapeCircle>(other);
- return m_centerX == otherCircle.m_centerX
- && m_centerY == otherCircle.m_centerY
- && m_radius == otherCircle.m_radius;
+ ASSERT(type() == other->type());
+
+ const DeprecatedBasicShapeCircle* o = static_cast<const DeprecatedBasicShapeCircle*>(other);
+ RefPtr<DeprecatedBasicShapeCircle> result = DeprecatedBasicShapeCircle::create();
+ result->setCenterX(m_centerX.blend(o->centerX(), progress));
+ result->setCenterY(m_centerY.blend(o->centerY(), progress));
+ result->setRadius(m_radius.blend(o->radius(), progress));
+ return result.release();
}
float BasicShapeCircle::floatValueForRadiusInBox(float boxWidth, float boxHeight) const
@@ -166,267 +158,239 @@ float BasicShapeCircle::floatValueForRadiusInBox(float boxWidth, float boxHeight
float centerX = floatValueForCenterCoordinate(m_centerX, boxWidth);
float centerY = floatValueForCenterCoordinate(m_centerY, boxHeight);
- float widthDelta = std::abs(boxWidth - centerX);
- float heightDelta = std::abs(boxHeight - centerY);
if (m_radius.type() == BasicShapeRadius::ClosestSide)
- return std::min(std::min(std::abs(centerX), widthDelta), std::min(std::abs(centerY), heightDelta));
+ return std::min(std::min(centerX, boxWidth - centerX), std::min(centerY, boxHeight - centerY));
// If radius.type() == BasicShapeRadius::FarthestSide.
- return std::max(std::max(std::abs(centerX), widthDelta), std::max(std::abs(centerY), heightDelta));
+ return std::max(std::max(centerX, boxWidth - centerX), std::max(centerY, boxHeight - centerY));
}
-const Path& BasicShapeCircle::path(const FloatRect& boundingBox)
+void BasicShapeCircle::path(Path& path, const FloatRect& boundingBox)
{
+ ASSERT(path.isEmpty());
+
float centerX = floatValueForCenterCoordinate(m_centerX, boundingBox.width());
float centerY = floatValueForCenterCoordinate(m_centerY, boundingBox.height());
float radius = floatValueForRadiusInBox(boundingBox.width(), boundingBox.height());
-
- return cachedEllipsePath(FloatRect(centerX - radius + boundingBox.x(), centerY - radius + boundingBox.y(), radius * 2, radius * 2));
+ path.addEllipse(FloatRect(
+ centerX - radius + boundingBox.x(),
+ centerY - radius + boundingBox.y(),
+ radius * 2,
+ radius * 2
+ ));
}
-bool BasicShapeCircle::canBlend(const BasicShape& other) const
+PassRefPtr<BasicShape> BasicShapeCircle::blend(const BasicShape* other, double progress) const
{
- if (type() != other.type())
- return false;
-
- return radius().canBlend(downcast<BasicShapeCircle>(other).radius());
+ ASSERT(type() == other->type());
+ const BasicShapeCircle* o = static_cast<const BasicShapeCircle*>(other);
+ RefPtr<BasicShapeCircle> result = BasicShapeCircle::create();
+
+ result->setCenterX(m_centerX.blend(o->centerX(), progress));
+ result->setCenterY(m_centerY.blend(o->centerY(), progress));
+ result->setRadius(m_radius.blend(o->radius(), progress));
+ return result.release();
}
-Ref<BasicShape> BasicShapeCircle::blend(const BasicShape& other, double progress) const
+void DeprecatedBasicShapeEllipse::path(Path& path, const FloatRect& boundingBox)
{
- ASSERT(type() == other.type());
- auto& otherCircle = downcast<BasicShapeCircle>(other);
- auto result = BasicShapeCircle::create();
-
- result->setCenterX(m_centerX.blend(otherCircle.centerX(), progress));
- result->setCenterY(m_centerY.blend(otherCircle.centerY(), progress));
- result->setRadius(m_radius.blend(otherCircle.radius(), progress));
- return WTFMove(result);
+ ASSERT(path.isEmpty());
+ float centerX = floatValueForLength(m_centerX, boundingBox.width());
+ float centerY = floatValueForLength(m_centerY, boundingBox.height());
+ float radiusX = floatValueForLength(m_radiusX, boundingBox.width());
+ float radiusY = floatValueForLength(m_radiusY, boundingBox.height());
+ path.addEllipse(FloatRect(
+ centerX - radiusX + boundingBox.x(),
+ centerY - radiusY + boundingBox.y(),
+ radiusX * 2,
+ radiusY * 2
+ ));
}
-bool BasicShapeEllipse::operator==(const BasicShape& other) const
+PassRefPtr<BasicShape> DeprecatedBasicShapeEllipse::blend(const BasicShape* other, double progress) const
{
- if (type() != other.type())
- return false;
-
- auto& otherEllipse = downcast<BasicShapeEllipse>(other);
- return m_centerX == otherEllipse.m_centerX
- && m_centerY == otherEllipse.m_centerY
- && m_radiusX == otherEllipse.m_radiusX
- && m_radiusY == otherEllipse.m_radiusY;
+ ASSERT(type() == other->type());
+
+ const DeprecatedBasicShapeEllipse* o = static_cast<const DeprecatedBasicShapeEllipse*>(other);
+ RefPtr<DeprecatedBasicShapeEllipse> result = DeprecatedBasicShapeEllipse::create();
+ result->setCenterX(m_centerX.blend(o->centerX(), progress));
+ result->setCenterY(m_centerY.blend(o->centerY(), progress));
+ result->setRadiusX(m_radiusX.blend(o->radiusX(), progress));
+ result->setRadiusY(m_radiusY.blend(o->radiusY(), progress));
+ return result.release();
}
float BasicShapeEllipse::floatValueForRadiusInBox(const BasicShapeRadius& radius, float center, float boxWidthOrHeight) const
{
if (radius.type() == BasicShapeRadius::Value)
- return floatValueForLength(radius.value(), std::abs(boxWidthOrHeight));
+ return floatValueForLength(radius.value(), boxWidthOrHeight);
- float widthOrHeightDelta = std::abs(boxWidthOrHeight - center);
if (radius.type() == BasicShapeRadius::ClosestSide)
- return std::min(std::abs(center), widthOrHeightDelta);
+ return std::min(center, boxWidthOrHeight - center);
ASSERT(radius.type() == BasicShapeRadius::FarthestSide);
- return std::max(std::abs(center), widthOrHeightDelta);
+ return std::max(center, boxWidthOrHeight - center);
}
-const Path& BasicShapeEllipse::path(const FloatRect& boundingBox)
+void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox)
{
+ ASSERT(path.isEmpty());
+
float centerX = floatValueForCenterCoordinate(m_centerX, boundingBox.width());
float centerY = floatValueForCenterCoordinate(m_centerY, boundingBox.height());
float radiusX = floatValueForRadiusInBox(m_radiusX, centerX, boundingBox.width());
float radiusY = floatValueForRadiusInBox(m_radiusY, centerY, boundingBox.height());
-
- return cachedEllipsePath(FloatRect(centerX - radiusX + boundingBox.x(), centerY - radiusY + boundingBox.y(), radiusX * 2, radiusY * 2));
-}
-
-bool BasicShapeEllipse::canBlend(const BasicShape& other) const
-{
- if (type() != other.type())
- return false;
-
- auto& otherEllipse = downcast<BasicShapeEllipse>(other);
- return radiusX().canBlend(otherEllipse.radiusX()) && radiusY().canBlend(otherEllipse.radiusY());
+ path.addEllipse(FloatRect(
+ centerX - radiusX + boundingBox.x(),
+ centerY - radiusY + boundingBox.y(),
+ radiusX * 2,
+ radiusY * 2));
}
-Ref<BasicShape> BasicShapeEllipse::blend(const BasicShape& other, double progress) const
+PassRefPtr<BasicShape> BasicShapeEllipse::blend(const BasicShape* other, double progress) const
{
- ASSERT(type() == other.type());
- auto& otherEllipse = downcast<BasicShapeEllipse>(other);
- auto result = BasicShapeEllipse::create();
-
- if (m_radiusX.type() != BasicShapeRadius::Value || otherEllipse.radiusX().type() != BasicShapeRadius::Value
- || m_radiusY.type() != BasicShapeRadius::Value || otherEllipse.radiusY().type() != BasicShapeRadius::Value) {
- result->setCenterX(otherEllipse.centerX());
- result->setCenterY(otherEllipse.centerY());
- result->setRadiusX(otherEllipse.radiusX());
- result->setRadiusY(otherEllipse.radiusY());
- return WTFMove(result);
+ ASSERT(type() == other->type());
+ const BasicShapeEllipse* o = static_cast<const BasicShapeEllipse*>(other);
+ RefPtr<BasicShapeEllipse> result = BasicShapeEllipse::create();
+
+ if (m_radiusX.type() != BasicShapeRadius::Value || o->radiusX().type() != BasicShapeRadius::Value
+ || m_radiusY.type() != BasicShapeRadius::Value || o->radiusY().type() != BasicShapeRadius::Value) {
+ result->setCenterX(o->centerX());
+ result->setCenterY(o->centerY());
+ result->setRadiusX(o->radiusX());
+ result->setRadiusY(o->radiusY());
+ return result;
}
- result->setCenterX(m_centerX.blend(otherEllipse.centerX(), progress));
- result->setCenterY(m_centerY.blend(otherEllipse.centerY(), progress));
- result->setRadiusX(m_radiusX.blend(otherEllipse.radiusX(), progress));
- result->setRadiusY(m_radiusY.blend(otherEllipse.radiusY(), progress));
- return WTFMove(result);
+ result->setCenterX(m_centerX.blend(o->centerX(), progress));
+ result->setCenterY(m_centerY.blend(o->centerY(), progress));
+ result->setRadiusX(m_radiusX.blend(o->radiusX(), progress));
+ result->setRadiusY(m_radiusY.blend(o->radiusY(), progress));
+ return result.release();
}
-bool BasicShapePolygon::operator==(const BasicShape& other) const
-{
- if (type() != other.type())
- return false;
-
- auto& otherPolygon = downcast<BasicShapePolygon>(other);
- return m_windRule == otherPolygon.m_windRule
- && m_values == otherPolygon.m_values;
-}
-
-const Path& BasicShapePolygon::path(const FloatRect& boundingBox)
+void BasicShapePolygon::path(Path& path, const FloatRect& boundingBox)
{
+ ASSERT(path.isEmpty());
ASSERT(!(m_values.size() % 2));
size_t length = m_values.size();
+
+ if (!length)
+ return;
- Vector<FloatPoint> points(length / 2);
- for (size_t i = 0; i < points.size(); ++i) {
- points[i].setX(floatValueForLength(m_values.at(i * 2), boundingBox.width()) + boundingBox.x());
- points[i].setY(floatValueForLength(m_values.at(i * 2 + 1), boundingBox.height()) + boundingBox.y());
+ path.moveTo(FloatPoint(floatValueForLength(m_values.at(0), boundingBox.width()) + boundingBox.x(),
+ floatValueForLength(m_values.at(1), boundingBox.height()) + boundingBox.y()));
+ for (size_t i = 2; i < length; i = i + 2) {
+ path.addLineTo(FloatPoint(floatValueForLength(m_values.at(i), boundingBox.width()) + boundingBox.x(),
+ floatValueForLength(m_values.at(i + 1), boundingBox.height()) + boundingBox.y()));
}
-
- return cachedPolygonPath(points);
+ path.closeSubpath();
}
-bool BasicShapePolygon::canBlend(const BasicShape& other) const
+PassRefPtr<BasicShape> BasicShapePolygon::blend(const BasicShape* other, double progress) const
{
- if (type() != other.type())
- return false;
+ ASSERT(type() == other->type());
- auto& otherPolygon = downcast<BasicShapePolygon>(other);
- return values().size() == otherPolygon.values().size() && windRule() == otherPolygon.windRule();
-}
-
-Ref<BasicShape> BasicShapePolygon::blend(const BasicShape& other, double progress) const
-{
- ASSERT(type() == other.type());
-
- auto& otherPolygon = downcast<BasicShapePolygon>(other);
- ASSERT(m_values.size() == otherPolygon.values().size());
+ const BasicShapePolygon* o = static_cast<const BasicShapePolygon*>(other);
+ ASSERT(m_values.size() == o->values().size());
ASSERT(!(m_values.size() % 2));
size_t length = m_values.size();
- auto result = BasicShapePolygon::create();
+ RefPtr<BasicShapePolygon> result = BasicShapePolygon::create();
if (!length)
- return WTFMove(result);
+ return result.release();
- result->setWindRule(otherPolygon.windRule());
+ result->setWindRule(o->windRule());
for (size_t i = 0; i < length; i = i + 2) {
- result->appendPoint(m_values.at(i).blend(otherPolygon.values().at(i), progress),
- m_values.at(i + 1).blend(otherPolygon.values().at(i + 1), progress));
+ result->appendPoint(m_values.at(i).blend(o->values().at(i), progress),
+ m_values.at(i + 1).blend(o->values().at(i + 1), progress));
}
- return WTFMove(result);
-}
-
-BasicShapePath::BasicShapePath(std::unique_ptr<SVGPathByteStream>&& byteStream)
- : m_byteStream(WTFMove(byteStream))
-{
-}
-
-const Path& BasicShapePath::path(const FloatRect& boundingBox)
-{
- return cachedTranslatedByteStreamPath(*m_byteStream, boundingBox.location());
+ return result.release();
}
-bool BasicShapePath::operator==(const BasicShape& other) const
+void BasicShapeInsetRectangle::path(Path& path, const FloatRect& boundingBox)
{
- if (type() != other.type())
- return false;
-
- auto& otherPath = downcast<BasicShapePath>(other);
- return m_windRule == otherPath.m_windRule && *m_byteStream == *otherPath.m_byteStream;
-}
-
-bool BasicShapePath::canBlend(const BasicShape& other) const
-{
- if (type() != other.type())
- return false;
-
- auto& otherPath = downcast<BasicShapePath>(other);
- return windRule() == otherPath.windRule() && canBlendSVGPathByteStreams(*m_byteStream, *otherPath.pathData());
-}
-
-Ref<BasicShape> BasicShapePath::blend(const BasicShape& from, double progress) const
-{
- ASSERT(type() == from.type());
-
- auto& fromPath = downcast<BasicShapePath>(from);
-
- auto resultingPathBytes = std::make_unique<SVGPathByteStream>();
- buildAnimatedSVGPathByteStream(*fromPath.m_byteStream, *m_byteStream, *resultingPathBytes, progress);
-
- auto result = BasicShapePath::create(WTFMove(resultingPathBytes));
- result->setWindRule(windRule());
- return WTFMove(result);
-}
-
-bool BasicShapeInset::operator==(const BasicShape& other) const
-{
- if (type() != other.type())
- return false;
-
- auto& otherInset = downcast<BasicShapeInset>(other);
- return m_right == otherInset.m_right
- && m_top == otherInset.m_top
- && m_bottom == otherInset.m_bottom
- && m_left == otherInset.m_left
- && m_topLeftRadius == otherInset.m_topLeftRadius
- && m_topRightRadius == otherInset.m_topRightRadius
- && m_bottomRightRadius == otherInset.m_bottomRightRadius
- && m_bottomLeftRadius == otherInset.m_bottomLeftRadius;
+ ASSERT(path.isEmpty());
+ float left = floatValueForLength(m_left, boundingBox.width());
+ float top = floatValueForLength(m_top, boundingBox.height());
+ path.addRoundedRect(
+ FloatRect(
+ left + boundingBox.x(),
+ top + boundingBox.y(),
+ std::max<float>(boundingBox.width() - left - floatValueForLength(m_right, boundingBox.width()), 0),
+ std::max<float>(boundingBox.height() - top - floatValueForLength(m_bottom, boundingBox.height()), 0)
+ ),
+ FloatSize(
+ floatValueForLength(m_cornerRadiusX, boundingBox.width()),
+ floatValueForLength(m_cornerRadiusY, boundingBox.height())
+ )
+ );
}
-static FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatRect& boundingBox)
+PassRefPtr<BasicShape> BasicShapeInsetRectangle::blend(const BasicShape* other, double progress) const
{
- return FloatSize(floatValueForLength(lengthSize.width(), boundingBox.width()),
- floatValueForLength(lengthSize.height(), boundingBox.height()));
+ ASSERT(type() == other->type());
+
+ const BasicShapeInsetRectangle* o = static_cast<const BasicShapeInsetRectangle*>(other);
+ RefPtr<BasicShapeInsetRectangle> result = BasicShapeInsetRectangle::create();
+ result->setTop(m_top.blend(o->top(), progress));
+ result->setRight(m_right.blend(o->right(), progress));
+ result->setBottom(m_bottom.blend(o->bottom(), progress));
+ result->setLeft(m_left.blend(o->left(), progress));
+ result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress));
+ result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress));
+ return result.release();
}
-const Path& BasicShapeInset::path(const FloatRect& boundingBox)
+void BasicShapeInset::path(Path& path, const FloatRect& boundingBox)
{
+ ASSERT(path.isEmpty());
float left = floatValueForLength(m_left, boundingBox.width());
float top = floatValueForLength(m_top, boundingBox.height());
- auto rect = FloatRect(left + boundingBox.x(), top + boundingBox.y(),
- std::max<float>(boundingBox.width() - left - floatValueForLength(m_right, boundingBox.width()), 0),
- std::max<float>(boundingBox.height() - top - floatValueForLength(m_bottom, boundingBox.height()), 0));
- auto radii = FloatRoundedRect::Radii(floatSizeForLengthSize(m_topLeftRadius, boundingBox),
- floatSizeForLengthSize(m_topRightRadius, boundingBox),
- floatSizeForLengthSize(m_bottomLeftRadius, boundingBox),
- floatSizeForLengthSize(m_bottomRightRadius, boundingBox));
- radii.scale(calcBorderRadiiConstraintScaleFor(rect, radii));
-
- return cachedRoundedRectPath(FloatRoundedRect(rect, radii));
-}
-
-bool BasicShapeInset::canBlend(const BasicShape& other) const
-{
- return type() == other.type();
+ path.addRoundedRect(
+ FloatRect(
+ left + boundingBox.x(),
+ top + boundingBox.y(),
+ std::max<float>(boundingBox.width() - left - floatValueForLength(m_right, boundingBox.width()), 0),
+ std::max<float>(boundingBox.height() - top - floatValueForLength(m_bottom, boundingBox.height()), 0)
+ ),
+ FloatSize(
+ floatValueForLength(m_topLeftRadius.width(), boundingBox.width()),
+ floatValueForLength(m_topLeftRadius.height(), boundingBox.height())
+ ),
+ FloatSize(
+ floatValueForLength(m_topRightRadius.width(), boundingBox.width()),
+ floatValueForLength(m_topRightRadius.height(), boundingBox.height())
+ ),
+ FloatSize(
+ floatValueForLength(m_bottomRightRadius.width(), boundingBox.width()),
+ floatValueForLength(m_bottomRightRadius.height(), boundingBox.height())
+ ),
+ FloatSize(
+ floatValueForLength(m_bottomLeftRadius.width(), boundingBox.width()),
+ floatValueForLength(m_bottomLeftRadius.height(), boundingBox.height())
+ )
+ );
}
-Ref<BasicShape> BasicShapeInset::blend(const BasicShape& other, double progress) const
+PassRefPtr<BasicShape> BasicShapeInset::blend(const BasicShape* other, double progress) const
{
- ASSERT(type() == other.type());
+ ASSERT(type() == other->type());
- auto& otherInset = downcast<BasicShapeInset>(other);
- auto result = BasicShapeInset::create();
- result->setTop(m_top.blend(otherInset.top(), progress));
- result->setRight(m_right.blend(otherInset.right(), progress));
- result->setBottom(m_bottom.blend(otherInset.bottom(), progress));
- result->setLeft(m_left.blend(otherInset.left(), progress));
+ const BasicShapeInset* o = static_cast<const BasicShapeInset*>(other);
+ RefPtr<BasicShapeInset> result = BasicShapeInset::create();
+ result->setTop(m_top.blend(o->top(), progress));
+ result->setRight(m_right.blend(o->right(), progress));
+ result->setBottom(m_bottom.blend(o->bottom(), progress));
+ result->setLeft(m_left.blend(o->left(), progress));
- result->setTopLeftRadius(m_topLeftRadius.blend(otherInset.topLeftRadius(), progress));
- result->setTopRightRadius(m_topRightRadius.blend(otherInset.topRightRadius(), progress));
- result->setBottomRightRadius(m_bottomRightRadius.blend(otherInset.bottomRightRadius(), progress));
- result->setBottomLeftRadius(m_bottomLeftRadius.blend(otherInset.bottomLeftRadius(), progress));
+ result->setTopLeftRadius(m_topLeftRadius.blend(o->topLeftRadius(), progress));
+ result->setTopRightRadius(m_topRightRadius.blend(o->topRightRadius(), progress));
+ result->setBottomRightRadius(m_bottomRightRadius.blend(o->bottomRightRadius(), progress));
+ result->setBottomLeftRadius(m_bottomLeftRadius.blend(o->bottomLeftRadius(), progress));
- return WTFMove(result);
+ return result.release();
}
}
diff --git a/Source/WebCore/rendering/style/BasicShapes.h b/Source/WebCore/rendering/style/BasicShapes.h
index be1572b13..36464596a 100644
--- a/Source/WebCore/rendering/style/BasicShapes.h
+++ b/Source/WebCore/rendering/style/BasicShapes.h
@@ -36,7 +36,6 @@
#include "WindRule.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
-#include <wtf/TypeCasts.h>
#include <wtf/Vector.h>
namespace WebCore {
@@ -44,29 +43,82 @@ namespace WebCore {
class FloatRect;
class Path;
class RenderBox;
-class SVGPathByteStream;
class BasicShape : public RefCounted<BasicShape> {
public:
virtual ~BasicShape() { }
enum Type {
+ BasicShapeRectangleType,
+ DeprecatedBasicShapeCircleType,
+ DeprecatedBasicShapeEllipseType,
BasicShapePolygonType,
- BasicShapePathType,
+ BasicShapeInsetRectangleType,
BasicShapeCircleType,
BasicShapeEllipseType,
BasicShapeInsetType
};
- virtual Type type() const = 0;
+ bool canBlend(const BasicShape*) const;
- virtual const Path& path(const FloatRect&) = 0;
+ virtual void path(Path&, const FloatRect&) = 0;
virtual WindRule windRule() const { return RULE_NONZERO; }
+ virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const = 0;
+
+ virtual Type type() const = 0;
- virtual bool canBlend(const BasicShape&) const = 0;
- virtual Ref<BasicShape> blend(const BasicShape&, double) const = 0;
+ LayoutBox layoutBox() const { return m_layoutBox; }
+ void setLayoutBox(LayoutBox layoutBox) { m_layoutBox = layoutBox; }
+
+protected:
+ BasicShape()
+ : m_layoutBox(BoxMissing)
+ {
+ }
- virtual bool operator==(const BasicShape&) const = 0;
+private:
+ LayoutBox m_layoutBox;
+};
+
+class BasicShapeRectangle : public BasicShape {
+public:
+ static PassRefPtr<BasicShapeRectangle> create() { return adoptRef(new BasicShapeRectangle); }
+
+ const Length& x() const { return m_x; }
+ const Length& y() const { return m_y; }
+ const Length& width() const { return m_width; }
+ const Length& height() const { return m_height; }
+ const Length& cornerRadiusX() const { return m_cornerRadiusX; }
+ const Length& cornerRadiusY() const { return m_cornerRadiusY; }
+
+ void setX(Length x) { m_x = std::move(x); }
+ void setY(Length y) { m_y = std::move(y); }
+ void setWidth(Length width) { m_width = std::move(width); }
+ void setHeight(Length height) { m_height = std::move(height); }
+ void setCornerRadiusX(Length radiusX)
+ {
+ ASSERT(!radiusX.isUndefined());
+ m_cornerRadiusX = std::move(radiusX);
+ }
+ void setCornerRadiusY(Length radiusY)
+ {
+ ASSERT(!radiusY.isUndefined());
+ m_cornerRadiusY = std::move(radiusY);
+ }
+
+ virtual void path(Path&, const FloatRect&) override;
+ virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
+
+ virtual Type type() const override { return BasicShapeRectangleType; }
+private:
+ BasicShapeRectangle() { }
+
+ Length m_y;
+ Length m_x;
+ Length m_width;
+ Length m_height;
+ Length m_cornerRadiusX;
+ Length m_cornerRadiusY;
};
class BasicShapeCenterCoordinate {
@@ -105,20 +157,13 @@ public:
{
return BasicShapeCenterCoordinate(TopLeft, m_computedLength.blend(other.m_computedLength, progress));
}
-
- bool operator==(const BasicShapeCenterCoordinate& other) const
- {
- return m_direction == other.m_direction
- && m_length == other.m_length
- && m_computedLength == other.m_computedLength;
- }
private:
- void updateComputedLength();
-
Direction m_direction;
Length m_length;
Length m_computedLength;
+
+ void updateComputedLength();
};
class BasicShapeRadius {
@@ -128,23 +173,10 @@ public:
ClosestSide,
FarthestSide
};
- BasicShapeRadius()
- : m_value(Undefined),
- m_type(ClosestSide)
- { }
-
- explicit BasicShapeRadius(Length v)
- : m_value(v)
- , m_type(Value)
- { }
- explicit BasicShapeRadius(Type t)
- : m_value(Undefined)
- , m_type(t)
- { }
- BasicShapeRadius(const BasicShapeRadius& other)
- : m_value(other.value())
- , m_type(other.type())
- { }
+ BasicShapeRadius() : m_value(Undefined), m_type(ClosestSide) { }
+ explicit BasicShapeRadius(Length v) : m_value(v), m_type(Value) { }
+ explicit BasicShapeRadius(Type t) : m_value(Undefined), m_type(t) { }
+ BasicShapeRadius(const BasicShapeRadius& other) : m_value(other.value()), m_type(other.type()) { }
const Length& value() const { return m_value; }
Type type() const { return m_type; }
@@ -162,11 +194,6 @@ public:
return BasicShapeRadius(m_value.blend(other.value(), progress));
}
-
- bool operator==(const BasicShapeRadius& other) const
- {
- return m_value == other.m_value && m_type == other.m_type;
- }
private:
Length m_value;
@@ -174,39 +201,58 @@ private:
};
-class BasicShapeCircle final : public BasicShape {
+class BasicShapeCircle : public BasicShape {
public:
- static Ref<BasicShapeCircle> create() { return adoptRef(*new BasicShapeCircle); }
+ static PassRefPtr<BasicShapeCircle> create() { return adoptRef(new BasicShapeCircle); }
const BasicShapeCenterCoordinate& centerX() const { return m_centerX; }
const BasicShapeCenterCoordinate& centerY() const { return m_centerY; }
const BasicShapeRadius& radius() const { return m_radius; }
float floatValueForRadiusInBox(float boxWidth, float boxHeight) const;
- void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = WTFMove(centerX); }
- void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = WTFMove(centerY); }
- void setRadius(BasicShapeRadius radius) { m_radius = WTFMove(radius); }
+ void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = std::move(centerX); }
+ void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = std::move(centerY); }
+ void setRadius(BasicShapeRadius radius) { m_radius = std::move(radius); }
-private:
- BasicShapeCircle() = default;
+ virtual void path(Path&, const FloatRect&) override;
+ virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
virtual Type type() const override { return BasicShapeCircleType; }
-
- virtual const Path& path(const FloatRect&) override;
-
- virtual bool canBlend(const BasicShape&) const override;
- virtual Ref<BasicShape> blend(const BasicShape&, double) const override;
-
- virtual bool operator==(const BasicShape&) const override;
+private:
+ BasicShapeCircle() { }
BasicShapeCenterCoordinate m_centerX;
BasicShapeCenterCoordinate m_centerY;
BasicShapeRadius m_radius;
};
-class BasicShapeEllipse final : public BasicShape {
+class DeprecatedBasicShapeCircle : public BasicShape {
public:
- static Ref<BasicShapeEllipse> create() { return adoptRef(*new BasicShapeEllipse); }
+ static PassRefPtr<DeprecatedBasicShapeCircle> create() { return adoptRef(new DeprecatedBasicShapeCircle); }
+
+ const Length& centerX() const { return m_centerX; }
+ const Length& centerY() const { return m_centerY; }
+ const Length& radius() const { return m_radius; }
+
+ void setCenterX(Length centerX) { m_centerX = std::move(centerX); }
+ void setCenterY(Length centerY) { m_centerY = std::move(centerY); }
+ void setRadius(Length radius) { m_radius = std::move(radius); }
+
+ virtual void path(Path&, const FloatRect&) override;
+ virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
+
+ virtual Type type() const override { return DeprecatedBasicShapeCircleType; }
+private:
+ DeprecatedBasicShapeCircle() { }
+
+ Length m_centerX;
+ Length m_centerY;
+ Length m_radius;
+};
+
+class BasicShapeEllipse : public BasicShape {
+public:
+ static PassRefPtr<BasicShapeEllipse> create() { return adoptRef(new BasicShapeEllipse); }
const BasicShapeCenterCoordinate& centerX() const { return m_centerX; }
const BasicShapeCenterCoordinate& centerY() const { return m_centerY; }
@@ -214,22 +260,17 @@ public:
const BasicShapeRadius& radiusY() const { return m_radiusY; }
float floatValueForRadiusInBox(const BasicShapeRadius&, float center, float boxWidthOrHeight) const;
- void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = WTFMove(centerX); }
- void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = WTFMove(centerY); }
- void setRadiusX(BasicShapeRadius radiusX) { m_radiusX = WTFMove(radiusX); }
- void setRadiusY(BasicShapeRadius radiusY) { m_radiusY = WTFMove(radiusY); }
+ void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = std::move(centerX); }
+ void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = std::move(centerY); }
+ void setRadiusX(BasicShapeRadius radiusX) { m_radiusX = std::move(radiusX); }
+ void setRadiusY(BasicShapeRadius radiusY) { m_radiusY = std::move(radiusY); }
-private:
- BasicShapeEllipse() = default;
+ virtual void path(Path&, const FloatRect&) override;
+ virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
virtual Type type() const override { return BasicShapeEllipseType; }
-
- virtual const Path& path(const FloatRect&) override;
-
- virtual bool canBlend(const BasicShape&) const override;
- virtual Ref<BasicShape> blend(const BasicShape&, double) const override;
-
- virtual bool operator==(const BasicShape&) const override;
+private:
+ BasicShapeEllipse() { }
BasicShapeCenterCoordinate m_centerX;
BasicShapeCenterCoordinate m_centerY;
@@ -237,66 +278,103 @@ private:
BasicShapeRadius m_radiusY;
};
-class BasicShapePolygon final : public BasicShape {
+class DeprecatedBasicShapeEllipse : public BasicShape {
+public:
+ static PassRefPtr<DeprecatedBasicShapeEllipse> create() { return adoptRef(new DeprecatedBasicShapeEllipse); }
+
+ const Length& centerX() const { return m_centerX; }
+ const Length& centerY() const { return m_centerY; }
+ const Length& radiusX() const { return m_radiusX; }
+ const Length& radiusY() const { return m_radiusY; }
+
+ void setCenterX(Length centerX) { m_centerX = std::move(centerX); }
+ void setCenterY(Length centerY) { m_centerY = std::move(centerY); }
+ void setRadiusX(Length radiusX) { m_radiusX = std::move(radiusX); }
+ void setRadiusY(Length radiusY) { m_radiusY = std::move(radiusY); }
+
+ virtual void path(Path&, const FloatRect&) override;
+ virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
+
+ virtual Type type() const override { return DeprecatedBasicShapeEllipseType; }
+private:
+ DeprecatedBasicShapeEllipse() { }
+
+ Length m_centerX;
+ Length m_centerY;
+ Length m_radiusX;
+ Length m_radiusY;
+};
+
+class BasicShapePolygon : public BasicShape {
public:
- static Ref<BasicShapePolygon> create() { return adoptRef(*new BasicShapePolygon); }
+ static PassRefPtr<BasicShapePolygon> create() { return adoptRef(new BasicShapePolygon); }
const Vector<Length>& values() const { return m_values; }
const Length& getXAt(unsigned i) const { return m_values[2 * i]; }
const Length& getYAt(unsigned i) const { return m_values[2 * i + 1]; }
void setWindRule(WindRule windRule) { m_windRule = windRule; }
- void appendPoint(Length x, Length y) { m_values.append(WTFMove(x)); m_values.append(WTFMove(y)); }
+ void appendPoint(Length x, Length y) { m_values.append(std::move(x)); m_values.append(std::move(y)); }
- virtual WindRule windRule() const override { return m_windRule; }
+ virtual void path(Path&, const FloatRect&) override;
+ virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
-private:
- BasicShapePolygon() = default;
+ virtual WindRule windRule() const override { return m_windRule; }
virtual Type type() const override { return BasicShapePolygonType; }
+private:
+ BasicShapePolygon()
+ : m_windRule(RULE_NONZERO)
+ { }
- virtual const Path& path(const FloatRect&) override;
-
- virtual bool canBlend(const BasicShape&) const override;
- virtual Ref<BasicShape> blend(const BasicShape&, double) const override;
-
- virtual bool operator==(const BasicShape&) const override;
-
- WindRule m_windRule { RULE_NONZERO };
+ WindRule m_windRule;
Vector<Length> m_values;
};
-class BasicShapePath final : public BasicShape {
+class BasicShapeInsetRectangle : public BasicShape {
public:
- static Ref<BasicShapePath> create(std::unique_ptr<SVGPathByteStream>&& byteStream)
+ static PassRefPtr<BasicShapeInsetRectangle> create() { return adoptRef(new BasicShapeInsetRectangle); }
+
+ const Length& top() const { return m_top; }
+ const Length& right() const { return m_right; }
+ const Length& bottom() const { return m_bottom; }
+ const Length& left() const { return m_left; }
+ const Length& cornerRadiusX() const { return m_cornerRadiusX; }
+ const Length& cornerRadiusY() const { return m_cornerRadiusY; }
+
+ void setTop(Length top) { m_top = std::move(top); }
+ void setRight(Length right) { m_right = std::move(right); }
+ void setBottom(Length bottom) { m_bottom = std::move(bottom); }
+ void setLeft(Length left) { m_left = std::move(left); }
+ void setCornerRadiusX(Length radiusX)
{
- return adoptRef(*new BasicShapePath(WTFMove(byteStream)));
+ ASSERT(!radiusX.isUndefined());
+ m_cornerRadiusX = std::move(radiusX);
+ }
+ void setCornerRadiusY(Length radiusY)
+ {
+ ASSERT(!radiusY.isUndefined());
+ m_cornerRadiusY = std::move(radiusY);
}
- void setWindRule(WindRule windRule) { m_windRule = windRule; }
- virtual WindRule windRule() const override { return m_windRule; }
-
- const SVGPathByteStream* pathData() const { return m_byteStream.get(); }
+ virtual void path(Path&, const FloatRect&) override;
+ virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
+ virtual Type type() const override { return BasicShapeInsetRectangleType; }
private:
- BasicShapePath(std::unique_ptr<SVGPathByteStream>&&);
-
- virtual Type type() const override { return BasicShapePathType; }
-
- virtual const Path& path(const FloatRect&) override;
+ BasicShapeInsetRectangle() { }
- virtual bool canBlend(const BasicShape&) const override;
- virtual Ref<BasicShape> blend(const BasicShape&, double) const override;
-
- virtual bool operator==(const BasicShape&) const override;
-
- std::unique_ptr<SVGPathByteStream> m_byteStream;
- WindRule m_windRule { RULE_NONZERO };
+ Length m_right;
+ Length m_top;
+ Length m_bottom;
+ Length m_left;
+ Length m_cornerRadiusX;
+ Length m_cornerRadiusY;
};
-class BasicShapeInset final : public BasicShape {
+class BasicShapeInset : public BasicShape {
public:
- static Ref<BasicShapeInset> create() { return adoptRef(*new BasicShapeInset); }
+ static PassRefPtr<BasicShapeInset> create() { return adoptRef(new BasicShapeInset); }
const Length& top() const { return m_top; }
const Length& right() const { return m_right; }
@@ -308,27 +386,22 @@ public:
const LengthSize& bottomRightRadius() const { return m_bottomRightRadius; }
const LengthSize& bottomLeftRadius() const { return m_bottomLeftRadius; }
- void setTop(Length top) { m_top = WTFMove(top); }
- void setRight(Length right) { m_right = WTFMove(right); }
- void setBottom(Length bottom) { m_bottom = WTFMove(bottom); }
- void setLeft(Length left) { m_left = WTFMove(left); }
+ void setTop(Length top) { m_top = std::move(top); }
+ void setRight(Length right) { m_right = std::move(right); }
+ void setBottom(Length bottom) { m_bottom = std::move(bottom); }
+ void setLeft(Length left) { m_left = std::move(left); }
- void setTopLeftRadius(LengthSize radius) { m_topLeftRadius = WTFMove(radius); }
- void setTopRightRadius(LengthSize radius) { m_topRightRadius = WTFMove(radius); }
- void setBottomRightRadius(LengthSize radius) { m_bottomRightRadius = WTFMove(radius); }
- void setBottomLeftRadius(LengthSize radius) { m_bottomLeftRadius = WTFMove(radius); }
+ void setTopLeftRadius(LengthSize radius) { m_topLeftRadius = std::move(radius); }
+ void setTopRightRadius(LengthSize radius) { m_topRightRadius = std::move(radius); }
+ void setBottomRightRadius(LengthSize radius) { m_bottomRightRadius = std::move(radius); }
+ void setBottomLeftRadius(LengthSize radius) { m_bottomLeftRadius = std::move(radius); }
-private:
- BasicShapeInset() = default;
+ virtual void path(Path&, const FloatRect&) override;
+ virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
virtual Type type() const override { return BasicShapeInsetType; }
-
- virtual const Path& path(const FloatRect&) override;
-
- virtual bool canBlend(const BasicShape&) const override;
- virtual Ref<BasicShape> blend(const BasicShape&, double) const override;
-
- virtual bool operator==(const BasicShape&) const override;
+private:
+ BasicShapeInset() { }
Length m_right;
Length m_top;
@@ -341,17 +414,5 @@ private:
LengthSize m_bottomLeftRadius;
};
-} // namespace WebCore
-
-#define SPECIALIZE_TYPE_TRAITS_BASIC_SHAPE(ToValueTypeName, predicate) \
-SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToValueTypeName) \
- static bool isType(const WebCore::BasicShape& basicShape) { return basicShape.type() == WebCore::predicate; } \
-SPECIALIZE_TYPE_TRAITS_END()
-
-SPECIALIZE_TYPE_TRAITS_BASIC_SHAPE(BasicShapeCircle, BasicShape::BasicShapeCircleType)
-SPECIALIZE_TYPE_TRAITS_BASIC_SHAPE(BasicShapeEllipse, BasicShape::BasicShapeEllipseType)
-SPECIALIZE_TYPE_TRAITS_BASIC_SHAPE(BasicShapePolygon, BasicShape::BasicShapePolygonType)
-SPECIALIZE_TYPE_TRAITS_BASIC_SHAPE(BasicShapePath, BasicShape::BasicShapePathType)
-SPECIALIZE_TYPE_TRAITS_BASIC_SHAPE(BasicShapeInset, BasicShape::BasicShapeInsetType)
-
-#endif // BasicShapes_h
+}
+#endif
diff --git a/Source/WebCore/rendering/style/BorderData.h b/Source/WebCore/rendering/style/BorderData.h
index cd1a5834c..e65628a99 100644
--- a/Source/WebCore/rendering/style/BorderData.h
+++ b/Source/WebCore/rendering/style/BorderData.h
@@ -47,11 +47,6 @@ public:
return m_left.nonZero(!haveImage) || m_right.nonZero(!haveImage) || m_top.nonZero(!haveImage) || m_bottom.nonZero(!haveImage);
}
- bool hasFill() const
- {
- return m_image.hasImage() && m_image.fill();
- }
-
bool hasBorderRadius() const
{
if (!m_topLeft.width().isZero())
@@ -65,38 +60,33 @@ public:
return false;
}
- float borderLeftWidth() const
+ unsigned borderLeftWidth() const
{
if (!m_image.hasImage() && (m_left.style() == BNONE || m_left.style() == BHIDDEN))
return 0;
return m_left.width();
}
- float borderRightWidth() const
+ unsigned borderRightWidth() const
{
if (!m_image.hasImage() && (m_right.style() == BNONE || m_right.style() == BHIDDEN))
return 0;
return m_right.width();
}
- float borderTopWidth() const
+ unsigned borderTopWidth() const
{
if (!m_image.hasImage() && (m_top.style() == BNONE || m_top.style() == BHIDDEN))
return 0;
return m_top.width();
}
- float borderBottomWidth() const
+ unsigned borderBottomWidth() const
{
if (!m_image.hasImage() && (m_bottom.style() == BNONE || m_bottom.style() == BHIDDEN))
return 0;
return m_bottom.width();
}
-
- FloatBoxExtent borderWidth() const
- {
- return FloatBoxExtent(borderTopWidth(), borderRightWidth(), borderBottomWidth(), borderLeftWidth());
- }
bool operator==(const BorderData& o) const
{
diff --git a/Source/WebCore/rendering/style/BorderValue.h b/Source/WebCore/rendering/style/BorderValue.h
index cf340d0f6..c8f6512c5 100644
--- a/Source/WebCore/rendering/style/BorderValue.h
+++ b/Source/WebCore/rendering/style/BorderValue.h
@@ -34,9 +34,9 @@ class BorderValue {
friend class RenderStyle;
public:
BorderValue()
- : m_width(3)
- , m_color(0)
+ : m_color(0)
, m_colorIsValid(false)
+ , m_width(3)
, m_style(BNONE)
, m_isAuto(AUTO_OFF)
{
@@ -75,14 +75,14 @@ public:
Color color() const { return Color(m_color, m_colorIsValid); }
- float width() const { return m_width; }
+ unsigned width() const { return m_width; }
EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
protected:
- float m_width;
RGBA32 m_color;
unsigned m_colorIsValid : 1;
+ unsigned m_width : 26;
unsigned m_style : 4; // EBorderStyle
// This is only used by OutlineValue but moved here to keep the bits packed.
diff --git a/Source/WebCore/rendering/style/CollapsedBorderValue.h b/Source/WebCore/rendering/style/CollapsedBorderValue.h
index da9c53a6f..120173bda 100644
--- a/Source/WebCore/rendering/style/CollapsedBorderValue.h
+++ b/Source/WebCore/rendering/style/CollapsedBorderValue.h
@@ -26,14 +26,15 @@
#define CollapsedBorderValue_h
#include "BorderValue.h"
-#include "LayoutUnit.h"
namespace WebCore {
class CollapsedBorderValue {
public:
CollapsedBorderValue()
- : m_colorIsValid(false)
+ : m_color(0)
+ , m_colorIsValid(false)
+ , m_width(0)
, m_style(BNONE)
, m_precedence(BOFF)
, m_transparent(false)
@@ -41,16 +42,16 @@ public:
}
CollapsedBorderValue(const BorderValue& border, const Color& color, EBorderPrecedence precedence)
- : m_width(LayoutUnit(border.nonZero() ? border.width() : 0))
- , m_color(color.rgb())
+ : m_color(color.rgb())
, m_colorIsValid(color.isValid())
+ , m_width(border.nonZero() ? border.width() : 0)
, m_style(border.style())
, m_precedence(precedence)
, m_transparent(border.isTransparent())
{
}
- LayoutUnit width() const { return m_style > BHIDDEN ? m_width : LayoutUnit::fromPixel(0); }
+ unsigned width() const { return m_style > BHIDDEN ? m_width : 0; }
EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
bool exists() const { return m_precedence != BOFF; }
Color color() const { return Color(m_color, m_colorIsValid); }
@@ -63,9 +64,9 @@ public:
}
private:
- LayoutUnit m_width;
- RGBA32 m_color { 0 };
+ RGBA32 m_color;
unsigned m_colorIsValid : 1;
+ unsigned m_width : 23;
unsigned m_style : 4; // EBorderStyle
unsigned m_precedence : 3; // EBorderPrecedence
unsigned m_transparent : 1;
diff --git a/Source/WebCore/rendering/style/ContentData.cpp b/Source/WebCore/rendering/style/ContentData.cpp
index ea28c4269..b0c469b41 100644
--- a/Source/WebCore/rendering/style/ContentData.cpp
+++ b/Source/WebCore/rendering/style/ContentData.cpp
@@ -40,7 +40,7 @@ std::unique_ptr<ContentData> ContentData::clone() const
ContentData* lastNewData = result.get();
for (const ContentData* contentData = next(); contentData; contentData = contentData->next()) {
auto newData = contentData->cloneInternal();
- lastNewData->setNext(WTFMove(newData));
+ lastNewData->setNext(std::move(newData));
lastNewData = lastNewData->next();
}
@@ -52,14 +52,14 @@ RenderPtr<RenderObject> ImageContentData::createContentRenderer(Document& docume
auto image = createRenderer<RenderImage>(document, RenderStyle::createStyleInheritingFromPseudoStyle(pseudoStyle), m_image.get());
image->initializeStyle();
image->setAltText(altText());
- return WTFMove(image);
+ return std::move(image);
}
RenderPtr<RenderObject> TextContentData::createContentRenderer(Document& document, const RenderStyle&) const
{
auto fragment = createRenderer<RenderTextFragment>(document, m_text);
fragment->setAltText(altText());
- return WTFMove(fragment);
+ return std::move(fragment);
}
RenderPtr<RenderObject> CounterContentData::createContentRenderer(Document& document, const RenderStyle&) const
@@ -71,7 +71,7 @@ RenderPtr<RenderObject> QuoteContentData::createContentRenderer(Document& docume
{
auto quote = createRenderer<RenderQuote>(document, RenderStyle::createStyleInheritingFromPseudoStyle(pseudoStyle), m_quote);
quote->initializeStyle();
- return WTFMove(quote);
+ return std::move(quote);
}
} // namespace WebCore
diff --git a/Source/WebCore/rendering/style/ContentData.h b/Source/WebCore/rendering/style/ContentData.h
index d97a197b8..4d1b9717a 100644
--- a/Source/WebCore/rendering/style/ContentData.h
+++ b/Source/WebCore/rendering/style/ContentData.h
@@ -28,7 +28,7 @@
#include "CounterContent.h"
#include "StyleImage.h"
#include "RenderPtr.h"
-#include <wtf/TypeCasts.h>
+#include <wtf/OwnPtr.h>
namespace WebCore {
@@ -39,199 +39,149 @@ class RenderStyle;
class ContentData {
WTF_MAKE_FAST_ALLOCATED;
public:
- enum Type {
- CounterDataType,
- ImageDataType,
- QuoteDataType,
- TextDataType
- };
virtual ~ContentData() { }
- Type type() const { return m_type; }
-
- bool isCounter() const { return type() == CounterDataType; }
- bool isImage() const { return type() == ImageDataType; }
- bool isQuote() const { return type() == QuoteDataType; }
- bool isText() const { return type() == TextDataType; }
+ virtual bool isCounter() const { return false; }
+ virtual bool isImage() const { return false; }
+ virtual bool isQuote() const { return false; }
+ virtual bool isText() const { return false; }
virtual RenderPtr<RenderObject> createContentRenderer(Document&, const RenderStyle&) const = 0;
std::unique_ptr<ContentData> clone() const;
ContentData* next() const { return m_next.get(); }
- void setNext(std::unique_ptr<ContentData> next) { m_next = WTFMove(next); }
+ void setNext(std::unique_ptr<ContentData> next) { m_next = std::move(next); }
void setAltText(const String& alt) { m_altText = alt; }
const String& altText() const { return m_altText; }
-
-protected:
- explicit ContentData(Type type)
- : m_type(type)
- {
- }
+
+ virtual bool equals(const ContentData&) const = 0;
private:
virtual std::unique_ptr<ContentData> cloneInternal() const = 0;
std::unique_ptr<ContentData> m_next;
String m_altText;
- Type m_type;
};
class ImageContentData final : public ContentData {
public:
explicit ImageContentData(PassRefPtr<StyleImage> image)
- : ContentData(ImageDataType)
- , m_image(image)
+ : m_image(image)
{
- ASSERT(m_image);
}
- const StyleImage& image() const { return *m_image; }
- void setImage(PassRefPtr<StyleImage> image)
- {
- ASSERT(image);
- m_image = image;
- }
+ const StyleImage* image() const { return m_image.get(); }
+ StyleImage* image() { return m_image.get(); }
+ void setImage(PassRefPtr<StyleImage> image) { m_image = image; }
+ virtual bool isImage() const override { return true; }
virtual RenderPtr<RenderObject> createContentRenderer(Document&, const RenderStyle&) const override;
+ virtual bool equals(const ContentData& data) const override
+ {
+ if (!data.isImage())
+ return false;
+ return *static_cast<const ImageContentData&>(data).image() == *image();
+ }
+
private:
virtual std::unique_ptr<ContentData> cloneInternal() const override
{
- std::unique_ptr<ContentData> image = std::make_unique<ImageContentData>(m_image.get());
- image->setAltText(altText());
+ RefPtr<StyleImage> image = const_cast<StyleImage*>(this->image());
- return image;
+ return std::make_unique<ImageContentData>(image.release());
}
RefPtr<StyleImage> m_image;
};
-inline bool operator==(const ImageContentData& a, const ImageContentData& b)
-{
- return a.image() == b.image();
-}
-
-inline bool operator!=(const ImageContentData& a, const ImageContentData& b)
-{
- return !(a == b);
-}
-
class TextContentData final : public ContentData {
public:
explicit TextContentData(const String& text)
- : ContentData(TextDataType)
- , m_text(text)
+ : m_text(text)
{
}
const String& text() const { return m_text; }
void setText(const String& text) { m_text = text; }
+ virtual bool isText() const override { return true; }
virtual RenderPtr<RenderObject> createContentRenderer(Document&, const RenderStyle&) const override;
+ virtual bool equals(const ContentData& data) const override
+ {
+ if (!data.isText())
+ return false;
+ return static_cast<const TextContentData&>(data).text() == text();
+ }
+
private:
virtual std::unique_ptr<ContentData> cloneInternal() const override { return std::make_unique<TextContentData>(text()); }
String m_text;
};
-inline bool operator==(const TextContentData& a, const TextContentData& b)
-{
- return a.text() == b.text();
-}
-
-inline bool operator!=(const TextContentData& a, const TextContentData& b)
-{
- return !(a == b);
-}
-
class CounterContentData final : public ContentData {
public:
explicit CounterContentData(std::unique_ptr<CounterContent> counter)
- : ContentData(CounterDataType)
- , m_counter(WTFMove(counter))
+ : m_counter(std::move(counter))
{
- ASSERT(m_counter);
}
- const CounterContent& counter() const { return *m_counter; }
- void setCounter(std::unique_ptr<CounterContent> counter)
- {
- ASSERT(counter);
- m_counter = WTFMove(counter);
- }
+ const CounterContent* counter() const { return m_counter.get(); }
+ void setCounter(std::unique_ptr<CounterContent> counter) { m_counter = std::move(counter); }
+ virtual bool isCounter() const override { return true; }
virtual RenderPtr<RenderObject> createContentRenderer(Document&, const RenderStyle&) const override;
private:
virtual std::unique_ptr<ContentData> cloneInternal() const override
{
- auto counterData = std::make_unique<CounterContent>(counter());
- return std::make_unique<CounterContentData>(WTFMove(counterData));
+ auto counterData = std::make_unique<CounterContent>(*counter());
+ return std::make_unique<CounterContentData>(std::move(counterData));
+ }
+
+ virtual bool equals(const ContentData& data) const override
+ {
+ if (!data.isCounter())
+ return false;
+ return *static_cast<const CounterContentData&>(data).counter() == *counter();
}
std::unique_ptr<CounterContent> m_counter;
};
-inline bool operator==(const CounterContentData& a, const CounterContentData& b)
-{
- return a.counter() == b.counter();
-}
-
-inline bool operator!=(const CounterContentData& a, const CounterContentData& b)
-{
- return !(a == b);
-}
-
class QuoteContentData final : public ContentData {
public:
explicit QuoteContentData(QuoteType quote)
- : ContentData(QuoteDataType)
- , m_quote(quote)
+ : m_quote(quote)
{
}
QuoteType quote() const { return m_quote; }
void setQuote(QuoteType quote) { m_quote = quote; }
+ virtual bool isQuote() const override { return true; }
virtual RenderPtr<RenderObject> createContentRenderer(Document&, const RenderStyle&) const override;
+ virtual bool equals(const ContentData& data) const override
+ {
+ if (!data.isQuote())
+ return false;
+ return static_cast<const QuoteContentData&>(data).quote() == quote();
+ }
+
private:
virtual std::unique_ptr<ContentData> cloneInternal() const override { return std::make_unique<QuoteContentData>(quote()); }
QuoteType m_quote;
};
-inline bool operator==(const QuoteContentData& a, const QuoteContentData& b)
-{
- return a.quote() == b.quote();
-}
-
-inline bool operator!=(const QuoteContentData& a, const QuoteContentData& b)
-{
- return !(a == b);
-}
-
inline bool operator==(const ContentData& a, const ContentData& b)
{
- if (a.type() != b.type())
- return false;
-
- switch (a.type()) {
- case ContentData::CounterDataType:
- return downcast<CounterContentData>(a) == downcast<CounterContentData>(b);
- case ContentData::ImageDataType:
- return downcast<ImageContentData>(a) == downcast<ImageContentData>(b);
- case ContentData::QuoteDataType:
- return downcast<QuoteContentData>(a) == downcast<QuoteContentData>(b);
- case ContentData::TextDataType:
- return downcast<TextContentData>(a) == downcast<TextContentData>(b);
- }
-
- ASSERT_NOT_REACHED();
- return false;
+ return a.equals(b);
}
inline bool operator!=(const ContentData& a, const ContentData& b)
@@ -241,14 +191,4 @@ inline bool operator!=(const ContentData& a, const ContentData& b)
} // namespace WebCore
-#define SPECIALIZE_TYPE_TRAITS_CONTENT_DATA(ToClassName, ContentDataName) \
-SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToClassName) \
- static bool isType(const WebCore::ContentData& contentData) { return contentData.is##ContentDataName(); } \
-SPECIALIZE_TYPE_TRAITS_END()
-
-SPECIALIZE_TYPE_TRAITS_CONTENT_DATA(ImageContentData, Image)
-SPECIALIZE_TYPE_TRAITS_CONTENT_DATA(TextContentData, Text)
-SPECIALIZE_TYPE_TRAITS_CONTENT_DATA(CounterContentData, Counter)
-SPECIALIZE_TYPE_TRAITS_CONTENT_DATA(QuoteContentData, Quote)
-
#endif // ContentData_h
diff --git a/Source/WebCore/rendering/style/CounterDirectives.cpp b/Source/WebCore/rendering/style/CounterDirectives.cpp
index 4b7fd7a1e..06d44ddf6 100644
--- a/Source/WebCore/rendering/style/CounterDirectives.cpp
+++ b/Source/WebCore/rendering/style/CounterDirectives.cpp
@@ -21,6 +21,7 @@
#include "config.h"
#include "CounterDirectives.h"
+#include <wtf/PassOwnPtr.h>
namespace WebCore {
@@ -32,11 +33,11 @@ bool operator==(const CounterDirectives& a, const CounterDirectives& b)
&& a.resetValue() == b.resetValue();
}
-std::unique_ptr<CounterDirectiveMap> clone(const CounterDirectiveMap& counterDirectives)
+PassOwnPtr<CounterDirectiveMap> clone(const CounterDirectiveMap& counterDirectives)
{
- auto result = std::make_unique<CounterDirectiveMap>();
+ OwnPtr<CounterDirectiveMap> result = adoptPtr(new CounterDirectiveMap);
*result = counterDirectives;
- return result;
+ return result.release();
}
} // namespace WebCore
diff --git a/Source/WebCore/rendering/style/CounterDirectives.h b/Source/WebCore/rendering/style/CounterDirectives.h
index d5de076cf..cf793bb8f 100644
--- a/Source/WebCore/rendering/style/CounterDirectives.h
+++ b/Source/WebCore/rendering/style/CounterDirectives.h
@@ -25,7 +25,6 @@
#ifndef CounterDirectives_h
#define CounterDirectives_h
-#include <memory>
#include <wtf/HashMap.h>
#include <wtf/MathExtras.h>
#include <wtf/RefPtr.h>
@@ -105,7 +104,7 @@ inline bool operator!=(const CounterDirectives& a, const CounterDirectives& b) {
typedef HashMap<AtomicString, CounterDirectives> CounterDirectiveMap;
-std::unique_ptr<CounterDirectiveMap> clone(const CounterDirectiveMap&);
+PassOwnPtr<CounterDirectiveMap> clone(const CounterDirectiveMap&);
} // namespace WebCore
diff --git a/Source/WebCore/rendering/style/CursorList.h b/Source/WebCore/rendering/style/CursorList.h
index 4b3e3d358..a1d1fe797 100644
--- a/Source/WebCore/rendering/style/CursorList.h
+++ b/Source/WebCore/rendering/style/CursorList.h
@@ -33,9 +33,9 @@ namespace WebCore {
class CursorList : public RefCounted<CursorList> {
public:
- static Ref<CursorList> create()
+ static PassRefPtr<CursorList> create()
{
- return adoptRef(*new CursorList);
+ return adoptRef(new CursorList);
}
const CursorData& operator[](int i) const { return m_vector[i]; }
diff --git a/Source/WebCore/rendering/style/DataRef.h b/Source/WebCore/rendering/style/DataRef.h
index 0afb6ecd9..3eb14e1eb 100644
--- a/Source/WebCore/rendering/style/DataRef.h
+++ b/Source/WebCore/rendering/style/DataRef.h
@@ -24,17 +24,18 @@
#ifndef DataRef_h
#define DataRef_h
+#include <wtf/PassRef.h>
#include <wtf/Ref.h>
namespace WebCore {
template <typename T> class DataRef {
public:
- DataRef(Ref<T>&& data) : m_data(WTFMove(data)) { }
+ DataRef(PassRef<T> data) : m_data(std::move(data)) { }
DataRef(const DataRef& other) : m_data(const_cast<T&>(other.m_data.get())) { }
DataRef& operator=(const DataRef& other) { m_data = const_cast<T&>(other.m_data.get()); return *this; }
- const T* get() const { return m_data.ptr(); }
+ const T* get() const { return &m_data.get(); }
const T& operator*() const { return *get(); }
const T* operator->() const { return get(); }
@@ -43,17 +44,17 @@ public:
{
if (!m_data->hasOneRef())
m_data = m_data->copy();
- return m_data.ptr();
+ return &m_data.get();
}
bool operator==(const DataRef<T>& o) const
{
- return m_data.ptr() == o.m_data.ptr() || m_data.get() == o.m_data.get();
+ return &m_data.get() == &o.m_data.get() || m_data.get() == o.m_data.get();
}
bool operator!=(const DataRef<T>& o) const
{
- return m_data.ptr() != o.m_data.ptr() && m_data.get() != o.m_data.get();
+ return &m_data.get() != &o.m_data.get() && m_data.get() != o.m_data.get();
}
private:
diff --git a/Source/WebCore/rendering/style/FillLayer.cpp b/Source/WebCore/rendering/style/FillLayer.cpp
index a0f0abee4..3c563b278 100644
--- a/Source/WebCore/rendering/style/FillLayer.cpp
+++ b/Source/WebCore/rendering/style/FillLayer.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple 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
@@ -22,40 +22,39 @@
#include "config.h"
#include "FillLayer.h"
-#include "TextStream.h"
-#include <wtf/PointerComparison.h>
-
namespace WebCore {
struct SameSizeAsFillLayer {
- FillLayer* next;
+ FillLayer* m_next;
- RefPtr<StyleImage> image;
+ RefPtr<StyleImage> m_image;
- Length x;
- Length y;
+ Length m_xPosition;
+ Length m_yPosition;
- LengthSize sizeLength;
+ LengthSize m_sizeLength;
- unsigned bitfields : 32;
- unsigned bitfields2 : 11;
+ unsigned m_bitfields: 32;
+ unsigned m_bitfields2: 1;
};
COMPILE_ASSERT(sizeof(FillLayer) == sizeof(SameSizeAsFillLayer), FillLayer_should_stay_small);
FillLayer::FillLayer(EFillLayerType type)
- : m_image(FillLayer::initialFillImage(type))
+ : m_next(0)
+ , m_image(FillLayer::initialFillImage(type))
, m_xPosition(FillLayer::initialFillXPosition(type))
, m_yPosition(FillLayer::initialFillYPosition(type))
+ , m_sizeLength(FillLayer::initialFillSizeLength(type))
, m_attachment(FillLayer::initialFillAttachment(type))
, m_clip(FillLayer::initialFillClip(type))
, m_origin(FillLayer::initialFillOrigin(type))
, m_repeatX(FillLayer::initialFillRepeatX(type))
, m_repeatY(FillLayer::initialFillRepeatY(type))
, m_composite(FillLayer::initialFillComposite(type))
- , m_sizeType(SizeNone)
+ , m_sizeType(FillLayer::initialFillSizeType(type))
, m_blendMode(FillLayer::initialFillBlendMode(type))
- , m_maskSourceType(FillLayer::initialFillMaskSourceType(type))
+ , m_maskSourceType(FillLayer::initialMaskSourceType(type))
, m_imageSet(false)
, m_attachmentSet(false)
, m_clipSet(false)
@@ -65,8 +64,8 @@ FillLayer::FillLayer(EFillLayerType type)
, m_xPosSet(false)
, m_yPosSet(false)
, m_backgroundOriginSet(false)
- , m_backgroundXOrigin(static_cast<unsigned>(Edge::Left))
- , m_backgroundYOrigin(static_cast<unsigned>(Edge::Top))
+ , m_backgroundXOrigin(LeftEdge)
+ , m_backgroundYOrigin(TopEdge)
, m_compositeSet(type == MaskFillLayer)
, m_blendModeSet(false)
, m_maskSourceTypeSet(false)
@@ -75,7 +74,7 @@ FillLayer::FillLayer(EFillLayerType type)
}
FillLayer::FillLayer(const FillLayer& o)
- : m_next(o.m_next ? std::make_unique<FillLayer>(*o.m_next) : nullptr)
+ : m_next(o.m_next ? new FillLayer(*o.m_next) : 0)
, m_image(o.m_image)
, m_xPosition(o.m_xPosition)
, m_yPosition(o.m_yPosition)
@@ -109,13 +108,15 @@ FillLayer::FillLayer(const FillLayer& o)
FillLayer::~FillLayer()
{
- // Delete the layers in a loop rather than allowing recursive calls to the destructors.
- for (std::unique_ptr<FillLayer> next = WTFMove(m_next); next; next = WTFMove(next->m_next)) { }
+ delete m_next;
}
FillLayer& FillLayer::operator=(const FillLayer& o)
{
- m_next = o.m_next ? std::make_unique<FillLayer>(*o.m_next) : nullptr;
+ if (m_next != o.m_next) {
+ delete m_next;
+ m_next = o.m_next ? new FillLayer(*o.m_next) : 0;
+ }
m_image = o.m_image;
m_xPosition = o.m_xPosition;
@@ -154,14 +155,14 @@ FillLayer& FillLayer::operator=(const FillLayer& o)
bool FillLayer::operator==(const FillLayer& o) const
{
// We do not check the "isSet" booleans for each property, since those are only used during initial construction
- // to propagate patterns into layers. All layer comparisons happen after values have all been filled in anyway.
- return arePointingToEqualData(m_image.get(), o.m_image.get()) && m_xPosition == o.m_xPosition && m_yPosition == o.m_yPosition
- && m_backgroundXOrigin == o.m_backgroundXOrigin && m_backgroundYOrigin == o.m_backgroundYOrigin
- && m_attachment == o.m_attachment && m_clip == o.m_clip && m_composite == o.m_composite
- && m_blendMode == o.m_blendMode && m_origin == o.m_origin && m_repeatX == o.m_repeatX
- && m_repeatY == o.m_repeatY && m_sizeType == o.m_sizeType && m_maskSourceType == o.m_maskSourceType
- && m_sizeLength == o.m_sizeLength && m_type == o.m_type
- && ((m_next && o.m_next) ? *m_next == *o.m_next : m_next == o.m_next);
+ // to propagate patterns into layers. All layer comparisons happen after values have all been filled in anyway.
+ return StyleImage::imagesEquivalent(m_image.get(), o.m_image.get()) && m_xPosition == o.m_xPosition && m_yPosition == o.m_yPosition
+ && m_backgroundXOrigin == o.m_backgroundXOrigin && m_backgroundYOrigin == o.m_backgroundYOrigin
+ && m_attachment == o.m_attachment && m_clip == o.m_clip && m_composite == o.m_composite
+ && m_blendMode == o.m_blendMode && m_origin == o.m_origin && m_repeatX == o.m_repeatX
+ && m_repeatY == o.m_repeatY && m_sizeType == o.m_sizeType && m_maskSourceType == o.m_maskSourceType
+ && m_sizeLength == o.m_sizeLength && m_type == o.m_type
+ && ((m_next && o.m_next) ? *m_next == *o.m_next : m_next == o.m_next);
}
void FillLayer::fillUnsetProperties()
@@ -289,15 +290,18 @@ void FillLayer::fillUnsetProperties()
void FillLayer::cullEmptyLayers()
{
- for (FillLayer* layer = this; layer; layer = layer->m_next.get()) {
- if (layer->m_next && !layer->m_next->isImageSet()) {
- layer->m_next = nullptr;
+ FillLayer* next;
+ for (FillLayer* p = this; p; p = next) {
+ next = p->m_next;
+ if (next && !next->isImageSet()) {
+ delete next;
+ p->m_next = 0;
break;
}
}
}
-static inline EFillBox clipMax(EFillBox clipA, EFillBox clipB)
+static EFillBox clipMax(EFillBox clipA, EFillBox clipB)
{
if (clipA == BorderFillBox || clipB == BorderFillBox)
return BorderFillBox;
@@ -310,15 +314,11 @@ static inline EFillBox clipMax(EFillBox clipA, EFillBox clipB)
void FillLayer::computeClipMax() const
{
- Vector<const FillLayer*, 4> layers;
- for (auto* layer = this; layer; layer = layer->m_next.get())
- layers.append(layer);
- EFillBox computedClipMax = TextFillBox;
- for (unsigned i = layers.size(); i; --i) {
- auto& layer = *layers[i - 1];
- computedClipMax = clipMax(computedClipMax, layer.clip());
- layer.m_clipMax = computedClipMax;
- }
+ if (m_next) {
+ m_next->computeClipMax();
+ m_clipMax = clipMax(clip(), m_next->clip());
+ } else
+ m_clipMax = m_clip;
}
bool FillLayer::clipOccludesNextLayers(bool firstLayer) const
@@ -328,25 +328,29 @@ bool FillLayer::clipOccludesNextLayers(bool firstLayer) const
return m_clip == m_clipMax;
}
-bool FillLayer::containsImage(StyleImage& image) const
+bool FillLayer::containsImage(StyleImage* s) const
{
- for (auto* layer = this; layer; layer = layer->m_next.get()) {
- if (layer->m_image && image == *layer->m_image)
- return true;
- }
+ if (!s)
+ return false;
+ if (m_image && *s == *m_image)
+ return true;
+ if (m_next)
+ return m_next->containsImage(s);
return false;
}
bool FillLayer::imagesAreLoaded() const
{
- for (auto* layer = this; layer; layer = layer->m_next.get()) {
- if (layer->m_image && !layer->m_image->isLoaded())
+ const FillLayer* curr;
+ for (curr = this; curr; curr = curr->next()) {
+ if (curr->m_image && !curr->m_image->isLoaded())
return false;
}
+
return true;
}
-bool FillLayer::hasOpaqueImage(const RenderElement& renderer) const
+bool FillLayer::hasOpaqueImage(const RenderElement* renderer) const
{
if (!m_image)
return false;
@@ -354,83 +358,18 @@ bool FillLayer::hasOpaqueImage(const RenderElement& renderer) const
if (m_composite == CompositeClear || m_composite == CompositeCopy)
return true;
- return m_blendMode == BlendModeNormal && m_composite == CompositeSourceOver && m_image->knownToBeOpaque(&renderer);
-}
-
-bool FillLayer::hasRepeatXY() const
-{
- return m_repeatX == RepeatFill && m_repeatY == RepeatFill;
-}
+ if (m_blendMode != BlendModeNormal)
+ return false;
-bool FillLayer::hasImage() const
-{
- for (auto* layer = this; layer; layer = layer->m_next.get()) {
- if (layer->image())
- return true;
- }
- return false;
-}
+ if (m_composite == CompositeSourceOver)
+ return m_image->knownToBeOpaque(renderer);
-bool FillLayer::hasFixedImage() const
-{
- for (auto* layer = this; layer; layer = layer->m_next.get()) {
- if (layer->m_image && layer->m_attachment == FixedBackgroundAttachment)
- return true;
- }
return false;
}
-static inline bool layerImagesIdentical(const FillLayer& layer1, const FillLayer& layer2)
-{
- // We just care about pointer equivalency.
- return layer1.image() == layer2.image();
-}
-
-bool FillLayer::imagesIdentical(const FillLayer* layer1, const FillLayer* layer2)
-{
- for (; layer1 && layer2; layer1 = layer1->next(), layer2 = layer2->next()) {
- if (!layerImagesIdentical(*layer1, *layer2))
- return false;
- }
-
- return !layer1 && !layer2;
-}
-
-TextStream& operator<<(TextStream& ts, FillSize fillSize)
-{
- return ts << fillSize.type << " " << fillSize.size;
-}
-
-TextStream& operator<<(TextStream& ts, const FillLayer& layer)
+bool FillLayer::hasRepeatXY() const
{
- TextStream::GroupScope scope(ts);
- ts << "fill-layer";
-
- ts.startGroup();
- ts << "position " << layer.xPosition() << " " << layer.yPosition();
- ts.endGroup();
-
- ts.dumpProperty("size", layer.size());
-
- ts.startGroup();
- ts << "background-origin " << layer.backgroundXOrigin() << " " << layer.backgroundYOrigin();
- ts.endGroup();
-
- ts.startGroup();
- ts << "repeat " << layer.repeatX() << " " << layer.repeatY();
- ts.endGroup();
-
- ts.dumpProperty("clip", layer.clip());
- ts.dumpProperty("origin", layer.origin());
-
- ts.dumpProperty("composite", layer.composite());
- ts.dumpProperty("blend-mode", layer.blendMode());
- ts.dumpProperty("mask-type", layer.maskSourceType());
-
- if (layer.next())
- ts << *layer.next();
-
- return ts;
+ return m_repeatX == RepeatFill && m_repeatY == RepeatFill;
}
} // namespace WebCore
diff --git a/Source/WebCore/rendering/style/FillLayer.h b/Source/WebCore/rendering/style/FillLayer.h
index 2358b4db2..be4818fff 100644
--- a/Source/WebCore/rendering/style/FillLayer.h
+++ b/Source/WebCore/rendering/style/FillLayer.h
@@ -2,7 +2,7 @@
* Copyright (C) 2000 Lars Knoll (knoll@kde.org)
* (C) 2000 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
*
* This library is free software; you can redistribute it and/or
@@ -26,6 +26,7 @@
#define FillLayer_h
#include "GraphicsTypes.h"
+#include "Length.h"
#include "LengthSize.h"
#include "RenderStyleConstants.h"
#include "StyleImage.h"
@@ -41,37 +42,36 @@ struct FillSize {
{
}
- FillSize(EFillSizeType type, const LengthSize& size)
- : type(type)
- , size(size)
+ FillSize(EFillSizeType t, LengthSize size)
+ : type(t)
+ , size(std::move(size))
{
}
+ bool operator==(const FillSize& o) const
+ {
+ return type == o.type && size == o.size;
+ }
+ bool operator!=(const FillSize& o) const
+ {
+ return !(*this == o);
+ }
+
EFillSizeType type;
LengthSize size;
};
-inline bool operator==(const FillSize& a, const FillSize& b)
-{
- return a.type == b.type && a.size == b.size;
-}
-
-inline bool operator!=(const FillSize& a, const FillSize& b)
-{
- return !(a == b);
-}
-
class FillLayer {
WTF_MAKE_FAST_ALLOCATED;
public:
- explicit FillLayer(EFillLayerType);
+ FillLayer(EFillLayerType);
~FillLayer();
StyleImage* image() const { return m_image.get(); }
const Length& xPosition() const { return m_xPosition; }
const Length& yPosition() const { return m_yPosition; }
- Edge backgroundXOrigin() const { return static_cast<Edge>(m_backgroundXOrigin); }
- Edge backgroundYOrigin() const { return static_cast<Edge>(m_backgroundYOrigin); }
+ BackgroundEdgeOrigin backgroundXOrigin() const { return static_cast<BackgroundEdgeOrigin>(m_backgroundXOrigin); }
+ BackgroundEdgeOrigin backgroundYOrigin() const { return static_cast<BackgroundEdgeOrigin>(m_backgroundYOrigin); }
EFillAttachment attachment() const { return static_cast<EFillAttachment>(m_attachment); }
EFillBox clip() const { return static_cast<EFillBox>(m_clip); }
EFillBox origin() const { return static_cast<EFillBox>(m_origin); }
@@ -84,8 +84,8 @@ public:
FillSize size() const { return FillSize(static_cast<EFillSizeType>(m_sizeType), m_sizeLength); }
EMaskSourceType maskSourceType() const { return static_cast<EMaskSourceType>(m_maskSourceType); }
- const FillLayer* next() const { return m_next.get(); }
- FillLayer* next() { return m_next.get(); }
+ const FillLayer* next() const { return m_next; }
+ FillLayer* next() { return m_next; }
bool isImageSet() const { return m_imageSet; }
bool isXPositionSet() const { return m_xPosSet; }
@@ -101,11 +101,11 @@ public:
bool isSizeSet() const { return m_sizeType != SizeNone; }
bool isMaskSourceTypeSet() const { return m_maskSourceTypeSet; }
- void setImage(PassRefPtr<StyleImage> image) { m_image = image; m_imageSet = true; }
- void setXPosition(Length length) { m_xPosition = WTFMove(length); m_xPosSet = true; }
- void setYPosition(Length length) { m_yPosition = WTFMove(length); m_yPosSet = true; }
- void setBackgroundXOrigin(Edge o) { m_backgroundXOrigin = static_cast<unsigned>(o); m_backgroundOriginSet = true; }
- void setBackgroundYOrigin(Edge o) { m_backgroundYOrigin = static_cast<unsigned>(o); m_backgroundOriginSet = true; }
+ void setImage(PassRefPtr<StyleImage> i) { m_image = i; m_imageSet = true; }
+ void setXPosition(Length length) { m_xPosition = std::move(length); m_xPosSet = true; }
+ void setYPosition(Length length) { m_yPosition = std::move(length); m_yPosSet = true; }
+ void setBackgroundXOrigin(BackgroundEdgeOrigin o) { m_backgroundXOrigin = o; m_backgroundOriginSet = true; }
+ void setBackgroundYOrigin(BackgroundEdgeOrigin o) { m_backgroundYOrigin = o; m_backgroundOriginSet = true; }
void setAttachment(EFillAttachment attachment) { m_attachment = attachment; m_attachmentSet = true; }
void setClip(EFillBox b) { m_clip = b; m_clipSet = true; }
void setOrigin(EFillBox b) { m_origin = b; m_originSet = true; }
@@ -118,10 +118,17 @@ public:
void setSize(FillSize f) { m_sizeType = f.type; m_sizeLength = f.size; }
void setMaskSourceType(EMaskSourceType m) { m_maskSourceType = m; m_maskSourceTypeSet = true; }
- void clearImage() { m_image = nullptr; m_imageSet = false; }
-
- void clearXPosition() { m_xPosSet = false; m_backgroundOriginSet = false; }
- void clearYPosition() { m_yPosSet = false; m_backgroundOriginSet = false; }
+ void clearImage() { m_image.clear(); m_imageSet = false; }
+ void clearXPosition()
+ {
+ m_xPosSet = false;
+ m_backgroundOriginSet = false;
+ }
+ void clearYPosition()
+ {
+ m_yPosSet = false;
+ m_backgroundOriginSet = false;
+ }
void clearAttachment() { m_attachmentSet = false; }
void clearClip() { m_clipSet = false; }
@@ -133,19 +140,35 @@ public:
void clearSize() { m_sizeType = SizeNone; }
void clearMaskSourceType() { m_maskSourceTypeSet = false; }
- void setNext(std::unique_ptr<FillLayer> next) { m_next = WTFMove(next); }
+ void setNext(FillLayer* n) { if (m_next != n) { delete m_next; m_next = n; } }
- FillLayer& operator=(const FillLayer&);
- FillLayer(const FillLayer&);
+ FillLayer& operator=(const FillLayer& o);
+ FillLayer(const FillLayer& o);
- bool operator==(const FillLayer&) const;
- bool operator!=(const FillLayer& other) const { return !(*this == other); }
+ bool operator==(const FillLayer& o) const;
+ bool operator!=(const FillLayer& o) const
+ {
+ return !(*this == o);
+ }
- bool containsImage(StyleImage&) const;
+ bool containsImage(StyleImage*) const;
bool imagesAreLoaded() const;
- bool hasImage() const;
- bool hasFixedImage() const;
- bool hasOpaqueImage(const RenderElement&) const;
+
+ bool hasImage() const
+ {
+ if (m_image)
+ return true;
+ return m_next ? m_next->hasImage() : false;
+ }
+
+ bool hasFixedImage() const
+ {
+ if (m_image && m_attachment == FixedBackgroundAttachment)
+ return true;
+ return m_next ? m_next->hasFixedImage() : false;
+ }
+
+ bool hasOpaqueImage(const RenderElement*) const;
bool hasRepeatXY() const;
bool clipOccludesNextLayers(bool firstLayer) const;
@@ -154,8 +177,6 @@ public:
void fillUnsetProperties();
void cullEmptyLayers();
- static bool imagesIdentical(const FillLayer*, const FillLayer*);
-
static EFillAttachment initialFillAttachment(EFillLayerType) { return ScrollBackgroundAttachment; }
static EFillBox initialFillClip(EFillLayerType) { return BorderFillBox; }
static EFillBox initialFillOrigin(EFillLayerType type) { return type == BackgroundFillLayer ? PaddingFillBox : BorderFillBox; }
@@ -163,18 +184,22 @@ public:
static EFillRepeat initialFillRepeatY(EFillLayerType) { return RepeatFill; }
static CompositeOperator initialFillComposite(EFillLayerType) { return CompositeSourceOver; }
static BlendMode initialFillBlendMode(EFillLayerType) { return BlendModeNormal; }
- static FillSize initialFillSize(EFillLayerType) { return FillSize(); }
- static Length initialFillXPosition(EFillLayerType) { return Length(0.0f, Percent); }
- static Length initialFillYPosition(EFillLayerType) { return Length(0.0f, Percent); }
- static StyleImage* initialFillImage(EFillLayerType) { return nullptr; }
- static EMaskSourceType initialFillMaskSourceType(EFillLayerType) { return MaskAlpha; }
+ static EFillSizeType initialFillSizeType(EFillLayerType) { return SizeNone; }
+ static LengthSize initialFillSizeLength(EFillLayerType) { return LengthSize(); }
+ static FillSize initialFillSize(EFillLayerType type) { return FillSize(initialFillSizeType(type), initialFillSizeLength(type)); }
+ static Length initialFillXPosition(EFillLayerType) { return Length(0.0, Percent); }
+ static Length initialFillYPosition(EFillLayerType) { return Length(0.0, Percent); }
+ static StyleImage* initialFillImage(EFillLayerType) { return 0; }
+ static EMaskSourceType initialMaskSourceType(EFillLayerType) { return MaskAlpha; }
private:
friend class RenderStyle;
void computeClipMax() const;
- std::unique_ptr<FillLayer> m_next;
+ FillLayer() { }
+
+ FillLayer* m_next;
RefPtr<StyleImage> m_image;
@@ -202,8 +227,8 @@ private:
unsigned m_xPosSet : 1;
unsigned m_yPosSet : 1;
unsigned m_backgroundOriginSet : 1;
- unsigned m_backgroundXOrigin : 2; // Edge
- unsigned m_backgroundYOrigin : 2; // Edge
+ unsigned m_backgroundXOrigin : 2; // BackgroundEdgeOrigin
+ unsigned m_backgroundYOrigin : 2; // BackgroundEdgeOrigin
unsigned m_compositeSet : 1;
unsigned m_blendModeSet : 1;
unsigned m_maskSourceTypeSet : 1;
@@ -213,9 +238,6 @@ private:
mutable unsigned m_clipMax : 2; // EFillBox, maximum m_clip value from this to bottom layer
};
-TextStream& operator<<(TextStream&, FillSize);
-TextStream& operator<<(TextStream&, const FillLayer&);
-
} // namespace WebCore
#endif // FillLayer_h
diff --git a/Source/WebCore/rendering/style/GridCoordinate.h b/Source/WebCore/rendering/style/GridCoordinate.h
index 21e040dc2..74a97c7ab 100644
--- a/Source/WebCore/rendering/style/GridCoordinate.h
+++ b/Source/WebCore/rendering/style/GridCoordinate.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 Google Inc. All rights reserved.
- * Copyright (C) 2013, 2014 Igalia S.L.
+ * Copyright (C) 2013 Igalia S.L.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -32,92 +32,36 @@
#ifndef GridCoordinate_h
#define GridCoordinate_h
-#if ENABLE(CSS_GRID_LAYOUT)
-
-#include "GridResolvedPosition.h"
#include <wtf/HashMap.h>
+#include <wtf/PassOwnPtr.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
-// Recommended maximum size for both explicit and implicit grids.
-const unsigned kGridMaxTracks = 1000000;
-
-// A span in a single direction (either rows or columns). Note that |resolvedInitialPosition|
-// and |resolvedFinalPosition| are grid lines' indexes.
-// Iterating over the span shouldn't include |resolvedFinalPosition| to be correct.
+// A span in a single direction (either rows or columns). Note that |initialPositionIndex|
+// and |finalPositionIndex| are grid areas' indexes, NOT grid lines'. Iterating over the
+// span should include both |initialPositionIndex| and |finalPositionIndex| to be correct.
class GridSpan {
public:
-
- static GridSpan definiteGridSpan(const GridResolvedPosition& resolvedInitialPosition, const GridResolvedPosition& resolvedFinalPosition)
+ static PassOwnPtr<GridSpan> create(size_t initialPosition, size_t finalPosition)
{
- return GridSpan(resolvedInitialPosition, resolvedFinalPosition, Definite);
+ return adoptPtr(new GridSpan(initialPosition, finalPosition));
}
- static GridSpan indefiniteGridSpan()
+ GridSpan(size_t initialPosition, size_t finalPosition)
+ : initialPositionIndex(initialPosition)
+ , finalPositionIndex(finalPosition)
{
- return GridSpan(0, 1, Indefinite);
+ ASSERT(initialPositionIndex <= finalPositionIndex);
}
bool operator==(const GridSpan& o) const
{
- return m_type == o.m_type && m_resolvedInitialPosition == o.m_resolvedInitialPosition && m_resolvedFinalPosition == o.m_resolvedFinalPosition;
- }
-
- unsigned integerSpan() const
- {
- ASSERT(isDefinite());
- return m_resolvedFinalPosition.toInt() - m_resolvedInitialPosition.toInt();
- }
-
- const GridResolvedPosition& resolvedInitialPosition() const
- {
- ASSERT(isDefinite());
- return m_resolvedInitialPosition;
- }
-
- const GridResolvedPosition& resolvedFinalPosition() const
- {
- ASSERT(isDefinite());
- return m_resolvedFinalPosition;
- }
-
- typedef GridResolvedPosition iterator;
-
- iterator begin() const
- {
- ASSERT(isDefinite());
- return m_resolvedInitialPosition;
- }
-
- iterator end() const
- {
- ASSERT(isDefinite());
- return m_resolvedFinalPosition;
+ return initialPositionIndex == o.initialPositionIndex && finalPositionIndex == o.finalPositionIndex;
}
- bool isDefinite() const
- {
- return m_type == Definite;
- }
-
-private:
-
- enum GridSpanType {Definite, Indefinite};
-
- GridSpan(const GridResolvedPosition& resolvedInitialPosition, const GridResolvedPosition& resolvedFinalPosition, GridSpanType type)
- : m_resolvedInitialPosition(std::min(resolvedInitialPosition.toInt(), kGridMaxTracks - 1))
- , m_resolvedFinalPosition(std::min(resolvedFinalPosition.toInt(), kGridMaxTracks))
- , m_type(type)
- {
- ASSERT(resolvedInitialPosition < resolvedFinalPosition);
- }
-
- GridResolvedPosition m_resolvedInitialPosition;
- GridResolvedPosition m_resolvedFinalPosition;
- GridSpanType m_type;
-
-
+ size_t initialPositionIndex;
+ size_t finalPositionIndex;
};
// This represents a grid area that spans in both rows' and columns' direction.
@@ -125,8 +69,8 @@ class GridCoordinate {
public:
// HashMap requires a default constuctor.
GridCoordinate()
- : columns(GridSpan::indefiniteGridSpan())
- , rows(GridSpan::indefiniteGridSpan())
+ : columns(0, 0)
+ , rows(0, 0)
{
}
@@ -154,6 +98,4 @@ typedef HashMap<String, GridCoordinate> NamedGridAreaMap;
} // namespace WebCore
-#endif /* ENABLE(CSS_GRID_LAYOUT) */
-
#endif // GridCoordinate_h
diff --git a/Source/WebCore/rendering/style/GridLength.h b/Source/WebCore/rendering/style/GridLength.h
index 2747007bb..3a9ec4e8c 100644
--- a/Source/WebCore/rendering/style/GridLength.h
+++ b/Source/WebCore/rendering/style/GridLength.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 Google Inc. All rights reserved.
- * Copyright (C) 2013, 2014 Igalia S.L.
+ * Copyright (C) 2013 Igalia S.L.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -32,8 +32,6 @@
#ifndef GridLength_h
#define GridLength_h
-#if ENABLE(CSS_GRID_LAYOUT)
-
#include "Length.h"
namespace WebCore {
@@ -43,17 +41,17 @@ namespace WebCore {
// an new unit to Length.h.
class GridLength {
public:
- GridLength(const Length& length)
- : m_length(length)
+ GridLength()
+ : m_length(Undefined)
, m_flex(0)
, m_type(LengthType)
{
- ASSERT(!length.isUndefined());
}
- explicit GridLength(double flex)
- : m_flex(flex)
- , m_type(FlexType)
+ GridLength(const Length& length)
+ : m_length(length)
+ , m_flex(0)
+ , m_type(LengthType)
{
}
@@ -61,10 +59,14 @@ public:
bool isFlex() const { return m_type == FlexType; }
const Length& length() const { ASSERT(isLength()); return m_length; }
+ Length& length() { ASSERT(isLength()); return m_length; }
double flex() const { ASSERT(isFlex()); return m_flex; }
-
- bool isPercentage() const { return m_type == LengthType && m_length.isPercentOrCalculated(); }
+ void setFlex(double flex)
+ {
+ m_type = FlexType;
+ m_flex = flex;
+ }
bool operator==(const GridLength& o) const
{
@@ -87,6 +89,4 @@ private:
} // namespace WebCore
-#endif /* ENABLE(CSS_GRID_LAYOUT) */
-
#endif // GridLength_h
diff --git a/Source/WebCore/rendering/style/GridPosition.h b/Source/WebCore/rendering/style/GridPosition.h
index 074ae68e2..5a276144e 100644
--- a/Source/WebCore/rendering/style/GridPosition.h
+++ b/Source/WebCore/rendering/style/GridPosition.h
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
- * Copyright (C) 2013, 2014 Igalia S.L.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -32,8 +31,6 @@
#ifndef GridPosition_h
#define GridPosition_h
-#if ENABLE(CSS_GRID_LAYOUT)
-
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -45,13 +42,6 @@ enum GridPositionType {
NamedGridAreaPosition // <ident>
};
-enum GridPositionSide {
- ColumnStartSide,
- ColumnEndSide,
- RowStartSide,
- RowEndSide
-};
-
class GridPosition {
public:
GridPosition()
@@ -74,12 +64,6 @@ public:
m_namedGridLine = namedGridLine;
}
- void setAutoPosition()
- {
- m_type = AutoPosition;
- m_integerPosition = 0;
- }
-
// 'span' values cannot be negative, yet we reuse the <integer> position which can
// be. This means that we have to convert the span position to an integer, losing
// some precision here. It shouldn't be an issue in practice though.
@@ -116,7 +100,7 @@ public:
bool operator==(const GridPosition& other) const
{
- return m_type == other.m_type && m_integerPosition == other.m_integerPosition && m_namedGridLine == other.m_namedGridLine;
+ return m_type == other.m_type && m_integerPosition == other.m_integerPosition;
}
bool shouldBeResolvedAgainstOppositePosition() const
@@ -131,6 +115,4 @@ private:
} // namespace WebCore
-#endif /* ENABLE(CSS_GRID_LAYOUT) */
-
#endif // GridPosition_h
diff --git a/Source/WebCore/rendering/style/GridResolvedPosition.cpp b/Source/WebCore/rendering/style/GridResolvedPosition.cpp
deleted file mode 100644
index 7c2101c83..000000000
--- a/Source/WebCore/rendering/style/GridResolvedPosition.cpp
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * Copyright (C) 2014 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 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.
- */
-
-#include "config.h"
-#include "GridResolvedPosition.h"
-
-#if ENABLE(CSS_GRID_LAYOUT)
-
-#include "GridCoordinate.h"
-#include "RenderBox.h"
-
-namespace WebCore {
-
-static inline bool isColumnSide(GridPositionSide side)
-{
- return side == ColumnStartSide || side == ColumnEndSide;
-}
-
-static inline bool isStartSide(GridPositionSide side)
-{
- return side == ColumnStartSide || side == RowStartSide;
-}
-
-static inline GridPositionSide initialPositionSide(GridTrackSizingDirection direction)
-{
- return direction == ForColumns ? ColumnStartSide : RowStartSide;
-}
-
-static inline GridPositionSide finalPositionSide(GridTrackSizingDirection direction)
-{
- return direction == ForColumns ? ColumnEndSide : RowEndSide;
-}
-
-static const NamedGridLinesMap& gridLinesForSide(const RenderStyle& style, GridPositionSide side)
-{
- return isColumnSide(side) ? style.namedGridColumnLines() : style.namedGridRowLines();
-}
-
-static const String implicitNamedGridLineForSide(const String& lineName, GridPositionSide side)
-{
- return lineName + (isStartSide(side) ? "-start" : "-end");
-}
-
-bool GridResolvedPosition::isNonExistentNamedLineOrArea(const String& lineName, const RenderStyle& style, GridPositionSide side)
-{
- const NamedGridLinesMap& gridLineNames = gridLinesForSide(style, side);
- return !gridLineNames.contains(implicitNamedGridLineForSide(lineName, side)) && !gridLineNames.contains(lineName);
-}
-
-static void adjustGridPositionsFromStyle(const RenderStyle& gridContainerStyle, const RenderBox& gridItem, GridTrackSizingDirection direction, GridPosition& initialPosition, GridPosition& finalPosition)
-{
- bool isForColumns = direction == ForColumns;
- initialPosition = isForColumns ? gridItem.style().gridItemColumnStart() : gridItem.style().gridItemRowStart();
- finalPosition = isForColumns ? gridItem.style().gridItemColumnEnd() : gridItem.style().gridItemRowEnd();
-
- // We must handle the placement error handling code here instead of in the StyleAdjuster because we don't want to
- // overwrite the specified values.
- if (initialPosition.isSpan() && finalPosition.isSpan())
- finalPosition.setAutoPosition();
-
- // Try to early detect the case of non existing named grid lines. This way we could assume later that
- // GridResolvedPosition::resolveGrisPositionFromStyle() won't require the autoplacement to run, i.e., it'll always return a
- // valid resolved position.
- if (initialPosition.isNamedGridArea() && GridResolvedPosition::isNonExistentNamedLineOrArea(initialPosition.namedGridLine(), gridContainerStyle, initialPositionSide(direction)))
- initialPosition.setAutoPosition();
-
- if (finalPosition.isNamedGridArea() && GridResolvedPosition::isNonExistentNamedLineOrArea(finalPosition.namedGridLine(), gridContainerStyle, finalPositionSide(direction)))
- finalPosition.setAutoPosition();
-
- // If the grid item has an automatic position and a grid span for a named line in a given dimension, instead treat the grid span as one.
- if (initialPosition.isAuto() && finalPosition.isSpan() && !finalPosition.namedGridLine().isNull())
- finalPosition.setSpanPosition(1, String());
- if (finalPosition.isAuto() && initialPosition.isSpan() && !initialPosition.namedGridLine().isNull())
- initialPosition.setSpanPosition(1, String());
-}
-
-unsigned GridResolvedPosition::explicitGridColumnCount(const RenderStyle& gridContainerStyle)
-{
- return std::min<unsigned>(gridContainerStyle.gridColumns().size(), kGridMaxTracks);
-}
-
-unsigned GridResolvedPosition::explicitGridRowCount(const RenderStyle& gridContainerStyle)
-{
- return std::min<unsigned>(gridContainerStyle.gridRows().size(), kGridMaxTracks);
-}
-
-static unsigned explicitGridSizeForSide(const RenderStyle& gridContainerStyle, GridPositionSide side)
-{
- return isColumnSide(side) ? GridResolvedPosition::explicitGridColumnCount(gridContainerStyle) : GridResolvedPosition::explicitGridRowCount(gridContainerStyle);
-}
-
-static GridResolvedPosition resolveNamedGridLinePositionFromStyle(const RenderStyle& gridContainerStyle, const GridPosition& position, GridPositionSide side)
-{
- ASSERT(!position.namedGridLine().isNull());
-
- const NamedGridLinesMap& gridLinesNames = isColumnSide(side) ? gridContainerStyle.namedGridColumnLines() : gridContainerStyle.namedGridRowLines();
- NamedGridLinesMap::const_iterator it = gridLinesNames.find(position.namedGridLine());
- if (it == gridLinesNames.end()) {
- if (position.isPositive())
- return 0;
- const unsigned lastLine = explicitGridSizeForSide(gridContainerStyle, side);
- return lastLine;
- }
-
- unsigned namedGridLineIndex;
- if (position.isPositive())
- namedGridLineIndex = std::min<unsigned>(position.integerPosition(), it->value.size()) - 1;
- else
- namedGridLineIndex = std::max<int>(0, it->value.size() - abs(position.integerPosition()));
- return it->value[namedGridLineIndex];
-}
-
-static GridSpan resolveRowStartColumnStartNamedGridLinePositionAgainstOppositePosition(const GridResolvedPosition& resolvedOppositePosition, const GridPosition& position, const Vector<unsigned>& gridLines)
-{
- if (!resolvedOppositePosition.toInt())
- return GridSpan::definiteGridSpan(resolvedOppositePosition, resolvedOppositePosition.next());
-
- unsigned firstLineBeforePositionIndex = 0;
- auto firstLineBeforePosition = std::lower_bound(gridLines.begin(), gridLines.end(), resolvedOppositePosition.toInt());
- if (firstLineBeforePosition != gridLines.end())
- firstLineBeforePositionIndex = firstLineBeforePosition - gridLines.begin();
-
- unsigned gridLineIndex = std::max<int>(0, firstLineBeforePositionIndex - position.spanPosition());
-
- GridResolvedPosition resolvedGridLinePosition = GridResolvedPosition(gridLines[gridLineIndex]);
- if (resolvedGridLinePosition >= resolvedOppositePosition)
- resolvedGridLinePosition = resolvedOppositePosition.prev();
- return GridSpan::definiteGridSpan(std::min<GridResolvedPosition>(resolvedGridLinePosition, resolvedOppositePosition), resolvedOppositePosition);
-}
-
-static GridSpan resolveRowEndColumnEndNamedGridLinePositionAgainstOppositePosition(const GridResolvedPosition& resolvedOppositePosition, const GridPosition& position, const Vector<unsigned>& gridLines)
-{
- ASSERT(gridLines.size());
- unsigned firstLineAfterOppositePositionIndex = gridLines.size() - 1;
- const unsigned* firstLineAfterOppositePosition = std::upper_bound(gridLines.begin(), gridLines.end(), resolvedOppositePosition);
- if (firstLineAfterOppositePosition != gridLines.end())
- firstLineAfterOppositePositionIndex = firstLineAfterOppositePosition - gridLines.begin();
-
- unsigned gridLineIndex = std::min<unsigned>(gridLines.size() - 1, firstLineAfterOppositePositionIndex + position.spanPosition() - 1);
- GridResolvedPosition resolvedGridLinePosition = gridLines[gridLineIndex];
- if (resolvedGridLinePosition <= resolvedOppositePosition)
- resolvedGridLinePosition = resolvedOppositePosition.next();
- return GridSpan::definiteGridSpan(resolvedOppositePosition, resolvedGridLinePosition);
-}
-
-static GridSpan resolveNamedGridLinePositionAgainstOppositePosition(const RenderStyle& gridContainerStyle, const GridResolvedPosition& resolvedOppositePosition, const GridPosition& position, GridPositionSide side)
-{
- ASSERT(position.isSpan());
- ASSERT(!position.namedGridLine().isNull());
- // Negative positions are not allowed per the specification and should have been handled during parsing.
- ASSERT(position.spanPosition() > 0);
-
- const NamedGridLinesMap& gridLinesNames = isColumnSide(side) ? gridContainerStyle.namedGridColumnLines() : gridContainerStyle.namedGridRowLines();
- NamedGridLinesMap::const_iterator it = gridLinesNames.find(position.namedGridLine());
-
- // If there is no named grid line of that name, we resolve the position to 'auto' (which is equivalent to 'span 1' in this case).
- // See http://lists.w3.org/Archives/Public/www-style/2013Jun/0394.html.
- if (it == gridLinesNames.end()) {
- if (isStartSide(side) && resolvedOppositePosition.toInt())
- return GridSpan::definiteGridSpan(resolvedOppositePosition.prev(), resolvedOppositePosition);
- return GridSpan::definiteGridSpan(resolvedOppositePosition, resolvedOppositePosition.next());
- }
-
- if (side == RowStartSide || side == ColumnStartSide)
- return resolveRowStartColumnStartNamedGridLinePositionAgainstOppositePosition(resolvedOppositePosition, position, it->value);
-
- return resolveRowEndColumnEndNamedGridLinePositionAgainstOppositePosition(resolvedOppositePosition, position, it->value);
-}
-
-static GridSpan resolveGridPositionAgainstOppositePosition(const RenderStyle& gridContainerStyle, const GridResolvedPosition& resolvedOppositePosition, const GridPosition& position, GridPositionSide side)
-{
- if (position.isAuto()) {
- if (isStartSide(side) && resolvedOppositePosition.toInt())
- return GridSpan::definiteGridSpan(resolvedOppositePosition.prev(), resolvedOppositePosition);
- return GridSpan::definiteGridSpan(resolvedOppositePosition, resolvedOppositePosition.next());
- }
-
- ASSERT(position.isSpan());
- ASSERT(position.spanPosition() > 0);
-
- if (!position.namedGridLine().isNull()) {
- // span 2 'c' -> we need to find the appropriate grid line before / after our opposite position.
- return resolveNamedGridLinePositionAgainstOppositePosition(gridContainerStyle, resolvedOppositePosition, position, side);
- }
-
- // 'span 1' is contained inside a single grid track regardless of the direction.
- // That's why the CSS span value is one more than the offset we apply.
- unsigned positionOffset = position.spanPosition();
- if (isStartSide(side)) {
- if (!resolvedOppositePosition.toInt())
- return GridSpan::definiteGridSpan(resolvedOppositePosition, resolvedOppositePosition.next());
-
- unsigned initialResolvedPosition = std::max<int>(0, resolvedOppositePosition.toInt() - positionOffset);
- return GridSpan::definiteGridSpan(initialResolvedPosition, resolvedOppositePosition);
- }
-
- return GridSpan::definiteGridSpan(resolvedOppositePosition, resolvedOppositePosition.toInt() + positionOffset);
-}
-
-GridSpan GridResolvedPosition::resolveGridPositionsFromAutoPlacementPosition(const RenderStyle& gridContainerStyle, const RenderBox& gridItem, GridTrackSizingDirection direction, const GridResolvedPosition& resolvedInitialPosition)
-{
- GridPosition initialPosition, finalPosition;
- adjustGridPositionsFromStyle(gridContainerStyle, gridItem, direction, initialPosition, finalPosition);
-
- GridPositionSide finalSide = finalPositionSide(direction);
- // This method will only be used when both positions need to be resolved against the opposite one.
- ASSERT(initialPosition.shouldBeResolvedAgainstOppositePosition() && finalPosition.shouldBeResolvedAgainstOppositePosition());
-
- GridResolvedPosition resolvedFinalPosition = resolvedInitialPosition.next();
-
- if (initialPosition.isSpan())
- return resolveGridPositionAgainstOppositePosition(gridContainerStyle, resolvedInitialPosition, initialPosition, finalSide);
- if (finalPosition.isSpan())
- return resolveGridPositionAgainstOppositePosition(gridContainerStyle, resolvedInitialPosition, finalPosition, finalSide);
-
- return GridSpan::definiteGridSpan(resolvedInitialPosition, resolvedFinalPosition);
-}
-
-static GridResolvedPosition resolveGridPositionFromStyle(const RenderStyle& gridContainerStyle, const GridPosition& position, GridPositionSide side)
-{
- switch (position.type()) {
- case ExplicitPosition: {
- ASSERT(position.integerPosition());
-
- if (!position.namedGridLine().isNull())
- return resolveNamedGridLinePositionFromStyle(gridContainerStyle, position, side);
-
- // Handle <integer> explicit position.
- if (position.isPositive())
- return position.integerPosition() - 1;
-
- unsigned resolvedPosition = abs(position.integerPosition()) - 1;
- const unsigned endOfTrack = explicitGridSizeForSide(gridContainerStyle, side);
-
- // Per http://lists.w3.org/Archives/Public/www-style/2013Mar/0589.html, we clamp negative value to the first line.
- if (endOfTrack < resolvedPosition)
- return 0;
-
- return endOfTrack - resolvedPosition;
- }
- case NamedGridAreaPosition:
- {
- // First attempt to match the grid area's edge to a named grid area: if there is a named line with the name
- // ''<custom-ident>-start (for grid-*-start) / <custom-ident>-end'' (for grid-*-end), contributes the first such
- // line to the grid item's placement.
- String namedGridLine = position.namedGridLine();
- ASSERT(!GridResolvedPosition::isNonExistentNamedLineOrArea(namedGridLine, gridContainerStyle, side));
-
- const NamedGridLinesMap& gridLineNames = gridLinesForSide(gridContainerStyle, side);
- auto implicitLine = gridLineNames.find(implicitNamedGridLineForSide(namedGridLine, side));
- if (implicitLine != gridLineNames.end())
- return implicitLine->value[0];
-
- // Otherwise, if there is a named line with the specified name, contributes the first such line to the grid
- // item's placement.
- auto explicitLine = gridLineNames.find(namedGridLine);
- if (explicitLine != gridLineNames.end())
- return explicitLine->value[0];
-
- // If none of the above works specs mandate us to treat it as auto BUT we should have detected it before calling
- // this function in resolveGridPositionsFromStyle(). We should be covered anyway by the ASSERT at the beginning
- // of this case block.
- ASSERT_NOT_REACHED();
- return 0;
- }
- case AutoPosition:
- case SpanPosition:
- // 'auto' and span depend on the opposite position for resolution (e.g. grid-row: auto / 1 or grid-column: span 3 / "myHeader").
- ASSERT_NOT_REACHED();
- return GridResolvedPosition(0);
- }
- ASSERT_NOT_REACHED();
- return GridResolvedPosition(0);
-}
-
-GridSpan GridResolvedPosition::resolveGridPositionsFromStyle(const RenderStyle& gridContainerStyle, const RenderBox& gridItem, GridTrackSizingDirection direction)
-{
- GridPosition initialPosition, finalPosition;
- adjustGridPositionsFromStyle(gridContainerStyle, gridItem, direction, initialPosition, finalPosition);
-
- GridPositionSide initialSide = initialPositionSide(direction);
- GridPositionSide finalSide = finalPositionSide(direction);
-
- // We can't get our grid positions without running the auto placement algorithm.
- if (initialPosition.shouldBeResolvedAgainstOppositePosition() && finalPosition.shouldBeResolvedAgainstOppositePosition())
- return GridSpan::indefiniteGridSpan();
-
- if (initialPosition.shouldBeResolvedAgainstOppositePosition()) {
- // Infer the position from the final position ('auto / 1' or 'span 2 / 3' case).
- auto finalResolvedPosition = resolveGridPositionFromStyle(gridContainerStyle, finalPosition, finalSide);
- return resolveGridPositionAgainstOppositePosition(gridContainerStyle, finalResolvedPosition, initialPosition, initialSide);
- }
-
- if (finalPosition.shouldBeResolvedAgainstOppositePosition()) {
- // Infer our position from the initial position ('1 / auto' or '3 / span 2' case).
- auto initialResolvedPosition = resolveGridPositionFromStyle(gridContainerStyle, initialPosition, initialSide);
- return resolveGridPositionAgainstOppositePosition(gridContainerStyle, initialResolvedPosition, finalPosition, finalSide);
- }
-
- GridResolvedPosition resolvedInitialPosition = resolveGridPositionFromStyle(gridContainerStyle, initialPosition, initialSide);
- GridResolvedPosition resolvedFinalPosition = resolveGridPositionFromStyle(gridContainerStyle, finalPosition, finalSide);
-
- if (resolvedInitialPosition > resolvedFinalPosition)
- std::swap(resolvedInitialPosition, resolvedFinalPosition);
- else if (resolvedInitialPosition == resolvedFinalPosition)
- resolvedFinalPosition = resolvedInitialPosition.next();
-
- return GridSpan::definiteGridSpan(resolvedInitialPosition, std::max(resolvedInitialPosition, resolvedFinalPosition));
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(CSS_GRID_LAYOUT)
diff --git a/Source/WebCore/rendering/style/GridResolvedPosition.h b/Source/WebCore/rendering/style/GridResolvedPosition.h
deleted file mode 100644
index 3d91eecb0..000000000
--- a/Source/WebCore/rendering/style/GridResolvedPosition.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2014 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 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 GridResolvedPosition_h
-#define GridResolvedPosition_h
-
-#if ENABLE(CSS_GRID_LAYOUT)
-
-#include "GridPosition.h"
-
-namespace WebCore {
-
-class GridSpan;
-class RenderBox;
-class RenderStyle;
-
-enum GridTrackSizingDirection {
- ForColumns,
- ForRows
-};
-
-// This class represents a line index into one of the dimensions of the grid array.
-// Wraps an unsigned integer just for the purpose of knowing what we manipulate in the grid code.
-class GridResolvedPosition {
-public:
- GridResolvedPosition(unsigned position)
- : m_integerPosition(position)
- {
- }
-
- GridResolvedPosition& operator*()
- {
- return *this;
- }
-
- GridResolvedPosition& operator++()
- {
- m_integerPosition++;
- return *this;
- }
-
- bool operator==(const GridResolvedPosition& other) const
- {
- return m_integerPosition == other.m_integerPosition;
- }
-
- bool operator!=(const GridResolvedPosition& other) const
- {
- return m_integerPosition != other.m_integerPosition;
- }
-
- bool operator<(const GridResolvedPosition& other) const
- {
- return m_integerPosition < other.m_integerPosition;
- }
-
- bool operator>(const GridResolvedPosition& other) const
- {
- return m_integerPosition > other.m_integerPosition;
- }
-
- bool operator<=(const GridResolvedPosition& other) const
- {
- return m_integerPosition <= other.m_integerPosition;
- }
-
- bool operator>=(const GridResolvedPosition& other) const
- {
- return m_integerPosition >= other.m_integerPosition;
- }
-
- unsigned toInt() const
- {
- return m_integerPosition;
- }
-
- GridResolvedPosition next() const
- {
- return GridResolvedPosition(m_integerPosition + 1);
- }
-
- GridResolvedPosition prev() const
- {
- return m_integerPosition ? m_integerPosition - 1 : 0;
- }
-
- static GridSpan resolveGridPositionsFromAutoPlacementPosition(const RenderStyle&, const RenderBox&, GridTrackSizingDirection, const GridResolvedPosition&);
- static GridSpan resolveGridPositionsFromStyle(const RenderStyle&, const RenderBox&, GridTrackSizingDirection);
- static unsigned explicitGridColumnCount(const RenderStyle&);
- static unsigned explicitGridRowCount(const RenderStyle&);
- static bool isNonExistentNamedLineOrArea(const String& lineName, const RenderStyle&, GridPositionSide);
-
-private:
- unsigned m_integerPosition;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(CSS_GRID_LAYOUT)
-
-#endif // GridResolvedPosition_h
diff --git a/Source/WebCore/rendering/style/GridTrackSize.h b/Source/WebCore/rendering/style/GridTrackSize.h
index 6063792ca..d5fca8948 100644
--- a/Source/WebCore/rendering/style/GridTrackSize.h
+++ b/Source/WebCore/rendering/style/GridTrackSize.h
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
- * Copyright (C) 2013, 2014 Igalia S.L.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -32,10 +31,7 @@
#ifndef GridTrackSize_h
#define GridTrackSize_h
-#if ENABLE(CSS_GRID_LAYOUT)
-
#include "GridLength.h"
-#include <wtf/NeverDestroyed.h>
namespace WebCore {
@@ -46,20 +42,11 @@ enum GridTrackSizeType {
class GridTrackSize {
public:
- GridTrackSize(const GridLength& length)
+ GridTrackSize(LengthType type = Undefined)
: m_type(LengthTrackSizing)
- , m_minTrackBreadth(length)
- , m_maxTrackBreadth(length)
+ , m_minTrackBreadth(type)
+ , m_maxTrackBreadth(type)
{
- cacheMinMaxTrackBreadthTypes();
- }
-
- GridTrackSize(const GridLength& minTrackBreadth, const GridLength& maxTrackBreadth)
- : m_type(MinMaxTrackSizing)
- , m_minTrackBreadth(minTrackBreadth)
- , m_maxTrackBreadth(maxTrackBreadth)
- {
- cacheMinMaxTrackBreadthTypes();
}
const GridLength& length() const
@@ -67,61 +54,64 @@ public:
ASSERT(m_type == LengthTrackSizing);
ASSERT(m_minTrackBreadth == m_maxTrackBreadth);
const GridLength& minTrackBreadth = m_minTrackBreadth;
+ ASSERT(!minTrackBreadth.isLength() || !minTrackBreadth.length().isUndefined());
return minTrackBreadth;
}
- const GridLength& minTrackBreadth() const { return m_minTrackBreadth; }
+ void setLength(const GridLength& length)
+ {
+ m_type = LengthTrackSizing;
+ m_minTrackBreadth = length;
+ m_maxTrackBreadth = length;
+ }
- const GridLength& maxTrackBreadth() const { return m_maxTrackBreadth; }
+ const GridLength& minTrackBreadth() const
+ {
+ ASSERT(!m_minTrackBreadth.isLength() || !m_minTrackBreadth.length().isUndefined());
+ if (m_minTrackBreadth.isLength() && m_minTrackBreadth.length().isAuto()) {
+ DEFINE_STATIC_LOCAL(GridLength, minContent, (MinContent));
+ return minContent;
+ }
+ return m_minTrackBreadth;
+ }
+
+ const GridLength& maxTrackBreadth() const
+ {
+ ASSERT(!m_maxTrackBreadth.isLength() || !m_maxTrackBreadth.length().isUndefined());
+ if (m_maxTrackBreadth.isLength() && m_maxTrackBreadth.length().isAuto()) {
+ DEFINE_STATIC_LOCAL(GridLength, maxContent, (MaxContent));
+ return maxContent;
+ }
+ return m_maxTrackBreadth;
+ }
+
+ void setMinMax(const GridLength& minTrackBreadth, const GridLength& maxTrackBreadth)
+ {
+ m_type = MinMaxTrackSizing;
+ m_minTrackBreadth = minTrackBreadth;
+ m_maxTrackBreadth = maxTrackBreadth;
+ }
GridTrackSizeType type() const { return m_type; }
bool isContentSized() const { return m_minTrackBreadth.isContentSized() || m_maxTrackBreadth.isContentSized(); }
- bool isPercentage() const { return m_type == LengthTrackSizing && length().isLength() && length().length().isPercentOrCalculated(); }
-
bool operator==(const GridTrackSize& other) const
{
return m_type == other.m_type && m_minTrackBreadth == other.m_minTrackBreadth && m_maxTrackBreadth == other.m_maxTrackBreadth;
}
- void cacheMinMaxTrackBreadthTypes()
- {
- m_minTrackBreadthIsAuto = minTrackBreadth().isLength() && minTrackBreadth().length().isAuto();
- m_minTrackBreadthIsMinContent = minTrackBreadth().isLength() && minTrackBreadth().length().isMinContent();
- m_minTrackBreadthIsMaxContent = minTrackBreadth().isLength() && minTrackBreadth().length().isMaxContent();
- m_maxTrackBreadthIsMaxContent = maxTrackBreadth().isLength() && maxTrackBreadth().length().isMaxContent();
- m_maxTrackBreadthIsMinContent = maxTrackBreadth().isLength() && maxTrackBreadth().length().isMinContent();
- m_maxTrackBreadthIsAuto = maxTrackBreadth().isLength() && maxTrackBreadth().length().isAuto();
- }
-
- bool hasIntrinsicMinTrackBreadth() const { return m_minTrackBreadthIsMaxContent || m_minTrackBreadthIsMinContent || m_minTrackBreadthIsAuto; }
- bool hasMinOrMaxContentMinTrackBreadth() const { return m_minTrackBreadthIsMaxContent || m_minTrackBreadthIsMinContent; }
- bool hasAutoMinTrackBreadth() const { return m_minTrackBreadthIsAuto; }
- bool hasAutoMaxTrackBreadth() const { return m_maxTrackBreadthIsAuto; }
- bool hasMaxContentMaxTrackBreadth() const { return m_maxTrackBreadthIsMaxContent; }
- bool hasMaxContentOrAutoMaxTrackBreadth() const { return m_maxTrackBreadthIsMaxContent || m_maxTrackBreadthIsAuto; }
- bool hasMinContentMaxTrackBreadth() const { return m_maxTrackBreadthIsMinContent; }
- bool hasMinOrMaxContentMaxTrackBreadth() const { return m_maxTrackBreadthIsMaxContent || m_maxTrackBreadthIsMinContent; }
- bool hasMaxContentMinTrackBreadth() const { return m_minTrackBreadthIsMaxContent; }
- bool hasMinContentMinTrackBreadth() const { return m_minTrackBreadthIsMinContent; }
- bool hasMaxContentMinTrackBreadthAndMaxContentMaxTrackBreadth() const { return m_minTrackBreadthIsMaxContent && m_maxTrackBreadthIsMaxContent; }
- bool hasAutoOrMinContentMinTrackBreadthAndIntrinsicMaxTrackBreadth() const { return (m_minTrackBreadthIsMinContent || m_minTrackBreadthIsAuto) && (m_maxTrackBreadthIsAuto || hasMinOrMaxContentMaxTrackBreadth()); }
+ bool hasMinOrMaxContentMinTrackBreadth() const { return minTrackBreadth().isLength() && (minTrackBreadth().length().isMinContent() || minTrackBreadth().length().isMaxContent()); }
+ bool hasMaxContentMinTrackBreadth() const { return minTrackBreadth().isLength() && minTrackBreadth().length().isMaxContent(); }
+ bool hasMinOrMaxContentMaxTrackBreadth() const { return maxTrackBreadth().isLength() && (maxTrackBreadth().length().isMinContent() || maxTrackBreadth().length().isMaxContent()); }
+ bool hasMaxContentMaxTrackBreadth() const { return maxTrackBreadth().isLength() && maxTrackBreadth().length().isMaxContent(); }
private:
GridTrackSizeType m_type;
GridLength m_minTrackBreadth;
GridLength m_maxTrackBreadth;
- bool m_minTrackBreadthIsAuto;
- bool m_minTrackBreadthIsMaxContent;
- bool m_minTrackBreadthIsMinContent;
- bool m_maxTrackBreadthIsAuto;
- bool m_maxTrackBreadthIsMaxContent;
- bool m_maxTrackBreadthIsMinContent;
};
} // namespace WebCore
-#endif /* ENABLE(CSS_GRID_LAYOUT) */
-
#endif // GridTrackSize_h
diff --git a/Source/WebCore/rendering/style/KeyframeList.cpp b/Source/WebCore/rendering/style/KeyframeList.cpp
index 545bca23a..a127b468b 100644
--- a/Source/WebCore/rendering/style/KeyframeList.cpp
+++ b/Source/WebCore/rendering/style/KeyframeList.cpp
@@ -21,27 +21,10 @@
#include "config.h"
#include "KeyframeList.h"
-
-#include "Animation.h"
#include "RenderObject.h"
namespace WebCore {
-TimingFunction* KeyframeValue::timingFunction(const AtomicString& name) const
-{
- const RenderStyle* keyframeStyle = style();
- if (!keyframeStyle || !keyframeStyle->animations())
- return nullptr;
-
- for (size_t i = 0; i < keyframeStyle->animations()->size(); ++i) {
- const Animation& animation = keyframeStyle->animations()->animation(i);
- if (name == animation.name())
- return animation.timingFunction().get();
- }
-
- return nullptr;
-}
-
KeyframeList::~KeyframeList()
{
clear();
diff --git a/Source/WebCore/rendering/style/KeyframeList.h b/Source/WebCore/rendering/style/KeyframeList.h
index 4df5f4db6..6b8c7f323 100644
--- a/Source/WebCore/rendering/style/KeyframeList.h
+++ b/Source/WebCore/rendering/style/KeyframeList.h
@@ -35,7 +35,6 @@
namespace WebCore {
class RenderStyle;
-class TimingFunction;
class KeyframeValue {
public:
@@ -55,8 +54,6 @@ public:
const RenderStyle* style() const { return m_style.get(); }
void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; }
- TimingFunction* timingFunction(const AtomicString& name) const;
-
private:
double m_key;
HashSet<CSSPropertyID> m_properties; // The properties specified in this keyframe.
@@ -82,13 +79,13 @@ public:
void addProperty(CSSPropertyID prop) { m_properties.add(prop); }
bool containsProperty(CSSPropertyID prop) const { return m_properties.contains(prop); }
- const HashSet<CSSPropertyID>& properties() const { return m_properties; }
+ HashSet<CSSPropertyID>::const_iterator beginProperties() const { return m_properties.begin(); }
+ HashSet<CSSPropertyID>::const_iterator endProperties() const { return m_properties.end(); }
void clear();
bool isEmpty() const { return m_keyframes.isEmpty(); }
size_t size() const { return m_keyframes.size(); }
const KeyframeValue& operator[](size_t index) const { return m_keyframes[index]; }
- const Vector<KeyframeValue>& keyframes() const { return m_keyframes; }
private:
AtomicString m_animationName;
diff --git a/Source/WebCore/rendering/style/NinePieceImage.cpp b/Source/WebCore/rendering/style/NinePieceImage.cpp
index b4c33f4f0..43bd1b043 100644
--- a/Source/WebCore/rendering/style/NinePieceImage.cpp
+++ b/Source/WebCore/rendering/style/NinePieceImage.cpp
@@ -2,7 +2,7 @@
* Copyright (C) 2000 Lars Knoll (knoll@kde.org)
* (C) 2000 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2013, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2013 Apple 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
@@ -23,12 +23,7 @@
#include "config.h"
#include "NinePieceImage.h"
-
-#include "GraphicsContext.h"
-#include "LengthFunctions.h"
-#include "RenderStyle.h"
#include <wtf/NeverDestroyed.h>
-#include <wtf/PointerComparison.h>
namespace WebCore {
@@ -47,188 +42,19 @@ NinePieceImage::NinePieceImage(PassRefPtr<StyleImage> image, LengthBox imageSlic
: m_data(NinePieceImageData::create())
{
m_data.access()->image = image;
- m_data.access()->imageSlices = WTFMove(imageSlices);
- m_data.access()->borderSlices = WTFMove(borderSlices);
- m_data.access()->outset = WTFMove(outset);
+ m_data.access()->imageSlices = std::move(imageSlices);
+ m_data.access()->borderSlices = std::move(borderSlices);
+ m_data.access()->outset = std::move(outset);
m_data.access()->fill = fill;
m_data.access()->horizontalRule = horizontalRule;
m_data.access()->verticalRule = verticalRule;
}
-LayoutUnit NinePieceImage::computeSlice(Length length, LayoutUnit width, LayoutUnit slice, LayoutUnit extent)
-{
- if (length.isRelative())
- return length.value() * width;
- if (length.isAuto())
- return slice;
- return valueForLength(length, extent);
-}
-
-LayoutBoxExtent NinePieceImage::computeSlices(const LayoutSize& size, const LengthBox& lengths, int scaleFactor)
-{
- LayoutUnit top = std::min<LayoutUnit>(size.height(), valueForLength(lengths.top(), size.height())) * scaleFactor;
- LayoutUnit right = std::min<LayoutUnit>(size.width(), valueForLength(lengths.right(), size.width())) * scaleFactor;
- LayoutUnit bottom = std::min<LayoutUnit>(size.height(), valueForLength(lengths.bottom(), size.height())) * scaleFactor;
- LayoutUnit left = std::min<LayoutUnit>(size.width(), valueForLength(lengths.left(), size.width())) * scaleFactor;
- return LayoutBoxExtent(top, right, bottom, left);
-}
-
-LayoutBoxExtent NinePieceImage::computeSlices(const LayoutSize& size, const LengthBox& lengths, const FloatBoxExtent& widths, const LayoutBoxExtent& slices)
-{
- LayoutUnit top = computeSlice(lengths.top(), widths.top(), slices.top(), size.height());
- LayoutUnit right = computeSlice(lengths.right(), widths.right(), slices.right(), size.width());
- LayoutUnit bottom = computeSlice(lengths.bottom(), widths.bottom(), slices.bottom(), size.height());
- LayoutUnit left = computeSlice(lengths.left(), widths.left(), slices.left(), size.width());
- return LayoutBoxExtent(top, right, bottom, left);
-}
-
-void NinePieceImage::scaleSlicesIfNeeded(const LayoutSize& size, LayoutBoxExtent& slices, float deviceScaleFactor)
-{
- LayoutUnit width = std::max<LayoutUnit>(1 / deviceScaleFactor, slices.left() + slices.right());
- LayoutUnit height = std::max<LayoutUnit>(1 / deviceScaleFactor, slices.top() + slices.bottom());
-
- float sliceScaleFactor = std::min((float)size.width() / width, (float)size.height() / height);
-
- if (sliceScaleFactor >= 1)
- return;
-
- // All slices are reduced by multiplying them by sliceScaleFactor.
- slices.top() *= sliceScaleFactor;
- slices.right() *= sliceScaleFactor;
- slices.bottom() *= sliceScaleFactor;
- slices.left() *= sliceScaleFactor;
-}
-
-bool NinePieceImage::isEmptyPieceRect(ImagePiece piece, const LayoutBoxExtent& slices)
-{
- if (piece == MiddlePiece)
- return false;
-
- PhysicalBoxSide horizontalSide = imagePieceHorizontalSide(piece);
- PhysicalBoxSide verticalSide = imagePieceVerticalSide(piece);
- return !((horizontalSide == NilSide || slices.at(horizontalSide)) && (verticalSide == NilSide || slices.at(verticalSide)));
-}
-
-bool NinePieceImage::isEmptyPieceRect(ImagePiece piece, const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects)
-{
- return destinationRects[piece].isEmpty() || sourceRects[piece].isEmpty();
-}
-
-Vector<FloatRect> NinePieceImage::computeNineRects(const FloatRect& outer, const LayoutBoxExtent& slices, float deviceScaleFactor)
-{
- FloatRect inner = outer;
- inner.move(slices.left(), slices.top());
- inner.contract(slices.left() + slices.right(), slices.top() + slices.bottom());
- ASSERT(outer.contains(inner));
-
- Vector<FloatRect> rects(MaxPiece);
-
- rects[TopLeftPiece] = snapRectToDevicePixels(outer.x(), outer.y(), slices.left(), slices.top(), deviceScaleFactor);
- rects[BottomLeftPiece] = snapRectToDevicePixels(outer.x(), inner.maxY(), slices.left(), slices.bottom(), deviceScaleFactor);
- rects[LeftPiece] = snapRectToDevicePixels(outer.x(), inner.y(), slices.left(), inner.height(), deviceScaleFactor);
-
- rects[TopRightPiece] = snapRectToDevicePixels(inner.maxX(), outer.y(), slices.right(), slices.top(), deviceScaleFactor);
- rects[BottomRightPiece] = snapRectToDevicePixels(inner.maxX(), inner.maxY(), slices.right(), slices.bottom(), deviceScaleFactor);
- rects[RightPiece] = snapRectToDevicePixels(inner.maxX(), inner.y(), slices.right(), inner.height(), deviceScaleFactor);
-
- rects[TopPiece] = snapRectToDevicePixels(inner.x(), outer.y(), inner.width(), slices.top(), deviceScaleFactor);
- rects[BottomPiece] = snapRectToDevicePixels(inner.x(), inner.maxY(), inner.width(), slices.bottom(), deviceScaleFactor);
-
- rects[MiddlePiece] = snapRectToDevicePixels(inner.x(), inner.y(), inner.width(), inner.height(), deviceScaleFactor);
- return rects;
-}
-
-FloatSize NinePieceImage::computeSideTileScale(ImagePiece piece, const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects)
-{
- ASSERT(!isCornerPiece(piece) && !isMiddlePiece(piece));
- if (isEmptyPieceRect(piece, destinationRects, sourceRects))
- return FloatSize(1, 1);
-
- float scale;
- if (isHorizontalPiece(piece))
- scale = destinationRects[piece].height() / sourceRects[piece].height();
- else
- scale = destinationRects[piece].width() / sourceRects[piece].width();
-
- return FloatSize(scale, scale);
-}
-
-FloatSize NinePieceImage::computeMiddleTileScale(const Vector<FloatSize>& scales, const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects, ENinePieceImageRule hRule, ENinePieceImageRule vRule)
-{
- FloatSize scale(1, 1);
- if (isEmptyPieceRect(MiddlePiece, destinationRects, sourceRects))
- return scale;
-
- // Unlike the side pieces, the middle piece can have "stretch" specified in one axis but not the other.
- // In fact the side pieces don't even use the scale factor unless they have a rule other than "stretch".
- if (hRule == StretchImageRule)
- scale.setWidth(destinationRects[MiddlePiece].width() / sourceRects[MiddlePiece].width());
- else if (!isEmptyPieceRect(TopPiece, destinationRects, sourceRects))
- scale.setWidth(scales[TopPiece].width());
- else if (!isEmptyPieceRect(BottomPiece, destinationRects, sourceRects))
- scale.setWidth(scales[BottomPiece].width());
-
- if (vRule == StretchImageRule)
- scale.setHeight(destinationRects[MiddlePiece].height() / sourceRects[MiddlePiece].height());
- else if (!isEmptyPieceRect(LeftPiece, destinationRects, sourceRects))
- scale.setHeight(scales[LeftPiece].height());
- else if (!isEmptyPieceRect(RightPiece, destinationRects, sourceRects))
- scale.setHeight(scales[RightPiece].height());
-
- return scale;
-}
-
-Vector<FloatSize> NinePieceImage::computeTileScales(const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects, ENinePieceImageRule hRule, ENinePieceImageRule vRule)
-{
- Vector<FloatSize> scales(MaxPiece, FloatSize(1, 1));
-
- scales[TopPiece] = computeSideTileScale(TopPiece, destinationRects, sourceRects);
- scales[RightPiece] = computeSideTileScale(RightPiece, destinationRects, sourceRects);
- scales[BottomPiece] = computeSideTileScale(BottomPiece, destinationRects, sourceRects);
- scales[LeftPiece] = computeSideTileScale(LeftPiece, destinationRects, sourceRects);
-
- scales[MiddlePiece] = computeMiddleTileScale(scales, destinationRects, sourceRects, hRule, vRule);
- return scales;
-}
-
-void NinePieceImage::paint(GraphicsContext& graphicsContext, RenderElement* renderer, const RenderStyle& style, const LayoutRect& destination, const LayoutSize& source, float deviceScaleFactor, CompositeOperator op) const
-{
- StyleImage* styleImage = image();
- ASSERT(styleImage && styleImage->isLoaded());
-
- LayoutBoxExtent sourceSlices = computeSlices(source, imageSlices(), styleImage->imageScaleFactor());
- LayoutBoxExtent destinationSlices = computeSlices(destination.size(), borderSlices(), style.borderWidth(), sourceSlices);
-
- scaleSlicesIfNeeded(destination.size(), destinationSlices, deviceScaleFactor);
-
- Vector<FloatRect> destinationRects = computeNineRects(destination, destinationSlices, deviceScaleFactor);
- Vector<FloatRect> sourceRects = computeNineRects(FloatRect(FloatPoint(), source), sourceSlices, deviceScaleFactor);
- Vector<FloatSize> tileScales = computeTileScales(destinationRects, sourceRects, horizontalRule(), verticalRule());
-
- RefPtr<Image> image = styleImage->image(renderer, source);
- if (!image)
- return;
-
- for (ImagePiece piece = MinPiece; piece < MaxPiece; ++piece) {
- if ((piece == MiddlePiece && !fill()) || isEmptyPieceRect(piece, destinationRects, sourceRects))
- continue;
-
- if (isCornerPiece(piece)) {
- graphicsContext.drawImage(*image, destinationRects[piece], sourceRects[piece], op);
- continue;
- }
-
- Image::TileRule hRule = isHorizontalPiece(piece) ? static_cast<Image::TileRule>(horizontalRule()) : Image::StretchTile;
- Image::TileRule vRule = isVerticalPiece(piece) ? static_cast<Image::TileRule>(verticalRule()) : Image::StretchTile;
- graphicsContext.drawTiledImage(*image, destinationRects[piece], sourceRects[piece], tileScales[piece], hRule, vRule, op);
- }
-}
-
NinePieceImageData::NinePieceImageData()
: fill(false)
, horizontalRule(StretchImageRule)
, verticalRule(StretchImageRule)
- , image(nullptr)
+ , image(0)
, imageSlices(Length(100, Percent), Length(100, Percent), Length(100, Percent), Length(100, Percent))
, borderSlices(Length(1, Relative), Length(1, Relative), Length(1, Relative), Length(1, Relative))
, outset(0)
@@ -247,14 +73,14 @@ inline NinePieceImageData::NinePieceImageData(const NinePieceImageData& other)
{
}
-Ref<NinePieceImageData> NinePieceImageData::copy() const
+PassRef<NinePieceImageData> NinePieceImageData::copy() const
{
return adoptRef(*new NinePieceImageData(*this));
}
bool NinePieceImageData::operator==(const NinePieceImageData& other) const
{
- return arePointingToEqualData(image, other.image)
+ return StyleImage::imagesEquivalent(image.get(), other.image.get())
&& imageSlices == other.imageSlices
&& fill == other.fill
&& borderSlices == other.borderSlices
diff --git a/Source/WebCore/rendering/style/NinePieceImage.h b/Source/WebCore/rendering/style/NinePieceImage.h
index 414af9d87..e34924147 100644
--- a/Source/WebCore/rendering/style/NinePieceImage.h
+++ b/Source/WebCore/rendering/style/NinePieceImage.h
@@ -2,7 +2,7 @@
* Copyright (C) 2000 Lars Knoll (knoll@kde.org)
* (C) 2000 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2013, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2013 Apple 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
@@ -25,12 +25,9 @@
#define NinePieceImage_h
#include "DataRef.h"
-#include "LayoutRect.h"
-#include "LayoutSize.h"
#include "LayoutUnit.h"
#include "LengthBox.h"
#include "StyleImage.h"
-#include <wtf/Vector.h>
namespace WebCore {
@@ -38,74 +35,10 @@ enum ENinePieceImageRule {
StretchImageRule, RoundImageRule, SpaceImageRule, RepeatImageRule
};
-enum ImagePiece {
- MinPiece = 0,
- TopLeftPiece = MinPiece,
- LeftPiece,
- BottomLeftPiece,
- TopRightPiece,
- RightPiece,
- BottomRightPiece,
- TopPiece,
- BottomPiece,
- MiddlePiece,
- MaxPiece
-};
-
-inline ImagePiece& operator++(ImagePiece& piece)
-{
- piece = static_cast<ImagePiece>(static_cast<int>(piece) + 1);
- return piece;
-}
-
-inline bool isCornerPiece(ImagePiece piece)
-{
- return piece == TopLeftPiece || piece == TopRightPiece || piece == BottomLeftPiece || piece == BottomRightPiece;
-}
-
-inline bool isMiddlePiece(ImagePiece piece)
-{
- return piece == MiddlePiece;
-}
-
-inline bool isHorizontalPiece(ImagePiece piece)
-{
- return piece == TopPiece || piece == BottomPiece || piece == MiddlePiece;
-}
-
-inline bool isVerticalPiece(ImagePiece piece)
-{
- return piece == LeftPiece || piece == RightPiece || piece == MiddlePiece;
-}
-
-inline PhysicalBoxSide imagePieceHorizontalSide(ImagePiece piece)
-{
- if (piece == TopLeftPiece || piece == TopPiece || piece == TopRightPiece)
- return TopSide;
-
- if (piece == BottomLeftPiece || piece == BottomPiece || piece == BottomRightPiece)
- return BottomSide;
-
- return NilSide;
-}
-
-inline PhysicalBoxSide imagePieceVerticalSide(ImagePiece piece)
-{
- if (piece == TopLeftPiece || piece == LeftPiece || piece == BottomLeftPiece)
- return LeftSide;
-
- if (piece == TopRightPiece || piece == RightPiece || piece == BottomRightPiece)
- return RightSide;
-
- return NilSide;
-}
-
-class RenderStyle;
-
class NinePieceImageData : public RefCounted<NinePieceImageData> {
public:
- static Ref<NinePieceImageData> create() { return adoptRef(*new NinePieceImageData); }
- Ref<NinePieceImageData> copy() const;
+ static PassRef<NinePieceImageData> create() { return adoptRef(*new NinePieceImageData); }
+ PassRef<NinePieceImageData> copy() const;
bool operator==(const NinePieceImageData&) const;
bool operator!=(const NinePieceImageData& o) const { return !(*this == o); }
@@ -136,16 +69,16 @@ public:
void setImage(PassRefPtr<StyleImage> image) { m_data.access()->image = image; }
const LengthBox& imageSlices() const { return m_data->imageSlices; }
- void setImageSlices(LengthBox slices) { m_data.access()->imageSlices = WTFMove(slices); }
+ void setImageSlices(LengthBox slices) { m_data.access()->imageSlices = std::move(slices); }
bool fill() const { return m_data->fill; }
void setFill(bool fill) { m_data.access()->fill = fill; }
const LengthBox& borderSlices() const { return m_data->borderSlices; }
- void setBorderSlices(LengthBox slices) { m_data.access()->borderSlices = WTFMove(slices); }
+ void setBorderSlices(LengthBox slices) { m_data.access()->borderSlices = std::move(slices); }
const LengthBox& outset() const { return m_data->outset; }
- void setOutset(LengthBox outset) { m_data.access()->outset = WTFMove(outset); }
+ void setOutset(LengthBox outset) { m_data.access()->outset = std::move(outset); }
ENinePieceImageRule horizontalRule() const { return static_cast<ENinePieceImageRule>(m_data->horizontalRule); }
void setHorizontalRule(ENinePieceImageRule rule) { m_data.access()->horizontalRule = rule; }
@@ -189,23 +122,6 @@ public:
return outsetSide.value();
}
- static LayoutUnit computeSlice(Length, LayoutUnit width, LayoutUnit slice, LayoutUnit extent);
- static LayoutBoxExtent computeSlices(const LayoutSize&, const LengthBox& lengths, int scaleFactor);
- static LayoutBoxExtent computeSlices(const LayoutSize&, const LengthBox& lengths, const FloatBoxExtent& widths, const LayoutBoxExtent& slices);
-
- static bool isEmptyPieceRect(ImagePiece, const LayoutBoxExtent& slices);
- static bool isEmptyPieceRect(ImagePiece, const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects);
-
- static Vector<FloatRect> computeNineRects(const FloatRect& outer, const LayoutBoxExtent& slices, float deviceScaleFactor);
-
- static void scaleSlicesIfNeeded(const LayoutSize&, LayoutBoxExtent& slices, float deviceScaleFactor);
-
- static FloatSize computeSideTileScale(ImagePiece, const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects);
- static FloatSize computeMiddleTileScale(const Vector<FloatSize>& scales, const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects, ENinePieceImageRule hRule, ENinePieceImageRule vRule);
- static Vector<FloatSize> computeTileScales(const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects, ENinePieceImageRule hRule, ENinePieceImageRule vRule);
-
- void paint(GraphicsContext&, RenderElement*, const RenderStyle&, const LayoutRect& destination, const LayoutSize& source, float deviceScaleFactor, CompositeOperator) const;
-
private:
DataRef<NinePieceImageData> m_data;
};
diff --git a/Source/WebCore/rendering/style/OutlineValue.h b/Source/WebCore/rendering/style/OutlineValue.h
index 0afe5a812..f380af628 100644
--- a/Source/WebCore/rendering/style/OutlineValue.h
+++ b/Source/WebCore/rendering/style/OutlineValue.h
@@ -32,6 +32,11 @@ namespace WebCore {
class OutlineValue : public BorderValue {
friend class RenderStyle;
public:
+ OutlineValue()
+ : m_offset(0)
+ {
+ }
+
bool operator==(const OutlineValue& o) const
{
return m_width == o.m_width && m_style == o.m_style && m_color == o.m_color && m_colorIsValid == o.m_colorIsValid && m_offset == o.m_offset && m_isAuto == o.m_isAuto;
@@ -42,11 +47,11 @@ public:
return !(*this == o);
}
- float offset() const { return m_offset; }
+ int offset() const { return m_offset; }
OutlineIsAuto isAuto() const { return static_cast<OutlineIsAuto>(m_isAuto); }
private:
- float m_offset { 0 };
+ int m_offset;
};
} // namespace WebCore
diff --git a/Source/WebCore/rendering/style/RenderStyle.cpp b/Source/WebCore/rendering/style/RenderStyle.cpp
index ebd4c9142..fffd1c19f 100644
--- a/Source/WebCore/rendering/style/RenderStyle.cpp
+++ b/Source/WebCore/rendering/style/RenderStyle.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
- * Copyright (C) 2004-2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
*
* This library is free software; you can redistribute it and/or
@@ -24,29 +24,22 @@
#include "RenderStyle.h"
#include "ContentData.h"
-#include "CSSCustomPropertyValue.h"
-#include "CSSPropertyNames.h"
-#include "CSSVariableDependentValue.h"
#include "CursorList.h"
-#include "FloatRoundedRect.h"
-#include "FontCascade.h"
+#include "CSSPropertyNames.h"
+#include "Font.h"
#include "FontSelector.h"
-#include "InlineTextBoxStyle.h"
#include "Pagination.h"
#include "QuotesData.h"
#include "RenderObject.h"
-#include "RenderTheme.h"
#include "ScaleTransformOperation.h"
#include "ShadowData.h"
#include "StyleImage.h"
#include "StyleInheritedData.h"
#include "StyleResolver.h"
-#include "StyleScrollSnapPoints.h"
-#include "StyleSelfAlignmentData.h"
-#include "StyleTreeResolver.h"
-#include "WillChangeData.h"
+#if ENABLE(TOUCH_EVENTS)
+#include "RenderTheme.h"
+#endif
#include <wtf/MathExtras.h>
-#include <wtf/PointerComparison.h>
#include <wtf/StdLibExtras.h>
#include <algorithm>
@@ -61,9 +54,8 @@
namespace WebCore {
struct SameSizeAsBorderValue {
- float m_width;
RGBA32 m_color;
- int m_restBits;
+ unsigned m_width;
};
COMPILE_ASSERT(sizeof(BorderValue) == sizeof(SameSizeAsBorderValue), BorderValue_should_not_grow);
@@ -71,13 +63,15 @@ COMPILE_ASSERT(sizeof(BorderValue) == sizeof(SameSizeAsBorderValue), BorderValue
struct SameSizeAsRenderStyle : public RefCounted<SameSizeAsRenderStyle> {
void* dataRefs[7];
void* ownPtrs[1];
+#if ENABLE(SVG)
void* dataRefSvgStyle;
+#endif
struct InheritedFlags {
unsigned m_bitfields[2];
} inherited_flags;
struct NonInheritedFlags {
- uint64_t m_flags;
+ unsigned m_bitfields[2];
} noninherited_flags;
};
@@ -89,17 +83,17 @@ inline RenderStyle& defaultStyle()
return style;
}
-Ref<RenderStyle> RenderStyle::create()
+PassRef<RenderStyle> RenderStyle::create()
{
- return adoptRef(*new RenderStyle(defaultStyle()));
+ return adoptRef(*new RenderStyle());
}
-Ref<RenderStyle> RenderStyle::createDefaultStyle()
+PassRef<RenderStyle> RenderStyle::createDefaultStyle()
{
return adoptRef(*new RenderStyle(true));
}
-Ref<RenderStyle> RenderStyle::createAnonymousStyleWithDisplay(const RenderStyle* parentStyle, EDisplay display)
+PassRef<RenderStyle> RenderStyle::createAnonymousStyleWithDisplay(const RenderStyle* parentStyle, EDisplay display)
{
auto newStyle = RenderStyle::create();
newStyle.get().inheritFrom(parentStyle);
@@ -108,20 +102,40 @@ Ref<RenderStyle> RenderStyle::createAnonymousStyleWithDisplay(const RenderStyle*
return newStyle;
}
-Ref<RenderStyle> RenderStyle::clone(const RenderStyle* other)
+PassRef<RenderStyle> RenderStyle::clone(const RenderStyle* other)
{
return adoptRef(*new RenderStyle(*other));
}
-Ref<RenderStyle> RenderStyle::createStyleInheritingFromPseudoStyle(const RenderStyle& pseudoStyle)
+PassRef<RenderStyle> RenderStyle::createStyleInheritingFromPseudoStyle(const RenderStyle& pseudoStyle)
{
ASSERT(pseudoStyle.styleType() == BEFORE || pseudoStyle.styleType() == AFTER);
+ // Images are special and must inherit the pseudoStyle so the width and height of
+ // the pseudo element doesn't change the size of the image. In all other cases we
+ // can just share the style.
auto style = RenderStyle::create();
style.get().inheritFrom(&pseudoStyle);
return style;
}
+ALWAYS_INLINE RenderStyle::RenderStyle()
+ : m_box(defaultStyle().m_box)
+ , visual(defaultStyle().visual)
+ , m_background(defaultStyle().m_background)
+ , surround(defaultStyle().surround)
+ , rareNonInheritedData(defaultStyle().rareNonInheritedData)
+ , rareInheritedData(defaultStyle().rareInheritedData)
+ , inherited(defaultStyle().inherited)
+#if ENABLE(SVG)
+ , m_svgStyle(defaultStyle().m_svgStyle)
+#endif
+{
+ setBitDefaults(); // Would it be faster to copy this from the default style?
+ COMPILE_ASSERT((sizeof(InheritedFlags) <= 8), InheritedFlags_does_not_grow);
+ COMPILE_ASSERT((sizeof(NonInheritedFlags) <= 8), NonInheritedFlags_does_not_grow);
+}
+
ALWAYS_INLINE RenderStyle::RenderStyle(bool)
: m_box(StyleBoxData::create())
, visual(StyleVisualData::create())
@@ -130,33 +144,11 @@ ALWAYS_INLINE RenderStyle::RenderStyle(bool)
, rareNonInheritedData(StyleRareNonInheritedData::create())
, rareInheritedData(StyleRareInheritedData::create())
, inherited(StyleInheritedData::create())
+#if ENABLE(SVG)
, m_svgStyle(SVGRenderStyle::create())
-{
- inherited_flags._empty_cells = initialEmptyCells();
- inherited_flags._caption_side = initialCaptionSide();
- inherited_flags._list_style_type = initialListStyleType();
- inherited_flags._list_style_position = initialListStylePosition();
- inherited_flags._visibility = initialVisibility();
- inherited_flags._text_align = initialTextAlign();
- inherited_flags._text_transform = initialTextTransform();
- inherited_flags._text_decorations = initialTextDecoration();
- inherited_flags._cursor_style = initialCursor();
-#if ENABLE(CURSOR_VISIBILITY)
- inherited_flags.m_cursorVisibility = initialCursorVisibility();
#endif
- inherited_flags._direction = initialDirection();
- inherited_flags._white_space = initialWhiteSpace();
- inherited_flags._border_collapse = initialBorderCollapse();
- inherited_flags.m_rtlOrdering = initialRTLOrdering();
- inherited_flags._box_direction = initialBoxDirection();
- inherited_flags.m_printColorAdjust = initialPrintColorAdjust();
- inherited_flags._pointerEvents = initialPointerEvents();
- inherited_flags._insideLink = NotInsideLink;
- inherited_flags._insideDefaultButton = false;
- inherited_flags.m_writingMode = initialWritingMode();
-
- static_assert((sizeof(InheritedFlags) <= 8), "InheritedFlags does not grow");
- static_assert((sizeof(NonInheritedFlags) <= 8), "NonInheritedFlags does not grow");
+{
+ setBitDefaults();
}
ALWAYS_INLINE RenderStyle::RenderStyle(const RenderStyle& o)
@@ -168,80 +160,14 @@ ALWAYS_INLINE RenderStyle::RenderStyle(const RenderStyle& o)
, rareNonInheritedData(o.rareNonInheritedData)
, rareInheritedData(o.rareInheritedData)
, inherited(o.inherited)
+#if ENABLE(SVG)
, m_svgStyle(o.m_svgStyle)
+#endif
, inherited_flags(o.inherited_flags)
, noninherited_flags(o.noninherited_flags)
{
}
-static inline StyleSelfAlignmentData resolveAlignmentData(const RenderStyle& parentStyle, const RenderStyle& childStyle, ItemPosition resolvedAutoPositionForRenderer)
-{
- // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto".
- if (childStyle.alignSelfPosition() == ItemPositionAuto)
- return (parentStyle.alignItemsPosition() == ItemPositionAuto) ? StyleSelfAlignmentData(resolvedAutoPositionForRenderer, OverflowAlignmentDefault) : parentStyle.alignItems();
- return childStyle.alignSelf();
-}
-
-static inline StyleSelfAlignmentData resolveJustificationData(const RenderStyle& parentStyle, const RenderStyle& childStyle, ItemPosition resolvedAutoPositionForRenderer)
-{
- // The auto keyword computes to the parent's justify-items computed value, or to "stretch", if not set or "auto".
- if (childStyle.justifySelfPosition() == ItemPositionAuto)
- return (parentStyle.justifyItemsPosition() == ItemPositionAuto) ? StyleSelfAlignmentData(resolvedAutoPositionForRenderer, OverflowAlignmentDefault) : parentStyle.justifyItems();
- return childStyle.justifySelf();
-}
-
-ItemPosition RenderStyle::resolveAlignment(const RenderStyle& parentStyle, const RenderStyle& childStyle, ItemPosition resolvedAutoPositionForRenderer)
-{
- return resolveAlignmentData(parentStyle, childStyle, resolvedAutoPositionForRenderer).position();
-}
-
-OverflowAlignment RenderStyle::resolveAlignmentOverflow(const RenderStyle& parentStyle, const RenderStyle& childStyle)
-{
- return resolveAlignmentData(parentStyle, childStyle, ItemPositionStretch).overflow();
-}
-
-ItemPosition RenderStyle::resolveJustification(const RenderStyle& parentStyle, const RenderStyle& childStyle, ItemPosition resolvedAutoPositionForRenderer)
-{
- return resolveJustificationData(parentStyle, childStyle, resolvedAutoPositionForRenderer).position();
-}
-
-OverflowAlignment RenderStyle::resolveJustificationOverflow(const RenderStyle& parentStyle, const RenderStyle& childStyle)
-{
- return resolveJustificationData(parentStyle, childStyle, ItemPositionStretch).overflow();
-}
-
-ContentPosition RenderStyle::resolvedAlignContentPosition() const
-{
- const StyleContentAlignmentData& align = alignContent();
- if (align.position() != ContentPositionAuto || align.distribution() != ContentDistributionDefault)
- return align.position();
- // 'auto' computes to 'stretch' for flexbox, hence it's managed by distribution().
- return isDisplayFlexibleBox() ? ContentPositionAuto : ContentPositionStart;
-}
-
-ContentDistributionType RenderStyle::resolvedAlignContentDistribution() const
-{
- const StyleContentAlignmentData& align = alignContent();
- if (align.position() != ContentPositionAuto || align.distribution() != ContentDistributionDefault)
- return align.distribution();
- return isDisplayFlexibleBox() ? ContentDistributionStretch : ContentDistributionDefault;
-}
-
-ContentPosition RenderStyle::resolvedJustifyContentPosition() const
-{
- const StyleContentAlignmentData& justify = justifyContent();
- if (justify.position() != ContentPositionAuto || justify.distribution() != ContentDistributionDefault)
- return justify.position();
- // 'auto' computes to 'stretch' for flexbox, but since flexing in the main axis is controlled by flex, it behaves as flex-start.
- return isDisplayFlexibleBox() ? ContentPositionFlexStart : ContentPositionStart;
-}
-
-ContentDistributionType RenderStyle::resolvedJustifyContentDistribution() const
-{
- // even that 'auto' computes to 'stretch' for flexbox it behaves as flex-start, hence it's managed by position().
- return justifyContentDistribution();
-}
-
void RenderStyle::inheritFrom(const RenderStyle* inheritParent, IsAtShadowBoundary isAtShadowBoundary)
{
if (isAtShadowBoundary == AtShadowBoundary) {
@@ -253,9 +179,10 @@ void RenderStyle::inheritFrom(const RenderStyle* inheritParent, IsAtShadowBounda
rareInheritedData = inheritParent->rareInheritedData;
inherited = inheritParent->inherited;
inherited_flags = inheritParent->inherited_flags;
-
+#if ENABLE(SVG)
if (m_svgStyle != inheritParent->m_svgStyle)
m_svgStyle.access()->inheritFrom(inheritParent->m_svgStyle.get());
+#endif
}
void RenderStyle::copyNonInheritedFrom(const RenderStyle* other)
@@ -265,11 +192,25 @@ void RenderStyle::copyNonInheritedFrom(const RenderStyle* other)
m_background = other->m_background;
surround = other->surround;
rareNonInheritedData = other->rareNonInheritedData;
- noninherited_flags.copyNonInheritedFrom(other->noninherited_flags);
-
+ // The flags are copied one-by-one because noninherited_flags contains a bunch of stuff other than real style data.
+ noninherited_flags._effectiveDisplay = other->noninherited_flags._effectiveDisplay;
+ noninherited_flags._originalDisplay = other->noninherited_flags._originalDisplay;
+ noninherited_flags._overflowX = other->noninherited_flags._overflowX;
+ noninherited_flags._overflowY = other->noninherited_flags._overflowY;
+ noninherited_flags._vertical_align = other->noninherited_flags._vertical_align;
+ noninherited_flags._clear = other->noninherited_flags._clear;
+ noninherited_flags._position = other->noninherited_flags._position;
+ noninherited_flags._floating = other->noninherited_flags._floating;
+ noninherited_flags._table_layout = other->noninherited_flags._table_layout;
+ noninherited_flags._unicodeBidi = other->noninherited_flags._unicodeBidi;
+ noninherited_flags._page_break_before = other->noninherited_flags._page_break_before;
+ noninherited_flags._page_break_after = other->noninherited_flags._page_break_after;
+ noninherited_flags._page_break_inside = other->noninherited_flags._page_break_inside;
+ noninherited_flags.explicitInheritance = other->noninherited_flags.explicitInheritance;
+#if ENABLE(SVG)
if (m_svgStyle != other->m_svgStyle)
m_svgStyle.access()->copyNonInheritedFrom(other->m_svgStyle.get());
-
+#endif
ASSERT(zoom() == initialZoom());
}
@@ -285,13 +226,15 @@ bool RenderStyle::operator==(const RenderStyle& o) const
&& rareNonInheritedData == o.rareNonInheritedData
&& rareInheritedData == o.rareInheritedData
&& inherited == o.inherited
+#if ENABLE(SVG)
&& m_svgStyle == o.m_svgStyle
+#endif
;
}
bool RenderStyle::isStyleAvailable() const
{
- return !Style::isPlaceholderStyle(*this);
+ return this != StyleResolver::styleNotYetAvailable();
}
bool RenderStyle::hasUniquePseudoStyle() const
@@ -311,10 +254,10 @@ bool RenderStyle::hasUniquePseudoStyle() const
RenderStyle* RenderStyle::getCachedPseudoStyle(PseudoId pid) const
{
if (!m_cachedPseudoStyles || !m_cachedPseudoStyles->size())
- return nullptr;
+ return 0;
if (styleType() != NOPSEUDO)
- return nullptr;
+ return 0;
for (size_t i = 0; i < m_cachedPseudoStyles->size(); ++i) {
RenderStyle* pseudoStyle = m_cachedPseudoStyles->at(i).get();
@@ -322,20 +265,20 @@ RenderStyle* RenderStyle::getCachedPseudoStyle(PseudoId pid) const
return pseudoStyle;
}
- return nullptr;
+ return 0;
}
RenderStyle* RenderStyle::addCachedPseudoStyle(PassRefPtr<RenderStyle> pseudo)
{
if (!pseudo)
- return nullptr;
+ return 0;
ASSERT(pseudo->styleType() > NOPSEUDO);
RenderStyle* result = pseudo.get();
if (!m_cachedPseudoStyles)
- m_cachedPseudoStyles = std::make_unique<PseudoStyleCache>();
+ m_cachedPseudoStyles = adoptPtr(new PseudoStyleCache);
m_cachedPseudoStyles->append(pseudo);
@@ -359,24 +302,28 @@ bool RenderStyle::inheritedNotEqual(const RenderStyle* other) const
{
return inherited_flags != other->inherited_flags
|| inherited != other->inherited
+#if ENABLE(SVG)
|| m_svgStyle->inheritedNotEqual(other->m_svgStyle.get())
+#endif
|| rareInheritedData != other->rareInheritedData;
}
#if ENABLE(IOS_TEXT_AUTOSIZING)
-
-static inline unsigned computeFontHash(const FontCascade& font)
+inline unsigned computeFontHash(const Font& font)
{
- IntegerHasher hasher;
- hasher.add(ASCIICaseInsensitiveHash::hash(font.fontDescription().firstFamily()));
- hasher.add(font.fontDescription().specifiedSize());
- return hasher.hash();
+ unsigned hashCodes[2] = {
+ CaseFoldingHash::hash(font.fontDescription().firstFamily().impl()),
+ static_cast<unsigned>(font.fontDescription().specifiedSize())
+ };
+ return StringHasher::computeHash(reinterpret_cast<UChar*>(hashCodes), 2 * sizeof(unsigned) / sizeof(UChar));
}
-unsigned RenderStyle::hashForTextAutosizing() const
+uint32_t RenderStyle::hashForTextAutosizing() const
{
// FIXME: Not a very smart hash. Could be improved upon. See <https://bugs.webkit.org/show_bug.cgi?id=121131>.
- unsigned hash = rareNonInheritedData->m_appearance;
+ uint32_t hash = 0;
+
+ hash ^= rareNonInheritedData->m_appearance;
hash ^= rareNonInheritedData->marginBeforeCollapse;
hash ^= rareNonInheritedData->marginAfterCollapse;
hash ^= rareNonInheritedData->lineClamp.value();
@@ -384,13 +331,13 @@ unsigned RenderStyle::hashForTextAutosizing() const
hash ^= rareInheritedData->nbspMode;
hash ^= rareInheritedData->lineBreak;
hash ^= WTF::FloatHash<float>::hash(inherited->specifiedLineHeight.value());
- hash ^= computeFontHash(inherited->fontCascade);
+ hash ^= computeFontHash(inherited->font);
hash ^= inherited->horizontal_border_spacing;
hash ^= inherited->vertical_border_spacing;
hash ^= inherited_flags._box_direction;
hash ^= inherited_flags.m_rtlOrdering;
- hash ^= noninherited_flags.position();
- hash ^= noninherited_flags.floating();
+ hash ^= noninherited_flags._position;
+ hash ^= noninherited_flags._floating;
hash ^= rareNonInheritedData->textOverflow;
hash ^= rareInheritedData->textSecurity;
return hash;
@@ -408,16 +355,15 @@ bool RenderStyle::equalForTextAutosizing(const RenderStyle* other) const
&& rareInheritedData->lineBreak == other->rareInheritedData->lineBreak
&& rareInheritedData->textSecurity == other->rareInheritedData->textSecurity
&& inherited->specifiedLineHeight == other->inherited->specifiedLineHeight
- && inherited->fontCascade.equalForTextAutoSizing(other->inherited->fontCascade)
+ && inherited->font.equalForTextAutoSizing(other->inherited->font)
&& inherited->horizontal_border_spacing == other->inherited->horizontal_border_spacing
&& inherited->vertical_border_spacing == other->inherited->vertical_border_spacing
&& inherited_flags._box_direction == other->inherited_flags._box_direction
&& inherited_flags.m_rtlOrdering == other->inherited_flags.m_rtlOrdering
- && noninherited_flags.position() == other->noninherited_flags.position()
- && noninherited_flags.floating() == other->noninherited_flags.floating()
+ && noninherited_flags._position == other->noninherited_flags._position
+ && noninherited_flags._floating == other->noninherited_flags._floating
&& rareNonInheritedData->textOverflow == other->rareNonInheritedData->textOverflow;
}
-
#endif // ENABLE(IOS_TEXT_AUTOSIZING)
bool RenderStyle::inheritedDataShared(const RenderStyle* other) const
@@ -425,7 +371,9 @@ bool RenderStyle::inheritedDataShared(const RenderStyle* other) const
// This is a fast check that only looks if the data structures are shared.
return inherited_flags == other->inherited_flags
&& inherited.get() == other->inherited.get()
+#if ENABLE(SVG)
&& m_svgStyle.get() == other->m_svgStyle.get()
+#endif
&& rareInheritedData.get() == other->rareInheritedData.get();
}
@@ -456,263 +404,250 @@ static bool positionChangeIsMovementOnly(const LengthBox& a, const LengthBox& b,
return true;
}
-inline bool RenderStyle::changeAffectsVisualOverflow(const RenderStyle& other) const
+bool RenderStyle::changeRequiresLayout(const RenderStyle* other, unsigned& changedContextSensitiveProperties) const
{
- if (rareNonInheritedData.get() != other.rareNonInheritedData.get()
- && !arePointingToEqualData(rareNonInheritedData->m_boxShadow, other.rareNonInheritedData->m_boxShadow))
+ if (m_box->width() != other->m_box->width()
+ || m_box->minWidth() != other->m_box->minWidth()
+ || m_box->maxWidth() != other->m_box->maxWidth()
+ || m_box->height() != other->m_box->height()
+ || m_box->minHeight() != other->m_box->minHeight()
+ || m_box->maxHeight() != other->m_box->maxHeight())
return true;
- if (rareInheritedData.get() != other.rareInheritedData.get()
- && !arePointingToEqualData(rareInheritedData->textShadow, other.rareInheritedData->textShadow))
+ if (m_box->verticalAlign() != other->m_box->verticalAlign() || noninherited_flags._vertical_align != other->noninherited_flags._vertical_align)
return true;
- if (inherited_flags._text_decorations != other.inherited_flags._text_decorations
- || visual->textDecoration != other.visual->textDecoration
- || rareNonInheritedData->m_textDecorationStyle != other.rareNonInheritedData->m_textDecorationStyle) {
- // Underlines are always drawn outside of their textbox bounds when text-underline-position: under;
- // is specified. We can take an early out here.
- if (textUnderlinePosition() == TextUnderlinePositionUnder
- || other.textUnderlinePosition() == TextUnderlinePositionUnder)
- return true;
- return visualOverflowForDecorations(*this, nullptr) != visualOverflowForDecorations(other, nullptr);
- }
-
- if (hasOutlineInVisualOverflow() != other.hasOutlineInVisualOverflow())
+ if (m_box->boxSizing() != other->m_box->boxSizing())
return true;
- return false;
-}
-bool RenderStyle::changeRequiresLayout(const RenderStyle& other, unsigned& changedContextSensitiveProperties) const
-{
- if (m_box->width() != other.m_box->width()
- || m_box->minWidth() != other.m_box->minWidth()
- || m_box->maxWidth() != other.m_box->maxWidth()
- || m_box->height() != other.m_box->height()
- || m_box->minHeight() != other.m_box->minHeight()
- || m_box->maxHeight() != other.m_box->maxHeight())
+ if (surround->margin != other->surround->margin)
return true;
- if (m_box->verticalAlign() != other.m_box->verticalAlign() || noninherited_flags.verticalAlign() != other.noninherited_flags.verticalAlign())
+ if (surround->padding != other->surround->padding)
return true;
- if (m_box->boxSizing() != other.m_box->boxSizing())
- return true;
-
- if (surround->margin != other.surround->margin)
- return true;
-
- if (surround->padding != other.surround->padding)
- return true;
-
- // FIXME: We should add an optimized form of layout that just recomputes visual overflow.
- if (changeAffectsVisualOverflow(other))
- return true;
+ if (rareNonInheritedData.get() != other->rareNonInheritedData.get()) {
+ if (rareNonInheritedData->m_appearance != other->rareNonInheritedData->m_appearance
+ || rareNonInheritedData->marginBeforeCollapse != other->rareNonInheritedData->marginBeforeCollapse
+ || rareNonInheritedData->marginAfterCollapse != other->rareNonInheritedData->marginAfterCollapse
+ || rareNonInheritedData->lineClamp != other->rareNonInheritedData->lineClamp
+ || rareNonInheritedData->textOverflow != other->rareNonInheritedData->textOverflow)
+ return true;
- if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) {
- if (rareNonInheritedData->m_appearance != other.rareNonInheritedData->m_appearance
- || rareNonInheritedData->marginBeforeCollapse != other.rareNonInheritedData->marginBeforeCollapse
- || rareNonInheritedData->marginAfterCollapse != other.rareNonInheritedData->marginAfterCollapse
- || rareNonInheritedData->lineClamp != other.rareNonInheritedData->lineClamp
- || rareNonInheritedData->m_initialLetter != other.rareNonInheritedData->m_initialLetter
- || rareNonInheritedData->textOverflow != other.rareNonInheritedData->textOverflow)
+ if (rareNonInheritedData->m_regionFragment != other->rareNonInheritedData->m_regionFragment)
return true;
- if (rareNonInheritedData->m_regionFragment != other.rareNonInheritedData->m_regionFragment)
+ if (rareNonInheritedData->m_wrapFlow != other->rareNonInheritedData->m_wrapFlow
+ || rareNonInheritedData->m_wrapThrough != other->rareNonInheritedData->m_wrapThrough)
return true;
#if ENABLE(CSS_SHAPES)
- if (rareNonInheritedData->m_shapeMargin != other.rareNonInheritedData->m_shapeMargin)
+ if (rareNonInheritedData->m_shapeMargin != other->rareNonInheritedData->m_shapeMargin
+ || rareNonInheritedData->m_shapePadding != other->rareNonInheritedData->m_shapePadding)
return true;
#endif
- if (rareNonInheritedData->m_deprecatedFlexibleBox != other.rareNonInheritedData->m_deprecatedFlexibleBox)
+ if (rareNonInheritedData->m_deprecatedFlexibleBox.get() != other->rareNonInheritedData->m_deprecatedFlexibleBox.get()
+ && *rareNonInheritedData->m_deprecatedFlexibleBox.get() != *other->rareNonInheritedData->m_deprecatedFlexibleBox.get())
return true;
- if (rareNonInheritedData->m_flexibleBox != other.rareNonInheritedData->m_flexibleBox)
+ if (rareNonInheritedData->m_flexibleBox.get() != other->rareNonInheritedData->m_flexibleBox.get()
+ && *rareNonInheritedData->m_flexibleBox.get() != *other->rareNonInheritedData->m_flexibleBox.get())
+ return true;
+ if (rareNonInheritedData->m_order != other->rareNonInheritedData->m_order
+ || rareNonInheritedData->m_alignContent != other->rareNonInheritedData->m_alignContent
+ || rareNonInheritedData->m_alignItems != other->rareNonInheritedData->m_alignItems
+ || rareNonInheritedData->m_alignSelf != other->rareNonInheritedData->m_alignSelf
+ || rareNonInheritedData->m_justifyContent != other->rareNonInheritedData->m_justifyContent)
return true;
- if (rareNonInheritedData->m_order != other.rareNonInheritedData->m_order
- || rareNonInheritedData->m_alignContent != other.rareNonInheritedData->m_alignContent
- || rareNonInheritedData->m_alignItems != other.rareNonInheritedData->m_alignItems
- || rareNonInheritedData->m_alignSelf != other.rareNonInheritedData->m_alignSelf
- || rareNonInheritedData->m_justifyContent != other.rareNonInheritedData->m_justifyContent
- || rareNonInheritedData->m_justifyItems != other.rareNonInheritedData->m_justifyItems
- || rareNonInheritedData->m_justifySelf != other.rareNonInheritedData->m_justifySelf)
+ // FIXME: We should add an optimized form of layout that just recomputes visual overflow.
+ if (!rareNonInheritedData->shadowDataEquivalent(*other->rareNonInheritedData.get()))
return true;
- if (!arePointingToEqualData(rareNonInheritedData->m_boxReflect, other.rareNonInheritedData->m_boxReflect))
+ if (!rareNonInheritedData->reflectionDataEquivalent(*other->rareNonInheritedData.get()))
return true;
- if (rareNonInheritedData->m_multiCol != other.rareNonInheritedData->m_multiCol)
+ if (rareNonInheritedData->m_multiCol.get() != other->rareNonInheritedData->m_multiCol.get()
+ && *rareNonInheritedData->m_multiCol.get() != *other->rareNonInheritedData->m_multiCol.get())
return true;
- if (rareNonInheritedData->m_transform != other.rareNonInheritedData->m_transform) {
- if (rareNonInheritedData->m_transform->hasTransform() != other.rareNonInheritedData->m_transform->hasTransform())
- return true;
- if (*rareNonInheritedData->m_transform != *other.rareNonInheritedData->m_transform) {
- changedContextSensitiveProperties |= ContextSensitivePropertyTransform;
- // Don't return; keep looking for another change
- }
+ if (rareNonInheritedData->m_transform.get() != other->rareNonInheritedData->m_transform.get()
+ && *rareNonInheritedData->m_transform.get() != *other->rareNonInheritedData->m_transform.get()) {
+#if USE(ACCELERATED_COMPOSITING)
+ changedContextSensitiveProperties |= ContextSensitivePropertyTransform;
+ // Don't return; keep looking for another change
+#else
+ UNUSED_PARAM(changedContextSensitiveProperties);
+ return true;
+#endif
}
-#if ENABLE(CSS_GRID_LAYOUT)
- if (rareNonInheritedData->m_grid != other.rareNonInheritedData->m_grid
- || rareNonInheritedData->m_gridItem != other.rareNonInheritedData->m_gridItem)
+ if (rareNonInheritedData->m_grid.get() != other->rareNonInheritedData->m_grid.get()
+ || rareNonInheritedData->m_gridItem.get() != other->rareNonInheritedData->m_gridItem.get())
return true;
+
+#if !USE(ACCELERATED_COMPOSITING)
+ if (rareNonInheritedData.get() != other->rareNonInheritedData.get()) {
+ if (rareNonInheritedData->m_transformStyle3D != other->rareNonInheritedData->m_transformStyle3D
+ || rareNonInheritedData->m_backfaceVisibility != other->rareNonInheritedData->m_backfaceVisibility
+ || rareNonInheritedData->m_perspective != other->rareNonInheritedData->m_perspective
+ || rareNonInheritedData->m_perspectiveOriginX != other->rareNonInheritedData->m_perspectiveOriginX
+ || rareNonInheritedData->m_perspectiveOriginY != other->rareNonInheritedData->m_perspectiveOriginY)
+ return true;
+ }
#endif
#if ENABLE(DASHBOARD_SUPPORT)
// If regions change, trigger a relayout to re-calc regions.
- if (rareNonInheritedData->m_dashboardRegions != other.rareNonInheritedData->m_dashboardRegions)
+ if (rareNonInheritedData->m_dashboardRegions != other->rareNonInheritedData->m_dashboardRegions)
return true;
#endif
- if (!arePointingToEqualData(rareNonInheritedData->m_willChange, other.rareNonInheritedData->m_willChange)) {
- changedContextSensitiveProperties |= ContextSensitivePropertyWillChange;
- // Don't return; keep looking for another change
- }
+#if ENABLE(CSS_SHAPES)
+ if (rareNonInheritedData->m_shapeInside != other->rareNonInheritedData->m_shapeInside)
+ return true;
+#endif
}
- if (rareInheritedData.get() != other.rareInheritedData.get()) {
- if (rareInheritedData->indent != other.rareInheritedData->indent
+ if (rareInheritedData.get() != other->rareInheritedData.get()) {
+ if (rareInheritedData->highlight != other->rareInheritedData->highlight
+ || rareInheritedData->indent != other->rareInheritedData->indent
#if ENABLE(CSS3_TEXT)
- || rareInheritedData->m_textAlignLast != other.rareInheritedData->m_textAlignLast
- || rareInheritedData->m_textJustify != other.rareInheritedData->m_textJustify
- || rareInheritedData->m_textIndentLine != other.rareInheritedData->m_textIndentLine
+ || rareInheritedData->m_textAlignLast != other->rareInheritedData->m_textAlignLast
+ || rareInheritedData->m_textIndentLine != other->rareInheritedData->m_textIndentLine
#endif
- || rareInheritedData->m_effectiveZoom != other.rareInheritedData->m_effectiveZoom
- || rareInheritedData->m_textZoom != other.rareInheritedData->m_textZoom
+ || rareInheritedData->m_effectiveZoom != other->rareInheritedData->m_effectiveZoom
#if ENABLE(IOS_TEXT_AUTOSIZING)
- || rareInheritedData->textSizeAdjust != other.rareInheritedData->textSizeAdjust
+ || rareInheritedData->textSizeAdjust != other->rareInheritedData->textSizeAdjust
#endif
- || rareInheritedData->wordBreak != other.rareInheritedData->wordBreak
- || rareInheritedData->overflowWrap != other.rareInheritedData->overflowWrap
- || rareInheritedData->nbspMode != other.rareInheritedData->nbspMode
- || rareInheritedData->lineBreak != other.rareInheritedData->lineBreak
- || rareInheritedData->textSecurity != other.rareInheritedData->textSecurity
- || rareInheritedData->hyphens != other.rareInheritedData->hyphens
- || rareInheritedData->hyphenationLimitBefore != other.rareInheritedData->hyphenationLimitBefore
- || rareInheritedData->hyphenationLimitAfter != other.rareInheritedData->hyphenationLimitAfter
- || rareInheritedData->hyphenationString != other.rareInheritedData->hyphenationString
- || rareInheritedData->m_rubyPosition != other.rareInheritedData->m_rubyPosition
- || rareInheritedData->textEmphasisMark != other.rareInheritedData->textEmphasisMark
- || rareInheritedData->textEmphasisPosition != other.rareInheritedData->textEmphasisPosition
- || rareInheritedData->textEmphasisCustomMark != other.rareInheritedData->textEmphasisCustomMark
- || rareInheritedData->m_textOrientation != other.rareInheritedData->m_textOrientation
- || rareInheritedData->m_tabSize != other.rareInheritedData->m_tabSize
- || rareInheritedData->m_lineBoxContain != other.rareInheritedData->m_lineBoxContain
- || rareInheritedData->m_lineGrid != other.rareInheritedData->m_lineGrid
+ || rareInheritedData->wordBreak != other->rareInheritedData->wordBreak
+ || rareInheritedData->overflowWrap != other->rareInheritedData->overflowWrap
+ || rareInheritedData->nbspMode != other->rareInheritedData->nbspMode
+ || rareInheritedData->lineBreak != other->rareInheritedData->lineBreak
+ || rareInheritedData->textSecurity != other->rareInheritedData->textSecurity
+ || rareInheritedData->hyphens != other->rareInheritedData->hyphens
+ || rareInheritedData->hyphenationLimitBefore != other->rareInheritedData->hyphenationLimitBefore
+ || rareInheritedData->hyphenationLimitAfter != other->rareInheritedData->hyphenationLimitAfter
+ || rareInheritedData->hyphenationString != other->rareInheritedData->hyphenationString
+ || rareInheritedData->locale != other->rareInheritedData->locale
+ || rareInheritedData->m_rubyPosition != other->rareInheritedData->m_rubyPosition
+ || rareInheritedData->textEmphasisMark != other->rareInheritedData->textEmphasisMark
+ || rareInheritedData->textEmphasisPosition != other->rareInheritedData->textEmphasisPosition
+ || rareInheritedData->textEmphasisCustomMark != other->rareInheritedData->textEmphasisCustomMark
+ || rareInheritedData->m_textOrientation != other->rareInheritedData->m_textOrientation
+ || rareInheritedData->m_tabSize != other->rareInheritedData->m_tabSize
+ || rareInheritedData->m_lineBoxContain != other->rareInheritedData->m_lineBoxContain
+ || rareInheritedData->m_lineGrid != other->rareInheritedData->m_lineGrid
#if ENABLE(CSS_IMAGE_ORIENTATION)
- || rareInheritedData->m_imageOrientation != other.rareInheritedData->m_imageOrientation
+ || rareInheritedData->m_imageOrientation != other->rareInheritedData->m_imageOrientation
#endif
#if ENABLE(CSS_IMAGE_RESOLUTION)
- || rareInheritedData->m_imageResolutionSource != other.rareInheritedData->m_imageResolutionSource
- || rareInheritedData->m_imageResolutionSnap != other.rareInheritedData->m_imageResolutionSnap
- || rareInheritedData->m_imageResolution != other.rareInheritedData->m_imageResolution
+ || rareInheritedData->m_imageResolutionSource != other->rareInheritedData->m_imageResolutionSource
+ || rareInheritedData->m_imageResolutionSnap != other->rareInheritedData->m_imageResolutionSnap
+ || rareInheritedData->m_imageResolution != other->rareInheritedData->m_imageResolution
#endif
- || rareInheritedData->m_lineSnap != other.rareInheritedData->m_lineSnap
- || rareInheritedData->m_lineAlign != other.rareInheritedData->m_lineAlign
- || rareInheritedData->m_hangingPunctuation != other.rareInheritedData->m_hangingPunctuation
+ || rareInheritedData->m_lineSnap != other->rareInheritedData->m_lineSnap
+ || rareInheritedData->m_lineAlign != other->rareInheritedData->m_lineAlign
#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
- || rareInheritedData->useTouchOverflowScrolling != other.rareInheritedData->useTouchOverflowScrolling
+ || rareInheritedData->useTouchOverflowScrolling != other->rareInheritedData->useTouchOverflowScrolling
#endif
- || rareInheritedData->listStyleImage != other.rareInheritedData->listStyleImage) // FIXME: needs arePointingToEqualData()?
+ || rareInheritedData->listStyleImage != other->rareInheritedData->listStyleImage)
+ return true;
+
+ if (!rareInheritedData->shadowDataEquivalent(*other->rareInheritedData.get()))
return true;
- if (textStrokeWidth() != other.textStrokeWidth())
+ if (textStrokeWidth() != other->textStrokeWidth())
return true;
}
#if ENABLE(TEXT_AUTOSIZING)
- if (visual->m_textAutosizingMultiplier != other.visual->m_textAutosizingMultiplier)
+ if (visual->m_textAutosizingMultiplier != other->visual->m_textAutosizingMultiplier)
return true;
#endif
- if (inherited->line_height != other.inherited->line_height
+ if (inherited->line_height != other->inherited->line_height
#if ENABLE(IOS_TEXT_AUTOSIZING)
- || inherited->specifiedLineHeight != other.inherited->specifiedLineHeight
+ || inherited->specifiedLineHeight != other->inherited->specifiedLineHeight
#endif
- || inherited->fontCascade != other.inherited->fontCascade
- || inherited->horizontal_border_spacing != other.inherited->horizontal_border_spacing
- || inherited->vertical_border_spacing != other.inherited->vertical_border_spacing
- || inherited_flags._box_direction != other.inherited_flags._box_direction
- || inherited_flags.m_rtlOrdering != other.inherited_flags.m_rtlOrdering
- || noninherited_flags.position() != other.noninherited_flags.position()
- || noninherited_flags.floating() != other.noninherited_flags.floating()
- || noninherited_flags.originalDisplay() != other.noninherited_flags.originalDisplay())
+ || inherited->font != other->inherited->font
+ || inherited->horizontal_border_spacing != other->inherited->horizontal_border_spacing
+ || inherited->vertical_border_spacing != other->inherited->vertical_border_spacing
+ || inherited_flags._box_direction != other->inherited_flags._box_direction
+ || inherited_flags.m_rtlOrdering != other->inherited_flags.m_rtlOrdering
+ || noninherited_flags._position != other->noninherited_flags._position
+ || noninherited_flags._floating != other->noninherited_flags._floating
+ || noninherited_flags._originalDisplay != other->noninherited_flags._originalDisplay)
return true;
- if ((noninherited_flags.effectiveDisplay()) >= TABLE) {
- if (inherited_flags._border_collapse != other.inherited_flags._border_collapse
- || inherited_flags._empty_cells != other.inherited_flags._empty_cells
- || inherited_flags._caption_side != other.inherited_flags._caption_side
- || noninherited_flags.tableLayout() != other.noninherited_flags.tableLayout())
+ if (((int)noninherited_flags._effectiveDisplay) >= TABLE) {
+ if (inherited_flags._border_collapse != other->inherited_flags._border_collapse
+ || inherited_flags._empty_cells != other->inherited_flags._empty_cells
+ || inherited_flags._caption_side != other->inherited_flags._caption_side
+ || noninherited_flags._table_layout != other->noninherited_flags._table_layout)
return true;
// In the collapsing border model, 'hidden' suppresses other borders, while 'none'
// does not, so these style differences can be width differences.
if (inherited_flags._border_collapse
- && ((borderTopStyle() == BHIDDEN && other.borderTopStyle() == BNONE)
- || (borderTopStyle() == BNONE && other.borderTopStyle() == BHIDDEN)
- || (borderBottomStyle() == BHIDDEN && other.borderBottomStyle() == BNONE)
- || (borderBottomStyle() == BNONE && other.borderBottomStyle() == BHIDDEN)
- || (borderLeftStyle() == BHIDDEN && other.borderLeftStyle() == BNONE)
- || (borderLeftStyle() == BNONE && other.borderLeftStyle() == BHIDDEN)
- || (borderRightStyle() == BHIDDEN && other.borderRightStyle() == BNONE)
- || (borderRightStyle() == BNONE && other.borderRightStyle() == BHIDDEN)))
+ && ((borderTopStyle() == BHIDDEN && other->borderTopStyle() == BNONE)
+ || (borderTopStyle() == BNONE && other->borderTopStyle() == BHIDDEN)
+ || (borderBottomStyle() == BHIDDEN && other->borderBottomStyle() == BNONE)
+ || (borderBottomStyle() == BNONE && other->borderBottomStyle() == BHIDDEN)
+ || (borderLeftStyle() == BHIDDEN && other->borderLeftStyle() == BNONE)
+ || (borderLeftStyle() == BNONE && other->borderLeftStyle() == BHIDDEN)
+ || (borderRightStyle() == BHIDDEN && other->borderRightStyle() == BNONE)
+ || (borderRightStyle() == BNONE && other->borderRightStyle() == BHIDDEN)))
return true;
}
- if (noninherited_flags.effectiveDisplay() == LIST_ITEM) {
- if (inherited_flags._list_style_type != other.inherited_flags._list_style_type
- || inherited_flags._list_style_position != other.inherited_flags._list_style_position)
+ if (noninherited_flags._effectiveDisplay == LIST_ITEM) {
+ if (inherited_flags._list_style_type != other->inherited_flags._list_style_type
+ || inherited_flags._list_style_position != other->inherited_flags._list_style_position)
return true;
}
- if (inherited_flags._text_align != other.inherited_flags._text_align
- || inherited_flags._text_transform != other.inherited_flags._text_transform
- || inherited_flags._direction != other.inherited_flags._direction
- || inherited_flags._white_space != other.inherited_flags._white_space
- || noninherited_flags.clear() != other.noninherited_flags.clear()
- || noninherited_flags.unicodeBidi() != other.noninherited_flags.unicodeBidi())
+ if (inherited_flags._text_align != other->inherited_flags._text_align
+ || inherited_flags._text_transform != other->inherited_flags._text_transform
+ || inherited_flags._direction != other->inherited_flags._direction
+ || inherited_flags._white_space != other->inherited_flags._white_space
+ || noninherited_flags._clear != other->noninherited_flags._clear
+ || noninherited_flags._unicodeBidi != other->noninherited_flags._unicodeBidi)
return true;
// Check block flow direction.
- if (inherited_flags.m_writingMode != other.inherited_flags.m_writingMode)
+ if (inherited_flags.m_writingMode != other->inherited_flags.m_writingMode)
return true;
// Check text combine mode.
- if (rareNonInheritedData->m_textCombine != other.rareNonInheritedData->m_textCombine)
- return true;
-
- // Check breaks.
- if (rareNonInheritedData->m_breakBefore != other.rareNonInheritedData->m_breakBefore
- || rareNonInheritedData->m_breakAfter != other.rareNonInheritedData->m_breakAfter
- || rareNonInheritedData->m_breakInside != other.rareNonInheritedData->m_breakInside)
+ if (rareNonInheritedData->m_textCombine != other->rareNonInheritedData->m_textCombine)
return true;
// Overflow returns a layout hint.
- if (noninherited_flags.overflowX() != other.noninherited_flags.overflowX()
- || noninherited_flags.overflowY() != other.noninherited_flags.overflowY())
+ if (noninherited_flags._overflowX != other->noninherited_flags._overflowX
+ || noninherited_flags._overflowY != other->noninherited_flags._overflowY)
return true;
// If our border widths change, then we need to layout. Other changes to borders
// only necessitate a repaint.
- if (borderLeftWidth() != other.borderLeftWidth()
- || borderTopWidth() != other.borderTopWidth()
- || borderBottomWidth() != other.borderBottomWidth()
- || borderRightWidth() != other.borderRightWidth())
+ if (borderLeftWidth() != other->borderLeftWidth()
+ || borderTopWidth() != other->borderTopWidth()
+ || borderBottomWidth() != other->borderBottomWidth()
+ || borderRightWidth() != other->borderRightWidth())
return true;
// If the counter directives change, trigger a relayout to re-calculate counter values and rebuild the counter node tree.
- if (!arePointingToEqualData(rareNonInheritedData->m_counterDirectives, other.rareNonInheritedData->m_counterDirectives))
+ const CounterDirectiveMap* mapA = rareNonInheritedData->m_counterDirectives.get();
+ const CounterDirectiveMap* mapB = other->rareNonInheritedData->m_counterDirectives.get();
+ if (!(mapA == mapB || (mapA && mapB && *mapA == *mapB)))
return true;
- if ((visibility() == COLLAPSE) != (other.visibility() == COLLAPSE))
+ if ((visibility() == COLLAPSE) != (other->visibility() == COLLAPSE))
return true;
- if (rareNonInheritedData->hasOpacity() != other.rareNonInheritedData->hasOpacity()) {
+ if (rareNonInheritedData->hasOpacity() != other->rareNonInheritedData->hasOpacity()) {
// FIXME: We would like to use SimplifiedLayout here, but we can't quite do that yet.
// We need to make sure SimplifiedLayout can operate correctly on RenderInlines (we will need
// to add a selfNeedsSimplifiedLayout bit in order to not get confused and taint every line).
@@ -721,19 +656,18 @@ bool RenderStyle::changeRequiresLayout(const RenderStyle& other, unsigned& chang
return true;
}
- if (rareNonInheritedData->hasFilters() != other.rareNonInheritedData->hasFilters())
- return true;
-
-#if ENABLE(FILTERS_LEVEL_2)
- if (rareNonInheritedData->hasBackdropFilters() != other.rareNonInheritedData->hasBackdropFilters())
+#if ENABLE(CSS_FILTERS)
+ if (rareNonInheritedData->hasFilters() != other->rareNonInheritedData->hasFilters())
return true;
#endif
- if (!arePointingToEqualData(rareInheritedData->quotes, other.rareInheritedData->quotes))
+ const QuotesData* quotesDataA = rareInheritedData->quotes.get();
+ const QuotesData* quotesDataB = other->rareInheritedData->quotes.get();
+ if (!(quotesDataA == quotesDataB || (quotesDataA && quotesDataB && *quotesDataA == *quotesDataB)))
return true;
if (position() != StaticPosition) {
- if (surround->offset != other.surround->offset) {
+ if (surround->offset != other->surround->offset) {
// FIXME: We would like to use SimplifiedLayout for relative positioning, but we can't quite do that yet.
// We need to make sure SimplifiedLayout can operate correctly on RenderInlines (we will need
// to add a selfNeedsSimplifiedLayout bit in order to not get confused and taint every line).
@@ -741,7 +675,7 @@ bool RenderStyle::changeRequiresLayout(const RenderStyle& other, unsigned& chang
return true;
// Optimize for the case where a positioned layer is moving but not changing size.
- if (!positionChangeIsMovementOnly(surround->offset, other.surround->offset, m_box->width()))
+ if (!positionChangeIsMovementOnly(surround->offset, other->surround->offset, m_box->width()))
return true;
}
}
@@ -749,136 +683,153 @@ bool RenderStyle::changeRequiresLayout(const RenderStyle& other, unsigned& chang
return false;
}
-bool RenderStyle::changeRequiresPositionedLayoutOnly(const RenderStyle& other, unsigned&) const
+bool RenderStyle::changeRequiresPositionedLayoutOnly(const RenderStyle* other, unsigned&) const
{
if (position() == StaticPosition)
return false;
- if (surround->offset != other.surround->offset) {
+ if (surround->offset != other->surround->offset) {
// Optimize for the case where a positioned layer is moving but not changing size.
- if (position() == AbsolutePosition && positionChangeIsMovementOnly(surround->offset, other.surround->offset, m_box->width()))
+ if (position() == AbsolutePosition && positionChangeIsMovementOnly(surround->offset, other->surround->offset, m_box->width()))
return true;
}
return false;
}
-bool RenderStyle::changeRequiresLayerRepaint(const RenderStyle& other, unsigned& changedContextSensitiveProperties) const
+bool RenderStyle::changeRequiresLayerRepaint(const RenderStyle* other, unsigned& changedContextSensitiveProperties) const
{
- // StyleResolver has ensured that zIndex is non-auto only if it's applicable.
- if (m_box->zIndex() != other.m_box->zIndex() || m_box->hasAutoZIndex() != other.m_box->hasAutoZIndex())
- return true;
-
if (position() != StaticPosition) {
- if (visual->clip != other.visual->clip || visual->hasClip != other.visual->hasClip) {
- changedContextSensitiveProperties |= ContextSensitivePropertyClipRect;
+ if (m_box->zIndex() != other->m_box->zIndex()
+ || m_box->hasAutoZIndex() != other->m_box->hasAutoZIndex()
+ || visual->clip != other->visual->clip
+ || visual->hasClip != other->visual->hasClip)
return true;
- }
}
#if ENABLE(CSS_COMPOSITING)
- if (rareNonInheritedData->m_effectiveBlendMode != other.rareNonInheritedData->m_effectiveBlendMode)
+ if (rareNonInheritedData->m_effectiveBlendMode != other->rareNonInheritedData->m_effectiveBlendMode)
return true;
#endif
- if (rareNonInheritedData->opacity != other.rareNonInheritedData->opacity) {
+ if (rareNonInheritedData->opacity != other->rareNonInheritedData->opacity) {
+#if USE(ACCELERATED_COMPOSITING)
changedContextSensitiveProperties |= ContextSensitivePropertyOpacity;
// Don't return; keep looking for another change.
+#else
+ UNUSED_PARAM(changedContextSensitiveProperties);
+ return true;
+#endif
}
- if (rareNonInheritedData->m_filter != other.rareNonInheritedData->m_filter) {
+#if ENABLE(CSS_FILTERS)
+ if (rareNonInheritedData->m_filter.get() != other->rareNonInheritedData->m_filter.get()
+ && *rareNonInheritedData->m_filter.get() != *other->rareNonInheritedData->m_filter.get()) {
+#if USE(ACCELERATED_COMPOSITING)
changedContextSensitiveProperties |= ContextSensitivePropertyFilter;
// Don't return; keep looking for another change.
+#else
+ return true;
+#endif
}
+#endif
- if (rareNonInheritedData->m_mask != other.rareNonInheritedData->m_mask
- || rareNonInheritedData->m_maskBoxImage != other.rareNonInheritedData->m_maskBoxImage)
+ if (rareNonInheritedData->m_mask != other->rareNonInheritedData->m_mask
+ || rareNonInheritedData->m_maskBoxImage != other->rareNonInheritedData->m_maskBoxImage)
return true;
return false;
}
-bool RenderStyle::changeRequiresRepaint(const RenderStyle& other, unsigned& changedContextSensitiveProperties) const
-{
- if (inherited_flags._visibility != other.inherited_flags._visibility
- || inherited_flags.m_printColorAdjust != other.inherited_flags.m_printColorAdjust
- || inherited_flags._insideLink != other.inherited_flags._insideLink
- || inherited_flags._insideDefaultButton != other.inherited_flags._insideDefaultButton
- || surround->border != other.surround->border
- || !m_background->isEquivalentForPainting(*other.m_background)
- || rareInheritedData->userModify != other.rareInheritedData->userModify
- || rareInheritedData->userSelect != other.rareInheritedData->userSelect
- || rareNonInheritedData->userDrag != other.rareNonInheritedData->userDrag
- || rareNonInheritedData->m_borderFit != other.rareNonInheritedData->m_borderFit
- || rareNonInheritedData->m_objectFit != other.rareNonInheritedData->m_objectFit
- || rareInheritedData->m_imageRendering != other.rareInheritedData->m_imageRendering)
+bool RenderStyle::changeRequiresRepaint(const RenderStyle* other, unsigned&) const
+{
+ if (inherited_flags._visibility != other->inherited_flags._visibility
+ || inherited_flags.m_printColorAdjust != other->inherited_flags.m_printColorAdjust
+ || inherited_flags._insideLink != other->inherited_flags._insideLink
+ || surround->border != other->surround->border
+ || !m_background->isEquivalentForPainting(*other->m_background)
+ || rareInheritedData->userModify != other->rareInheritedData->userModify
+ || rareInheritedData->userSelect != other->rareInheritedData->userSelect
+ || rareNonInheritedData->userDrag != other->rareNonInheritedData->userDrag
+ || rareNonInheritedData->m_borderFit != other->rareNonInheritedData->m_borderFit
+ || rareNonInheritedData->m_objectFit != other->rareNonInheritedData->m_objectFit
+ || rareInheritedData->m_imageRendering != other->rareInheritedData->m_imageRendering)
return true;
#if ENABLE(CSS_SHAPES)
- if (rareNonInheritedData->m_shapeOutside != other.rareNonInheritedData->m_shapeOutside)
+ // FIXME: The current spec is being reworked to remove dependencies between exclusions and affected
+ // content. There's a proposal to use floats instead. In that case, wrap-shape should actually relayout
+ // the parent container. For sure, I will have to revisit this code, but for now I've added this in order
+ // to avoid having diff() == StyleDifferenceEqual where wrap-shapes actually differ.
+ // Tracking bug: https://bugs.webkit.org/show_bug.cgi?id=62991
+ if (rareNonInheritedData->m_shapeOutside != other->rareNonInheritedData->m_shapeOutside)
return true;
#endif
- // FIXME: this should probably be moved to changeRequiresLayerRepaint().
- if (rareNonInheritedData->m_clipPath != other.rareNonInheritedData->m_clipPath) {
- changedContextSensitiveProperties |= ContextSensitivePropertyClipPath;
- // Don't return; keep looking for another change.
- }
+ if (rareNonInheritedData->m_clipPath != other->rareNonInheritedData->m_clipPath)
+ return true;
return false;
}
-bool RenderStyle::changeRequiresRepaintIfTextOrBorderOrOutline(const RenderStyle& other, unsigned&) const
+bool RenderStyle::changeRequiresRepaintIfTextOrBorderOrOutline(const RenderStyle* other, unsigned&) const
{
- if (inherited->color != other.inherited->color
- || inherited_flags._text_decorations != other.inherited_flags._text_decorations
- || visual->textDecoration != other.visual->textDecoration
- || rareNonInheritedData->m_textDecorationStyle != other.rareNonInheritedData->m_textDecorationStyle
- || rareNonInheritedData->m_textDecorationColor != other.rareNonInheritedData->m_textDecorationColor
- || rareInheritedData->m_textDecorationSkip != other.rareInheritedData->m_textDecorationSkip
- || rareInheritedData->textFillColor != other.rareInheritedData->textFillColor
- || rareInheritedData->textStrokeColor != other.rareInheritedData->textStrokeColor
- || rareInheritedData->textEmphasisColor != other.rareInheritedData->textEmphasisColor
- || rareInheritedData->textEmphasisFill != other.rareInheritedData->textEmphasisFill)
+ if (inherited->color != other->inherited->color
+ || inherited_flags._text_decorations != other->inherited_flags._text_decorations
+ || visual->textDecoration != other->visual->textDecoration
+ || rareNonInheritedData->m_textDecorationStyle != other->rareNonInheritedData->m_textDecorationStyle
+ || rareNonInheritedData->m_textDecorationColor != other->rareNonInheritedData->m_textDecorationColor
+ || rareInheritedData->m_textDecorationSkip != other->rareInheritedData->m_textDecorationSkip
+ || rareInheritedData->textFillColor != other->rareInheritedData->textFillColor
+ || rareInheritedData->textStrokeColor != other->rareInheritedData->textStrokeColor
+ || rareInheritedData->textEmphasisColor != other->rareInheritedData->textEmphasisColor
+ || rareInheritedData->textEmphasisFill != other->rareInheritedData->textEmphasisFill)
return true;
return false;
}
-bool RenderStyle::changeRequiresRecompositeLayer(const RenderStyle& other, unsigned&) const
+bool RenderStyle::changeRequiresRecompositeLayer(const RenderStyle* other, unsigned&) const
{
- if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) {
- if (rareNonInheritedData->m_transformStyle3D != other.rareNonInheritedData->m_transformStyle3D
- || rareNonInheritedData->m_backfaceVisibility != other.rareNonInheritedData->m_backfaceVisibility
- || rareNonInheritedData->m_perspective != other.rareNonInheritedData->m_perspective
- || rareNonInheritedData->m_perspectiveOriginX != other.rareNonInheritedData->m_perspectiveOriginX
- || rareNonInheritedData->m_perspectiveOriginY != other.rareNonInheritedData->m_perspectiveOriginY)
+#if USE(ACCELERATED_COMPOSITING)
+ if (rareNonInheritedData.get() != other->rareNonInheritedData.get()) {
+ if (rareNonInheritedData->m_transformStyle3D != other->rareNonInheritedData->m_transformStyle3D
+ || rareNonInheritedData->m_backfaceVisibility != other->rareNonInheritedData->m_backfaceVisibility
+ || rareNonInheritedData->m_perspective != other->rareNonInheritedData->m_perspective
+ || rareNonInheritedData->m_perspectiveOriginX != other->rareNonInheritedData->m_perspectiveOriginX
+ || rareNonInheritedData->m_perspectiveOriginY != other->rareNonInheritedData->m_perspectiveOriginY)
return true;
}
-
+#else
+ UNUSED_PARAM(other);
+#endif
return false;
}
-StyleDifference RenderStyle::diff(const RenderStyle& other, unsigned& changedContextSensitiveProperties) const
+StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedContextSensitiveProperties) const
{
changedContextSensitiveProperties = ContextSensitivePropertyNone;
+#if ENABLE(SVG)
StyleDifference svgChange = StyleDifferenceEqual;
- if (m_svgStyle != other.m_svgStyle) {
- svgChange = m_svgStyle->diff(other.m_svgStyle.get());
+ if (m_svgStyle != other->m_svgStyle) {
+ svgChange = m_svgStyle->diff(other->m_svgStyle.get());
if (svgChange == StyleDifferenceLayout)
return svgChange;
}
+#endif
if (changeRequiresLayout(other, changedContextSensitiveProperties))
return StyleDifferenceLayout;
+#if ENABLE(SVG)
// SVGRenderStyle::diff() might have returned StyleDifferenceRepaint, eg. if fill changes.
// If eg. the font-size changed at the same time, we're not allowed to return StyleDifferenceRepaint,
// but have to return StyleDifferenceLayout, that's why this if branch comes after all branches
// that are relevant for SVG and might return StyleDifferenceLayout.
if (svgChange != StyleDifferenceEqual)
return svgChange;
+#endif
if (changeRequiresPositionedLayoutOnly(other, changedContextSensitiveProperties))
return StyleDifferenceLayoutPositionedMovementOnly;
@@ -889,8 +840,10 @@ StyleDifference RenderStyle::diff(const RenderStyle& other, unsigned& changedCon
if (changeRequiresRepaint(other, changedContextSensitiveProperties))
return StyleDifferenceRepaint;
+#if USE(ACCELERATED_COMPOSITING)
if (changeRequiresRecompositeLayer(other, changedContextSensitiveProperties))
return StyleDifferenceRecompositeLayer;
+#endif
if (changeRequiresRepaintIfTextOrBorderOrOutline(other, changedContextSensitiveProperties))
return StyleDifferenceRepaintIfTextOrBorderOrOutline;
@@ -903,26 +856,19 @@ StyleDifference RenderStyle::diff(const RenderStyle& other, unsigned& changedCon
return StyleDifferenceEqual;
}
-bool RenderStyle::diffRequiresLayerRepaint(const RenderStyle& style, bool isComposited) const
+bool RenderStyle::diffRequiresRepaint(const RenderStyle* style) const
{
unsigned changedContextSensitiveProperties = 0;
-
- if (changeRequiresRepaint(style, changedContextSensitiveProperties))
- return true;
-
- if (isComposited && changeRequiresLayerRepaint(style, changedContextSensitiveProperties))
- return changedContextSensitiveProperties & ContextSensitivePropertyClipRect;
-
- return false;
+ return changeRequiresRepaint(style, changedContextSensitiveProperties);
}
void RenderStyle::setClip(Length top, Length right, Length bottom, Length left)
{
StyleVisualData* data = visual.access();
- data->clip.top() = top;
- data->clip.right() = right;
- data->clip.bottom() = bottom;
- data->clip.left() = left;
+ data->clip.m_top = top;
+ data->clip.m_right = right;
+ data->clip.m_bottom = bottom;
+ data->clip.m_left = left;
}
void RenderStyle::addCursor(PassRefPtr<StyleImage> image, const IntPoint& hotSpot)
@@ -945,18 +891,10 @@ void RenderStyle::setQuotes(PassRefPtr<QuotesData> q)
rareInheritedData.access()->quotes = q;
}
-void RenderStyle::setWillChange(PassRefPtr<WillChangeData> willChangeData)
-{
- if (arePointingToEqualData(rareNonInheritedData->m_willChange.get(), willChangeData.get()))
- return;
-
- rareNonInheritedData.access()->m_willChange = WTFMove(willChangeData);
-}
-
void RenderStyle::clearCursorList()
{
if (rareInheritedData->cursorData)
- rareInheritedData.access()->cursorData = nullptr;
+ rareInheritedData.access()->cursorData = 0;
}
void RenderStyle::clearContent()
@@ -973,9 +911,9 @@ void RenderStyle::appendContent(std::unique_ptr<ContentData> contentData)
lastContent = lastContent->next();
if (lastContent)
- lastContent->setNext(WTFMove(contentData));
+ lastContent->setNext(std::move(contentData));
else
- content = WTFMove(contentData);
+ content = std::move(contentData);
}
void RenderStyle::setContent(PassRefPtr<StyleImage> image, bool add)
@@ -1003,9 +941,9 @@ void RenderStyle::setContent(const String& string, bool add)
if (lastContent) {
// We attempt to merge with the last ContentData if possible.
- if (is<TextContentData>(*lastContent)) {
- TextContentData& textContent = downcast<TextContentData>(*lastContent);
- textContent.setText(textContent.text() + string);
+ if (lastContent->isText()) {
+ TextContentData* textContent = static_cast<TextContentData*>(lastContent);
+ textContent->setText(textContent->text() + string);
} else
lastContent->setNext(std::make_unique<TextContentData>(string));
@@ -1026,11 +964,11 @@ void RenderStyle::setContent(std::unique_ptr<CounterContent> counter, bool add)
return;
if (add) {
- appendContent(std::make_unique<CounterContentData>(WTFMove(counter)));
+ appendContent(std::make_unique<CounterContentData>(std::move(counter)));
return;
}
- rareNonInheritedData.access()->m_content = std::make_unique<CounterContentData>(WTFMove(counter));
+ rareNonInheritedData.access()->m_content = std::make_unique<CounterContentData>(std::move(counter));
}
void RenderStyle::setContent(QuoteType quote, bool add)
@@ -1056,8 +994,7 @@ const String& RenderStyle::contentAltText() const
return rareNonInheritedData->m_altText;
}
-// FIXME: use affectedByTransformOrigin().
-static inline bool requireTransformOrigin(const Vector<RefPtr<TransformOperation>>& transformOperations, RenderStyle::ApplyTransformOrigin applyOrigin)
+inline bool requireTransformOrigin(const Vector<RefPtr<TransformOperation>>& transformOperations, RenderStyle::ApplyTransformOrigin applyOrigin)
{
// transform-origin brackets the transform with translate operations.
// Optimize for the case where the only transform is a translation, since the transform-origin is irrelevant
@@ -1065,8 +1002,9 @@ static inline bool requireTransformOrigin(const Vector<RefPtr<TransformOperation
if (applyOrigin != RenderStyle::IncludeTransformOrigin)
return false;
- for (auto& operation : transformOperations) {
- TransformOperation::OperationType type = operation->type();
+ unsigned size = transformOperations.size();
+ for (unsigned i = 0; i < size; ++i) {
+ TransformOperation::OperationType type = transformOperations[i]->type();
if (type != TransformOperation::TRANSLATE_X
&& type != TransformOperation::TRANSLATE_Y
&& type != TransformOperation::TRANSLATE
@@ -1074,27 +1012,47 @@ static inline bool requireTransformOrigin(const Vector<RefPtr<TransformOperation
&& type != TransformOperation::TRANSLATE_3D)
return true;
}
-
+
return false;
}
-void RenderStyle::applyTransform(TransformationMatrix& transform, const FloatRect& boundingBox, ApplyTransformOrigin applyOrigin) const
+void RenderStyle::applyTransform(TransformationMatrix& transform, const LayoutSize& borderBoxSize, ApplyTransformOrigin applyOrigin) const
{
- auto& operations = rareNonInheritedData->m_transform->m_operations.operations();
- bool applyTransformOrigin = requireTransformOrigin(operations, applyOrigin);
+ // FIXME: when subpixel layout is supported (bug 71143) the body of this function could be replaced by
+ // applyTransform(transform, FloatRect(FloatPoint(), borderBoxSize), applyOrigin);
+
+ const Vector<RefPtr<TransformOperation>>& transformOperations = rareNonInheritedData->m_transform->m_operations.operations();
+ bool applyTransformOrigin = requireTransformOrigin(transformOperations, applyOrigin);
- float offsetX = transformOriginX().isPercent() ? boundingBox.x() : 0;
- float offsetY = transformOriginY().isPercent() ? boundingBox.y() : 0;
+ if (applyTransformOrigin)
+ transform.translate3d(floatValueForLength(transformOriginX(), borderBoxSize.width()), floatValueForLength(transformOriginY(), borderBoxSize.height()), transformOriginZ());
+
+ unsigned size = transformOperations.size();
+ for (unsigned i = 0; i < size; ++i)
+ transformOperations[i]->apply(transform, borderBoxSize);
+
+ if (applyTransformOrigin)
+ transform.translate3d(-floatValueForLength(transformOriginX(), borderBoxSize.width()), -floatValueForLength(transformOriginY(), borderBoxSize.height()), -transformOriginZ());
+}
+void RenderStyle::applyTransform(TransformationMatrix& transform, const FloatRect& boundingBox, ApplyTransformOrigin applyOrigin) const
+{
+ const Vector<RefPtr<TransformOperation>>& transformOperations = rareNonInheritedData->m_transform->m_operations.operations();
+ bool applyTransformOrigin = requireTransformOrigin(transformOperations, applyOrigin);
+
+ float offsetX = transformOriginX().type() == Percent ? boundingBox.x() : 0;
+ float offsetY = transformOriginY().type() == Percent ? boundingBox.y() : 0;
+
if (applyTransformOrigin) {
transform.translate3d(floatValueForLength(transformOriginX(), boundingBox.width()) + offsetX,
floatValueForLength(transformOriginY(), boundingBox.height()) + offsetY,
transformOriginZ());
}
-
- for (auto& operation : operations)
- operation->apply(transform, boundingBox.size());
-
+
+ unsigned size = transformOperations.size();
+ for (unsigned i = 0; i < size; ++i)
+ transformOperations[i]->apply(transform, boundingBox.size());
+
if (applyTransformOrigin) {
transform.translate3d(-floatValueForLength(transformOriginX(), boundingBox.width()) - offsetX,
-floatValueForLength(transformOriginY(), boundingBox.height()) - offsetY,
@@ -1113,43 +1071,75 @@ void RenderStyle::setPageScaleTransform(float scale)
setTransformOriginY(Length(0, Fixed));
}
-void RenderStyle::setTextShadow(std::unique_ptr<ShadowData> shadowData, bool add)
+void RenderStyle::setTextShadow(PassOwnPtr<ShadowData> shadowData, bool add)
{
ASSERT(!shadowData || (!shadowData->spread() && shadowData->style() == Normal));
StyleRareInheritedData* rareData = rareInheritedData.access();
if (!add) {
- rareData->textShadow = WTFMove(shadowData);
+ rareData->textShadow = shadowData;
return;
}
- shadowData->setNext(WTFMove(rareData->textShadow));
- rareData->textShadow = WTFMove(shadowData);
+ shadowData->setNext(rareData->textShadow.release());
+ rareData->textShadow = shadowData;
}
-void RenderStyle::setBoxShadow(std::unique_ptr<ShadowData> shadowData, bool add)
+void RenderStyle::setBoxShadow(PassOwnPtr<ShadowData> shadowData, bool add)
{
StyleRareNonInheritedData* rareData = rareNonInheritedData.access();
if (!add) {
- rareData->m_boxShadow = WTFMove(shadowData);
+ rareData->m_boxShadow = shadowData;
return;
}
- shadowData->setNext(WTFMove(rareData->m_boxShadow));
- rareData->m_boxShadow = WTFMove(shadowData);
+ shadowData->setNext(rareData->m_boxShadow.release());
+ rareData->m_boxShadow = shadowData;
}
-static RoundedRect::Radii calcRadiiFor(const BorderData& border, const LayoutSize& size)
+static RoundedRect::Radii calcRadiiFor(const BorderData& border, IntSize size, RenderView* renderView)
{
return RoundedRect::Radii(
- LayoutSize(valueForLength(border.topLeft().width(), size.width()),
- valueForLength(border.topLeft().height(), size.height())),
- LayoutSize(valueForLength(border.topRight().width(), size.width()),
- valueForLength(border.topRight().height(), size.height())),
- LayoutSize(valueForLength(border.bottomLeft().width(), size.width()),
- valueForLength(border.bottomLeft().height(), size.height())),
- LayoutSize(valueForLength(border.bottomRight().width(), size.width()),
- valueForLength(border.bottomRight().height(), size.height())));
+ IntSize(valueForLength(border.topLeft().width(), size.width(), renderView),
+ valueForLength(border.topLeft().height(), size.height(), renderView)),
+ IntSize(valueForLength(border.topRight().width(), size.width(), renderView),
+ valueForLength(border.topRight().height(), size.height(), renderView)),
+ IntSize(valueForLength(border.bottomLeft().width(), size.width(), renderView),
+ valueForLength(border.bottomLeft().height(), size.height(), renderView)),
+ IntSize(valueForLength(border.bottomRight().width(), size.width(), renderView),
+ valueForLength(border.bottomRight().height(), size.height(), renderView)));
+}
+
+static float calcConstraintScaleFor(const IntRect& rect, const RoundedRect::Radii& radii)
+{
+ // Constrain corner radii using CSS3 rules:
+ // http://www.w3.org/TR/css3-background/#the-border-radius
+
+ float factor = 1;
+ unsigned radiiSum;
+
+ // top
+ radiiSum = static_cast<unsigned>(radii.topLeft().width()) + static_cast<unsigned>(radii.topRight().width()); // Casts to avoid integer overflow.
+ if (radiiSum > static_cast<unsigned>(rect.width()))
+ factor = std::min(static_cast<float>(rect.width()) / radiiSum, factor);
+
+ // bottom
+ radiiSum = static_cast<unsigned>(radii.bottomLeft().width()) + static_cast<unsigned>(radii.bottomRight().width());
+ if (radiiSum > static_cast<unsigned>(rect.width()))
+ factor = std::min(static_cast<float>(rect.width()) / radiiSum, factor);
+
+ // left
+ radiiSum = static_cast<unsigned>(radii.topLeft().height()) + static_cast<unsigned>(radii.bottomLeft().height());
+ if (radiiSum > static_cast<unsigned>(rect.height()))
+ factor = std::min(static_cast<float>(rect.height()) / radiiSum, factor);
+
+ // right
+ radiiSum = static_cast<unsigned>(radii.topRight().height()) + static_cast<unsigned>(radii.bottomRight().height());
+ if (radiiSum > static_cast<unsigned>(rect.height()))
+ factor = std::min(static_cast<float>(rect.height()) / radiiSum, factor);
+
+ ASSERT(factor <= 1);
+ return factor;
}
StyleImage* RenderStyle::listStyleImage() const { return rareInheritedData->listStyleImage.get(); }
@@ -1169,12 +1159,13 @@ short RenderStyle::verticalBorderSpacing() const { return inherited->vertical_bo
void RenderStyle::setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horizontal_border_spacing, v); }
void RenderStyle::setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertical_border_spacing, v); }
-RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
+RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, RenderView* renderView, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
{
- RoundedRect roundedRect(borderRect);
+ IntRect snappedBorderRect(pixelSnappedIntRect(borderRect));
+ RoundedRect roundedRect(snappedBorderRect);
if (hasBorderRadius()) {
- RoundedRect::Radii radii = calcRadiiFor(surround->border, borderRect.size());
- radii.scale(calcBorderRadiiConstraintScaleFor(borderRect, radii));
+ RoundedRect::Radii radii = calcRadiiFor(surround->border, snappedBorderRect.size(), renderView);
+ radii.scale(calcConstraintScaleFor(snappedBorderRect, radii));
roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includeLogicalLeftEdge, includeLogicalRightEdge);
}
return roundedRect;
@@ -1184,23 +1175,23 @@ RoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderRect,
{
bool horizontal = isHorizontalWritingMode();
- LayoutUnit leftWidth = (!horizontal || includeLogicalLeftEdge) ? borderLeftWidth() : 0;
- LayoutUnit rightWidth = (!horizontal || includeLogicalRightEdge) ? borderRightWidth() : 0;
- LayoutUnit topWidth = (horizontal || includeLogicalLeftEdge) ? borderTopWidth() : 0;
- LayoutUnit bottomWidth = (horizontal || includeLogicalRightEdge) ? borderBottomWidth() : 0;
+ int leftWidth = (!horizontal || includeLogicalLeftEdge) ? borderLeftWidth() : 0;
+ int rightWidth = (!horizontal || includeLogicalRightEdge) ? borderRightWidth() : 0;
+ int topWidth = (horizontal || includeLogicalLeftEdge) ? borderTopWidth() : 0;
+ int bottomWidth = (horizontal || includeLogicalRightEdge) ? borderBottomWidth() : 0;
return getRoundedInnerBorderFor(borderRect, topWidth, bottomWidth, leftWidth, rightWidth, includeLogicalLeftEdge, includeLogicalRightEdge);
}
-RoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderRect, LayoutUnit topWidth, LayoutUnit bottomWidth,
- LayoutUnit leftWidth, LayoutUnit rightWidth, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
+RoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderRect,
+ int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
{
LayoutRect innerRect(borderRect.x() + leftWidth,
borderRect.y() + topWidth,
borderRect.width() - leftWidth - rightWidth,
borderRect.height() - topWidth - bottomWidth);
- RoundedRect roundedRect(innerRect);
+ RoundedRect roundedRect(pixelSnappedIntRect(innerRect));
if (hasBorderRadius()) {
RoundedRect::Radii radii = getRoundedBorderFor(borderRect).radii();
@@ -1232,9 +1223,9 @@ const CounterDirectiveMap* RenderStyle::counterDirectives() const
CounterDirectiveMap& RenderStyle::accessCounterDirectives()
{
- auto& map = rareNonInheritedData.access()->m_counterDirectives;
+ OwnPtr<CounterDirectiveMap>& map = rareNonInheritedData.access()->m_counterDirectives;
if (!map)
- map = std::make_unique<CounterDirectiveMap>();
+ map = adoptPtr(new CounterDirectiveMap);
return *map;
}
@@ -1254,9 +1245,9 @@ const AtomicString& RenderStyle::hyphenString() const
return hyphenationString;
// FIXME: This should depend on locale.
- static NeverDestroyed<AtomicString> hyphenMinusString(&hyphenMinus, 1);
- static NeverDestroyed<AtomicString> hyphenString(&hyphen, 1);
- return fontCascade().primaryFont().glyphForCharacter(hyphen) ? hyphenString : hyphenMinusString;
+ DEFINE_STATIC_LOCAL(AtomicString, hyphenMinusString, (&hyphenMinus, 1));
+ DEFINE_STATIC_LOCAL(AtomicString, hyphenString, (&hyphen, 1));
+ return font().primaryFontHasGlyphForCharacter(hyphen) ? hyphenString : hyphenMinusString;
}
const AtomicString& RenderStyle::textEmphasisMarkString() const
@@ -1267,28 +1258,28 @@ const AtomicString& RenderStyle::textEmphasisMarkString() const
case TextEmphasisMarkCustom:
return textEmphasisCustomMark();
case TextEmphasisMarkDot: {
- static NeverDestroyed<AtomicString> filledDotString(&bullet, 1);
- static NeverDestroyed<AtomicString> openDotString(&whiteBullet, 1);
+ DEFINE_STATIC_LOCAL(AtomicString, filledDotString, (&bullet, 1));
+ DEFINE_STATIC_LOCAL(AtomicString, openDotString, (&whiteBullet, 1));
return textEmphasisFill() == TextEmphasisFillFilled ? filledDotString : openDotString;
}
case TextEmphasisMarkCircle: {
- static NeverDestroyed<AtomicString> filledCircleString(&blackCircle, 1);
- static NeverDestroyed<AtomicString> openCircleString(&whiteCircle, 1);
+ DEFINE_STATIC_LOCAL(AtomicString, filledCircleString, (&blackCircle, 1));
+ DEFINE_STATIC_LOCAL(AtomicString, openCircleString, (&whiteCircle, 1));
return textEmphasisFill() == TextEmphasisFillFilled ? filledCircleString : openCircleString;
}
case TextEmphasisMarkDoubleCircle: {
- static NeverDestroyed<AtomicString> filledDoubleCircleString(&fisheye, 1);
- static NeverDestroyed<AtomicString> openDoubleCircleString(&bullseye, 1);
+ DEFINE_STATIC_LOCAL(AtomicString, filledDoubleCircleString, (&fisheye, 1));
+ DEFINE_STATIC_LOCAL(AtomicString, openDoubleCircleString, (&bullseye, 1));
return textEmphasisFill() == TextEmphasisFillFilled ? filledDoubleCircleString : openDoubleCircleString;
}
case TextEmphasisMarkTriangle: {
- static NeverDestroyed<AtomicString> filledTriangleString(&blackUpPointingTriangle, 1);
- static NeverDestroyed<AtomicString> openTriangleString(&whiteUpPointingTriangle, 1);
+ DEFINE_STATIC_LOCAL(AtomicString, filledTriangleString, (&blackUpPointingTriangle, 1));
+ DEFINE_STATIC_LOCAL(AtomicString, openTriangleString, (&whiteUpPointingTriangle, 1));
return textEmphasisFill() == TextEmphasisFillFilled ? filledTriangleString : openTriangleString;
}
case TextEmphasisMarkSesame: {
- static NeverDestroyed<AtomicString> filledSesameString(&sesameDot, 1);
- static NeverDestroyed<AtomicString> openSesameString(&whiteSesameDot, 1);
+ DEFINE_STATIC_LOCAL(AtomicString, filledSesameString, (&sesameDot, 1));
+ DEFINE_STATIC_LOCAL(AtomicString, openSesameString, (&whiteSesameDot, 1));
return textEmphasisFill() == TextEmphasisFillFilled ? filledSesameString : openSesameString;
}
case TextEmphasisMarkAuto:
@@ -1303,24 +1294,24 @@ const AtomicString& RenderStyle::textEmphasisMarkString() const
#if ENABLE(DASHBOARD_SUPPORT)
const Vector<StyleDashboardRegion>& RenderStyle::initialDashboardRegions()
{
- static NeverDestroyed<Vector<StyleDashboardRegion>> emptyList;
+ DEFINE_STATIC_LOCAL(Vector<StyleDashboardRegion>, emptyList, ());
return emptyList;
}
const Vector<StyleDashboardRegion>& RenderStyle::noneDashboardRegions()
{
- static NeverDestroyed<Vector<StyleDashboardRegion>> noneList;
+ DEFINE_STATIC_LOCAL(Vector<StyleDashboardRegion>, noneList, ());
static bool noneListInitialized = false;
if (!noneListInitialized) {
StyleDashboardRegion region;
region.label = "";
- region.offset.top() = Length();
- region.offset.right() = Length();
- region.offset.bottom() = Length();
- region.offset.left() = Length();
+ region.offset.m_top = Length();
+ region.offset.m_right = Length();
+ region.offset.m_bottom = Length();
+ region.offset.m_left = Length();
region.type = StyleDashboardRegion::None;
- noneList.get().append(region);
+ noneList.append(region);
noneListInitialized = true;
}
return noneList;
@@ -1385,18 +1376,18 @@ void RenderStyle::adjustTransitions()
}
}
-AnimationList& RenderStyle::ensureAnimations()
+AnimationList* RenderStyle::accessAnimations()
{
if (!rareNonInheritedData.access()->m_animations)
- rareNonInheritedData.access()->m_animations = std::make_unique<AnimationList>();
- return *rareNonInheritedData->m_animations;
+ rareNonInheritedData.access()->m_animations = adoptPtr(new AnimationList());
+ return rareNonInheritedData->m_animations.get();
}
-AnimationList& RenderStyle::ensureTransitions()
+AnimationList* RenderStyle::accessTransitions()
{
if (!rareNonInheritedData.access()->m_transitions)
- rareNonInheritedData.access()->m_transitions = std::make_unique<AnimationList>();
- return *rareNonInheritedData->m_transitions;
+ rareNonInheritedData.access()->m_transitions = adoptPtr(new AnimationList());
+ return rareNonInheritedData->m_transitions.get();
}
const Animation* RenderStyle::transitionForProperty(CSSPropertyID property) const
@@ -1412,20 +1403,20 @@ const Animation* RenderStyle::transitionForProperty(CSSPropertyID property) cons
return 0;
}
-const FontCascade& RenderStyle::fontCascade() const { return inherited->fontCascade; }
-const FontMetrics& RenderStyle::fontMetrics() const { return inherited->fontCascade.fontMetrics(); }
-const FontCascadeDescription& RenderStyle::fontDescription() const { return inherited->fontCascade.fontDescription(); }
+const Font& RenderStyle::font() const { return inherited->font; }
+const FontMetrics& RenderStyle::fontMetrics() const { return inherited->font.fontMetrics(); }
+const FontDescription& RenderStyle::fontDescription() const { return inherited->font.fontDescription(); }
float RenderStyle::specifiedFontSize() const { return fontDescription().specifiedSize(); }
float RenderStyle::computedFontSize() const { return fontDescription().computedSize(); }
-int RenderStyle::fontSize() const { return inherited->fontCascade.pixelSize(); }
+int RenderStyle::fontSize() const { return inherited->font.pixelSize(); }
const Length& RenderStyle::wordSpacing() const { return rareInheritedData->wordSpacing; }
-float RenderStyle::letterSpacing() const { return inherited->fontCascade.letterSpacing(); }
+float RenderStyle::letterSpacing() const { return inherited->font.letterSpacing(); }
-bool RenderStyle::setFontDescription(const FontCascadeDescription& v)
+bool RenderStyle::setFontDescription(const FontDescription& v)
{
- if (inherited->fontCascade.fontDescription() != v) {
- inherited.access()->fontCascade = FontCascade(v, inherited->fontCascade.letterSpacing(), inherited->fontCascade.wordSpacing());
+ if (inherited->font.fontDescription() != v) {
+ inherited.access()->font = Font(v, inherited->font.letterSpacing(), inherited->font.wordSpacing());
return true;
}
return false;
@@ -1454,7 +1445,7 @@ Length RenderStyle::lineHeight() const
}
void RenderStyle::setLineHeight(Length specifiedLineHeight) { SET_VAR(inherited, line_height, specifiedLineHeight); }
-int RenderStyle::computedLineHeight() const
+int RenderStyle::computedLineHeight(RenderView* renderView) const
{
const Length& lh = lineHeight();
@@ -1462,38 +1453,41 @@ int RenderStyle::computedLineHeight() const
if (lh.isNegative())
return fontMetrics().lineSpacing();
- if (lh.isPercentOrCalculated())
+ if (lh.isPercent())
return minimumValueForLength(lh, fontSize());
- return clampTo<int>(lh.value());
+ if (lh.isViewportPercentage())
+ return valueForLength(lh, 0, renderView);
+
+ return lh.value();
}
-void RenderStyle::setWordSpacing(Length value)
+void RenderStyle::setWordSpacing(Length v)
{
float fontWordSpacing;
- switch (value.type()) {
+ switch (v.type()) {
case Auto:
fontWordSpacing = 0;
- break;
+ FALLTHROUGH;
case Percent:
- fontWordSpacing = value.percent() * fontCascade().spaceWidth() / 100;
+ fontWordSpacing = v.getFloatValue() * font().spaceWidth() / 100;
break;
case Fixed:
- fontWordSpacing = value.value();
+ fontWordSpacing = v.getFloatValue();
break;
case Calculated:
- fontWordSpacing = value.nonNanCalculatedValue(maxValueForCssLength);
+ fontWordSpacing = v.nonNanCalculatedValue(maxValueForCssLength);
break;
default:
ASSERT_NOT_REACHED();
fontWordSpacing = 0;
break;
}
- inherited.access()->fontCascade.setWordSpacing(fontWordSpacing);
- rareInheritedData.access()->wordSpacing = WTFMove(value);
+ inherited.access()->font.setWordSpacing(fontWordSpacing);
+ rareInheritedData.access()->wordSpacing = std::move(v);
}
-void RenderStyle::setLetterSpacing(float v) { inherited.access()->fontCascade.setLetterSpacing(v); }
+void RenderStyle::setLetterSpacing(float v) { inherited.access()->font.setLetterSpacing(v); }
void RenderStyle::setFontSize(float size)
{
@@ -1506,21 +1500,21 @@ void RenderStyle::setFontSize(float size)
else
size = std::min(maximumAllowedFontSize, size);
- FontSelector* currentFontSelector = fontCascade().fontSelector();
- auto description = fontDescription();
- description.setSpecifiedSize(size);
- description.setComputedSize(size);
+ FontSelector* currentFontSelector = font().fontSelector();
+ FontDescription desc(fontDescription());
+ desc.setSpecifiedSize(size);
+ desc.setComputedSize(size);
#if ENABLE(TEXT_AUTOSIZING)
float multiplier = textAutosizingMultiplier();
if (multiplier > 1) {
float autosizedFontSize = TextAutosizer::computeAutosizedFontSize(size, multiplier);
- description.setComputedSize(min(maximumAllowedFontSize, autosizedFontSize));
+ desc.setComputedSize(min(maximumAllowedFontSize, autosizedFontSize));
}
#endif
- setFontDescription(description);
- fontCascade().update(currentFontSelector);
+ setFontDescription(desc);
+ font().update(currentFontSelector);
}
void RenderStyle::getShadowExtent(const ShadowData* shadow, LayoutUnit &top, LayoutUnit &right, LayoutUnit &bottom, LayoutUnit &left) const
@@ -1622,7 +1616,7 @@ Color RenderStyle::colorIncludingFallback(int colorProperty, bool visitedLink) c
case CSSPropertyOutlineColor:
result = visitedLink ? visitedLinkOutlineColor() : outlineColor();
break;
- case CSSPropertyColumnRuleColor:
+ case CSSPropertyWebkitColumnRuleColor:
result = visitedLink ? visitedLinkColumnRuleColor() : columnRuleColor();
break;
case CSSPropertyWebkitTextDecorationColor:
@@ -1721,7 +1715,7 @@ const BorderValue& RenderStyle::borderEnd() const
return isLeftToRightDirection() ? borderBottom() : borderTop();
}
-float RenderStyle::borderBeforeWidth() const
+unsigned short RenderStyle::borderBeforeWidth() const
{
switch (writingMode()) {
case TopToBottomWritingMode:
@@ -1737,7 +1731,7 @@ float RenderStyle::borderBeforeWidth() const
return borderTopWidth();
}
-float RenderStyle::borderAfterWidth() const
+unsigned short RenderStyle::borderAfterWidth() const
{
switch (writingMode()) {
case TopToBottomWritingMode:
@@ -1753,14 +1747,14 @@ float RenderStyle::borderAfterWidth() const
return borderBottomWidth();
}
-float RenderStyle::borderStartWidth() const
+unsigned short RenderStyle::borderStartWidth() const
{
if (isHorizontalWritingMode())
return isLeftToRightDirection() ? borderLeftWidth() : borderRightWidth();
return isLeftToRightDirection() ? borderTopWidth() : borderBottomWidth();
}
-float RenderStyle::borderEndWidth() const
+unsigned short RenderStyle::borderEndWidth() const
{
if (isHorizontalWritingMode())
return isLeftToRightDirection() ? borderRightWidth() : borderLeftWidth();
@@ -1824,23 +1818,42 @@ LayoutBoxExtent RenderStyle::imageOutsets(const NinePieceImage& image) const
NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth()));
}
-std::pair<FontOrientation, NonCJKGlyphOrientation> RenderStyle::fontAndGlyphOrientation()
+void RenderStyle::getFontAndGlyphOrientation(FontOrientation& fontOrientation, NonCJKGlyphOrientation& glyphOrientation)
{
- // FIXME: TextOrientationSideways should map to sideways-left in vertical-lr, which is not supported yet.
-
- if (isHorizontalWritingMode())
- return { Horizontal, NonCJKGlyphOrientation::Mixed };
+ if (isHorizontalWritingMode()) {
+ fontOrientation = Horizontal;
+ glyphOrientation = NonCJKGlyphOrientationVerticalRight;
+ return;
+ }
switch (textOrientation()) {
- case TextOrientation::Mixed:
- return { Vertical, NonCJKGlyphOrientation::Mixed };
- case TextOrientation::Upright:
- return { Vertical, NonCJKGlyphOrientation::Upright };
- case TextOrientation::Sideways:
- return { Horizontal, NonCJKGlyphOrientation::Mixed };
+ case TextOrientationVerticalRight:
+ fontOrientation = Vertical;
+ glyphOrientation = NonCJKGlyphOrientationVerticalRight;
+ return;
+ case TextOrientationUpright:
+ fontOrientation = Vertical;
+ glyphOrientation = NonCJKGlyphOrientationUpright;
+ return;
+ case TextOrientationSideways:
+ if (writingMode() == LeftToRightWritingMode) {
+ // FIXME: This should map to sideways-left, which is not supported yet.
+ fontOrientation = Vertical;
+ glyphOrientation = NonCJKGlyphOrientationVerticalRight;
+ return;
+ }
+ fontOrientation = Horizontal;
+ glyphOrientation = NonCJKGlyphOrientationVerticalRight;
+ return;
+ case TextOrientationSidewaysRight:
+ fontOrientation = Horizontal;
+ glyphOrientation = NonCJKGlyphOrientationVerticalRight;
+ return;
default:
ASSERT_NOT_REACHED();
- return { Horizontal, NonCJKGlyphOrientation::Mixed };
+ fontOrientation = Horizontal;
+ glyphOrientation = NonCJKGlyphOrientationVerticalRight;
+ return;
}
}
@@ -1876,9 +1889,7 @@ void RenderStyle::setColumnStylesFromPaginationMode(const Pagination::Mode& pagi
{
if (paginationMode == Pagination::Unpaginated)
return;
-
- setColumnFill(ColumnFillAuto);
-
+
switch (paginationMode) {
case Pagination::LeftToRightPaginated:
setColumnAxis(HorizontalColumnAxis);
@@ -1914,149 +1925,4 @@ void RenderStyle::setColumnStylesFromPaginationMode(const Pagination::Mode& pagi
}
}
-#if ENABLE(CSS_SCROLL_SNAP)
-LengthSize RenderStyle::initialScrollSnapDestination()
-{
- return defaultScrollSnapDestination();
-}
-
-Vector<LengthSize> RenderStyle::initialScrollSnapCoordinates()
-{
- return Vector<LengthSize>();
-}
-
-const ScrollSnapPoints* RenderStyle::scrollSnapPointsX() const
-{
- return rareNonInheritedData->m_scrollSnapPoints->xPoints.get();
-}
-
-const ScrollSnapPoints* RenderStyle::scrollSnapPointsY() const
-{
- return rareNonInheritedData->m_scrollSnapPoints->yPoints.get();
-}
-
-const LengthSize& RenderStyle::scrollSnapDestination() const
-{
- return rareNonInheritedData->m_scrollSnapPoints->destination;
-}
-
-const Vector<LengthSize>& RenderStyle::scrollSnapCoordinates() const
-{
- return rareNonInheritedData->m_scrollSnapPoints->coordinates;
-}
-
-void RenderStyle::setScrollSnapPointsX(std::unique_ptr<ScrollSnapPoints> points)
-{
- if (rareNonInheritedData->m_scrollSnapPoints->xPoints.get() == points.get())
- return;
- rareNonInheritedData.access()->m_scrollSnapPoints.access()->xPoints = WTFMove(points);
-}
-
-void RenderStyle::setScrollSnapPointsY(std::unique_ptr<ScrollSnapPoints> points)
-{
- if (rareNonInheritedData->m_scrollSnapPoints->yPoints.get() == points.get())
- return;
- rareNonInheritedData.access()->m_scrollSnapPoints.access()->yPoints = WTFMove(points);
-}
-
-void RenderStyle::setScrollSnapDestination(LengthSize destination)
-{
- if (rareNonInheritedData->m_scrollSnapPoints->destination == destination)
- return;
- rareNonInheritedData.access()->m_scrollSnapPoints.access()->destination = WTFMove(destination);
-}
-
-void RenderStyle::setScrollSnapCoordinates(Vector<LengthSize> coordinates)
-{
- if (rareNonInheritedData->m_scrollSnapPoints->coordinates == coordinates)
- return;
- rareNonInheritedData.access()->m_scrollSnapPoints.access()->coordinates = WTFMove(coordinates);
-}
-
-#endif
-
-bool RenderStyle::hasReferenceFilterOnly() const
-{
- if (!hasFilter())
- return false;
-
- const FilterOperations& filterOperations = rareNonInheritedData->m_filter->m_operations;
- if (filterOperations.size() != 1)
- return false;
-
- const FilterOperation& filterOperation = *filterOperations.at(0);
- if (filterOperation.type() != FilterOperation::REFERENCE)
- return false;
-
- return true;
-}
-
-void RenderStyle::checkVariablesInCustomProperties()
-{
- if (!rareInheritedData->m_customProperties->containsVariables())
- return;
-
- // Our first pass checks the variables for validity and replaces any properties that became
- // invalid with empty values.
- auto& customProperties = rareInheritedData.access()->m_customProperties.access()->values();
- HashSet<AtomicString> invalidProperties;
- for (auto entry : customProperties) {
- if (!entry.value->isVariableDependentValue())
- continue;
- HashSet<AtomicString> seenProperties;
- downcast<CSSVariableDependentValue>(*entry.value).checkVariablesForCycles(entry.key, customProperties, seenProperties, invalidProperties);
- }
-
- // Now insert invalid values.
- if (!invalidProperties.isEmpty()) {
- RefPtr<CSSValue> invalidValue = CSSCustomPropertyValue::createInvalid();
- for (auto& property : invalidProperties)
- customProperties.set(property, invalidValue);
- }
-
- // Now that all of the properties have been tested for validity and replaced with
- // invalid values if they failed, we can perform variable substitution on the valid values.
- Vector<RefPtr<CSSCustomPropertyValue>> resolvedValues;
- for (auto entry : customProperties) {
- if (!entry.value->isVariableDependentValue())
- continue;
-
- CSSParserValueList parserList;
- RefPtr<CSSCustomPropertyValue> result;
- if (!downcast<CSSVariableDependentValue>(*entry.value).valueList()->buildParserValueListSubstitutingVariables(&parserList, customProperties)) {
- RefPtr<CSSValue> invalidResult = CSSCustomPropertyValue::createInvalid();
- result = CSSCustomPropertyValue::create(entry.key, invalidResult);
- } else {
- RefPtr<CSSValue> newValueList = CSSValueList::createFromParserValueList(parserList);
- result = CSSCustomPropertyValue::create(entry.key, newValueList);
- }
- resolvedValues.append(result);
- }
-
- // With all results computed, we can now mutate our table to eliminate the variables and
- // hold the final values. This way when we inherit, we don't end up resubstituting variables, etc.
- for (auto& resolvedValue : resolvedValues)
- customProperties.set(resolvedValue->name(), resolvedValue->value());
-
- rareInheritedData.access()->m_customProperties.access()->setContainsVariables(false);
-}
-
-float RenderStyle::outlineWidth() const
-{
- if (m_background->outline().style() == BNONE)
- return 0;
- if (outlineStyleIsAuto())
- return std::max(m_background->outline().width(), RenderTheme::platformFocusRingWidth());
- return m_background->outline().width();
-}
-
-float RenderStyle::outlineOffset() const
-{
- if (m_background->outline().style() == BNONE)
- return 0;
- if (outlineStyleIsAuto())
- return (m_background->outline().offset() + RenderTheme::platformFocusRingOffset(outlineWidth()));
- return m_background->outline().offset();
-}
-
} // namespace WebCore
diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h
index 559df8182..73a5350ce 100644
--- a/Source/WebCore/rendering/style/RenderStyle.h
+++ b/Source/WebCore/rendering/style/RenderStyle.h
@@ -2,7 +2,7 @@
* Copyright (C) 2000 Lars Knoll (knoll@kde.org)
* (C) 2000 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003-2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
*
* This library is free software; you can redistribute it and/or
@@ -37,6 +37,7 @@
#include "FontBaseline.h"
#include "FontDescription.h"
#include "GraphicsTypes.h"
+#include "LayoutBoxExtent.h"
#include "Length.h"
#include "LengthBox.h"
#include "LengthFunctions.h"
@@ -47,15 +48,14 @@
#include "Pagination.h"
#include "RenderStyleConstants.h"
#include "RoundedRect.h"
-#include "SVGPaint.h"
-#include "SVGRenderStyle.h"
#include "ShadowData.h"
#include "ShapeValue.h"
#include "StyleBackgroundData.h"
#include "StyleBoxData.h"
#include "StyleDeprecatedFlexibleBoxData.h"
-#include "StyleFilterData.h"
#include "StyleFlexibleBoxData.h"
+#include "StyleGridData.h"
+#include "StyleGridItemData.h"
#include "StyleMarqueeData.h"
#include "StyleMultiColData.h"
#include "StyleRareInheritedData.h"
@@ -64,20 +64,18 @@
#include "StyleSurroundData.h"
#include "StyleTransformData.h"
#include "StyleVisualData.h"
-#include "TextFlags.h"
+#include "TextDirection.h"
#include "ThemeTypes.h"
#include "TransformOperations.h"
#include "UnicodeBidi.h"
-#include <memory>
#include <wtf/Forward.h>
-#include <wtf/NeverDestroyed.h>
+#include <wtf/OwnPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/StdLibExtras.h>
#include <wtf/Vector.h>
-#if ENABLE(CSS_GRID_LAYOUT)
-#include "StyleGridData.h"
-#include "StyleGridItemData.h"
+#if ENABLE(CSS_FILTERS)
+#include "StyleFilterData.h"
#endif
#if ENABLE(DASHBOARD_SUPPORT)
@@ -88,28 +86,31 @@
#include "TextSizeAdjustment.h"
#endif
-template<typename T, typename U> inline bool compareEqual(const T& t, const U& u) { return t == static_cast<const T&>(u); }
+#if ENABLE(SVG)
+#include "SVGPaint.h"
+#include "SVGRenderStyle.h"
+#endif
+
+template<typename T, typename U> inline bool compareEqual(const T& t, const U& u) { return t == static_cast<T>(u); }
#define SET_VAR(group, variable, value) \
if (!compareEqual(group->variable, value)) \
group.access()->variable = value
-#define SET_NESTED_VAR(group, parentVariable, variable, value) \
- if (!compareEqual(group->parentVariable->variable, value)) \
- group.access()->parentVariable.access()->variable = value
-
#define SET_BORDERVALUE_COLOR(group, variable, value) \
if (!compareEqual(group->variable.color(), value)) \
group.access()->variable.setColor(value)
namespace WebCore {
+#if ENABLE(CSS_FILTERS)
+class FilterOperations;
+#endif
+
class BorderData;
-class ContentData;
class CounterContent;
class CursorList;
-class FilterOperations;
-class FontCascade;
+class Font;
class FontMetrics;
class IntRect;
class Pair;
@@ -119,273 +120,20 @@ class StyleInheritedData;
class StyleResolver;
class TransformationMatrix;
-struct ScrollSnapPoints;
+class ContentData;
typedef Vector<RefPtr<RenderStyle>, 4> PseudoStyleCache;
class RenderStyle: public RefCounted<RenderStyle> {
friend class CSSPropertyAnimationWrapperMap; // Used by CSS animations. We can't allow them to animate based off visited colors.
friend class ApplyStyleCommand; // Editing has to only reveal unvisited info.
+ friend class DeprecatedStyleBuilder; // Sets members directly.
friend class EditingStyle; // Editing has to only reveal unvisited info.
friend class ComputedStyleExtractor; // Ignores visited styles, so needs to be able to see unvisited info.
friend class PropertyWrapperMaybeInvalidColor; // Used by CSS animations. We can't allow them to animate based off visited colors.
friend class RenderSVGResource; // FIXME: Needs to alter the visited state by hand. Should clean the SVG code up and move it into RenderStyle perhaps.
friend class RenderTreeAsText; // FIXME: Only needed so the render tree can keep lying and dump the wrong colors. Rebaselining would allow this to be yanked.
- friend class StyleBuilderConverter; // Sets members directly.
- friend class StyleBuilderCustom; // Sets members directly.
- friend class StyleBuilderFunctions; // Sets members directly.
friend class StyleResolver; // Sets members directly.
-
-public:
- struct NonInheritedFlags {
- NonInheritedFlags()
- {
- // The default values should all be zero.
- ASSERT(!initialOverflowX());
- ASSERT(!initialOverflowY());
- ASSERT(!initialClear());
- ASSERT(!initialDisplay());
- ASSERT(!initialUnicodeBidi());
- ASSERT(!initialPosition());
- ASSERT(!initialVerticalAlign());
- ASSERT(!initialFloating());
- ASSERT(!initialTableLayout());
-
- m_flags = 0;
- }
-
- bool operator==(const NonInheritedFlags& other) const
- {
- return m_flags == other.m_flags;
- }
-
- bool operator!=(const NonInheritedFlags& other) const { return !(*this == other); }
-
- void copyNonInheritedFrom(const NonInheritedFlags& other)
- {
- // Only a subset is copied because NonInheritedFlags contains a bunch of stuff other than real style data.
- uint64_t nonInheritedMask = overflowMask << overflowXOffset
- | overflowMask << overflowYOffset
- | clearMask << clearOffset
- | displayMask << effectiveDisplayOffset
- | positionMask << positionOffset
- | displayMask << originalDisplayOffset
- | unicodeBidiMask << unicodeBidiOffset
- | verticalAlignMask << verticalAlignOffset
- | floatingMask << floatingOffset
- | oneBitMask << explicitInheritanceOffset
- | tableLayoutBitMask << tableLayoutOffset
- | hasViewportUnitsBitMask << hasViewportUnitsOffset;
-
- m_flags = (m_flags & ~nonInheritedMask) | (other.m_flags & nonInheritedMask);
- }
-
- EOverflow overflowX() const { return static_cast<EOverflow>(getValue(overflowMask, overflowXOffset)); }
- void setOverflowX(EOverflow overflowX) { updateValue(overflowX, overflowMask, overflowXOffset); }
-
- EOverflow overflowY() const { return static_cast<EOverflow>(getValue(overflowMask, overflowYOffset)); }
- void setOverflowY(EOverflow overflowY) { updateValue(overflowY, overflowMask, overflowYOffset); }
-
- EClear clear() const { return static_cast<EClear>(getValue(clearMask, clearOffset)); }
- void setClear(EClear clear) { updateValue(clear, clearMask, clearOffset); }
-
- EDisplay effectiveDisplay() const { return static_cast<EDisplay>(getValue(displayMask, effectiveDisplayOffset)); }
- void setEffectiveDisplay(EDisplay effectiveDisplay) { updateValue(effectiveDisplay, displayMask, effectiveDisplayOffset); }
-
- EPosition position() const { return static_cast<EPosition>(getValue(positionMask, positionOffset)); }
- void setPosition(EPosition position) { updateValue(position, positionMask, positionOffset); }
-
- EDisplay originalDisplay() const { return static_cast<EDisplay>(getValue(displayMask, originalDisplayOffset)); }
- void setOriginalDisplay(EDisplay originalDisplay) { updateValue(originalDisplay, displayMask, originalDisplayOffset); }
-
- EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(getValue(unicodeBidiMask, unicodeBidiOffset)); }
- void setUnicodeBidi(EUnicodeBidi unicodeBidi) { updateValue(unicodeBidi, unicodeBidiMask, unicodeBidiOffset); }
-
- bool hasViewportUnits() const { return getBoolean(hasViewportUnitsOffset); }
- void setHasViewportUnits(bool value) { updateBoolean(value, hasViewportUnitsOffset); }
-
- EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(getValue(verticalAlignMask, verticalAlignOffset)); }
- void setVerticalAlign(EVerticalAlign verticalAlign) { updateValue(verticalAlign, verticalAlignMask, verticalAlignOffset); }
-
- bool hasExplicitlyInheritedProperties() const { return getBoolean(explicitInheritanceOffset); }
- void setHasExplicitlyInheritedProperties(bool value) { updateBoolean(value, explicitInheritanceOffset); }
-
- bool isFloating() const { return floating() != NoFloat; }
- EFloat floating() const { return static_cast<EFloat>(getValue(floatingMask, floatingOffset)); }
- void setFloating(EFloat floating) { updateValue(floating, floatingMask, floatingOffset); }
-
- bool hasAnyPublicPseudoStyles() const { return PUBLIC_PSEUDOID_MASK & getValue(pseudoBitsMask, pseudoBitsOffset); }
- bool hasPseudoStyle(PseudoId pseudo) const
- {
- ASSERT(pseudo > NOPSEUDO);
- ASSERT(pseudo < FIRST_INTERNAL_PSEUDOID);
- return (oneBitMask << (pseudoBitsOffset - 1 + pseudo)) & m_flags;
- }
- void setHasPseudoStyle(PseudoId pseudo)
- {
- ASSERT(pseudo > NOPSEUDO);
- ASSERT(pseudo < FIRST_INTERNAL_PSEUDOID);
- m_flags |= oneBitMask << (pseudoBitsOffset - 1 + pseudo);
- }
- void setHasPseudoStyles(PseudoIdSet pseudoIdSet)
- {
- ASSERT(pseudoIdSet);
- uint64_t rawPseudoIdSet = pseudoIdSet.data();
- ASSERT((rawPseudoIdSet & PUBLIC_PSEUDOID_MASK) == rawPseudoIdSet);
- static_assert(pseudoBitsOffset >= 1, "(pseudoBitsOffset - 1) should be valid.");
- m_flags |= (static_cast<uint64_t>(rawPseudoIdSet) << (pseudoBitsOffset - 1));
- }
-
- ETableLayout tableLayout() const { return static_cast<ETableLayout>(getValue(tableLayoutBitMask, tableLayoutOffset)); }
- void setTableLayout(ETableLayout tableLayout) { updateValue(tableLayout, tableLayoutBitMask, tableLayoutOffset); }
-
- PseudoId styleType() const { return static_cast<PseudoId>(getValue(styleTypeMask, styleTypeOffset)); }
- void setStyleType(PseudoId styleType) { updateValue(styleType, styleTypeMask, styleTypeOffset); }
-
- bool isUnique() const { return getBoolean(isUniqueOffset); }
- void setIsUnique() { updateBoolean(true, isUniqueOffset); }
-
- bool emptyState() const { return getBoolean(emptyStateOffset); }
- void setEmptyState(bool value) { updateBoolean(value, emptyStateOffset); }
-
- bool firstChildState() const { return getBoolean(firstChildStateOffset); }
- void setFirstChildState(bool value) { updateBoolean(value, firstChildStateOffset); }
-
- bool lastChildState() const { return getBoolean(lastChildStateOffset); }
- void setLastChildState(bool value) { updateBoolean(value, lastChildStateOffset); }
-
- bool affectedByHover() const { return getBoolean(affectedByHoverOffset); }
- void setAffectedByHover(bool value) { updateBoolean(value, affectedByHoverOffset); }
-
- bool affectedByActive() const { return getBoolean(affectedByActiveOffset); }
- void setAffectedByActive(bool value) { updateBoolean(value, affectedByActiveOffset); }
-
- bool affectedByDrag() const { return getBoolean(affectedByDragOffset); }
- void setAffectedByDrag(bool value) { updateBoolean(value, affectedByDragOffset); }
-
- bool isLink() const { return getBoolean(isLinkOffset); }
- void setIsLink(bool value) { updateBoolean(value, isLinkOffset); }
-
- bool hasExplicitlySetDirection() const { return getBoolean(hasExplicitlySetDirectionOffset); }
- void setHasExplicitlySetDirection(bool value) { updateBoolean(value, hasExplicitlySetDirectionOffset); }
-
- bool hasExplicitlySetWritingMode() const { return getBoolean(hasExplicitlySetWritingModeOffset); }
- void setHasExplicitlySetWritingMode(bool value) { updateBoolean(value, hasExplicitlySetWritingModeOffset); }
-
- static ptrdiff_t flagsMemoryOffset() { return OBJECT_OFFSETOF(NonInheritedFlags, m_flags); }
- static uint64_t flagIsaffectedByActive() { return oneBitMask << affectedByActiveOffset; }
- static uint64_t flagIsaffectedByHover() { return oneBitMask << affectedByHoverOffset; }
- static uint64_t flagPseudoStyle(PseudoId pseudo) { return oneBitMask << (pseudoBitsOffset - 1 + pseudo); }
- static uint64_t setFirstChildStateFlags() { return flagFirstChildState() | flagIsUnique(); }
- static uint64_t setLastChildStateFlags() { return flagLastChildState() | flagIsUnique(); }
- private:
- void updateBoolean(bool isSet, uint64_t offset)
- {
- if (isSet)
- m_flags |= (oneBitMask << offset);
- else
- m_flags &= ~(oneBitMask << offset);
- }
-
- bool getBoolean(uint64_t offset) const
- {
- return m_flags & (oneBitMask << offset);
- }
-
- void updateValue(uint8_t newValue, uint64_t positionIndependentMask, uint64_t offset)
- {
- ASSERT(!(newValue & ~positionIndependentMask));
- uint64_t positionDependentMask = positionIndependentMask << offset;
- m_flags = (m_flags & ~positionDependentMask) | (static_cast<uint64_t>(newValue) << offset);
- }
-
- unsigned getValue(uint64_t positionIndependentMask, uint64_t offset) const
- {
- return static_cast<unsigned>((m_flags >> offset) & positionIndependentMask);
- }
-
- static uint64_t flagIsUnique() { return oneBitMask << isUniqueOffset; }
- static uint64_t flagFirstChildState() { return oneBitMask << firstChildStateOffset; }
- static uint64_t flagLastChildState() { return oneBitMask << lastChildStateOffset; }
-
- // To type the bit mask properly on 64bits.
- static const uint64_t oneBitMask = 0x1;
-
- // Byte 1.
- static const unsigned overflowBitCount = 3;
- static const uint64_t overflowMask = (oneBitMask << overflowBitCount) - 1;
- static const unsigned overflowXOffset = 0;
- static const unsigned overflowYOffset = overflowXOffset + overflowBitCount;
- static const unsigned clearBitCount = 2;
- static const uint64_t clearMask = (oneBitMask << clearBitCount) - 1;
- static const unsigned clearOffset = overflowYOffset + overflowBitCount;
-
- // Byte 2.
- static const unsigned displayBitCount = 5;
- static const uint64_t displayMask = (oneBitMask << displayBitCount) - 1;
- static const unsigned effectiveDisplayOffset = clearOffset + clearBitCount;
- static const unsigned positionBitCount = 3;
- static const uint64_t positionMask = (oneBitMask << positionBitCount) - 1;
- static const unsigned positionOffset = effectiveDisplayOffset + displayBitCount;
-
- // Byte 3.
- static const unsigned originalDisplayOffset = positionOffset + positionBitCount;
- static const unsigned unicodeBidiBitCount = 3;
- static const uint64_t unicodeBidiMask = (oneBitMask << unicodeBidiBitCount) - 1;
- static const unsigned unicodeBidiOffset = originalDisplayOffset + displayBitCount;
-
- // Byte 4.
- static const unsigned floatingBitCount = 2;
- static const uint64_t floatingMask = (oneBitMask << floatingBitCount) - 1;
- static const unsigned floatingOffset = unicodeBidiOffset + unicodeBidiBitCount;
- static const unsigned hasExplicitlySetDirectionBitcount = 1;
- static const unsigned hasExplicitlySetDirectionOffset = floatingOffset + floatingBitCount;
- static const unsigned hasExplicitlySetWritingModeBitcount = 1;
- static const unsigned hasExplicitlySetWritingModeOffset = hasExplicitlySetDirectionOffset + hasExplicitlySetDirectionBitcount;
-
- // Byte 5.
- static const unsigned explicitInheritanceBitCount = 1;
- static const unsigned explicitInheritanceOffset = hasExplicitlySetWritingModeOffset + hasExplicitlySetWritingModeBitcount;
- static const unsigned tableLayoutBitCount = 1;
- static const uint64_t tableLayoutBitMask = oneBitMask;
- static const unsigned tableLayoutOffset = explicitInheritanceOffset + explicitInheritanceBitCount;
- static const unsigned verticalAlignBitCount = 4;
- static const unsigned verticalAlignPadding = 2;
- static const unsigned verticalAlignAndPaddingBitCount = verticalAlignBitCount + verticalAlignPadding;
- static const uint64_t verticalAlignMask = (oneBitMask << verticalAlignBitCount) - 1;
- static const unsigned verticalAlignOffset = tableLayoutOffset + tableLayoutBitCount;
-
- // Byte 6.
- static const unsigned pseudoBitsBitCount = 7;
- static const uint64_t pseudoBitsMask = (oneBitMask << pseudoBitsBitCount) - 1;
- static const unsigned pseudoBitsOffset = verticalAlignOffset + verticalAlignBitCount;
-
- static const unsigned hasViewportUnitsBitCount = 1;
- static const uint64_t hasViewportUnitsBitMask = (oneBitMask << hasViewportUnitsBitCount) - 1;
- static const unsigned hasViewportUnitsOffset = pseudoBitsOffset + pseudoBitsBitCount;
-
- // Byte 7.
- static const unsigned styleTypeBitCount = 6;
- static const unsigned styleTypePadding = 2;
- static const unsigned styleTypeAndPaddingBitCount = styleTypeBitCount + styleTypePadding;
- static const uint64_t styleTypeMask = (oneBitMask << styleTypeAndPaddingBitCount) - 1;
- static const unsigned styleTypeOffset = hasViewportUnitsBitCount + hasViewportUnitsOffset;
-
- // Byte 8.
- static const unsigned isUniqueOffset = styleTypeOffset + styleTypeAndPaddingBitCount;
- static const unsigned emptyStateOffset = isUniqueOffset + 1;
- static const unsigned firstChildStateOffset = emptyStateOffset + 1;
- static const unsigned lastChildStateOffset = firstChildStateOffset + 1;
- static const unsigned affectedByHoverOffset = lastChildStateOffset + 1;
- static const unsigned affectedByActiveOffset = affectedByHoverOffset + 1;
- static const unsigned affectedByDragOffset = affectedByActiveOffset + 1;
- static const unsigned isLinkOffset = affectedByDragOffset + 1;
-
- // 60 bits are assigned. There are 4 bits available currently used as padding to improve code generation.
- // If you add more style bits here, you will also need to update RenderStyle::copyNonInheritedFrom().
- uint64_t m_flags;
- };
-
protected:
// non-inherited attributes
@@ -400,9 +148,11 @@ protected:
DataRef<StyleInheritedData> inherited;
// list of associated pseudo styles
- std::unique_ptr<PseudoStyleCache> m_cachedPseudoStyles;
+ OwnPtr<PseudoStyleCache> m_cachedPseudoStyles;
+#if ENABLE(SVG)
DataRef<SVGRenderStyle> m_svgStyle;
+#endif
// !START SYNC!: Keep this in sync with the copy constructor in RenderStyle.cpp and implicitlyInherited() in StyleResolver.cpp
@@ -430,7 +180,6 @@ protected:
&& (m_printColorAdjust == other.m_printColorAdjust)
&& (_pointerEvents == other._pointerEvents)
&& (_insideLink == other._insideLink)
- && (_insideDefaultButton == other._insideDefaultButton)
&& (m_writingMode == other.m_writingMode);
}
@@ -459,40 +208,152 @@ protected:
unsigned m_printColorAdjust : PrintColorAdjustBits;
unsigned _pointerEvents : 4; // EPointerEvents
unsigned _insideLink : 2; // EInsideLink
- unsigned _insideDefaultButton : 1;
- // 44 bits
+ // 43 bits
// CSS Text Layout Module Level 3: Vertical writing support
unsigned m_writingMode : 2; // WritingMode
- // 46 bits
+ // 45 bits
} inherited_flags;
// don't inherit
- NonInheritedFlags noninherited_flags;
+ struct NonInheritedFlags {
+ bool operator==(const NonInheritedFlags& other) const
+ {
+ return _effectiveDisplay == other._effectiveDisplay
+ && _originalDisplay == other._originalDisplay
+ && _overflowX == other._overflowX
+ && _overflowY == other._overflowY
+ && _vertical_align == other._vertical_align
+ && _clear == other._clear
+ && _position == other._position
+ && _floating == other._floating
+ && _table_layout == other._table_layout
+ && _page_break_before == other._page_break_before
+ && _page_break_after == other._page_break_after
+ && _page_break_inside == other._page_break_inside
+ && _styleType == other._styleType
+ && _affectedByHover == other._affectedByHover
+ && _affectedByActive == other._affectedByActive
+ && _affectedByDrag == other._affectedByDrag
+ && _pseudoBits == other._pseudoBits
+ && _unicodeBidi == other._unicodeBidi
+ && explicitInheritance == other.explicitInheritance
+ && unique == other.unique
+ && emptyState == other.emptyState
+ && firstChildState == other.firstChildState
+ && lastChildState == other.lastChildState
+ && _isLink == other._isLink;
+ }
+
+ bool operator!=(const NonInheritedFlags& other) const { return !(*this == other); }
+
+ unsigned _effectiveDisplay : 5; // EDisplay
+ unsigned _originalDisplay : 5; // EDisplay
+ unsigned _overflowX : 3; // EOverflow
+ unsigned _overflowY : 3; // EOverflow
+ unsigned _vertical_align : 4; // EVerticalAlign
+ unsigned _clear : 2; // EClear
+ unsigned _position : 3; // EPosition
+ unsigned _floating : 2; // EFloat
+ unsigned _table_layout : 1; // ETableLayout
+
+ unsigned _unicodeBidi : 3; // EUnicodeBidi
+ // 31 bits
+ unsigned _page_break_before : 2; // EPageBreak
+ unsigned _page_break_after : 2; // EPageBreak
+ unsigned _page_break_inside : 2; // EPageBreak
+
+ unsigned _styleType : 6; // PseudoId
+ unsigned _pseudoBits : 7;
+ unsigned explicitInheritance : 1; // Explicitly inherits a non-inherited property
+ unsigned unique : 1; // Style can not be shared.
+ unsigned emptyState : 1;
+ unsigned firstChildState : 1;
+ unsigned lastChildState : 1;
+
+ bool affectedByHover() const { return _affectedByHover; }
+ void setAffectedByHover(bool value) { _affectedByHover = value; }
+ bool affectedByActive() const { return _affectedByActive; }
+ void setAffectedByActive(bool value) { _affectedByActive = value; }
+ bool affectedByDrag() const { return _affectedByDrag; }
+ void setAffectedByDrag(bool value) { _affectedByDrag = value; }
+ bool isLink() const { return _isLink; }
+ void setIsLink(bool value) { _isLink = value; }
+ private:
+ unsigned _affectedByHover : 1;
+ unsigned _affectedByActive : 1;
+ unsigned _affectedByDrag : 1;
+ unsigned _isLink : 1;
+ // If you add more style bits here, you will also need to update RenderStyle::copyNonInheritedFrom()
+ // 59 bits
+ } noninherited_flags;
// !END SYNC!
+
+protected:
+ void setBitDefaults()
+ {
+ inherited_flags._empty_cells = initialEmptyCells();
+ inherited_flags._caption_side = initialCaptionSide();
+ inherited_flags._list_style_type = initialListStyleType();
+ inherited_flags._list_style_position = initialListStylePosition();
+ inherited_flags._visibility = initialVisibility();
+ inherited_flags._text_align = initialTextAlign();
+ inherited_flags._text_transform = initialTextTransform();
+ inherited_flags._text_decorations = initialTextDecoration();
+ inherited_flags._cursor_style = initialCursor();
+#if ENABLE(CURSOR_VISIBILITY)
+ inherited_flags.m_cursorVisibility = initialCursorVisibility();
+#endif
+ inherited_flags._direction = initialDirection();
+ inherited_flags._white_space = initialWhiteSpace();
+ inherited_flags._border_collapse = initialBorderCollapse();
+ inherited_flags.m_rtlOrdering = initialRTLOrdering();
+ inherited_flags._box_direction = initialBoxDirection();
+ inherited_flags.m_printColorAdjust = initialPrintColorAdjust();
+ inherited_flags._pointerEvents = initialPointerEvents();
+ inherited_flags._insideLink = NotInsideLink;
+ inherited_flags.m_writingMode = initialWritingMode();
+
+ noninherited_flags._effectiveDisplay = noninherited_flags._originalDisplay = initialDisplay();
+ noninherited_flags._overflowX = initialOverflowX();
+ noninherited_flags._overflowY = initialOverflowY();
+ noninherited_flags._vertical_align = initialVerticalAlign();
+ noninherited_flags._clear = initialClear();
+ noninherited_flags._position = initialPosition();
+ noninherited_flags._floating = initialFloating();
+ noninherited_flags._table_layout = initialTableLayout();
+ noninherited_flags._unicodeBidi = initialUnicodeBidi();
+ noninherited_flags._page_break_before = initialPageBreak();
+ noninherited_flags._page_break_after = initialPageBreak();
+ noninherited_flags._page_break_inside = initialPageBreak();
+ noninherited_flags._styleType = NOPSEUDO;
+ noninherited_flags._pseudoBits = 0;
+ noninherited_flags.explicitInheritance = false;
+ noninherited_flags.unique = false;
+ noninherited_flags.emptyState = false;
+ noninherited_flags.firstChildState = false;
+ noninherited_flags.lastChildState = false;
+ noninherited_flags.setAffectedByHover(false);
+ noninherited_flags.setAffectedByActive(false);
+ noninherited_flags.setAffectedByDrag(false);
+ noninherited_flags.setIsLink(false);
+ }
+
private:
+ ALWAYS_INLINE RenderStyle();
// used to create the default style.
ALWAYS_INLINE RenderStyle(bool);
ALWAYS_INLINE RenderStyle(const RenderStyle&);
public:
- static Ref<RenderStyle> create();
- static Ref<RenderStyle> createDefaultStyle();
- static Ref<RenderStyle> createAnonymousStyleWithDisplay(const RenderStyle* parentStyle, EDisplay);
- static Ref<RenderStyle> clone(const RenderStyle*);
+ static PassRef<RenderStyle> create();
+ static PassRef<RenderStyle> createDefaultStyle();
+ static PassRef<RenderStyle> createAnonymousStyleWithDisplay(const RenderStyle* parentStyle, EDisplay);
+ static PassRef<RenderStyle> clone(const RenderStyle*);
// Create a RenderStyle for generated content by inheriting from a pseudo style.
- static Ref<RenderStyle> createStyleInheritingFromPseudoStyle(const RenderStyle& pseudoStyle);
-
- ContentPosition resolvedAlignContentPosition() const;
- ContentDistributionType resolvedAlignContentDistribution() const;
- ContentPosition resolvedJustifyContentPosition() const;
- ContentDistributionType resolvedJustifyContentDistribution() const;
- static ItemPosition resolveAlignment(const RenderStyle& parentStyle, const RenderStyle& childStyle, ItemPosition resolvedAutoPositionForRenderer);
- static OverflowAlignment resolveAlignmentOverflow(const RenderStyle& parentStyle, const RenderStyle& childStyle);
- static ItemPosition resolveJustification(const RenderStyle& parentStyle, const RenderStyle& childStyle, ItemPosition resolvedAutoPositionForRenderer);
- static OverflowAlignment resolveJustificationOverflow(const RenderStyle& parentStyle, const RenderStyle& childStyle);
+ static PassRef<RenderStyle> createStyleInheritingFromPseudoStyle(const RenderStyle& pseudoStyle);
enum IsAtShadowBoundary {
AtShadowBoundary,
@@ -502,8 +363,8 @@ public:
void inheritFrom(const RenderStyle* inheritParent, IsAtShadowBoundary = NotAtShadowBoundary);
void copyNonInheritedFrom(const RenderStyle*);
- PseudoId styleType() const { return noninherited_flags.styleType(); }
- void setStyleType(PseudoId styleType) { noninherited_flags.setStyleType(styleType); }
+ PseudoId styleType() const { return static_cast<PseudoId>(noninherited_flags._styleType); }
+ void setStyleType(PseudoId styleType) { noninherited_flags._styleType = styleType; }
RenderStyle* getCachedPseudoStyle(PseudoId) const;
RenderStyle* addCachedPseudoStyle(PassRefPtr<RenderStyle>);
@@ -511,14 +372,6 @@ public:
const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoStyles.get(); }
- void setCustomPropertyValue(const AtomicString& name, const RefPtr<CSSValue>& value) { rareInheritedData.access()->m_customProperties.access()->setCustomPropertyValue(name, value); }
- RefPtr<CSSValue> getCustomPropertyValue(const AtomicString& name) const { return rareInheritedData->m_customProperties->getCustomPropertyValue(name); }
- bool hasCustomProperty(const AtomicString& name) const { return rareInheritedData->m_customProperties->hasCustomProperty(name); }
- const CustomPropertyValueMap& customProperties() const { return rareInheritedData->m_customProperties->m_values; }
-
- void setHasViewportUnits(bool hasViewportUnits = true) { noninherited_flags.setHasViewportUnits(hasViewportUnits); }
- bool hasViewportUnits() const { return noninherited_flags.hasViewportUnits(); }
-
bool affectedByHover() const { return noninherited_flags.affectedByHover(); }
bool affectedByActive() const { return noninherited_flags.affectedByActive(); }
bool affectedByDrag() const { return noninherited_flags.affectedByDrag(); }
@@ -531,15 +384,13 @@ public:
bool operator==(const RenderStyle& other) const;
bool operator!=(const RenderStyle& other) const { return !(*this == other); }
- bool isFloating() const { return noninherited_flags.isFloating(); }
- bool hasMargin() const { return !surround->margin.isZero(); }
+ bool isFloating() const { return noninherited_flags._floating != NoFloat; }
+ bool hasMargin() const { return surround->margin.nonZero(); }
bool hasBorder() const { return surround->border.hasBorder(); }
- bool hasBorderFill() const { return surround->border.hasFill(); }
- bool hasBorderDecoration() const { return hasBorder() || hasBorderFill(); }
- bool hasPadding() const { return !surround->padding.isZero(); }
- bool hasOffset() const { return !surround->offset.isZero(); }
- bool hasMarginBeforeQuirk() const { return marginBefore().hasQuirk(); }
- bool hasMarginAfterQuirk() const { return marginAfter().hasQuirk(); }
+ bool hasPadding() const { return surround->padding.nonZero(); }
+ bool hasOffset() const { return surround->offset.nonZero(); }
+ bool hasMarginBeforeQuirk() const { return marginBefore().quirk(); }
+ bool hasMarginAfterQuirk() const { return marginAfter().quirk(); }
bool hasBackgroundImage() const { return m_background->background().hasImage(); }
bool hasFixedBackgroundImage() const { return m_background->background().hasFixedImage(); }
@@ -559,7 +410,7 @@ public:
LayoutBoxExtent imageOutsets(const NinePieceImage&) const;
bool hasBorderImageOutsets() const
{
- return borderImage().hasImage() && !borderImage().outset().isZero();
+ return borderImage().hasImage() && borderImage().outset().nonZero();
}
LayoutBoxExtent borderImageOutsets() const
{
@@ -571,8 +422,10 @@ public:
return imageOutsets(maskBoxImage());
}
+#if ENABLE(CSS_FILTERS)
bool hasFilterOutsets() const { return hasFilter() && filter().hasOutsets(); }
FilterOutsets filterOutsets() const { return hasFilter() ? filter().outsets() : FilterOutsets(); }
+#endif
Order rtlOrdering() const { return static_cast<Order>(inherited_flags.m_rtlOrdering); }
void setRTLOrdering(Order o) { inherited_flags.m_rtlOrdering = o; }
@@ -582,13 +435,12 @@ public:
bool hasAnyPublicPseudoStyles() const;
bool hasPseudoStyle(PseudoId pseudo) const;
void setHasPseudoStyle(PseudoId pseudo);
- void setHasPseudoStyles(PseudoIdSet);
bool hasUniquePseudoStyle() const;
// attribute getter methods
- EDisplay display() const { return noninherited_flags.effectiveDisplay(); }
- EDisplay originalDisplay() const { return noninherited_flags.originalDisplay(); }
+ EDisplay display() const { return static_cast<EDisplay>(noninherited_flags._effectiveDisplay); }
+ EDisplay originalDisplay() const { return static_cast<EDisplay>(noninherited_flags._originalDisplay); }
const Length& left() const { return surround->offset.left(); }
const Length& right() const { return surround->offset.right(); }
@@ -596,8 +448,8 @@ public:
const Length& bottom() const { return surround->offset.bottom(); }
// Accessors for positioned object edges that take into account writing mode.
- const Length& logicalLeft() const { return surround->offset.start(writingMode()); }
- const Length& logicalRight() const { return surround->offset.end(writingMode()); }
+ const Length& logicalLeft() const { return surround->offset.logicalLeft(writingMode()); }
+ const Length& logicalRight() const { return surround->offset.logicalRight(writingMode()); }
const Length& logicalTop() const { return surround->offset.before(writingMode()); }
const Length& logicalBottom() const { return surround->offset.after(writingMode()); }
@@ -608,11 +460,11 @@ public:
bool hasStaticInlinePosition(bool horizontal) const { return horizontal ? hasAutoLeftAndRight() : hasAutoTopAndBottom(); }
bool hasStaticBlockPosition(bool horizontal) const { return horizontal ? hasAutoTopAndBottom() : hasAutoLeftAndRight(); }
- EPosition position() const { return noninherited_flags.position(); }
+ EPosition position() const { return static_cast<EPosition>(noninherited_flags._position); }
bool hasOutOfFlowPosition() const { return position() == AbsolutePosition || position() == FixedPosition; }
bool hasInFlowPosition() const { return position() == RelativePosition || position() == StickyPosition; }
bool hasViewportConstrainedPosition() const { return position() == FixedPosition || position() == StickyPosition; }
- EFloat floating() const { return noninherited_flags.floating(); }
+ EFloat floating() const { return static_cast<EFloat>(noninherited_flags._floating); }
const Length& width() const { return m_box->width(); }
const Length& height() const { return m_box->height(); }
@@ -651,37 +503,40 @@ public:
const LengthSize& borderBottomRightRadius() const { return surround->border.bottomRight(); }
bool hasBorderRadius() const { return surround->border.hasBorderRadius(); }
- float borderLeftWidth() const { return surround->border.borderLeftWidth(); }
+ unsigned borderLeftWidth() const { return surround->border.borderLeftWidth(); }
EBorderStyle borderLeftStyle() const { return surround->border.left().style(); }
bool borderLeftIsTransparent() const { return surround->border.left().isTransparent(); }
- float borderRightWidth() const { return surround->border.borderRightWidth(); }
+ unsigned borderRightWidth() const { return surround->border.borderRightWidth(); }
EBorderStyle borderRightStyle() const { return surround->border.right().style(); }
bool borderRightIsTransparent() const { return surround->border.right().isTransparent(); }
- float borderTopWidth() const { return surround->border.borderTopWidth(); }
+ unsigned borderTopWidth() const { return surround->border.borderTopWidth(); }
EBorderStyle borderTopStyle() const { return surround->border.top().style(); }
bool borderTopIsTransparent() const { return surround->border.top().isTransparent(); }
- float borderBottomWidth() const { return surround->border.borderBottomWidth(); }
+ unsigned borderBottomWidth() const { return surround->border.borderBottomWidth(); }
EBorderStyle borderBottomStyle() const { return surround->border.bottom().style(); }
bool borderBottomIsTransparent() const { return surround->border.bottom().isTransparent(); }
- FloatBoxExtent borderWidth() const { return surround->border.borderWidth(); }
-
- float borderBeforeWidth() const;
- float borderAfterWidth() const;
- float borderStartWidth() const;
- float borderEndWidth() const;
+
+ unsigned short borderBeforeWidth() const;
+ unsigned short borderAfterWidth() const;
+ unsigned short borderStartWidth() const;
+ unsigned short borderEndWidth() const;
- float outlineSize() const { return std::max<float>(0, outlineWidth() + outlineOffset()); }
- float outlineWidth() const;
- bool hasOutline() const { return outlineStyle() > BHIDDEN && outlineWidth() > 0; }
+ unsigned short outlineSize() const { return std::max(0, outlineWidth() + outlineOffset()); }
+ unsigned short outlineWidth() const
+ {
+ if (m_background->outline().style() == BNONE)
+ return 0;
+ return m_background->outline().width();
+ }
+ bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHIDDEN; }
EBorderStyle outlineStyle() const { return m_background->outline().style(); }
OutlineIsAuto outlineStyleIsAuto() const { return static_cast<OutlineIsAuto>(m_background->outline().isAuto()); }
- bool hasOutlineInVisualOverflow() const { return hasOutline() && outlineSize() > 0; }
- EOverflow overflowX() const { return noninherited_flags.overflowX(); }
- EOverflow overflowY() const { return noninherited_flags.overflowY(); }
+ EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); }
+ EOverflow overflowY() const { return static_cast<EOverflow>(noninherited_flags._overflowY); }
EVisibility visibility() const { return static_cast<EVisibility>(inherited_flags._visibility); }
- EVerticalAlign verticalAlign() const { return noninherited_flags.verticalAlign(); }
+ EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(noninherited_flags._vertical_align); }
const Length& verticalAlignLength() const { return m_box->verticalAlign(); }
const Length& clipLeft() const { return visual->clip.left(); }
@@ -691,18 +546,18 @@ public:
const LengthBox& clip() const { return visual->clip; }
bool hasClip() const { return visual->hasClip; }
- EUnicodeBidi unicodeBidi() const { return noninherited_flags.unicodeBidi(); }
+ EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(noninherited_flags._unicodeBidi); }
- EClear clear() const { return noninherited_flags.clear(); }
- ETableLayout tableLayout() const { return noninherited_flags.tableLayout(); }
+ EClear clear() const { return static_cast<EClear>(noninherited_flags._clear); }
+ ETableLayout tableLayout() const { return static_cast<ETableLayout>(noninherited_flags._table_layout); }
- WEBCORE_EXPORT const FontCascade& fontCascade() const;
- WEBCORE_EXPORT const FontMetrics& fontMetrics() const;
- WEBCORE_EXPORT const FontCascadeDescription& fontDescription() const;
+ const Font& font() const;
+ const FontMetrics& fontMetrics() const;
+ const FontDescription& fontDescription() const;
float specifiedFontSize() const;
float computedFontSize() const;
int fontSize() const;
- std::pair<FontOrientation, NonCJKGlyphOrientation> fontAndGlyphOrientation();
+ void getFontAndGlyphOrientation(FontOrientation&, NonCJKGlyphOrientation&);
#if ENABLE(TEXT_AUTOSIZING)
float textAutosizingMultiplier() const { return visual->m_textAutosizingMultiplier; }
@@ -730,16 +585,13 @@ public:
float zoom() const { return visual->m_zoom; }
float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; }
-
- TextZoom textZoom() const { return static_cast<TextZoom>(rareInheritedData->m_textZoom); }
TextDirection direction() const { return static_cast<TextDirection>(inherited_flags._direction); }
bool isLeftToRightDirection() const { return direction() == LTR; }
- bool hasExplicitlySetDirection() const { return noninherited_flags.hasExplicitlySetDirection(); }
const Length& specifiedLineHeight() const;
Length lineHeight() const;
- int computedLineHeight() const;
+ int computedLineHeight(RenderView* = 0) const;
EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_flags._white_space); }
static bool autoWrap(EWhiteSpace ws)
@@ -807,7 +659,7 @@ public:
const Length& backgroundYPosition() const { return m_background->background().yPosition(); }
EFillSizeType backgroundSizeType() const { return m_background->background().sizeType(); }
const LengthSize& backgroundSizeLength() const { return m_background->background().sizeLength(); }
- FillLayer& ensureBackgroundLayers() { return m_background.access()->m_background; }
+ FillLayer* accessBackgroundLayers() { return &(m_background.access()->m_background); }
const FillLayer* backgroundLayers() const { return &(m_background->background()); }
StyleImage* maskImage() const { return rareNonInheritedData->m_mask.image(); }
@@ -820,7 +672,7 @@ public:
const Length& maskYPosition() const { return rareNonInheritedData->m_mask.yPosition(); }
EFillSizeType maskSizeType() const { return rareNonInheritedData->m_mask.sizeType(); }
const LengthSize& maskSizeLength() const { return rareNonInheritedData->m_mask.sizeLength(); }
- FillLayer& ensureMaskLayers() { return rareNonInheritedData.access()->m_mask; }
+ FillLayer* accessMaskLayers() { return &(rareNonInheritedData.access()->m_mask); }
const FillLayer* maskLayers() const { return &(rareNonInheritedData->m_mask); }
const NinePieceImage& maskBoxImage() const { return rareNonInheritedData->m_maskBoxImage; }
StyleImage* maskBoxImageSource() const { return rareNonInheritedData->m_maskBoxImage.image(); }
@@ -868,21 +720,23 @@ public:
EInsideLink insideLink() const { return static_cast<EInsideLink>(inherited_flags._insideLink); }
bool isLink() const { return noninherited_flags.isLink(); }
- bool insideDefaultButton() const { return inherited_flags._insideDefaultButton; }
-
short widows() const { return rareInheritedData->widows; }
short orphans() const { return rareInheritedData->orphans; }
bool hasAutoWidows() const { return rareInheritedData->m_hasAutoWidows; }
bool hasAutoOrphans() const { return rareInheritedData->m_hasAutoOrphans; }
+ EPageBreak pageBreakInside() const { return static_cast<EPageBreak>(noninherited_flags._page_break_inside); }
+ EPageBreak pageBreakBefore() const { return static_cast<EPageBreak>(noninherited_flags._page_break_before); }
+ EPageBreak pageBreakAfter() const { return static_cast<EPageBreak>(noninherited_flags._page_break_after); }
// CSS3 Getter Methods
- BreakInside breakInside() const { return static_cast<BreakInside>(rareNonInheritedData->m_breakInside); }
- BreakBetween breakBefore() const { return static_cast<BreakBetween>(rareNonInheritedData->m_breakBefore); }
- BreakBetween breakAfter() const { return static_cast<BreakBetween>(rareNonInheritedData->m_breakAfter); }
-
- HangingPunctuation hangingPunctuation() const { return static_cast<HangingPunctuation>(rareInheritedData->m_hangingPunctuation); }
- float outlineOffset() const;
+ int outlineOffset() const
+ {
+ if (m_background->outline().style() == BNONE)
+ return 0;
+ return m_background->outline().offset();
+ }
+
const ShadowData* textShadow() const { return rareInheritedData->textShadow.get(); }
void getTextShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(textShadow(), top, right, bottom, left); }
void getTextShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(textShadow(), left, right); }
@@ -891,9 +745,11 @@ public:
void getTextShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const { getShadowBlockDirectionExtent(textShadow(), logicalTop, logicalBottom); }
float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; }
+ ColorSpace colorSpace() const { return static_cast<ColorSpace>(rareInheritedData->colorSpace); }
float opacity() const { return rareNonInheritedData->opacity; }
ControlPart appearance() const { return static_cast<ControlPart>(rareNonInheritedData->m_appearance); }
- AspectRatioType aspectRatioType() const { return static_cast<AspectRatioType>(rareNonInheritedData->m_aspectRatioType); }
+ // aspect ratio convenience method
+ bool hasAspectRatio() const { return rareNonInheritedData->m_hasAspectRatio; }
float aspectRatio() const { return aspectRatioNumerator() / aspectRatioDenominator(); }
float aspectRatioDenominator() const { return rareNonInheritedData->m_aspectRatioDenominator; }
float aspectRatioNumerator() const { return rareNonInheritedData->m_aspectRatioNumerator; }
@@ -910,58 +766,30 @@ public:
float flexGrow() const { return rareNonInheritedData->m_flexibleBox->m_flexGrow; }
float flexShrink() const { return rareNonInheritedData->m_flexibleBox->m_flexShrink; }
const Length& flexBasis() const { return rareNonInheritedData->m_flexibleBox->m_flexBasis; }
- const StyleContentAlignmentData& alignContent() const { return rareNonInheritedData->m_alignContent; }
- ContentPosition alignContentPosition() const { return rareNonInheritedData->m_alignContent.position(); }
- ContentDistributionType alignContentDistribution() const { return rareNonInheritedData->m_alignContent.distribution(); }
- OverflowAlignment alignContentOverflowAlignment() const { return rareNonInheritedData->m_alignContent.overflow(); }
- const StyleSelfAlignmentData& alignItems() const { return rareNonInheritedData->m_alignItems; }
- ItemPosition alignItemsPosition() const { return rareNonInheritedData->m_alignItems.position(); }
- OverflowAlignment alignItemsOverflowAlignment() const { return rareNonInheritedData->m_alignItems.overflow(); }
- const StyleSelfAlignmentData& alignSelf() const { return rareNonInheritedData->m_alignSelf; }
- ItemPosition alignSelfPosition() const { return rareNonInheritedData->m_alignSelf.position(); }
- OverflowAlignment alignSelfOverflowAlignment() const { return rareNonInheritedData->m_alignSelf.overflow(); }
+ EAlignContent alignContent() const { return static_cast<EAlignContent>(rareNonInheritedData->m_alignContent); }
+ EAlignItems alignItems() const { return static_cast<EAlignItems>(rareNonInheritedData->m_alignItems); }
+ EAlignItems alignSelf() const { return static_cast<EAlignItems>(rareNonInheritedData->m_alignSelf); }
EFlexDirection flexDirection() const { return static_cast<EFlexDirection>(rareNonInheritedData->m_flexibleBox->m_flexDirection); }
bool isColumnFlexDirection() const { return flexDirection() == FlowColumn || flexDirection() == FlowColumnReverse; }
bool isReverseFlexDirection() const { return flexDirection() == FlowRowReverse || flexDirection() == FlowColumnReverse; }
EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(rareNonInheritedData->m_flexibleBox->m_flexWrap); }
- const StyleContentAlignmentData& justifyContent() const { return rareNonInheritedData->m_justifyContent; }
- ContentPosition justifyContentPosition() const { return rareNonInheritedData->m_justifyContent.position(); }
- ContentDistributionType justifyContentDistribution() const { return rareNonInheritedData->m_justifyContent.distribution(); }
- OverflowAlignment justifyContentOverflowAlignment() const { return rareNonInheritedData->m_justifyContent.overflow(); }
- const StyleSelfAlignmentData& justifyItems() const { return rareNonInheritedData->m_justifyItems; }
- ItemPosition justifyItemsPosition() const { return rareNonInheritedData->m_justifyItems.position(); }
- OverflowAlignment justifyItemsOverflowAlignment() const { return rareNonInheritedData->m_justifyItems.overflow(); }
- ItemPositionType justifyItemsPositionType() const { return rareNonInheritedData->m_justifyItems.positionType(); }
- const StyleSelfAlignmentData& justifySelf() const { return rareNonInheritedData->m_justifySelf; }
- ItemPosition justifySelfPosition() const { return rareNonInheritedData->m_justifySelf.position(); }
- OverflowAlignment justifySelfOverflowAlignment() const { return rareNonInheritedData->m_justifySelf.overflow(); }
-
-#if ENABLE(CSS_GRID_LAYOUT)
+ EJustifyContent justifyContent() const { return static_cast<EJustifyContent>(rareNonInheritedData->m_justifyContent); }
+
const Vector<GridTrackSize>& gridColumns() const { return rareNonInheritedData->m_grid->m_gridColumns; }
const Vector<GridTrackSize>& gridRows() const { return rareNonInheritedData->m_grid->m_gridRows; }
const NamedGridLinesMap& namedGridColumnLines() const { return rareNonInheritedData->m_grid->m_namedGridColumnLines; }
const NamedGridLinesMap& namedGridRowLines() const { return rareNonInheritedData->m_grid->m_namedGridRowLines; }
- const OrderedNamedGridLinesMap& orderedNamedGridColumnLines() const { return rareNonInheritedData->m_grid->m_orderedNamedGridColumnLines; }
- const OrderedNamedGridLinesMap& orderedNamedGridRowLines() const { return rareNonInheritedData->m_grid->m_orderedNamedGridRowLines; }
const NamedGridAreaMap& namedGridArea() const { return rareNonInheritedData->m_grid->m_namedGridArea; }
size_t namedGridAreaRowCount() const { return rareNonInheritedData->m_grid->m_namedGridAreaRowCount; }
size_t namedGridAreaColumnCount() const { return rareNonInheritedData->m_grid->m_namedGridAreaColumnCount; }
- GridAutoFlow gridAutoFlow() const { return static_cast<GridAutoFlow>(rareNonInheritedData->m_grid->m_gridAutoFlow); }
- bool isGridAutoFlowDirectionRow() const { return (rareNonInheritedData->m_grid->m_gridAutoFlow & InternalAutoFlowDirectionRow); }
- bool isGridAutoFlowDirectionColumn() const { return (rareNonInheritedData->m_grid->m_gridAutoFlow & InternalAutoFlowDirectionColumn); }
- bool isGridAutoFlowAlgorithmSparse() const { return (rareNonInheritedData->m_grid->m_gridAutoFlow & InternalAutoFlowAlgorithmSparse); }
- bool isGridAutoFlowAlgorithmDense() const { return (rareNonInheritedData->m_grid->m_gridAutoFlow & InternalAutoFlowAlgorithmDense); }
+ GridAutoFlow gridAutoFlow() const { return rareNonInheritedData->m_grid->m_gridAutoFlow; }
const GridTrackSize& gridAutoColumns() const { return rareNonInheritedData->m_grid->m_gridAutoColumns; }
const GridTrackSize& gridAutoRows() const { return rareNonInheritedData->m_grid->m_gridAutoRows; }
- const Length& gridColumnGap() const { return rareNonInheritedData->m_grid->m_gridColumnGap; }
- const Length& gridRowGap() const { return rareNonInheritedData->m_grid->m_gridRowGap; }
-
const GridPosition& gridItemColumnStart() const { return rareNonInheritedData->m_gridItem->m_gridColumnStart; }
const GridPosition& gridItemColumnEnd() const { return rareNonInheritedData->m_gridItem->m_gridColumnEnd; }
const GridPosition& gridItemRowStart() const { return rareNonInheritedData->m_gridItem->m_gridRowStart; }
const GridPosition& gridItemRowEnd() const { return rareNonInheritedData->m_gridItem->m_gridRowEnd; }
-#endif /* ENABLE(CSS_GRID_LAYOUT) */
const ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
void getBoxShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(boxShadow(), top, right, bottom, left); }
@@ -991,14 +819,15 @@ public:
EOverflowWrap overflowWrap() const { return static_cast<EOverflowWrap>(rareInheritedData->overflowWrap); }
ENBSPMode nbspMode() const { return static_cast<ENBSPMode>(rareInheritedData->nbspMode); }
LineBreak lineBreak() const { return static_cast<LineBreak>(rareInheritedData->lineBreak); }
+ const AtomicString& highlight() const { return rareInheritedData->highlight; }
Hyphens hyphens() const { return static_cast<Hyphens>(rareInheritedData->hyphens); }
short hyphenationLimitBefore() const { return rareInheritedData->hyphenationLimitBefore; }
short hyphenationLimitAfter() const { return rareInheritedData->hyphenationLimitAfter; }
short hyphenationLimitLines() const { return rareInheritedData->hyphenationLimitLines; }
const AtomicString& hyphenationString() const { return rareInheritedData->hyphenationString; }
- const AtomicString& locale() const { return fontDescription().locale(); }
+ const AtomicString& locale() const { return rareInheritedData->locale; }
EBorderFit borderFit() const { return static_cast<EBorderFit>(rareNonInheritedData->m_borderFit); }
- EResize resize() const { return static_cast<EResize>(rareNonInheritedData->m_resize); }
+ EResize resize() const { return static_cast<EResize>(rareInheritedData->resize); }
ColumnAxis columnAxis() const { return static_cast<ColumnAxis>(rareNonInheritedData->m_multiCol->m_axis); }
bool hasInlineColumnAxis() const {
ColumnAxis axis = columnAxis();
@@ -1017,7 +846,12 @@ public:
unsigned short columnRuleWidth() const { return rareNonInheritedData->m_multiCol->ruleWidth(); }
bool columnRuleIsTransparent() const { return rareNonInheritedData->m_multiCol->m_rule.isTransparent(); }
ColumnSpan columnSpan() const { return static_cast<ColumnSpan>(rareNonInheritedData->m_multiCol->m_columnSpan); }
-
+ EPageBreak columnBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakBefore); }
+ EPageBreak columnBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakInside); }
+ EPageBreak columnBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakAfter); }
+ EPageBreak regionBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakBefore); }
+ EPageBreak regionBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakInside); }
+ EPageBreak regionBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakAfter); }
const TransformOperations& transform() const { return rareNonInheritedData->m_transform->m_operations; }
const Length& transformOriginX() const { return rareNonInheritedData->m_transform->m_x; }
const Length& transformOriginY() const { return rareNonInheritedData->m_transform->m_y; }
@@ -1041,6 +875,7 @@ public:
bool hasTransformRelatedProperty() const { return hasTransform() || preserves3D() || hasPerspective(); }
enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin };
+ void applyTransform(TransformationMatrix&, const LayoutSize& borderBoxSize, ApplyTransformOrigin = IncludeTransformOrigin) const;
void applyTransform(TransformationMatrix&, const FloatRect& boundingBox, ApplyTransformOrigin = IncludeTransformOrigin) const;
void setPageScaleTransform(float);
@@ -1053,7 +888,6 @@ public:
// End CSS3 Getters
- bool hasFlowInto() const { return !rareNonInheritedData->m_flowThread.isNull(); }
const AtomicString& flowThread() const { return rareNonInheritedData->m_flowThread; }
bool hasFlowFrom() const { return !rareNonInheritedData->m_regionThread.isNull(); }
const AtomicString& regionThread() const { return rareNonInheritedData->m_regionThread; }
@@ -1063,18 +897,16 @@ public:
LineSnap lineSnap() const { return static_cast<LineSnap>(rareInheritedData->m_lineSnap); }
LineAlign lineAlign() const { return static_cast<LineAlign>(rareInheritedData->m_lineAlign); }
+ WrapFlow wrapFlow() const { return static_cast<WrapFlow>(rareNonInheritedData->m_wrapFlow); }
+ WrapThrough wrapThrough() const { return static_cast<WrapThrough>(rareNonInheritedData->m_wrapThrough); }
+
// Apple-specific property getter methods
EPointerEvents pointerEvents() const { return static_cast<EPointerEvents>(inherited_flags._pointerEvents); }
const AnimationList* animations() const { return rareNonInheritedData->m_animations.get(); }
const AnimationList* transitions() const { return rareNonInheritedData->m_transitions.get(); }
- AnimationList* animations() { return rareNonInheritedData->m_animations.get(); }
- AnimationList* transitions() { return rareNonInheritedData->m_transitions.get(); }
-
- bool hasAnimationsOrTransitions() const { return rareNonInheritedData->hasAnimationsOrTransitions(); }
-
- AnimationList& ensureAnimations();
- AnimationList& ensureTransitions();
+ AnimationList* accessAnimations();
+ AnimationList* accessTransitions();
bool hasAnimations() const { return rareNonInheritedData->m_animations && rareNonInheritedData->m_animations->size() > 0; }
bool hasTransitions() const { return rareNonInheritedData->m_transitions && rareNonInheritedData->m_transitions->size() > 0; }
@@ -1093,58 +925,36 @@ public:
const LengthSize& pageSize() const { return rareNonInheritedData->m_pageSize; }
PageSizeType pageSizeType() const { return static_cast<PageSizeType>(rareNonInheritedData->m_pageSizeType); }
+#if USE(ACCELERATED_COMPOSITING)
// When set, this ensures that styles compare as different. Used during accelerated animations.
bool isRunningAcceleratedAnimation() const { return rareNonInheritedData->m_runningAcceleratedAnimation; }
+#endif
LineBoxContain lineBoxContain() const { return rareInheritedData->m_lineBoxContain; }
const LineClampValue& lineClamp() const { return rareNonInheritedData->lineClamp; }
- const IntSize& initialLetter() const { return rareNonInheritedData->m_initialLetter; }
- int initialLetterDrop() const { return initialLetter().width(); }
- int initialLetterHeight() const { return initialLetter().height(); }
-
-#if ENABLE(TOUCH_EVENTS)
- TouchAction touchAction() const { return static_cast<TouchAction>(rareNonInheritedData->m_touchAction); }
-#endif
-
-#if ENABLE(CSS_SCROLL_SNAP)
- ScrollSnapType scrollSnapType() const { return static_cast<ScrollSnapType>(rareNonInheritedData->m_scrollSnapType); }
- const ScrollSnapPoints* scrollSnapPointsX() const;
- const ScrollSnapPoints* scrollSnapPointsY() const;
- const LengthSize& scrollSnapDestination() const;
- WEBCORE_EXPORT const Vector<LengthSize>& scrollSnapCoordinates() const;
-#endif
-
#if ENABLE(TOUCH_EVENTS)
Color tapHighlightColor() const { return rareInheritedData->tapHighlightColor; }
#endif
-
#if PLATFORM(IOS)
bool touchCalloutEnabled() const { return rareInheritedData->touchCalloutEnabled; }
+ Color compositionFillColor() const { return rareInheritedData->compositionFillColor; }
#endif
-
#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
bool useTouchOverflowScrolling() const { return rareInheritedData->useTouchOverflowScrolling; }
#endif
-
#if ENABLE(IOS_TEXT_AUTOSIZING)
TextSizeAdjustment textSizeAdjust() const { return rareInheritedData->textSizeAdjust; }
#endif
-
ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareInheritedData->textSecurity); }
WritingMode writingMode() const { return static_cast<WritingMode>(inherited_flags.m_writingMode); }
bool isHorizontalWritingMode() const { return WebCore::isHorizontalWritingMode(writingMode()); }
bool isFlippedLinesWritingMode() const { return WebCore::isFlippedLinesWritingMode(writingMode()); }
- bool isFlippedBlocksWritingMode() const { return WebCore::isFlippedWritingMode(writingMode()); }
+ bool isFlippedBlocksWritingMode() const { return WebCore::isFlippedBlocksWritingMode(writingMode()); }
- ImageOrientationEnum imageOrientation() const
- {
#if ENABLE(CSS_IMAGE_ORIENTATION)
- return static_cast<ImageOrientationEnum>(rareInheritedData->m_imageOrientation);
-#else
- return DefaultImageOrientation;
+ ImageOrientationEnum imageOrientation() const { return static_cast<ImageOrientationEnum>(rareInheritedData->m_imageOrientation); }
#endif
- }
EImageRendering imageRendering() const { return static_cast<EImageRendering>(rareInheritedData->m_imageRendering); }
@@ -1156,33 +966,20 @@ public:
ESpeak speak() const { return static_cast<ESpeak>(rareInheritedData->speak); }
+#if ENABLE(CSS_FILTERS)
FilterOperations& mutableFilter() { return rareNonInheritedData.access()->m_filter.access()->m_operations; }
const FilterOperations& filter() const { return rareNonInheritedData->m_filter->m_operations; }
bool hasFilter() const { return !rareNonInheritedData->m_filter->m_operations.operations().isEmpty(); }
- bool hasReferenceFilterOnly() const;
-
-#if ENABLE(FILTERS_LEVEL_2)
- FilterOperations& mutableBackdropFilter() { return rareNonInheritedData.access()->m_backdropFilter.access()->m_operations; }
- const FilterOperations& backdropFilter() const { return rareNonInheritedData->m_backdropFilter->m_operations; }
- bool hasBackdropFilter() const { return !rareNonInheritedData->m_backdropFilter->m_operations.operations().isEmpty(); }
#else
- bool hasBackdropFilter() const { return false; }
+ bool hasFilter() const { return false; }
#endif
#if ENABLE(CSS_COMPOSITING)
BlendMode blendMode() const { return static_cast<BlendMode>(rareNonInheritedData->m_effectiveBlendMode); }
- void setBlendMode(BlendMode blendMode) { SET_VAR(rareNonInheritedData, m_effectiveBlendMode, blendMode); }
+ void setBlendMode(BlendMode v) { rareNonInheritedData.access()->m_effectiveBlendMode = v; }
bool hasBlendMode() const { return static_cast<BlendMode>(rareNonInheritedData->m_effectiveBlendMode) != BlendModeNormal; }
-
- Isolation isolation() const { return static_cast<Isolation>(rareNonInheritedData->m_isolation); }
- void setIsolation(Isolation isolation) { SET_VAR(rareNonInheritedData, m_isolation, isolation); }
- bool hasIsolation() const { return rareNonInheritedData->m_isolation != IsolationAuto; }
#else
- BlendMode blendMode() const { return BlendModeNormal; }
bool hasBlendMode() const { return false; }
-
- Isolation isolation() const { return IsolationAuto; }
- bool hasIsolation() const { return false; }
#endif
#if USE(RTL_SCROLLBAR)
@@ -1190,50 +987,44 @@ public:
#else
bool shouldPlaceBlockDirectionScrollbarOnLogicalLeft() const { return false; }
#endif
-
-#if ENABLE(CSS_TRAILING_WORD)
- TrailingWord trailingWord() const { return static_cast<TrailingWord>(rareInheritedData->trailingWord); }
-#endif
-
- void checkVariablesInCustomProperties();
-
+
// attribute setter methods
- void setDisplay(EDisplay v) { noninherited_flags.setEffectiveDisplay(v); }
- void setOriginalDisplay(EDisplay v) { noninherited_flags.setOriginalDisplay(v); }
- void setPosition(EPosition v) { noninherited_flags.setPosition(v); }
- void setFloating(EFloat v) { noninherited_flags.setFloating(v); }
+ void setDisplay(EDisplay v) { noninherited_flags._effectiveDisplay = v; }
+ void setOriginalDisplay(EDisplay v) { noninherited_flags._originalDisplay = v; }
+ void setPosition(EPosition v) { noninherited_flags._position = v; }
+ void setFloating(EFloat v) { noninherited_flags._floating = v; }
- void setLeft(Length v) { SET_VAR(surround, offset.left(), WTFMove(v)); }
- void setRight(Length v) { SET_VAR(surround, offset.right(), WTFMove(v)); }
- void setTop(Length v) { SET_VAR(surround, offset.top(), WTFMove(v)); }
- void setBottom(Length v) { SET_VAR(surround, offset.bottom(), WTFMove(v)); }
+ void setLeft(Length v) { SET_VAR(surround, offset.m_left, std::move(v)); }
+ void setRight(Length v) { SET_VAR(surround, offset.m_right, std::move(v)); }
+ void setTop(Length v) { SET_VAR(surround, offset.m_top, std::move(v)); }
+ void setBottom(Length v) { SET_VAR(surround, offset.m_bottom, std::move(v)); }
- void setWidth(Length v) { SET_VAR(m_box, m_width, WTFMove(v)); }
- void setHeight(Length v) { SET_VAR(m_box, m_height, WTFMove(v)); }
+ void setWidth(Length v) { SET_VAR(m_box, m_width, std::move(v)); }
+ void setHeight(Length v) { SET_VAR(m_box, m_height, std::move(v)); }
void setLogicalWidth(Length v)
{
if (isHorizontalWritingMode()) {
- SET_VAR(m_box, m_width, WTFMove(v));
+ SET_VAR(m_box, m_width, std::move(v));
} else {
- SET_VAR(m_box, m_height, WTFMove(v));
+ SET_VAR(m_box, m_height, std::move(v));
}
}
void setLogicalHeight(Length v)
{
if (isHorizontalWritingMode()) {
- SET_VAR(m_box, m_height, WTFMove(v));
+ SET_VAR(m_box, m_height, std::move(v));
} else {
- SET_VAR(m_box, m_width, WTFMove(v));
+ SET_VAR(m_box, m_width, std::move(v));
}
}
- void setMinWidth(Length v) { SET_VAR(m_box, m_minWidth, WTFMove(v)); }
- void setMaxWidth(Length v) { SET_VAR(m_box, m_maxWidth, WTFMove(v)); }
- void setMinHeight(Length v) { SET_VAR(m_box, m_minHeight, WTFMove(v)); }
- void setMaxHeight(Length v) { SET_VAR(m_box, m_maxHeight, WTFMove(v)); }
+ void setMinWidth(Length v) { SET_VAR(m_box, m_minWidth, std::move(v)); }
+ void setMaxWidth(Length v) { SET_VAR(m_box, m_maxWidth, std::move(v)); }
+ void setMinHeight(Length v) { SET_VAR(m_box, m_minHeight, std::move(v)); }
+ void setMaxHeight(Length v) { SET_VAR(m_box, m_maxHeight, std::move(v)); }
#if ENABLE(DASHBOARD_SUPPORT)
Vector<StyleDashboardRegion> dashboardRegions() const { return rareNonInheritedData->m_dashboardRegions; }
@@ -1243,10 +1034,10 @@ public:
{
StyleDashboardRegion region;
region.label = label;
- region.offset.top() = WTFMove(t);
- region.offset.right() = WTFMove(r);
- region.offset.bottom() = WTFMove(b);
- region.offset.left() = WTFMove(l);
+ region.offset.m_top = std::move(t);
+ region.offset.m_right = std::move(r);
+ region.offset.m_bottom = std::move(b);
+ region.offset.m_left = std::move(l);
region.type = type;
if (!append)
rareNonInheritedData.access()->m_dashboardRegions.clear();
@@ -1268,10 +1059,10 @@ public:
void setBackgroundColor(const Color& v) { SET_VAR(m_background, m_color, v); }
- void setBackgroundXPosition(Length length) { SET_VAR(m_background, m_background.m_xPosition, WTFMove(length)); }
- void setBackgroundYPosition(Length length) { SET_VAR(m_background, m_background.m_yPosition, WTFMove(length)); }
+ void setBackgroundXPosition(Length length) { SET_VAR(m_background, m_background.m_xPosition, std::move(length)); }
+ void setBackgroundYPosition(Length length) { SET_VAR(m_background, m_background.m_yPosition, std::move(length)); }
void setBackgroundSize(EFillSizeType b) { SET_VAR(m_background, m_background.m_sizeType, b); }
- void setBackgroundSizeLength(LengthSize size) { SET_VAR(m_background, m_background.m_sizeLength, WTFMove(size)); }
+ void setBackgroundSizeLength(LengthSize size) { SET_VAR(m_background, m_background.m_sizeLength, std::move(size)); }
void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.m_image, b); }
void setBorderImageSource(PassRefPtr<StyleImage>);
@@ -1279,10 +1070,10 @@ public:
void setBorderImageWidth(LengthBox);
void setBorderImageOutset(LengthBox);
- void setBorderTopLeftRadius(LengthSize size) { SET_VAR(surround, border.m_topLeft, WTFMove(size)); }
- void setBorderTopRightRadius(LengthSize size) { SET_VAR(surround, border.m_topRight, WTFMove(size)); }
- void setBorderBottomLeftRadius(LengthSize size) { SET_VAR(surround, border.m_bottomLeft, WTFMove(size)); }
- void setBorderBottomRightRadius(LengthSize size) { SET_VAR(surround, border.m_bottomRight, WTFMove(size)); }
+ void setBorderTopLeftRadius(LengthSize size) { SET_VAR(surround, border.m_topLeft, std::move(size)); }
+ void setBorderTopRightRadius(LengthSize size) { SET_VAR(surround, border.m_topRight, std::move(size)); }
+ void setBorderBottomLeftRadius(LengthSize size) { SET_VAR(surround, border.m_bottomLeft, std::move(size)); }
+ void setBorderBottomRightRadius(LengthSize size) { SET_VAR(surround, border.m_bottomRight, std::move(size)); }
void setBorderRadius(LengthSize s)
{
@@ -1296,50 +1087,50 @@ public:
setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed)));
}
- RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
+ RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, RenderView* = 0, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
- RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, LayoutUnit topWidth, LayoutUnit bottomWidth,
- LayoutUnit leftWidth, LayoutUnit rightWidth, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
+ RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect,
+ int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const;
- void setBorderLeftWidth(float v) { SET_VAR(surround, border.m_left.m_width, v); }
+ void setBorderLeftWidth(unsigned v) { SET_VAR(surround, border.m_left.m_width, v); }
void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_style, v); }
void setBorderLeftColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_left, v); }
- void setBorderRightWidth(float v) { SET_VAR(surround, border.m_right.m_width, v); }
+ void setBorderRightWidth(unsigned v) { SET_VAR(surround, border.m_right.m_width, v); }
void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right.m_style, v); }
void setBorderRightColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_right, v); }
- void setBorderTopWidth(float v) { SET_VAR(surround, border.m_top.m_width, v); }
+ void setBorderTopWidth(unsigned v) { SET_VAR(surround, border.m_top.m_width, v); }
void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.m_top.m_style, v); }
void setBorderTopColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_top, v); }
- void setBorderBottomWidth(float v) { SET_VAR(surround, border.m_bottom.m_width, v); }
+ void setBorderBottomWidth(unsigned v) { SET_VAR(surround, border.m_bottom.m_width, v); }
void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.m_bottom.m_style, v); }
void setBorderBottomColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_bottom, v); }
- void setOutlineWidth(float v) { SET_VAR(m_background, m_outline.m_width, v); }
+ void setOutlineWidth(unsigned short v) { SET_VAR(m_background, m_outline.m_width, v); }
void setOutlineStyleIsAuto(OutlineIsAuto isAuto) { SET_VAR(m_background, m_outline.m_isAuto, isAuto); }
void setOutlineStyle(EBorderStyle v) { SET_VAR(m_background, m_outline.m_style, v); }
void setOutlineColor(const Color& v) { SET_BORDERVALUE_COLOR(m_background, m_outline, v); }
- void setOverflowX(EOverflow v) { noninherited_flags.setOverflowX(v); }
- void setOverflowY(EOverflow v) { noninherited_flags.setOverflowY(v); }
+ void setOverflowX(EOverflow v) { noninherited_flags._overflowX = v; }
+ void setOverflowY(EOverflow v) { noninherited_flags._overflowY = v; }
void setVisibility(EVisibility v) { inherited_flags._visibility = v; }
- void setVerticalAlign(EVerticalAlign v) { noninherited_flags.setVerticalAlign(v); }
- void setVerticalAlignLength(Length length) { setVerticalAlign(LENGTH); SET_VAR(m_box, m_verticalAlign, WTFMove(length)); }
+ void setVerticalAlign(EVerticalAlign v) { noninherited_flags._vertical_align = v; }
+ void setVerticalAlignLength(Length length) { setVerticalAlign(LENGTH); SET_VAR(m_box, m_verticalAlign, std::move(length)); }
void setHasClip(bool b = true) { SET_VAR(visual, hasClip, b); }
- void setClipLeft(Length length) { SET_VAR(visual, clip.left(), WTFMove(length)); }
- void setClipRight(Length length) { SET_VAR(visual, clip.right(), WTFMove(length)); }
- void setClipTop(Length length) { SET_VAR(visual, clip.top(), WTFMove(length)); }
- void setClipBottom(Length length) { SET_VAR(visual, clip.bottom(), WTFMove(length)); }
+ void setClipLeft(Length length) { SET_VAR(visual, clip.m_left, std::move(length)); }
+ void setClipRight(Length length) { SET_VAR(visual, clip.m_right, std::move(length)); }
+ void setClipTop(Length length) { SET_VAR(visual, clip.m_top, std::move(length)); }
+ void setClipBottom(Length length) { SET_VAR(visual, clip.m_bottom, std::move(length)); }
void setClip(Length top, Length right, Length bottom, Length left);
- void setClip(LengthBox box) { SET_VAR(visual, clip, WTFMove(box)); }
+ void setClip(LengthBox box) { SET_VAR(visual, clip, std::move(box)); }
- void setUnicodeBidi(EUnicodeBidi b) { noninherited_flags.setUnicodeBidi(b); }
+ void setUnicodeBidi(EUnicodeBidi b) { noninherited_flags._unicodeBidi = b; }
- void setClear(EClear v) { noninherited_flags.setClear(v); }
- void setTableLayout(ETableLayout v) { noninherited_flags.setTableLayout(v); }
+ void setClear(EClear v) { noninherited_flags._clear = v; }
+ void setTableLayout(ETableLayout v) { noninherited_flags._table_layout = v; }
- bool setFontDescription(const FontCascadeDescription&);
+ bool setFontDescription(const FontDescription&);
// Only used for blending font sizes when animating, for MathML anonymous blocks, and for text autosizing.
void setFontSize(float);
@@ -1352,7 +1143,7 @@ public:
#endif
void setColor(const Color&);
- void setTextIndent(Length length) { SET_VAR(rareInheritedData, indent, WTFMove(length)); }
+ void setTextIndent(Length length) { SET_VAR(rareInheritedData, indent, std::move(length)); }
#if ENABLE(CSS3_TEXT)
void setTextIndentLine(TextIndentLine v) { SET_VAR(rareInheritedData, m_textIndentLine, v); }
void setTextIndentType(TextIndentType v) { SET_VAR(rareInheritedData, m_textIndentType, v); }
@@ -1365,12 +1156,11 @@ public:
#if ENABLE(CSS3_TEXT)
void setTextAlignLast(TextAlignLast v) { SET_VAR(rareInheritedData, m_textAlignLast, v); }
void setTextJustify(TextJustify v) { SET_VAR(rareInheritedData, m_textJustify, v); }
-#endif
+#endif // CSS3_TEXT
void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(rareNonInheritedData, m_textDecorationStyle, v); }
void setTextDecorationSkip(TextDecorationSkip skip) { SET_VAR(rareInheritedData, m_textDecorationSkip, skip); }
void setTextUnderlinePosition(TextUnderlinePosition v) { SET_VAR(rareInheritedData, m_textUnderlinePosition, v); }
void setDirection(TextDirection v) { inherited_flags._direction = v; }
- void setHasExplicitlySetDirection(bool v) { noninherited_flags.setHasExplicitlySetDirection(v); }
#if ENABLE(IOS_TEXT_AUTOSIZING)
void setSpecifiedLineHeight(Length v);
#endif
@@ -1378,8 +1168,7 @@ public:
bool setZoom(float);
void setZoomWithoutReturnValue(float f) { setZoom(f); }
bool setEffectiveZoom(float);
- void setTextZoom(TextZoom v) { SET_VAR(rareInheritedData, m_textZoom, v); }
-
+
#if ENABLE(CSS_IMAGE_ORIENTATION)
void setImageOrientation(ImageOrientationEnum v) { SET_VAR(rareInheritedData, m_imageOrientation, static_cast<int>(v)); }
#endif
@@ -1403,8 +1192,8 @@ public:
void adjustBackgroundLayers()
{
if (backgroundLayers()->next()) {
- ensureBackgroundLayers().cullEmptyLayers();
- ensureBackgroundLayers().fillUnsetProperties();
+ accessBackgroundLayers()->cullEmptyLayers();
+ accessBackgroundLayers()->fillUnsetProperties();
}
}
@@ -1414,8 +1203,8 @@ public:
void adjustMaskLayers()
{
if (maskLayers()->next()) {
- ensureMaskLayers().cullEmptyLayers();
- ensureMaskLayers().fillUnsetProperties();
+ accessMaskLayers()->cullEmptyLayers();
+ accessMaskLayers()->fillUnsetProperties();
}
}
@@ -1423,9 +1212,9 @@ public:
void setMaskBoxImage(const NinePieceImage& b) { SET_VAR(rareNonInheritedData, m_maskBoxImage, b); }
void setMaskBoxImageSource(PassRefPtr<StyleImage> v) { rareNonInheritedData.access()->m_maskBoxImage.setImage(v); }
- void setMaskXPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_xPosition, WTFMove(length)); }
- void setMaskYPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_yPosition, WTFMove(length)); }
- void setMaskSize(LengthSize size) { SET_VAR(rareNonInheritedData, m_mask.m_sizeLength, WTFMove(size)); }
+ void setMaskXPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_xPosition, std::move(length)); }
+ void setMaskYPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_yPosition, std::move(length)); }
+ void setMaskSize(LengthSize size) { SET_VAR(rareNonInheritedData, m_mask.m_sizeLength, std::move(size)); }
void setBorderCollapse(EBorderCollapse collapse) { inherited_flags._border_collapse = collapse; }
void setHorizontalBorderSpacing(short);
@@ -1433,7 +1222,7 @@ public:
void setEmptyCells(EEmptyCell v) { inherited_flags._empty_cells = v; }
void setCaptionSide(ECaptionSide v) { inherited_flags._caption_side = v; }
- void setAspectRatioType(AspectRatioType aspectRatioType) { SET_VAR(rareNonInheritedData, m_aspectRatioType, aspectRatioType); }
+ void setHasAspectRatio(bool b) { SET_VAR(rareNonInheritedData, m_hasAspectRatio, b); }
void setAspectRatioDenominator(float v) { SET_VAR(rareNonInheritedData, m_aspectRatioDenominator, v); }
void setAspectRatioNumerator(float v) { SET_VAR(rareNonInheritedData, m_aspectRatioNumerator, v); }
@@ -1442,19 +1231,19 @@ public:
void setListStylePosition(EListStylePosition v) { inherited_flags._list_style_position = v; }
void resetMargin() { SET_VAR(surround, margin, LengthBox(Fixed)); }
- void setMarginTop(Length length) { SET_VAR(surround, margin.top(), WTFMove(length)); }
- void setMarginBottom(Length length) { SET_VAR(surround, margin.bottom(), WTFMove(length)); }
- void setMarginLeft(Length length) { SET_VAR(surround, margin.left(), WTFMove(length)); }
- void setMarginRight(Length length) { SET_VAR(surround, margin.right(), WTFMove(length)); }
+ void setMarginTop(Length length) { SET_VAR(surround, margin.m_top, std::move(length)); }
+ void setMarginBottom(Length length) { SET_VAR(surround, margin.m_bottom, std::move(length)); }
+ void setMarginLeft(Length length) { SET_VAR(surround, margin.m_left, std::move(length)); }
+ void setMarginRight(Length length) { SET_VAR(surround, margin.m_right, std::move(length)); }
void setMarginStart(Length);
void setMarginEnd(Length);
void resetPadding() { SET_VAR(surround, padding, LengthBox(Auto)); }
- void setPaddingBox(LengthBox box) { SET_VAR(surround, padding, WTFMove(box)); }
- void setPaddingTop(Length length) { SET_VAR(surround, padding.top(), WTFMove(length)); }
- void setPaddingBottom(Length length) { SET_VAR(surround, padding.bottom(), WTFMove(length)); }
- void setPaddingLeft(Length length) { SET_VAR(surround, padding.left(), WTFMove(length)); }
- void setPaddingRight(Length length) { SET_VAR(surround, padding.right(), WTFMove(length)); }
+ void setPaddingBox(LengthBox box) { SET_VAR(surround, padding, std::move(box)); }
+ void setPaddingTop(Length length) { SET_VAR(surround, padding.m_top, std::move(length)); }
+ void setPaddingBottom(Length length) { SET_VAR(surround, padding.m_bottom, std::move(length)); }
+ void setPaddingLeft(Length length) { SET_VAR(surround, padding.m_left, std::move(length)); }
+ void setPaddingRight(Length length) { SET_VAR(surround, padding.m_right, std::move(length)); }
void setCursor(ECursor c) { inherited_flags._cursor_style = c; }
void addCursor(PassRefPtr<StyleImage>, const IntPoint& hotSpot = IntPoint());
@@ -1468,8 +1257,6 @@ public:
void setInsideLink(EInsideLink insideLink) { inherited_flags._insideLink = insideLink; }
void setIsLink(bool b) { noninherited_flags.setIsLink(b); }
- void setInsideDefaultButton(bool insideDefaultButton) { inherited_flags._insideDefaultButton = insideDefaultButton; }
-
PrintColorAdjust printColorAdjust() const { return static_cast<PrintColorAdjust>(inherited_flags.m_printColorAdjust); }
void setPrintColorAdjust(PrintColorAdjust value) { inherited_flags.m_printColorAdjust = value; }
@@ -1484,81 +1271,65 @@ public:
void setHasAutoOrphans() { SET_VAR(rareInheritedData, m_hasAutoOrphans, true); SET_VAR(rareInheritedData, orphans, initialOrphans()); }
void setOrphans(short o) { SET_VAR(rareInheritedData, m_hasAutoOrphans, false); SET_VAR(rareInheritedData, orphans, o); }
+ // For valid values of page-break-inside see http://www.w3.org/TR/CSS21/page.html#page-break-props
+ void setPageBreakInside(EPageBreak b) { ASSERT(b == PBAUTO || b == PBAVOID); noninherited_flags._page_break_inside = b; }
+ void setPageBreakBefore(EPageBreak b) { noninherited_flags._page_break_before = b; }
+ void setPageBreakAfter(EPageBreak b) { noninherited_flags._page_break_after = b; }
+
// CSS3 Setters
- void setOutlineOffset(float v) { SET_VAR(m_background, m_outline.m_offset, v); }
- void setTextShadow(std::unique_ptr<ShadowData>, bool add = false);
+ void setOutlineOffset(int v) { SET_VAR(m_background, m_outline.m_offset, v); }
+ void setTextShadow(PassOwnPtr<ShadowData>, bool add = false);
void setTextStrokeColor(const Color& c) { SET_VAR(rareInheritedData, textStrokeColor, c); }
void setTextStrokeWidth(float w) { SET_VAR(rareInheritedData, textStrokeWidth, w); }
void setTextFillColor(const Color& c) { SET_VAR(rareInheritedData, textFillColor, c); }
+ void setColorSpace(ColorSpace space) { SET_VAR(rareInheritedData, colorSpace, space); }
void setOpacity(float f) { float v = clampTo<float>(f, 0, 1); SET_VAR(rareNonInheritedData, opacity, v); }
void setAppearance(ControlPart a) { SET_VAR(rareNonInheritedData, m_appearance, a); }
// For valid values of box-align see http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/#alignment
- void setBoxAlign(EBoxAlignment a) { SET_NESTED_VAR(rareNonInheritedData, m_deprecatedFlexibleBox, align, a); }
+ void setBoxAlign(EBoxAlignment a) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, align, a); }
#if ENABLE(CSS_BOX_DECORATION_BREAK)
void setBoxDecorationBreak(EBoxDecorationBreak b) { SET_VAR(m_box, m_boxDecorationBreak, b); }
#endif
void setBoxDirection(EBoxDirection d) { inherited_flags._box_direction = d; }
- void setBoxFlex(float f) { SET_NESTED_VAR(rareNonInheritedData, m_deprecatedFlexibleBox, flex, f); }
- void setBoxFlexGroup(unsigned int fg) { SET_NESTED_VAR(rareNonInheritedData, m_deprecatedFlexibleBox, flex_group, fg); }
- void setBoxLines(EBoxLines l) { SET_NESTED_VAR(rareNonInheritedData, m_deprecatedFlexibleBox, lines, l); }
- void setBoxOrdinalGroup(unsigned int og) { SET_NESTED_VAR(rareNonInheritedData, m_deprecatedFlexibleBox, ordinal_group, og); }
- void setBoxOrient(EBoxOrient o) { SET_NESTED_VAR(rareNonInheritedData, m_deprecatedFlexibleBox, orient, o); }
- void setBoxPack(EBoxPack p) { SET_NESTED_VAR(rareNonInheritedData, m_deprecatedFlexibleBox, pack, p); }
- void setBoxShadow(std::unique_ptr<ShadowData>, bool add = false);
+ void setBoxFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, flex, f); }
+ void setBoxFlexGroup(unsigned int fg) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, flex_group, fg); }
+ void setBoxLines(EBoxLines l) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, lines, l); }
+ void setBoxOrdinalGroup(unsigned int og) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, ordinal_group, og); }
+ void setBoxOrient(EBoxOrient o) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, orient, o); }
+ void setBoxPack(EBoxPack p) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, pack, p); }
+ void setBoxShadow(PassOwnPtr<ShadowData>, bool add = false);
void setBoxReflect(PassRefPtr<StyleReflection> reflect) { if (rareNonInheritedData->m_boxReflect != reflect) rareNonInheritedData.access()->m_boxReflect = reflect; }
void setBoxSizing(EBoxSizing s) { SET_VAR(m_box, m_boxSizing, s); }
- void setFlexGrow(float f) { SET_NESTED_VAR(rareNonInheritedData, m_flexibleBox, m_flexGrow, f); }
- void setFlexShrink(float f) { SET_NESTED_VAR(rareNonInheritedData, m_flexibleBox, m_flexShrink, f); }
- void setFlexBasis(Length length) { SET_NESTED_VAR(rareNonInheritedData, m_flexibleBox, m_flexBasis, WTFMove(length)); }
+ void setFlexGrow(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexGrow, f); }
+ void setFlexShrink(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexShrink, f); }
+ void setFlexBasis(Length length) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexBasis, std::move(length)); }
void setOrder(int o) { SET_VAR(rareNonInheritedData, m_order, o); }
- void setAlignContent(const StyleContentAlignmentData& data) { SET_VAR(rareNonInheritedData, m_alignContent, data); }
- void setAlignContentPosition(ContentPosition position) { rareNonInheritedData.access()->m_alignContent.setPosition(position); }
- void setAlignContentOverflow(OverflowAlignment overflow) { rareNonInheritedData.access()->m_alignContent.setOverflow(overflow); }
- void setAlignContentDistribution(ContentDistributionType distribution) { rareNonInheritedData.access()->m_alignContent.setDistribution(distribution); }
- void setAlignItems(const StyleSelfAlignmentData& data) { SET_VAR(rareNonInheritedData, m_alignItems, data); }
- void setAlignItemsPosition(ItemPosition position) { rareNonInheritedData.access()->m_alignItems.setPosition(position); }
- void setAlignItemsOverflow(OverflowAlignment overflow) { rareNonInheritedData.access()->m_alignItems.setOverflow(overflow); }
- void setAlignSelf(const StyleSelfAlignmentData& data) { SET_VAR(rareNonInheritedData, m_alignSelf, data); }
- void setAlignSelfPosition(ItemPosition position) { rareNonInheritedData.access()->m_alignSelf.setPosition(position); }
- void setAlignSelfOverflow(OverflowAlignment overflow) { rareNonInheritedData.access()->m_alignSelf.setOverflow(overflow); }
- void setFlexDirection(EFlexDirection direction) { SET_NESTED_VAR(rareNonInheritedData, m_flexibleBox, m_flexDirection, direction); }
- void setFlexWrap(EFlexWrap w) { SET_NESTED_VAR(rareNonInheritedData, m_flexibleBox, m_flexWrap, w); }
- void setJustifyContent(const StyleContentAlignmentData& data) { SET_VAR(rareNonInheritedData, m_justifyContent, data); }
- void setJustifyContentPosition(ContentPosition position) { rareNonInheritedData.access()->m_justifyContent.setPosition(position); }
- void setJustifyContentOverflow(OverflowAlignment overflow) { rareNonInheritedData.access()->m_justifyContent.setOverflow(overflow); }
- void setJustifyContentDistribution(ContentDistributionType distribution) { rareNonInheritedData.access()->m_justifyContent.setDistribution(distribution); }
- void setJustifyItems(const StyleSelfAlignmentData& data) { SET_VAR(rareNonInheritedData, m_justifyItems, data); }
- void setJustifyItemsPosition(ItemPosition position) { rareNonInheritedData.access()->m_justifyItems.setPosition(position); }
- void setJustifyItemsOverflow(OverflowAlignment overflow) { rareNonInheritedData.access()->m_justifyItems.setOverflow(overflow); }
- void setJustifyItemsPositionType(ItemPositionType positionType) { rareNonInheritedData.access()->m_justifyItems.setPositionType(positionType); }
- void setJustifySelf(const StyleSelfAlignmentData& data) { SET_VAR(rareNonInheritedData, m_justifySelf, data); }
- void setJustifySelfPosition(ItemPosition position) { rareNonInheritedData.access()->m_justifySelf.setPosition(position); }
- void setJustifySelfOverflow(OverflowAlignment overflow) { rareNonInheritedData.access()->m_justifySelf.setOverflow(overflow); }
-#if ENABLE(CSS_GRID_LAYOUT)
- void setGridAutoColumns(const GridTrackSize& length) { SET_NESTED_VAR(rareNonInheritedData, m_grid, m_gridAutoColumns, length); }
- void setGridAutoRows(const GridTrackSize& length) { SET_NESTED_VAR(rareNonInheritedData, m_grid, m_gridAutoRows, length); }
- void setGridColumns(const Vector<GridTrackSize>& lengths) { SET_NESTED_VAR(rareNonInheritedData, m_grid, m_gridColumns, lengths); }
- void setGridRows(const Vector<GridTrackSize>& lengths) { SET_NESTED_VAR(rareNonInheritedData, m_grid, m_gridRows, lengths); }
- void setNamedGridColumnLines(const NamedGridLinesMap& namedGridColumnLines) { SET_NESTED_VAR(rareNonInheritedData, m_grid, m_namedGridColumnLines, namedGridColumnLines); }
- void setNamedGridRowLines(const NamedGridLinesMap& namedGridRowLines) { SET_NESTED_VAR(rareNonInheritedData, m_grid, m_namedGridRowLines, namedGridRowLines); }
- void setOrderedNamedGridColumnLines(const OrderedNamedGridLinesMap& orderedNamedGridColumnLines) { SET_NESTED_VAR(rareNonInheritedData, m_grid, m_orderedNamedGridColumnLines, orderedNamedGridColumnLines); }
- void setOrderedNamedGridRowLines(const OrderedNamedGridLinesMap& orderedNamedGridRowLines) { SET_NESTED_VAR(rareNonInheritedData, m_grid, m_orderedNamedGridRowLines, orderedNamedGridRowLines); }
- void setNamedGridArea(const NamedGridAreaMap& namedGridArea) { SET_NESTED_VAR(rareNonInheritedData, m_grid, m_namedGridArea, namedGridArea); }
- void setNamedGridAreaRowCount(size_t rowCount) { SET_NESTED_VAR(rareNonInheritedData, m_grid, m_namedGridAreaRowCount, rowCount); }
- void setNamedGridAreaColumnCount(size_t columnCount) { SET_NESTED_VAR(rareNonInheritedData, m_grid, m_namedGridAreaColumnCount, columnCount); }
- void setGridAutoFlow(GridAutoFlow flow) { SET_NESTED_VAR(rareNonInheritedData, m_grid, m_gridAutoFlow, flow); }
- void setGridItemColumnStart(const GridPosition& columnStartPosition) { SET_NESTED_VAR(rareNonInheritedData, m_gridItem, m_gridColumnStart, columnStartPosition); }
- void setGridItemColumnEnd(const GridPosition& columnEndPosition) { SET_NESTED_VAR(rareNonInheritedData, m_gridItem, m_gridColumnEnd, columnEndPosition); }
- void setGridItemRowStart(const GridPosition& rowStartPosition) { SET_NESTED_VAR(rareNonInheritedData, m_gridItem, m_gridRowStart, rowStartPosition); }
- void setGridItemRowEnd(const GridPosition& rowEndPosition) { SET_NESTED_VAR(rareNonInheritedData, m_gridItem, m_gridRowEnd, rowEndPosition); }
- void setGridColumnGap(const Length& v) { SET_NESTED_VAR(rareNonInheritedData, m_grid, m_gridColumnGap, v); }
- void setGridRowGap(const Length& v) { SET_NESTED_VAR(rareNonInheritedData, m_grid, m_gridRowGap, v); }
-#endif /* ENABLE(CSS_GRID_LAYOUT) */
- void setMarqueeIncrement(Length length) { SET_NESTED_VAR(rareNonInheritedData, m_marquee, increment, WTFMove(length)); }
- void setMarqueeSpeed(int f) { SET_NESTED_VAR(rareNonInheritedData, m_marquee, speed, f); }
- void setMarqueeDirection(EMarqueeDirection d) { SET_NESTED_VAR(rareNonInheritedData, m_marquee, direction, d); }
- void setMarqueeBehavior(EMarqueeBehavior b) { SET_NESTED_VAR(rareNonInheritedData, m_marquee, behavior, b); }
- void setMarqueeLoopCount(int i) { SET_NESTED_VAR(rareNonInheritedData, m_marquee, loops, i); }
+ void setAlignContent(EAlignContent p) { SET_VAR(rareNonInheritedData, m_alignContent, p); }
+ void setAlignItems(EAlignItems a) { SET_VAR(rareNonInheritedData, m_alignItems, a); }
+ void setAlignSelf(EAlignItems a) { SET_VAR(rareNonInheritedData, m_alignSelf, a); }
+ void setFlexDirection(EFlexDirection direction) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexDirection, direction); }
+ void setFlexWrap(EFlexWrap w) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexWrap, w); }
+ void setJustifyContent(EJustifyContent p) { SET_VAR(rareNonInheritedData, m_justifyContent, p); }
+ void setGridAutoColumns(const GridTrackSize& length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoColumns, length); }
+ void setGridAutoRows(const GridTrackSize& length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoRows, length); }
+ void setGridColumns(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridColumns, lengths); }
+ void setGridRows(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridRows, lengths); }
+ void setNamedGridColumnLines(const NamedGridLinesMap& namedGridColumnLines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridColumnLines, namedGridColumnLines); }
+ void setNamedGridRowLines(const NamedGridLinesMap& namedGridRowLines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridRowLines, namedGridRowLines); }
+ void setNamedGridArea(const NamedGridAreaMap& namedGridArea) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridArea, namedGridArea); }
+ void setNamedGridAreaRowCount(size_t rowCount) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridAreaRowCount, rowCount); }
+ void setNamedGridAreaColumnCount(size_t columnCount) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridAreaColumnCount, columnCount); }
+ void setGridAutoFlow(GridAutoFlow flow) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoFlow, flow); }
+ void setGridItemColumnStart(const GridPosition& columnStartPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridColumnStart, columnStartPosition); }
+ void setGridItemColumnEnd(const GridPosition& columnEndPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridColumnEnd, columnEndPosition); }
+ void setGridItemRowStart(const GridPosition& rowStartPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridRowStart, rowStartPosition); }
+ void setGridItemRowEnd(const GridPosition& rowEndPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridRowEnd, rowEndPosition); }
+
+ void setMarqueeIncrement(Length length) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, std::move(length)); }
+ void setMarqueeSpeed(int f) { SET_VAR(rareNonInheritedData.access()->m_marquee, speed, f); }
+ void setMarqueeDirection(EMarqueeDirection d) { SET_VAR(rareNonInheritedData.access()->m_marquee, direction, d); }
+ void setMarqueeBehavior(EMarqueeBehavior b) { SET_VAR(rareNonInheritedData.access()->m_marquee, behavior, b); }
+ void setMarqueeLoopCount(int i) { SET_VAR(rareNonInheritedData.access()->m_marquee, loops, i); }
void setUserModify(EUserModify u) { SET_VAR(rareInheritedData, userModify, u); }
void setUserDrag(EUserDrag d) { SET_VAR(rareNonInheritedData, userDrag, d); }
void setUserSelect(EUserSelect s) { SET_VAR(rareInheritedData, userSelect, s); }
@@ -1569,32 +1340,41 @@ public:
void setOverflowWrap(EOverflowWrap b) { SET_VAR(rareInheritedData, overflowWrap, b); }
void setNBSPMode(ENBSPMode b) { SET_VAR(rareInheritedData, nbspMode, b); }
void setLineBreak(LineBreak b) { SET_VAR(rareInheritedData, lineBreak, b); }
+ void setHighlight(const AtomicString& h) { SET_VAR(rareInheritedData, highlight, h); }
void setHyphens(Hyphens h) { SET_VAR(rareInheritedData, hyphens, h); }
void setHyphenationLimitBefore(short limit) { SET_VAR(rareInheritedData, hyphenationLimitBefore, limit); }
void setHyphenationLimitAfter(short limit) { SET_VAR(rareInheritedData, hyphenationLimitAfter, limit); }
void setHyphenationLimitLines(short limit) { SET_VAR(rareInheritedData, hyphenationLimitLines, limit); }
void setHyphenationString(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenationString, h); }
+ void setLocale(const AtomicString& locale) { SET_VAR(rareInheritedData, locale, locale); }
void setBorderFit(EBorderFit b) { SET_VAR(rareNonInheritedData, m_borderFit, b); }
- void setResize(EResize r) { SET_VAR(rareNonInheritedData, m_resize, r); }
- void setColumnAxis(ColumnAxis axis) { SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_axis, axis); }
- void setColumnProgression(ColumnProgression progression) { SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_progression, progression); }
- void setColumnWidth(float f) { SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_autoWidth, false); SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_width, f); }
- void setHasAutoColumnWidth() { SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_autoWidth, true); SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_width, 0); }
- void setColumnCount(unsigned short c) { SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_autoCount, false); SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_count, c); }
- void setHasAutoColumnCount() { SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_autoCount, true); SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_count, 0); }
- void setColumnFill(ColumnFill columnFill) { SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_fill, columnFill); }
- void setColumnGap(float f) { SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_normalGap, false); SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_gap, f); }
- void setHasNormalColumnGap() { SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_normalGap, true); SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_gap, 0); }
+ void setResize(EResize r) { SET_VAR(rareInheritedData, resize, r); }
+ void setColumnAxis(ColumnAxis axis) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_axis, axis); }
+ void setColumnProgression(ColumnProgression progression) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_progression, progression); }
+ void setColumnWidth(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, f); }
+ void setHasAutoColumnWidth() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, 0); }
+ void setColumnCount(unsigned short c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, c); }
+ void setHasAutoColumnCount() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, 0); }
+ void setColumnFill(ColumnFill columnFill) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_fill, columnFill); }
+ void setColumnGap(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, f); }
+ void setHasNormalColumnGap() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, 0); }
void setColumnRuleColor(const Color& c) { SET_BORDERVALUE_COLOR(rareNonInheritedData.access()->m_multiCol, m_rule, c); }
- void setColumnRuleStyle(EBorderStyle b) { SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_rule.m_style, b); }
- void setColumnRuleWidth(unsigned short w) { SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_rule.m_width, w); }
- void resetColumnRule() { SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_rule, BorderValue()); }
- void setColumnSpan(ColumnSpan columnSpan) { SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_columnSpan, columnSpan); }
+ void setColumnRuleStyle(EBorderStyle b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_style, b); }
+ void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_width, w); }
+ void resetColumnRule() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule, BorderValue()); }
+ void setColumnSpan(ColumnSpan columnSpan) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_columnSpan, columnSpan); }
+ void setColumnBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakBefore, p); }
+ // For valid values of column-break-inside see http://www.w3.org/TR/css3-multicol/#break-before-break-after-break-inside
+ void setColumnBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakInside, p); }
+ void setColumnBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakAfter, p); }
+ void setRegionBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData, m_regionBreakBefore, p); }
+ void setRegionBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID); SET_VAR(rareNonInheritedData, m_regionBreakInside, p); }
+ void setRegionBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData, m_regionBreakAfter, p); }
void inheritColumnPropertiesFrom(RenderStyle* parent) { rareNonInheritedData.access()->m_multiCol = parent->rareNonInheritedData->m_multiCol; }
- void setTransform(const TransformOperations& ops) { SET_NESTED_VAR(rareNonInheritedData, m_transform, m_operations, ops); }
- void setTransformOriginX(Length length) { SET_NESTED_VAR(rareNonInheritedData, m_transform, m_x, WTFMove(length)); }
- void setTransformOriginY(Length length) { SET_NESTED_VAR(rareNonInheritedData, m_transform, m_y, WTFMove(length)); }
- void setTransformOriginZ(float f) { SET_NESTED_VAR(rareNonInheritedData, m_transform, m_z, f); }
+ void setTransform(const TransformOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_transform, m_operations, ops); }
+ void setTransformOriginX(Length length) { SET_VAR(rareNonInheritedData.access()->m_transform, m_x, std::move(length)); }
+ void setTransformOriginY(Length length) { SET_VAR(rareNonInheritedData.access()->m_transform, m_y, std::move(length)); }
+ void setTransformOriginZ(float f) { SET_VAR(rareNonInheritedData.access()->m_transform, m_z, f); }
void setSpeak(ESpeak s) { SET_VAR(rareInheritedData, speak, s); }
void setTextCombine(TextCombine v) { SET_VAR(rareNonInheritedData, m_textCombine, v); }
void setTextDecorationColor(const Color& c) { SET_VAR(rareNonInheritedData, m_textDecorationColor, c); }
@@ -1609,19 +1389,12 @@ public:
void setRubyPosition(RubyPosition position) { SET_VAR(rareInheritedData, m_rubyPosition, position); }
- void setFilter(const FilterOperations& ops) { SET_NESTED_VAR(rareNonInheritedData, m_filter, m_operations, ops); }
-#if ENABLE(FILTERS_LEVEL_2)
- void setBackdropFilter(const FilterOperations& ops) { SET_NESTED_VAR(rareNonInheritedData, m_backdropFilter, m_operations, ops); }
+#if ENABLE(CSS_FILTERS)
+ void setFilter(const FilterOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_filter, m_operations, ops); }
#endif
void setTabSize(unsigned size) { SET_VAR(rareInheritedData, m_tabSize, size); }
- void setBreakBefore(BreakBetween breakBehavior) { SET_VAR(rareNonInheritedData, m_breakBefore, breakBehavior); }
- void setBreakAfter(BreakBetween breakBehavior) { SET_VAR(rareNonInheritedData, m_breakAfter, breakBehavior); }
- void setBreakInside(BreakInside breakBehavior) { SET_VAR(rareNonInheritedData, m_breakInside, breakBehavior); }
-
- void setHangingPunctuation(HangingPunctuation punctuation) { SET_VAR(rareInheritedData, m_hangingPunctuation, punctuation); }
-
// End CSS3 Setters
void setLineGrid(const AtomicString& lineGrid) { SET_VAR(rareInheritedData, m_lineGrid, lineGrid); }
@@ -1632,74 +1405,58 @@ public:
void setRegionThread(const AtomicString& regionThread) { SET_VAR(rareNonInheritedData, m_regionThread, regionThread); }
void setRegionFragment(RegionFragment regionFragment) { SET_VAR(rareNonInheritedData, m_regionFragment, regionFragment); }
+ void setWrapFlow(WrapFlow wrapFlow) { SET_VAR(rareNonInheritedData, m_wrapFlow, wrapFlow); }
+ void setWrapThrough(WrapThrough wrapThrough) { SET_VAR(rareNonInheritedData, m_wrapThrough, wrapThrough); }
+
// Apple-specific property setters
void setPointerEvents(EPointerEvents p) { inherited_flags._pointerEvents = p; }
void clearAnimations()
{
- rareNonInheritedData.access()->m_animations = nullptr;
+ rareNonInheritedData.access()->m_animations.clear();
}
void clearTransitions()
{
- rareNonInheritedData.access()->m_transitions = nullptr;
+ rareNonInheritedData.access()->m_transitions.clear();
}
- void inheritAnimations(const AnimationList* parent) { rareNonInheritedData.access()->m_animations = parent ? std::make_unique<AnimationList>(*parent) : nullptr; }
- void inheritTransitions(const AnimationList* parent) { rareNonInheritedData.access()->m_transitions = parent ? std::make_unique<AnimationList>(*parent) : nullptr; }
+ void inheritAnimations(const AnimationList* parent) { rareNonInheritedData.access()->m_animations = parent ? adoptPtr(new AnimationList(*parent)) : nullptr; }
+ void inheritTransitions(const AnimationList* parent) { rareNonInheritedData.access()->m_transitions = parent ? adoptPtr(new AnimationList(*parent)) : nullptr; }
void adjustAnimations();
void adjustTransitions();
void setTransformStyle3D(ETransformStyle3D b) { SET_VAR(rareNonInheritedData, m_transformStyle3D, b); }
void setBackfaceVisibility(EBackfaceVisibility b) { SET_VAR(rareNonInheritedData, m_backfaceVisibility, b); }
void setPerspective(float p) { SET_VAR(rareNonInheritedData, m_perspective, p); }
- void setPerspectiveOriginX(Length length) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, WTFMove(length)); }
- void setPerspectiveOriginY(Length length) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, WTFMove(length)); }
- void setPageSize(LengthSize size) { SET_VAR(rareNonInheritedData, m_pageSize, WTFMove(size)); }
+ void setPerspectiveOriginX(Length length) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, std::move(length)); }
+ void setPerspectiveOriginY(Length length) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, std::move(length)); }
+ void setPageSize(LengthSize size) { SET_VAR(rareNonInheritedData, m_pageSize, std::move(size)); }
void setPageSizeType(PageSizeType t) { SET_VAR(rareNonInheritedData, m_pageSizeType, t); }
void resetPageSizeType() { SET_VAR(rareNonInheritedData, m_pageSizeType, PAGE_SIZE_AUTO); }
+#if USE(ACCELERATED_COMPOSITING)
void setIsRunningAcceleratedAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_runningAcceleratedAnimation, b); }
+#endif
void setLineBoxContain(LineBoxContain c) { SET_VAR(rareInheritedData, m_lineBoxContain, c); }
void setLineClamp(LineClampValue c) { SET_VAR(rareNonInheritedData, lineClamp, c); }
-
- void setInitialLetter(const IntSize& size) { SET_VAR(rareNonInheritedData, m_initialLetter, size); }
-
-#if ENABLE(TOUCH_EVENTS)
- void setTouchAction(TouchAction touchAction) { SET_VAR(rareNonInheritedData, m_touchAction, static_cast<unsigned>(touchAction)); }
-#endif
-
-#if ENABLE(CSS_SCROLL_SNAP)
- void setScrollSnapType(ScrollSnapType type) { SET_VAR(rareNonInheritedData, m_scrollSnapType, static_cast<unsigned>(type)); }
- void setScrollSnapPointsX(std::unique_ptr<ScrollSnapPoints>);
- void setScrollSnapPointsY(std::unique_ptr<ScrollSnapPoints>);
- void setScrollSnapDestination(LengthSize);
- void setScrollSnapCoordinates(Vector<LengthSize>);
-#endif
-
#if ENABLE(TOUCH_EVENTS)
void setTapHighlightColor(const Color& c) { SET_VAR(rareInheritedData, tapHighlightColor, c); }
#endif
-
#if PLATFORM(IOS)
void setTouchCalloutEnabled(bool v) { SET_VAR(rareInheritedData, touchCalloutEnabled, v); }
+ void setCompositionFillColor(const Color &c) { SET_VAR(rareInheritedData, compositionFillColor, c); }
#endif
-
#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
void setUseTouchOverflowScrolling(bool v) { SET_VAR(rareInheritedData, useTouchOverflowScrolling, v); }
#endif
-
#if ENABLE(IOS_TEXT_AUTOSIZING)
void setTextSizeAdjust(TextSizeAdjustment anAdjustment) { SET_VAR(rareInheritedData, textSizeAdjust, anAdjustment); }
#endif
-
void setTextSecurity(ETextSecurity aTextSecurity) { SET_VAR(rareInheritedData, textSecurity, aTextSecurity); }
-#if ENABLE(CSS_TRAILING_WORD)
- void setTrailingWord(TrailingWord v) { SET_VAR(rareInheritedData, trailingWord, static_cast<unsigned>(v)); }
-#endif
-
+#if ENABLE(SVG)
const SVGRenderStyle& svgStyle() const { return *m_svgStyle; }
SVGRenderStyle& accessSVGStyle() { return *m_svgStyle.access(); }
@@ -1714,30 +1471,15 @@ public:
void setStrokePaintColor(const Color& c) { accessSVGStyle().setStrokePaint(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, c, ""); }
float strokeOpacity() const { return svgStyle().strokeOpacity(); }
void setStrokeOpacity(float f) { accessSVGStyle().setStrokeOpacity(f); }
- const Length& strokeWidth() const { return svgStyle().strokeWidth(); }
- void setStrokeWidth(Length w) { accessSVGStyle().setStrokeWidth(w); }
+ SVGLength strokeWidth() const { return svgStyle().strokeWidth(); }
+ void setStrokeWidth(SVGLength w) { accessSVGStyle().setStrokeWidth(w); }
Vector<SVGLength> strokeDashArray() const { return svgStyle().strokeDashArray(); }
void setStrokeDashArray(Vector<SVGLength> array) { accessSVGStyle().setStrokeDashArray(array); }
- const Length& strokeDashOffset() const { return svgStyle().strokeDashOffset(); }
- void setStrokeDashOffset(Length d) { accessSVGStyle().setStrokeDashOffset(d); }
+ SVGLength strokeDashOffset() const { return svgStyle().strokeDashOffset(); }
+ void setStrokeDashOffset(SVGLength d) { accessSVGStyle().setStrokeDashOffset(d); }
float strokeMiterLimit() const { return svgStyle().strokeMiterLimit(); }
void setStrokeMiterLimit(float f) { accessSVGStyle().setStrokeMiterLimit(f); }
- const Length& cx() const { return svgStyle().cx(); }
- void setCx(Length cx) { accessSVGStyle().setCx(cx); }
- const Length& cy() const { return svgStyle().cy(); }
- void setCy(Length cy) { accessSVGStyle().setCy(cy); }
- const Length& r() const { return svgStyle().r(); }
- void setR(Length r) { accessSVGStyle().setR(r); }
- const Length& rx() const { return svgStyle().rx(); }
- void setRx(Length rx) { accessSVGStyle().setRx(rx); }
- const Length& ry() const { return svgStyle().ry(); }
- void setRy(Length ry) { accessSVGStyle().setRy(ry); }
- const Length& x() const { return svgStyle().x(); }
- void setX(Length x) { accessSVGStyle().setX(x); }
- const Length& y() const { return svgStyle().y(); }
- void setY(Length y) { accessSVGStyle().setY(y); }
-
float floodOpacity() const { return svgStyle().floodOpacity(); }
void setFloodOpacity(float f) { accessSVGStyle().setFloodOpacity(f); }
@@ -1752,8 +1494,24 @@ public:
void setBaselineShiftValue(SVGLength s) { accessSVGStyle().setBaselineShiftValue(s); }
SVGLength kerning() const { return svgStyle().kerning(); }
void setKerning(SVGLength k) { accessSVGStyle().setKerning(k); }
+#endif
#if ENABLE(CSS_SHAPES)
+ void setShapeInside(PassRefPtr<ShapeValue> value)
+ {
+ if (rareNonInheritedData->m_shapeInside == value)
+ return;
+ rareNonInheritedData.access()->m_shapeInside = value;
+ }
+ ShapeValue* shapeInside() const { return rareNonInheritedData->m_shapeInside.get(); }
+ ShapeValue* resolvedShapeInside() const
+ {
+ ShapeValue* shapeInside = this->shapeInside();
+ if (shapeInside && shapeInside->type() == ShapeValue::Outside)
+ return shapeOutside();
+ return shapeInside;
+ }
+
void setShapeOutside(PassRefPtr<ShapeValue> value)
{
if (rareNonInheritedData->m_shapeOutside == value)
@@ -1762,10 +1520,15 @@ public:
}
ShapeValue* shapeOutside() const { return rareNonInheritedData->m_shapeOutside.get(); }
+ static ShapeValue* initialShapeInside() { return 0; }
static ShapeValue* initialShapeOutside() { return 0; }
+ const Length& shapePadding() const { return rareNonInheritedData->m_shapePadding; }
+ void setShapePadding(Length shapePadding) { SET_VAR(rareNonInheritedData, m_shapePadding, std::move(shapePadding)); }
+ static Length initialShapePadding() { return Length(0, Fixed); }
+
const Length& shapeMargin() const { return rareNonInheritedData->m_shapeMargin; }
- void setShapeMargin(Length shapeMargin) { SET_VAR(rareNonInheritedData, m_shapeMargin, WTFMove(shapeMargin)); }
+ void setShapeMargin(Length shapeMargin) { SET_VAR(rareNonInheritedData, m_shapeMargin, std::move(shapeMargin)); }
static Length initialShapeMargin() { return Length(0, Fixed); }
float shapeImageThreshold() const { return rareNonInheritedData->m_shapeImageThreshold; }
@@ -1784,7 +1547,7 @@ public:
}
ClipPathOperation* clipPath() const { return rareNonInheritedData->m_clipPath.get(); }
- static ClipPathOperation* initialClipPath() { return nullptr; }
+ static ClipPathOperation* initialClipPath() { return 0; }
bool hasContent() const { return contentData(); }
const ContentData* contentData() const { return rareNonInheritedData->m_content.get(); }
@@ -1804,17 +1567,6 @@ public:
QuotesData* quotes() const { return rareInheritedData->quotes.get(); }
void setQuotes(PassRefPtr<QuotesData>);
- WillChangeData* willChange() const { return rareNonInheritedData->m_willChange.get(); }
- void setWillChange(PassRefPtr<WillChangeData>);
-
- bool willChangeCreatesStackingContext() const
- {
- if (!willChange())
- return false;
-
- return willChange()->canCreateStackingContext();
- }
-
const AtomicString& hyphenString() const;
bool inheritedNotEqual(const RenderStyle*) const;
@@ -1825,14 +1577,12 @@ public:
bool equalForTextAutosizing(const RenderStyle *other) const;
#endif
- StyleDifference diff(const RenderStyle&, unsigned& changedContextSensitiveProperties) const;
- bool diffRequiresLayerRepaint(const RenderStyle&, bool isComposited) const;
+ StyleDifference diff(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
+ bool diffRequiresRepaint(const RenderStyle*) const;
bool isDisplayReplacedType() const { return isDisplayReplacedType(display()); }
bool isDisplayInlineType() const { return isDisplayInlineType(display()); }
bool isOriginalDisplayInlineType() const { return isDisplayInlineType(originalDisplay()); }
- bool isDisplayFlexibleOrGridBox() const { return isDisplayFlexibleOrGridBox(display()); }
- bool isDisplayFlexibleBox() const { return isDisplayFlexibleBox(display()); }
bool isDisplayRegionType() const
{
return display() == BLOCK || display() == INLINE_BLOCK
@@ -1849,90 +1599,82 @@ public:
return true;
}
- bool hasExplicitlySetWritingMode() const { return noninherited_flags.hasExplicitlySetWritingMode(); }
- void setHasExplicitlySetWritingMode(bool v) { noninherited_flags.setHasExplicitlySetWritingMode(v); }
-
// A unique style is one that has matches something that makes it impossible to share.
- bool unique() const { return noninherited_flags.isUnique(); }
- void setUnique() { noninherited_flags.setIsUnique(); }
+ bool unique() const { return noninherited_flags.unique; }
+ void setUnique() { noninherited_flags.unique = true; }
- bool emptyState() const { return noninherited_flags.emptyState(); }
- void setEmptyState(bool b) { setUnique(); noninherited_flags.setEmptyState(b); }
- bool firstChildState() const { return noninherited_flags.firstChildState(); }
- void setFirstChildState() { setUnique(); noninherited_flags.setFirstChildState(true); }
- bool lastChildState() const { return noninherited_flags.lastChildState(); }
- void setLastChildState() { setUnique(); noninherited_flags.setLastChildState(true); }
+ bool emptyState() const { return noninherited_flags.emptyState; }
+ void setEmptyState(bool b) { setUnique(); noninherited_flags.emptyState = b; }
+ bool firstChildState() const { return noninherited_flags.firstChildState; }
+ void setFirstChildState() { setUnique(); noninherited_flags.firstChildState = true; }
+ bool lastChildState() const { return noninherited_flags.lastChildState; }
+ void setLastChildState() { setUnique(); noninherited_flags.lastChildState = true; }
- WEBCORE_EXPORT Color visitedDependentColor(int colorProperty) const;
- bool backgroundColorEqualsToColorIgnoringVisited(const Color& color) const { return color == backgroundColor(); }
+ Color visitedDependentColor(int colorProperty) const;
- void setHasExplicitlyInheritedProperties() { noninherited_flags.setHasExplicitlyInheritedProperties(true); }
- bool hasExplicitlyInheritedProperties() const { return noninherited_flags.hasExplicitlyInheritedProperties(); }
+ void setHasExplicitlyInheritedProperties() { noninherited_flags.explicitInheritance = true; }
+ bool hasExplicitlyInheritedProperties() const { return noninherited_flags.explicitInheritance; }
// Initial values for all the properties
- static EOverflow initialOverflowX() { return OVISIBLE; }
- static EOverflow initialOverflowY() { return OVISIBLE; }
- static EClear initialClear() { return CNONE; }
- static EDisplay initialDisplay() { return INLINE; }
- static EUnicodeBidi initialUnicodeBidi() { return UBNormal; }
- static EPosition initialPosition() { return StaticPosition; }
- static EVerticalAlign initialVerticalAlign() { return BASELINE; }
- static EFloat initialFloating() { return NoFloat; }
- static BreakBetween initialBreakBetween() { return AutoBreakBetween; }
- static BreakInside initialBreakInside() { return AutoBreakInside; }
- static HangingPunctuation initialHangingPunctuation() { return NoHangingPunctuation; }
- static ETableLayout initialTableLayout() { return TAUTO; }
static EBorderCollapse initialBorderCollapse() { return BSEPARATE; }
static EBorderStyle initialBorderStyle() { return BNONE; }
static OutlineIsAuto initialOutlineStyleIsAuto() { return AUTO_OFF; }
static NinePieceImage initialNinePieceImage() { return NinePieceImage(); }
static LengthSize initialBorderRadius() { return LengthSize(Length(0, Fixed), Length(0, Fixed)); }
static ECaptionSide initialCaptionSide() { return CAPTOP; }
+ static EClear initialClear() { return CNONE; }
+ static ColorSpace initialColorSpace() { return ColorSpaceDeviceRGB; }
static ColumnAxis initialColumnAxis() { return AutoColumnAxis; }
static ColumnProgression initialColumnProgression() { return NormalColumnProgression; }
static TextDirection initialDirection() { return LTR; }
static WritingMode initialWritingMode() { return TopToBottomWritingMode; }
static TextCombine initialTextCombine() { return TextCombineNone; }
- static TextOrientation initialTextOrientation() { return TextOrientation::
- Mixed; }
+ static TextOrientation initialTextOrientation() { return TextOrientationVerticalRight; }
static ObjectFit initialObjectFit() { return ObjectFitFill; }
+ static EDisplay initialDisplay() { return INLINE; }
static EEmptyCell initialEmptyCells() { return SHOW; }
+ static EFloat initialFloating() { return NoFloat; }
static EListStylePosition initialListStylePosition() { return OUTSIDE; }
static EListStyleType initialListStyleType() { return Disc; }
+ static EOverflow initialOverflowX() { return OVISIBLE; }
+ static EOverflow initialOverflowY() { return OVISIBLE; }
+ static EPageBreak initialPageBreak() { return PBAUTO; }
+ static EPosition initialPosition() { return StaticPosition; }
+ static ETableLayout initialTableLayout() { return TAUTO; }
+ static EUnicodeBidi initialUnicodeBidi() { return UBNormal; }
static ETextTransform initialTextTransform() { return TTNONE; }
static EVisibility initialVisibility() { return VISIBLE; }
static EWhiteSpace initialWhiteSpace() { return NORMAL; }
static short initialHorizontalBorderSpacing() { return 0; }
static short initialVerticalBorderSpacing() { return 0; }
- static ECursor initialCursor() { return CursorAuto; }
+ static ECursor initialCursor() { return CURSOR_AUTO; }
#if ENABLE(CURSOR_VISIBILITY)
static CursorVisibility initialCursorVisibility() { return CursorVisibilityAuto; }
#endif
static Color initialColor() { return Color::black; }
static StyleImage* initialListStyleImage() { return 0; }
- static float initialBorderWidth() { return 3; }
+ static unsigned initialBorderWidth() { return 3; }
static unsigned short initialColumnRuleWidth() { return 3; }
- static float initialOutlineWidth() { return 3; }
+ static unsigned short initialOutlineWidth() { return 3; }
static float initialLetterSpacing() { return 0; }
static Length initialWordSpacing() { return Length(Fixed); }
static Length initialSize() { return Length(); }
- static Length initialMinSize() { return Length(); }
+ static Length initialMinSize() { return Length(Fixed); }
static Length initialMaxSize() { return Length(Undefined); }
static Length initialOffset() { return Length(); }
static Length initialMargin() { return Length(Fixed); }
static Length initialPadding() { return Length(Fixed); }
static Length initialTextIndent() { return Length(Fixed); }
- static Length initialZeroLength() { return Length(Fixed); }
- static Length initialOneLength() { return Length(1, Fixed); }
#if ENABLE(CSS3_TEXT)
static TextIndentLine initialTextIndentLine() { return TextIndentFirstLine; }
static TextIndentType initialTextIndentType() { return TextIndentNormal; }
#endif
+ static EVerticalAlign initialVerticalAlign() { return BASELINE; }
static short initialWidows() { return 2; }
static short initialOrphans() { return 2; }
- static Length initialLineHeight() { return Length(-100.0f, Percent); }
+ static Length initialLineHeight() { return Length(-100.0, Percent); }
#if ENABLE(IOS_TEXT_AUTOSIZING)
- static Length initialSpecifiedLineHeight() { return Length(-100.0f, Percent); }
+ static Length initialSpecifiedLineHeight() { return Length(-100, Percent); }
#endif
static ETextAlign initialTextAlign() { return TASTART; }
static TextDecoration initialTextDecoration() { return TextDecorationNone; }
@@ -1941,11 +1683,10 @@ public:
static TextJustify initialTextJustify() { return TextJustifyAuto; }
#endif // CSS3_TEXT
static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyleSolid; }
- static TextDecorationSkip initialTextDecorationSkip() { return TextDecorationSkipAuto; }
+ static TextDecorationSkip initialTextDecorationSkip() { return TextDecorationSkipInk; }
static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnderlinePositionAuto; }
static float initialZoom() { return 1.0f; }
- static TextZoom initialTextZoom() { return TextZoomNormal; }
- static float initialOutlineOffset() { return 0; }
+ static int initialOutlineOffset() { return 0; }
static float initialOpacity() { return 1.0f; }
static EBoxAlignment initialBoxAlign() { return BSTRETCH; }
static EBoxDecorationBreak initialBoxDecorationBreak() { return DSLICE; }
@@ -1962,10 +1703,12 @@ public:
static float initialFlexShrink() { return 1; }
static Length initialFlexBasis() { return Length(Auto); }
static int initialOrder() { return 0; }
- static StyleSelfAlignmentData initialSelfAlignment() { return StyleSelfAlignmentData(ItemPositionAuto, OverflowAlignmentDefault); }
- static StyleContentAlignmentData initialContentAlignment() { return StyleContentAlignmentData(ContentPositionAuto, ContentDistributionDefault, OverflowAlignmentDefault); }
+ static EAlignContent initialAlignContent() { return AlignContentStretch; }
+ static EAlignItems initialAlignItems() { return AlignStretch; }
+ static EAlignItems initialAlignSelf() { return AlignAuto; }
static EFlexDirection initialFlexDirection() { return FlowRow; }
static EFlexWrap initialFlexWrap() { return FlexNoWrap; }
+ static EJustifyContent initialJustifyContent() { return JustifyFlexStart; }
static int initialMarqueeLoopCount() { return -1; }
static int initialMarqueeSpeed() { return 85; }
static Length initialMarqueeIncrement() { return Length(6, Fixed); }
@@ -1981,16 +1724,18 @@ public:
static EOverflowWrap initialOverflowWrap() { return NormalOverflowWrap; }
static ENBSPMode initialNBSPMode() { return NBNORMAL; }
static LineBreak initialLineBreak() { return LineBreakAuto; }
+ static const AtomicString& initialHighlight() { return nullAtom; }
static ESpeak initialSpeak() { return SpeakNormal; }
static Hyphens initialHyphens() { return HyphensManual; }
static short initialHyphenationLimitBefore() { return -1; }
static short initialHyphenationLimitAfter() { return -1; }
static short initialHyphenationLimitLines() { return -1; }
static const AtomicString& initialHyphenationString() { return nullAtom; }
+ static const AtomicString& initialLocale() { return nullAtom; }
static EBorderFit initialBorderFit() { return BorderFitBorder; }
static EResize initialResize() { return RESIZE_NONE; }
static ControlPart initialAppearance() { return NoControlPart; }
- static AspectRatioType initialAspectRatioType() { return AspectRatioAuto; }
+ static bool initialHasAspectRatio() { return false; }
static float initialAspectRatioDenominator() { return 1; }
static float initialAspectRatioNumerator() { return 1; }
static Order initialRTLOrdering() { return LogicalOrder; }
@@ -1998,16 +1743,16 @@ public:
static unsigned short initialColumnCount() { return 1; }
static ColumnFill initialColumnFill() { return ColumnFillBalance; }
static ColumnSpan initialColumnSpan() { return ColumnSpanNone; }
- static const TransformOperations& initialTransform() { static NeverDestroyed<TransformOperations> ops; return ops; }
- static Length initialTransformOriginX() { return Length(50.0f, Percent); }
- static Length initialTransformOriginY() { return Length(50.0f, Percent); }
+ static const TransformOperations& initialTransform() { DEFINE_STATIC_LOCAL(TransformOperations, ops, ()); return ops; }
+ static Length initialTransformOriginX() { return Length(50.0, Percent); }
+ static Length initialTransformOriginY() { return Length(50.0, Percent); }
static EPointerEvents initialPointerEvents() { return PE_AUTO; }
static float initialTransformOriginZ() { return 0; }
static ETransformStyle3D initialTransformStyle3D() { return TransformStyle3DFlat; }
static EBackfaceVisibility initialBackfaceVisibility() { return BackfaceVisibilityVisible; }
static float initialPerspective() { return 0; }
- static Length initialPerspectiveOriginX() { return Length(50.0f, Percent); }
- static Length initialPerspectiveOriginY() { return Length(50.0f, Percent); }
+ static Length initialPerspectiveOriginX() { return Length(50.0, Percent); }
+ static Length initialPerspectiveOriginY() { return Length(50.0, Percent); }
static Color initialBackgroundColor() { return Color::transparent; }
static Color initialTextEmphasisColor() { return TextEmphasisFillFilled; }
static TextEmphasisFill initialTextEmphasisFill() { return TextEmphasisFillFilled; }
@@ -2021,39 +1766,18 @@ public:
static ImageResolutionSource initialImageResolutionSource() { return ImageResolutionSpecified; }
static ImageResolutionSnap initialImageResolutionSnap() { return ImageResolutionNoSnap; }
static float initialImageResolution() { return 1; }
- static StyleImage* initialBorderImageSource() { return nullptr; }
- static StyleImage* initialMaskBoxImageSource() { return nullptr; }
+ static StyleImage* initialBorderImageSource() { return 0; }
+ static StyleImage* initialMaskBoxImageSource() { return 0; }
static PrintColorAdjust initialPrintColorAdjust() { return PrintColorAdjustEconomy; }
- static QuotesData* initialQuotes() { return nullptr; }
- static const AtomicString& initialContentAltText() { return emptyAtom; }
-
- static WillChangeData* initialWillChange() { return nullptr; }
-
-#if ENABLE(TOUCH_EVENTS)
- static TouchAction initialTouchAction() { return TouchAction::Auto; }
-#endif
-
-#if ENABLE(CSS_SCROLL_SNAP)
- static ScrollSnapType initialScrollSnapType() { return ScrollSnapType::None; }
- static ScrollSnapPoints* initialScrollSnapPointsX() { return nullptr; }
- static ScrollSnapPoints* initialScrollSnapPointsY() { return nullptr; }
- static LengthSize initialScrollSnapDestination();
- static Vector<LengthSize> initialScrollSnapCoordinates();
-#endif
-#if ENABLE(CSS_TRAILING_WORD)
- static TrailingWord initialTrailingWord() { return TrailingWord::Auto; }
-#endif
-
-#if ENABLE(CSS_GRID_LAYOUT)
// The initial value is 'none' for grid tracks.
static Vector<GridTrackSize> initialGridColumns() { return Vector<GridTrackSize>(); }
static Vector<GridTrackSize> initialGridRows() { return Vector<GridTrackSize>(); }
- static GridAutoFlow initialGridAutoFlow() { return AutoFlowRow; }
+ static GridAutoFlow initialGridAutoFlow() { return AutoFlowNone; }
- static GridTrackSize initialGridAutoColumns() { return GridTrackSize(Length(Auto)); }
- static GridTrackSize initialGridAutoRows() { return GridTrackSize(Length(Auto)); }
+ static GridTrackSize initialGridAutoColumns() { return GridTrackSize(Auto); }
+ static GridTrackSize initialGridAutoRows() { return GridTrackSize(Auto); }
static NamedGridAreaMap initialNamedGridArea() { return NamedGridAreaMap(); }
static size_t initialNamedGridAreaCount() { return 0; }
@@ -2061,18 +1785,11 @@ public:
static NamedGridLinesMap initialNamedGridColumnLines() { return NamedGridLinesMap(); }
static NamedGridLinesMap initialNamedGridRowLines() { return NamedGridLinesMap(); }
- static OrderedNamedGridLinesMap initialOrderedNamedGridColumnLines() { return OrderedNamedGridLinesMap(); }
- static OrderedNamedGridLinesMap initialOrderedNamedGridRowLines() { return OrderedNamedGridLinesMap(); }
-
- static Length initialGridColumnGap() { return Length(Fixed); }
- static Length initialGridRowGap() { return Length(Fixed); }
-
// 'auto' is the default.
static GridPosition initialGridItemColumnStart() { return GridPosition(); }
static GridPosition initialGridItemColumnEnd() { return GridPosition(); }
static GridPosition initialGridItemRowStart() { return GridPosition(); }
static GridPosition initialGridItemRowEnd() { return GridPosition(); }
-#endif /* ENABLE(CSS_GRID_LAYOUT) */
static unsigned initialTabSize() { return 8; }
@@ -2084,8 +1801,10 @@ public:
static const AtomicString& initialRegionThread() { return nullAtom; }
static RegionFragment initialRegionFragment() { return AutoRegionFragment; }
+ static WrapFlow initialWrapFlow() { return WrapFlowAuto; }
+ static WrapThrough initialWrapThrough() { return WrapThroughWrap; }
+
// Keep these at the end.
- static IntSize initialInitialLetter() { return IntSize(); }
static LineClampValue initialLineClamp() { return LineClampValue(); }
static ETextSecurity initialTextSecurity() { return TSNONE; }
#if ENABLE(IOS_TEXT_AUTOSIZING)
@@ -2093,6 +1812,7 @@ public:
#endif
#if PLATFORM(IOS)
static bool initialTouchCalloutEnabled() { return true; }
+ static Color initialCompositionFillColor() { return Color::compositionFill; }
#endif
#if ENABLE(TOUCH_EVENTS)
static Color initialTapHighlightColor();
@@ -2104,25 +1824,20 @@ public:
static const Vector<StyleDashboardRegion>& initialDashboardRegions();
static const Vector<StyleDashboardRegion>& noneDashboardRegions();
#endif
- static const FilterOperations& initialFilter() { static NeverDestroyed<FilterOperations> ops; return ops; }
-#if ENABLE(FILTERS_LEVEL_2)
- static const FilterOperations& initialBackdropFilter() { static NeverDestroyed<FilterOperations> ops; return ops; }
+#if ENABLE(CSS_FILTERS)
+ static const FilterOperations& initialFilter() { DEFINE_STATIC_LOCAL(FilterOperations, ops, ()); return ops; }
#endif
#if ENABLE(CSS_COMPOSITING)
static BlendMode initialBlendMode() { return BlendModeNormal; }
- static Isolation initialIsolation() { return IsolationAuto; }
#endif
- static ptrdiff_t noninheritedFlagsMemoryOffset() { return OBJECT_OFFSETOF(RenderStyle, noninherited_flags); }
-
private:
- bool changeAffectsVisualOverflow(const RenderStyle&) const;
- bool changeRequiresLayout(const RenderStyle&, unsigned& changedContextSensitiveProperties) const;
- bool changeRequiresPositionedLayoutOnly(const RenderStyle&, unsigned& changedContextSensitiveProperties) const;
- bool changeRequiresLayerRepaint(const RenderStyle&, unsigned& changedContextSensitiveProperties) const;
- bool changeRequiresRepaint(const RenderStyle&, unsigned& changedContextSensitiveProperties) const;
- bool changeRequiresRepaintIfTextOrBorderOrOutline(const RenderStyle&, unsigned& changedContextSensitiveProperties) const;
- bool changeRequiresRecompositeLayer(const RenderStyle&, unsigned& changedContextSensitiveProperties) const;
+ bool changeRequiresLayout(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
+ bool changeRequiresPositionedLayoutOnly(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
+ bool changeRequiresLayerRepaint(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
+ bool changeRequiresRepaint(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
+ bool changeRequiresRepaintIfTextOrBorderOrOutline(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
+ bool changeRequiresRecompositeLayer(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
void setVisitedLinkColor(const Color&);
void setVisitedLinkBackgroundColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBackgroundColor, v); }
@@ -2131,13 +1846,13 @@ private:
void setVisitedLinkBorderBottomColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderBottomColor, v); }
void setVisitedLinkBorderTopColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderTopColor, v); }
void setVisitedLinkOutlineColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkOutlineColor, v); }
- void setVisitedLinkColumnRuleColor(const Color& v) { SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_visitedLinkColumnRuleColor, v); }
+ void setVisitedLinkColumnRuleColor(const Color& v) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_visitedLinkColumnRuleColor, v); }
void setVisitedLinkTextDecorationColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkTextDecorationColor, v); }
void setVisitedLinkTextEmphasisColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextEmphasisColor, v); }
void setVisitedLinkTextFillColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextFillColor, v); }
void setVisitedLinkTextStrokeColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextStrokeColor, v); }
- void inheritUnicodeBidiFrom(const RenderStyle* parent) { noninherited_flags.setUnicodeBidi(parent->noninherited_flags.unicodeBidi()); }
+ void inheritUnicodeBidiFrom(const RenderStyle* parent) { noninherited_flags._unicodeBidi = parent->noninherited_flags._unicodeBidi; }
void getShadowExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const;
LayoutBoxExtent getShadowInsetExtent(const ShadowData*) const;
void getShadowHorizontalExtent(const ShadowData*, LayoutUnit& left, LayoutUnit& right) const;
@@ -2154,10 +1869,7 @@ private:
bool isDisplayReplacedType(EDisplay display) const
{
return display == INLINE_BLOCK || display == INLINE_BOX || display == INLINE_FLEX
-#if ENABLE(CSS_GRID_LAYOUT)
- || display == INLINE_GRID
-#endif
- || display == INLINE_TABLE;
+ || display == INLINE_TABLE || display == INLINE_GRID;
}
bool isDisplayInlineType(EDisplay display) const
@@ -2165,28 +1877,8 @@ private:
return display == INLINE || isDisplayReplacedType(display);
}
- bool isDisplayFlexibleBox(EDisplay display) const
- {
- return display == FLEX || display == INLINE_FLEX;
- }
-
- bool isDisplayGridBox(EDisplay display) const
- {
-#if ENABLE(CSS_GRID_LAYOUT)
- return display == GRID || display == INLINE_GRID;
-#else
- UNUSED_PARAM(display);
- return false;
-#endif
- }
-
- bool isDisplayFlexibleOrGridBox(EDisplay display) const
- {
- return isDisplayFlexibleBox(display) || isDisplayGridBox(display);
- }
-
// Color accessors are all private to make sure callers use visitedDependentColor instead to access them.
- static Color invalidColor() { return Color(); }
+ Color invalidColor() const { static Color invalid; return invalid; }
Color borderLeftColor() const { return surround->border.left().color(); }
Color borderRightColor() const { return surround->border.right().color(); }
Color borderTopColor() const { return surround->border.top().color(); }
@@ -2214,9 +1906,11 @@ private:
Color colorIncludingFallback(int colorProperty, bool visitedLink) const;
+#if ENABLE(SVG)
Color stopColor() const { return svgStyle().stopColor(); }
Color floodColor() const { return svgStyle().floodColor(); }
Color lightingColor() const { return svgStyle().lightingColor(); }
+#endif
void appendContent(std::unique_ptr<ContentData>);
};
@@ -2237,31 +1931,24 @@ inline int adjustForAbsoluteZoom(int value, const RenderStyle& style)
return roundForImpreciseConversion<int>(value / zoomFactor);
}
-inline float adjustFloatForAbsoluteZoom(float value, const RenderStyle& style)
+inline float adjustFloatForAbsoluteZoom(float value, const RenderStyle* style)
{
- return value / style.effectiveZoom();
+ return value / style->effectiveZoom();
}
+#if ENABLE(SUBPIXEL_LAYOUT)
inline LayoutUnit adjustLayoutUnitForAbsoluteZoom(LayoutUnit value, const RenderStyle& style)
{
return value / style.effectiveZoom();
}
-
-inline EBorderStyle collapsedBorderStyle(EBorderStyle style)
-{
- if (style == OUTSET)
- return GROOVE;
- if (style == INSET)
- return RIDGE;
- return style;
-}
+#endif
inline bool RenderStyle::setZoom(float f)
{
- setEffectiveZoom(effectiveZoom() * f);
if (compareEqual(visual->m_zoom, f))
return false;
visual.access()->m_zoom = f;
+ setEffectiveZoom(effectiveZoom() * zoom());
return true;
}
@@ -2275,31 +1962,30 @@ inline bool RenderStyle::setEffectiveZoom(float f)
inline bool RenderStyle::setTextOrientation(TextOrientation textOrientation)
{
- if (compareEqual(rareInheritedData->m_textOrientation, static_cast<unsigned>(textOrientation)))
+ if (compareEqual(rareInheritedData->m_textOrientation, textOrientation))
return false;
- rareInheritedData.access()->m_textOrientation = static_cast<unsigned>(textOrientation);
+ rareInheritedData.access()->m_textOrientation = textOrientation;
return true;
}
inline bool RenderStyle::hasAnyPublicPseudoStyles() const
{
- return noninherited_flags.hasAnyPublicPseudoStyles();
+ return PUBLIC_PSEUDOID_MASK & noninherited_flags._pseudoBits;
}
inline bool RenderStyle::hasPseudoStyle(PseudoId pseudo) const
{
- return noninherited_flags.hasPseudoStyle(pseudo);
+ ASSERT(pseudo > NOPSEUDO);
+ ASSERT(pseudo < FIRST_INTERNAL_PSEUDOID);
+ return (1 << (pseudo - 1)) & noninherited_flags._pseudoBits;
}
inline void RenderStyle::setHasPseudoStyle(PseudoId pseudo)
{
- noninherited_flags.setHasPseudoStyle(pseudo);
-}
-
-inline void RenderStyle::setHasPseudoStyles(PseudoIdSet pseudoIdSet)
-{
- noninherited_flags.setHasPseudoStyles(pseudoIdSet);
+ ASSERT(pseudo > NOPSEUDO);
+ ASSERT(pseudo < FIRST_INTERNAL_PSEUDOID);
+ noninherited_flags._pseudoBits |= 1 << (pseudo - 1);
}
} // namespace WebCore
diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.cpp b/Source/WebCore/rendering/style/RenderStyleConstants.cpp
deleted file mode 100644
index f13cd7bd9..000000000
--- a/Source/WebCore/rendering/style/RenderStyleConstants.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 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.
- */
-
-#include "config.h"
-#include "RenderStyleConstants.h"
-
-#include "TextStream.h"
-
-namespace WebCore {
-
-TextStream& operator<<(TextStream& ts, EFillSizeType sizeType)
-{
- switch (sizeType) {
- case Contain: ts << "contain"; break;
- case Cover: ts << "cover"; break;
- case SizeLength: ts << "size-length"; break;
- case SizeNone: ts << "size-none"; break;
- }
-
- return ts;
-}
-
-TextStream& operator<<(TextStream& ts, EFillAttachment attachment)
-{
- switch (attachment) {
- case ScrollBackgroundAttachment: ts << "scroll"; break;
- case LocalBackgroundAttachment: ts << "local"; break;
- case FixedBackgroundAttachment: ts << "fixed"; break;
- }
- return ts;
-}
-
-TextStream& operator<<(TextStream& ts, EFillBox fill)
-{
- switch (fill) {
- case BorderFillBox: ts << "border"; break;
- case PaddingFillBox: ts << "padding"; break;
- case ContentFillBox: ts << "content"; break;
- case TextFillBox: ts << "text"; break;
- }
- return ts;
-}
-
-TextStream& operator<<(TextStream& ts, EFillRepeat repeat)
-{
- switch (repeat) {
- case RepeatFill: ts << "repeat"; break;
- case NoRepeatFill: ts << "no-repeat"; break;
- case RoundFill: ts << "round"; break;
- case SpaceFill: ts << "space"; break;
- }
-
- return ts;
-}
-
-TextStream& operator<<(TextStream& ts, EMaskSourceType maskSource)
-{
- switch (maskSource) {
- case MaskAlpha: ts << "alpha"; break;
- case MaskLuminance: ts << "luminance"; break;
- }
-
- return ts;
-}
-
-TextStream& operator<<(TextStream& ts, Edge edge)
-{
- switch (edge) {
- case Edge::Top: ts << "top"; break;
- case Edge::Right: ts << "right"; break;
- case Edge::Bottom: ts << "bottom"; break;
- case Edge::Left: ts << "left"; break;
- }
- return ts;
-}
-
-bool alwaysPageBreak(BreakBetween between)
-{
- return between >= PageBreakBetween;
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.h b/Source/WebCore/rendering/style/RenderStyleConstants.h
index 492f78c4d..11b428559 100644
--- a/Source/WebCore/rendering/style/RenderStyleConstants.h
+++ b/Source/WebCore/rendering/style/RenderStyleConstants.h
@@ -26,12 +26,8 @@
#ifndef RenderStyleConstants_h
#define RenderStyleConstants_h
-#include <initializer_list>
-
namespace WebCore {
-class TextStream;
-
static const size_t PrintColorAdjustBits = 1;
enum PrintColorAdjust {
PrintColorAdjustEconomy,
@@ -50,15 +46,16 @@ enum PrintColorAdjust {
// - StyleDifferenceLayout - A full layout is required.
enum StyleDifference {
StyleDifferenceEqual,
+#if USE(ACCELERATED_COMPOSITING)
StyleDifferenceRecompositeLayer,
+#endif
StyleDifferenceRepaint,
StyleDifferenceRepaintIfTextOrBorderOrOutline,
StyleDifferenceRepaintLayer,
StyleDifferenceLayoutPositionedMovementOnly,
StyleDifferenceSimplifiedLayout,
StyleDifferenceSimplifiedLayoutAndPositionedMovement,
- StyleDifferenceLayout,
- StyleDifferenceNewStyle
+ StyleDifferenceLayout
};
// When some style properties change, different amounts of work have to be done depending on
@@ -66,91 +63,26 @@ enum StyleDifference {
// A simple StyleDifference does not provide enough information so we return a bit mask of
// StyleDifferenceContextSensitiveProperties from RenderStyle::diff() too.
enum StyleDifferenceContextSensitiveProperty {
- ContextSensitivePropertyNone = 0,
- ContextSensitivePropertyTransform = 1 << 0,
- ContextSensitivePropertyOpacity = 1 << 1,
- ContextSensitivePropertyFilter = 1 << 2,
- ContextSensitivePropertyClipRect = 1 << 3,
- ContextSensitivePropertyClipPath = 1 << 4,
- ContextSensitivePropertyWillChange = 1 << 5,
+ ContextSensitivePropertyNone = 0,
+ ContextSensitivePropertyTransform = (1 << 0),
+ ContextSensitivePropertyOpacity = (1 << 1),
+ ContextSensitivePropertyFilter = (1 << 2)
};
// Static pseudo styles. Dynamic ones are produced on the fly.
-enum PseudoId : unsigned char {
+enum PseudoId {
// The order must be NOP ID, public IDs, and then internal IDs.
NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION, FIRST_LINE_INHERITED, SCROLLBAR,
// Internal IDs follow:
SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER,
+ INPUT_LIST_BUTTON,
AFTER_LAST_INTERNAL_PSEUDOID,
+ FULL_SCREEN, FULL_SCREEN_DOCUMENT, FULL_SCREEN_ANCESTOR, ANIMATING_FULL_SCREEN_TRANSITION,
FIRST_PUBLIC_PSEUDOID = FIRST_LINE,
FIRST_INTERNAL_PSEUDOID = SCROLLBAR_THUMB,
PUBLIC_PSEUDOID_MASK = ((1 << FIRST_INTERNAL_PSEUDOID) - 1) & ~((1 << FIRST_PUBLIC_PSEUDOID) - 1)
};
-class PseudoIdSet {
-public:
- PseudoIdSet()
- : m_data(0)
- {
- }
-
- PseudoIdSet(std::initializer_list<PseudoId> initializerList)
- : m_data(0)
- {
- for (PseudoId pseudoId : initializerList)
- add(pseudoId);
- }
-
- static PseudoIdSet fromMask(unsigned rawPseudoIdSet)
- {
- return PseudoIdSet(rawPseudoIdSet);
- }
-
- bool has(PseudoId pseudoId) const
- {
- ASSERT((sizeof(m_data) * 8) > pseudoId);
- return m_data & (1U << pseudoId);
- }
-
- void add(PseudoId pseudoId)
- {
- ASSERT((sizeof(m_data) * 8) > pseudoId);
- m_data |= (1U << pseudoId);
- }
-
- void merge(PseudoIdSet source)
- {
- m_data |= source.m_data;
- }
-
- PseudoIdSet operator &(const PseudoIdSet& pseudoIdSet) const
- {
- return PseudoIdSet(m_data & pseudoIdSet.m_data);
- }
-
- PseudoIdSet operator |(const PseudoIdSet& pseudoIdSet) const
- {
- return PseudoIdSet(m_data | pseudoIdSet.m_data);
- }
-
- explicit operator bool() const
- {
- return m_data;
- }
-
- unsigned data() const { return m_data; }
-
- static ptrdiff_t dataMemoryOffset() { return OBJECT_OFFSETOF(PseudoIdSet, m_data); }
-
-private:
- explicit PseudoIdSet(unsigned rawPseudoIdSet)
- : m_data(rawPseudoIdSet)
- {
- }
-
- unsigned m_data;
-};
-
enum ColumnFill { ColumnFillBalance, ColumnFillAuto };
enum ColumnSpan { ColumnSpanNone = 0, ColumnSpanAll };
@@ -230,8 +162,8 @@ enum EFillLayerType {
// CSS3 Background Values
enum EFillSizeType { Contain, Cover, SizeLength, SizeNone };
-// CSS3 <position>
-enum class Edge { Top, Right, Bottom, Left };
+// CSS3 Background Position
+enum BackgroundEdgeOrigin { TopEdge, RightEdge, BottomEdge, LeftEdge };
// CSS3 Mask Source Types
enum EMaskSourceType { MaskAlpha, MaskLuminance };
@@ -252,13 +184,10 @@ enum EBoxDirection { BNORMAL, BREVERSE };
// CSS3 Flexbox Properties
enum EAlignContent { AlignContentFlexStart, AlignContentFlexEnd, AlignContentCenter, AlignContentSpaceBetween, AlignContentSpaceAround, AlignContentStretch };
+enum EAlignItems { AlignAuto, AlignFlexStart, AlignFlexEnd, AlignCenter, AlignStretch, AlignBaseline };
enum EFlexDirection { FlowRow, FlowRowReverse, FlowColumn, FlowColumnReverse };
enum EFlexWrap { FlexNoWrap, FlexWrap, FlexWrapReverse };
-enum ItemPosition {ItemPositionAuto, ItemPositionStretch, ItemPositionBaseline, ItemPositionLastBaseline, ItemPositionCenter, ItemPositionStart, ItemPositionEnd, ItemPositionSelfStart, ItemPositionSelfEnd, ItemPositionFlexStart, ItemPositionFlexEnd, ItemPositionLeft, ItemPositionRight};
-enum OverflowAlignment {OverflowAlignmentDefault, OverflowAlignmentUnsafe, OverflowAlignmentSafe};
-enum ItemPositionType {NonLegacyPosition, LegacyPosition};
-enum ContentPosition {ContentPositionAuto, ContentPositionBaseline, ContentPositionLastBaseline, ContentPositionCenter, ContentPositionStart, ContentPositionEnd, ContentPositionFlexStart, ContentPositionFlexEnd, ContentPositionLeft, ContentPositionRight};
-enum ContentDistributionType {ContentDistributionDefault, ContentDistributionSpaceBetween, ContentDistributionSpaceAround, ContentDistributionSpaceEvenly, ContentDistributionStretch};
+enum EJustifyContent { JustifyFlexStart, JustifyFlexEnd, JustifyCenter, JustifySpaceBetween, JustifySpaceAround };
enum ETextSecurity {
TSNONE, TSDISC, TSCIRCLE, TSSQUARE
@@ -287,12 +216,10 @@ enum ObjectFit {
ObjectFitFill, ObjectFitContain, ObjectFitCover, ObjectFitNone, ObjectFitScaleDown
};
-enum AspectRatioType {
- AspectRatioAuto, AspectRatioFromIntrinsic, AspectRatioFromDimensions, AspectRatioSpecified
-};
+// Word Break Values. Matches WinIE, rather than CSS3
enum EWordBreak {
- NormalWordBreak, BreakAllWordBreak, KeepAllWordBreak, BreakWordBreak
+ NormalWordBreak, BreakAllWordBreak, BreakWordBreak
};
enum EOverflowWrap {
@@ -454,15 +381,13 @@ enum TextAlignLast {
};
enum TextJustify {
- TextJustifyAuto, TextJustifyNone, TextJustifyInterWord, TextJustifyDistribute
+ TextJustifyAuto, TextJustifyNone, TextJustifyInterWord, TextJustifyInterIdeograph, TextJustifyInterCluster, TextJustifyDistribute, TextJustifyKashida
};
#endif // CSS3_TEXT
enum TextDecorationSkipItems {
TextDecorationSkipNone = 0,
- TextDecorationSkipInk = 1 << 0,
- TextDecorationSkipObjects = 1 << 1,
- TextDecorationSkipAuto = 1 << 2
+ TextDecorationSkipInk = 1 << 0
};
typedef unsigned TextDecorationSkip;
@@ -471,29 +396,10 @@ enum TextUnderlinePosition {
TextUnderlinePositionAuto = 0x1, TextUnderlinePositionAlphabetic = 0x2, TextUnderlinePositionUnder = 0x4
};
-enum TextZoom {
- TextZoomNormal, TextZoomReset
+enum EPageBreak {
+ PBAUTO, PBALWAYS, PBAVOID
};
-enum BreakBetween {
- AutoBreakBetween, AvoidBreakBetween, AvoidColumnBreakBetween, AvoidPageBreakBetween, AvoidRegionBreakBetween, ColumnBreakBetween, RegionBreakBetween, PageBreakBetween, LeftPageBreakBetween, RightPageBreakBetween, RectoPageBreakBetween, VersoPageBreakBetween
-};
-bool alwaysPageBreak(BreakBetween);
-
-enum BreakInside {
- AutoBreakInside, AvoidBreakInside, AvoidColumnBreakInside, AvoidPageBreakInside, AvoidRegionBreakInside
-};
-
-enum HangingPunctuation {
- NoHangingPunctuation = 0,
- FirstHangingPunctuation = 1 << 0,
- LastHangingPunctuation = 1 << 1,
- AllowEndHangingPunctuation = 1 << 2,
- ForceEndHangingPunctuation = 1 << 3
-};
-inline HangingPunctuation operator| (HangingPunctuation a, HangingPunctuation b) { return HangingPunctuation(int(a) | int(b)); }
-inline HangingPunctuation& operator|= (HangingPunctuation& a, HangingPunctuation b) { return a = a | b; }
-
enum EEmptyCell {
SHOW, HIDE
};
@@ -508,44 +414,44 @@ enum EVisibility { VISIBLE, HIDDEN, COLLAPSE };
enum ECursor {
// The following must match the order in CSSValueKeywords.in.
- CursorAuto,
- CursorCross,
- CursorDefault,
- CursorPointer,
- CursorMove,
- CursorVerticalText,
- CursorCell,
- CursorContextMenu,
- CursorAlias,
- CursorProgress,
- CursorNoDrop,
- CursorNotAllowed,
- CursorZoomIn,
- CursorZoomOut,
- CursorEResize,
- CursorNeResize,
- CursorNwResize,
- CursorNResize,
- CursorSeResize,
- CursorSwResize,
- CursorSResize,
- CursorWResize,
- CursorEwResize,
- CursorNsResize,
- CursorNeswResize,
- CursorNwseResize,
- CursorColResize,
- CursorRowResize,
- CursorText,
- CursorWait,
- CursorHelp,
- CursorAllScroll,
- CursorWebkitGrab,
- CursorWebkitGrabbing,
+ CURSOR_AUTO,
+ CURSOR_CROSS,
+ CURSOR_DEFAULT,
+ CURSOR_POINTER,
+ CURSOR_MOVE,
+ CURSOR_VERTICAL_TEXT,
+ CURSOR_CELL,
+ CURSOR_CONTEXT_MENU,
+ CURSOR_ALIAS,
+ CURSOR_PROGRESS,
+ CURSOR_NO_DROP,
+ CURSOR_NOT_ALLOWED,
+ CURSOR_WEBKIT_ZOOM_IN,
+ CURSOR_WEBKIT_ZOOM_OUT,
+ CURSOR_E_RESIZE,
+ CURSOR_NE_RESIZE,
+ CURSOR_NW_RESIZE,
+ CURSOR_N_RESIZE,
+ CURSOR_SE_RESIZE,
+ CURSOR_SW_RESIZE,
+ CURSOR_S_RESIZE,
+ CURSOR_W_RESIZE,
+ CURSOR_EW_RESIZE,
+ CURSOR_NS_RESIZE,
+ CURSOR_NESW_RESIZE,
+ CURSOR_NWSE_RESIZE,
+ CURSOR_COL_RESIZE,
+ CURSOR_ROW_RESIZE,
+ CURSOR_TEXT,
+ CURSOR_WAIT,
+ CURSOR_HELP,
+ CURSOR_ALL_SCROLL,
+ CURSOR_WEBKIT_GRAB,
+ CURSOR_WEBKIT_GRABBING,
// The following are handled as exceptions so don't need to match.
- CursorCopy,
- CursorNone
+ CURSOR_COPY,
+ CURSOR_NONE
};
#if ENABLE(CURSOR_VISIBILITY)
@@ -557,15 +463,13 @@ enum CursorVisibility {
// The order of this enum must match the order of the display values in CSSValueKeywords.in.
enum EDisplay {
- INLINE, BLOCK, LIST_ITEM, COMPACT, INLINE_BLOCK,
+ INLINE, BLOCK, LIST_ITEM, RUN_IN, COMPACT, INLINE_BLOCK,
TABLE, INLINE_TABLE, TABLE_ROW_GROUP,
TABLE_HEADER_GROUP, TABLE_FOOTER_GROUP, TABLE_ROW,
TABLE_COLUMN_GROUP, TABLE_COLUMN, TABLE_CELL,
TABLE_CAPTION, BOX, INLINE_BOX,
- FLEX, WEBKIT_FLEX, INLINE_FLEX, WEBKIT_INLINE_FLEX,
-#if ENABLE(CSS_GRID_LAYOUT)
+ FLEX, INLINE_FLEX,
GRID, INLINE_GRID,
-#endif
NONE
};
@@ -604,17 +508,11 @@ enum TextEmphasisPositions {
};
typedef unsigned TextEmphasisPosition;
-enum class TextOrientation { Mixed, Upright, Sideways };
+enum TextOrientation { TextOrientationVerticalRight, TextOrientationUpright, TextOrientationSideways, TextOrientationSidewaysRight };
enum TextOverflow { TextOverflowClip = 0, TextOverflowEllipsis };
-enum EImageRendering {
- ImageRenderingAuto = 0,
- ImageRenderingOptimizeSpeed,
- ImageRenderingOptimizeQuality,
- ImageRenderingCrispEdges,
- ImageRenderingPixelated
-};
+enum EImageRendering { ImageRenderingAuto = 0, ImageRenderingOptimizeSpeed, ImageRenderingOptimizeQuality, ImageRenderingCrispEdges };
enum ImageResolutionSource { ImageResolutionSpecified = 0, ImageResolutionFromImage };
@@ -632,27 +530,13 @@ enum LineSnap { LineSnapNone, LineSnapBaseline, LineSnapContain };
enum LineAlign { LineAlignNone, LineAlignEdges };
-enum RubyPosition { RubyPositionBefore, RubyPositionAfter, RubyPositionInterCharacter };
+enum WrapFlow { WrapFlowAuto, WrapFlowBoth, WrapFlowStart, WrapFlowEnd, WrapFlowMaximum, WrapFlowClear };
-#if ENABLE(CSS_GRID_LAYOUT)
-static const size_t GridAutoFlowBits = 4;
-enum InternalGridAutoFlowAlgorithm {
- InternalAutoFlowAlgorithmSparse = 0x1,
- InternalAutoFlowAlgorithmDense = 0x2,
-};
+enum WrapThrough { WrapThroughWrap, WrapThroughNone };
-enum InternalGridAutoFlowDirection {
- InternalAutoFlowDirectionRow = 0x4,
- InternalAutoFlowDirectionColumn = 0x8
-};
+enum RubyPosition { RubyPositionBefore, RubyPositionAfter };
-enum GridAutoFlow {
- AutoFlowRow = InternalAutoFlowAlgorithmSparse | InternalAutoFlowDirectionRow,
- AutoFlowColumn = InternalAutoFlowAlgorithmSparse | InternalAutoFlowDirectionColumn,
- AutoFlowRowDense = InternalAutoFlowAlgorithmDense | InternalAutoFlowDirectionRow,
- AutoFlowColumnDense = InternalAutoFlowAlgorithmDense | InternalAutoFlowDirectionColumn
-};
-#endif
+enum GridAutoFlow { AutoFlowNone, AutoFlowColumn, AutoFlowRow };
// Reasonable maximum to prevent insane font sizes from causing crashes on some platforms (such as Windows).
static const float maximumAllowedFontSize = 1000000.0f;
@@ -662,39 +546,7 @@ enum TextIndentLine { TextIndentFirstLine, TextIndentEachLine };
enum TextIndentType { TextIndentNormal, TextIndentHanging };
#endif
-enum Isolation { IsolationAuto, IsolationIsolate };
-
-// Fill, Stroke, ViewBox are just used for SVG.
-enum CSSBoxType { BoxMissing = 0, MarginBox, BorderBox, PaddingBox, ContentBox, Fill, Stroke, ViewBox };
-
-#if ENABLE(TOUCH_EVENTS)
-enum class TouchAction {
- Auto,
- Manipulation
-};
-#endif
-
-#if ENABLE(CSS_SCROLL_SNAP)
-enum class ScrollSnapType {
- None,
- Proximity,
- Mandatory
-};
-#endif
-
-#if ENABLE(CSS_TRAILING_WORD)
-enum class TrailingWord {
- Auto,
- PartiallyBalanced
-};
-#endif
-
-TextStream& operator<<(TextStream&, EFillSizeType);
-TextStream& operator<<(TextStream&, EFillAttachment);
-TextStream& operator<<(TextStream&, EFillBox);
-TextStream& operator<<(TextStream&, EFillRepeat);
-TextStream& operator<<(TextStream&, EMaskSourceType);
-TextStream& operator<<(TextStream&, Edge);
+enum LayoutBox { BoxMissing = 0, MarginBox, BorderBox, PaddingBox, ContentBox, BoundingBox };
} // namespace WebCore
diff --git a/Source/WebCore/rendering/style/SVGRenderStyle.cpp b/Source/WebCore/rendering/style/SVGRenderStyle.cpp
index df79aff65..06c793f69 100644
--- a/Source/WebCore/rendering/style/SVGRenderStyle.cpp
+++ b/Source/WebCore/rendering/style/SVGRenderStyle.cpp
@@ -7,7 +7,7 @@
Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
Copyright (C) 2002-2003 Dirk Mueller (mueller@kde.org)
- Copyright (C) 2002 Apple Inc.
+ Copyright (C) 2002 Apple Computer, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -26,6 +26,8 @@
*/
#include "config.h"
+
+#if ENABLE(SVG)
#include "SVGRenderStyle.h"
#include "CSSPrimitiveValue.h"
@@ -43,7 +45,7 @@ static const SVGRenderStyle& defaultSVGStyle()
return *style.get().get();
}
-Ref<SVGRenderStyle> SVGRenderStyle::createDefaultStyle()
+PassRef<SVGRenderStyle> SVGRenderStyle::createDefaultStyle()
{
return adoptRef(*new SVGRenderStyle(CreateDefault));
}
@@ -56,7 +58,6 @@ SVGRenderStyle::SVGRenderStyle()
, stops(defaultSVGStyle().stops)
, misc(defaultSVGStyle().misc)
, shadowSVG(defaultSVGStyle().shadowSVG)
- , layout(defaultSVGStyle().layout)
, resources(defaultSVGStyle().resources)
{
setBitDefaults();
@@ -70,7 +71,6 @@ SVGRenderStyle::SVGRenderStyle(CreateDefaultType)
, stops(StyleStopData::create())
, misc(StyleMiscData::create())
, shadowSVG(StyleShadowSVGData::create())
- , layout(StyleLayoutData::create())
, resources(StyleResourceData::create())
{
setBitDefaults();
@@ -87,12 +87,11 @@ inline SVGRenderStyle::SVGRenderStyle(const SVGRenderStyle& other)
, stops(other.stops)
, misc(other.misc)
, shadowSVG(other.shadowSVG)
- , layout(other.layout)
, resources(other.resources)
{
}
-Ref<SVGRenderStyle> SVGRenderStyle::copy() const
+PassRef<SVGRenderStyle> SVGRenderStyle::copy() const
{
return adoptRef(*new SVGRenderStyle(*this));
}
@@ -109,7 +108,6 @@ bool SVGRenderStyle::operator==(const SVGRenderStyle& other) const
&& stops == other.stops
&& misc == other.misc
&& shadowSVG == other.shadowSVG
- && layout == other.layout
&& inheritedResources == other.inheritedResources
&& resources == other.resources
&& svg_inherited_flags == other.svg_inherited_flags
@@ -144,50 +142,9 @@ void SVGRenderStyle::copyNonInheritedFrom(const SVGRenderStyle* other)
stops = other->stops;
misc = other->misc;
shadowSVG = other->shadowSVG;
- layout = other->layout;
resources = other->resources;
}
-Vector<PaintType, 3> SVGRenderStyle::paintTypesForPaintOrder() const
-{
- Vector<PaintType, 3> paintOrder;
- switch (this->paintOrder()) {
- case PaintOrderNormal:
- FALLTHROUGH;
- case PaintOrderFill:
- paintOrder.append(PaintTypeFill);
- paintOrder.append(PaintTypeStroke);
- paintOrder.append(PaintTypeMarkers);
- break;
- case PaintOrderFillMarkers:
- paintOrder.append(PaintTypeFill);
- paintOrder.append(PaintTypeMarkers);
- paintOrder.append(PaintTypeStroke);
- break;
- case PaintOrderStroke:
- paintOrder.append(PaintTypeStroke);
- paintOrder.append(PaintTypeFill);
- paintOrder.append(PaintTypeMarkers);
- break;
- case PaintOrderStrokeMarkers:
- paintOrder.append(PaintTypeStroke);
- paintOrder.append(PaintTypeMarkers);
- paintOrder.append(PaintTypeFill);
- break;
- case PaintOrderMarkers:
- paintOrder.append(PaintTypeMarkers);
- paintOrder.append(PaintTypeFill);
- paintOrder.append(PaintTypeStroke);
- break;
- case PaintOrderMarkersStroke:
- paintOrder.append(PaintTypeMarkers);
- paintOrder.append(PaintTypeStroke);
- paintOrder.append(PaintTypeFill);
- break;
- };
- return paintOrder;
-}
-
StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const
{
// NOTE: All comparisions that may return StyleDifferenceLayout have to go before those who return StyleDifferenceRepaint
@@ -228,10 +185,6 @@ StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const
if (shadowSVG != other->shadowSVG)
return StyleDifferenceLayout;
- // The x or y properties require relayout.
- if (layout != other->layout)
- return StyleDifferenceLayout;
-
// Some stroke properties, requires relayouts, as the cached stroke boundaries need to be recalculated.
if (stroke != other->stroke) {
if (stroke->width != other->stroke->width
@@ -251,10 +204,6 @@ StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const
return StyleDifferenceRepaint;
}
- // vector-effect changes require a re-layout.
- if (svg_noninherited_flags.f._vectorEffect != other->svg_noninherited_flags.f._vectorEffect)
- return StyleDifferenceLayout;
-
// NOTE: All comparisions below may only return StyleDifferenceRepaint
// Painting related properties only need repaints.
@@ -283,6 +232,10 @@ StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const
|| svg_inherited_flags._colorInterpolationFilters != other->svg_inherited_flags._colorInterpolationFilters)
return StyleDifferenceRepaint;
+ // FIXME: vector-effect is not taken into account in the layout-phase. Once this is fixed, we should relayout here.
+ if (svg_noninherited_flags.f._vectorEffect != other->svg_noninherited_flags.f._vectorEffect)
+ return StyleDifferenceRepaint;
+
if (svg_noninherited_flags.f.bufferedRendering != other->svg_noninherited_flags.f.bufferedRendering)
return StyleDifferenceRepaint;
@@ -293,3 +246,5 @@ StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const
}
}
+
+#endif // ENABLE(SVG)
diff --git a/Source/WebCore/rendering/style/SVGRenderStyle.h b/Source/WebCore/rendering/style/SVGRenderStyle.h
index 1eff35685..ff07db54c 100644
--- a/Source/WebCore/rendering/style/SVGRenderStyle.h
+++ b/Source/WebCore/rendering/style/SVGRenderStyle.h
@@ -1,9 +1,8 @@
/*
Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2005, 2006 Apple Inc.
+ Copyright (C) 2005, 2006 Apple Computer, Inc.
Copyright (C) Research In Motion Limited 2010. All rights reserved.
- Copyright (C) 2014 Adobe Systems Incorporated. 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
@@ -24,6 +23,7 @@
#ifndef SVGRenderStyle_h
#define SVGRenderStyle_h
+#if ENABLE(SVG)
#include "CSSValueList.h"
#include "DataRef.h"
#include "ExceptionCodePlaceholder.h"
@@ -41,9 +41,9 @@ class RenderObject;
class SVGRenderStyle : public RefCounted<SVGRenderStyle> {
public:
- static Ref<SVGRenderStyle> createDefaultStyle();
- static Ref<SVGRenderStyle> create() { return adoptRef(*new SVGRenderStyle); }
- Ref<SVGRenderStyle> copy() const;
+ static PassRef<SVGRenderStyle> createDefaultStyle();
+ static PassRef<SVGRenderStyle> create() { return adoptRef(*new SVGRenderStyle); }
+ PassRef<SVGRenderStyle> copy() const;
~SVGRenderStyle();
bool inheritedNotEqual(const SVGRenderStyle*) const;
@@ -90,12 +90,12 @@ public:
static Color initialLightingColor() { return Color(255, 255, 255); }
static ShadowData* initialShadow() { return 0; }
static String initialClipperResource() { return String(); }
+ static String initialFilterResource() { return String(); }
static String initialMaskerResource() { return String(); }
static String initialMarkerStartResource() { return String(); }
static String initialMarkerMidResource() { return String(); }
static String initialMarkerEndResource() { return String(); }
static EMaskType initialMaskType() { return MT_LUMINANCE; }
- static PaintOrder initialPaintOrder() { return PaintOrderNormal; }
static SVGLength initialBaselineShiftValue()
{
@@ -111,6 +111,20 @@ public:
return length;
}
+ static SVGLength initialStrokeDashOffset()
+ {
+ SVGLength length;
+ length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION);
+ return length;
+ }
+
+ static SVGLength initialStrokeWidth()
+ {
+ SVGLength length;
+ length.newValueSpecifiedUnits(LengthTypeNumber, 1, ASSERT_NO_EXCEPTION);
+ return length;
+ }
+
// SVG CSS Property setters
void setAlignmentBaseline(EAlignmentBaseline val) { svg_noninherited_flags.f._alignmentBaseline = val; }
void setDominantBaseline(EDominantBaseline val) { svg_noninherited_flags.f._dominantBaseline = val; }
@@ -130,42 +144,6 @@ public:
void setGlyphOrientationHorizontal(EGlyphOrientation val) { svg_inherited_flags._glyphOrientationHorizontal = val; }
void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flags._glyphOrientationVertical = val; }
void setMaskType(EMaskType val) { svg_noninherited_flags.f.maskType = val; }
- void setPaintOrder(PaintOrder val) { svg_inherited_flags.paintOrder = val; }
- void setCx(const Length& obj)
- {
- if (!(layout->cx == obj))
- layout.access()->cx = obj;
- }
- void setCy(const Length& obj)
- {
- if (!(layout->cy == obj))
- layout.access()->cy = obj;
- }
- void setR(const Length& obj)
- {
- if (!(layout->r == obj))
- layout.access()->r = obj;
- }
- void setRx(const Length& obj)
- {
- if (!(layout->rx == obj))
- layout.access()->rx = obj;
- }
- void setRy(const Length& obj)
- {
- if (!(layout->ry == obj))
- layout.access()->ry = obj;
- }
- void setX(const Length& obj)
- {
- if (!(layout->x == obj))
- layout.access()->x = obj;
- }
- void setY(const Length& obj)
- {
- if (!(layout->y == obj))
- layout.access()->y = obj;
- }
void setFillOpacity(float obj)
{
@@ -231,13 +209,13 @@ public:
stroke.access()->miterLimit = obj;
}
- void setStrokeWidth(const Length& obj)
+ void setStrokeWidth(const SVGLength& obj)
{
if (!(stroke->width == obj))
stroke.access()->width = obj;
}
- void setStrokeDashOffset(const Length& obj)
+ void setStrokeDashOffset(const SVGLength& obj)
{
if (!(stroke->dashOffset == obj))
stroke.access()->dashOffset = obj;
@@ -285,7 +263,7 @@ public:
misc.access()->baselineShiftValue = obj;
}
- void setShadow(std::unique_ptr<ShadowData> obj) { shadowSVG.access()->shadow = WTFMove(obj); }
+ void setShadow(PassOwnPtr<ShadowData> obj) { shadowSVG.access()->shadow = obj; }
// Setters for non-inherited resources
void setClipperResource(const String& obj)
@@ -294,6 +272,12 @@ public:
resources.access()->clipper = obj;
}
+ void setFilterResource(const String& obj)
+ {
+ if (!(resources->filter == obj))
+ resources.access()->filter = obj;
+ }
+
void setMaskerResource(const String& obj)
{
if (!(resources->masker == obj))
@@ -347,8 +331,8 @@ public:
const String& strokePaintUri() const { return stroke->paintUri; }
Vector<SVGLength> strokeDashArray() const { return stroke->dashArray; }
float strokeMiterLimit() const { return stroke->miterLimit; }
- const Length& strokeWidth() const { return stroke->width; }
- const Length& strokeDashOffset() const { return stroke->dashOffset; }
+ SVGLength strokeWidth() const { return stroke->width; }
+ SVGLength strokeDashOffset() const { return stroke->dashOffset; }
SVGLength kerning() const { return text->kerning; }
float stopOpacity() const { return stops->opacity; }
const Color& stopColor() const { return stops->color; }
@@ -357,21 +341,13 @@ public:
const Color& lightingColor() const { return misc->lightingColor; }
SVGLength baselineShiftValue() const { return misc->baselineShiftValue; }
ShadowData* shadow() const { return shadowSVG->shadow.get(); }
- const Length& cx() const { return layout->cx; }
- const Length& cy() const { return layout->cy; }
- const Length& r() const { return layout->r; }
- const Length& rx() const { return layout->rx; }
- const Length& ry() const { return layout->ry; }
- const Length& x() const { return layout->x; }
- const Length& y() const { return layout->y; }
String clipperResource() const { return resources->clipper; }
+ String filterResource() const { return resources->filter; }
String maskerResource() const { return resources->masker; }
String markerStartResource() const { return inheritedResources->markerStart; }
String markerMidResource() const { return inheritedResources->markerMid; }
String markerEndResource() const { return inheritedResources->markerEnd; }
EMaskType maskType() const { return (EMaskType) svg_noninherited_flags.f.maskType; }
- PaintOrder paintOrder() const { return (PaintOrder) svg_inherited_flags.paintOrder; }
- Vector<PaintType, 3> paintTypesForPaintOrder() const;
const SVGPaint::SVGPaintType& visitedLinkFillPaintType() const { return fill->visitedLinkPaintType; }
const Color& visitedLinkFillPaintColor() const { return fill->visitedLinkPaintColor; }
@@ -383,12 +359,12 @@ public:
// convenience
bool hasClipper() const { return !clipperResource().isEmpty(); }
bool hasMasker() const { return !maskerResource().isEmpty(); }
+ bool hasFilter() const { return !filterResource().isEmpty(); }
bool hasMarkers() const { return !markerStartResource().isEmpty() || !markerMidResource().isEmpty() || !markerEndResource().isEmpty(); }
bool hasStroke() const { return strokePaintType() != SVGPaint::SVG_PAINTTYPE_NONE; }
bool hasVisibleStroke() const { return hasStroke() && !strokeWidth().isZero(); }
bool hasFill() const { return fillPaintType() != SVGPaint::SVG_PAINTTYPE_NONE; }
bool isVerticalWritingMode() const { return writingMode() == WM_TBRL || writingMode() == WM_TB; }
- bool isolatesBlending() const { return hasMasker() || shadow(); }
protected:
// inherit
@@ -406,8 +382,7 @@ protected:
&& (_colorInterpolationFilters == other._colorInterpolationFilters)
&& (_writingMode == other._writingMode)
&& (_glyphOrientationHorizontal == other._glyphOrientationHorizontal)
- && (_glyphOrientationVertical == other._glyphOrientationVertical)
- && (paintOrder == other.paintOrder);
+ && (_glyphOrientationVertical == other._glyphOrientationVertical);
}
bool operator!=(const InheritedFlags& other) const
@@ -427,7 +402,6 @@ protected:
unsigned _writingMode : 3; // SVGWritingMode
unsigned _glyphOrientationHorizontal : 3; // EGlyphOrientation
unsigned _glyphOrientationVertical : 3; // EGlyphOrientation
- unsigned paintOrder : 3; // PaintOrder
} svg_inherited_flags;
// don't inherit
@@ -460,7 +434,6 @@ protected:
DataRef<StyleStopData> stops;
DataRef<StyleMiscData> misc;
DataRef<StyleShadowSVGData> shadowSVG;
- DataRef<StyleLayoutData> layout;
DataRef<StyleResourceData> resources;
private:
@@ -484,7 +457,6 @@ private:
svg_inherited_flags._writingMode = initialWritingMode();
svg_inherited_flags._glyphOrientationHorizontal = initialGlyphOrientationHorizontal();
svg_inherited_flags._glyphOrientationVertical = initialGlyphOrientationVertical();
- svg_inherited_flags.paintOrder = initialPaintOrder();
svg_noninherited_flags._niflags = 0;
svg_noninherited_flags.f._alignmentBaseline = initialAlignmentBaseline();
@@ -498,4 +470,5 @@ private:
} // namespace WebCore
+#endif // ENABLE(SVG)
#endif // SVGRenderStyle_h
diff --git a/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp b/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp
index 20ded8b8b..aed179b9c 100644
--- a/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp
+++ b/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp
@@ -2,13 +2,12 @@
Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2007 Rob Buis <buis@kde.org>
Copyright (C) Research In Motion Limited 2010. All rights reserved.
- Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
Based on khtml code by:
Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
Copyright (C) 2002-2003 Dirk Mueller (mueller@kde.org)
- Copyright (C) 2002 Apple Inc.
+ Copyright (C) 2002 Apple Computer, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -27,11 +26,12 @@
*/
#include "config.h"
+
+#if ENABLE(SVG)
#include "SVGRenderStyleDefs.h"
#include "RenderStyle.h"
#include "SVGRenderStyle.h"
-#include <wtf/PointerComparison.h>
namespace WebCore {
@@ -58,7 +58,7 @@ inline StyleFillData::StyleFillData(const StyleFillData& other)
{
}
-Ref<StyleFillData> StyleFillData::copy() const
+PassRef<StyleFillData> StyleFillData::copy() const
{
return adoptRef(*new StyleFillData(*this));
}
@@ -77,8 +77,8 @@ bool StyleFillData::operator==(const StyleFillData& other) const
StyleStrokeData::StyleStrokeData()
: opacity(SVGRenderStyle::initialStrokeOpacity())
, miterLimit(SVGRenderStyle::initialStrokeMiterLimit())
- , width(RenderStyle::initialOneLength())
- , dashOffset(RenderStyle::initialZeroLength())
+ , width(SVGRenderStyle::initialStrokeWidth())
+ , dashOffset(SVGRenderStyle::initialStrokeDashOffset())
, dashArray(SVGRenderStyle::initialStrokeDashArray())
, paintType(SVGRenderStyle::initialStrokePaintType())
, paintColor(SVGRenderStyle::initialStrokePaintColor())
@@ -105,7 +105,7 @@ inline StyleStrokeData::StyleStrokeData(const StyleStrokeData& other)
{
}
-Ref<StyleStrokeData> StyleStrokeData::copy() const
+PassRef<StyleStrokeData> StyleStrokeData::copy() const
{
return adoptRef(*new StyleStrokeData(*this));
}
@@ -138,7 +138,7 @@ inline StyleStopData::StyleStopData(const StyleStopData& other)
{
}
-Ref<StyleStopData> StyleStopData::copy() const
+PassRef<StyleStopData> StyleStopData::copy() const
{
return adoptRef(*new StyleStopData(*this));
}
@@ -160,7 +160,7 @@ inline StyleTextData::StyleTextData(const StyleTextData& other)
{
}
-Ref<StyleTextData> StyleTextData::copy() const
+PassRef<StyleTextData> StyleTextData::copy() const
{
return adoptRef(*new StyleTextData(*this));
}
@@ -187,7 +187,7 @@ inline StyleMiscData::StyleMiscData(const StyleMiscData& other)
{
}
-Ref<StyleMiscData> StyleMiscData::copy() const
+PassRef<StyleMiscData> StyleMiscData::copy() const
{
return adoptRef(*new StyleMiscData(*this));
}
@@ -206,22 +206,27 @@ StyleShadowSVGData::StyleShadowSVGData()
inline StyleShadowSVGData::StyleShadowSVGData(const StyleShadowSVGData& other)
: RefCounted<StyleShadowSVGData>()
- , shadow(other.shadow ? std::make_unique<ShadowData>(*other.shadow) : nullptr)
+ , shadow(other.shadow ? adoptPtr(new ShadowData(*other.shadow)) : nullptr)
{
}
-Ref<StyleShadowSVGData> StyleShadowSVGData::copy() const
+PassRef<StyleShadowSVGData> StyleShadowSVGData::copy() const
{
return adoptRef(*new StyleShadowSVGData(*this));
}
bool StyleShadowSVGData::operator==(const StyleShadowSVGData& other) const
{
- return arePointingToEqualData(shadow, other.shadow);
+ if ((!shadow && other.shadow) || (shadow && !other.shadow))
+ return false;
+ if (shadow && other.shadow && (*shadow != *other.shadow))
+ return false;
+ return true;
}
StyleResourceData::StyleResourceData()
: clipper(SVGRenderStyle::initialClipperResource())
+ , filter(SVGRenderStyle::initialFilterResource())
, masker(SVGRenderStyle::initialMaskerResource())
{
}
@@ -229,11 +234,12 @@ StyleResourceData::StyleResourceData()
inline StyleResourceData::StyleResourceData(const StyleResourceData& other)
: RefCounted<StyleResourceData>()
, clipper(other.clipper)
+ , filter(other.filter)
, masker(other.masker)
{
}
-Ref<StyleResourceData> StyleResourceData::copy() const
+PassRef<StyleResourceData> StyleResourceData::copy() const
{
return adoptRef(*new StyleResourceData(*this));
}
@@ -241,6 +247,7 @@ Ref<StyleResourceData> StyleResourceData::copy() const
bool StyleResourceData::operator==(const StyleResourceData& other) const
{
return clipper == other.clipper
+ && filter == other.filter
&& masker == other.masker;
}
@@ -259,7 +266,7 @@ inline StyleInheritedResourceData::StyleInheritedResourceData(const StyleInherit
{
}
-Ref<StyleInheritedResourceData> StyleInheritedResourceData::copy() const
+PassRef<StyleInheritedResourceData> StyleInheritedResourceData::copy() const
{
return adoptRef(*new StyleInheritedResourceData(*this));
}
@@ -271,43 +278,6 @@ bool StyleInheritedResourceData::operator==(const StyleInheritedResourceData& ot
&& markerEnd == other.markerEnd;
}
-StyleLayoutData::StyleLayoutData()
- : cx(RenderStyle::initialZeroLength())
- , cy(RenderStyle::initialZeroLength())
- , r(RenderStyle::initialZeroLength())
- , rx(RenderStyle::initialZeroLength())
- , ry(RenderStyle::initialZeroLength())
- , x(RenderStyle::initialZeroLength())
- , y(RenderStyle::initialZeroLength())
-{
-}
-
-inline StyleLayoutData::StyleLayoutData(const StyleLayoutData& other)
- : RefCounted<StyleLayoutData>()
- , cx(other.cx)
- , cy(other.cy)
- , r(other.r)
- , rx(other.rx)
- , ry(other.ry)
- , x(other.x)
- , y(other.y)
-{
-}
-
-Ref<StyleLayoutData> StyleLayoutData::copy() const
-{
- return adoptRef(*new StyleLayoutData(*this));
-}
-
-bool StyleLayoutData::operator==(const StyleLayoutData& other) const
-{
- return cx == other.cx
- && cy == other.cy
- && r == other.r
- && rx == other.rx
- && ry == other.ry
- && x == other.x
- && y == other.y;
}
-}
+#endif // ENABLE(SVG)
diff --git a/Source/WebCore/rendering/style/SVGRenderStyleDefs.h b/Source/WebCore/rendering/style/SVGRenderStyleDefs.h
index 883641970..9c840bc0f 100644
--- a/Source/WebCore/rendering/style/SVGRenderStyleDefs.h
+++ b/Source/WebCore/rendering/style/SVGRenderStyleDefs.h
@@ -2,13 +2,12 @@
Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
Copyright (C) Research In Motion Limited 2010. All rights reserved.
- Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
Based on khtml code by:
Copyright (C) 2000-2003 Lars Knoll (knoll@kde.org)
(C) 2000 Antti Koivisto (koivisto@kde.org)
(C) 2000-2003 Dirk Mueller (mueller@kde.org)
- (C) 2002-2003 Apple Inc.
+ (C) 2002-2003 Apple Computer, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -29,10 +28,12 @@
#ifndef SVGRenderStyleDefs_h
#define SVGRenderStyleDefs_h
-#include "Length.h"
+#if ENABLE(SVG)
#include "SVGLength.h"
#include "SVGPaint.h"
#include "ShadowData.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
@@ -93,23 +94,6 @@ namespace WebCore {
MT_ALPHA
};
- // These are all minimized combinations of paint-order.
- enum PaintOrder {
- PaintOrderNormal = 0,
- PaintOrderFill = 1,
- PaintOrderFillMarkers = 2,
- PaintOrderStroke = 3,
- PaintOrderStrokeMarkers = 4,
- PaintOrderMarkers = 5,
- PaintOrderMarkersStroke = 6
- };
-
- enum PaintType {
- PaintTypeFill,
- PaintTypeStroke,
- PaintTypeMarkers
- };
-
class CSSValue;
class CSSValueList;
class SVGPaint;
@@ -117,8 +101,8 @@ namespace WebCore {
// Inherited/Non-Inherited Style Datastructures
class StyleFillData : public RefCounted<StyleFillData> {
public:
- static Ref<StyleFillData> create() { return adoptRef(*new StyleFillData); }
- Ref<StyleFillData> copy() const;
+ static PassRef<StyleFillData> create() { return adoptRef(*new StyleFillData); }
+ PassRef<StyleFillData> copy() const;
bool operator==(const StyleFillData&) const;
bool operator!=(const StyleFillData& other) const
@@ -141,8 +125,8 @@ namespace WebCore {
class StyleStrokeData : public RefCounted<StyleStrokeData> {
public:
- static Ref<StyleStrokeData> create() { return adoptRef(*new StyleStrokeData); }
- Ref<StyleStrokeData> copy() const;
+ static PassRef<StyleStrokeData> create() { return adoptRef(*new StyleStrokeData); }
+ PassRef<StyleStrokeData> copy() const;
bool operator==(const StyleStrokeData&) const;
bool operator!=(const StyleStrokeData& other) const
@@ -153,8 +137,8 @@ namespace WebCore {
float opacity;
float miterLimit;
- Length width;
- Length dashOffset;
+ SVGLength width;
+ SVGLength dashOffset;
Vector<SVGLength> dashArray;
SVGPaint::SVGPaintType paintType;
@@ -171,8 +155,8 @@ namespace WebCore {
class StyleStopData : public RefCounted<StyleStopData> {
public:
- static Ref<StyleStopData> create() { return adoptRef(*new StyleStopData); }
- Ref<StyleStopData> copy() const;
+ static PassRef<StyleStopData> create() { return adoptRef(*new StyleStopData); }
+ PassRef<StyleStopData> copy() const;
bool operator==(const StyleStopData&) const;
bool operator!=(const StyleStopData& other) const
@@ -190,8 +174,8 @@ namespace WebCore {
class StyleTextData : public RefCounted<StyleTextData> {
public:
- static Ref<StyleTextData> create() { return adoptRef(*new StyleTextData); }
- Ref<StyleTextData> copy() const;
+ static PassRef<StyleTextData> create() { return adoptRef(*new StyleTextData); }
+ PassRef<StyleTextData> copy() const;
bool operator==(const StyleTextData& other) const;
bool operator!=(const StyleTextData& other) const
@@ -209,8 +193,8 @@ namespace WebCore {
// Note: the rule for this class is, *no inheritance* of these props
class StyleMiscData : public RefCounted<StyleMiscData> {
public:
- static Ref<StyleMiscData> create() { return adoptRef(*new StyleMiscData); }
- Ref<StyleMiscData> copy() const;
+ static PassRef<StyleMiscData> create() { return adoptRef(*new StyleMiscData); }
+ PassRef<StyleMiscData> copy() const;
bool operator==(const StyleMiscData&) const;
bool operator!=(const StyleMiscData& other) const
@@ -232,8 +216,8 @@ namespace WebCore {
class StyleShadowSVGData : public RefCounted<StyleShadowSVGData> {
public:
- static Ref<StyleShadowSVGData> create() { return adoptRef(*new StyleShadowSVGData); }
- Ref<StyleShadowSVGData> copy() const;
+ static PassRef<StyleShadowSVGData> create() { return adoptRef(*new StyleShadowSVGData); }
+ PassRef<StyleShadowSVGData> copy() const;
bool operator==(const StyleShadowSVGData&) const;
bool operator!=(const StyleShadowSVGData& other) const
@@ -241,7 +225,7 @@ namespace WebCore {
return !(*this == other);
}
- std::unique_ptr<ShadowData> shadow;
+ OwnPtr<ShadowData> shadow;
private:
StyleShadowSVGData();
@@ -251,8 +235,8 @@ namespace WebCore {
// Non-inherited resources
class StyleResourceData : public RefCounted<StyleResourceData> {
public:
- static Ref<StyleResourceData> create() { return adoptRef(*new StyleResourceData); }
- Ref<StyleResourceData> copy() const;
+ static PassRef<StyleResourceData> create() { return adoptRef(*new StyleResourceData); }
+ PassRef<StyleResourceData> copy() const;
bool operator==(const StyleResourceData&) const;
bool operator!=(const StyleResourceData& other) const
@@ -261,6 +245,7 @@ namespace WebCore {
}
String clipper;
+ String filter;
String masker;
private:
@@ -271,8 +256,8 @@ namespace WebCore {
// Inherited resources
class StyleInheritedResourceData : public RefCounted<StyleInheritedResourceData> {
public:
- static Ref<StyleInheritedResourceData> create() { return adoptRef(*new StyleInheritedResourceData); }
- Ref<StyleInheritedResourceData> copy() const;
+ static PassRef<StyleInheritedResourceData> create() { return adoptRef(*new StyleInheritedResourceData); }
+ PassRef<StyleInheritedResourceData> copy() const;
bool operator==(const StyleInheritedResourceData&) const;
bool operator!=(const StyleInheritedResourceData& other) const
@@ -289,31 +274,7 @@ namespace WebCore {
StyleInheritedResourceData(const StyleInheritedResourceData&);
};
- // Positioning and sizing properties.
- class StyleLayoutData : public RefCounted<StyleLayoutData> {
- public:
- static Ref<StyleLayoutData> create() { return adoptRef(*new StyleLayoutData); }
- Ref<StyleLayoutData> copy() const;
-
- bool operator==(const StyleLayoutData&) const;
- bool operator!=(const StyleLayoutData& other) const
- {
- return !(*this == other);
- }
-
- Length cx;
- Length cy;
- Length r;
- Length rx;
- Length ry;
- Length x;
- Length y;
-
- private:
- StyleLayoutData();
- StyleLayoutData(const StyleLayoutData&);
- };
-
} // namespace WebCore
+#endif // ENABLE(SVG)
#endif // SVGRenderStyleDefs_h
diff --git a/Source/WebCore/rendering/style/ShadowData.cpp b/Source/WebCore/rendering/style/ShadowData.cpp
index 4e5cb90f0..d91073bd4 100644
--- a/Source/WebCore/rendering/style/ShadowData.cpp
+++ b/Source/WebCore/rendering/style/ShadowData.cpp
@@ -23,7 +23,6 @@
#include "ShadowData.h"
#include "LayoutRect.h"
-#include <wtf/PointerComparison.h>
namespace WebCore {
@@ -34,13 +33,14 @@ ShadowData::ShadowData(const ShadowData& o)
, m_color(o.m_color)
, m_style(o.m_style)
, m_isWebkitBoxShadow(o.m_isWebkitBoxShadow)
- , m_next(o.m_next ? std::make_unique<ShadowData>(*o.m_next) : nullptr)
+ , m_next(o.m_next ? adoptPtr(new ShadowData(*o.m_next)) : nullptr)
{
}
bool ShadowData::operator==(const ShadowData& o) const
{
- if (!arePointingToEqualData(m_next, o.m_next))
+ if ((m_next && !o.m_next) || (!m_next && o.m_next)
+ || (m_next && o.m_next && *m_next != *o.m_next))
return false;
return m_location == o.m_location
diff --git a/Source/WebCore/rendering/style/ShadowData.h b/Source/WebCore/rendering/style/ShadowData.h
index 4c3dab7a6..19be48d6c 100644
--- a/Source/WebCore/rendering/style/ShadowData.h
+++ b/Source/WebCore/rendering/style/ShadowData.h
@@ -28,6 +28,8 @@
#include "Color.h"
#include "FloatRect.h"
#include "LayoutRect.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
namespace WebCore {
@@ -82,7 +84,7 @@ public:
bool isWebkitBoxShadow() const { return m_isWebkitBoxShadow; }
const ShadowData* next() const { return m_next.get(); }
- void setNext(std::unique_ptr<ShadowData> shadow) { m_next = WTFMove(shadow); }
+ void setNext(PassOwnPtr<ShadowData> shadow) { m_next = shadow; }
void adjustRectForShadow(LayoutRect&, int additionalOutlineSize = 0) const;
void adjustRectForShadow(FloatRect&, int additionalOutlineSize = 0) const;
@@ -94,7 +96,7 @@ private:
Color m_color;
ShadowStyle m_style;
bool m_isWebkitBoxShadow;
- std::unique_ptr<ShadowData> m_next;
+ OwnPtr<ShadowData> m_next;
};
} // namespace WebCore
diff --git a/Source/WebCore/rendering/style/ShapeValue.cpp b/Source/WebCore/rendering/style/ShapeValue.cpp
deleted file mode 100644
index 2eef76042..000000000
--- a/Source/WebCore/rendering/style/ShapeValue.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND 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.
- */
-
-#include "config.h"
-#include "ShapeValue.h"
-
-#include "CachedImage.h"
-
-namespace WebCore {
-
-bool ShapeValue::isImageValid() const
-{
- if (!image())
- return false;
- if (image()->isCachedImage() || image()->isCachedImageSet())
- return image()->cachedImage() && image()->cachedImage()->hasImage();
- return image()->isGeneratedImage();
-}
-
-template <typename T>
-bool pointersOrValuesEqual(T p1, T p2)
-{
- if (p1 == p2)
- return true;
-
- if (!p1 || !p2)
- return false;
-
- return *p1 == *p2;
-}
-
-bool ShapeValue::operator==(const ShapeValue& other) const
-{
- if (m_type != other.m_type || m_cssBox != other.m_cssBox)
- return false;
-
- return pointersOrValuesEqual(m_shape.get(), other.m_shape.get())
- && pointersOrValuesEqual(m_image.get(), other.m_image.get());
-}
-
-
-} // namespace WebCore
diff --git a/Source/WebCore/rendering/style/ShapeValue.h b/Source/WebCore/rendering/style/ShapeValue.h
index f54678d71..53c11a7e8 100644
--- a/Source/WebCore/rendering/style/ShapeValue.h
+++ b/Source/WebCore/rendering/style/ShapeValue.h
@@ -32,6 +32,7 @@
#include "BasicShapes.h"
#include "CSSValueKeywords.h"
+#include "CachedImage.h"
#include "StyleImage.h"
#include <wtf/PassRefPtr.h>
@@ -39,76 +40,77 @@ namespace WebCore {
class ShapeValue : public RefCounted<ShapeValue> {
public:
- enum class Type {
+ enum ShapeValueType {
// The None value is defined by a null ShapeValue*
Shape,
Box,
+ Outside,
Image
};
- static Ref<ShapeValue> createShapeValue(PassRefPtr<BasicShape> shape, CSSBoxType cssBox)
+ static PassRefPtr<ShapeValue> createShapeValue(PassRefPtr<BasicShape> shape, LayoutBox layoutBox)
{
- return adoptRef(*new ShapeValue(shape, cssBox));
+ return adoptRef(new ShapeValue(shape, layoutBox));
}
- static Ref<ShapeValue> createBoxShapeValue(CSSBoxType boxShape)
+ static PassRefPtr<ShapeValue> createLayoutBoxValue(LayoutBox layoutBox)
{
- return adoptRef(*new ShapeValue(boxShape));
+ return adoptRef(new ShapeValue(layoutBox));
}
- static Ref<ShapeValue> createImageValue(PassRefPtr<StyleImage> image)
+ static PassRefPtr<ShapeValue> createOutsideValue()
{
- return adoptRef(*new ShapeValue(image));
+ return adoptRef(new ShapeValue(Outside));
}
- Type type() const { return m_type; }
+ static PassRefPtr<ShapeValue> createImageValue(PassRefPtr<StyleImage> image)
+ {
+ return adoptRef(new ShapeValue(image));
+ }
+
+ ShapeValueType type() const { return m_type; }
BasicShape* shape() const { return m_shape.get(); }
- CSSBoxType cssBox() const { return m_cssBox; }
+ LayoutBox layoutBox() const { return m_layoutBox; }
StyleImage* image() const { return m_image.get(); }
-
- bool isImageValid() const;
-
+ bool isImageValid() const { return image() && image()->cachedImage() && image()->cachedImage()->hasImage(); }
void setImage(PassRefPtr<StyleImage> image)
{
- ASSERT(type() == Type::Image);
+ ASSERT(type() == Image);
if (m_image != image)
m_image = image;
}
- bool operator==(const ShapeValue&) const;
- bool operator!=(const ShapeValue& other) const
- {
- return !(*this == other);
- }
+ bool operator==(const ShapeValue& other) const { return type() == other.type(); }
private:
- ShapeValue(PassRefPtr<BasicShape> shape, CSSBoxType cssBox)
- : m_type(Type::Shape)
+ ShapeValue(PassRefPtr<BasicShape> shape, LayoutBox layoutBox)
+ : m_type(Shape)
, m_shape(shape)
- , m_cssBox(cssBox)
+ , m_layoutBox(layoutBox)
{
}
- ShapeValue(Type type)
+ ShapeValue(ShapeValueType type)
: m_type(type)
+ , m_layoutBox(BoxMissing)
{
}
ShapeValue(PassRefPtr<StyleImage> image)
- : m_type(Type::Image)
+ : m_type(Image)
, m_image(image)
+ , m_layoutBox(BoxMissing)
{
}
-
- ShapeValue(CSSBoxType cssBox)
- : m_type(Type::Box)
- , m_cssBox(cssBox)
+ ShapeValue(LayoutBox layoutBox)
+ : m_type(Box)
+ , m_layoutBox(layoutBox)
{
}
- Type m_type;
+ ShapeValueType m_type;
RefPtr<BasicShape> m_shape;
RefPtr<StyleImage> m_image;
- CSSBoxType m_cssBox { BoxMissing };
+ LayoutBox m_layoutBox;
};
}
diff --git a/Source/WebCore/rendering/style/StyleAllInOne.cpp b/Source/WebCore/rendering/style/StyleAllInOne.cpp
deleted file mode 100644
index 7c6c079d6..000000000
--- a/Source/WebCore/rendering/style/StyleAllInOne.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 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.
- */
-
-// This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build.
-
-#include "BasicShapes.cpp"
-#include "ContentData.cpp"
-#include "CounterDirectives.cpp"
-#include "FillLayer.cpp"
-#include "GridResolvedPosition.cpp"
-#include "KeyframeList.cpp"
-#include "NinePieceImage.cpp"
-#include "QuotesData.cpp"
-#include "RenderStyle.cpp"
-#include "SVGRenderStyle.cpp"
-#include "SVGRenderStyleDefs.cpp"
-#include "ShadowData.cpp"
-#include "ShapeValue.cpp"
-#include "StyleBackgroundData.cpp"
-#include "StyleBoxData.cpp"
-#include "StyleCachedImage.cpp"
-#include "StyleCachedImageSet.cpp"
-#include "StyleDeprecatedFlexibleBoxData.cpp"
-#include "StyleFilterData.cpp"
-#include "StyleFlexibleBoxData.cpp"
-#include "StyleGeneratedImage.cpp"
-#include "StyleGridData.cpp"
-#include "StyleGridItemData.cpp"
-#include "StyleInheritedData.cpp"
-#include "StyleMarqueeData.cpp"
-#include "StyleMultiColData.cpp"
-#include "StyleRareInheritedData.cpp"
-#include "StyleRareNonInheritedData.cpp"
-#include "StyleScrollSnapPoints.cpp"
-#include "StyleSurroundData.cpp"
-#include "StyleTransformData.cpp"
-#include "StyleVisualData.cpp"
-#include "WillChangeData.cpp"
diff --git a/Source/WebCore/rendering/style/StyleBackgroundData.cpp b/Source/WebCore/rendering/style/StyleBackgroundData.cpp
index 1ba36c4a8..c51b8255f 100644
--- a/Source/WebCore/rendering/style/StyleBackgroundData.cpp
+++ b/Source/WebCore/rendering/style/StyleBackgroundData.cpp
@@ -41,7 +41,7 @@ inline StyleBackgroundData::StyleBackgroundData(const StyleBackgroundData& o)
{
}
-Ref<StyleBackgroundData> StyleBackgroundData::copy() const
+PassRef<StyleBackgroundData> StyleBackgroundData::copy() const
{
return adoptRef(*new StyleBackgroundData(*this));
}
diff --git a/Source/WebCore/rendering/style/StyleBackgroundData.h b/Source/WebCore/rendering/style/StyleBackgroundData.h
index 2e1b69820..b2996dcd8 100644
--- a/Source/WebCore/rendering/style/StyleBackgroundData.h
+++ b/Source/WebCore/rendering/style/StyleBackgroundData.h
@@ -35,8 +35,8 @@ namespace WebCore {
class StyleBackgroundData : public RefCounted<StyleBackgroundData> {
public:
- static Ref<StyleBackgroundData> create() { return adoptRef(*new StyleBackgroundData); }
- Ref<StyleBackgroundData> copy() const;
+ static PassRef<StyleBackgroundData> create() { return adoptRef(*new StyleBackgroundData); }
+ PassRef<StyleBackgroundData> copy() const;
~StyleBackgroundData() { }
bool operator==(const StyleBackgroundData& o) const;
diff --git a/Source/WebCore/rendering/style/StyleBoxData.cpp b/Source/WebCore/rendering/style/StyleBoxData.cpp
index 392708aae..a1187ff36 100644
--- a/Source/WebCore/rendering/style/StyleBoxData.cpp
+++ b/Source/WebCore/rendering/style/StyleBoxData.cpp
@@ -67,7 +67,7 @@ inline StyleBoxData::StyleBoxData(const StyleBoxData& o)
{
}
-Ref<StyleBoxData> StyleBoxData::copy() const
+PassRef<StyleBoxData> StyleBoxData::copy() const
{
return adoptRef(*new StyleBoxData(*this));
}
diff --git a/Source/WebCore/rendering/style/StyleBoxData.h b/Source/WebCore/rendering/style/StyleBoxData.h
index ec255f291..2c6d03353 100644
--- a/Source/WebCore/rendering/style/StyleBoxData.h
+++ b/Source/WebCore/rendering/style/StyleBoxData.h
@@ -34,8 +34,8 @@ namespace WebCore {
class StyleBoxData : public RefCounted<StyleBoxData> {
public:
- static Ref<StyleBoxData> create() { return adoptRef(*new StyleBoxData); }
- Ref<StyleBoxData> copy() const;
+ static PassRef<StyleBoxData> create() { return adoptRef(*new StyleBoxData); }
+ PassRef<StyleBoxData> copy() const;
bool operator==(const StyleBoxData& o) const;
bool operator!=(const StyleBoxData& o) const
diff --git a/Source/WebCore/rendering/style/StyleCachedImage.cpp b/Source/WebCore/rendering/style/StyleCachedImage.cpp
index e74940725..04d55e942 100644
--- a/Source/WebCore/rendering/style/StyleCachedImage.cpp
+++ b/Source/WebCore/rendering/style/StyleCachedImage.cpp
@@ -61,7 +61,7 @@ bool StyleCachedImage::errorOccurred() const
return m_image->errorOccurred();
}
-FloatSize StyleCachedImage::imageSize(const RenderElement* renderer, float multiplier) const
+LayoutSize StyleCachedImage::imageSize(const RenderElement* renderer, float multiplier) const
{
return m_image->imageSizeForRenderer(renderer, multiplier);
}
@@ -86,9 +86,9 @@ bool StyleCachedImage::usesImageContainerSize() const
return m_image->usesImageContainerSize();
}
-void StyleCachedImage::setContainerSizeForRenderer(const RenderElement* renderer, const FloatSize& imageContainerSize, float imageContainerZoomFactor)
+void StyleCachedImage::setContainerSizeForRenderer(const RenderElement* renderer, const IntSize& imageContainerSize, float imageContainerZoomFactor)
{
- m_image->setContainerSizeForRenderer(renderer, LayoutSize(imageContainerSize), imageContainerZoomFactor);
+ m_image->setContainerSizeForRenderer(renderer, imageContainerSize, imageContainerZoomFactor);
}
void StyleCachedImage::addClient(RenderElement* renderer)
@@ -101,7 +101,7 @@ void StyleCachedImage::removeClient(RenderElement* renderer)
m_image->removeClient(renderer);
}
-RefPtr<Image> StyleCachedImage::image(RenderElement* renderer, const FloatSize&) const
+PassRefPtr<Image> StyleCachedImage::image(RenderElement* renderer, const IntSize&) const
{
return m_image->imageForRenderer(renderer);
}
diff --git a/Source/WebCore/rendering/style/StyleCachedImage.h b/Source/WebCore/rendering/style/StyleCachedImage.h
index 2d20c34c8..0ef45d2d6 100644
--- a/Source/WebCore/rendering/style/StyleCachedImage.h
+++ b/Source/WebCore/rendering/style/StyleCachedImage.h
@@ -35,7 +35,7 @@ class CachedImage;
class StyleCachedImage final : public StyleImage, private CachedImageClient {
WTF_MAKE_FAST_ALLOCATED;
public:
- static Ref<StyleCachedImage> create(CachedImage* image) { return adoptRef(*new StyleCachedImage(image)); }
+ static PassRefPtr<StyleCachedImage> create(CachedImage* image) { return adoptRef(new StyleCachedImage(image)); }
virtual ~StyleCachedImage();
virtual CachedImage* cachedImage() const override { return m_image.get(); }
@@ -48,15 +48,15 @@ private:
virtual bool canRender(const RenderObject*, float multiplier) const override;
virtual bool isLoaded() const override;
virtual bool errorOccurred() const override;
- virtual FloatSize imageSize(const RenderElement*, float multiplier) const override;
+ virtual LayoutSize imageSize(const RenderElement*, float multiplier) const override;
virtual bool imageHasRelativeWidth() const override;
virtual bool imageHasRelativeHeight() const override;
virtual void computeIntrinsicDimensions(const RenderElement*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) override;
virtual bool usesImageContainerSize() const override;
- virtual void setContainerSizeForRenderer(const RenderElement*, const FloatSize&, float) override;
+ virtual void setContainerSizeForRenderer(const RenderElement*, const IntSize&, float) override;
virtual void addClient(RenderElement*) override;
virtual void removeClient(RenderElement*) override;
- virtual RefPtr<Image> image(RenderElement*, const FloatSize&) const override;
+ virtual PassRefPtr<Image> image(RenderElement*, const IntSize&) const override;
virtual bool knownToBeOpaque(const RenderElement*) const override;
explicit StyleCachedImage(CachedImage*);
@@ -64,8 +64,5 @@ private:
CachedResourceHandle<CachedImage> m_image;
};
-} // namespace WebCore
-
-SPECIALIZE_TYPE_TRAITS_STYLE_IMAGE(StyleCachedImage, isCachedImage)
-
-#endif // StyleCachedImage_h
+}
+#endif
diff --git a/Source/WebCore/rendering/style/StyleCachedImageSet.cpp b/Source/WebCore/rendering/style/StyleCachedImageSet.cpp
index 19764f372..f95b2c940 100644
--- a/Source/WebCore/rendering/style/StyleCachedImageSet.cpp
+++ b/Source/WebCore/rendering/style/StyleCachedImageSet.cpp
@@ -69,9 +69,9 @@ bool StyleCachedImageSet::errorOccurred() const
return m_bestFitImage->errorOccurred();
}
-FloatSize StyleCachedImageSet::imageSize(const RenderElement* renderer, float multiplier) const
+LayoutSize StyleCachedImageSet::imageSize(const RenderElement* renderer, float multiplier) const
{
- FloatSize scaledImageSize = m_bestFitImage->imageSizeForRenderer(renderer, multiplier);
+ LayoutSize scaledImageSize = m_bestFitImage->imageSizeForRenderer(renderer, multiplier);
scaledImageSize.scale(1 / m_imageScaleFactor);
return scaledImageSize;
}
@@ -96,9 +96,9 @@ bool StyleCachedImageSet::usesImageContainerSize() const
return m_bestFitImage->usesImageContainerSize();
}
-void StyleCachedImageSet::setContainerSizeForRenderer(const RenderElement* renderer, const FloatSize& imageContainerSize, float imageContainerZoomFactor)
+void StyleCachedImageSet::setContainerSizeForRenderer(const RenderElement* renderer, const IntSize& imageContainerSize, float imageContainerZoomFactor)
{
- m_bestFitImage->setContainerSizeForRenderer(renderer, LayoutSize(imageContainerSize), imageContainerZoomFactor);
+ m_bestFitImage->setContainerSizeForRenderer(renderer, imageContainerSize, imageContainerZoomFactor);
}
void StyleCachedImageSet::addClient(RenderElement* renderer)
@@ -111,7 +111,7 @@ void StyleCachedImageSet::removeClient(RenderElement* renderer)
m_bestFitImage->removeClient(renderer);
}
-RefPtr<Image> StyleCachedImageSet::image(RenderElement* renderer, const FloatSize&) const
+PassRefPtr<Image> StyleCachedImageSet::image(RenderElement* renderer, const IntSize&) const
{
return m_bestFitImage->imageForRenderer(renderer);
}
diff --git a/Source/WebCore/rendering/style/StyleCachedImageSet.h b/Source/WebCore/rendering/style/StyleCachedImageSet.h
index 24d8330d9..d0ad5c913 100644
--- a/Source/WebCore/rendering/style/StyleCachedImageSet.h
+++ b/Source/WebCore/rendering/style/StyleCachedImageSet.h
@@ -43,9 +43,9 @@ class CSSImageSetValue;
class StyleCachedImageSet final : public StyleImage, private CachedImageClient {
WTF_MAKE_FAST_ALLOCATED;
public:
- static Ref<StyleCachedImageSet> create(CachedImage* image, float imageScaleFactor, CSSImageSetValue* value)
+ static PassRefPtr<StyleCachedImageSet> create(CachedImage* image, float imageScaleFactor, CSSImageSetValue* value)
{
- return adoptRef(*new StyleCachedImageSet(image, imageScaleFactor, value));
+ return adoptRef(new StyleCachedImageSet(image, imageScaleFactor, value));
}
virtual ~StyleCachedImageSet();
@@ -64,15 +64,15 @@ private:
virtual bool canRender(const RenderObject*, float multiplier) const override;
virtual bool isLoaded() const override;
virtual bool errorOccurred() const override;
- virtual FloatSize imageSize(const RenderElement*, float multiplier) const override;
+ virtual LayoutSize imageSize(const RenderElement*, float multiplier) const override;
virtual bool imageHasRelativeWidth() const override;
virtual bool imageHasRelativeHeight() const override;
virtual void computeIntrinsicDimensions(const RenderElement*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) override;
virtual bool usesImageContainerSize() const override;
- virtual void setContainerSizeForRenderer(const RenderElement*, const FloatSize&, float) override;
+ virtual void setContainerSizeForRenderer(const RenderElement*, const IntSize&, float) override;
virtual void addClient(RenderElement*) override;
virtual void removeClient(RenderElement*) override;
- virtual RefPtr<Image> image(RenderElement*, const FloatSize&) const override;
+ virtual PassRefPtr<Image> image(RenderElement*, const IntSize&) const override;
virtual float imageScaleFactor() const override { return m_imageScaleFactor; }
virtual bool knownToBeOpaque(const RenderElement*) const override;
@@ -85,8 +85,6 @@ private:
} // namespace WebCore
-SPECIALIZE_TYPE_TRAITS_STYLE_IMAGE(StyleCachedImageSet, isCachedImageSet)
-
#endif // ENABLE(CSS_IMAGE_SET)
#endif // StyleCachedImageSet_h
diff --git a/Source/WebCore/rendering/style/StyleContentAlignmentData.h b/Source/WebCore/rendering/style/StyleContentAlignmentData.h
deleted file mode 100644
index 31b61b4c3..000000000
--- a/Source/WebCore/rendering/style/StyleContentAlignmentData.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2015 Igalia S.L. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND 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 StyleContentAlignmentData_h
-#define StyleContentAlignmentData_h
-
-#include "RenderStyleConstants.h"
-
-namespace WebCore {
-
-class StyleContentAlignmentData {
-public:
- // Style data for Content-Distribution properties: align-content, justify-content.
- // <content-distribution> || [ <overflow-position>? && <content-position> ]
- StyleContentAlignmentData(ContentPosition position, ContentDistributionType distribution, OverflowAlignment overflow = OverflowAlignmentDefault)
- : m_position(position)
- , m_distribution(distribution)
- , m_overflow(overflow)
- {
- }
-
- void setPosition(ContentPosition position) { m_position = position; }
- void setDistribution(ContentDistributionType distribution) { m_distribution = distribution; }
- void setOverflow(OverflowAlignment overflow) { m_overflow = overflow; }
-
- ContentPosition position() const { return static_cast<ContentPosition>(m_position); }
- ContentDistributionType distribution() const { return static_cast<ContentDistributionType>(m_distribution); }
- OverflowAlignment overflow() const { return static_cast<OverflowAlignment>(m_overflow); }
-
- bool operator==(const StyleContentAlignmentData& o) const
- {
- return m_position == o.m_position && m_distribution == o.m_distribution && m_overflow == o.m_overflow;
- }
-
- bool operator!=(const StyleContentAlignmentData& o) const
- {
- return !(*this == o);
- }
-
-private:
- unsigned m_position : 4; // ContentPosition
- unsigned m_distribution : 3; // ContentDistributionType
- unsigned m_overflow : 2; // OverflowAlignment
-};
-
-} // namespace WebCore
-
-#endif // StyleContentAlignmentData_h
diff --git a/Source/WebCore/rendering/style/StyleCustomPropertyData.h b/Source/WebCore/rendering/style/StyleCustomPropertyData.h
deleted file mode 100644
index c0a19684d..000000000
--- a/Source/WebCore/rendering/style/StyleCustomPropertyData.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2015 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 StyleCustomPropertyData_h
-#define StyleCustomPropertyData_h
-
-#include "CSSValue.h"
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/AtomicStringHash.h>
-
-namespace WebCore {
-
-class StyleCustomPropertyData : public RefCounted<StyleCustomPropertyData> {
-public:
- static Ref<StyleCustomPropertyData> create() { return adoptRef(*new StyleCustomPropertyData); }
- Ref<StyleCustomPropertyData> copy() const { return adoptRef(*new StyleCustomPropertyData(*this)); }
-
- bool operator==(const StyleCustomPropertyData& o) const
- {
- if (m_containsVariables != o.m_containsVariables)
- return false;
-
- if (m_values.size() != o.m_values.size())
- return false;
-
- for (WTF::KeyValuePair<AtomicString, RefPtr<CSSValue>> entry : m_values) {
- RefPtr<CSSValue> other = o.m_values.get(entry.key);
- if (!other || !entry.value->equals(*other))
- return false;
- }
- return true;
- }
-
- bool operator!=(const StyleCustomPropertyData &o) const { return !(*this == o); }
-
- void setCustomPropertyValue(const AtomicString& name, const RefPtr<CSSValue>& value)
- {
- m_values.set(name, value);
- if (value->isVariableDependentValue())
- m_containsVariables = true;
- }
-
- RefPtr<CSSValue> getCustomPropertyValue(const AtomicString& name) const { return m_values.get(name); }
- CustomPropertyValueMap& values() { return m_values; }
-
- bool hasCustomProperty(const AtomicString& name) const { return m_values.contains(name); }
-
- bool containsVariables() const { return m_containsVariables; }
- void setContainsVariables(bool containsVariables) { m_containsVariables = containsVariables; }
-
- CustomPropertyValueMap m_values;
- bool m_containsVariables { false };
-
-private:
- explicit StyleCustomPropertyData()
- : RefCounted<StyleCustomPropertyData>()
- { }
- StyleCustomPropertyData(const StyleCustomPropertyData& other)
- : RefCounted<StyleCustomPropertyData>()
- , m_values(CustomPropertyValueMap(other.m_values))
- , m_containsVariables(other.m_containsVariables)
- { }
-};
-
-} // namespace WebCore
-
-#endif // StyleCustomPropertyData_h
diff --git a/Source/WebCore/rendering/style/StyleDeprecatedFlexibleBoxData.cpp b/Source/WebCore/rendering/style/StyleDeprecatedFlexibleBoxData.cpp
index 32f7805eb..3c835923a 100644
--- a/Source/WebCore/rendering/style/StyleDeprecatedFlexibleBoxData.cpp
+++ b/Source/WebCore/rendering/style/StyleDeprecatedFlexibleBoxData.cpp
@@ -49,7 +49,7 @@ inline StyleDeprecatedFlexibleBoxData::StyleDeprecatedFlexibleBoxData(const Styl
{
}
-Ref<StyleDeprecatedFlexibleBoxData> StyleDeprecatedFlexibleBoxData::copy() const
+PassRef<StyleDeprecatedFlexibleBoxData> StyleDeprecatedFlexibleBoxData::copy() const
{
return adoptRef(*new StyleDeprecatedFlexibleBoxData(*this));
}
diff --git a/Source/WebCore/rendering/style/StyleDeprecatedFlexibleBoxData.h b/Source/WebCore/rendering/style/StyleDeprecatedFlexibleBoxData.h
index 20fee8bb2..64c9c7fa0 100644
--- a/Source/WebCore/rendering/style/StyleDeprecatedFlexibleBoxData.h
+++ b/Source/WebCore/rendering/style/StyleDeprecatedFlexibleBoxData.h
@@ -32,8 +32,8 @@ namespace WebCore {
class StyleDeprecatedFlexibleBoxData : public RefCounted<StyleDeprecatedFlexibleBoxData> {
public:
- static Ref<StyleDeprecatedFlexibleBoxData> create() { return adoptRef(*new StyleDeprecatedFlexibleBoxData); }
- Ref<StyleDeprecatedFlexibleBoxData> copy() const;
+ static PassRef<StyleDeprecatedFlexibleBoxData> create() { return adoptRef(*new StyleDeprecatedFlexibleBoxData); }
+ PassRef<StyleDeprecatedFlexibleBoxData> copy() const;
bool operator==(const StyleDeprecatedFlexibleBoxData&) const;
bool operator!=(const StyleDeprecatedFlexibleBoxData& o) const
diff --git a/Source/WebCore/rendering/style/StyleFilterData.cpp b/Source/WebCore/rendering/style/StyleFilterData.cpp
index b0d3be110..d1eb94bd4 100644
--- a/Source/WebCore/rendering/style/StyleFilterData.cpp
+++ b/Source/WebCore/rendering/style/StyleFilterData.cpp
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -27,6 +27,9 @@
#include "StyleFilterData.h"
#include "FEGaussianBlur.h"
+
+#if ENABLE(CSS_FILTERS)
+
#include "RenderStyle.h"
namespace WebCore {
@@ -42,7 +45,7 @@ inline StyleFilterData::StyleFilterData(const StyleFilterData& o)
{
}
-Ref<StyleFilterData> StyleFilterData::copy() const
+PassRef<StyleFilterData> StyleFilterData::copy() const
{
return adoptRef(*new StyleFilterData(*this));
}
@@ -53,3 +56,5 @@ bool StyleFilterData::operator==(const StyleFilterData& o) const
}
} // namespace WebCore
+
+#endif // ENABLE(CSS_FILTERS)
diff --git a/Source/WebCore/rendering/style/StyleFilterData.h b/Source/WebCore/rendering/style/StyleFilterData.h
index 210d0ecb9..25e2f7a3b 100644
--- a/Source/WebCore/rendering/style/StyleFilterData.h
+++ b/Source/WebCore/rendering/style/StyleFilterData.h
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -26,6 +26,8 @@
#ifndef StyleFilterData_h
#define StyleFilterData_h
+#if ENABLE(CSS_FILTERS)
+
#include "FilterOperations.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
@@ -34,8 +36,8 @@ namespace WebCore {
class StyleFilterData : public RefCounted<StyleFilterData> {
public:
- static Ref<StyleFilterData> create() { return adoptRef(*new StyleFilterData); }
- Ref<StyleFilterData> copy() const;
+ static PassRef<StyleFilterData> create() { return adoptRef(*new StyleFilterData); }
+ PassRef<StyleFilterData> copy() const;
bool operator==(const StyleFilterData&) const;
bool operator!=(const StyleFilterData& o) const
@@ -52,4 +54,6 @@ private:
} // namespace WebCore
+#endif // ENABLE(CSS_FILTERS)
+
#endif // StyleFilterData_h
diff --git a/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp b/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp
index 99e55eb7e..775886b6e 100644
--- a/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp
+++ b/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp
@@ -49,7 +49,7 @@ inline StyleFlexibleBoxData::StyleFlexibleBoxData(const StyleFlexibleBoxData& o)
{
}
-Ref<StyleFlexibleBoxData> StyleFlexibleBoxData::copy() const
+PassRef<StyleFlexibleBoxData> StyleFlexibleBoxData::copy() const
{
return adoptRef(*new StyleFlexibleBoxData(*this));
}
diff --git a/Source/WebCore/rendering/style/StyleFlexibleBoxData.h b/Source/WebCore/rendering/style/StyleFlexibleBoxData.h
index d332de552..0e3352c09 100644
--- a/Source/WebCore/rendering/style/StyleFlexibleBoxData.h
+++ b/Source/WebCore/rendering/style/StyleFlexibleBoxData.h
@@ -35,8 +35,8 @@ namespace WebCore {
class StyleFlexibleBoxData : public RefCounted<StyleFlexibleBoxData> {
public:
- static Ref<StyleFlexibleBoxData> create() { return adoptRef(*new StyleFlexibleBoxData); }
- Ref<StyleFlexibleBoxData> copy() const;
+ static PassRef<StyleFlexibleBoxData> create() { return adoptRef(*new StyleFlexibleBoxData); }
+ PassRef<StyleFlexibleBoxData> copy() const;
bool operator==(const StyleFlexibleBoxData&) const;
bool operator!=(const StyleFlexibleBoxData& o) const
diff --git a/Source/WebCore/rendering/style/StyleGeneratedImage.cpp b/Source/WebCore/rendering/style/StyleGeneratedImage.cpp
index 24ae933a9..6b59fe7c4 100644
--- a/Source/WebCore/rendering/style/StyleGeneratedImage.cpp
+++ b/Source/WebCore/rendering/style/StyleGeneratedImage.cpp
@@ -30,8 +30,8 @@
namespace WebCore {
-StyleGeneratedImage::StyleGeneratedImage(Ref<CSSImageGeneratorValue>&& value)
- : m_imageGeneratorValue(WTFMove(value))
+StyleGeneratedImage::StyleGeneratedImage(PassRef<CSSImageGeneratorValue> value)
+ : m_imageGeneratorValue(std::move(value))
, m_fixedSize(m_imageGeneratorValue->isFixedSize())
{
m_isGeneratedImage = true;
@@ -39,28 +39,27 @@ StyleGeneratedImage::StyleGeneratedImage(Ref<CSSImageGeneratorValue>&& value)
PassRefPtr<CSSValue> StyleGeneratedImage::cssValue() const
{
- return const_cast<CSSImageGeneratorValue*>(m_imageGeneratorValue.ptr());
+ return &const_cast<CSSImageGeneratorValue&>(m_imageGeneratorValue.get());
}
-FloatSize StyleGeneratedImage::imageSize(const RenderElement* renderer, float multiplier) const
+LayoutSize StyleGeneratedImage::imageSize(const RenderElement* renderer, float multiplier) const
{
if (m_fixedSize) {
- FloatSize fixedSize = const_cast<CSSImageGeneratorValue&>(m_imageGeneratorValue.get()).fixedSize(renderer);
+ IntSize fixedSize = const_cast<CSSImageGeneratorValue&>(m_imageGeneratorValue.get()).fixedSize(renderer);
if (multiplier == 1.0f)
return fixedSize;
- float width = fixedSize.width() * multiplier;
- float height = fixedSize.height() * multiplier;
+ LayoutUnit width = fixedSize.width() * multiplier;
+ LayoutUnit height = fixedSize.height() * multiplier;
- // Don't let images that have a width/height >= 1 shrink below 1 device pixel when zoomed.
- float deviceScaleFactor = renderer ? renderer->document().deviceScaleFactor() : 1;
+ // Don't let images that have a width/height >= 1 shrink below 1 when zoomed.
if (fixedSize.width() > 0)
- width = std::max<float>(1 / deviceScaleFactor, width);
+ width = std::max<LayoutUnit>(1, width);
if (fixedSize.height() > 0)
- height = std::max<float>(1 / deviceScaleFactor, height);
+ height = std::max<LayoutUnit>(1, height);
- return FloatSize(width, height);
+ return LayoutSize(width, height);
}
return m_containerSize;
@@ -68,8 +67,8 @@ FloatSize StyleGeneratedImage::imageSize(const RenderElement* renderer, float mu
void StyleGeneratedImage::computeIntrinsicDimensions(const RenderElement* renderer, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)
{
- // At a zoom level of 1 the image is guaranteed to have a device pixel size.
- FloatSize size = floorSizeToDevicePixels(LayoutSize(imageSize(renderer, 1)), renderer ? renderer->document().deviceScaleFactor() : 1);
+ // At a zoom level of 1 the image is guaranteed to have an integer size.
+ IntSize size = flooredIntSize(imageSize(renderer, 1));
intrinsicWidth = Length(size.width(), Fixed);
intrinsicHeight = Length(size.height(), Fixed);
intrinsicRatio = size;
@@ -85,7 +84,7 @@ void StyleGeneratedImage::removeClient(RenderElement* renderer)
m_imageGeneratorValue->removeClient(renderer);
}
-RefPtr<Image> StyleGeneratedImage::image(RenderElement* renderer, const FloatSize& size) const
+PassRefPtr<Image> StyleGeneratedImage::image(RenderElement* renderer, const IntSize& size) const
{
return const_cast<CSSImageGeneratorValue&>(m_imageGeneratorValue.get()).image(renderer, size);
}
diff --git a/Source/WebCore/rendering/style/StyleGeneratedImage.h b/Source/WebCore/rendering/style/StyleGeneratedImage.h
index db49dd544..756ca2152 100644
--- a/Source/WebCore/rendering/style/StyleGeneratedImage.h
+++ b/Source/WebCore/rendering/style/StyleGeneratedImage.h
@@ -33,38 +33,41 @@ class CSSImageGeneratorValue;
class StyleGeneratedImage final : public StyleImage {
public:
- static Ref<StyleGeneratedImage> create(Ref<CSSImageGeneratorValue>&& value)
+ static PassRefPtr<StyleGeneratedImage> create(PassRef<CSSImageGeneratorValue> value)
{
- return adoptRef(*new StyleGeneratedImage(WTFMove(value)));
+ return adoptRef(new StyleGeneratedImage(std::move(value)));
}
- CSSImageGeneratorValue& imageValue() { return m_imageGeneratorValue; }
+ CSSImageGeneratorValue& imageValue() { return m_imageGeneratorValue.get(); }
private:
- virtual WrappedImagePtr data() const override { return m_imageGeneratorValue.ptr(); }
+ virtual WrappedImagePtr data() const override { return &m_imageGeneratorValue.get(); }
virtual PassRefPtr<CSSValue> cssValue() const override;
- virtual FloatSize imageSize(const RenderElement*, float multiplier) const override;
+ virtual LayoutSize imageSize(const RenderElement*, float multiplier) const override;
virtual bool imageHasRelativeWidth() const override { return !m_fixedSize; }
virtual bool imageHasRelativeHeight() const override { return !m_fixedSize; }
virtual void computeIntrinsicDimensions(const RenderElement*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) override;
virtual bool usesImageContainerSize() const override { return !m_fixedSize; }
- virtual void setContainerSizeForRenderer(const RenderElement*, const FloatSize& containerSize, float) override { m_containerSize = containerSize; }
+ virtual void setContainerSizeForRenderer(const RenderElement*, const IntSize& containerSize, float) override { m_containerSize = containerSize; }
virtual void addClient(RenderElement*) override;
virtual void removeClient(RenderElement*) override;
- virtual RefPtr<Image> image(RenderElement*, const FloatSize&) const override;
+ virtual PassRefPtr<Image> image(RenderElement*, const IntSize&) const override;
virtual bool knownToBeOpaque(const RenderElement*) const override;
- explicit StyleGeneratedImage(Ref<CSSImageGeneratorValue>&&);
+ StyleGeneratedImage(PassRef<CSSImageGeneratorValue>);
Ref<CSSImageGeneratorValue> m_imageGeneratorValue;
- FloatSize m_containerSize;
+ IntSize m_containerSize;
bool m_fixedSize;
};
-} // namespace WebCore
+inline StyleGeneratedImage* toStyleGeneratedImage(StyleImage* image)
+{
+ ASSERT_WITH_SECURITY_IMPLICATION(!image || image->isGeneratedImage());
+ return static_cast<StyleGeneratedImage*>(image);
+}
-SPECIALIZE_TYPE_TRAITS_STYLE_IMAGE(StyleGeneratedImage, isGeneratedImage)
-
-#endif // StyleGeneratedImage_h
+}
+#endif
diff --git a/Source/WebCore/rendering/style/StyleGridData.cpp b/Source/WebCore/rendering/style/StyleGridData.cpp
index fa22ed2c3..10eccc0d8 100644
--- a/Source/WebCore/rendering/style/StyleGridData.cpp
+++ b/Source/WebCore/rendering/style/StyleGridData.cpp
@@ -26,8 +26,6 @@
#include "config.h"
#include "StyleGridData.h"
-#if ENABLE(CSS_GRID_LAYOUT)
-
#include "RenderStyle.h"
namespace WebCore {
@@ -37,16 +35,12 @@ StyleGridData::StyleGridData()
, m_gridRows(RenderStyle::initialGridRows())
, m_namedGridColumnLines(RenderStyle::initialNamedGridColumnLines())
, m_namedGridRowLines(RenderStyle::initialNamedGridRowLines())
- , m_orderedNamedGridColumnLines(RenderStyle::initialOrderedNamedGridColumnLines())
- , m_orderedNamedGridRowLines(RenderStyle::initialOrderedNamedGridRowLines())
, m_gridAutoFlow(RenderStyle::initialGridAutoFlow())
, m_gridAutoRows(RenderStyle::initialGridAutoRows())
, m_gridAutoColumns(RenderStyle::initialGridAutoColumns())
, m_namedGridArea(RenderStyle::initialNamedGridArea())
, m_namedGridAreaRowCount(RenderStyle::initialNamedGridAreaCount())
, m_namedGridAreaColumnCount(RenderStyle::initialNamedGridAreaCount())
- , m_gridColumnGap(RenderStyle::initialGridColumnGap())
- , m_gridRowGap(RenderStyle::initialGridRowGap())
{
}
@@ -56,24 +50,19 @@ inline StyleGridData::StyleGridData(const StyleGridData& o)
, m_gridRows(o.m_gridRows)
, m_namedGridColumnLines(o.m_namedGridColumnLines)
, m_namedGridRowLines(o.m_namedGridRowLines)
- , m_orderedNamedGridColumnLines(o.m_orderedNamedGridColumnLines)
- , m_orderedNamedGridRowLines(o.m_orderedNamedGridRowLines)
, m_gridAutoFlow(o.m_gridAutoFlow)
, m_gridAutoRows(o.m_gridAutoRows)
, m_gridAutoColumns(o.m_gridAutoColumns)
, m_namedGridArea(o.m_namedGridArea)
, m_namedGridAreaRowCount(o.m_namedGridAreaRowCount)
, m_namedGridAreaColumnCount(o.m_namedGridAreaColumnCount)
- , m_gridColumnGap(o.m_gridColumnGap)
- , m_gridRowGap(o.m_gridRowGap)
{
}
-Ref<StyleGridData> StyleGridData::copy() const
+PassRef<StyleGridData> StyleGridData::copy() const
{
return adoptRef(*new StyleGridData(*this));
}
} // namespace WebCore
-#endif /* ENABLE(CSS_GRID_LAYOUT) */
diff --git a/Source/WebCore/rendering/style/StyleGridData.h b/Source/WebCore/rendering/style/StyleGridData.h
index d895cdaa7..7fe4c9588 100644
--- a/Source/WebCore/rendering/style/StyleGridData.h
+++ b/Source/WebCore/rendering/style/StyleGridData.h
@@ -26,8 +26,6 @@
#ifndef StyleGridData_h
#define StyleGridData_h
-#if ENABLE(CSS_GRID_LAYOUT)
-
#include "GridCoordinate.h"
#include "GridTrackSize.h"
#include "RenderStyleConstants.h"
@@ -38,24 +36,17 @@
namespace WebCore {
-typedef HashMap<String, Vector<unsigned>> NamedGridLinesMap;
-typedef HashMap<unsigned, Vector<String>, WTF::IntHash<unsigned>, WTF::UnsignedWithZeroKeyHashTraits<unsigned>> OrderedNamedGridLinesMap;
+typedef HashMap<String, Vector<size_t>> NamedGridLinesMap;
class StyleGridData : public RefCounted<StyleGridData> {
public:
- static Ref<StyleGridData> create() { return adoptRef(*new StyleGridData); }
- Ref<StyleGridData> copy() const;
+ static PassRef<StyleGridData> create() { return adoptRef(*new StyleGridData); }
+ PassRef<StyleGridData> copy() const;
bool operator==(const StyleGridData& o) const
{
// FIXME: comparing two hashes doesn't look great for performance. Something to keep in mind going forward.
- return m_gridColumns == o.m_gridColumns && m_gridRows == o.m_gridRows
- && m_gridAutoFlow == o.m_gridAutoFlow && m_gridAutoRows == o.m_gridAutoRows && m_gridAutoColumns == o.m_gridAutoColumns
- && m_namedGridColumnLines == o.m_namedGridColumnLines && m_namedGridRowLines == o.m_namedGridRowLines
- && m_namedGridArea == o.m_namedGridArea && m_namedGridArea == o.m_namedGridArea
- && m_namedGridAreaRowCount == o.m_namedGridAreaRowCount && m_namedGridAreaColumnCount == o.m_namedGridAreaColumnCount
- && m_orderedNamedGridRowLines == o.m_orderedNamedGridRowLines && m_orderedNamedGridColumnLines == o.m_orderedNamedGridColumnLines
- && m_gridColumnGap == o.m_gridColumnGap && m_gridRowGap == o.m_gridRowGap;
+ return m_gridColumns == o.m_gridColumns && m_gridRows == o.m_gridRows && m_gridAutoFlow == o.m_gridAutoFlow && m_gridAutoRows == o.m_gridAutoRows && m_gridAutoColumns == o.m_gridAutoColumns && m_namedGridColumnLines == o.m_namedGridColumnLines && m_namedGridRowLines == o.m_namedGridRowLines && m_namedGridArea == o.m_namedGridArea && m_namedGridArea == o.m_namedGridArea && m_namedGridAreaRowCount == o.m_namedGridAreaRowCount && m_namedGridAreaColumnCount == o.m_namedGridAreaColumnCount;
}
bool operator!=(const StyleGridData& o) const
@@ -70,10 +61,7 @@ public:
NamedGridLinesMap m_namedGridColumnLines;
NamedGridLinesMap m_namedGridRowLines;
- OrderedNamedGridLinesMap m_orderedNamedGridColumnLines;
- OrderedNamedGridLinesMap m_orderedNamedGridRowLines;
-
- unsigned m_gridAutoFlow : GridAutoFlowBits;
+ GridAutoFlow m_gridAutoFlow;
GridTrackSize m_gridAutoRows;
GridTrackSize m_gridAutoColumns;
@@ -81,11 +69,8 @@ public:
NamedGridAreaMap m_namedGridArea;
// Because m_namedGridArea doesn't store the unnamed grid areas, we need to keep track
// of the explicit grid size defined by both named and unnamed grid areas.
- unsigned m_namedGridAreaRowCount;
- unsigned m_namedGridAreaColumnCount;
-
- Length m_gridColumnGap;
- Length m_gridRowGap;
+ size_t m_namedGridAreaRowCount;
+ size_t m_namedGridAreaColumnCount;
private:
StyleGridData();
@@ -94,6 +79,4 @@ private:
} // namespace WebCore
-#endif /* ENABLE(CSS_GRID_LAYOUT) */
-
#endif // StyleGridData_h
diff --git a/Source/WebCore/rendering/style/StyleGridItemData.cpp b/Source/WebCore/rendering/style/StyleGridItemData.cpp
index 102be908d..0c9929a7d 100644
--- a/Source/WebCore/rendering/style/StyleGridItemData.cpp
+++ b/Source/WebCore/rendering/style/StyleGridItemData.cpp
@@ -30,8 +30,6 @@
#include "config.h"
#include "StyleGridItemData.h"
-#if ENABLE(CSS_GRID_LAYOUT)
-
#include "RenderStyle.h"
namespace WebCore {
@@ -53,11 +51,9 @@ inline StyleGridItemData::StyleGridItemData(const StyleGridItemData& o)
{
}
-Ref<StyleGridItemData> StyleGridItemData::copy() const
+PassRef<StyleGridItemData> StyleGridItemData::copy() const
{
return adoptRef(*new StyleGridItemData(*this));
}
} // namespace WebCore
-
-#endif /* ENABLE(CSS_GRID_LAYOUT) */
diff --git a/Source/WebCore/rendering/style/StyleGridItemData.h b/Source/WebCore/rendering/style/StyleGridItemData.h
index d6678174b..c0f9d987a 100644
--- a/Source/WebCore/rendering/style/StyleGridItemData.h
+++ b/Source/WebCore/rendering/style/StyleGridItemData.h
@@ -31,7 +31,6 @@
#ifndef StyleGridItemData_h
#define StyleGridItemData_h
-#if ENABLE(CSS_GRID_LAYOUT)
#include "GridPosition.h"
#include <wtf/PassRefPtr.h>
@@ -42,8 +41,8 @@ namespace WebCore {
class StyleGridItemData : public RefCounted<StyleGridItemData> {
public:
- static Ref<StyleGridItemData> create() { return adoptRef(*new StyleGridItemData); }
- Ref<StyleGridItemData> copy() const;
+ static PassRef<StyleGridItemData> create() { return adoptRef(*new StyleGridItemData); }
+ PassRef<StyleGridItemData> copy() const;
bool operator==(const StyleGridItemData& o) const
{
@@ -68,6 +67,4 @@ private:
} // namespace WebCore
-#endif /* ENABLE(CSS_GRID_LAYOUT) */
-
#endif // StyleGridItemData_h
diff --git a/Source/WebCore/rendering/style/StyleImage.h b/Source/WebCore/rendering/style/StyleImage.h
index 0e83f2e96..a0bd45a6f 100644
--- a/Source/WebCore/rendering/style/StyleImage.h
+++ b/Source/WebCore/rendering/style/StyleImage.h
@@ -25,12 +25,12 @@
#define StyleImage_h
#include "CSSValue.h"
-#include "FloatSize.h"
#include "Image.h"
+#include "IntSize.h"
+#include "LayoutSize.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
-#include <wtf/TypeCasts.h>
namespace WebCore {
@@ -55,15 +55,15 @@ public:
virtual bool canRender(const RenderObject*, float /*multiplier*/) const { return true; }
virtual bool isLoaded() const { return true; }
virtual bool errorOccurred() const { return false; }
- virtual FloatSize imageSize(const RenderElement*, float multiplier) const = 0;
+ virtual LayoutSize imageSize(const RenderElement*, float multiplier) const = 0;
virtual void computeIntrinsicDimensions(const RenderElement*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) = 0;
virtual bool imageHasRelativeWidth() const = 0;
virtual bool imageHasRelativeHeight() const = 0;
virtual bool usesImageContainerSize() const = 0;
- virtual void setContainerSizeForRenderer(const RenderElement*, const FloatSize&, float) = 0;
+ virtual void setContainerSizeForRenderer(const RenderElement*, const IntSize&, float) = 0;
virtual void addClient(RenderElement*) = 0;
virtual void removeClient(RenderElement*) = 0;
- virtual RefPtr<Image> image(RenderElement*, const FloatSize&) const = 0;
+ virtual PassRefPtr<Image> image(RenderElement*, const IntSize&) const = 0;
virtual WrappedImagePtr data() const = 0;
virtual float imageScaleFactor() const { return 1; }
virtual bool knownToBeOpaque(const RenderElement*) const = 0;
@@ -74,6 +74,11 @@ public:
ALWAYS_INLINE bool isGeneratedImage() const { return m_isGeneratedImage; }
ALWAYS_INLINE bool isCachedImageSet() const { return m_isCachedImageSet; }
+ static bool imagesEquivalent(StyleImage* image1, StyleImage* image2)
+ {
+ return image1 == image2 || (image1 && image2 && *image1 == *image2);
+ }
+
protected:
StyleImage()
: m_isCachedImage(false)
@@ -88,11 +93,5 @@ protected:
bool m_isCachedImageSet : 1;
};
-} // namespace WebCore
-
-#define SPECIALIZE_TYPE_TRAITS_STYLE_IMAGE(ToClassName, predicate) \
-SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToClassName) \
- static bool isType(const WebCore::StyleImage& image) { return image.predicate(); } \
-SPECIALIZE_TYPE_TRAITS_END()
-
-#endif // StyleImage_h
+}
+#endif
diff --git a/Source/WebCore/rendering/style/StyleInheritedData.cpp b/Source/WebCore/rendering/style/StyleInheritedData.cpp
index bfceeca72..7f2e1c551 100644
--- a/Source/WebCore/rendering/style/StyleInheritedData.cpp
+++ b/Source/WebCore/rendering/style/StyleInheritedData.cpp
@@ -50,13 +50,13 @@ inline StyleInheritedData::StyleInheritedData(const StyleInheritedData& o)
#if ENABLE(IOS_TEXT_AUTOSIZING)
, specifiedLineHeight(o.specifiedLineHeight)
#endif
- , fontCascade(o.fontCascade)
+ , font(o.font)
, color(o.color)
, visitedLinkColor(o.visitedLinkColor)
{
}
-Ref<StyleInheritedData> StyleInheritedData::copy() const
+PassRef<StyleInheritedData> StyleInheritedData::copy() const
{
return adoptRef(*new StyleInheritedData(*this));
}
@@ -67,7 +67,7 @@ bool StyleInheritedData::operator==(const StyleInheritedData& o) const
#if ENABLE(IOS_TEXT_AUTOSIZING)
&& specifiedLineHeight == o.specifiedLineHeight
#endif
- && fontCascade == o.fontCascade
+ && font == o.font
&& color == o.color
&& visitedLinkColor == o.visitedLinkColor
&& horizontal_border_spacing == o.horizontal_border_spacing
diff --git a/Source/WebCore/rendering/style/StyleInheritedData.h b/Source/WebCore/rendering/style/StyleInheritedData.h
index ae2cf678c..a65beff47 100644
--- a/Source/WebCore/rendering/style/StyleInheritedData.h
+++ b/Source/WebCore/rendering/style/StyleInheritedData.h
@@ -26,9 +26,9 @@
#define StyleInheritedData_h
#include "Color.h"
-#include "FontCascade.h"
+#include "Font.h"
#include "Length.h"
-#include <wtf/Ref.h>
+#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
@@ -36,8 +36,8 @@ namespace WebCore {
class StyleInheritedData : public RefCounted<StyleInheritedData> {
public:
- static Ref<StyleInheritedData> create() { return adoptRef(*new StyleInheritedData); }
- Ref<StyleInheritedData> copy() const;
+ static PassRef<StyleInheritedData> create() { return adoptRef(*new StyleInheritedData); }
+ PassRef<StyleInheritedData> copy() const;
~StyleInheritedData();
bool operator==(const StyleInheritedData& o) const;
@@ -56,7 +56,7 @@ public:
Length specifiedLineHeight;
#endif
- FontCascade fontCascade;
+ Font font;
Color color;
Color visitedLinkColor;
diff --git a/Source/WebCore/rendering/style/StyleMarqueeData.cpp b/Source/WebCore/rendering/style/StyleMarqueeData.cpp
index 597b3f776..5e25e4983 100644
--- a/Source/WebCore/rendering/style/StyleMarqueeData.cpp
+++ b/Source/WebCore/rendering/style/StyleMarqueeData.cpp
@@ -45,7 +45,7 @@ inline StyleMarqueeData::StyleMarqueeData(const StyleMarqueeData& o)
{
}
-Ref<StyleMarqueeData> StyleMarqueeData::copy() const
+PassRef<StyleMarqueeData> StyleMarqueeData::copy() const
{
return adoptRef(*new StyleMarqueeData(*this));
}
diff --git a/Source/WebCore/rendering/style/StyleMarqueeData.h b/Source/WebCore/rendering/style/StyleMarqueeData.h
index dd11a6ed1..69e9dcc3c 100644
--- a/Source/WebCore/rendering/style/StyleMarqueeData.h
+++ b/Source/WebCore/rendering/style/StyleMarqueeData.h
@@ -34,8 +34,8 @@ namespace WebCore {
class StyleMarqueeData : public RefCounted<StyleMarqueeData> {
public:
- static Ref<StyleMarqueeData> create() { return adoptRef(*new StyleMarqueeData); }
- Ref<StyleMarqueeData> copy() const;
+ static PassRef<StyleMarqueeData> create() { return adoptRef(*new StyleMarqueeData); }
+ PassRef<StyleMarqueeData> copy() const;
bool operator==(const StyleMarqueeData& o) const;
bool operator!=(const StyleMarqueeData& o) const
diff --git a/Source/WebCore/rendering/style/StyleMultiColData.cpp b/Source/WebCore/rendering/style/StyleMultiColData.cpp
index 5c90e20a1..68b6178ed 100644
--- a/Source/WebCore/rendering/style/StyleMultiColData.cpp
+++ b/Source/WebCore/rendering/style/StyleMultiColData.cpp
@@ -35,6 +35,9 @@ StyleMultiColData::StyleMultiColData()
, m_normalGap(true)
, m_fill(RenderStyle::initialColumnFill())
, m_columnSpan(false)
+ , m_breakBefore(RenderStyle::initialPageBreak())
+ , m_breakAfter(RenderStyle::initialPageBreak())
+ , m_breakInside(RenderStyle::initialPageBreak())
, m_axis(RenderStyle::initialColumnAxis())
, m_progression(RenderStyle::initialColumnProgression())
{
@@ -52,12 +55,15 @@ inline StyleMultiColData::StyleMultiColData(const StyleMultiColData& o)
, m_normalGap(o.m_normalGap)
, m_fill(o.m_fill)
, m_columnSpan(o.m_columnSpan)
+ , m_breakBefore(o.m_breakBefore)
+ , m_breakAfter(o.m_breakAfter)
+ , m_breakInside(o.m_breakInside)
, m_axis(o.m_axis)
, m_progression(o.m_progression)
{
}
-Ref<StyleMultiColData> StyleMultiColData::copy() const
+PassRef<StyleMultiColData> StyleMultiColData::copy() const
{
return adoptRef(*new StyleMultiColData(*this));
}
@@ -65,9 +71,10 @@ Ref<StyleMultiColData> StyleMultiColData::copy() const
bool StyleMultiColData::operator==(const StyleMultiColData& o) const
{
return m_width == o.m_width && m_count == o.m_count && m_gap == o.m_gap
- && m_rule == o.m_rule && m_visitedLinkColumnRuleColor == o.m_visitedLinkColumnRuleColor
+ && m_rule == o.m_rule && m_visitedLinkColumnRuleColor == o.m_visitedLinkColumnRuleColor && m_breakBefore == o.m_breakBefore
&& m_autoWidth == o.m_autoWidth && m_autoCount == o.m_autoCount && m_normalGap == o.m_normalGap
&& m_fill == o.m_fill && m_columnSpan == o.m_columnSpan
+ && m_breakAfter == o.m_breakAfter && m_breakInside == o.m_breakInside
&& m_axis == o.m_axis && m_progression == o.m_progression;
}
diff --git a/Source/WebCore/rendering/style/StyleMultiColData.h b/Source/WebCore/rendering/style/StyleMultiColData.h
index f16ea5fd9..0e42e6f29 100644
--- a/Source/WebCore/rendering/style/StyleMultiColData.h
+++ b/Source/WebCore/rendering/style/StyleMultiColData.h
@@ -37,8 +37,8 @@ namespace WebCore {
class StyleMultiColData : public RefCounted<StyleMultiColData> {
public:
- static Ref<StyleMultiColData> create() { return adoptRef(*new StyleMultiColData); }
- Ref<StyleMultiColData> copy() const;
+ static PassRef<StyleMultiColData> create() { return adoptRef(*new StyleMultiColData); }
+ PassRef<StyleMultiColData> copy() const;
bool operator==(const StyleMultiColData& o) const;
bool operator!=(const StyleMultiColData &o) const
@@ -64,6 +64,9 @@ public:
bool m_normalGap : 1;
unsigned m_fill : 1; // ColumnFill
unsigned m_columnSpan : 1;
+ unsigned m_breakBefore : 2; // EPageBreak
+ unsigned m_breakAfter : 2; // EPageBreak
+ unsigned m_breakInside : 2; // EPageBreak
unsigned m_axis : 2; // ColumnAxis
unsigned m_progression : 2; // ColumnProgression
diff --git a/Source/WebCore/rendering/style/StylePendingImage.h b/Source/WebCore/rendering/style/StylePendingImage.h
index 1924fba7a..68ca1c222 100644
--- a/Source/WebCore/rendering/style/StylePendingImage.h
+++ b/Source/WebCore/rendering/style/StylePendingImage.h
@@ -13,7 +13,7 @@
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -41,16 +41,16 @@ namespace WebCore {
// style resolution, in order to avoid loading images that are not referenced by the final style.
// They should never exist in a RenderStyle after it has been returned from the style selector.
-class StylePendingImage final : public StyleImage {
+class StylePendingImage : public StyleImage {
public:
- static Ref<StylePendingImage> create(CSSValue* value) { return adoptRef(*new StylePendingImage(value)); }
+ static PassRefPtr<StylePendingImage> create(CSSValue* value) { return adoptRef(new StylePendingImage(value)); }
- CSSImageValue* cssImageValue() const { return is<CSSImageValue>(m_value) ? downcast<CSSImageValue>(m_value) : nullptr; }
- CSSImageGeneratorValue* cssImageGeneratorValue() const { return is<CSSImageGeneratorValue>(m_value) ? static_cast<CSSImageGeneratorValue*>(m_value) : nullptr; }
- CSSCursorImageValue* cssCursorImageValue() const { return is<CSSCursorImageValue>(m_value) ? downcast<CSSCursorImageValue>(m_value) : nullptr; }
+ CSSImageValue* cssImageValue() const { return m_value && m_value->isImageValue() ? toCSSImageValue(m_value) : nullptr; }
+ CSSImageGeneratorValue* cssImageGeneratorValue() const { return m_value && m_value->isImageGeneratorValue() ? static_cast<CSSImageGeneratorValue*>(m_value) : nullptr; }
+ CSSCursorImageValue* cssCursorImageValue() const { return m_value && m_value->isCursorImageValue() ? toCSSCursorImageValue(m_value) : nullptr; }
#if ENABLE(CSS_IMAGE_SET)
- CSSImageSetValue* cssImageSetValue() const { return is<CSSImageSetValue>(m_value) ? downcast<CSSImageSetValue>(m_value) : nullptr; }
+ CSSImageSetValue* cssImageSetValue() const { return m_value && m_value->isImageSetValue() ? toCSSImageSetValue(m_value) : nullptr; }
#endif
void detachFromCSSValue() { m_value = nullptr; }
@@ -60,16 +60,16 @@ private:
virtual PassRefPtr<CSSValue> cssValue() const override { return m_value; }
- virtual FloatSize imageSize(const RenderElement*, float /*multiplier*/) const override { return FloatSize(); }
+ virtual LayoutSize imageSize(const RenderElement*, float /*multiplier*/) const override { return LayoutSize(); }
virtual bool imageHasRelativeWidth() const override { return false; }
virtual bool imageHasRelativeHeight() const override { return false; }
- virtual void computeIntrinsicDimensions(const RenderElement*, Length& /* intrinsicWidth */ , Length& /* intrinsicHeight */, FloatSize& /* intrinsicRatio */) override { }
+ virtual void computeIntrinsicDimensions(const RenderElement*, Length& /* intrinsicWidth */ , Length& /* intrinsicHeight */, FloatSize& /* intrinsicRatio */) { }
virtual bool usesImageContainerSize() const override { return false; }
- virtual void setContainerSizeForRenderer(const RenderElement*, const FloatSize&, float) override { }
+ virtual void setContainerSizeForRenderer(const RenderElement*, const IntSize&, float) override { }
virtual void addClient(RenderElement*) override { }
virtual void removeClient(RenderElement*) override { }
- virtual RefPtr<Image> image(RenderElement*, const FloatSize&) const override
+ virtual PassRefPtr<Image> image(RenderElement*, const IntSize&) const override
{
ASSERT_NOT_REACHED();
return nullptr;
@@ -86,8 +86,6 @@ private:
CSSValue* m_value; // Not retained; it owns us.
};
-} // namespace WebCore
+}
-SPECIALIZE_TYPE_TRAITS_STYLE_IMAGE(StylePendingImage, isPendingImage)
-
-#endif // StylePendingImage_h
+#endif
diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
index 2098b9179..dcca2021d 100644
--- a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
+++ b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
@@ -23,14 +23,11 @@
#include "StyleRareInheritedData.h"
#include "CursorList.h"
-#include "DataRef.h"
#include "QuotesData.h"
#include "RenderStyle.h"
#include "RenderStyleConstants.h"
#include "ShadowData.h"
-#include "StyleCustomPropertyData.h"
#include "StyleImage.h"
-#include <wtf/PointerComparison.h>
namespace WebCore {
@@ -63,8 +60,6 @@ struct GreaterThanOrSameSizeAsStyleRareInheritedData : public RefCounted<Greater
#if ENABLE(TOUCH_EVENTS)
Color tapHighlightColor;
#endif
-
- void* customPropertyDataRefs[1];
};
COMPILE_ASSERT(sizeof(StyleRareInheritedData) <= sizeof(GreaterThanOrSameSizeAsStyleRareInheritedData), StyleRareInheritedData_should_bit_pack);
@@ -74,7 +69,6 @@ StyleRareInheritedData::StyleRareInheritedData()
, textStrokeWidth(RenderStyle::initialTextStrokeWidth())
, indent(RenderStyle::initialTextIndent())
, m_effectiveZoom(RenderStyle::initialZoom())
- , m_customProperties(StyleCustomPropertyData::create())
, widows(RenderStyle::initialWidows())
, orphans(RenderStyle::initialOrphans())
, m_hasAutoWidows(true)
@@ -85,13 +79,15 @@ StyleRareInheritedData::StyleRareInheritedData()
, overflowWrap(RenderStyle::initialOverflowWrap())
, nbspMode(NBNORMAL)
, lineBreak(LineBreakAuto)
+ , resize(RenderStyle::initialResize())
, userSelect(RenderStyle::initialUserSelect())
+ , colorSpace(ColorSpaceDeviceRGB)
, speak(SpeakNormal)
, hyphens(HyphensManual)
, textEmphasisFill(TextEmphasisFillFilled)
, textEmphasisMark(TextEmphasisMarkNone)
, textEmphasisPosition(TextEmphasisPositionOver | TextEmphasisPositionRight)
- , m_textOrientation(static_cast<unsigned>(TextOrientation::Mixed))
+ , m_textOrientation(TextOrientationVerticalRight)
#if ENABLE(CSS3_TEXT)
, m_textIndentLine(RenderStyle::initialTextIndentLine())
, m_textIndentType(RenderStyle::initialTextIndentType())
@@ -117,19 +113,17 @@ StyleRareInheritedData::StyleRareInheritedData()
, m_textDecorationSkip(RenderStyle::initialTextDecorationSkip())
, m_textUnderlinePosition(RenderStyle::initialTextUnderlinePosition())
, m_rubyPosition(RenderStyle::initialRubyPosition())
- , m_textZoom(RenderStyle::initialTextZoom())
#if PLATFORM(IOS)
, touchCalloutEnabled(RenderStyle::initialTouchCalloutEnabled())
#endif
-#if ENABLE(CSS_TRAILING_WORD)
- , trailingWord(static_cast<unsigned>(RenderStyle::initialTrailingWord()))
-#endif
- , m_hangingPunctuation(RenderStyle::initialHangingPunctuation())
, hyphenationLimitBefore(-1)
, hyphenationLimitAfter(-1)
, hyphenationLimitLines(-1)
, m_lineGrid(RenderStyle::initialLineGrid())
, m_tabSize(RenderStyle::initialTabSize())
+#if PLATFORM(IOS)
+ , compositionFillColor(RenderStyle::initialCompositionFillColor())
+#endif
#if ENABLE(IOS_TEXT_AUTOSIZING)
, textSizeAdjust(RenderStyle::initialTextSizeAdjust())
#endif
@@ -152,11 +146,11 @@ inline StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedDa
, visitedLinkTextStrokeColor(o.visitedLinkTextStrokeColor)
, visitedLinkTextFillColor(o.visitedLinkTextFillColor)
, visitedLinkTextEmphasisColor(o.visitedLinkTextEmphasisColor)
- , textShadow(o.textShadow ? std::make_unique<ShadowData>(*o.textShadow) : nullptr)
+ , textShadow(o.textShadow ? adoptPtr(new ShadowData(*o.textShadow)) : nullptr)
+ , highlight(o.highlight)
, cursorData(o.cursorData)
, indent(o.indent)
, m_effectiveZoom(o.m_effectiveZoom)
- , m_customProperties(o.m_customProperties)
, widows(o.widows)
, orphans(o.orphans)
, m_hasAutoWidows(o.m_hasAutoWidows)
@@ -167,7 +161,9 @@ inline StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedDa
, overflowWrap(o.overflowWrap)
, nbspMode(o.nbspMode)
, lineBreak(o.lineBreak)
+ , resize(o.resize)
, userSelect(o.userSelect)
+ , colorSpace(o.colorSpace)
, speak(o.speak)
, hyphens(o.hyphens)
, textEmphasisFill(o.textEmphasisFill)
@@ -199,21 +195,20 @@ inline StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedDa
, m_textDecorationSkip(o.m_textDecorationSkip)
, m_textUnderlinePosition(o.m_textUnderlinePosition)
, m_rubyPosition(o.m_rubyPosition)
- , m_textZoom(o.m_textZoom)
#if PLATFORM(IOS)
, touchCalloutEnabled(o.touchCalloutEnabled)
#endif
-#if ENABLE(CSS_TRAILING_WORD)
- , trailingWord(o.trailingWord)
-#endif
- , m_hangingPunctuation(o.m_hangingPunctuation)
, hyphenationString(o.hyphenationString)
, hyphenationLimitBefore(o.hyphenationLimitBefore)
, hyphenationLimitAfter(o.hyphenationLimitAfter)
, hyphenationLimitLines(o.hyphenationLimitLines)
+ , locale(o.locale)
, textEmphasisCustomMark(o.textEmphasisCustomMark)
, m_lineGrid(o.m_lineGrid)
, m_tabSize(o.m_tabSize)
+#if PLATFORM(IOS)
+ , compositionFillColor(o.compositionFillColor)
+#endif
#if ENABLE(IOS_TEXT_AUTOSIZING)
, textSizeAdjust(o.textSizeAdjust)
#endif
@@ -226,7 +221,7 @@ inline StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedDa
{
}
-Ref<StyleRareInheritedData> StyleRareInheritedData::copy() const
+PassRef<StyleRareInheritedData> StyleRareInheritedData::copy() const
{
return adoptRef(*new StyleRareInheritedData(*this));
}
@@ -235,6 +230,24 @@ StyleRareInheritedData::~StyleRareInheritedData()
{
}
+static bool cursorDataEquivalent(const CursorList* c1, const CursorList* c2)
+{
+ if (c1 == c2)
+ return true;
+ if ((!c1 && c2) || (c1 && !c2))
+ return false;
+ return (*c1 == *c2);
+}
+
+static bool quotesDataEquivalent(const QuotesData* q1, const QuotesData* q2)
+{
+ if (q1 == q2)
+ return true;
+ if ((!q1 && q2) || (q1 && !q2))
+ return false;
+ return (*q1 == *q2);
+}
+
bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
{
return textStrokeColor == o.textStrokeColor
@@ -247,8 +260,9 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
#if ENABLE(TOUCH_EVENTS)
&& tapHighlightColor == o.tapHighlightColor
#endif
- && arePointingToEqualData(textShadow, o.textShadow)
- && arePointingToEqualData(cursorData, o.cursorData)
+ && shadowDataEquivalent(o)
+ && highlight == o.highlight
+ && cursorDataEquivalent(cursorData.get(), o.cursorData.get())
&& indent == o.indent
&& m_effectiveZoom == o.m_effectiveZoom
&& widows == o.widows
@@ -267,7 +281,9 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
#if ENABLE(IOS_TEXT_AUTOSIZING)
&& textSizeAdjust == o.textSizeAdjust
#endif
+ && resize == o.resize
&& userSelect == o.userSelect
+ && colorSpace == o.colorSpace
&& speak == o.speak
&& hyphens == o.hyphens
&& hyphenationLimitBefore == o.hyphenationLimitBefore
@@ -284,10 +300,12 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
&& m_lineBoxContain == o.m_lineBoxContain
#if PLATFORM(IOS)
&& touchCalloutEnabled == o.touchCalloutEnabled
+ && compositionFillColor == o.compositionFillColor
#endif
&& hyphenationString == o.hyphenationString
+ && locale == o.locale
&& textEmphasisCustomMark == o.textEmphasisCustomMark
- && arePointingToEqualData(quotes, o.quotes)
+ && quotesDataEquivalent(quotes.get(), o.quotes.get())
&& m_tabSize == o.m_tabSize
&& m_lineGrid == o.m_lineGrid
#if ENABLE(CSS_IMAGE_ORIENTATION)
@@ -306,15 +324,18 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
&& m_textDecorationSkip == o.m_textDecorationSkip
&& m_textUnderlinePosition == o.m_textUnderlinePosition
&& m_rubyPosition == o.m_rubyPosition
- && m_textZoom == o.m_textZoom
&& m_lineSnap == o.m_lineSnap
&& m_lineAlign == o.m_lineAlign
-#if ENABLE(CSS_TRAILING_WORD)
- && trailingWord == o.trailingWord
-#endif
- && m_hangingPunctuation == o.m_hangingPunctuation
- && m_customProperties == o.m_customProperties
- && arePointingToEqualData(listStyleImage, o.listStyleImage);
+ && StyleImage::imagesEquivalent(listStyleImage.get(), o.listStyleImage.get());
+}
+
+bool StyleRareInheritedData::shadowDataEquivalent(const StyleRareInheritedData& o) const
+{
+ if ((!textShadow && o.textShadow) || (textShadow && !o.textShadow))
+ return false;
+ if (textShadow && o.textShadow && (*textShadow != *o.textShadow))
+ return false;
+ return true;
}
} // namespace WebCore
diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.h b/Source/WebCore/rendering/style/StyleRareInheritedData.h
index 5f7c23636..ec0183544 100644
--- a/Source/WebCore/rendering/style/StyleRareInheritedData.h
+++ b/Source/WebCore/rendering/style/StyleRareInheritedData.h
@@ -26,9 +26,7 @@
#define StyleRareInheritedData_h
#include "Color.h"
-#include "DataRef.h"
#include "Length.h"
-#include "StyleCustomPropertyData.h"
#include <wtf/RefCounted.h>
#include <wtf/PassRefPtr.h>
#include <wtf/text/AtomicString.h>
@@ -49,8 +47,8 @@ class StyleImage;
// actually uses one of these properties.
class StyleRareInheritedData : public RefCounted<StyleRareInheritedData> {
public:
- static Ref<StyleRareInheritedData> create() { return adoptRef(*new StyleRareInheritedData); }
- Ref<StyleRareInheritedData> copy() const;
+ static PassRef<StyleRareInheritedData> create() { return adoptRef(*new StyleRareInheritedData); }
+ PassRef<StyleRareInheritedData> copy() const;
~StyleRareInheritedData();
bool operator==(const StyleRareInheritedData& o) const;
@@ -58,6 +56,7 @@ public:
{
return !(*this == o);
}
+ bool shadowDataEquivalent(const StyleRareInheritedData&) const;
RefPtr<StyleImage> listStyleImage;
@@ -70,7 +69,8 @@ public:
Color visitedLinkTextFillColor;
Color visitedLinkTextEmphasisColor;
- std::unique_ptr<ShadowData> textShadow; // Our text shadow information for shadowed text drawing.
+ OwnPtr<ShadowData> textShadow; // Our text shadow information for shadowed text drawing.
+ AtomicString highlight; // Apple-specific extension for custom highlight rendering.
RefPtr<CursorList> cursorData;
Length indent;
@@ -78,8 +78,6 @@ public:
Length wordSpacing;
- DataRef<StyleCustomPropertyData> m_customProperties;
-
// Paged media properties.
short widows;
short orphans;
@@ -92,6 +90,7 @@ public:
unsigned overflowWrap : 1; // EOverflowWrap
unsigned nbspMode : 1; // ENBSPMode
unsigned lineBreak : 3; // LineBreak
+ unsigned resize : 2; // EResize
unsigned userSelect : 2; // EUserSelect
unsigned colorSpace : 1; // ColorSpace
unsigned speak : 3; // ESpeak
@@ -109,7 +108,7 @@ public:
#if ENABLE(CSS_IMAGE_ORIENTATION)
unsigned m_imageOrientation : 4; // ImageOrientationEnum
#endif
- unsigned m_imageRendering : 3; // EImageRendering
+ unsigned m_imageRendering : 2; // EImageRendering
unsigned m_lineSnap : 2; // LineSnap
unsigned m_lineAlign : 1; // LineAlign
#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
@@ -121,34 +120,32 @@ public:
#endif
#if ENABLE(CSS3_TEXT)
unsigned m_textAlignLast : 3; // TextAlignLast
- unsigned m_textJustify : 2; // TextJustify
+ unsigned m_textJustify : 3; // TextJustify
#endif // CSS3_TEXT
unsigned m_textDecorationSkip : 5; // TextDecorationSkip
unsigned m_textUnderlinePosition : 3; // TextUnderlinePosition
- unsigned m_rubyPosition : 2; // RubyPosition
- unsigned m_textZoom: 1; // TextZoom
+ unsigned m_rubyPosition : 1; // RubyPosition
#if PLATFORM(IOS)
unsigned touchCalloutEnabled : 1;
#endif
-#if ENABLE(CSS_TRAILING_WORD)
- unsigned trailingWord : 1;
-#endif
-
- unsigned m_hangingPunctuation : 4;
-
AtomicString hyphenationString;
short hyphenationLimitBefore;
short hyphenationLimitAfter;
short hyphenationLimitLines;
+ AtomicString locale;
+
AtomicString textEmphasisCustomMark;
RefPtr<QuotesData> quotes;
AtomicString m_lineGrid;
unsigned m_tabSize;
+#if PLATFORM(IOS)
+ Color compositionFillColor;
+#endif
#if ENABLE(IOS_TEXT_AUTOSIZING)
TextSizeAdjustment textSizeAdjust;
#endif
diff --git a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
index 24ae59cf2..d2bd56f70 100644
--- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
+++ b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
@@ -30,9 +30,6 @@
#include "StyleTransformData.h"
#include "StyleImage.h"
#include "StyleResolver.h"
-#include "StyleScrollSnapPoints.h"
-#include <wtf/PointerComparison.h>
-#include <wtf/RefPtr.h>
namespace WebCore {
@@ -44,28 +41,23 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
, m_perspectiveOriginX(RenderStyle::initialPerspectiveOriginX())
, m_perspectiveOriginY(RenderStyle::initialPerspectiveOriginY())
, lineClamp(RenderStyle::initialLineClamp())
- , m_initialLetter(RenderStyle::initialInitialLetter())
, m_deprecatedFlexibleBox(StyleDeprecatedFlexibleBoxData::create())
, m_flexibleBox(StyleFlexibleBoxData::create())
, m_marquee(StyleMarqueeData::create())
, m_multiCol(StyleMultiColData::create())
, m_transform(StyleTransformData::create())
+#if ENABLE(CSS_FILTERS)
, m_filter(StyleFilterData::create())
-#if ENABLE(FILTERS_LEVEL_2)
- , m_backdropFilter(StyleFilterData::create())
#endif
-#if ENABLE(CSS_GRID_LAYOUT)
, m_grid(StyleGridData::create())
, m_gridItem(StyleGridItemData::create())
-#endif
-#if ENABLE(CSS_SCROLL_SNAP)
- , m_scrollSnapPoints(StyleScrollSnapPoints::create())
-#endif
- , m_willChange(RenderStyle::initialWillChange())
, m_mask(FillLayer(MaskFillLayer))
+ , m_pageSize()
#if ENABLE(CSS_SHAPES)
+ , m_shapeInside(RenderStyle::initialShapeInside())
, m_shapeOutside(RenderStyle::initialShapeOutside())
, m_shapeMargin(RenderStyle::initialShapeMargin())
+ , m_shapePadding(RenderStyle::initialShapePadding())
, m_shapeImageThreshold(RenderStyle::initialShapeImageThreshold())
#endif
, m_clipPath(RenderStyle::initialClipPath())
@@ -73,22 +65,17 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
, m_order(RenderStyle::initialOrder())
, m_flowThread(RenderStyle::initialFlowThread())
, m_regionThread(RenderStyle::initialRegionThread())
- , m_alignContent(RenderStyle::initialContentAlignment())
- , m_alignItems(RenderStyle::initialSelfAlignment())
- , m_alignSelf(RenderStyle::initialSelfAlignment())
- , m_justifyContent(RenderStyle::initialContentAlignment())
- , m_justifyItems(RenderStyle::initialSelfAlignment())
- , m_justifySelf(RenderStyle::initialSelfAlignment())
-#if ENABLE(TOUCH_EVENTS)
- , m_touchAction(static_cast<unsigned>(RenderStyle::initialTouchAction()))
-#endif
-#if ENABLE(CSS_SCROLL_SNAP)
- , m_scrollSnapType(static_cast<unsigned>(RenderStyle::initialScrollSnapType()))
-#endif
, m_regionFragment(RenderStyle::initialRegionFragment())
+ , m_regionBreakAfter(RenderStyle::initialPageBreak())
+ , m_regionBreakBefore(RenderStyle::initialPageBreak())
+ , m_regionBreakInside(RenderStyle::initialPageBreak())
, m_pageSizeType(PAGE_SIZE_AUTO)
, m_transformStyle3D(RenderStyle::initialTransformStyle3D())
, m_backfaceVisibility(RenderStyle::initialBackfaceVisibility())
+ , m_alignContent(RenderStyle::initialAlignContent())
+ , m_alignItems(RenderStyle::initialAlignItems())
+ , m_alignSelf(RenderStyle::initialAlignSelf())
+ , m_justifyContent(RenderStyle::initialJustifyContent())
, userDrag(RenderStyle::initialUserDrag())
, textOverflow(RenderStyle::initialTextOverflow())
, marginBeforeCollapse(MCOLLAPSE)
@@ -97,17 +84,16 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
, m_borderFit(RenderStyle::initialBorderFit())
, m_textCombine(RenderStyle::initialTextCombine())
, m_textDecorationStyle(RenderStyle::initialTextDecorationStyle())
+ , m_wrapFlow(RenderStyle::initialWrapFlow())
+ , m_wrapThrough(RenderStyle::initialWrapThrough())
+#if USE(ACCELERATED_COMPOSITING)
, m_runningAcceleratedAnimation(false)
- , m_aspectRatioType(RenderStyle::initialAspectRatioType())
+#endif
+ , m_hasAspectRatio(false)
#if ENABLE(CSS_COMPOSITING)
, m_effectiveBlendMode(RenderStyle::initialBlendMode())
- , m_isolation(RenderStyle::initialIsolation())
#endif
, m_objectFit(RenderStyle::initialObjectFit())
- , m_breakBefore(RenderStyle::initialBreakBetween())
- , m_breakAfter(RenderStyle::initialBreakBetween())
- , m_breakInside(RenderStyle::initialBreakInside())
- , m_resize(RenderStyle::initialResize())
{
m_maskBoxImage.setMaskDefaults();
}
@@ -121,37 +107,30 @@ inline StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonIn
, m_perspectiveOriginX(o.m_perspectiveOriginX)
, m_perspectiveOriginY(o.m_perspectiveOriginY)
, lineClamp(o.lineClamp)
- , m_initialLetter(o.m_initialLetter)
, m_deprecatedFlexibleBox(o.m_deprecatedFlexibleBox)
, m_flexibleBox(o.m_flexibleBox)
, m_marquee(o.m_marquee)
, m_multiCol(o.m_multiCol)
, m_transform(o.m_transform)
+#if ENABLE(CSS_FILTERS)
, m_filter(o.m_filter)
-#if ENABLE(FILTERS_LEVEL_2)
- , m_backdropFilter(o.m_backdropFilter)
#endif
-#if ENABLE(CSS_GRID_LAYOUT)
, m_grid(o.m_grid)
, m_gridItem(o.m_gridItem)
-#endif
-#if ENABLE(CSS_SCROLL_SNAP)
- , m_scrollSnapPoints(o.m_scrollSnapPoints)
-#endif
, m_content(o.m_content ? o.m_content->clone() : nullptr)
, m_counterDirectives(o.m_counterDirectives ? clone(*o.m_counterDirectives) : nullptr)
- , m_altText(o.m_altText)
- , m_boxShadow(o.m_boxShadow ? std::make_unique<ShadowData>(*o.m_boxShadow) : nullptr)
- , m_willChange(o.m_willChange)
+ , m_boxShadow(o.m_boxShadow ? adoptPtr(new ShadowData(*o.m_boxShadow)) : nullptr)
, m_boxReflect(o.m_boxReflect)
- , m_animations(o.m_animations ? std::make_unique<AnimationList>(*o.m_animations) : nullptr)
- , m_transitions(o.m_transitions ? std::make_unique<AnimationList>(*o.m_transitions) : nullptr)
+ , m_animations(o.m_animations ? adoptPtr(new AnimationList(*o.m_animations)) : nullptr)
+ , m_transitions(o.m_transitions ? adoptPtr(new AnimationList(*o.m_transitions)) : nullptr)
, m_mask(o.m_mask)
, m_maskBoxImage(o.m_maskBoxImage)
, m_pageSize(o.m_pageSize)
#if ENABLE(CSS_SHAPES)
+ , m_shapeInside(o.m_shapeInside)
, m_shapeOutside(o.m_shapeOutside)
, m_shapeMargin(o.m_shapeMargin)
+ , m_shapePadding(o.m_shapePadding)
, m_shapeImageThreshold(o.m_shapeImageThreshold)
#endif
, m_clipPath(o.m_clipPath)
@@ -166,22 +145,17 @@ inline StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonIn
, m_order(o.m_order)
, m_flowThread(o.m_flowThread)
, m_regionThread(o.m_regionThread)
- , m_alignContent(o.m_alignContent)
- , m_alignItems(o.m_alignItems)
- , m_alignSelf(o.m_alignSelf)
- , m_justifyContent(o.m_justifyContent)
- , m_justifyItems(o.m_justifyItems)
- , m_justifySelf(o.m_justifySelf)
-#if ENABLE(TOUCH_EVENTS)
- , m_touchAction(o.m_touchAction)
-#endif
-#if ENABLE(CSS_SCROLL_SNAP)
- , m_scrollSnapType(o.m_scrollSnapType)
-#endif
, m_regionFragment(o.m_regionFragment)
+ , m_regionBreakAfter(o.m_regionBreakAfter)
+ , m_regionBreakBefore(o.m_regionBreakBefore)
+ , m_regionBreakInside(o.m_regionBreakInside)
, m_pageSizeType(o.m_pageSizeType)
, m_transformStyle3D(o.m_transformStyle3D)
, m_backfaceVisibility(o.m_backfaceVisibility)
+ , m_alignContent(o.m_alignContent)
+ , m_alignItems(o.m_alignItems)
+ , m_alignSelf(o.m_alignSelf)
+ , m_justifyContent(o.m_justifyContent)
, userDrag(o.userDrag)
, textOverflow(o.textOverflow)
, marginBeforeCollapse(o.marginBeforeCollapse)
@@ -190,21 +164,20 @@ inline StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonIn
, m_borderFit(o.m_borderFit)
, m_textCombine(o.m_textCombine)
, m_textDecorationStyle(o.m_textDecorationStyle)
+ , m_wrapFlow(o.m_wrapFlow)
+ , m_wrapThrough(o.m_wrapThrough)
+#if USE(ACCELERATED_COMPOSITING)
, m_runningAcceleratedAnimation(o.m_runningAcceleratedAnimation)
- , m_aspectRatioType(o.m_aspectRatioType)
+#endif
+ , m_hasAspectRatio(o.m_hasAspectRatio)
#if ENABLE(CSS_COMPOSITING)
, m_effectiveBlendMode(o.m_effectiveBlendMode)
- , m_isolation(o.m_isolation)
#endif
, m_objectFit(o.m_objectFit)
- , m_breakBefore(o.m_breakBefore)
- , m_breakAfter(o.m_breakAfter)
- , m_breakInside(o.m_breakInside)
- , m_resize(o.m_resize)
{
}
-Ref<StyleRareNonInheritedData> StyleRareNonInheritedData::copy() const
+PassRef<StyleRareNonInheritedData> StyleRareNonInheritedData::copy() const
{
return adoptRef(*new StyleRareNonInheritedData(*this));
}
@@ -222,7 +195,6 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
&& m_perspectiveOriginX == o.m_perspectiveOriginX
&& m_perspectiveOriginY == o.m_perspectiveOriginY
&& lineClamp == o.lineClamp
- && m_initialLetter == o.m_initialLetter
#if ENABLE(DASHBOARD_SUPPORT)
&& m_dashboardRegions == o.m_dashboardRegions
#endif
@@ -231,34 +203,28 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
&& m_marquee == o.m_marquee
&& m_multiCol == o.m_multiCol
&& m_transform == o.m_transform
+#if ENABLE(CSS_FILTERS)
&& m_filter == o.m_filter
-#if ENABLE(FILTERS_LEVEL_2)
- && m_backdropFilter == o.m_backdropFilter
#endif
-#if ENABLE(CSS_GRID_LAYOUT)
&& m_grid == o.m_grid
&& m_gridItem == o.m_gridItem
-#endif
-#if ENABLE(CSS_SCROLL_SNAP)
- && m_scrollSnapPoints == o.m_scrollSnapPoints
-#endif
&& contentDataEquivalent(o)
- && arePointingToEqualData(m_counterDirectives, o.m_counterDirectives)
- && m_altText == o.m_altText
- && arePointingToEqualData(m_boxShadow, o.m_boxShadow)
- && arePointingToEqualData(m_willChange, o.m_willChange)
- && arePointingToEqualData(m_boxReflect, o.m_boxReflect)
- && arePointingToEqualData(m_animations, o.m_animations)
- && arePointingToEqualData(m_transitions, o.m_transitions)
+ && counterDataEquivalent(o)
+ && shadowDataEquivalent(o)
+ && reflectionDataEquivalent(o)
+ && animationDataEquivalent(o)
+ && transitionDataEquivalent(o)
&& m_mask == o.m_mask
&& m_maskBoxImage == o.m_maskBoxImage
&& m_pageSize == o.m_pageSize
#if ENABLE(CSS_SHAPES)
- && arePointingToEqualData(m_shapeOutside, o.m_shapeOutside)
+ && m_shapeInside == o.m_shapeInside
+ && m_shapeOutside == o.m_shapeOutside
&& m_shapeMargin == o.m_shapeMargin
+ && m_shapePadding == o.m_shapePadding
&& m_shapeImageThreshold == o.m_shapeImageThreshold
#endif
- && arePointingToEqualData(m_clipPath, o.m_clipPath)
+ && m_clipPath == o.m_clipPath
&& m_textDecorationColor == o.m_textDecorationColor
&& m_visitedLinkTextDecorationColor == o.m_visitedLinkTextDecorationColor
&& m_visitedLinkBackgroundColor == o.m_visitedLinkBackgroundColor
@@ -269,17 +235,18 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
&& m_visitedLinkBorderBottomColor == o.m_visitedLinkBorderBottomColor
&& m_order == o.m_order
&& m_flowThread == o.m_flowThread
- && m_alignContent == o.m_alignContent
- && m_alignItems == o.m_alignItems
- && m_alignSelf == o.m_alignSelf
- && m_justifyContent == o.m_justifyContent
- && m_justifyItems == o.m_justifyItems
- && m_justifySelf == o.m_justifySelf
&& m_regionThread == o.m_regionThread
&& m_regionFragment == o.m_regionFragment
+ && m_regionBreakAfter == o.m_regionBreakAfter
+ && m_regionBreakBefore == o.m_regionBreakBefore
+ && m_regionBreakInside == o.m_regionBreakInside
&& m_pageSizeType == o.m_pageSizeType
&& m_transformStyle3D == o.m_transformStyle3D
&& m_backfaceVisibility == o.m_backfaceVisibility
+ && m_alignContent == o.m_alignContent
+ && m_alignItems == o.m_alignItems
+ && m_alignSelf == o.m_alignSelf
+ && m_justifyContent == o.m_justifyContent
&& userDrag == o.userDrag
&& textOverflow == o.textOverflow
&& marginBeforeCollapse == o.marginBeforeCollapse
@@ -288,23 +255,16 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
&& m_borderFit == o.m_borderFit
&& m_textCombine == o.m_textCombine
&& m_textDecorationStyle == o.m_textDecorationStyle
-#if ENABLE(TOUCH_EVENTS)
- && m_touchAction == o.m_touchAction
-#endif
-#if ENABLE(CSS_SCROLL_SNAP)
- && m_scrollSnapType == o.m_scrollSnapType
-#endif
+ && m_wrapFlow == o.m_wrapFlow
+ && m_wrapThrough == o.m_wrapThrough
+#if USE(ACCELERATED_COMPOSITING)
&& !m_runningAcceleratedAnimation && !o.m_runningAcceleratedAnimation
+#endif
#if ENABLE(CSS_COMPOSITING)
&& m_effectiveBlendMode == o.m_effectiveBlendMode
- && m_isolation == o.m_isolation
#endif
- && m_aspectRatioType == o.m_aspectRatioType
- && m_objectFit == o.m_objectFit
- && m_breakAfter == o.m_breakAfter
- && m_breakBefore == o.m_breakBefore
- && m_breakInside == o.m_breakInside
- && m_resize == o.m_resize;
+ && m_hasAspectRatio == o.m_hasAspectRatio
+ && m_objectFit == o.m_objectFit;
}
bool StyleRareNonInheritedData::contentDataEquivalent(const StyleRareNonInheritedData& o) const
@@ -320,16 +280,61 @@ bool StyleRareNonInheritedData::contentDataEquivalent(const StyleRareNonInherite
return !a && !b;
}
-bool StyleRareNonInheritedData::hasFilters() const
+bool StyleRareNonInheritedData::counterDataEquivalent(const StyleRareNonInheritedData& o) const
{
- return m_filter.get() && !m_filter->m_operations.isEmpty();
+ if (m_counterDirectives.get() == o.m_counterDirectives.get())
+ return true;
+
+ if (m_counterDirectives && o.m_counterDirectives && *m_counterDirectives == *o.m_counterDirectives)
+ return true;
+
+ return false;
+}
+
+bool StyleRareNonInheritedData::shadowDataEquivalent(const StyleRareNonInheritedData& o) const
+{
+ if ((!m_boxShadow && o.m_boxShadow) || (m_boxShadow && !o.m_boxShadow))
+ return false;
+ if (m_boxShadow && o.m_boxShadow && (*m_boxShadow != *o.m_boxShadow))
+ return false;
+ return true;
}
-#if ENABLE(FILTERS_LEVEL_2)
-bool StyleRareNonInheritedData::hasBackdropFilters() const
+bool StyleRareNonInheritedData::reflectionDataEquivalent(const StyleRareNonInheritedData& o) const
{
- return m_backdropFilter.get() && !m_backdropFilter->m_operations.isEmpty();
+ if (m_boxReflect != o.m_boxReflect) {
+ if (!m_boxReflect || !o.m_boxReflect)
+ return false;
+ return *m_boxReflect == *o.m_boxReflect;
+ }
+ return true;
+}
+
+bool StyleRareNonInheritedData::animationDataEquivalent(const StyleRareNonInheritedData& o) const
+{
+ if ((!m_animations && o.m_animations) || (m_animations && !o.m_animations))
+ return false;
+ if (m_animations && o.m_animations && (*m_animations != *o.m_animations))
+ return false;
+ return true;
+}
+
+bool StyleRareNonInheritedData::transitionDataEquivalent(const StyleRareNonInheritedData& o) const
+{
+ if ((!m_transitions && o.m_transitions) || (m_transitions && !o.m_transitions))
+ return false;
+ if (m_transitions && o.m_transitions && (*m_transitions != *o.m_transitions))
+ return false;
+ return true;
}
+
+bool StyleRareNonInheritedData::hasFilters() const
+{
+#if ENABLE(CSS_FILTERS)
+ return m_filter.get() && !m_filter->m_operations.isEmpty();
+#else
+ return false;
#endif
+}
} // namespace WebCore
diff --git a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h b/Source/WebCore/rendering/style/StyleRareNonInheritedData.h
index 9b1b2ad53..4523f3be4 100644
--- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h
+++ b/Source/WebCore/rendering/style/StyleRareNonInheritedData.h
@@ -26,7 +26,6 @@
#define StyleRareNonInheritedData_h
#include "BasicShapes.h"
-#include "CSSPropertyNames.h"
#include "ClipPathOperation.h"
#include "CounterDirectives.h"
#include "CursorData.h"
@@ -35,10 +34,7 @@
#include "LineClampValue.h"
#include "NinePieceImage.h"
#include "ShapeValue.h"
-#include "StyleContentAlignmentData.h"
-#include "StyleSelfAlignmentData.h"
-#include "WillChangeData.h"
-#include <memory>
+#include <wtf/OwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/Vector.h>
@@ -47,20 +43,17 @@ namespace WebCore {
class AnimationList;
class ShadowData;
class StyleDeprecatedFlexibleBoxData;
+#if ENABLE(CSS_FILTERS)
class StyleFilterData;
+#endif
class StyleFlexibleBoxData;
-#if ENABLE(CSS_GRID_LAYOUT)
class StyleGridData;
class StyleGridItemData;
-#endif
class StyleMarqueeData;
class StyleMultiColData;
class StyleReflection;
class StyleResolver;
class StyleTransformData;
-#if ENABLE(CSS_SCROLL_SNAP)
-class StyleScrollSnapPoints;
-#endif
class ContentData;
struct LengthSize;
@@ -84,23 +77,22 @@ enum PageSizeType {
// actually uses one of these properties.
class StyleRareNonInheritedData : public RefCounted<StyleRareNonInheritedData> {
public:
- static Ref<StyleRareNonInheritedData> create() { return adoptRef(*new StyleRareNonInheritedData); }
- Ref<StyleRareNonInheritedData> copy() const;
+ static PassRef<StyleRareNonInheritedData> create() { return adoptRef(*new StyleRareNonInheritedData); }
+ PassRef<StyleRareNonInheritedData> copy() const;
~StyleRareNonInheritedData();
bool operator==(const StyleRareNonInheritedData&) const;
bool operator!=(const StyleRareNonInheritedData& o) const { return !(*this == o); }
bool contentDataEquivalent(const StyleRareNonInheritedData&) const;
-
+ bool counterDataEquivalent(const StyleRareNonInheritedData&) const;
+ bool shadowDataEquivalent(const StyleRareNonInheritedData&) const;
+ bool reflectionDataEquivalent(const StyleRareNonInheritedData&) const;
+ bool animationDataEquivalent(const StyleRareNonInheritedData&) const;
+ bool transitionDataEquivalent(const StyleRareNonInheritedData&) const;
bool hasFilters() const;
-#if ENABLE(FILTERS_LEVEL_2)
- bool hasBackdropFilters() const;
-#endif
bool hasOpacity() const { return opacity < 1; }
- bool hasAnimationsOrTransitions() const { return m_animations || m_transitions; }
-
float opacity;
float m_aspectRatioDenominator;
@@ -111,9 +103,6 @@ public:
Length m_perspectiveOriginY;
LineClampValue lineClamp; // An Apple extension.
-
- IntSize m_initialLetter;
-
#if ENABLE(DASHBOARD_SUPPORT)
Vector<StyleDashboardRegion> m_dashboardRegions;
#endif
@@ -123,32 +112,24 @@ public:
DataRef<StyleMarqueeData> m_marquee; // Marquee properties
DataRef<StyleMultiColData> m_multiCol; // CSS3 multicol properties
DataRef<StyleTransformData> m_transform; // Transform properties (rotate, scale, skew, etc.)
+
+#if ENABLE(CSS_FILTERS)
DataRef<StyleFilterData> m_filter; // Filter operations (url, sepia, blur, etc.)
-#if ENABLE(FILTERS_LEVEL_2)
- DataRef<StyleFilterData> m_backdropFilter; // Filter operations (url, sepia, blur, etc.)
#endif
-#if ENABLE(CSS_GRID_LAYOUT)
DataRef<StyleGridData> m_grid;
DataRef<StyleGridItemData> m_gridItem;
-#endif
-
-#if ENABLE(CSS_SCROLL_SNAP)
- DataRef<StyleScrollSnapPoints> m_scrollSnapPoints;
-#endif
std::unique_ptr<ContentData> m_content;
- std::unique_ptr<CounterDirectiveMap> m_counterDirectives;
+ OwnPtr<CounterDirectiveMap> m_counterDirectives;
String m_altText;
- std::unique_ptr<ShadowData> m_boxShadow; // For box-shadow decorations.
-
- RefPtr<WillChangeData> m_willChange; // Null indicates 'auto'.
+ OwnPtr<ShadowData> m_boxShadow; // For box-shadow decorations.
RefPtr<StyleReflection> m_boxReflect;
- std::unique_ptr<AnimationList> m_animations;
- std::unique_ptr<AnimationList> m_transitions;
+ OwnPtr<AnimationList> m_animations;
+ OwnPtr<AnimationList> m_transitions;
FillLayer m_mask;
NinePieceImage m_maskBoxImage;
@@ -156,8 +137,10 @@ public:
LengthSize m_pageSize;
#if ENABLE(CSS_SHAPES)
+ RefPtr<ShapeValue> m_shapeInside;
RefPtr<ShapeValue> m_shapeOutside;
Length m_shapeMargin;
+ Length m_shapePadding;
float m_shapeImageThreshold;
#endif
@@ -176,28 +159,20 @@ public:
AtomicString m_flowThread;
AtomicString m_regionThread;
-
- StyleContentAlignmentData m_alignContent;
- StyleSelfAlignmentData m_alignItems;
- StyleSelfAlignmentData m_alignSelf;
- StyleContentAlignmentData m_justifyContent;
- StyleSelfAlignmentData m_justifyItems;
- StyleSelfAlignmentData m_justifySelf;
-
-#if ENABLE(TOUCH_EVENTS)
- unsigned m_touchAction : 1; // TouchAction
-#endif
-
-#if ENABLE(CSS_SCROLL_SNAP)
- unsigned m_scrollSnapType : 2; // ScrollSnapType
-#endif
-
unsigned m_regionFragment : 1; // RegionFragment
+ unsigned m_regionBreakAfter : 2; // EPageBreak
+ unsigned m_regionBreakBefore : 2; // EPageBreak
+ unsigned m_regionBreakInside : 2; // EPageBreak
+
unsigned m_pageSizeType : 2; // PageSizeType
unsigned m_transformStyle3D : 1; // ETransformStyle3D
unsigned m_backfaceVisibility : 1; // EBackfaceVisibility
+ unsigned m_alignContent : 3; // EAlignContent
+ unsigned m_alignItems : 3; // EAlignItems
+ unsigned m_alignSelf : 3; // EAlignItems
+ unsigned m_justifyContent : 3; // EJustifyContent
unsigned userDrag : 2; // EUserDrag
unsigned textOverflow : 1; // Whether or not lines that spill out should be truncated with "..."
@@ -208,22 +183,20 @@ public:
unsigned m_textCombine : 1; // CSS3 text-combine properties
unsigned m_textDecorationStyle : 3; // TextDecorationStyle
+ unsigned m_wrapFlow: 3; // WrapFlow
+ unsigned m_wrapThrough: 1; // WrapThrough
+#if USE(ACCELERATED_COMPOSITING)
unsigned m_runningAcceleratedAnimation : 1;
+#endif
- unsigned m_aspectRatioType : 2;
+ unsigned m_hasAspectRatio : 1; // Whether or not an aspect ratio has been specified.
#if ENABLE(CSS_COMPOSITING)
unsigned m_effectiveBlendMode: 5; // EBlendMode
- unsigned m_isolation : 1; // Isolation
#endif
unsigned m_objectFit : 3; // ObjectFit
-
- unsigned m_breakBefore : 4; // BreakBetween
- unsigned m_breakAfter : 4;
- unsigned m_breakInside : 3; // BreakInside
- unsigned m_resize : 2; // EResize
private:
StyleRareNonInheritedData();
diff --git a/Source/WebCore/rendering/style/StyleReflection.h b/Source/WebCore/rendering/style/StyleReflection.h
index 17f7f7195..45b93e204 100644
--- a/Source/WebCore/rendering/style/StyleReflection.h
+++ b/Source/WebCore/rendering/style/StyleReflection.h
@@ -34,9 +34,9 @@ namespace WebCore {
class StyleReflection : public RefCounted<StyleReflection> {
public:
- static Ref<StyleReflection> create()
+ static PassRefPtr<StyleReflection> create()
{
- return adoptRef(*new StyleReflection);
+ return adoptRef(new StyleReflection);
}
bool operator==(const StyleReflection& o) const
@@ -50,7 +50,7 @@ public:
const NinePieceImage& mask() const { return m_mask; }
void setDirection(CSSReflectionDirection dir) { m_direction = dir; }
- void setOffset(Length offset) { m_offset = WTFMove(offset); }
+ void setOffset(Length offset) { m_offset = std::move(offset); }
void setMask(const NinePieceImage& image) { m_mask = image; }
private:
diff --git a/Source/WebCore/rendering/style/StyleScrollSnapPoints.cpp b/Source/WebCore/rendering/style/StyleScrollSnapPoints.cpp
deleted file mode 100644
index 8d8858f84..000000000
--- a/Source/WebCore/rendering/style/StyleScrollSnapPoints.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND 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.
- */
-
-#include "config.h"
-#include "StyleScrollSnapPoints.h"
-
-#if ENABLE(CSS_SCROLL_SNAP)
-
-namespace WebCore {
-
-ScrollSnapPoints::ScrollSnapPoints()
- : repeatOffset(100, Percent)
- , hasRepeat(true)
- , usesElements(false)
-{
-}
-
-bool operator==(const ScrollSnapPoints& a, const ScrollSnapPoints& b)
-{
- return a.repeatOffset == b.repeatOffset
- && a.hasRepeat == b.hasRepeat
- && a.usesElements == b.usesElements
- && a.offsets == b.offsets;
-}
-
-LengthSize defaultScrollSnapDestination()
-{
- return LengthSize(Length(0, Fixed), Length(0, Fixed));
-}
-
-StyleScrollSnapPoints::StyleScrollSnapPoints()
- : destination(defaultScrollSnapDestination())
-{
-}
-
-inline StyleScrollSnapPoints::StyleScrollSnapPoints(const StyleScrollSnapPoints& other)
- : RefCounted()
- , xPoints(other.xPoints ? std::make_unique<ScrollSnapPoints>(*other.xPoints) : nullptr)
- , yPoints(other.yPoints ? std::make_unique<ScrollSnapPoints>(*other.yPoints) : nullptr)
- , destination(other.destination)
- , coordinates(other.coordinates)
-{
-}
-
-Ref<StyleScrollSnapPoints> StyleScrollSnapPoints::copy() const
-{
- return adoptRef(*new StyleScrollSnapPoints(*this));
-}
-
-bool operator==(const StyleScrollSnapPoints& a, const StyleScrollSnapPoints& b)
-{
- return a.xPoints == b.xPoints
- && a.yPoints == b.yPoints
- && a.destination == b.destination
- && a.coordinates == b.coordinates;
-}
-
-} // namespace WebCore
-
-#endif /* ENABLE(CSS_SCROLL_SNAP) */
diff --git a/Source/WebCore/rendering/style/StyleScrollSnapPoints.h b/Source/WebCore/rendering/style/StyleScrollSnapPoints.h
deleted file mode 100644
index a4861f835..000000000
--- a/Source/WebCore/rendering/style/StyleScrollSnapPoints.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND 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 StyleScrollSnapPoints_h
-#define StyleScrollSnapPoints_h
-
-#if ENABLE(CSS_SCROLL_SNAP)
-
-#include "LengthSize.h"
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-struct ScrollSnapPoints {
- Length repeatOffset;
- bool hasRepeat;
- bool usesElements;
- Vector<Length> offsets;
-
- ScrollSnapPoints();
-};
-
-bool operator==(const ScrollSnapPoints&, const ScrollSnapPoints&);
-inline bool operator!=(const ScrollSnapPoints& a, const ScrollSnapPoints& b) { return !(a == b); }
-
-LengthSize defaultScrollSnapDestination();
-
-class StyleScrollSnapPoints : public RefCounted<StyleScrollSnapPoints> {
-public:
- static Ref<StyleScrollSnapPoints> create() { return adoptRef(*new StyleScrollSnapPoints); }
- Ref<StyleScrollSnapPoints> copy() const;
-
- std::unique_ptr<ScrollSnapPoints> xPoints;
- std::unique_ptr<ScrollSnapPoints> yPoints;
- LengthSize destination;
- Vector<LengthSize> coordinates;
-
-private:
- StyleScrollSnapPoints();
- StyleScrollSnapPoints(const StyleScrollSnapPoints&);
-};
-
-bool operator==(const StyleScrollSnapPoints&, const StyleScrollSnapPoints&);
-inline bool operator!=(const StyleScrollSnapPoints& a, const StyleScrollSnapPoints& b) { return !(a == b); }
-
-} // namespace WebCore
-
-#endif // ENABLE(CSS_SCROLL_SNAP)
-
-#endif // StyleScrollSnapPoints_h
diff --git a/Source/WebCore/rendering/style/StyleSelfAlignmentData.h b/Source/WebCore/rendering/style/StyleSelfAlignmentData.h
deleted file mode 100644
index 895558d42..000000000
--- a/Source/WebCore/rendering/style/StyleSelfAlignmentData.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2015 Igalia S.L. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND 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 StyleSelfAlignmentData_h
-#define StyleSelfAlignmentData_h
-
-#include "RenderStyleConstants.h"
-
-
-namespace WebCore {
-
-class StyleSelfAlignmentData {
-public:
- // Style data for Self-Aligment and Default-Alignment properties: align-{self, items}, justify-{self, items}.
- // [ <self-position> && <overflow-position>? ] | [ legacy && [ left | right | center ] ]
- StyleSelfAlignmentData(ItemPosition position, OverflowAlignment overflow, ItemPositionType positionType = NonLegacyPosition)
- : m_position(position)
- , m_positionType(positionType)
- , m_overflow(overflow)
- {
- }
-
- void setPosition(ItemPosition position) { m_position = position; }
- void setPositionType(ItemPositionType positionType) { m_positionType = positionType; }
- void setOverflow(OverflowAlignment overflow) { m_overflow = overflow; }
-
- ItemPosition position() const { return static_cast<ItemPosition>(m_position); }
- ItemPositionType positionType() const { return static_cast<ItemPositionType>(m_positionType); }
- OverflowAlignment overflow() const { return static_cast<OverflowAlignment>(m_overflow); }
-
- bool operator==(const StyleSelfAlignmentData& o) const
- {
- return m_position == o.m_position && m_positionType == o.m_positionType && m_overflow == o.m_overflow;
- }
-
- bool operator!=(const StyleSelfAlignmentData& o) const
- {
- return !(*this == o);
- }
-
-private:
- unsigned m_position : 4; // ItemPosition
- unsigned m_positionType: 1; // Whether or not alignment uses the 'legacy' keyword.
- unsigned m_overflow : 2; // OverflowAlignment
-};
-
-} // namespace WebCore
-
-#endif // StyleSelfAlignmentData_h
diff --git a/Source/WebCore/rendering/style/StyleSurroundData.cpp b/Source/WebCore/rendering/style/StyleSurroundData.cpp
index 5c9bbdbec..766a70f46 100644
--- a/Source/WebCore/rendering/style/StyleSurroundData.cpp
+++ b/Source/WebCore/rendering/style/StyleSurroundData.cpp
@@ -39,7 +39,7 @@ inline StyleSurroundData::StyleSurroundData(const StyleSurroundData& o)
{
}
-Ref<StyleSurroundData> StyleSurroundData::copy() const
+PassRef<StyleSurroundData> StyleSurroundData::copy() const
{
return adoptRef(*new StyleSurroundData(*this));
}
diff --git a/Source/WebCore/rendering/style/StyleSurroundData.h b/Source/WebCore/rendering/style/StyleSurroundData.h
index 00bf5f0b3..0dce31811 100644
--- a/Source/WebCore/rendering/style/StyleSurroundData.h
+++ b/Source/WebCore/rendering/style/StyleSurroundData.h
@@ -34,8 +34,8 @@ namespace WebCore {
class StyleSurroundData : public RefCounted<StyleSurroundData> {
public:
- static Ref<StyleSurroundData> create() { return adoptRef(*new StyleSurroundData); }
- Ref<StyleSurroundData> copy() const;
+ static PassRef<StyleSurroundData> create() { return adoptRef(*new StyleSurroundData); }
+ PassRef<StyleSurroundData> copy() const;
bool operator==(const StyleSurroundData& o) const;
bool operator!=(const StyleSurroundData& o) const
diff --git a/Source/WebCore/rendering/style/StyleTransformData.cpp b/Source/WebCore/rendering/style/StyleTransformData.cpp
index eaf310b63..c3f91ea2a 100644
--- a/Source/WebCore/rendering/style/StyleTransformData.cpp
+++ b/Source/WebCore/rendering/style/StyleTransformData.cpp
@@ -43,7 +43,7 @@ inline StyleTransformData::StyleTransformData(const StyleTransformData& o)
{
}
-Ref<StyleTransformData> StyleTransformData::copy() const
+PassRef<StyleTransformData> StyleTransformData::copy() const
{
return adoptRef(*new StyleTransformData(*this));
}
diff --git a/Source/WebCore/rendering/style/StyleTransformData.h b/Source/WebCore/rendering/style/StyleTransformData.h
index b8fb09053..e82ea2063 100644
--- a/Source/WebCore/rendering/style/StyleTransformData.h
+++ b/Source/WebCore/rendering/style/StyleTransformData.h
@@ -34,16 +34,14 @@ namespace WebCore {
class StyleTransformData : public RefCounted<StyleTransformData> {
public:
- static Ref<StyleTransformData> create() { return adoptRef(*new StyleTransformData); }
- Ref<StyleTransformData> copy() const;
+ static PassRef<StyleTransformData> create() { return adoptRef(*new StyleTransformData); }
+ PassRef<StyleTransformData> copy() const;
bool operator==(const StyleTransformData& o) const;
bool operator!=(const StyleTransformData& o) const
{
return !(*this == o);
}
-
- bool hasTransform() const { return m_operations.size(); }
TransformOperations m_operations;
Length m_x;
diff --git a/Source/WebCore/rendering/style/StyleVisualData.cpp b/Source/WebCore/rendering/style/StyleVisualData.cpp
index d8fb8869b..23e6cd225 100644
--- a/Source/WebCore/rendering/style/StyleVisualData.cpp
+++ b/Source/WebCore/rendering/style/StyleVisualData.cpp
@@ -52,7 +52,7 @@ inline StyleVisualData::StyleVisualData(const StyleVisualData& o)
{
}
-Ref<StyleVisualData> StyleVisualData::copy() const
+PassRef<StyleVisualData> StyleVisualData::copy() const
{
return adoptRef(*new StyleVisualData(*this));
}
diff --git a/Source/WebCore/rendering/style/StyleVisualData.h b/Source/WebCore/rendering/style/StyleVisualData.h
index 5b2496ca3..2b2d63027 100644
--- a/Source/WebCore/rendering/style/StyleVisualData.h
+++ b/Source/WebCore/rendering/style/StyleVisualData.h
@@ -34,8 +34,8 @@ namespace WebCore {
class StyleVisualData : public RefCounted<StyleVisualData> {
public:
- static Ref<StyleVisualData> create() { return adoptRef(*new StyleVisualData); }
- Ref<StyleVisualData> copy() const;
+ static PassRef<StyleVisualData> create() { return adoptRef(*new StyleVisualData); }
+ PassRef<StyleVisualData> copy() const;
~StyleVisualData();
bool operator==(const StyleVisualData& o) const
diff --git a/Source/WebCore/rendering/style/TextSizeAdjustment.h b/Source/WebCore/rendering/style/TextSizeAdjustment.h
deleted file mode 100644
index d56d6760c..000000000
--- a/Source/WebCore/rendering/style/TextSizeAdjustment.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple 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 TextSizeAdjustment_h
-#define TextSizeAdjustment_h
-
-#if ENABLE(IOS_TEXT_AUTOSIZING)
-
-enum TextSizeAdjustmentType { AutoTextSizeAdjustment = -1, NoTextSizeAdjustment = -2 };
-
-class TextSizeAdjustment {
-public:
- TextSizeAdjustment() : m_value(AutoTextSizeAdjustment) { }
- TextSizeAdjustment(float value) : m_value(value) { }
-
- float percentage() const { return m_value; }
- float multiplier() const { return m_value / 100; }
-
- bool isAuto() const { return m_value == AutoTextSizeAdjustment; }
- bool isNone() const { return m_value == NoTextSizeAdjustment; }
- bool isPercentage() const { return m_value >= 0; }
-
- bool operator==(const TextSizeAdjustment& anAdjustment) const { return m_value == anAdjustment.m_value; }
- bool operator!=(const TextSizeAdjustment& anAdjustment) const { return m_value != anAdjustment.m_value; }
-
-private:
- float m_value;
-};
-
-#endif // ENABLE(IOS_TEXT_AUTOSIZING)
-
-#endif // TextSizeAdjustment_h
diff --git a/Source/WebCore/rendering/style/WillChangeData.cpp b/Source/WebCore/rendering/style/WillChangeData.cpp
deleted file mode 100644
index 77d4aa871..000000000
--- a/Source/WebCore/rendering/style/WillChangeData.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND 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.
- */
-
-#include "config.h"
-#include "WillChangeData.h"
-
-namespace WebCore {
-
-bool WillChangeData::operator==(const WillChangeData& other) const
-{
- return m_animatableFeatures == other.m_animatableFeatures;
-}
-
-bool WillChangeData::containsScrollPosition() const
-{
- for (const auto& feature : m_animatableFeatures) {
- if (feature.feature() == ScrollPosition)
- return true;
- }
- return false;
-}
-
-bool WillChangeData::containsContents() const
-{
- for (const auto& feature : m_animatableFeatures) {
- if (feature.feature() == Contents)
- return true;
- }
- return false;
-}
-
-bool WillChangeData::containsProperty(CSSPropertyID property) const
-{
- for (const auto& feature : m_animatableFeatures) {
- if (feature.property() == property)
- return true;
- }
- return false;
-}
-
-// "If any non-initial value of a property would create a stacking context on the element,
-// specifying that property in will-change must create a stacking context on the element."
-static bool propertyCreatesStackingContext(CSSPropertyID property)
-{
- switch (property) {
- case CSSPropertyPerspective:
- case CSSPropertyTransform:
- case CSSPropertyTransformStyle:
- case CSSPropertyWebkitTransformStyle:
- case CSSPropertyClipPath:
- case CSSPropertyWebkitClipPath:
- case CSSPropertyMask:
- case CSSPropertyOpacity:
- case CSSPropertyPosition:
- case CSSPropertyZIndex:
- case CSSPropertyWebkitBoxReflect:
-#if ENABLE(CSS_COMPOSITING)
- case CSSPropertyMixBlendMode:
- case CSSPropertyIsolation:
-#endif
- case CSSPropertyFilter:
-#if ENABLE(FILTERS_LEVEL_2)
- case CSSPropertyWebkitBackdropFilter:
-#endif
- case CSSPropertyWebkitMask:
- case CSSPropertyWebkitMaskImage:
- case CSSPropertyWebkitMaskBoxImage:
-#if ENABLE(CSS_REGIONS)
- case CSSPropertyWebkitFlowFrom:
-#endif
-#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
- case CSSPropertyWebkitOverflowScrolling:
-#endif
- return true;
- default:
- return false;
- }
-}
-
-static bool propertyTriggersCompositing(CSSPropertyID property)
-{
- switch (property) {
- case CSSPropertyOpacity:
- case CSSPropertyFilter:
-#if ENABLE(FILTERS_LEVEL_2)
- case CSSPropertyWebkitBackdropFilter:
-#endif
- return true;
- default:
- return false;
- }
-}
-
-static bool propertyTriggersCompositingOnBoxesOnly(CSSPropertyID property)
-{
- // Don't trigger for perspective and transform-style, because those
- // only do compositing if they have a 3d-transformed descendant and
- // we don't want to do compositing all the time.
- // Similarly, we don't want -webkit-overflow-scrolling-touch to
- // always composite if there's no scrollable overflow.
- switch (property) {
- case CSSPropertyTransform:
- return true;
- default:
- return false;
- }
-}
-
-void WillChangeData::addFeature(Feature feature, CSSPropertyID propertyID)
-{
- ASSERT(feature == Property || propertyID == CSSPropertyInvalid);
- m_animatableFeatures.append(AnimatableFeature(feature, propertyID));
-
- m_canCreateStackingContext |= propertyCreatesStackingContext(propertyID);
-
- m_canTriggerCompositingOnInline |= propertyTriggersCompositing(propertyID);
- m_canTriggerCompositing |= m_canTriggerCompositingOnInline | propertyTriggersCompositingOnBoxesOnly(propertyID);
-}
-
-WillChangeData::FeaturePropertyPair WillChangeData::featureAt(size_t index) const
-{
- if (index >= m_animatableFeatures.size())
- return FeaturePropertyPair(Invalid, CSSPropertyInvalid);
-
- return m_animatableFeatures[index].featurePropertyPair();
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/rendering/style/WillChangeData.h b/Source/WebCore/rendering/style/WillChangeData.h
deleted file mode 100644
index 49e76089d..000000000
--- a/Source/WebCore/rendering/style/WillChangeData.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND 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 WillChangeData_h
-#define WillChangeData_h
-
-#include "CSSPropertyNames.h"
-#include "RenderStyleConstants.h"
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-class WillChangeData : public RefCounted<WillChangeData> {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- static Ref<WillChangeData> create()
- {
- return adoptRef(*new WillChangeData);
- }
-
- bool operator==(const WillChangeData&) const;
- bool operator!=(const WillChangeData& o) const
- {
- return !(*this == o);
- }
-
- bool isAuto() const { return m_animatableFeatures.isEmpty(); }
- size_t numFeatures() const { return m_animatableFeatures.size(); }
-
- bool containsScrollPosition() const;
- bool containsContents() const;
- bool containsProperty(CSSPropertyID) const;
-
- bool canCreateStackingContext() const { return m_canCreateStackingContext; }
- bool canTriggerCompositing() const { return m_canTriggerCompositing; }
- bool canTriggerCompositingOnInline() const { return m_canTriggerCompositingOnInline; }
-
- enum Feature {
- ScrollPosition,
- Contents,
- Property,
- Invalid
- };
-
- void addFeature(Feature, CSSPropertyID = CSSPropertyInvalid);
-
- typedef std::pair<Feature, CSSPropertyID> FeaturePropertyPair;
- FeaturePropertyPair featureAt(size_t) const;
-
-private:
- WillChangeData()
- {
- }
-
- struct AnimatableFeature {
- static const int numCSSPropertyIDBits = 14;
- COMPILE_ASSERT(numCSSProperties < (1 << numCSSPropertyIDBits), CSSPropertyID_should_fit_in_14_bits);
-
- unsigned m_feature : 2;
- unsigned m_cssPropertyID : numCSSPropertyIDBits;
-
- Feature feature() const
- {
- return static_cast<Feature>(m_feature);
- }
-
- CSSPropertyID property() const
- {
- return feature() == Property ? static_cast<CSSPropertyID>(m_cssPropertyID) : CSSPropertyInvalid;
- }
-
- FeaturePropertyPair featurePropertyPair() const
- {
- return FeaturePropertyPair(feature(), property());
- }
-
- AnimatableFeature(Feature willChange, CSSPropertyID willChangeProperty = CSSPropertyInvalid)
- {
- switch (willChange) {
- case Property:
- ASSERT(willChangeProperty != CSSPropertyInvalid);
- m_cssPropertyID = willChangeProperty;
- FALLTHROUGH;
- case ScrollPosition:
- case Contents:
- m_feature = static_cast<unsigned>(willChange);
- break;
- case Invalid:
- ASSERT_NOT_REACHED();
- break;
- }
- }
-
- bool operator==(const AnimatableFeature& other) const
- {
- return m_feature == other.m_feature && m_cssPropertyID == other.m_cssPropertyID;
- }
- };
-
- Vector<AnimatableFeature, 1> m_animatableFeatures;
- bool m_canCreateStackingContext { false };
- bool m_canTriggerCompositing { false };
- bool m_canTriggerCompositingOnInline { false };
-};
-
-
-} // namespace WebCore
-
-#endif // WillChangeData_h