summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/core/rendering/style
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-08 14:30:41 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-12 13:49:54 +0200
commitab0a50979b9eb4dfa3320eff7e187e41efedf7a9 (patch)
tree498dfb8a97ff3361a9f7486863a52bb4e26bb898 /chromium/third_party/WebKit/Source/core/rendering/style
parent4ce69f7403811819800e7c5ae1318b2647e778d1 (diff)
Update Chromium to beta version 37.0.2062.68
Change-Id: I188e3b5aff1bec75566014291b654eb19f5bc8ca Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/rendering/style')
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/AppliedTextDecoration.cpp36
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/AppliedTextDecoration.h34
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/BasicShapes.cpp202
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/BasicShapes.h256
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/BorderData.h13
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/BorderValue.h29
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/CachedUAStyle.h29
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/CollapsedBorderValue.h14
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/ContentData.h16
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/CursorList.h62
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/DataEquivalency.h49
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/FillLayer.cpp8
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/FillLayer.h14
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/GridCoordinate.h85
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/GridLength.h18
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/GridPosition.h27
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/GridResolvedPosition.cpp253
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/GridResolvedPosition.h125
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/GridTrackSize.h46
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.cpp21
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.h11
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/NinePieceImage.cpp6
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/OutlineValue.h2
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/QuotesData.cpp9
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/QuotesData.h4
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/RenderStyle.cpp1005
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/RenderStyle.h681
-rw-r--r--[-rwxr-xr-x]chromium/third_party/WebKit/Source/core/rendering/style/RenderStyleConstants.h93
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp81
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.h103
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyleDefs.cpp32
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyleDefs.h44
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/ShadowData.cpp2
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/ShadowData.h21
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/ShadowList.cpp35
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/ShadowList.h5
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/ShapeValue.h60
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleBackgroundData.cpp5
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleBackgroundData.h6
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleBoxData.h14
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgram.cpp46
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgram.h193
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgramCache.cpp86
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgramCache.h65
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleDeprecatedFlexibleBoxData.cpp12
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleDeprecatedFlexibleBoxData.h4
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleDifference.h80
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.cpp7
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.h28
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.cpp4
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.h37
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.cpp53
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.h57
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleGeneratedImage.cpp6
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleGeneratedImage.h27
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleGridData.cpp8
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleGridData.h6
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleImage.h14
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleInheritedData.cpp3
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleInheritedData.h1
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleMultiColData.cpp8
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleMultiColData.h4
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StylePendingImage.h26
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StylePendingShader.h60
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleRareInheritedData.cpp98
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleRareInheritedData.h53
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleRareNonInheritedData.cpp113
-rw-r--r--[-rwxr-xr-x]chromium/third_party/WebKit/Source/core/rendering/style/StyleRareNonInheritedData.h66
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleShader.h64
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleVariableData.h64
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleVisualData.cpp2
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleVisualData.h2
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleWillChangeData.cpp24
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/StyleWillChangeData.h42
74 files changed, 2538 insertions, 2381 deletions
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/AppliedTextDecoration.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/AppliedTextDecoration.cpp
new file mode 100644
index 00000000000..ea8be8483a8
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/AppliedTextDecoration.cpp
@@ -0,0 +1,36 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/rendering/style/AppliedTextDecoration.h"
+
+namespace WebCore {
+
+AppliedTextDecoration::AppliedTextDecoration(TextDecoration line, TextDecorationStyle style, StyleColor color)
+ : m_line(line)
+ , m_style(style)
+ , m_color(color)
+{
+}
+
+AppliedTextDecoration::AppliedTextDecoration(TextDecoration line)
+ : m_line(line)
+ , m_style(TextDecorationStyleSolid)
+ , m_color(StyleColor::currentColor())
+{
+}
+
+AppliedTextDecoration::AppliedTextDecoration()
+ : m_line(TextDecorationUnderline)
+ , m_style(TextDecorationStyleSolid)
+ , m_color(StyleColor::currentColor())
+{
+}
+
+bool AppliedTextDecoration::operator==(const AppliedTextDecoration& o) const
+{
+ return m_color == o.m_color && m_line == o.m_line && m_style == o.m_style;
+}
+
+} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/AppliedTextDecoration.h b/chromium/third_party/WebKit/Source/core/rendering/style/AppliedTextDecoration.h
new file mode 100644
index 00000000000..fd0df809194
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/AppliedTextDecoration.h
@@ -0,0 +1,34 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef AppliedTextDecoration_h
+#define AppliedTextDecoration_h
+
+#include "core/css/StyleColor.h"
+#include "core/rendering/style/RenderStyleConstants.h"
+
+namespace WebCore {
+
+class AppliedTextDecoration {
+public:
+ AppliedTextDecoration(TextDecoration, TextDecorationStyle, StyleColor);
+ explicit AppliedTextDecoration(TextDecoration);
+ AppliedTextDecoration();
+
+ TextDecoration line() const { return static_cast<TextDecoration>(m_line); }
+ TextDecorationStyle style() const { return static_cast<TextDecorationStyle>(m_style); }
+
+ bool isSimpleUnderline() const { return m_line == TextDecorationUnderline && m_style == TextDecorationStyleSolid && m_color.isCurrentColor(); }
+ bool operator==(const AppliedTextDecoration&) const;
+ bool operator!=(const AppliedTextDecoration& o) const { return !(*this == o); }
+
+private:
+ unsigned m_line : TextDecorationBits;
+ unsigned m_style : 3; // TextDecorationStyle
+ StyleColor m_color;
+};
+
+} // namespace WebCore
+
+#endif // AppliedTextDecoration_h
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/BasicShapes.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/BasicShapes.cpp
index 1eed605f291..a41a1d6393c 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/BasicShapes.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/BasicShapes.cpp
@@ -28,70 +28,90 @@
*/
#include "config.h"
-
#include "core/rendering/style/BasicShapes.h"
+
+#include "core/css/BasicShapeFunctions.h"
+#include "platform/CalculationValue.h"
#include "platform/LengthFunctions.h"
#include "platform/geometry/FloatRect.h"
#include "platform/graphics/Path.h"
namespace WebCore {
+void BasicShapeCenterCoordinate::updateComputedLength()
+{
+ if (m_direction == TopLeft) {
+ m_computedLength = m_length.isUndefined() ? Length(0, Fixed) : m_length;
+ return;
+ }
+ if (m_length.isUndefined()) {
+ m_computedLength = Length(100, Percent);
+ return;
+ }
+
+ m_computedLength = m_length.subtractFromOneHundredPercent();
+}
+
bool BasicShape::canBlend(const BasicShape* other) const
{
// FIXME: Support animations between different shapes in the future.
- if (type() != other->type())
+ if (!other || !isSameType(*other))
return false;
// 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)->values().size() != static_cast<const BasicShapePolygon*>(other)->values().size()
+ || static_cast<const BasicShapePolygon*>(this)->windRule() != static_cast<const BasicShapePolygon*>(other)->windRule()))
return false;
- return true;
+ // Circles with keywords for radii or center 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;
+ }
+
+ // Ellipses with keywords for radii or center coordinates cannot be animated.
+ if (type() != BasicShape::BasicShapeEllipseType)
+ return true;
+
+ 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()));
}
-void BasicShapeRectangle::path(Path& path, const FloatRect& boundingBox)
+bool BasicShapeCircle::operator==(const BasicShape& o) const
{
- 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())
- )
- );
+ if (!isSameType(o))
+ return false;
+ const BasicShapeCircle& other = toBasicShapeCircle(o);
+ return m_centerX == other.m_centerX && m_centerY == other.m_centerY && m_radius == other.m_radius;
}
-PassRefPtr<BasicShape> BasicShapeRectangle::blend(const BasicShape* other, double progress) const
+float BasicShapeCircle::floatValueForRadiusInBox(FloatSize boxSize) const
{
- ASSERT(type() == other->type());
+ if (m_radius.type() == BasicShapeRadius::Value)
+ return floatValueForLength(m_radius.value(), hypotf(boxSize.width(), boxSize.height()) / sqrtf(2));
- const BasicShapeRectangle* o = static_cast<const BasicShapeRectangle*>(other);
- RefPtr<BasicShapeRectangle> result = BasicShapeRectangle::create();
- result->setX(m_x.blend(o->x(), progress, ValueRangeAll));
- result->setY(m_y.blend(o->y(), progress, ValueRangeAll));
- result->setWidth(m_width.blend(o->width(), progress, ValueRangeNonNegative));
- result->setHeight(m_height.blend(o->height(), progress, ValueRangeNonNegative));
- result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress, ValueRangeNonNegative));
- result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress, ValueRangeNonNegative));
- return result.release();
+ FloatPoint center = floatPointForCenterCoordinate(m_centerX, m_centerY, boxSize);
+
+ if (m_radius.type() == BasicShapeRadius::ClosestSide)
+ return std::min(std::min(center.x(), boxSize.width() - center.x()), std::min(center.y(), boxSize.height() - center.y()));
+
+ // If radius.type() == BasicShapeRadius::FarthestSide.
+ return std::max(std::max(center.x(), boxSize.width() - center.x()), std::max(center.y(), boxSize.height() - center.y()));
}
void BasicShapeCircle::path(Path& path, const FloatRect& boundingBox)
{
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);
+ FloatPoint center = floatPointForCenterCoordinate(m_centerX, m_centerY, boundingBox.size());
+ float radius = floatValueForRadiusInBox(boundingBox.size());
path.addEllipse(FloatRect(
- centerX - radius + boundingBox.x(),
- centerY - radius + boundingBox.y(),
+ center.x() - radius + boundingBox.x(),
+ center.y() - radius + boundingBox.y(),
radius * 2,
radius * 2
));
@@ -100,25 +120,44 @@ void BasicShapeCircle::path(Path& path, const FloatRect& boundingBox)
PassRefPtr<BasicShape> BasicShapeCircle::blend(const BasicShape* other, double progress) const
{
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, ValueRangeAll));
- result->setCenterY(m_centerY.blend(o->centerY(), progress, ValueRangeAll));
- result->setRadius(m_radius.blend(o->radius(), progress, ValueRangeNonNegative));
+
+ 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();
}
+bool BasicShapeEllipse::operator==(const BasicShape& o) const
+{
+ if (!isSameType(o))
+ return false;
+ const BasicShapeEllipse& other = toBasicShapeEllipse(o);
+ return m_centerX == other.m_centerX && m_centerY == other.m_centerY && m_radiusX == other.m_radiusX && m_radiusY == other.m_radiusY;
+}
+
+float BasicShapeEllipse::floatValueForRadiusInBox(const BasicShapeRadius& radius, float center, float boxWidthOrHeight) const
+{
+ if (radius.type() == BasicShapeRadius::Value)
+ return floatValueForLength(radius.value(), boxWidthOrHeight);
+
+ if (radius.type() == BasicShapeRadius::ClosestSide)
+ return std::min(center, boxWidthOrHeight - center);
+
+ ASSERT(radius.type() == BasicShapeRadius::FarthestSide);
+ return std::max(center, boxWidthOrHeight - center);
+}
+
void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox)
{
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());
+ FloatPoint center = floatPointForCenterCoordinate(m_centerX, m_centerY, boundingBox.size());
+ float radiusX = floatValueForRadiusInBox(m_radiusX, center.x(), boundingBox.width());
+ float radiusY = floatValueForRadiusInBox(m_radiusY, center.y(), boundingBox.height());
path.addEllipse(FloatRect(
- centerX - radiusX + boundingBox.x(),
- centerY - radiusY + boundingBox.y(),
+ center.x() - radiusX + boundingBox.x(),
+ center.y() - radiusY + boundingBox.y(),
radiusX * 2,
radiusY * 2
));
@@ -127,13 +166,22 @@ void BasicShapeEllipse::path(Path& path, const FloatRect& boundingBox)
PassRefPtr<BasicShape> BasicShapeEllipse::blend(const BasicShape* other, double progress) const
{
ASSERT(type() == other->type());
-
const BasicShapeEllipse* o = static_cast<const BasicShapeEllipse*>(other);
RefPtr<BasicShapeEllipse> result = BasicShapeEllipse::create();
- result->setCenterX(m_centerX.blend(o->centerX(), progress, ValueRangeAll));
- result->setCenterY(m_centerY.blend(o->centerY(), progress, ValueRangeAll));
- result->setRadiusX(m_radiusX.blend(o->radiusX(), progress, ValueRangeNonNegative));
- result->setRadiusY(m_radiusY.blend(o->radiusY(), progress, ValueRangeNonNegative));
+
+ 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(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();
}
@@ -157,7 +205,7 @@ void BasicShapePolygon::path(Path& path, const FloatRect& boundingBox)
PassRefPtr<BasicShape> BasicShapePolygon::blend(const BasicShape* other, double progress) const
{
- ASSERT(type() == other->type());
+ ASSERT(other && isSameType(*other));
const BasicShapePolygon* o = static_cast<const BasicShapePolygon*>(other);
ASSERT(m_values.size() == o->values().size());
@@ -178,7 +226,21 @@ PassRefPtr<BasicShape> BasicShapePolygon::blend(const BasicShape* other, double
return result.release();
}
-void BasicShapeInsetRectangle::path(Path& path, const FloatRect& boundingBox)
+bool BasicShapePolygon::operator==(const BasicShape& o) const
+{
+ if (!isSameType(o))
+ return false;
+ const BasicShapePolygon& other = toBasicShapePolygon(o);
+ return m_windRule == other.m_windRule && m_values == other.m_values;
+}
+
+static FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatRect& boundingBox)
+{
+ return FloatSize(floatValueForLength(lengthSize.width(), boundingBox.width()),
+ floatValueForLength(lengthSize.height(), boundingBox.height()));
+}
+
+void BasicShapeInset::path(Path& path, const FloatRect& boundingBox)
{
ASSERT(path.isEmpty());
float left = floatValueForLength(m_left, boundingBox.width());
@@ -190,25 +252,33 @@ void BasicShapeInsetRectangle::path(Path& path, const FloatRect& boundingBox)
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())
- )
+ floatSizeForLengthSize(m_topLeftRadius, boundingBox),
+ floatSizeForLengthSize(m_topRightRadius, boundingBox),
+ floatSizeForLengthSize(m_bottomLeftRadius, boundingBox),
+ floatSizeForLengthSize(m_bottomRightRadius, boundingBox)
);
}
-PassRefPtr<BasicShape> BasicShapeInsetRectangle::blend(const BasicShape* other, double progress) const
+PassRefPtr<BasicShape> BasicShapeInset::blend(const BasicShape* other, double) const
{
ASSERT(type() == other->type());
+ // FIXME: Implement blend for BasicShapeInset.
+ return nullptr;
+}
- const BasicShapeInsetRectangle* o = static_cast<const BasicShapeInsetRectangle*>(other);
- RefPtr<BasicShapeInsetRectangle> result = BasicShapeInsetRectangle::create();
- result->setTop(m_top.blend(o->top(), progress, ValueRangeNonNegative));
- result->setRight(m_right.blend(o->right(), progress, ValueRangeNonNegative));
- result->setBottom(m_bottom.blend(o->bottom(), progress, ValueRangeNonNegative));
- result->setLeft(m_left.blend(o->left(), progress, ValueRangeNonNegative));
- result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress, ValueRangeNonNegative));
- result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress, ValueRangeNonNegative));
- return result.release();
+bool BasicShapeInset::operator==(const BasicShape& o) const
+{
+ if (!isSameType(o))
+ return false;
+ const BasicShapeInset& other = toBasicShapeInset(o);
+ return m_right == other.m_right
+ && m_top == other.m_top
+ && m_bottom == other.m_bottom
+ && m_left == other.m_left
+ && m_topLeftRadius == other.m_topLeftRadius
+ && m_topRightRadius == other.m_topRightRadius
+ && m_bottomRightRadius == other.m_bottomRightRadius
+ && m_bottomLeftRadius == other.m_bottomLeftRadius;
}
+
}
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/BasicShapes.h b/chromium/third_party/WebKit/Source/core/rendering/style/BasicShapes.h
index b8735a82095..6f414688e28 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/BasicShapes.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/BasicShapes.h
@@ -30,7 +30,9 @@
#ifndef BasicShapes_h
#define BasicShapes_h
+#include "core/rendering/style/RenderStyleConstants.h"
#include "platform/Length.h"
+#include "platform/LengthSize.h"
#include "platform/graphics/WindRule.h"
#include "wtf/RefCounted.h"
#include "wtf/RefPtr.h"
@@ -39,6 +41,7 @@
namespace WebCore {
class FloatRect;
+class FloatSize;
class Path;
class BasicShape : public RefCounted<BasicShape> {
@@ -46,117 +49,174 @@ public:
virtual ~BasicShape() { }
enum Type {
- BasicShapeRectangleType = 1,
- BasicShapeCircleType = 2,
- BasicShapeEllipseType = 3,
- BasicShapePolygonType = 4,
- BasicShapeInsetRectangleType = 5
+ BasicShapeEllipseType,
+ BasicShapePolygonType,
+ BasicShapeCircleType,
+ BasicShapeInsetType
};
bool canBlend(const BasicShape*) const;
+ bool isSameType(const BasicShape& other) const { return type() == other.type(); }
virtual void path(Path&, const FloatRect&) = 0;
virtual WindRule windRule() const { return RULE_NONZERO; }
virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const = 0;
+ virtual bool operator==(const BasicShape&) const = 0;
virtual Type type() const = 0;
+
protected:
- BasicShape() { }
+ BasicShape()
+ {
+ }
+
};
-class BasicShapeRectangle : public BasicShape {
+#define DEFINE_BASICSHAPE_TYPE_CASTS(thisType) \
+ DEFINE_TYPE_CASTS(thisType, BasicShape, value, value->type() == BasicShape::thisType##Type, value.type() == BasicShape::thisType##Type)
+
+class BasicShapeCenterCoordinate {
public:
- static PassRefPtr<BasicShapeRectangle> create() { return adoptRef(new BasicShapeRectangle); }
-
- Length x() const { return m_x; }
- Length y() const { return m_y; }
- Length width() const { return m_width; }
- Length height() const { return m_height; }
- Length cornerRadiusX() const { return m_cornerRadiusX; }
- Length cornerRadiusY() const { return m_cornerRadiusY; }
-
- void setX(Length x) { m_x = x; }
- void setY(Length y) { m_y = y; }
- void setWidth(Length width) { m_width = width; }
- void setHeight(Length height) { m_height = height; }
- void setCornerRadiusX(Length radiusX)
+ enum Direction {
+ TopLeft,
+ BottomRight
+ };
+ BasicShapeCenterCoordinate()
+ : m_direction(TopLeft)
+ , m_length(Undefined)
{
- ASSERT(!radiusX.isUndefined());
- m_cornerRadiusX = radiusX;
+ updateComputedLength();
}
- void setCornerRadiusY(Length radiusY)
+
+ BasicShapeCenterCoordinate(Direction direction, const Length& length)
+ : m_direction(direction)
+ , m_length(length)
{
- ASSERT(!radiusY.isUndefined());
- m_cornerRadiusY = radiusY;
+ updateComputedLength();
}
- virtual void path(Path&, const FloatRect&) OVERRIDE;
- virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
+ BasicShapeCenterCoordinate(const BasicShapeCenterCoordinate& other)
+ : m_direction(other.direction())
+ , m_length(other.length())
+ , m_computedLength(other.m_computedLength)
+ {
+ }
+
+ bool operator==(const BasicShapeCenterCoordinate& other) const { return m_direction == other.m_direction && m_length == other.m_length && m_computedLength == other.m_computedLength; }
+
+ Direction direction() const { return m_direction; }
+ const Length& length() const { return m_length; }
+ const Length& computedLength() const { return m_computedLength; }
+
+ BasicShapeCenterCoordinate blend(const BasicShapeCenterCoordinate& other, double progress) const
+ {
+ return BasicShapeCenterCoordinate(TopLeft, m_computedLength.blend(other.m_computedLength, progress, ValueRangeAll));
+ }
- virtual Type type() const { return BasicShapeRectangleType; }
private:
- BasicShapeRectangle() { }
-
- Length m_y;
- Length m_x;
- Length m_width;
- Length m_height;
- Length m_cornerRadiusX;
- Length m_cornerRadiusY;
+ Direction m_direction;
+ Length m_length;
+ Length m_computedLength;
+
+ void updateComputedLength();
};
-class BasicShapeCircle : public BasicShape {
+class BasicShapeRadius {
+public:
+ enum Type {
+ Value,
+ ClosestSide,
+ FarthestSide
+ };
+ BasicShapeRadius() : m_value(Undefined), m_type(ClosestSide) { }
+ explicit BasicShapeRadius(const 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()) { }
+ bool operator==(const BasicShapeRadius& other) const { return m_type == other.m_type && m_value == other.m_value; }
+
+ const Length& value() const { return m_value; }
+ Type type() const { return m_type; }
+
+ bool canBlend(const BasicShapeRadius& other) const
+ {
+ // FIXME determine how to interpolate between keywords. See issue 330248.
+ return m_type == Value && other.type() == Value;
+ }
+
+ BasicShapeRadius blend(const BasicShapeRadius& other, double progress) const
+ {
+ if (m_type != Value || other.type() != Value)
+ return BasicShapeRadius(other);
+
+ return BasicShapeRadius(m_value.blend(other.value(), progress, ValueRangeNonNegative));
+ }
+
+private:
+ Length m_value;
+ Type m_type;
+
+};
+
+class BasicShapeCircle FINAL : public BasicShape {
public:
static PassRefPtr<BasicShapeCircle> create() { return adoptRef(new BasicShapeCircle); }
- Length centerX() const { return m_centerX; }
- Length centerY() const { return m_centerY; }
- Length radius() const { return m_radius; }
+ const BasicShapeCenterCoordinate& centerX() const { return m_centerX; }
+ const BasicShapeCenterCoordinate& centerY() const { return m_centerY; }
+ const BasicShapeRadius& radius() const { return m_radius; }
- void setCenterX(Length centerX) { m_centerX = centerX; }
- void setCenterY(Length centerY) { m_centerY = centerY; }
- void setRadius(Length radius) { m_radius = radius; }
+ float floatValueForRadiusInBox(FloatSize) const;
+ void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; }
+ void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; }
+ void setRadius(BasicShapeRadius radius) { m_radius = radius; }
virtual void path(Path&, const FloatRect&) OVERRIDE;
virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
+ virtual bool operator==(const BasicShape&) const OVERRIDE;
- virtual Type type() const { return BasicShapeCircleType; }
+ virtual Type type() const OVERRIDE { return BasicShapeCircleType; }
private:
BasicShapeCircle() { }
- Length m_centerX;
- Length m_centerY;
- Length m_radius;
+ BasicShapeCenterCoordinate m_centerX;
+ BasicShapeCenterCoordinate m_centerY;
+ BasicShapeRadius m_radius;
};
-class BasicShapeEllipse : public BasicShape {
+DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeCircle);
+
+class BasicShapeEllipse FINAL : public BasicShape {
public:
static PassRefPtr<BasicShapeEllipse> create() { return adoptRef(new BasicShapeEllipse); }
- Length centerX() const { return m_centerX; }
- Length centerY() const { return m_centerY; }
- Length radiusX() const { return m_radiusX; }
- Length radiusY() const { return m_radiusY; }
+ const BasicShapeCenterCoordinate& centerX() const { return m_centerX; }
+ const BasicShapeCenterCoordinate& centerY() const { return m_centerY; }
+ const BasicShapeRadius& radiusX() const { return m_radiusX; }
+ const BasicShapeRadius& radiusY() const { return m_radiusY; }
+ float floatValueForRadiusInBox(const BasicShapeRadius&, float center, float boxWidthOrHeight) const;
- void setCenterX(Length centerX) { m_centerX = centerX; }
- void setCenterY(Length centerY) { m_centerY = centerY; }
- void setRadiusX(Length radiusX) { m_radiusX = radiusX; }
- void setRadiusY(Length radiusY) { m_radiusY = radiusY; }
+ void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; }
+ void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; }
+ void setRadiusX(BasicShapeRadius radiusX) { m_radiusX = radiusX; }
+ void setRadiusY(BasicShapeRadius radiusY) { m_radiusY = radiusY; }
virtual void path(Path&, const FloatRect&) OVERRIDE;
virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
+ virtual bool operator==(const BasicShape&) const OVERRIDE;
- virtual Type type() const { return BasicShapeEllipseType; }
+ virtual Type type() const OVERRIDE { return BasicShapeEllipseType; }
private:
BasicShapeEllipse() { }
- Length m_centerX;
- Length m_centerY;
- Length m_radiusX;
- Length m_radiusY;
+ BasicShapeCenterCoordinate m_centerX;
+ BasicShapeCenterCoordinate m_centerY;
+ BasicShapeRadius m_radiusX;
+ BasicShapeRadius m_radiusY;
};
-class BasicShapePolygon : public BasicShape {
+DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeEllipse);
+
+class BasicShapePolygon FINAL : public BasicShape {
public:
static PassRefPtr<BasicShapePolygon> create() { return adoptRef(new BasicShapePolygon); }
@@ -165,14 +225,15 @@ public:
Length getYAt(unsigned i) const { return m_values.at(2 * i + 1); }
void setWindRule(WindRule windRule) { m_windRule = windRule; }
- void appendPoint(Length x, Length y) { m_values.append(x); m_values.append(y); }
+ void appendPoint(const Length& x, const Length& y) { m_values.append(x); m_values.append(y); }
virtual void path(Path&, const FloatRect&) OVERRIDE;
virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
+ virtual bool operator==(const BasicShape&) const OVERRIDE;
- virtual WindRule windRule() const { return m_windRule; }
+ virtual WindRule windRule() const OVERRIDE { return m_windRule; }
- virtual Type type() const { return BasicShapePolygonType; }
+ virtual Type type() const OVERRIDE { return BasicShapePolygonType; }
private:
BasicShapePolygon()
: m_windRule(RULE_NONZERO)
@@ -182,45 +243,52 @@ private:
Vector<Length> m_values;
};
-class BasicShapeInsetRectangle : public BasicShape {
+DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapePolygon);
+
+class BasicShapeInset : public BasicShape {
public:
- static PassRefPtr<BasicShapeInsetRectangle> create() { return adoptRef(new BasicShapeInsetRectangle); }
-
- Length top() const { return m_top; }
- Length right() const { return m_right; }
- Length bottom() const { return m_bottom; }
- Length left() const { return m_left; }
- Length cornerRadiusX() const { return m_cornerRadiusX; }
- Length cornerRadiusY() const { return m_cornerRadiusY; }
-
- void setTop(Length top) { m_top = top; }
- void setRight(Length right) { m_right = right; }
- void setBottom(Length bottom) { m_bottom = bottom; }
- void setLeft(Length left) { m_left = left; }
- void setCornerRadiusX(Length radiusX)
- {
- ASSERT(!radiusX.isUndefined());
- m_cornerRadiusX = radiusX;
- }
- void setCornerRadiusY(Length radiusY)
- {
- ASSERT(!radiusY.isUndefined());
- m_cornerRadiusY = radiusY;
- }
+ static PassRefPtr<BasicShapeInset> create() { return adoptRef(new BasicShapeInset); }
+
+ 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 LengthSize& topLeftRadius() const { return m_topLeftRadius; }
+ const LengthSize& topRightRadius() const { return m_topRightRadius; }
+ const LengthSize& bottomRightRadius() const { return m_bottomRightRadius; }
+ const LengthSize& bottomLeftRadius() const { return m_bottomLeftRadius; }
+
+ void setTop(const Length& top) { m_top = top; }
+ void setRight(const Length& right) { m_right = right; }
+ void setBottom(const Length& bottom) { m_bottom = bottom; }
+ void setLeft(const Length& left) { m_left = left; }
+
+ void setTopLeftRadius(const LengthSize& radius) { m_topLeftRadius = radius; }
+ void setTopRightRadius(const LengthSize& radius) { m_topRightRadius = radius; }
+ void setBottomRightRadius(const LengthSize& radius) { m_bottomRightRadius = radius; }
+ void setBottomLeftRadius(const LengthSize& radius) { m_bottomLeftRadius = radius; }
virtual void path(Path&, const FloatRect&) OVERRIDE;
virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
+ virtual bool operator==(const BasicShape&) const OVERRIDE;
- virtual Type type() const { return BasicShapeInsetRectangleType; }
+ virtual Type type() const OVERRIDE { return BasicShapeInsetType; }
private:
- BasicShapeInsetRectangle() { }
+ BasicShapeInset() { }
Length m_right;
Length m_top;
Length m_bottom;
Length m_left;
- Length m_cornerRadiusX;
- Length m_cornerRadiusY;
+
+ LengthSize m_topLeftRadius;
+ LengthSize m_topRightRadius;
+ LengthSize m_bottomRightRadius;
+ LengthSize m_bottomLeftRadius;
};
+
+DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeInset);
+
}
#endif
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/BorderData.h b/chromium/third_party/WebKit/Source/core/rendering/style/BorderData.h
index bf96bcf797c..4df4644ebfe 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/BorderData.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/BorderData.h
@@ -94,6 +94,19 @@ public:
&& m_topLeft == o.m_topLeft && m_topRight == o.m_topRight && m_bottomLeft == o.m_bottomLeft && m_bottomRight == o.m_bottomRight;
}
+ bool visuallyEqual(const BorderData& o) const
+ {
+ return m_left.visuallyEqual(o.m_left)
+ && m_right.visuallyEqual(o.m_right)
+ && m_top.visuallyEqual(o.m_top)
+ && m_bottom.visuallyEqual(o.m_bottom)
+ && m_image == o.m_image
+ && m_topLeft == o.m_topLeft
+ && m_topRight == o.m_topRight
+ && m_bottomLeft == o.m_bottomLeft
+ && m_bottomRight == o.m_bottomRight;
+ }
+
bool operator!=(const BorderData& o) const
{
return !(*this == o);
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/BorderValue.h b/chromium/third_party/WebKit/Source/core/rendering/style/BorderValue.h
index dcd5096df0b..211f0be97f9 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/BorderValue.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/BorderValue.h
@@ -25,6 +25,7 @@
#ifndef BorderValue_h
#define BorderValue_h
+#include "core/css/StyleColor.h"
#include "core/rendering/style/RenderStyleConstants.h"
#include "platform/graphics/Color.h"
@@ -35,7 +36,7 @@ friend class RenderStyle;
public:
BorderValue()
: m_color(0)
- , m_colorIsValid(false)
+ , m_colorIsCurrentColor(true)
, m_width(3)
, m_style(BNONE)
, m_isAuto(AUTO_OFF)
@@ -49,7 +50,7 @@ public:
bool isTransparent() const
{
- return m_colorIsValid && !alphaChannel(m_color);
+ return !m_colorIsCurrentColor && !m_color.alpha();
}
bool isVisible(bool checkStyle = true) const
@@ -59,7 +60,17 @@ public:
bool operator==(const BorderValue& o) const
{
- return m_width == o.m_width && m_style == o.m_style && m_color == o.m_color && m_colorIsValid == o.m_colorIsValid;
+ return m_width == o.m_width && m_style == o.m_style && m_color == o.m_color && m_colorIsCurrentColor == o.m_colorIsCurrentColor;
+ }
+
+ // The default width is 3px, but if the style is none we compute a value of 0 (in RenderStyle itself)
+ bool visuallyEqual(const BorderValue& o) const
+ {
+ if (m_style == BNONE && o.m_style == BNONE)
+ return true;
+ if (m_style == BHIDDEN && o.m_style == BHIDDEN)
+ return true;
+ return *this == o;
}
bool operator!=(const BorderValue& o) const
@@ -67,20 +78,20 @@ public:
return !(*this == o);
}
- void setColor(const Color& color)
+ void setColor(const StyleColor& color)
{
- m_color = color.rgb();
- m_colorIsValid = color.isValid();
+ m_color = color.resolve(Color());
+ m_colorIsCurrentColor = color.isCurrentColor();
}
- Color color() const { return Color(m_color, m_colorIsValid); }
+ StyleColor color() const { return m_colorIsCurrentColor ? StyleColor::currentColor() : StyleColor(m_color); }
unsigned width() const { return m_width; }
EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
protected:
- RGBA32 m_color;
- unsigned m_colorIsValid : 1;
+ Color m_color;
+ unsigned m_colorIsCurrentColor : 1;
unsigned m_width : 26;
unsigned m_style : 4; // EBorderStyle
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/CachedUAStyle.h b/chromium/third_party/WebKit/Source/core/rendering/style/CachedUAStyle.h
index f56d66f3395..10bed857f56 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/CachedUAStyle.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/CachedUAStyle.h
@@ -32,32 +32,31 @@ namespace WebCore {
// applyMatchedProperties for later use during adjustRenderStyle.
class CachedUAStyle {
public:
- CachedUAStyle()
- : hasAppearance(false)
- , backgroundLayers(BackgroundFillLayer)
- { }
+ static PassOwnPtr<CachedUAStyle> create(const RenderStyle* style)
+ {
+ return adoptPtr(new CachedUAStyle(style));
+ }
+
+ bool hasAppearance;
+ BorderData border;
+ FillLayer backgroundLayers;
+ StyleColor backgroundColor;
+private:
explicit CachedUAStyle(const RenderStyle* style)
- : hasAppearance(style->hasAppearance())
+ : hasAppearance(true)
, backgroundLayers(BackgroundFillLayer)
+ , backgroundColor(StyleColor::currentColor())
{
- // RenderTheme::adjustStyle is the only consumer of this data.
- // It only cares about the styles if appearance is set,
- // so we cheat and don't bother to copy them when !hasAppearance.
- if (!hasAppearance)
- return;
+ ASSERT(style->hasAppearance());
border = style->border();
backgroundLayers = *style->backgroundLayers();
backgroundColor = style->backgroundColor();
}
-
- bool hasAppearance;
- BorderData border;
- FillLayer backgroundLayers;
- Color backgroundColor;
};
+
} // namespace WebCore
#endif // CachedUAStyle_h
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/CollapsedBorderValue.h b/chromium/third_party/WebKit/Source/core/rendering/style/CollapsedBorderValue.h
index ef16dba2322..ac7b0575557 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/CollapsedBorderValue.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/CollapsedBorderValue.h
@@ -33,7 +33,7 @@ class CollapsedBorderValue {
public:
CollapsedBorderValue()
: m_color(0)
- , m_colorIsValid(false)
+ , m_colorIsCurrentColor(true)
, m_width(0)
, m_style(BNONE)
, m_precedence(BOFF)
@@ -41,9 +41,9 @@ public:
{
}
- CollapsedBorderValue(const BorderValue& border, const Color& color, EBorderPrecedence precedence)
- : m_color(color.rgb())
- , m_colorIsValid(color.isValid())
+ CollapsedBorderValue(const BorderValue& border, const StyleColor& color, EBorderPrecedence precedence)
+ : m_color(color.resolve(Color()))
+ , m_colorIsCurrentColor(color.isCurrentColor())
, m_width(border.nonZero() ? border.width() : 0)
, m_style(border.style())
, m_precedence(precedence)
@@ -54,7 +54,7 @@ public:
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); }
+ StyleColor color() const { return m_colorIsCurrentColor ? StyleColor::currentColor() : StyleColor(m_color); }
bool isTransparent() const { return m_transparent; }
EBorderPrecedence precedence() const { return static_cast<EBorderPrecedence>(m_precedence); }
@@ -64,8 +64,8 @@ public:
}
private:
- RGBA32 m_color;
- unsigned m_colorIsValid : 1;
+ Color m_color;
+ unsigned m_colorIsCurrentColor : 1;
unsigned m_width : 23;
unsigned m_style : 4; // EBorderStyle
unsigned m_precedence : 3; // EBorderPrecedence
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/ContentData.h b/chromium/third_party/WebKit/Source/core/rendering/style/ContentData.h
index 77dd5619e9c..a01f6cc018f 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/ContentData.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/ContentData.h
@@ -66,7 +66,7 @@ private:
OwnPtr<ContentData> m_next;
};
-class ImageContentData : public ContentData {
+class ImageContentData FINAL : public ContentData {
friend class ContentData;
public:
const StyleImage* image() const { return m_image.get(); }
@@ -89,7 +89,7 @@ private:
{
}
- virtual PassOwnPtr<ContentData> cloneInternal() const
+ virtual PassOwnPtr<ContentData> cloneInternal() const OVERRIDE
{
RefPtr<StyleImage> image = const_cast<StyleImage*>(this->image());
return create(image.release());
@@ -98,7 +98,7 @@ private:
RefPtr<StyleImage> m_image;
};
-class TextContentData : public ContentData {
+class TextContentData FINAL : public ContentData {
friend class ContentData;
public:
const String& text() const { return m_text; }
@@ -120,12 +120,12 @@ private:
{
}
- virtual PassOwnPtr<ContentData> cloneInternal() const { return create(text()); }
+ virtual PassOwnPtr<ContentData> cloneInternal() const OVERRIDE { return create(text()); }
String m_text;
};
-class CounterContentData : public ContentData {
+class CounterContentData FINAL : public ContentData {
friend class ContentData;
public:
const CounterContent* counter() const { return m_counter.get(); }
@@ -140,7 +140,7 @@ private:
{
}
- virtual PassOwnPtr<ContentData> cloneInternal() const
+ virtual PassOwnPtr<ContentData> cloneInternal() const OVERRIDE
{
OwnPtr<CounterContent> counterData = adoptPtr(new CounterContent(*counter()));
return create(counterData.release());
@@ -156,7 +156,7 @@ private:
OwnPtr<CounterContent> m_counter;
};
-class QuoteContentData : public ContentData {
+class QuoteContentData FINAL : public ContentData {
friend class ContentData;
public:
QuoteType quote() const { return m_quote; }
@@ -178,7 +178,7 @@ private:
{
}
- virtual PassOwnPtr<ContentData> cloneInternal() const { return create(quote()); }
+ virtual PassOwnPtr<ContentData> cloneInternal() const OVERRIDE { return create(quote()); }
QuoteType m_quote;
};
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/CursorList.h b/chromium/third_party/WebKit/Source/core/rendering/style/CursorList.h
deleted file mode 100644
index 90bd00c181d..00000000000
--- a/chromium/third_party/WebKit/Source/core/rendering/style/CursorList.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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 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
- * 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 CursorList_h
-#define CursorList_h
-
-#include "core/rendering/style/CursorData.h"
-#include "wtf/RefCounted.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class CursorList : public RefCounted<CursorList> {
-public:
- static PassRefPtr<CursorList> create()
- {
- return adoptRef(new CursorList);
- }
-
- const CursorData& operator[](int i) const { return m_vector[i]; }
- CursorData& operator[](int i) { return m_vector[i]; }
- const CursorData& at(size_t i) const { return m_vector.at(i); }
- CursorData& at(size_t i) { return m_vector.at(i); }
-
- bool operator==(const CursorList& o) const { return m_vector == o.m_vector; }
- bool operator!=(const CursorList& o) const { return m_vector != o.m_vector; }
-
- size_t size() const { return m_vector.size(); }
- void append(const CursorData& cursorData) { m_vector.append(cursorData); }
-
-private:
- CursorList()
- {
- }
-
- Vector<CursorData> m_vector;
-};
-
-} // namespace WebCore
-
-#endif // CursorList_h
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/DataEquivalency.h b/chromium/third_party/WebKit/Source/core/rendering/style/DataEquivalency.h
new file mode 100644
index 00000000000..87d92388bbe
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/DataEquivalency.h
@@ -0,0 +1,49 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DataEquivalency_h
+#define DataEquivalency_h
+
+#include "wtf/OwnPtr.h"
+#include "wtf/RefPtr.h"
+
+namespace WebCore {
+
+template <typename T>
+bool dataEquivalent(const T* a, const T* b)
+{
+ if (a == b)
+ return true;
+ if (!a || !b)
+ return false;
+ return *a == *b;
+}
+
+template <typename T>
+bool dataEquivalent(const RefPtr<T>& a, const RefPtr<T>& b)
+{
+ return dataEquivalent(a.get(), b.get());
+}
+
+template <typename T>
+bool dataEquivalent(const Persistent<T>& a, const Persistent<T>& b)
+{
+ return dataEquivalent(a.get(), b.get());
+}
+
+template <typename T>
+bool dataEquivalent(const Member<T>& a, const Member<T>& b)
+{
+ return dataEquivalent(a.get(), b.get());
+}
+
+template <typename T>
+bool dataEquivalent(const OwnPtr<T>& a, const OwnPtr<T>& b)
+{
+ return dataEquivalent(a.get(), b.get());
+}
+
+} // namespace WebCore
+
+#endif // DataEquivalency_h
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/FillLayer.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/FillLayer.cpp
index 5a621e0c1f2..907a80d5b52 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/FillLayer.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/FillLayer.cpp
@@ -22,6 +22,8 @@
#include "config.h"
#include "core/rendering/style/FillLayer.h"
+#include "core/rendering/style/DataEquivalency.h"
+
namespace WebCore {
struct SameSizeAsFillLayer {
@@ -34,8 +36,8 @@ struct SameSizeAsFillLayer {
LengthSize m_sizeLength;
- unsigned m_bitfields: 32;
- unsigned m_bitfields2: 1;
+ unsigned m_bitfields1;
+ unsigned m_bitfields2;
};
COMPILE_ASSERT(sizeof(FillLayer) == sizeof(SameSizeAsFillLayer), FillLayer_should_stay_small);
@@ -159,7 +161,7 @@ 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 StyleImage::imagesEquivalent(m_image.get(), o.m_image.get()) && m_xPosition == o.m_xPosition && m_yPosition == o.m_yPosition
+ return dataEquivalent(m_image, o.m_image) && 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
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/FillLayer.h b/chromium/third_party/WebKit/Source/core/rendering/style/FillLayer.h
index 790f202db1b..f79abaf9588 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/FillLayer.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/FillLayer.h
@@ -40,7 +40,7 @@ struct FillSize {
{
}
- FillSize(EFillSizeType t, LengthSize l)
+ FillSize(EFillSizeType t, const LengthSize& l)
: type(t)
, size(l)
{
@@ -66,8 +66,8 @@ public:
~FillLayer();
StyleImage* image() const { return m_image.get(); }
- Length xPosition() const { return m_xPosition; }
- Length yPosition() const { return m_yPosition; }
+ const Length& xPosition() const { return m_xPosition; }
+ const Length& yPosition() const { return m_yPosition; }
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); }
@@ -77,7 +77,7 @@ public:
EFillRepeat repeatY() const { return static_cast<EFillRepeat>(m_repeatY); }
CompositeOperator composite() const { return static_cast<CompositeOperator>(m_composite); }
blink::WebBlendMode blendMode() const { return static_cast<blink::WebBlendMode>(m_blendMode); }
- LengthSize sizeLength() const { return m_sizeLength; }
+ const LengthSize& sizeLength() const { return m_sizeLength; }
EFillSizeType sizeType() const { return static_cast<EFillSizeType>(m_sizeType); }
FillSize size() const { return FillSize(static_cast<EFillSizeType>(m_sizeType), m_sizeLength); }
EMaskSourceType maskSourceType() const { return static_cast<EMaskSourceType>(m_maskSourceType); }
@@ -101,8 +101,8 @@ public:
bool isMaskSourceTypeSet() const { return m_maskSourceTypeSet; }
void setImage(PassRefPtr<StyleImage> i) { m_image = i; m_imageSet = true; }
- void setXPosition(Length position) { m_xPosition = position; m_xPosSet = true; m_backgroundXOriginSet = false; m_backgroundXOrigin = LeftEdge; }
- void setYPosition(Length position) { m_yPosition = position; m_yPosSet = true; m_backgroundYOriginSet = false; m_backgroundYOrigin = TopEdge; }
+ void setXPosition(const Length& position) { m_xPosition = position; m_xPosSet = true; m_backgroundXOriginSet = false; m_backgroundXOrigin = LeftEdge; }
+ void setYPosition(const Length& position) { m_yPosition = position; m_yPosSet = true; m_backgroundYOriginSet = false; m_backgroundYOrigin = TopEdge; }
void setBackgroundXOrigin(BackgroundEdgeOrigin origin) { m_backgroundXOrigin = origin; m_backgroundXOriginSet = true; }
void setBackgroundYOrigin(BackgroundEdgeOrigin origin) { m_backgroundYOrigin = origin; m_backgroundYOriginSet = true; }
void setAttachment(EFillAttachment attachment) { m_attachment = attachment; m_attachmentSet = true; }
@@ -113,7 +113,7 @@ public:
void setComposite(CompositeOperator c) { m_composite = c; m_compositeSet = true; }
void setBlendMode(blink::WebBlendMode b) { m_blendMode = b; m_blendModeSet = true; }
void setSizeType(EFillSizeType b) { m_sizeType = b; }
- void setSizeLength(LengthSize l) { m_sizeLength = l; }
+ void setSizeLength(const LengthSize& l) { m_sizeLength = l; }
void setSize(FillSize f) { m_sizeType = f.type; m_sizeLength = f.size; }
void setMaskSourceType(EMaskSourceType m) { m_maskSourceType = m; m_maskSourceTypeSet = true; }
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/GridCoordinate.h b/chromium/third_party/WebKit/Source/core/rendering/style/GridCoordinate.h
index 937d3f08b9b..fa78aa22a79 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/GridCoordinate.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/GridCoordinate.h
@@ -31,36 +31,36 @@
#ifndef GridCoordinate_h
#define GridCoordinate_h
-#include "core/rendering/style/GridPosition.h"
+#include "core/rendering/style/GridResolvedPosition.h"
#include "wtf/HashMap.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
-// 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.
+// A span in a single direction (either rows or columns). Note that |resolvedInitialPosition|
+// and |resolvedFinalPosition| are grid areas' indexes, NOT grid lines'. Iterating over the
+// span should include both |resolvedInitialPosition| and |resolvedFinalPosition| to be correct.
struct GridSpan {
- static PassOwnPtr<GridSpan> create(size_t initialPosition, size_t finalPosition)
+ static PassOwnPtr<GridSpan> create(const GridResolvedPosition& resolvedInitialPosition, const GridResolvedPosition& resolvedFinalPosition)
{
- return adoptPtr(new GridSpan(initialPosition, finalPosition));
+ return adoptPtr(new GridSpan(resolvedInitialPosition, resolvedFinalPosition));
}
- static PassOwnPtr<GridSpan> createWithSpanAgainstOpposite(size_t resolvedOppositePosition, const GridPosition& position, GridPositionSide side)
+ static PassOwnPtr<GridSpan> createWithSpanAgainstOpposite(const GridResolvedPosition& resolvedOppositePosition, const GridPosition& position, GridPositionSide 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.
size_t positionOffset = position.spanPosition() - 1;
if (side == ColumnStartSide || side == RowStartSide) {
- size_t initialResolvedPosition = std::max<int>(0, resolvedOppositePosition - positionOffset);
+ GridResolvedPosition initialResolvedPosition = GridResolvedPosition(std::max<int>(0, resolvedOppositePosition.toInt() - positionOffset));
return GridSpan::create(initialResolvedPosition, resolvedOppositePosition);
}
- return GridSpan::create(resolvedOppositePosition, resolvedOppositePosition + positionOffset);
+ return GridSpan::create(resolvedOppositePosition, GridResolvedPosition(resolvedOppositePosition.toInt() + positionOffset));
}
- static PassOwnPtr<GridSpan> createWithNamedSpanAgainstOpposite(size_t resolvedOppositePosition, const GridPosition& position, GridPositionSide side, const Vector<size_t>& gridLines)
+ static PassOwnPtr<GridSpan> createWithNamedSpanAgainstOpposite(const GridResolvedPosition& resolvedOppositePosition, const GridPosition& position, GridPositionSide side, const Vector<size_t>& gridLines)
{
if (side == RowStartSide || side == ColumnStartSide)
return createWithInitialNamedSpanAgainstOpposite(resolvedOppositePosition, position, gridLines);
@@ -68,50 +68,71 @@ struct GridSpan {
return createWithFinalNamedSpanAgainstOpposite(resolvedOppositePosition, position, gridLines);
}
- static PassOwnPtr<GridSpan> createWithInitialNamedSpanAgainstOpposite(size_t resolvedOppositePosition, const GridPosition& position, const Vector<size_t>& gridLines)
+ static PassOwnPtr<GridSpan> createWithInitialNamedSpanAgainstOpposite(const GridResolvedPosition& resolvedOppositePosition, const GridPosition& position, const Vector<size_t>& gridLines)
{
// The grid line inequality needs to be strict (which doesn't match the after / end case) because |resolvedOppositePosition|
// is already converted to an index in our grid representation (ie one was removed from the grid line to account for the side).
size_t firstLineBeforeOppositePositionIndex = 0;
- const size_t* firstLineBeforeOppositePosition = std::lower_bound(gridLines.begin(), gridLines.end(), resolvedOppositePosition);
- if (firstLineBeforeOppositePosition != gridLines.end())
+ const size_t* firstLineBeforeOppositePosition = std::lower_bound(gridLines.begin(), gridLines.end(), resolvedOppositePosition.toInt());
+ if (firstLineBeforeOppositePosition != gridLines.end()) {
+ if (*firstLineBeforeOppositePosition > resolvedOppositePosition.toInt() && firstLineBeforeOppositePosition != gridLines.begin())
+ --firstLineBeforeOppositePosition;
+
firstLineBeforeOppositePositionIndex = firstLineBeforeOppositePosition - gridLines.begin();
+ }
size_t gridLineIndex = std::max<int>(0, firstLineBeforeOppositePositionIndex - position.spanPosition() + 1);
- size_t resolvedGridLinePosition = gridLines[gridLineIndex];
+ GridResolvedPosition resolvedGridLinePosition = GridResolvedPosition(gridLines[gridLineIndex]);
if (resolvedGridLinePosition > resolvedOppositePosition)
resolvedGridLinePosition = resolvedOppositePosition;
return GridSpan::create(resolvedGridLinePosition, resolvedOppositePosition);
}
- static PassOwnPtr<GridSpan> createWithFinalNamedSpanAgainstOpposite(size_t resolvedOppositePosition, const GridPosition& position, const Vector<size_t>& gridLines)
+ static PassOwnPtr<GridSpan> createWithFinalNamedSpanAgainstOpposite(const GridResolvedPosition& resolvedOppositePosition, const GridPosition& position, const Vector<size_t>& gridLines)
{
size_t firstLineAfterOppositePositionIndex = gridLines.size() - 1;
- const size_t* firstLineAfterOppositePosition = std::upper_bound(gridLines.begin(), gridLines.end(), resolvedOppositePosition);
+ const size_t* firstLineAfterOppositePosition = std::upper_bound(gridLines.begin(), gridLines.end(), resolvedOppositePosition.toInt());
if (firstLineAfterOppositePosition != gridLines.end())
firstLineAfterOppositePositionIndex = firstLineAfterOppositePosition - gridLines.begin();
size_t gridLineIndex = std::min(gridLines.size() - 1, firstLineAfterOppositePositionIndex + position.spanPosition() - 1);
- size_t resolvedGridLinePosition = GridPosition::adjustGridPositionForAfterEndSide(gridLines[gridLineIndex]);
+ GridResolvedPosition resolvedGridLinePosition = GridResolvedPosition::adjustGridPositionForAfterEndSide(gridLines[gridLineIndex]);
if (resolvedGridLinePosition < resolvedOppositePosition)
resolvedGridLinePosition = resolvedOppositePosition;
return GridSpan::create(resolvedOppositePosition, resolvedGridLinePosition);
}
- GridSpan(size_t initialPosition, size_t finalPosition)
- : initialPositionIndex(initialPosition)
- , finalPositionIndex(finalPosition)
+ GridSpan(const GridResolvedPosition& resolvedInitialPosition, const GridResolvedPosition& resolvedFinalPosition)
+ : resolvedInitialPosition(resolvedInitialPosition)
+ , resolvedFinalPosition(resolvedFinalPosition)
{
- ASSERT(initialPositionIndex <= finalPositionIndex);
+ ASSERT(resolvedInitialPosition <= resolvedFinalPosition);
}
bool operator==(const GridSpan& o) const
{
- return initialPositionIndex == o.initialPositionIndex && finalPositionIndex == o.finalPositionIndex;
+ return resolvedInitialPosition == o.resolvedInitialPosition && resolvedFinalPosition == o.resolvedFinalPosition;
+ }
+
+ size_t integerSpan() const
+ {
+ return resolvedFinalPosition.toInt() - resolvedInitialPosition.toInt() + 1;
+ }
+
+ GridResolvedPosition resolvedInitialPosition;
+ GridResolvedPosition resolvedFinalPosition;
+
+ typedef GridResolvedPosition iterator;
+
+ iterator begin() const
+ {
+ return resolvedInitialPosition;
}
- size_t initialPositionIndex;
- size_t finalPositionIndex;
+ iterator end() const
+ {
+ return resolvedFinalPosition.next();
+ }
};
// This represents a grid area that spans in both rows' and columns' direction.
@@ -139,6 +160,22 @@ struct GridCoordinate {
return !(*this == o);
}
+ GridResolvedPosition positionForSide(GridPositionSide side) const
+ {
+ switch (side) {
+ case ColumnStartSide:
+ return columns.resolvedInitialPosition;
+ case ColumnEndSide:
+ return columns.resolvedFinalPosition;
+ case RowStartSide:
+ return rows.resolvedInitialPosition;
+ case RowEndSide:
+ return rows.resolvedFinalPosition;
+ }
+ ASSERT_NOT_REACHED();
+ return 0;
+ }
+
GridSpan columns;
GridSpan rows;
};
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/GridLength.h b/chromium/third_party/WebKit/Source/core/rendering/style/GridLength.h
index dadf7dac255..e822d08ab0b 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/GridLength.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/GridLength.h
@@ -40,17 +40,17 @@ namespace WebCore {
// an new unit to Length.h.
class GridLength {
public:
- GridLength()
- : m_length(Undefined)
+ GridLength(const Length& length)
+ : m_length(length)
, m_flex(0)
, m_type(LengthType)
{
+ ASSERT(!length.isUndefined());
}
- GridLength(const Length& length)
- : m_length(length)
- , m_flex(0)
- , m_type(LengthType)
+ explicit GridLength(double flex)
+ : m_flex(flex)
+ , m_type(FlexType)
{
}
@@ -58,14 +58,8 @@ 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; }
- void setFlex(double flex)
- {
- m_type = FlexType;
- m_flex = flex;
- }
bool operator==(const GridLength& o) const
{
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/GridPosition.h b/chromium/third_party/WebKit/Source/core/rendering/style/GridPosition.h
index 133cdd55123..bb404909546 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/GridPosition.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/GridPosition.h
@@ -42,13 +42,6 @@ enum GridPositionType {
NamedGridAreaPosition // <ident>
};
-enum GridPositionSide {
- ColumnStartSide,
- ColumnEndSide,
- RowStartSide,
- RowEndSide
-};
-
class GridPosition {
public:
GridPosition()
@@ -57,20 +50,6 @@ public:
{
}
- static size_t adjustGridPositionForAfterEndSide(size_t resolvedPosition)
- {
- return resolvedPosition ? resolvedPosition - 1 : 0;
- }
-
- static size_t adjustGridPositionForSide(size_t resolvedPosition, GridPositionSide side)
- {
- // An item finishing on the N-th line belongs to the N-1-th cell.
- if (side == ColumnEndSide || side == RowEndSide)
- return adjustGridPositionForAfterEndSide(resolvedPosition);
-
- return resolvedPosition;
- }
-
bool isPositive() const { return integerPosition() > 0; }
GridPositionType type() const { return m_type; }
@@ -85,6 +64,12 @@ 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.
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/GridResolvedPosition.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/GridResolvedPosition.cpp
new file mode 100644
index 00000000000..b537048b75c
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/GridResolvedPosition.cpp
@@ -0,0 +1,253 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/rendering/style/GridResolvedPosition.h"
+
+#include "core/rendering/RenderBox.h"
+#include "core/rendering/style/GridCoordinate.h"
+
+namespace WebCore {
+
+static const NamedGridLinesMap& gridLinesForSide(const RenderStyle& style, GridPositionSide side)
+{
+ return (side == ColumnStartSide || side == ColumnEndSide) ? style.namedGridColumnLines() : style.namedGridRowLines();
+}
+
+static inline String implicitNamedGridLineForSide(const String& lineName, GridPositionSide side)
+{
+ return lineName + ((side == ColumnStartSide || side == RowStartSide) ? "-start" : "-end");
+}
+
+static bool isValidNamedLineOrArea(const String& lineName, const RenderStyle& style, GridPositionSide side)
+{
+ const NamedGridLinesMap& gridLineNames = gridLinesForSide(style, side);
+
+ return gridLineNames.contains(implicitNamedGridLineForSide(lineName, side)) || gridLineNames.contains(lineName);
+}
+
+static GridPositionSide calculateInitialPositionSide(GridTrackSizingDirection direction)
+{
+ return (direction == ForColumns) ? ColumnStartSide : RowStartSide;
+}
+
+static GridPositionSide calculateFinalPositionSide(GridTrackSizingDirection direction)
+{
+ return (direction == ForColumns) ? ColumnEndSide : RowEndSide;
+}
+
+void GridResolvedPosition::initialAndFinalPositionsFromStyle(const RenderStyle& gridContainerStyle, const RenderBox& gridItem, GridTrackSizingDirection direction, GridPosition& initialPosition, GridPosition& finalPosition)
+{
+ initialPosition = (direction == ForColumns) ? gridItem.style()->gridColumnStart() : gridItem.style()->gridRowStart();
+ finalPosition = (direction == ForColumns) ? gridItem.style()->gridColumnEnd() : gridItem.style()->gridRowEnd();
+ GridPositionSide initialPositionSide = calculateInitialPositionSide(direction);
+ GridPositionSide finalPositionSide = calculateFinalPositionSide(direction);
+
+ // 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() always return a valid resolved position.
+ if (initialPosition.isNamedGridArea() && !isValidNamedLineOrArea(initialPosition.namedGridLine(), gridContainerStyle, initialPositionSide))
+ initialPosition.setAutoPosition();
+
+ if (finalPosition.isNamedGridArea() && !isValidNamedLineOrArea(finalPosition.namedGridLine(), gridContainerStyle, finalPositionSide))
+ 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());
+}
+
+GridSpan GridResolvedPosition::resolveGridPositionsFromAutoPlacementPosition(const RenderStyle& gridContainerStyle, const RenderBox& gridItem, GridTrackSizingDirection direction, const GridResolvedPosition& resolvedInitialPosition)
+{
+ GridPosition initialPosition, finalPosition;
+ initialAndFinalPositionsFromStyle(gridContainerStyle, gridItem, direction, initialPosition, finalPosition);
+
+ GridPositionSide finalPositionSide = calculateFinalPositionSide(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;
+
+ if (initialPosition.isSpan()) {
+ resolvedFinalPosition = resolveGridPositionAgainstOppositePosition(gridContainerStyle, resolvedInitialPosition, initialPosition, finalPositionSide)->resolvedFinalPosition;
+ } else if (finalPosition.isSpan()) {
+ resolvedFinalPosition = resolveGridPositionAgainstOppositePosition(gridContainerStyle, resolvedInitialPosition, finalPosition, finalPositionSide)->resolvedFinalPosition;
+ }
+
+ return GridSpan(resolvedInitialPosition, resolvedFinalPosition);
+}
+
+PassOwnPtr<GridSpan> GridResolvedPosition::resolveGridPositionsFromStyle(const RenderStyle& gridContainerStyle, const RenderBox& gridItem, GridTrackSizingDirection direction)
+{
+ GridPosition initialPosition, finalPosition;
+ initialAndFinalPositionsFromStyle(gridContainerStyle, gridItem, direction, initialPosition, finalPosition);
+
+ GridPositionSide initialPositionSide = calculateInitialPositionSide(direction);
+ GridPositionSide finalPositionSide = calculateFinalPositionSide(direction);
+
+ if (initialPosition.shouldBeResolvedAgainstOppositePosition() && finalPosition.shouldBeResolvedAgainstOppositePosition()) {
+ if (gridContainerStyle.gridAutoFlow() == AutoFlowNone)
+ return adoptPtr(new GridSpan(0, 0));
+
+ // We can't get our grid positions without running the auto placement algorithm.
+ return nullptr;
+ }
+
+ if (initialPosition.shouldBeResolvedAgainstOppositePosition()) {
+ // Infer the position from the final position ('auto / 1' or 'span 2 / 3' case).
+ GridResolvedPosition finalResolvedPosition = resolveGridPositionFromStyle(gridContainerStyle, finalPosition, finalPositionSide);
+ return resolveGridPositionAgainstOppositePosition(gridContainerStyle, finalResolvedPosition, initialPosition, initialPositionSide);
+ }
+
+ if (finalPosition.shouldBeResolvedAgainstOppositePosition()) {
+ // Infer our position from the initial position ('1 / auto' or '3 / span 2' case).
+ GridResolvedPosition initialResolvedPosition = resolveGridPositionFromStyle(gridContainerStyle, initialPosition, initialPositionSide);
+ return resolveGridPositionAgainstOppositePosition(gridContainerStyle, initialResolvedPosition, finalPosition, finalPositionSide);
+ }
+
+ GridResolvedPosition resolvedInitialPosition = resolveGridPositionFromStyle(gridContainerStyle, initialPosition, initialPositionSide);
+ GridResolvedPosition resolvedFinalPosition = resolveGridPositionFromStyle(gridContainerStyle, finalPosition, finalPositionSide);
+
+ // If 'grid-after' specifies a line at or before that specified by 'grid-before', it computes to 'span 1'.
+ if (resolvedFinalPosition < resolvedInitialPosition)
+ resolvedFinalPosition = resolvedInitialPosition;
+
+ return adoptPtr(new GridSpan(resolvedInitialPosition, resolvedFinalPosition));
+}
+
+size_t GridResolvedPosition::explicitGridColumnCount(const RenderStyle& gridContainerStyle)
+{
+ return gridContainerStyle.gridTemplateColumns().size();
+}
+
+size_t GridResolvedPosition::explicitGridRowCount(const RenderStyle& gridContainerStyle)
+{
+ return gridContainerStyle.gridTemplateRows().size();
+}
+
+size_t GridResolvedPosition::explicitGridSizeForSide(const RenderStyle& gridContainerStyle, GridPositionSide side)
+{
+ return (side == ColumnStartSide || side == ColumnEndSide) ? explicitGridColumnCount(gridContainerStyle) : explicitGridRowCount(gridContainerStyle);
+}
+
+GridResolvedPosition GridResolvedPosition::resolveNamedGridLinePositionFromStyle(const RenderStyle& gridContainerStyle, const GridPosition& position, GridPositionSide side)
+{
+ ASSERT(!position.namedGridLine().isNull());
+
+ const NamedGridLinesMap& gridLinesNames = gridLinesForSide(gridContainerStyle, side);
+ NamedGridLinesMap::const_iterator it = gridLinesNames.find(position.namedGridLine());
+ if (it == gridLinesNames.end()) {
+ if (position.isPositive())
+ return GridResolvedPosition(0);
+ const size_t lastLine = explicitGridSizeForSide(gridContainerStyle, side);
+ return adjustGridPositionForSide(lastLine, side);
+ }
+
+ size_t namedGridLineIndex;
+ if (position.isPositive())
+ namedGridLineIndex = std::min<size_t>(position.integerPosition(), it->value.size()) - 1;
+ else
+ namedGridLineIndex = std::max<int>(it->value.size() - abs(position.integerPosition()), 0);
+ return adjustGridPositionForSide(it->value[namedGridLineIndex], side);
+}
+
+GridResolvedPosition 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 adjustGridPositionForSide(position.integerPosition() - 1, side);
+
+ size_t resolvedPosition = abs(position.integerPosition()) - 1;
+ const size_t 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 GridResolvedPosition(0);
+
+ return adjustGridPositionForSide(endOfTrack - resolvedPosition, side);
+ }
+ 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(isValidNamedLineOrArea(namedGridLine, gridContainerStyle, side));
+
+ const NamedGridLinesMap& gridLineNames = gridLinesForSide(gridContainerStyle, side);
+ NamedGridLinesMap::const_iterator implicitLineIter = gridLineNames.find(implicitNamedGridLineForSide(namedGridLine, side));
+ if (implicitLineIter != gridLineNames.end())
+ return adjustGridPositionForSide(implicitLineIter->value[0], side);
+
+ // Otherwise, if there is a named line with the specified name, contributes the first such line to the grid
+ // item’s placement.
+ NamedGridLinesMap::const_iterator explicitLineIter = gridLineNames.find(namedGridLine);
+ if (explicitLineIter != gridLineNames.end())
+ return adjustGridPositionForSide(explicitLineIter->value[0], side);
+
+ // 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 GridResolvedPosition::resolveGridPositionsFromStyle(). We should be also covered by the
+ // ASSERT at the beginning of this block.
+ ASSERT_NOT_REACHED();
+ return GridResolvedPosition(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);
+}
+
+PassOwnPtr<GridSpan> GridResolvedPosition::resolveGridPositionAgainstOppositePosition(const RenderStyle& gridContainerStyle, const GridResolvedPosition& resolvedOppositePosition, const GridPosition& position, GridPositionSide side)
+{
+ if (position.isAuto())
+ return GridSpan::create(resolvedOppositePosition, resolvedOppositePosition);
+
+ 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);
+ }
+
+ return GridSpan::createWithSpanAgainstOpposite(resolvedOppositePosition, position, side);
+}
+
+PassOwnPtr<GridSpan> GridResolvedPosition::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 = gridLinesForSide(gridContainerStyle, side);
+ 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())
+ return GridSpan::create(resolvedOppositePosition, resolvedOppositePosition);
+
+ return GridSpan::createWithNamedSpanAgainstOpposite(resolvedOppositePosition, position, side, it->value);
+}
+
+} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/GridResolvedPosition.h b/chromium/third_party/WebKit/Source/core/rendering/style/GridResolvedPosition.h
new file mode 100644
index 00000000000..e9a79566736
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/GridResolvedPosition.h
@@ -0,0 +1,125 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef GridResolvedPosition_h
+#define GridResolvedPosition_h
+
+#include "core/rendering/style/GridPosition.h"
+
+namespace WebCore {
+
+struct GridSpan;
+class RenderBox;
+class RenderStyle;
+
+enum GridPositionSide {
+ ColumnStartSide,
+ ColumnEndSide,
+ RowStartSide,
+ RowEndSide
+};
+
+enum GridTrackSizingDirection {
+ ForColumns,
+ ForRows
+};
+
+// This class represents an index into one of the dimensions of the grid array.
+// Wraps a size_t integer just for the purpose of knowing what we manipulate in the grid code.
+class GridResolvedPosition {
+public:
+ static GridResolvedPosition adjustGridPositionForAfterEndSide(size_t resolvedPosition)
+ {
+ return resolvedPosition ? GridResolvedPosition(resolvedPosition - 1) : GridResolvedPosition(0);
+ }
+
+ static GridResolvedPosition adjustGridPositionForSide(size_t resolvedPosition, GridPositionSide side)
+ {
+ // An item finishing on the N-th line belongs to the N-1-th cell.
+ if (side == ColumnEndSide || side == RowEndSide)
+ return adjustGridPositionForAfterEndSide(resolvedPosition);
+
+ return GridResolvedPosition(resolvedPosition);
+ }
+
+ static void initialAndFinalPositionsFromStyle(const RenderStyle&, const RenderBox&, GridTrackSizingDirection, GridPosition &initialPosition, GridPosition &finalPosition);
+ static GridSpan resolveGridPositionsFromAutoPlacementPosition(const RenderStyle&, const RenderBox&, GridTrackSizingDirection, const GridResolvedPosition&);
+ static PassOwnPtr<GridSpan> resolveGridPositionsFromStyle(const RenderStyle&, const RenderBox&, GridTrackSizingDirection);
+ static GridResolvedPosition resolveNamedGridLinePositionFromStyle(const RenderStyle&, const GridPosition&, GridPositionSide);
+ static GridResolvedPosition resolveGridPositionFromStyle(const RenderStyle&, const GridPosition&, GridPositionSide);
+ static PassOwnPtr<GridSpan> resolveGridPositionAgainstOppositePosition(const RenderStyle&, const GridResolvedPosition& resolvedOppositePosition, const GridPosition&, GridPositionSide);
+ static PassOwnPtr<GridSpan> resolveNamedGridLinePositionAgainstOppositePosition(const RenderStyle&, const GridResolvedPosition& resolvedOppositePosition, const GridPosition&, GridPositionSide);
+
+ GridResolvedPosition(size_t position)
+ : m_integerPosition(position)
+ {
+ }
+
+ GridResolvedPosition(const GridPosition& position, GridPositionSide side)
+ {
+ ASSERT(position.integerPosition());
+ size_t integerPosition = position.integerPosition() - 1;
+
+ m_integerPosition = adjustGridPositionForSide(integerPosition, side).toInt();
+ }
+
+ 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;
+ }
+
+ size_t toInt() const
+ {
+ return m_integerPosition;
+ }
+
+ GridResolvedPosition next() const
+ {
+ return GridResolvedPosition(m_integerPosition + 1);
+ }
+
+ static size_t explicitGridColumnCount(const RenderStyle&);
+ static size_t explicitGridRowCount(const RenderStyle&);
+
+private:
+
+ static size_t explicitGridSizeForSide(const RenderStyle&, GridPositionSide);
+
+ size_t m_integerPosition;
+};
+
+} // namespace WebCore
+
+#endif // GridResolvedPosition_h
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/GridTrackSize.h b/chromium/third_party/WebKit/Source/core/rendering/style/GridTrackSize.h
index 584b47a4024..b64e5e3bc21 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/GridTrackSize.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/GridTrackSize.h
@@ -42,30 +42,27 @@ enum GridTrackSizeType {
class GridTrackSize {
public:
- GridTrackSize()
+ GridTrackSize(const GridLength& length)
: m_type(LengthTrackSizing)
- , m_minTrackBreadth(Undefined)
- , m_maxTrackBreadth(Undefined)
+ , m_minTrackBreadth(length)
+ , m_maxTrackBreadth(length)
, m_minTrackBreadthIsMinOrMaxContent(false)
, m_minTrackBreadthIsMaxContent(false)
, m_maxTrackBreadthIsMinOrMaxContent(false)
, m_maxTrackBreadthIsMaxContent(false)
{
- // Someone has to set a valid lenght type through setLength or
- // setMinMax before using the object.
+ cacheMinMaxTrackBreadthTypes();
}
- GridTrackSize(LengthType type)
- : m_type(LengthTrackSizing)
- , m_minTrackBreadth(type)
- , m_maxTrackBreadth(type)
+ GridTrackSize(const GridLength& minTrackBreadth, const GridLength& maxTrackBreadth)
+ : m_type(MinMaxTrackSizing)
+ , m_minTrackBreadth(minTrackBreadth)
+ , m_maxTrackBreadth(maxTrackBreadth)
, m_minTrackBreadthIsMinOrMaxContent(false)
, m_minTrackBreadthIsMaxContent(false)
, m_maxTrackBreadthIsMinOrMaxContent(false)
, m_maxTrackBreadthIsMaxContent(false)
{
- ASSERT(type != Undefined);
-
cacheMinMaxTrackBreadthTypes();
}
@@ -74,24 +71,13 @@ public:
ASSERT(m_type == LengthTrackSizing);
ASSERT(m_minTrackBreadth == m_maxTrackBreadth);
const GridLength& minTrackBreadth = m_minTrackBreadth;
- ASSERT(!minTrackBreadth.isLength() || !minTrackBreadth.length().isUndefined());
return minTrackBreadth;
}
- void setLength(const GridLength& length)
- {
- m_type = LengthTrackSizing;
- m_minTrackBreadth = length;
- m_maxTrackBreadth = length;
-
- cacheMinMaxTrackBreadthTypes();
- }
-
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));
+ DEFINE_STATIC_LOCAL(GridLength, minContent, (Length(MinContent)));
return minContent;
}
return m_minTrackBreadth;
@@ -99,27 +85,19 @@ public:
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));
+ DEFINE_STATIC_LOCAL(GridLength, maxContent, (Length(MaxContent)));
return maxContent;
}
return m_maxTrackBreadth;
}
- void setMinMax(const GridLength& minTrackBreadth, const GridLength& maxTrackBreadth)
- {
- m_type = MinMaxTrackSizing;
- m_minTrackBreadth = minTrackBreadth;
- m_maxTrackBreadth = maxTrackBreadth;
-
- cacheMinMaxTrackBreadthTypes();
- }
-
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().isPercent(); }
+
bool operator==(const GridTrackSize& other) const
{
return m_type == other.m_type && m_minTrackBreadth == other.m_minTrackBreadth && m_maxTrackBreadth == other.m_maxTrackBreadth;
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.cpp
index 2ed58360ee1..4ddaf8a5789 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.cpp
@@ -28,27 +28,6 @@
namespace WebCore {
-void KeyframeValue::addProperties(const StylePropertySet* propertySet)
-{
- if (!propertySet)
- return;
- unsigned propertyCount = propertySet->propertyCount();
- for (unsigned i = 0; i < propertyCount; ++i) {
- CSSPropertyID property = propertySet->propertyAt(i).id();
- // Timing-function within keyframes is special, because it is not animated; it just
- // describes the timing function between this keyframe and the next.
- if (property != CSSPropertyWebkitAnimationTimingFunction && property != CSSPropertyAnimationTimingFunction)
- addProperty(property);
- }
-}
-
-TimingFunction* KeyframeValue::timingFunction(const RenderStyle& keyframeStyle)
-{
- const CSSAnimationDataList* animations = keyframeStyle.animations();
- ASSERT(animations && !animations->isEmpty());
- return animations->animation(0)->timingFunction();
-}
-
KeyframeList::~KeyframeList()
{
clear();
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.h b/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.h
index ee2d237b505..26f7b9e76d7 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.h
@@ -25,7 +25,7 @@
#ifndef KeyframeList_h
#define KeyframeList_h
-#include "CSSPropertyNames.h"
+#include "core/CSSPropertyNames.h"
#include "core/rendering/style/StyleInheritedData.h"
#include "wtf/HashSet.h"
#include "wtf/RefPtr.h"
@@ -36,8 +36,6 @@ namespace WebCore {
class RenderObject;
class RenderStyle;
-class StylePropertySet;
-class TimingFunction;
class KeyframeValue {
public:
@@ -47,7 +45,6 @@ public:
{
}
- void addProperties(const StylePropertySet*);
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; }
@@ -58,8 +55,6 @@ public:
const RenderStyle* style() const { return m_style.get(); }
void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; }
- static TimingFunction* timingFunction(const RenderStyle& keyframeStyle);
-
private:
double m_key;
HashSet<CSSPropertyID> m_properties; // The properties specified in this keyframe.
@@ -71,8 +66,8 @@ public:
KeyframeList(RenderObject&, const AtomicString& animationName)
: m_animationName(animationName)
{
- insert(KeyframeValue(0, 0));
- insert(KeyframeValue(1, 0));
+ insert(KeyframeValue(0, nullptr));
+ insert(KeyframeValue(1, nullptr));
}
~KeyframeList();
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/NinePieceImage.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/NinePieceImage.cpp
index 383ca14283a..12c050849b1 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/NinePieceImage.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/NinePieceImage.cpp
@@ -24,6 +24,8 @@
#include "config.h"
#include "core/rendering/style/NinePieceImage.h"
+#include "core/rendering/style/DataEquivalency.h"
+
namespace WebCore {
static DataRef<NinePieceImageData>& defaultData()
@@ -55,7 +57,7 @@ NinePieceImageData::NinePieceImageData()
: fill(false)
, horizontalRule(StretchImageRule)
, verticalRule(StretchImageRule)
- , image(0)
+ , image(nullptr)
, imageSlices(Length(100, Percent), Length(100, Percent), Length(100, Percent), Length(100, Percent))
, borderSlices(1.0, 1.0, 1.0, 1.0)
, outset(Length(0, Fixed), Length(0, Fixed), Length(0, Fixed), Length(0, Fixed))
@@ -76,7 +78,7 @@ NinePieceImageData::NinePieceImageData(const NinePieceImageData& other)
bool NinePieceImageData::operator==(const NinePieceImageData& other) const
{
- return StyleImage::imagesEquivalent(image.get(), other.image.get())
+ return dataEquivalent(image, other.image)
&& imageSlices == other.imageSlices
&& fill == other.fill
&& borderSlices == other.borderSlices
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/OutlineValue.h b/chromium/third_party/WebKit/Source/core/rendering/style/OutlineValue.h
index ccf3c272a01..e70b23229e6 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/OutlineValue.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/OutlineValue.h
@@ -39,7 +39,7 @@ public:
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;
+ return BorderValue::operator==(o) && m_offset == o.m_offset && m_isAuto == o.m_isAuto;
}
bool operator!=(const OutlineValue& o) const
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/QuotesData.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/QuotesData.cpp
index a6ef8e9e120..5ec5c0c9374 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/QuotesData.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/QuotesData.cpp
@@ -64,13 +64,4 @@ const String QuotesData::getCloseQuote(int index) const
return m_quotePairs.at(index).second;
}
-bool QuotesData::equals(const QuotesData* a, const QuotesData* b)
-{
- if (a == b)
- return true;
- if (!a || !b)
- return false;
- return a->m_quotePairs == b->m_quotePairs;
-}
-
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/QuotesData.h b/chromium/third_party/WebKit/Source/core/rendering/style/QuotesData.h
index 94e89e37e10..f8db17b82b9 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/QuotesData.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/QuotesData.h
@@ -35,8 +35,8 @@ public:
static PassRefPtr<QuotesData> create(const String open, const String close);
static PassRefPtr<QuotesData> create(UChar open1, UChar close1, UChar open2, UChar close2);
- // FIXME: this should be an operator==.
- static bool equals(const QuotesData*, const QuotesData*);
+ bool operator==(const QuotesData& o) const { return m_quotePairs == o.m_quotePairs; }
+ bool operator!=(const QuotesData& o) const { return !(*this == o); }
void addPair(const std::pair<String, String> quotePair);
const String getOpenQuote(int index) const;
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/RenderStyle.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/RenderStyle.cpp
index 2bbea394980..6b072146cfb 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/RenderStyle.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/RenderStyle.cpp
@@ -24,18 +24,20 @@
#include "core/rendering/style/RenderStyle.h"
#include <algorithm>
-#include "RuntimeEnabledFeatures.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/rendering/RenderTheme.h"
#include "core/rendering/TextAutosizer.h"
+#include "core/rendering/style/AppliedTextDecoration.h"
#include "core/rendering/style/ContentData.h"
-#include "core/rendering/style/CursorList.h"
#include "core/rendering/style/QuotesData.h"
#include "core/rendering/style/ShadowList.h"
#include "core/rendering/style/StyleImage.h"
#include "core/rendering/style/StyleInheritedData.h"
+#include "platform/LengthFunctions.h"
+#include "platform/RuntimeEnabledFeatures.h"
#include "platform/fonts/Font.h"
#include "platform/fonts/FontSelector.h"
+#include "platform/geometry/FloatRoundedRect.h"
#include "wtf/MathExtras.h"
using namespace std;
@@ -124,6 +126,7 @@ ALWAYS_INLINE RenderStyle::RenderStyle(DefaultStyleTag)
rareNonInheritedData.access()->m_marquee.init();
rareNonInheritedData.access()->m_multiCol.init();
rareNonInheritedData.access()->m_transform.init();
+ rareNonInheritedData.access()->m_willChange.init();
rareNonInheritedData.access()->m_filter.init();
rareNonInheritedData.access()->m_grid.init();
rareNonInheritedData.access()->m_gridItem.init();
@@ -147,7 +150,7 @@ ALWAYS_INLINE RenderStyle::RenderStyle(const RenderStyle& o)
{
}
-static StyleRecalcChange comparePseudoStyles(const RenderStyle* oldStyle, const RenderStyle* newStyle)
+static StyleRecalcChange diffPseudoStyles(const RenderStyle* oldStyle, const RenderStyle* newStyle)
{
// If the pseudoStyles have changed, we want any StyleRecalcChange that is not NoChange
// because setStyle will do the right thing with anything else.
@@ -166,7 +169,7 @@ static StyleRecalcChange comparePseudoStyles(const RenderStyle* oldStyle, const
return NoChange;
}
-StyleRecalcChange RenderStyle::compare(const RenderStyle* oldStyle, const RenderStyle* newStyle)
+StyleRecalcChange RenderStyle::stylePropagationDiff(const RenderStyle* oldStyle, const RenderStyle* newStyle)
{
if ((!oldStyle && newStyle) || (oldStyle && !newStyle))
return Reattach;
@@ -177,15 +180,12 @@ StyleRecalcChange RenderStyle::compare(const RenderStyle* oldStyle, const Render
if (oldStyle->display() != newStyle->display()
|| oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FIRST_LETTER)
|| oldStyle->columnSpan() != newStyle->columnSpan()
- || oldStyle->specifiesAutoColumns() != newStyle->specifiesAutoColumns()
|| !oldStyle->contentDataEquivalent(newStyle)
- || oldStyle->hasTextCombine() != newStyle->hasTextCombine()
- || oldStyle->flowThread() != newStyle->flowThread()
- || oldStyle->regionThread() != newStyle->regionThread())
+ || oldStyle->hasTextCombine() != newStyle->hasTextCombine())
return Reattach;
if (*oldStyle == *newStyle)
- return comparePseudoStyles(oldStyle, newStyle);
+ return diffPseudoStyles(oldStyle, newStyle);
if (oldStyle->inheritedNotEqual(newStyle)
|| oldStyle->hasExplicitlyInheritedProperties()
@@ -233,6 +233,7 @@ void RenderStyle::copyNonInheritedFrom(const RenderStyle* other)
noninherited_flags._page_break_inside = other->noninherited_flags._page_break_inside;
noninherited_flags.explicitInheritance = other->noninherited_flags.explicitInheritance;
noninherited_flags.currentColor = other->noninherited_flags.currentColor;
+ noninherited_flags.hasViewportUnits = other->noninherited_flags.hasViewportUnits;
if (m_svgStyle != other->m_svgStyle)
m_svgStyle.access()->copyNonInheritedFrom(other->m_svgStyle.get());
ASSERT(zoom() == initialZoom());
@@ -336,7 +337,7 @@ bool RenderStyle::inheritedDataShared(const RenderStyle* other) const
&& rareInheritedData.get() == other->rareInheritedData.get();
}
-static bool positionedObjectMoved(const LengthBox& a, const LengthBox& b, const Length& width)
+static bool positionedObjectMovedOnly(const LengthBox& a, const LengthBox& b, const Length& width)
{
// If any unit types are different, then we can't guarantee
// that this was just a movement.
@@ -353,9 +354,11 @@ static bool positionedObjectMoved(const LengthBox& a, const LengthBox& b, const
return false;
if (!a.top().isIntrinsicOrAuto() && !a.bottom().isIntrinsicOrAuto())
return false;
- // If our width is auto and left or right is specified then this
+ // If our width is auto and left or right is specified and changed then this
// is not just a movement - we need to resize to our container.
- if ((!a.left().isIntrinsicOrAuto() || !a.right().isIntrinsicOrAuto()) && width.isIntrinsicOrAuto())
+ if (width.isIntrinsicOrAuto()
+ && ((!a.left().isIntrinsicOrAuto() && a.left() != b.left())
+ || (!a.right().isIntrinsicOrAuto() && a.right() != b.right())))
return false;
// One of the units is fixed or percent in both directions and stayed
@@ -363,328 +366,364 @@ static bool positionedObjectMoved(const LengthBox& a, const LengthBox& b, const
return true;
}
-StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedContextSensitiveProperties) const
+StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other, unsigned& changedContextSensitiveProperties) const
{
- changedContextSensitiveProperties = ContextSensitivePropertyNone;
+ // Note, we use .get() on each DataRef below because DataRef::operator== will do a deep
+ // compare, which is duplicate work when we're going to compare each property inside
+ // this function anyway.
- StyleDifference svgChange = StyleDifferenceEqual;
- if (m_svgStyle != other->m_svgStyle) {
- svgChange = m_svgStyle->diff(other->m_svgStyle.get());
- if (svgChange == StyleDifferenceLayout)
- return svgChange;
+ StyleDifference diff;
+ if (m_svgStyle.get() != other.m_svgStyle.get())
+ diff = m_svgStyle->diff(other.m_svgStyle.get());
+
+ if ((!diff.needsFullLayout() || !diff.needsRepaint()) && diffNeedsFullLayoutAndRepaint(other)) {
+ diff.setNeedsFullLayout();
+ diff.setNeedsRepaintObject();
+ }
+
+ if (!diff.needsFullLayout() && diffNeedsFullLayout(other))
+ diff.setNeedsFullLayout();
+
+ if (!diff.needsFullLayout() && position() != StaticPosition && surround->offset != other.surround->offset) {
+ // Optimize for the case where a positioned layer is moving but not changing size.
+ if ((position() == AbsolutePosition || position() == FixedPosition)
+ && positionedObjectMovedOnly(surround->offset, other.surround->offset, m_box->width())) {
+ diff.setNeedsPositionedMovementLayout();
+ } else {
+ // 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).
+ diff.setNeedsFullLayout();
+ }
+ }
+
+ if (diffNeedsRepaintLayer(other))
+ diff.setNeedsRepaintLayer();
+ else if (diffNeedsRepaintObject(other))
+ diff.setNeedsRepaintObject();
+
+ changedContextSensitiveProperties = computeChangedContextSensitiveProperties(other, diff);
+
+ if (diff.hasNoChange() && diffNeedsRecompositeLayer(other))
+ diff.setNeedsRecompositeLayer();
+
+ // Cursors are not checked, since they will be set appropriately in response to mouse events,
+ // so they don't need to cause any repaint or layout.
+
+ // Animations don't need to be checked either. We always set the new style on the RenderObject, so we will get a chance to fire off
+ // the resulting transition properly.
+
+ return diff;
+}
+
+bool RenderStyle::diffNeedsFullLayoutAndRepaint(const RenderStyle& other) const
+{
+ // FIXME: Not all cases in this method need both full layout and repaint.
+ // Should move cases into diffNeedsFullLayout() if
+ // - don't need repaint at all;
+ // - or the renderer knows how to exactly repaint caused by the layout change
+ // instead of forced full repaint.
+
+ if (m_box.get() != other.m_box.get()) {
+ 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 (m_box->verticalAlign() != other.m_box->verticalAlign())
+ return true;
+
+ if (m_box->boxSizing() != other.m_box->boxSizing())
+ return true;
+ }
+
+ if (surround.get() != other.surround.get()) {
+ if (surround->margin != other.surround->margin)
+ return true;
+
+ if (surround->padding != other.surround->padding)
+ 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())
+ return true;
}
- 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 StyleDifferenceLayout;
-
- if (m_box->verticalAlign() != other->m_box->verticalAlign() || noninherited_flags._vertical_align != other->noninherited_flags._vertical_align)
- return StyleDifferenceLayout;
-
- if (m_box->boxSizing() != other->m_box->boxSizing())
- return StyleDifferenceLayout;
-
- if (surround->margin != other->surround->margin)
- return StyleDifferenceLayout;
-
- if (surround->padding != other->surround->padding)
- return StyleDifferenceLayout;
-
- 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 StyleDifferenceLayout;
-
- if (rareNonInheritedData->m_regionFragment != other->rareNonInheritedData->m_regionFragment)
- return StyleDifferenceLayout;
-
- if (rareNonInheritedData->m_wrapFlow != other->rareNonInheritedData->m_wrapFlow
- || rareNonInheritedData->m_wrapThrough != other->rareNonInheritedData->m_wrapThrough
- || rareNonInheritedData->m_shapeMargin != other->rareNonInheritedData->m_shapeMargin
- || rareNonInheritedData->m_shapePadding != other->rareNonInheritedData->m_shapePadding)
- return StyleDifferenceLayout;
-
- if (rareNonInheritedData->m_deprecatedFlexibleBox.get() != other->rareNonInheritedData->m_deprecatedFlexibleBox.get()
- && *rareNonInheritedData->m_deprecatedFlexibleBox.get() != *other->rareNonInheritedData->m_deprecatedFlexibleBox.get())
- return StyleDifferenceLayout;
-
- if (rareNonInheritedData->m_flexibleBox.get() != other->rareNonInheritedData->m_flexibleBox.get()
- && *rareNonInheritedData->m_flexibleBox.get() != *other->rareNonInheritedData->m_flexibleBox.get())
- return StyleDifferenceLayout;
- 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 StyleDifferenceLayout;
+ 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
+ || rareNonInheritedData->m_wrapFlow != other.rareNonInheritedData->m_wrapFlow
+ || rareNonInheritedData->m_wrapThrough != other.rareNonInheritedData->m_wrapThrough
+ || rareNonInheritedData->m_shapeMargin != other.rareNonInheritedData->m_shapeMargin
+ || 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_grid.get() != other.rareNonInheritedData->m_grid.get()
+ || rareNonInheritedData->m_gridItem.get() != other.rareNonInheritedData->m_gridItem.get()
+ || rareNonInheritedData->m_textCombine != other.rareNonInheritedData->m_textCombine
+ || rareNonInheritedData->hasFilters() != other.rareNonInheritedData->hasFilters())
+ return true;
+
+ 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.get() != other.rareNonInheritedData->m_flexibleBox.get()
+ && *rareNonInheritedData->m_flexibleBox.get() != *other.rareNonInheritedData->m_flexibleBox.get())
+ return true;
// FIXME: We should add an optimized form of layout that just recomputes visual overflow.
- if (!rareNonInheritedData->shadowDataEquivalent(*other->rareNonInheritedData.get()))
- return StyleDifferenceLayout;
+ if (!rareNonInheritedData->shadowDataEquivalent(*other.rareNonInheritedData.get()))
+ return true;
+
+ if (!rareNonInheritedData->reflectionDataEquivalent(*other.rareNonInheritedData.get()))
+ return true;
- if (!rareNonInheritedData->reflectionDataEquivalent(*other->rareNonInheritedData.get()))
- return StyleDifferenceLayout;
+ if (rareNonInheritedData->m_multiCol.get() != other.rareNonInheritedData->m_multiCol.get()
+ && *rareNonInheritedData->m_multiCol.get() != *other.rareNonInheritedData->m_multiCol.get())
+ return true;
- if (rareNonInheritedData->m_multiCol.get() != other->rareNonInheritedData->m_multiCol.get()
- && *rareNonInheritedData->m_multiCol.get() != *other->rareNonInheritedData->m_multiCol.get())
- return StyleDifferenceLayout;
+ // If the counter directives change, trigger a relayout to re-calculate counter values and rebuild the counter node tree.
+ 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 (rareNonInheritedData->m_transform.get() != other->rareNonInheritedData->m_transform.get()
- && *rareNonInheritedData->m_transform.get() != *other->rareNonInheritedData->m_transform.get()) {
- // Don't return early here; instead take note of the type of
- // change, and deal with it when looking at compositing.
- changedContextSensitiveProperties |= ContextSensitivePropertyTransform;
+ // We only need do layout for opacity changes if adding or losing opacity could trigger a change
+ // in us being a stacking context.
+ if (hasAutoZIndex() != other.hasAutoZIndex() && 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).
+ // In addition we need to solve the floating object issue when layers come and go. Right now
+ // a full layout is necessary to keep floating object lists sane.
+ return true;
}
+ }
- if (rareNonInheritedData->m_grid.get() != other->rareNonInheritedData->m_grid.get()
- || rareNonInheritedData->m_gridItem.get() != other->rareNonInheritedData->m_gridItem.get())
- return StyleDifferenceLayout;
+ if (rareInheritedData.get() != other.rareInheritedData.get()) {
+ if (rareInheritedData->highlight != other.rareInheritedData->highlight
+ || rareInheritedData->indent != other.rareInheritedData->indent
+ || rareInheritedData->m_textAlignLast != other.rareInheritedData->m_textAlignLast
+ || rareInheritedData->m_textIndentLine != other.rareInheritedData->m_textIndentLine
+ || rareInheritedData->m_effectiveZoom != other.rareInheritedData->m_effectiveZoom
+ || rareInheritedData->wordBreak != other.rareInheritedData->wordBreak
+ || rareInheritedData->overflowWrap != other.rareInheritedData->overflowWrap
+ || 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_textJustify != other.rareInheritedData->m_textJustify
+ || rareInheritedData->m_textOrientation != other.rareInheritedData->m_textOrientation
+ || rareInheritedData->m_tabSize != other.rareInheritedData->m_tabSize
+ || rareInheritedData->m_lineBoxContain != other.rareInheritedData->m_lineBoxContain
+ || rareInheritedData->listStyleImage != other.rareInheritedData->listStyleImage
+ || rareInheritedData->textStrokeWidth != other.rareInheritedData->textStrokeWidth)
+ return true;
- if (rareNonInheritedData->m_shapeInside != other->rareNonInheritedData->m_shapeInside)
- return StyleDifferenceLayout;
- }
+ if (!rareInheritedData->shadowDataEquivalent(*other.rareInheritedData.get()))
+ return true;
- if (rareInheritedData.get() != other->rareInheritedData.get()) {
- if (rareInheritedData->highlight != other->rareInheritedData->highlight
- || rareInheritedData->indent != other->rareInheritedData->indent
- || rareInheritedData->m_textAlignLast != other->rareInheritedData->m_textAlignLast
- || rareInheritedData->m_textIndentLine != other->rareInheritedData->m_textIndentLine
- || rareInheritedData->m_effectiveZoom != other->rareInheritedData->m_effectiveZoom
- || rareInheritedData->wordBreak != other->rareInheritedData->wordBreak
- || rareInheritedData->overflowWrap != other->rareInheritedData->overflowWrap
- || 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_textAlignLast != other->rareInheritedData->m_textAlignLast
- || rareInheritedData->m_textJustify != other->rareInheritedData->m_textJustify
- || 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->m_lineSnap != other->rareInheritedData->m_lineSnap
- || rareInheritedData->m_lineAlign != other->rareInheritedData->m_lineAlign
- || rareInheritedData->listStyleImage != other->rareInheritedData->listStyleImage)
- return StyleDifferenceLayout;
-
- if (!rareInheritedData->shadowDataEquivalent(*other->rareInheritedData.get()))
- return StyleDifferenceLayout;
-
- if (textStrokeWidth() != other->textStrokeWidth())
- return StyleDifferenceLayout;
+ if (!rareInheritedData->quotesDataEquivalent(*other.rareInheritedData.get()))
+ return true;
}
- if (visual->m_textAutosizingMultiplier != other->visual->m_textAutosizingMultiplier)
- return StyleDifferenceLayout;
+ if (inherited->textAutosizingMultiplier != other.inherited->textAutosizingMultiplier)
+ return true;
- if (inherited->line_height != other->inherited->line_height
- || 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 StyleDifferenceLayout;
+ if (inherited.get() != other.inherited.get()) {
+ if (inherited->line_height != other.inherited->line_height
+ || inherited->font != other.inherited->font
+ || inherited->horizontal_border_spacing != other.inherited->horizontal_border_spacing
+ || inherited->vertical_border_spacing != other.inherited->vertical_border_spacing)
+ return true;
+ }
+ if (inherited_flags._box_direction != other.inherited_flags._box_direction
+ || inherited_flags.m_rtlOrdering != other.inherited_flags.m_rtlOrdering
+ || 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
+ || inherited_flags.m_writingMode != other.inherited_flags.m_writingMode)
+ return true;
- 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 StyleDifferenceLayout;
+ if (noninherited_flags._overflowX != other.noninherited_flags._overflowX
+ || noninherited_flags._overflowY != other.noninherited_flags._overflowY
+ || noninherited_flags._clear != other.noninherited_flags._clear
+ || noninherited_flags._unicodeBidi != other.noninherited_flags._unicodeBidi
+ || noninherited_flags._position != other.noninherited_flags._position
+ || noninherited_flags._floating != other.noninherited_flags._floating
+ || noninherited_flags._originalDisplay != other.noninherited_flags._originalDisplay
+ || noninherited_flags._vertical_align != other.noninherited_flags._vertical_align)
+ return true;
+
+ if (noninherited_flags._effectiveDisplay >= FIRST_TABLE_DISPLAY && noninherited_flags._effectiveDisplay <= LAST_TABLE_DISPLAY) {
+ 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)))
- return StyleDifferenceLayout;
+ && ((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;
+ } else 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 (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 StyleDifferenceLayout;
- }
+ if ((visibility() == COLLAPSE) != (other.visibility() == COLLAPSE))
+ 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)
- return StyleDifferenceLayout;
-
- // Check block flow direction.
- if (inherited_flags.m_writingMode != other->inherited_flags.m_writingMode)
- return StyleDifferenceLayout;
-
- // Check text combine mode.
- if (rareNonInheritedData->m_textCombine != other->rareNonInheritedData->m_textCombine)
- return StyleDifferenceLayout;
-
- // Overflow returns a layout hint.
- if (noninherited_flags._overflowX != other->noninherited_flags._overflowX
- || noninherited_flags._overflowY != other->noninherited_flags._overflowY)
- return StyleDifferenceLayout;
-
- // 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())
- return StyleDifferenceLayout;
-
- // If the counter directives change, trigger a relayout to re-calculate counter values and rebuild the counter node tree.
- const CounterDirectiveMap* mapA = rareNonInheritedData->m_counterDirectives.get();
- const CounterDirectiveMap* mapB = other->rareNonInheritedData->m_counterDirectives.get();
- if (!(mapA == mapB || (mapA && mapB && *mapA == *mapB)))
- return StyleDifferenceLayout;
-
- if ((visibility() == COLLAPSE) != (other->visibility() == COLLAPSE))
- return StyleDifferenceLayout;
-
- 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).
- // In addition we need to solve the floating object issue when layers come and go. Right now
- // a full layout is necessary to keep floating object lists sane.
- return StyleDifferenceLayout;
+ if (!m_background->outline().visuallyEqual(other.m_background->outline())) {
+ // FIXME: We only really need to recompute the overflow but we don't have an optimized layout for it.
+ return true;
}
- if (rareNonInheritedData->hasFilters() != other->rareNonInheritedData->hasFilters())
- return StyleDifferenceLayout;
+ // Movement of non-static-positioned object is special cased in RenderStyle::visualInvalidationDiff().
- if (!QuotesData::equals(rareInheritedData->quotes.get(), other->rareInheritedData->quotes.get()))
- return StyleDifferenceLayout;
+ return false;
+}
+
+bool RenderStyle::diffNeedsFullLayout(const RenderStyle& other) const
+{
+ return false;
+}
- // 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;
+bool RenderStyle::diffNeedsRepaintLayer(const RenderStyle& other) const
+{
+ if (position() != StaticPosition && (visual->clip != other.visual->clip || visual->hasClip != other.visual->hasClip))
+ return true;
- // Make sure these left/top/right/bottom checks stay below all layout checks and above
- // all visible checks.
- if (position() != StaticPosition && surround->offset != other->surround->offset) {
- // Optimize for the case where a positioned layer is moving but not changing size.
- if (position() == AbsolutePosition && positionedObjectMoved(surround->offset, other->surround->offset, m_box->width()) && repaintOnlyDiff(other, changedContextSensitiveProperties) == StyleDifferenceEqual)
- return StyleDifferenceLayoutPositionedMovementOnly;
+ if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) {
+ if (RuntimeEnabledFeatures::cssCompositingEnabled()
+ && (rareNonInheritedData->m_effectiveBlendMode != other.rareNonInheritedData->m_effectiveBlendMode
+ || rareNonInheritedData->m_isolation != other.rareNonInheritedData->m_isolation))
+ return true;
- // 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).
- return StyleDifferenceLayout;
+ if (rareNonInheritedData->m_mask != other.rareNonInheritedData->m_mask
+ || rareNonInheritedData->m_maskBoxImage != other.rareNonInheritedData->m_maskBoxImage)
+ return true;
}
- return repaintOnlyDiff(other, changedContextSensitiveProperties);
+
+ return false;
}
-StyleDifference RenderStyle::repaintOnlyDiff(const RenderStyle* other, unsigned& changedContextSensitiveProperties) const
+bool RenderStyle::diffNeedsRepaintObject(const RenderStyle& other) const
{
- if (position() != StaticPosition && (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 StyleDifferenceRepaintLayer;
-
- if (RuntimeEnabledFeatures::cssCompositingEnabled() && rareNonInheritedData->m_effectiveBlendMode != other->rareNonInheritedData->m_effectiveBlendMode)
- return StyleDifferenceRepaintLayer;
+ 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.visuallyEqual(other.surround->border)
+ || !m_background->visuallyEqual(*other.m_background))
+ return true;
- if (rareNonInheritedData->opacity != other->rareNonInheritedData->opacity) {
- // Don't return early here; instead take note of the type of change,
- // and deal with it when looking at compositing.
- changedContextSensitiveProperties |= ContextSensitivePropertyOpacity;
+ if (rareInheritedData.get() != other.rareInheritedData.get()) {
+ if (rareInheritedData->userModify != other.rareInheritedData->userModify
+ || rareInheritedData->userSelect != other.rareInheritedData->userSelect
+ || rareInheritedData->m_imageRendering != other.rareInheritedData->m_imageRendering)
+ return true;
}
- if (rareNonInheritedData->m_filter.get() != other->rareNonInheritedData->m_filter.get()
- && *rareNonInheritedData->m_filter.get() != *other->rareNonInheritedData->m_filter.get()) {
- // Don't return early here; instead take note of the type of change,
- // and deal with it when looking at compositing.
- changedContextSensitiveProperties |= ContextSensitivePropertyFilter;
+ if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) {
+ if (rareNonInheritedData->userDrag != other.rareNonInheritedData->userDrag
+ || rareNonInheritedData->m_borderFit != other.rareNonInheritedData->m_borderFit
+ || rareNonInheritedData->m_objectFit != other.rareNonInheritedData->m_objectFit
+ || rareNonInheritedData->m_objectPosition != other.rareNonInheritedData->m_objectPosition
+ || rareNonInheritedData->m_shapeOutside != other.rareNonInheritedData->m_shapeOutside
+ || rareNonInheritedData->m_clipPath != other.rareNonInheritedData->m_clipPath)
+ return true;
}
- if (rareNonInheritedData->m_mask != other->rareNonInheritedData->m_mask
- || rareNonInheritedData->m_maskBoxImage != other->rareNonInheritedData->m_maskBoxImage)
- return StyleDifferenceRepaintLayer;
-
- 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.get() != *other->m_background.get()
- || 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
- || rareNonInheritedData->m_objectPosition != other->rareNonInheritedData->m_objectPosition
- || rareInheritedData->m_imageRendering != other->rareInheritedData->m_imageRendering)
- return StyleDifferenceRepaint;
-
- // 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 StyleDifferenceRepaint;
-
- if (rareNonInheritedData->m_clipPath != other->rareNonInheritedData->m_clipPath)
- return StyleDifferenceRepaint;
-
- 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 StyleDifferenceRecompositeLayer;
+ return false;
+}
+
+bool RenderStyle::diffNeedsRecompositeLayer(const RenderStyle& other) 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
+ || hasWillChangeCompositingHint() != other.hasWillChangeCompositingHint())
+ return true;
}
- 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->textFillColor != other->rareInheritedData->textFillColor
- || rareInheritedData->textStrokeColor != other->rareInheritedData->textStrokeColor
- || rareInheritedData->textEmphasisColor != other->rareInheritedData->textEmphasisColor
- || rareInheritedData->textEmphasisFill != other->rareInheritedData->textEmphasisFill)
- return StyleDifferenceRepaintIfTextOrColorChange;
+ return false;
+}
- // Cursors are not checked, since they will be set appropriately in response to mouse events,
- // so they don't need to cause any repaint or layout.
+unsigned RenderStyle::computeChangedContextSensitiveProperties(const RenderStyle& other, StyleDifference diff) const
+{
+ unsigned changedContextSensitiveProperties = ContextSensitivePropertyNone;
- // Animations don't need to be checked either. We always set the new style on the RenderObject, so we will get a chance to fire off
- // the resulting transition properly.
- return StyleDifferenceEqual;
+ // StyleAdjuster 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())
+ changedContextSensitiveProperties |= ContextSensitivePropertyZIndex;
+
+ if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) {
+ if (!transformDataEquivalent(other))
+ changedContextSensitiveProperties |= ContextSensitivePropertyTransform;
+
+ if (rareNonInheritedData->opacity != other.rareNonInheritedData->opacity)
+ changedContextSensitiveProperties |= ContextSensitivePropertyOpacity;
+
+ if (rareNonInheritedData->m_filter != other.rareNonInheritedData->m_filter)
+ changedContextSensitiveProperties |= ContextSensitivePropertyFilter;
+ }
+
+ if (!diff.needsRepaint()) {
+ if (inherited->color != other.inherited->color
+ || inherited_flags.m_textUnderline != other.inherited_flags.m_textUnderline
+ || visual->textDecoration != other.visual->textDecoration) {
+ changedContextSensitiveProperties |= ContextSensitivePropertyTextOrColor;
+ } else if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) {
+ if (rareNonInheritedData->m_textDecorationStyle != other.rareNonInheritedData->m_textDecorationStyle
+ || rareNonInheritedData->m_textDecorationColor != other.rareNonInheritedData->m_textDecorationColor)
+ changedContextSensitiveProperties |= ContextSensitivePropertyTextOrColor;
+ } else if (rareInheritedData.get() != other.rareInheritedData.get()) {
+ if (rareInheritedData->textFillColor() != other.rareInheritedData->textFillColor()
+ || rareInheritedData->textStrokeColor() != other.rareInheritedData->textStrokeColor()
+ || rareInheritedData->textEmphasisColor() != other.rareInheritedData->textEmphasisColor()
+ || rareInheritedData->textEmphasisFill != other.rareInheritedData->textEmphasisFill
+ || rareInheritedData->appliedTextDecorations != other.rareInheritedData->appliedTextDecorations)
+ changedContextSensitiveProperties |= ContextSensitivePropertyTextOrColor;
+ }
+ }
+
+ return changedContextSensitiveProperties;
}
-void RenderStyle::setClip(Length top, Length right, Length bottom, Length left)
+void RenderStyle::setClip(const Length& top, const Length& right, const Length& bottom, const Length& left)
{
StyleVisualData* data = visual.access();
data->clip.m_top = top;
@@ -707,15 +746,13 @@ void RenderStyle::setCursorList(PassRefPtr<CursorList> other)
void RenderStyle::setQuotes(PassRefPtr<QuotesData> q)
{
- if (QuotesData::equals(rareInheritedData->quotes.get(), q.get()))
- return;
rareInheritedData.access()->quotes = q;
}
void RenderStyle::clearCursorList()
{
if (rareInheritedData->cursorData)
- rareInheritedData.access()->cursorData = 0;
+ rareInheritedData.access()->cursorData = nullptr;
}
void RenderStyle::addCallbackSelector(const String& selector)
@@ -842,6 +879,25 @@ bool RenderStyle::hasIsolation() const
return false;
}
+bool RenderStyle::hasWillChangeCompositingHint() const
+{
+ for (size_t i = 0; i < rareNonInheritedData->m_willChange->m_properties.size(); ++i) {
+ switch (rareNonInheritedData->m_willChange->m_properties[i]) {
+ case CSSPropertyOpacity:
+ case CSSPropertyTransform:
+ case CSSPropertyWebkitTransform:
+ case CSSPropertyTop:
+ case CSSPropertyLeft:
+ case CSSPropertyBottom:
+ case CSSPropertyRight:
+ return true;
+ default:
+ break;
+ }
+ }
+ return false;
+}
+
inline bool requireTransformOrigin(const Vector<RefPtr<TransformOperation> >& transformOperations, RenderStyle::ApplyTransformOrigin applyOrigin)
{
// transform-origin brackets the transform with translate operations.
@@ -878,8 +934,8 @@ void RenderStyle::applyTransform(TransformationMatrix& transform, const FloatRec
float offsetY = transformOriginY().type() == Percent ? boundingBox.y() : 0;
if (applyTransformOrigin) {
- transform.translate3d(floatValueForLength(transformOriginX(), boundingBox.width(), 0) + offsetX,
- floatValueForLength(transformOriginY(), boundingBox.height(), 0) + offsetY,
+ transform.translate3d(floatValueForLength(transformOriginX(), boundingBox.width()) + offsetX,
+ floatValueForLength(transformOriginY(), boundingBox.height()) + offsetY,
transformOriginZ());
}
@@ -888,8 +944,8 @@ void RenderStyle::applyTransform(TransformationMatrix& transform, const FloatRec
transformOperations[i]->apply(transform, boundingBox.size());
if (applyTransformOrigin) {
- transform.translate3d(-floatValueForLength(transformOriginX(), boundingBox.width(), 0) - offsetX,
- -floatValueForLength(transformOriginY(), boundingBox.height(), 0) - offsetY,
+ transform.translate3d(-floatValueForLength(transformOriginX(), boundingBox.width()) - offsetX,
+ -floatValueForLength(transformOriginY(), boundingBox.height()) - offsetY,
-transformOriginZ());
}
}
@@ -904,49 +960,17 @@ void RenderStyle::setBoxShadow(PassRefPtr<ShadowList> s)
rareNonInheritedData.access()->m_boxShadow = s;
}
-static RoundedRect::Radii calcRadiiFor(const BorderData& border, IntSize size, RenderView* renderView)
+static RoundedRect::Radii calcRadiiFor(const BorderData& border, IntSize size)
{
return RoundedRect::Radii(
- 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 = 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 = 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 = 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 = min(static_cast<float>(rect.height()) / radiiSum, factor);
-
- ASSERT(factor <= 1);
- return factor;
+ IntSize(valueForLength(border.topLeft().width(), size.width()),
+ valueForLength(border.topLeft().height(), size.height())),
+ IntSize(valueForLength(border.topRight().width(), size.width()),
+ valueForLength(border.topRight().height(), size.height())),
+ IntSize(valueForLength(border.bottomLeft().width(), size.width()),
+ valueForLength(border.bottomLeft().height(), size.height())),
+ IntSize(valueForLength(border.bottomRight().width(), size.width()),
+ valueForLength(border.bottomRight().height(), size.height())));
}
StyleImage* RenderStyle::listStyleImage() const { return rareInheritedData->listStyleImage.get(); }
@@ -966,13 +990,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, RenderView* renderView, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
+RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
{
IntRect snappedBorderRect(pixelSnappedIntRect(borderRect));
RoundedRect roundedRect(snappedBorderRect);
if (hasBorderRadius()) {
- RoundedRect::Radii radii = calcRadiiFor(surround->border, snappedBorderRect.size(), renderView);
- radii.scale(calcConstraintScaleFor(snappedBorderRect, radii));
+ RoundedRect::Radii radii = calcRadiiFor(surround->border, snappedBorderRect.size());
+ radii.scale(calcBorderRadiiConstraintScaleFor(borderRect, radii));
roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includeLogicalLeftEdge, includeLogicalRightEdge);
}
return roundedRect;
@@ -1096,111 +1120,67 @@ const AtomicString& RenderStyle::textEmphasisMarkString() const
return nullAtom;
}
-void RenderStyle::adjustAnimations()
+CSSAnimationData& RenderStyle::accessAnimations()
{
- CSSAnimationDataList* animationList = rareNonInheritedData->m_animations.get();
- if (!animationList)
- return;
-
- // Get rid of empty animations and anything beyond them
- for (size_t i = 0; i < animationList->size(); ++i) {
- if (animationList->animation(i)->isEmpty()) {
- animationList->resize(i);
- break;
- }
- }
-
- if (animationList->isEmpty()) {
- clearAnimations();
- return;
- }
-
- // Repeat patterns into layers that don't have some properties set.
- animationList->fillUnsetProperties();
+ if (!rareNonInheritedData.access()->m_animations)
+ rareNonInheritedData.access()->m_animations = CSSAnimationData::create();
+ return *rareNonInheritedData->m_animations;
}
-void RenderStyle::adjustTransitions()
+CSSTransitionData& RenderStyle::accessTransitions()
{
- CSSAnimationDataList* transitionList = rareNonInheritedData->m_transitions.get();
- if (!transitionList)
- return;
+ if (!rareNonInheritedData.access()->m_transitions)
+ rareNonInheritedData.access()->m_transitions = CSSTransitionData::create();
+ return *rareNonInheritedData->m_transitions;
+}
- // Get rid of empty transitions and anything beyond them
- for (size_t i = 0; i < transitionList->size(); ++i) {
- if (transitionList->animation(i)->isEmpty()) {
- transitionList->resize(i);
- break;
- }
- }
+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 fontDescription().computedPixelSize(); }
+FontWeight RenderStyle::fontWeight() const { return fontDescription().weight(); }
- if (transitionList->isEmpty()) {
- clearTransitions();
- return;
- }
+TextDecoration RenderStyle::textDecorationsInEffect() const
+{
+ int decorations = 0;
- // Repeat patterns into layers that don't have some properties set.
- transitionList->fillUnsetProperties();
-
- // Make sure there are no duplicate properties. This is an O(n^2) algorithm
- // but the lists tend to be very short, so it is probably ok
- for (size_t i = 0; i < transitionList->size(); ++i) {
- for (size_t j = i+1; j < transitionList->size(); ++j) {
- if (transitionList->animation(i)->property() == transitionList->animation(j)->property()) {
- // toss i
- transitionList->remove(i);
- j = i;
- }
- }
- }
-}
+ const Vector<AppliedTextDecoration>& applied = appliedTextDecorations();
-CSSAnimationDataList* RenderStyle::accessAnimations()
-{
- if (!rareNonInheritedData.access()->m_animations)
- rareNonInheritedData.access()->m_animations = adoptPtr(new CSSAnimationDataList());
- return rareNonInheritedData->m_animations.get();
-}
+ for (size_t i = 0; i < applied.size(); ++i)
+ decorations |= applied[i].line();
-CSSAnimationDataList* RenderStyle::accessTransitions()
-{
- if (!rareNonInheritedData.access()->m_transitions)
- rareNonInheritedData.access()->m_transitions = adoptPtr(new CSSAnimationDataList());
- return rareNonInheritedData->m_transitions.get();
+ return static_cast<TextDecoration>(decorations);
}
-const CSSAnimationData* RenderStyle::transitionForProperty(CSSPropertyID property) const
+const Vector<AppliedTextDecoration>& RenderStyle::appliedTextDecorations() const
{
- if (transitions()) {
- for (size_t i = 0; i < transitions()->size(); ++i) {
- const CSSAnimationData* p = transitions()->animation(i);
- if (p->animationMode() == CSSAnimationData::AnimateAll || p->property() == property) {
- return p;
- }
- }
+ if (!inherited_flags.m_textUnderline && !rareInheritedData->appliedTextDecorations) {
+ DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, empty, ());
+ return empty;
+ }
+ if (inherited_flags.m_textUnderline) {
+ DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, underline, (1, AppliedTextDecoration(TextDecorationUnderline)));
+ return underline;
}
- return 0;
-}
-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->font.pixelSize(); }
+ return rareInheritedData->appliedTextDecorations->vector();
+}
-float RenderStyle::wordSpacing() const { return inherited->font.wordSpacing(); }
-float RenderStyle::letterSpacing() const { return inherited->font.letterSpacing(); }
+float RenderStyle::wordSpacing() const { return fontDescription().wordSpacing(); }
+float RenderStyle::letterSpacing() const { return fontDescription().letterSpacing(); }
bool RenderStyle::setFontDescription(const FontDescription& v)
{
if (inherited->font.fontDescription() != v) {
- inherited.access()->font = Font(v, inherited->font.letterSpacing(), inherited->font.wordSpacing());
+ inherited.access()->font = Font(v);
return true;
}
return false;
}
-Length RenderStyle::specifiedLineHeight() const { return inherited->line_height; }
+const Length& RenderStyle::specifiedLineHeight() const { return inherited->line_height; }
Length RenderStyle::lineHeight() const
{
const Length& lh = inherited->line_height;
@@ -1214,9 +1194,10 @@ Length RenderStyle::lineHeight() const
return lh;
}
-void RenderStyle::setLineHeight(Length specifiedLineHeight) { SET_VAR(inherited, line_height, specifiedLineHeight); }
-int RenderStyle::computedLineHeight(RenderView* renderView) const
+void RenderStyle::setLineHeight(const Length& specifiedLineHeight) { SET_VAR(inherited, line_height, specifiedLineHeight); }
+
+int RenderStyle::computedLineHeight() const
{
const Length& lh = lineHeight();
@@ -1227,14 +1208,26 @@ int RenderStyle::computedLineHeight(RenderView* renderView) const
if (lh.isPercent())
return minimumValueForLength(lh, fontSize());
- if (lh.isViewportPercentage())
- return valueForLength(lh, 0, renderView);
-
return lh.value();
}
-void RenderStyle::setWordSpacing(float v) { inherited.access()->font.setWordSpacing(v); }
-void RenderStyle::setLetterSpacing(float v) { inherited.access()->font.setLetterSpacing(v); }
+void RenderStyle::setWordSpacing(float wordSpacing)
+{
+ FontSelector* currentFontSelector = font().fontSelector();
+ FontDescription desc(fontDescription());
+ desc.setWordSpacing(wordSpacing);
+ setFontDescription(desc);
+ font().update(currentFontSelector);
+}
+
+void RenderStyle::setLetterSpacing(float letterSpacing)
+{
+ FontSelector* currentFontSelector = font().fontSelector();
+ FontDescription desc(fontDescription());
+ desc.setLetterSpacing(letterSpacing);
+ setFontDescription(desc);
+ font().update(currentFontSelector);
+}
void RenderStyle::setFontSize(float size)
{
@@ -1262,6 +1255,66 @@ void RenderStyle::setFontSize(float size)
font().update(currentFontSelector);
}
+void RenderStyle::setFontWeight(FontWeight weight)
+{
+ FontSelector* currentFontSelector = font().fontSelector();
+ FontDescription desc(fontDescription());
+ desc.setWeight(weight);
+ setFontDescription(desc);
+ font().update(currentFontSelector);
+}
+
+void RenderStyle::addAppliedTextDecoration(const AppliedTextDecoration& decoration)
+{
+ RefPtr<AppliedTextDecorationList>& list = rareInheritedData.access()->appliedTextDecorations;
+
+ if (!list)
+ list = AppliedTextDecorationList::create();
+ else if (!list->hasOneRef())
+ list = list->copy();
+
+ if (inherited_flags.m_textUnderline) {
+ inherited_flags.m_textUnderline = false;
+ list->append(AppliedTextDecoration(TextDecorationUnderline));
+ }
+
+ list->append(decoration);
+}
+
+void RenderStyle::applyTextDecorations()
+{
+ if (textDecoration() == TextDecorationNone)
+ return;
+
+ TextDecorationStyle style = textDecorationStyle();
+ StyleColor styleColor = visitedDependentDecorationStyleColor();
+
+ int decorations = textDecoration();
+
+ if (decorations & TextDecorationUnderline) {
+ // To save memory, we don't use AppliedTextDecoration objects in the
+ // common case of a single simple underline.
+ AppliedTextDecoration underline(TextDecorationUnderline, style, styleColor);
+
+ if (!rareInheritedData->appliedTextDecorations && underline.isSimpleUnderline())
+ inherited_flags.m_textUnderline = true;
+ else
+ addAppliedTextDecoration(underline);
+ }
+ if (decorations & TextDecorationOverline)
+ addAppliedTextDecoration(AppliedTextDecoration(TextDecorationOverline, style, styleColor));
+ if (decorations & TextDecorationLineThrough)
+ addAppliedTextDecoration(AppliedTextDecoration(TextDecorationLineThrough, style, styleColor));
+}
+
+void RenderStyle::clearAppliedTextDecorations()
+{
+ inherited_flags.m_textUnderline = false;
+
+ if (rareInheritedData->appliedTextDecorations)
+ rareInheritedData.access()->appliedTextDecorations = nullptr;
+}
+
void RenderStyle::getShadowExtent(const ShadowList* shadowList, LayoutUnit &top, LayoutUnit &right, LayoutUnit &bottom, LayoutUnit &left) const
{
top = 0;
@@ -1274,7 +1327,7 @@ void RenderStyle::getShadowExtent(const ShadowList* shadowList, LayoutUnit &top,
const ShadowData& shadow = shadowList->shadows()[i];
if (shadow.style() == Inset)
continue;
- int blurAndSpread = shadow.blur() + shadow.spread();
+ float blurAndSpread = shadow.blur() + shadow.spread();
top = min<LayoutUnit>(top, shadow.y() - blurAndSpread);
right = max<LayoutUnit>(right, shadow.x() + blurAndSpread);
@@ -1295,7 +1348,7 @@ LayoutBoxExtent RenderStyle::getShadowInsetExtent(const ShadowList* shadowList)
const ShadowData& shadow = shadowList->shadows()[i];
if (shadow.style() == Normal)
continue;
- int blurAndSpread = shadow.blur() + shadow.spread();
+ float blurAndSpread = shadow.blur() + shadow.spread();
top = max<LayoutUnit>(top, shadow.y() + blurAndSpread);
right = min<LayoutUnit>(right, shadow.x() - blurAndSpread);
bottom = min<LayoutUnit>(bottom, shadow.y() - blurAndSpread);
@@ -1315,7 +1368,7 @@ void RenderStyle::getShadowHorizontalExtent(const ShadowList* shadowList, Layout
const ShadowData& shadow = shadowList->shadows()[i];
if (shadow.style() == Inset)
continue;
- int blurAndSpread = shadow.blur() + shadow.spread();
+ float blurAndSpread = shadow.blur() + shadow.spread();
left = min<LayoutUnit>(left, shadow.x() - blurAndSpread);
right = max<LayoutUnit>(right, shadow.x() + blurAndSpread);
@@ -1332,20 +1385,46 @@ void RenderStyle::getShadowVerticalExtent(const ShadowList* shadowList, LayoutUn
const ShadowData& shadow = shadowList->shadows()[i];
if (shadow.style() == Inset)
continue;
- int blurAndSpread = shadow.blur() + shadow.spread();
+ float blurAndSpread = shadow.blur() + shadow.spread();
top = min<LayoutUnit>(top, shadow.y() - blurAndSpread);
bottom = max<LayoutUnit>(bottom, shadow.y() + blurAndSpread);
}
}
+StyleColor RenderStyle::visitedDependentDecorationStyleColor() const
+{
+ bool isVisited = insideLink() == InsideVisitedLink;
+
+ StyleColor styleColor = isVisited ? visitedLinkTextDecorationColor() : textDecorationColor();
+
+ if (!styleColor.isCurrentColor())
+ return styleColor;
+
+ if (textStrokeWidth()) {
+ // Prefer stroke color if possible, but not if it's fully transparent.
+ StyleColor textStrokeStyleColor = isVisited ? visitedLinkTextStrokeColor() : textStrokeColor();
+ if (!textStrokeStyleColor.isCurrentColor() && textStrokeStyleColor.color().alpha())
+ return textStrokeStyleColor;
+ }
+
+ return isVisited ? visitedLinkTextFillColor() : textFillColor();
+}
+
+Color RenderStyle::visitedDependentDecorationColor() const
+{
+ bool isVisited = insideLink() == InsideVisitedLink;
+ return visitedDependentDecorationStyleColor().resolve(isVisited ? visitedLinkColor() : color());
+}
+
Color RenderStyle::colorIncludingFallback(int colorProperty, bool visitedLink) const
{
- Color result;
+ StyleColor result(StyleColor::currentColor());
EBorderStyle borderStyle = BNONE;
switch (colorProperty) {
case CSSPropertyBackgroundColor:
- return visitedLink ? visitedLinkBackgroundColor() : backgroundColor(); // Background color doesn't fall back.
+ result = visitedLink ? visitedLinkBackgroundColor() : backgroundColor();
+ break;
case CSSPropertyBorderLeftColor:
result = visitedLink ? visitedLinkBorderLeftColor() : borderLeftColor();
borderStyle = borderLeftStyle();
@@ -1371,9 +1450,6 @@ Color RenderStyle::colorIncludingFallback(int colorProperty, bool visitedLink) c
case CSSPropertyWebkitColumnRuleColor:
result = visitedLink ? visitedLinkColumnRuleColor() : columnRuleColor();
break;
- case CSSPropertyTextDecorationColor:
- // Text decoration color fallback is handled in RenderObject::decorationColor.
- return visitedLink ? visitedLinkTextDecorationColor() : textDecorationColor();
case CSSPropertyWebkitTextEmphasisColor:
result = visitedLink ? visitedLinkTextEmphasisColor() : textEmphasisColor();
break;
@@ -1400,13 +1476,14 @@ Color RenderStyle::colorIncludingFallback(int colorProperty, bool visitedLink) c
break;
}
- if (!result.isValid()) {
- if (!visitedLink && (borderStyle == INSET || borderStyle == OUTSET || borderStyle == RIDGE || borderStyle == GROOVE))
- result.setRGB(238, 238, 238);
- else
- result = visitedLink ? visitedLinkColor() : color();
- }
- return result;
+ if (!result.isCurrentColor())
+ return result.color();
+
+ // FIXME: Treating styled borders with initial color differently causes problems
+ // See crbug.com/316559, crbug.com/276231
+ if (!visitedLink && (borderStyle == INSET || borderStyle == OUTSET || borderStyle == RIDGE || borderStyle == GROOVE))
+ return Color(238, 238, 238);
+ return visitedLink ? visitedLinkColor() : color();
}
Color RenderStyle::visitedDependentColor(int colorProperty) const
@@ -1417,10 +1494,6 @@ Color RenderStyle::visitedDependentColor(int colorProperty) const
Color visitedColor = colorIncludingFallback(colorProperty, true);
- // Text decoration color validity is preserved (checked in RenderObject::decorationColor).
- if (colorProperty == CSSPropertyTextDecorationColor)
- return visitedColor;
-
// FIXME: Technically someone could explicitly specify the color transparent, but for now we'll just
// assume that if the background color is transparent that it wasn't set. Note that it's weird that
// we're returning unvisited info for a visited link, but given our restriction that the alpha values
@@ -1525,7 +1598,7 @@ unsigned short RenderStyle::borderEndWidth() const
return isLeftToRightDirection() ? borderBottomWidth() : borderTopWidth();
}
-void RenderStyle::setMarginStart(Length margin)
+void RenderStyle::setMarginStart(const Length& margin)
{
if (isHorizontalWritingMode()) {
if (isLeftToRightDirection())
@@ -1540,7 +1613,7 @@ void RenderStyle::setMarginStart(Length margin)
}
}
-void RenderStyle::setMarginEnd(Length margin)
+void RenderStyle::setMarginEnd(const Length& margin)
{
if (isHorizontalWritingMode()) {
if (isLeftToRightDirection())
@@ -1587,7 +1660,7 @@ void RenderStyle::setBorderImageSource(PassRefPtr<StyleImage> image)
surround.access()->border.m_image.setImage(image);
}
-void RenderStyle::setBorderImageSlices(LengthBox slices)
+void RenderStyle::setBorderImageSlices(const LengthBox& slices)
{
if (surround->border.m_image.imageSlices() == slices)
return;
@@ -1608,4 +1681,36 @@ void RenderStyle::setBorderImageOutset(const BorderImageLengthBox& outset)
surround.access()->border.m_image.setOutset(outset);
}
+float calcBorderRadiiConstraintScaleFor(const FloatRect& rect, const FloatRoundedRect::Radii& radii)
+{
+ // Constrain corner radii using CSS3 rules:
+ // http://www.w3.org/TR/css3-background/#the-border-radius
+
+ float factor = 1;
+ float radiiSum;
+
+ // top
+ radiiSum = radii.topLeft().width() + radii.topRight().width(); // Casts to avoid integer overflow.
+ if (radiiSum > rect.width())
+ factor = std::min(rect.width() / radiiSum, factor);
+
+ // bottom
+ radiiSum = radii.bottomLeft().width() + radii.bottomRight().width();
+ if (radiiSum > rect.width())
+ factor = std::min(rect.width() / radiiSum, factor);
+
+ // left
+ radiiSum = radii.topLeft().height() + radii.bottomLeft().height();
+ if (radiiSum > rect.height())
+ factor = std::min(rect.height() / radiiSum, factor);
+
+ // right
+ radiiSum = radii.topRight().height() + radii.bottomRight().height();
+ if (radiiSum > rect.height())
+ factor = std::min(rect.height() / radiiSum, factor);
+
+ ASSERT(factor <= 1);
+ return factor;
+}
+
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/RenderStyle.h b/chromium/third_party/WebKit/Source/core/rendering/style/RenderStyle.h
index f405b951fbe..543c815d06d 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/RenderStyle.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/RenderStyle.h
@@ -25,11 +25,11 @@
#ifndef RenderStyle_h
#define RenderStyle_h
-#include "CSSPropertyNames.h"
-#include "core/css/CSSLengthFunctions.h"
+#include "core/CSSPropertyNames.h"
+#include "core/animation/css/CSSAnimationData.h"
+#include "core/animation/css/CSSTransitionData.h"
#include "core/css/CSSLineBoxContainValue.h"
#include "core/css/CSSPrimitiveValue.h"
-#include "core/platform/animation/CSSAnimationDataList.h"
#include "core/rendering/style/BorderValue.h"
#include "core/rendering/style/CounterDirectives.h"
#include "core/rendering/style/DataRef.h"
@@ -42,10 +42,12 @@
#include "core/rendering/style/StyleBackgroundData.h"
#include "core/rendering/style/StyleBoxData.h"
#include "core/rendering/style/StyleDeprecatedFlexibleBoxData.h"
+#include "core/rendering/style/StyleDifference.h"
#include "core/rendering/style/StyleFilterData.h"
#include "core/rendering/style/StyleFlexibleBoxData.h"
#include "core/rendering/style/StyleGridData.h"
#include "core/rendering/style/StyleGridItemData.h"
+#include "core/rendering/style/StyleInheritedData.h"
#include "core/rendering/style/StyleMarqueeData.h"
#include "core/rendering/style/StyleMultiColData.h"
#include "core/rendering/style/StyleRareInheritedData.h"
@@ -54,6 +56,7 @@
#include "core/rendering/style/StyleSurroundData.h"
#include "core/rendering/style/StyleTransformData.h"
#include "core/rendering/style/StyleVisualData.h"
+#include "core/rendering/style/StyleWillChangeData.h"
#include "core/svg/SVGPaint.h"
#include "platform/Length.h"
#include "platform/LengthBox.h"
@@ -61,10 +64,12 @@
#include "platform/ThemeTypes.h"
#include "platform/fonts/FontBaseline.h"
#include "platform/fonts/FontDescription.h"
+#include "platform/geometry/FloatRoundedRect.h"
#include "platform/geometry/LayoutBoxExtent.h"
#include "platform/geometry/RoundedRect.h"
#include "platform/graphics/Color.h"
#include "platform/graphics/GraphicsTypes.h"
+#include "platform/scroll/ScrollableArea.h"
#include "platform/text/TextDirection.h"
#include "platform/text/UnicodeBidi.h"
#include "platform/transforms/TransformOperations.h"
@@ -80,6 +85,10 @@ template<typename T, typename U> inline bool compareEqual(const T& t, const U& u
if (!compareEqual(group->variable, value)) \
group.access()->variable = value
+#define SET_VAR_WITH_SETTER(group, getter, setter, value) \
+ if (!compareEqual(group->getter(), value)) \
+ group.access()->setter(value)
+
#define SET_BORDERVALUE_COLOR(group, variable, value) \
if (!compareEqual(group->variable.color(), value)) \
group.access()->variable.setColor(value)
@@ -90,13 +99,11 @@ using std::max;
class FilterOperations;
+class AppliedTextDecoration;
class BorderData;
class CounterContent;
-class CursorList;
class Font;
class FontMetrics;
-class IntRect;
-class Pair;
class ShadowList;
class StyleImage;
class StyleInheritedData;
@@ -110,11 +117,11 @@ typedef Vector<RefPtr<RenderStyle>, 4> PseudoStyleCache;
class RenderStyle: public RefCounted<RenderStyle> {
friend class AnimatedStyleBuilder; // Used by Web Animations CSS. Sets the color styles
friend class CSSAnimatableValueFactory; // Used by Web Animations CSS. Gets visited and unvisited colors separately.
- friend class CSSPropertyAnimation; // Used by CSS animations. We can't allow them to animate based off visited colors.
+ friend class CSSPropertyEquality; // 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 EditingStyle; // Editing has to only reveal unvisited info.
friend class CSSComputedStyleDeclaration; // 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 PropertyWrapperMaybeInvalidStyleColor; // Used by CSS animations. We can't allow them to animate based off visited colors.
friend class StyleBuilderFunctions; // Sets color styles
friend class CachedUAStyle; // Saves Border/Background information for later comparison.
@@ -156,7 +163,7 @@ protected:
&& (_visibility == other._visibility)
&& (_text_align == other._text_align)
&& (_text_transform == other._text_transform)
- && (_text_decorations == other._text_decorations)
+ && (m_textUnderline == other.m_textUnderline)
&& (_cursor_style == other._cursor_style)
&& (_direction == other._direction)
&& (_white_space == other._white_space)
@@ -178,24 +185,23 @@ protected:
unsigned _visibility : 2; // EVisibility
unsigned _text_align : 4; // ETextAlign
unsigned _text_transform : 2; // ETextTransform
- unsigned _text_decorations : TextDecorationBits;
+ unsigned m_textUnderline : 1;
unsigned _cursor_style : 6; // ECursor
unsigned _direction : 1; // TextDirection
unsigned _white_space : 3; // EWhiteSpace
- // 32 bits
unsigned _border_collapse : 1; // EBorderCollapse
unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module)
+ // 32 bits
// non CSS2 inherited
unsigned m_rtlOrdering : 1; // Order
unsigned m_printColorAdjust : PrintColorAdjustBits;
unsigned _pointerEvents : 4; // EPointerEvents
unsigned _insideLink : 2; // EInsideLink
- // 43 bits
// CSS Text Layout Module Level 3: Vertical writing support
unsigned m_writingMode : 2; // WritingMode
- // 45 bits
+ // 42 bits
} inherited_flags;
// don't inherit
@@ -243,7 +249,13 @@ protected:
unsigned _table_layout : 1; // ETableLayout
unsigned _unicodeBidi : 3; // EUnicodeBidi
- // 31 bits
+
+ // This is set if we used viewport units when resolving a length.
+ // It is mutable so we can pass around const RenderStyles to resolve lengths.
+ mutable unsigned hasViewportUnits : 1;
+
+ // 32 bits
+
unsigned _page_break_before : 2; // EPageBreak
unsigned _page_break_after : 2; // EPageBreak
unsigned _page_break_inside : 2; // EPageBreak
@@ -274,7 +286,7 @@ protected:
unsigned _affectedByDrag : 1;
unsigned _isLink : 1;
// If you add more style bits here, you will also need to update RenderStyle::copyNonInheritedFrom()
- // 60 bits
+ // 63 bits
} noninherited_flags;
// !END SYNC!
@@ -289,7 +301,7 @@ protected:
inherited_flags._visibility = initialVisibility();
inherited_flags._text_align = initialTextAlign();
inherited_flags._text_transform = initialTextTransform();
- inherited_flags._text_decorations = initialTextDecoration();
+ inherited_flags.m_textUnderline = false;
inherited_flags._cursor_style = initialCursor();
inherited_flags._direction = initialDirection();
inherited_flags._white_space = initialWhiteSpace();
@@ -321,6 +333,7 @@ protected:
noninherited_flags.emptyState = false;
noninherited_flags.firstChildState = false;
noninherited_flags.lastChildState = false;
+ noninherited_flags.hasViewportUnits = false;
noninherited_flags.setAffectedByFocus(false);
noninherited_flags.setAffectedByHover(false);
noninherited_flags.setAffectedByActive(false);
@@ -343,7 +356,11 @@ public:
static PassRefPtr<RenderStyle> createAnonymousStyleWithDisplay(const RenderStyle* parentStyle, EDisplay);
static PassRefPtr<RenderStyle> clone(const RenderStyle*);
- static StyleRecalcChange compare(const RenderStyle* oldStyle, const RenderStyle* newStyle);
+ // Computes how the style change should be propagated down the tree.
+ static StyleRecalcChange stylePropagationDiff(const RenderStyle* oldStyle, const RenderStyle* newStyle);
+
+ // Computes how much visual invalidation the style change causes: layout, repaint or recomposite.
+ StyleDifference visualInvalidationDiff(const RenderStyle&, unsigned& changedContextSensitiveProperties) const;
enum IsAtShadowBoundary {
AtShadowBoundary,
@@ -362,8 +379,8 @@ public:
const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoStyles.get(); }
- void setVariable(const AtomicString& name, const String& value) { rareInheritedData.access()->m_variables.access()->setVariable(name, value); }
- const HashMap<AtomicString, String>* variables() { return &(rareInheritedData->m_variables->m_data); }
+ void setHasViewportUnits(bool hasViewportUnits = true) const { noninherited_flags.hasViewportUnits = hasViewportUnits; }
+ bool hasViewportUnits() const { return noninherited_flags.hasViewportUnits; }
bool affectedByFocus() const { return noninherited_flags.affectedByFocus(); }
bool affectedByHover() const { return noninherited_flags.affectedByHover(); }
@@ -395,7 +412,7 @@ public:
bool hasBackground() const
{
Color color = visitedDependentColor(CSSPropertyBackgroundColor);
- if (color.isValid() && color.alpha())
+ if (color.alpha())
return true;
return hasBackgroundImage();
}
@@ -427,22 +444,23 @@ public:
bool hasPseudoStyle(PseudoId pseudo) const;
void setHasPseudoStyle(PseudoId pseudo);
bool hasUniquePseudoStyle() const;
+ bool hasPseudoElementStyle() const;
// attribute getter methods
EDisplay display() const { return static_cast<EDisplay>(noninherited_flags._effectiveDisplay); }
EDisplay originalDisplay() const { return static_cast<EDisplay>(noninherited_flags._originalDisplay); }
- Length left() const { return surround->offset.left(); }
- Length right() const { return surround->offset.right(); }
- Length top() const { return surround->offset.top(); }
- Length bottom() const { return surround->offset.bottom(); }
+ const Length& left() const { return surround->offset.left(); }
+ const Length& right() const { return surround->offset.right(); }
+ const Length& top() const { return surround->offset.top(); }
+ const Length& bottom() const { return surround->offset.bottom(); }
// Accessors for positioned object edges that take into account writing mode.
- Length logicalLeft() const { return surround->offset.logicalLeft(writingMode()); }
- Length logicalRight() const { return surround->offset.logicalRight(writingMode()); }
- Length logicalTop() const { return surround->offset.before(writingMode()); }
- Length logicalBottom() const { return surround->offset.after(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()); }
// Whether or not a positioned element requires normal flow x/y to be computed
// to determine its position.
@@ -457,19 +475,19 @@ public:
bool hasViewportConstrainedPosition() const { return position() == FixedPosition || position() == StickyPosition; }
EFloat floating() const { return static_cast<EFloat>(noninherited_flags._floating); }
- Length width() const { return m_box->width(); }
- Length height() const { return m_box->height(); }
- Length minWidth() const { return m_box->minWidth(); }
- Length maxWidth() const { return m_box->maxWidth(); }
- Length minHeight() const { return m_box->minHeight(); }
- Length maxHeight() const { return m_box->maxHeight(); }
+ const Length& width() const { return m_box->width(); }
+ const Length& height() const { return m_box->height(); }
+ const Length& minWidth() const { return m_box->minWidth(); }
+ const Length& maxWidth() const { return m_box->maxWidth(); }
+ const Length& minHeight() const { return m_box->minHeight(); }
+ const Length& maxHeight() const { return m_box->maxHeight(); }
- Length logicalWidth() const { return isHorizontalWritingMode() ? width() : height(); }
- Length logicalHeight() const { return isHorizontalWritingMode() ? height() : width(); }
- Length logicalMinWidth() const { return isHorizontalWritingMode() ? minWidth() : minHeight(); }
- Length logicalMaxWidth() const { return isHorizontalWritingMode() ? maxWidth() : maxHeight(); }
- Length logicalMinHeight() const { return isHorizontalWritingMode() ? minHeight() : minWidth(); }
- Length logicalMaxHeight() const { return isHorizontalWritingMode() ? maxHeight() : maxWidth(); }
+ const Length& logicalWidth() const { return isHorizontalWritingMode() ? width() : height(); }
+ const Length& logicalHeight() const { return isHorizontalWritingMode() ? height() : width(); }
+ const Length& logicalMinWidth() const { return isHorizontalWritingMode() ? minWidth() : minHeight(); }
+ const Length& logicalMaxWidth() const { return isHorizontalWritingMode() ? maxWidth() : maxHeight(); }
+ const Length& logicalMinHeight() const { return isHorizontalWritingMode() ? minHeight() : minWidth(); }
+ const Length& logicalMaxHeight() const { return isHorizontalWritingMode() ? maxHeight() : maxWidth(); }
const BorderData& border() const { return surround->border; }
const BorderValue& borderLeft() const { return surround->border.left(); }
@@ -484,14 +502,14 @@ public:
const NinePieceImage& borderImage() const { return surround->border.image(); }
StyleImage* borderImageSource() const { return surround->border.image().image(); }
- LengthBox borderImageSlices() const { return surround->border.image().imageSlices(); }
+ const LengthBox& borderImageSlices() const { return surround->border.image().imageSlices(); }
const BorderImageLengthBox& borderImageWidth() const { return surround->border.image().borderSlices(); }
const BorderImageLengthBox& borderImageOutset() const { return surround->border.image().outset(); }
- LengthSize borderTopLeftRadius() const { return surround->border.topLeft(); }
- LengthSize borderTopRightRadius() const { return surround->border.topRight(); }
- LengthSize borderBottomLeftRadius() const { return surround->border.bottomLeft(); }
- LengthSize borderBottomRightRadius() const { return surround->border.bottomRight(); }
+ const LengthSize& borderTopLeftRadius() const { return surround->border.topLeft(); }
+ const LengthSize& borderTopRightRadius() const { return surround->border.topRight(); }
+ const LengthSize& borderBottomLeftRadius() const { return surround->border.bottomLeft(); }
+ const LengthSize& borderBottomRightRadius() const { return surround->border.bottomRight(); }
bool hasBorderRadius() const { return surround->border.hasBorderRadius(); }
unsigned borderLeftWidth() const { return surround->border.borderLeftWidth(); }
@@ -525,22 +543,26 @@ public:
EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); }
EOverflow overflowY() const { return static_cast<EOverflow>(noninherited_flags._overflowY); }
+ // It's sufficient to just check one direction, since it's illegal to have visible on only one overflow value.
+ bool isOverflowVisible() const { ASSERT(overflowX() != OVISIBLE || overflowX() == overflowY()); return overflowX() == OVISIBLE; }
+ bool isOverflowPaged() const { return overflowY() == OPAGEDX || overflowY() == OPAGEDY; }
EVisibility visibility() const { return static_cast<EVisibility>(inherited_flags._visibility); }
EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(noninherited_flags._vertical_align); }
- Length verticalAlignLength() const { return m_box->verticalAlign(); }
+ const Length& verticalAlignLength() const { return m_box->verticalAlign(); }
- Length clipLeft() const { return visual->clip.left(); }
- Length clipRight() const { return visual->clip.right(); }
- Length clipTop() const { return visual->clip.top(); }
- Length clipBottom() const { return visual->clip.bottom(); }
- LengthBox clip() const { return visual->clip; }
+ const Length& clipLeft() const { return visual->clip.left(); }
+ const Length& clipRight() const { return visual->clip.right(); }
+ const Length& clipTop() const { return visual->clip.top(); }
+ const Length& clipBottom() const { return visual->clip.bottom(); }
+ const LengthBox& clip() const { return visual->clip; }
bool hasClip() const { return visual->hasClip; }
EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(noninherited_flags._unicodeBidi); }
EClear clear() const { return static_cast<EClear>(noninherited_flags._clear); }
ETableLayout tableLayout() const { return static_cast<ETableLayout>(noninherited_flags._table_layout); }
+ bool isFixedTableLayout() const { return tableLayout() == TFIXED && !logicalWidth().isAuto(); }
const Font& font() const;
const FontMetrics& fontMetrics() const;
@@ -548,16 +570,19 @@ public:
float specifiedFontSize() const;
float computedFontSize() const;
int fontSize() const;
+ FontWeight fontWeight() const;
- float textAutosizingMultiplier() const { return visual->m_textAutosizingMultiplier; }
+ float textAutosizingMultiplier() const { return inherited->textAutosizingMultiplier; }
- Length textIndent() const { return rareInheritedData->indent; }
+ const Length& textIndent() const { return rareInheritedData->indent; }
TextIndentLine textIndentLine() const { return static_cast<TextIndentLine>(rareInheritedData->m_textIndentLine); }
+ TextIndentType textIndentType() const { return static_cast<TextIndentType>(rareInheritedData->m_textIndentType); }
ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flags._text_align); }
TextAlignLast textAlignLast() const { return static_cast<TextAlignLast>(rareInheritedData->m_textAlignLast); }
TextJustify textJustify() const { return static_cast<TextJustify>(rareInheritedData->m_textJustify); }
ETextTransform textTransform() const { return static_cast<ETextTransform>(inherited_flags._text_transform); }
- TextDecoration textDecorationsInEffect() const { return static_cast<TextDecoration>(inherited_flags._text_decorations); }
+ TextDecoration textDecorationsInEffect() const;
+ const Vector<AppliedTextDecoration>& appliedTextDecorations() const;
TextDecoration textDecoration() const { return static_cast<TextDecoration>(visual->textDecoration); }
TextUnderlinePosition textUnderlinePosition() const { return static_cast<TextUnderlinePosition>(rareInheritedData->m_textUnderlinePosition); }
TextDecorationStyle textDecorationStyle() const { return static_cast<TextDecorationStyle>(rareNonInheritedData->m_textDecorationStyle); }
@@ -570,9 +595,9 @@ public:
TextDirection direction() const { return static_cast<TextDirection>(inherited_flags._direction); }
bool isLeftToRightDirection() const { return direction() == LTR; }
- Length specifiedLineHeight() const;
+ const Length& specifiedLineHeight() const;
Length lineHeight() const;
- int computedLineHeight(RenderView* = 0) const;
+ int computedLineHeight() const;
EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_flags._white_space); }
static bool autoWrap(EWhiteSpace ws)
@@ -636,10 +661,10 @@ public:
EFillAttachment backgroundAttachment() const { return static_cast<EFillAttachment>(m_background->background().attachment()); }
EFillBox backgroundClip() const { return static_cast<EFillBox>(m_background->background().clip()); }
EFillBox backgroundOrigin() const { return static_cast<EFillBox>(m_background->background().origin()); }
- Length backgroundXPosition() const { return m_background->background().xPosition(); }
- Length backgroundYPosition() const { return m_background->background().yPosition(); }
+ const Length& backgroundXPosition() const { return m_background->background().xPosition(); }
+ const Length& backgroundYPosition() const { return m_background->background().yPosition(); }
EFillSizeType backgroundSizeType() const { return m_background->background().sizeType(); }
- LengthSize backgroundSizeLength() const { return m_background->background().sizeLength(); }
+ const LengthSize& backgroundSizeLength() const { return m_background->background().sizeLength(); }
FillLayer* accessBackgroundLayers() { return &(m_background.access()->m_background); }
const FillLayer* backgroundLayers() const { return &(m_background->background()); }
@@ -649,16 +674,16 @@ public:
CompositeOperator maskComposite() const { return static_cast<CompositeOperator>(rareNonInheritedData->m_mask.composite()); }
EFillBox maskClip() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.clip()); }
EFillBox maskOrigin() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.origin()); }
- Length maskXPosition() const { return rareNonInheritedData->m_mask.xPosition(); }
- Length maskYPosition() const { return rareNonInheritedData->m_mask.yPosition(); }
+ const Length& maskXPosition() const { return rareNonInheritedData->m_mask.xPosition(); }
+ const Length& maskYPosition() const { return rareNonInheritedData->m_mask.yPosition(); }
EFillSizeType maskSizeType() const { return rareNonInheritedData->m_mask.sizeType(); }
- LengthSize maskSizeLength() const { return rareNonInheritedData->m_mask.sizeLength(); }
+ const LengthSize& maskSizeLength() const { return rareNonInheritedData->m_mask.sizeLength(); }
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(); }
- LengthBox maskBoxImageSlices() const { return rareNonInheritedData->m_maskBoxImage.imageSlices(); }
+ const LengthBox& maskBoxImageSlices() const { return rareNonInheritedData->m_maskBoxImage.imageSlices(); }
bool maskBoxImageSlicesFill() const { return rareNonInheritedData->m_maskBoxImage.fill(); }
const BorderImageLengthBox& maskBoxImageWidth() const { return rareNonInheritedData->m_maskBoxImage.borderSlices(); }
const BorderImageLengthBox& maskBoxImageOutset() const { return rareNonInheritedData->m_maskBoxImage.outset(); }
@@ -673,28 +698,28 @@ public:
StyleImage* listStyleImage() const;
EListStylePosition listStylePosition() const { return static_cast<EListStylePosition>(inherited_flags._list_style_position); }
- Length marginTop() const { return surround->margin.top(); }
- Length marginBottom() const { return surround->margin.bottom(); }
- Length marginLeft() const { return surround->margin.left(); }
- Length marginRight() const { return surround->margin.right(); }
- Length marginBefore() const { return surround->margin.before(writingMode()); }
- Length marginAfter() const { return surround->margin.after(writingMode()); }
- Length marginStart() const { return surround->margin.start(writingMode(), direction()); }
- Length marginEnd() const { return surround->margin.end(writingMode(), direction()); }
- Length marginStartUsing(const RenderStyle* otherStyle) const { return surround->margin.start(otherStyle->writingMode(), otherStyle->direction()); }
- Length marginEndUsing(const RenderStyle* otherStyle) const { return surround->margin.end(otherStyle->writingMode(), otherStyle->direction()); }
- Length marginBeforeUsing(const RenderStyle* otherStyle) const { return surround->margin.before(otherStyle->writingMode()); }
- Length marginAfterUsing(const RenderStyle* otherStyle) const { return surround->margin.after(otherStyle->writingMode()); }
-
- LengthBox paddingBox() const { return surround->padding; }
- Length paddingTop() const { return surround->padding.top(); }
- Length paddingBottom() const { return surround->padding.bottom(); }
- Length paddingLeft() const { return surround->padding.left(); }
- Length paddingRight() const { return surround->padding.right(); }
- Length paddingBefore() const { return surround->padding.before(writingMode()); }
- Length paddingAfter() const { return surround->padding.after(writingMode()); }
- Length paddingStart() const { return surround->padding.start(writingMode(), direction()); }
- Length paddingEnd() const { return surround->padding.end(writingMode(), direction()); }
+ const Length& marginTop() const { return surround->margin.top(); }
+ const Length& marginBottom() const { return surround->margin.bottom(); }
+ const Length& marginLeft() const { return surround->margin.left(); }
+ const Length& marginRight() const { return surround->margin.right(); }
+ const Length& marginBefore() const { return surround->margin.before(writingMode()); }
+ const Length& marginAfter() const { return surround->margin.after(writingMode()); }
+ const Length& marginStart() const { return surround->margin.start(writingMode(), direction()); }
+ const Length& marginEnd() const { return surround->margin.end(writingMode(), direction()); }
+ const Length& marginStartUsing(const RenderStyle* otherStyle) const { return surround->margin.start(otherStyle->writingMode(), otherStyle->direction()); }
+ const Length& marginEndUsing(const RenderStyle* otherStyle) const { return surround->margin.end(otherStyle->writingMode(), otherStyle->direction()); }
+ const Length& marginBeforeUsing(const RenderStyle* otherStyle) const { return surround->margin.before(otherStyle->writingMode()); }
+ const Length& marginAfterUsing(const RenderStyle* otherStyle) const { return surround->margin.after(otherStyle->writingMode()); }
+
+ const LengthBox& paddingBox() const { return surround->padding; }
+ const Length& paddingTop() const { return surround->padding.top(); }
+ const Length& paddingBottom() const { return surround->padding.bottom(); }
+ const Length& paddingLeft() const { return surround->padding.left(); }
+ const Length& paddingRight() const { return surround->padding.right(); }
+ const Length& paddingBefore() const { return surround->padding.before(writingMode()); }
+ const Length& paddingAfter() const { return surround->padding.after(writingMode()); }
+ const Length& paddingStart() const { return surround->padding.start(writingMode(), direction()); }
+ const Length& paddingEnd() const { return surround->padding.end(writingMode(), direction()); }
ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor_style); }
CursorList* cursors() const { return rareInheritedData->cursorData.get(); }
@@ -737,9 +762,9 @@ public:
EBoxAlignment boxAlign() const { return static_cast<EBoxAlignment>(rareNonInheritedData->m_deprecatedFlexibleBox->align); }
EBoxDirection boxDirection() const { return static_cast<EBoxDirection>(inherited_flags._box_direction); }
float boxFlex() const { return rareNonInheritedData->m_deprecatedFlexibleBox->flex; }
- unsigned int boxFlexGroup() const { return rareNonInheritedData->m_deprecatedFlexibleBox->flex_group; }
+ unsigned boxFlexGroup() const { return rareNonInheritedData->m_deprecatedFlexibleBox->flexGroup; }
EBoxLines boxLines() const { return static_cast<EBoxLines>(rareNonInheritedData->m_deprecatedFlexibleBox->lines); }
- unsigned int boxOrdinalGroup() const { return rareNonInheritedData->m_deprecatedFlexibleBox->ordinal_group; }
+ unsigned boxOrdinalGroup() const { return rareNonInheritedData->m_deprecatedFlexibleBox->ordinalGroup; }
EBoxOrient boxOrient() const { return static_cast<EBoxOrient>(rareNonInheritedData->m_deprecatedFlexibleBox->orient); }
EBoxPack boxPack() const { return static_cast<EBoxPack>(rareNonInheritedData->m_deprecatedFlexibleBox->pack); }
@@ -747,18 +772,22 @@ public:
const Vector<String>& callbackSelectors() const { return rareNonInheritedData->m_callbackSelectors; }
float flexGrow() const { return rareNonInheritedData->m_flexibleBox->m_flexGrow; }
float flexShrink() const { return rareNonInheritedData->m_flexibleBox->m_flexShrink; }
- Length flexBasis() const { return rareNonInheritedData->m_flexibleBox->m_flexBasis; }
+ const Length& flexBasis() const { return rareNonInheritedData->m_flexibleBox->m_flexBasis; }
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); }
+ ItemPosition alignItems() const { return static_cast<ItemPosition>(rareNonInheritedData->m_alignItems); }
+ OverflowAlignment alignItemsOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_alignItemsOverflowAlignment); }
+ ItemPosition alignSelf() const { return static_cast<ItemPosition>(rareNonInheritedData->m_alignSelf); }
+ OverflowAlignment alignSelfOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_alignSelfOverflowAlignment); }
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); }
EJustifyContent justifyContent() const { return static_cast<EJustifyContent>(rareNonInheritedData->m_justifyContent); }
+ ItemPosition justifySelf() const { return static_cast<ItemPosition>(rareNonInheritedData->m_justifySelf); }
+ OverflowAlignment justifySelfOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_justifySelfOverflowAlignment); }
- const Vector<GridTrackSize>& gridDefinitionColumns() const { return rareNonInheritedData->m_grid->m_gridDefinitionColumns; }
- const Vector<GridTrackSize>& gridDefinitionRows() const { return rareNonInheritedData->m_grid->m_gridDefinitionRows; }
+ const Vector<GridTrackSize>& gridTemplateColumns() const { return rareNonInheritedData->m_grid->m_gridTemplateColumns; }
+ const Vector<GridTrackSize>& gridTemplateRows() const { return rareNonInheritedData->m_grid->m_gridTemplateRows; }
const NamedGridLinesMap& namedGridColumnLines() const { return rareNonInheritedData->m_grid->m_namedGridColumnLines; }
const NamedGridLinesMap& namedGridRowLines() const { return rareNonInheritedData->m_grid->m_namedGridRowLines; }
const OrderedNamedGridLines& orderedNamedGridColumnLines() const { return rareNonInheritedData->m_grid->m_orderedNamedGridColumnLines; }
@@ -785,8 +814,10 @@ public:
EBoxDecorationBreak boxDecorationBreak() const { return m_box->boxDecorationBreak(); }
StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxReflect.get(); }
+ bool reflectionDataEquivalent(const RenderStyle* otherStyle) const { return rareNonInheritedData->reflectionDataEquivalent(*otherStyle->rareNonInheritedData); }
+
EBoxSizing boxSizing() const { return m_box->boxSizing(); }
- Length marqueeIncrement() const { return rareNonInheritedData->m_marquee->increment; }
+ const Length& marqueeIncrement() const { return rareNonInheritedData->m_marquee->increment; }
int marqueeSpeed() const { return rareNonInheritedData->m_marquee->speed; }
int marqueeLoopCount() const { return rareNonInheritedData->m_marquee->loops; }
EMarqueeBehavior marqueeBehavior() const { return static_cast<EMarqueeBehavior>(rareNonInheritedData->m_marquee->behavior); }
@@ -805,18 +836,20 @@ public:
const AtomicString& locale() const { return rareInheritedData->locale; }
EBorderFit borderFit() const { return static_cast<EBorderFit>(rareNonInheritedData->m_borderFit); }
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();
- return axis == AutoColumnAxis || isHorizontalWritingMode() == (axis == HorizontalColumnAxis);
+ bool hasInlinePaginationAxis() const
+ {
+ // If the pagination axis is parallel with the writing mode inline axis, columns may be laid
+ // out along the inline axis, just like for regular multicol. Otherwise, we need to lay out
+ // along the block axis.
+ if (isOverflowPaged())
+ return (overflowY() == OPAGEDX) == isHorizontalWritingMode();
+ return false;
}
- ColumnProgression columnProgression() const { return static_cast<ColumnProgression>(rareNonInheritedData->m_multiCol->m_progression); }
float columnWidth() const { return rareNonInheritedData->m_multiCol->m_width; }
bool hasAutoColumnWidth() const { return rareNonInheritedData->m_multiCol->m_autoWidth; }
unsigned short columnCount() const { return rareNonInheritedData->m_multiCol->m_count; }
bool hasAutoColumnCount() const { return rareNonInheritedData->m_multiCol->m_autoCount; }
- bool specifiesAutoColumns() const { return hasAutoColumnCount() && hasAutoColumnWidth(); }
- bool specifiesColumns() const { return !hasAutoColumnCount() || !hasAutoColumnWidth() || !hasInlineColumnAxis(); }
+ bool specifiesColumns() const { return !hasAutoColumnCount() || !hasAutoColumnWidth(); }
ColumnFill columnFill() const { return static_cast<ColumnFill>(rareNonInheritedData->m_multiCol->m_fill); }
float columnGap() const { return rareNonInheritedData->m_multiCol->m_gap; }
bool hasNormalColumnGap() const { return rareNonInheritedData->m_multiCol->m_normalGap; }
@@ -827,14 +860,12 @@ public:
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; }
- Length transformOriginX() const { return rareNonInheritedData->m_transform->m_x; }
- Length transformOriginY() const { return rareNonInheritedData->m_transform->m_y; }
+ const Length& transformOriginX() const { return rareNonInheritedData->m_transform->m_x; }
+ const Length& transformOriginY() const { return rareNonInheritedData->m_transform->m_y; }
float transformOriginZ() const { return rareNonInheritedData->m_transform->m_z; }
bool hasTransform() const { return !rareNonInheritedData->m_transform->m_operations.operations().isEmpty(); }
+ bool transformDataEquivalent(const RenderStyle& otherStyle) const { return rareNonInheritedData->m_transform == otherStyle.rareNonInheritedData->m_transform; }
TextEmphasisFill textEmphasisFill() const { return static_cast<TextEmphasisFill>(rareInheritedData->textEmphasisFill); }
TextEmphasisMark textEmphasisMark() const;
@@ -866,30 +897,16 @@ public:
// End CSS3 Getters
- const AtomicString& flowThread() const { return rareNonInheritedData->m_flowThread; }
- bool hasFlowFrom() const { return !rareNonInheritedData->m_regionThread.isNull(); }
- const AtomicString& regionThread() const { return rareNonInheritedData->m_regionThread; }
- RegionFragment regionFragment() const { return static_cast<RegionFragment>(rareNonInheritedData->m_regionFragment); }
-
- const AtomicString& lineGrid() const { return rareInheritedData->m_lineGrid; }
- 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 CSSAnimationDataList* animations() const { return rareNonInheritedData->m_animations.get(); }
- const CSSAnimationDataList* transitions() const { return rareNonInheritedData->m_transitions.get(); }
+ const CSSAnimationData* animations() const { return rareNonInheritedData->m_animations.get(); }
+ const CSSTransitionData* transitions() const { return rareNonInheritedData->m_transitions.get(); }
- CSSAnimationDataList* accessAnimations();
- CSSAnimationDataList* accessTransitions();
-
- bool hasAnimations() const { return rareNonInheritedData->m_animations && rareNonInheritedData->m_animations->size() > 0; }
-
- // return the first found Animation (including 'all' transitions)
- const CSSAnimationData* transitionForProperty(CSSPropertyID) const;
+ CSSAnimationData& accessAnimations();
+ CSSTransitionData& accessTransitions();
ETransformStyle3D transformStyle3D() const { return static_cast<ETransformStyle3D>(rareNonInheritedData->m_transformStyle3D); }
bool preserves3D() const { return rareNonInheritedData->m_transformStyle3D == TransformStyle3DPreserve3D; }
@@ -897,13 +914,20 @@ public:
EBackfaceVisibility backfaceVisibility() const { return static_cast<EBackfaceVisibility>(rareNonInheritedData->m_backfaceVisibility); }
float perspective() const { return rareNonInheritedData->m_perspective; }
bool hasPerspective() const { return rareNonInheritedData->m_perspective > 0; }
- Length perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; }
- Length perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; }
- LengthSize pageSize() const { return rareNonInheritedData->m_pageSize; }
+ const Length& perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; }
+ const Length& perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; }
+ const LengthSize& pageSize() const { return rareNonInheritedData->m_pageSize; }
PageSizeType pageSizeType() const { return static_cast<PageSizeType>(rareNonInheritedData->m_pageSizeType); }
- // When set, this ensures that styles compare as different. Used during accelerated animations.
- bool isRunningAcceleratedAnimation() const { return rareNonInheritedData->m_runningAcceleratedAnimation; }
+ bool hasCurrentOpacityAnimation() const { return rareNonInheritedData->m_hasCurrentOpacityAnimation; }
+ bool hasCurrentTransformAnimation() const { return rareNonInheritedData->m_hasCurrentTransformAnimation; }
+ bool hasCurrentFilterAnimation() const { return rareNonInheritedData->m_hasCurrentFilterAnimation; }
+ bool shouldCompositeForCurrentAnimations() { return hasCurrentOpacityAnimation() || hasCurrentTransformAnimation() || hasCurrentFilterAnimation(); }
+
+ bool isRunningOpacityAnimationOnCompositor() const { return rareNonInheritedData->m_runningOpacityAnimationOnCompositor; }
+ bool isRunningTransformAnimationOnCompositor() const { return rareNonInheritedData->m_runningTransformAnimationOnCompositor; }
+ bool isRunningFilterAnimationOnCompositor() const { return rareNonInheritedData->m_runningFilterAnimationOnCompositor; }
+ bool isRunningAnimationOnCompositor() { return isRunningOpacityAnimationOnCompositor() || isRunningTransformAnimationOnCompositor() || isRunningFilterAnimationOnCompositor(); }
LineBoxContain lineBoxContain() const { return rareInheritedData->m_lineBoxContain; }
const LineClampValue& lineClamp() const { return rareNonInheritedData->lineClamp; }
@@ -936,6 +960,14 @@ public:
TouchAction touchAction() const { return static_cast<TouchAction>(rareNonInheritedData->m_touchAction); }
TouchActionDelay touchActionDelay() const { return static_cast<TouchActionDelay>(rareInheritedData->m_touchActionDelay); }
+ ScrollBehavior scrollBehavior() const { return static_cast<ScrollBehavior>(rareNonInheritedData->m_scrollBehavior); }
+
+ const Vector<CSSPropertyID>& willChangeProperties() const { return rareNonInheritedData->m_willChange->m_properties; }
+ bool willChangeContents() const { return rareNonInheritedData->m_willChange->m_contents; }
+ bool willChangeScrollPosition() const { return rareNonInheritedData->m_willChange->m_scrollPosition; }
+ bool hasWillChangeCompositingHint() const;
+ bool subtreeWillChangeContents() const { return rareInheritedData->m_subtreeWillChangeContents; }
+
// attribute setter methods
void setDisplay(EDisplay v) { noninherited_flags._effectiveDisplay = v; }
@@ -943,15 +975,15 @@ public:
void setPosition(EPosition v) { noninherited_flags._position = v; }
void setFloating(EFloat v) { noninherited_flags._floating = v; }
- void setLeft(Length v) { SET_VAR(surround, offset.m_left, v); }
- void setRight(Length v) { SET_VAR(surround, offset.m_right, v); }
- void setTop(Length v) { SET_VAR(surround, offset.m_top, v); }
- void setBottom(Length v) { SET_VAR(surround, offset.m_bottom, v); }
+ void setLeft(const Length& v) { SET_VAR(surround, offset.m_left, v); }
+ void setRight(const Length& v) { SET_VAR(surround, offset.m_right, v); }
+ void setTop(const Length& v) { SET_VAR(surround, offset.m_top, v); }
+ void setBottom(const Length& v) { SET_VAR(surround, offset.m_bottom, v); }
- void setWidth(Length v) { SET_VAR(m_box, m_width, v); }
- void setHeight(Length v) { SET_VAR(m_box, m_height, v); }
+ void setWidth(const Length& v) { SET_VAR(m_box, m_width, v); }
+ void setHeight(const Length& v) { SET_VAR(m_box, m_height, v); }
- void setLogicalWidth(Length v)
+ void setLogicalWidth(const Length& v)
{
if (isHorizontalWritingMode()) {
SET_VAR(m_box, m_width, v);
@@ -960,7 +992,7 @@ public:
}
}
- void setLogicalHeight(Length v)
+ void setLogicalHeight(const Length& v)
{
if (isHorizontalWritingMode()) {
SET_VAR(m_box, m_height, v);
@@ -969,45 +1001,55 @@ public:
}
}
- void setMinWidth(Length v) { SET_VAR(m_box, m_minWidth, v); }
- void setMaxWidth(Length v) { SET_VAR(m_box, m_maxWidth, v); }
- void setMinHeight(Length v) { SET_VAR(m_box, m_minHeight, v); }
- void setMaxHeight(Length v) { SET_VAR(m_box, m_maxHeight, v); }
+ void setMinWidth(const Length& v) { SET_VAR(m_box, m_minWidth, v); }
+ void setMaxWidth(const Length& v) { SET_VAR(m_box, m_maxWidth, v); }
+ void setMinHeight(const Length& v) { SET_VAR(m_box, m_minHeight, v); }
+ void setMaxHeight(const Length& v) { SET_VAR(m_box, m_maxHeight, v); }
DraggableRegionMode getDraggableRegionMode() const { return rareNonInheritedData->m_draggableRegionMode; }
void setDraggableRegionMode(DraggableRegionMode v) { SET_VAR(rareNonInheritedData, m_draggableRegionMode, v); }
- void resetBorder() { resetBorderImage(); resetBorderTop(); resetBorderRight(); resetBorderBottom(); resetBorderLeft(); resetBorderRadius(); }
+ void resetBorder()
+ {
+ resetBorderImage();
+ resetBorderTop();
+ resetBorderRight();
+ resetBorderBottom();
+ resetBorderLeft();
+ resetBorderTopLeftRadius();
+ resetBorderTopRightRadius();
+ resetBorderBottomLeftRadius();
+ resetBorderBottomRightRadius();
+ }
void resetBorderTop() { SET_VAR(surround, border.m_top, BorderValue()); }
void resetBorderRight() { SET_VAR(surround, border.m_right, BorderValue()); }
void resetBorderBottom() { SET_VAR(surround, border.m_bottom, BorderValue()); }
void resetBorderLeft() { SET_VAR(surround, border.m_left, BorderValue()); }
void resetBorderImage() { SET_VAR(surround, border.m_image, NinePieceImage()); }
- void resetBorderRadius() { resetBorderTopLeftRadius(); resetBorderTopRightRadius(); resetBorderBottomLeftRadius(); resetBorderBottomRightRadius(); }
void resetBorderTopLeftRadius() { SET_VAR(surround, border.m_topLeft, initialBorderRadius()); }
void resetBorderTopRightRadius() { SET_VAR(surround, border.m_topRight, initialBorderRadius()); }
void resetBorderBottomLeftRadius() { SET_VAR(surround, border.m_bottomLeft, initialBorderRadius()); }
void resetBorderBottomRightRadius() { SET_VAR(surround, border.m_bottomRight, initialBorderRadius()); }
- void setBackgroundColor(const Color& v) { SET_VAR(m_background, m_color, v); }
+ void setBackgroundColor(const StyleColor& v) { SET_VAR(m_background, m_color, v); }
- void setBackgroundXPosition(Length length) { SET_VAR(m_background, m_background.m_xPosition, length); }
- void setBackgroundYPosition(Length length) { SET_VAR(m_background, m_background.m_yPosition, length); }
+ void setBackgroundXPosition(const Length& length) { SET_VAR(m_background, m_background.m_xPosition, length); }
+ void setBackgroundYPosition(const Length& length) { SET_VAR(m_background, m_background.m_yPosition, length); }
void setBackgroundSize(EFillSizeType b) { SET_VAR(m_background, m_background.m_sizeType, b); }
- void setBackgroundSizeLength(LengthSize s) { SET_VAR(m_background, m_background.m_sizeLength, s); }
+ void setBackgroundSizeLength(const LengthSize& s) { SET_VAR(m_background, m_background.m_sizeLength, s); }
void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.m_image, b); }
void setBorderImageSource(PassRefPtr<StyleImage>);
- void setBorderImageSlices(LengthBox);
+ void setBorderImageSlices(const LengthBox&);
void setBorderImageWidth(const BorderImageLengthBox&);
void setBorderImageOutset(const BorderImageLengthBox&);
- void setBorderTopLeftRadius(LengthSize s) { SET_VAR(surround, border.m_topLeft, s); }
- void setBorderTopRightRadius(LengthSize s) { SET_VAR(surround, border.m_topRight, s); }
- void setBorderBottomLeftRadius(LengthSize s) { SET_VAR(surround, border.m_bottomLeft, s); }
- void setBorderBottomRightRadius(LengthSize s) { SET_VAR(surround, border.m_bottomRight, s); }
+ void setBorderTopLeftRadius(const LengthSize& s) { SET_VAR(surround, border.m_topLeft, s); }
+ void setBorderTopRightRadius(const LengthSize& s) { SET_VAR(surround, border.m_topRight, s); }
+ void setBorderBottomLeftRadius(const LengthSize& s) { SET_VAR(surround, border.m_bottomLeft, s); }
+ void setBorderBottomRightRadius(const LengthSize& s) { SET_VAR(surround, border.m_bottomRight, s); }
- void setBorderRadius(LengthSize s)
+ void setBorderRadius(const LengthSize& s)
{
setBorderTopLeftRadius(s);
setBorderTopRightRadius(s);
@@ -1019,7 +1061,7 @@ public:
setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed)));
}
- RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, RenderView* = 0, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
+ RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect,
@@ -1027,35 +1069,35 @@ public:
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 setBorderLeftColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(surround, border.m_left, 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 setBorderRightColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(surround, border.m_right, 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 setBorderTopColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(surround, border.m_top, 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 setBorderBottomColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(surround, border.m_bottom, 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 setOutlineColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(m_background, m_outline, 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._vertical_align = v; }
- void setVerticalAlignLength(Length length) { setVerticalAlign(LENGTH); SET_VAR(m_box, m_verticalAlign, length); }
+ void setVerticalAlignLength(const Length& length) { setVerticalAlign(LENGTH); SET_VAR(m_box, m_verticalAlign, length); }
void setHasClip(bool b = true) { SET_VAR(visual, hasClip, b); }
- void setClipLeft(Length v) { SET_VAR(visual, clip.m_left, v); }
- void setClipRight(Length v) { SET_VAR(visual, clip.m_right, v); }
- void setClipTop(Length v) { SET_VAR(visual, clip.m_top, v); }
- void setClipBottom(Length v) { SET_VAR(visual, clip.m_bottom, v); }
- void setClip(Length top, Length right, Length bottom, Length left);
- void setClip(LengthBox box) { SET_VAR(visual, clip, box); }
+ void setClipLeft(const Length& v) { SET_VAR(visual, clip.m_left, v); }
+ void setClipRight(const Length& v) { SET_VAR(visual, clip.m_right, v); }
+ void setClipTop(const Length& v) { SET_VAR(visual, clip.m_top, v); }
+ void setClipBottom(const Length& v) { SET_VAR(visual, clip.m_bottom, v); }
+ void setClip(const Length& top, const Length& right, const Length& bottom, const Length& left);
+ void setClip(const LengthBox& box) { SET_VAR(visual, clip, box); }
void setUnicodeBidi(EUnicodeBidi b) { noninherited_flags._unicodeBidi = b; }
@@ -1065,41 +1107,40 @@ public:
bool setFontDescription(const FontDescription&);
// Only used for blending font sizes when animating and for text autosizing.
void setFontSize(float);
+ void setFontWeight(FontWeight);
void setTextAutosizingMultiplier(float v)
{
- SET_VAR(visual, m_textAutosizingMultiplier, v);
+ SET_VAR(inherited, textAutosizingMultiplier, v);
setFontSize(fontDescription().specifiedSize());
}
void setColor(const Color&);
- void setTextIndent(Length v) { SET_VAR(rareInheritedData, indent, v); }
+ void setTextIndent(const Length& v) { SET_VAR(rareInheritedData, indent, v); }
void setTextIndentLine(TextIndentLine v) { SET_VAR(rareInheritedData, m_textIndentLine, v); }
+ void setTextIndentType(TextIndentType v) { SET_VAR(rareInheritedData, m_textIndentType, v); }
void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; }
void setTextAlignLast(TextAlignLast v) { SET_VAR(rareInheritedData, m_textAlignLast, v); }
void setTextJustify(TextJustify v) { SET_VAR(rareInheritedData, m_textJustify, v); }
void setTextTransform(ETextTransform v) { inherited_flags._text_transform = v; }
- void addToTextDecorationsInEffect(TextDecoration v) { inherited_flags._text_decorations |= v; }
- void setTextDecorationsInEffect(TextDecoration v) { inherited_flags._text_decorations = v; }
+ void applyTextDecorations();
+ void clearAppliedTextDecorations();
void setTextDecoration(TextDecoration v) { SET_VAR(visual, textDecoration, v); }
void setTextUnderlinePosition(TextUnderlinePosition v) { SET_VAR(rareInheritedData, m_textUnderlinePosition, v); }
void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(rareNonInheritedData, m_textDecorationStyle, v); }
void setDirection(TextDirection v) { inherited_flags._direction = v; }
- void setLineHeight(Length specifiedLineHeight);
+ void setLineHeight(const Length& specifiedLineHeight);
bool setZoom(float);
- void setZoomWithoutReturnValue(float f) { setZoom(f); }
bool setEffectiveZoom(float);
void setImageRendering(EImageRendering v) { SET_VAR(rareInheritedData, m_imageRendering, v); }
void setWhiteSpace(EWhiteSpace v) { inherited_flags._white_space = v; }
+ // FIXME: Remove these two and replace them with respective FontBuilder calls.
void setWordSpacing(float);
void setLetterSpacing(float);
- void clearBackgroundLayers() { m_background.access()->m_background = FillLayer(BackgroundFillLayer); }
- void inheritBackgroundLayers(const FillLayer& parent) { m_background.access()->m_background = parent; }
-
void adjustBackgroundLayers()
{
if (backgroundLayers()->next()) {
@@ -1108,9 +1149,6 @@ public:
}
}
- void clearMaskLayers() { rareNonInheritedData.access()->m_mask = FillLayer(MaskFillLayer); }
- void inheritMaskLayers(const FillLayer& parent) { rareNonInheritedData.access()->m_mask = parent; }
-
void adjustMaskLayers()
{
if (maskLayers()->next()) {
@@ -1123,7 +1161,7 @@ public:
void setMaskBoxImage(const NinePieceImage& b) { SET_VAR(rareNonInheritedData, m_maskBoxImage, b); }
void setMaskBoxImageSource(PassRefPtr<StyleImage> v) { rareNonInheritedData.access()->m_maskBoxImage.setImage(v); }
- void setMaskBoxImageSlices(LengthBox slices)
+ void setMaskBoxImageSlices(const LengthBox& slices)
{
rareNonInheritedData.access()->m_maskBoxImage.setImageSlices(slices);
}
@@ -1139,9 +1177,9 @@ public:
{
rareNonInheritedData.access()->m_maskBoxImage.setOutset(outset);
}
- void setMaskXPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_xPosition, length); }
- void setMaskYPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_yPosition, length); }
- void setMaskSize(LengthSize s) { SET_VAR(rareNonInheritedData, m_mask.m_sizeLength, s); }
+ void setMaskXPosition(const Length& length) { SET_VAR(rareNonInheritedData, m_mask.m_xPosition, length); }
+ void setMaskYPosition(const Length& length) { SET_VAR(rareNonInheritedData, m_mask.m_yPosition, length); }
+ void setMaskSize(const LengthSize& s) { SET_VAR(rareNonInheritedData, m_mask.m_sizeLength, s); }
void setBorderCollapse(EBorderCollapse collapse) { inherited_flags._border_collapse = collapse; }
void setHorizontalBorderSpacing(short);
@@ -1157,20 +1195,19 @@ public:
void setListStyleImage(PassRefPtr<StyleImage>);
void setListStylePosition(EListStylePosition v) { inherited_flags._list_style_position = v; }
- void resetMargin() { SET_VAR(surround, margin, LengthBox(Fixed)); }
- void setMarginTop(Length v) { SET_VAR(surround, margin.m_top, v); }
- void setMarginBottom(Length v) { SET_VAR(surround, margin.m_bottom, v); }
- void setMarginLeft(Length v) { SET_VAR(surround, margin.m_left, v); }
- void setMarginRight(Length v) { SET_VAR(surround, margin.m_right, v); }
- void setMarginStart(Length);
- void setMarginEnd(Length);
+ void setMarginTop(const Length& v) { SET_VAR(surround, margin.m_top, v); }
+ void setMarginBottom(const Length& v) { SET_VAR(surround, margin.m_bottom, v); }
+ void setMarginLeft(const Length& v) { SET_VAR(surround, margin.m_left, v); }
+ void setMarginRight(const Length& v) { SET_VAR(surround, margin.m_right, v); }
+ void setMarginStart(const Length&);
+ void setMarginEnd(const Length&);
void resetPadding() { SET_VAR(surround, padding, LengthBox(Auto)); }
void setPaddingBox(const LengthBox& b) { SET_VAR(surround, padding, b); }
- void setPaddingTop(Length v) { SET_VAR(surround, padding.m_top, v); }
- void setPaddingBottom(Length v) { SET_VAR(surround, padding.m_bottom, v); }
- void setPaddingLeft(Length v) { SET_VAR(surround, padding.m_left, v); }
- void setPaddingRight(Length v) { SET_VAR(surround, padding.m_right, v); }
+ void setPaddingTop(const Length& v) { SET_VAR(surround, padding.m_top, v); }
+ void setPaddingBottom(const Length& v) { SET_VAR(surround, padding.m_bottom, v); }
+ void setPaddingLeft(const Length& v) { SET_VAR(surround, padding.m_left, v); }
+ void setPaddingRight(const Length& v) { SET_VAR(surround, padding.m_right, v); }
void setCursor(ECursor c) { inherited_flags._cursor_style = c; }
void addCursor(PassRefPtr<StyleImage>, const IntPoint& hotSpot = IntPoint());
@@ -1202,9 +1239,9 @@ public:
// CSS3 Setters
void setOutlineOffset(int v) { SET_VAR(m_background, m_outline.m_offset, v); }
void setTextShadow(PassRefPtr<ShadowList>);
- void setTextStrokeColor(const Color& c) { SET_VAR(rareInheritedData, textStrokeColor, c); }
+ void setTextStrokeColor(const StyleColor& c) { SET_VAR_WITH_SETTER(rareInheritedData, textStrokeColor, setTextStrokeColor, c); }
void setTextStrokeWidth(float w) { SET_VAR(rareInheritedData, textStrokeWidth, w); }
- void setTextFillColor(const Color& c) { SET_VAR(rareInheritedData, textFillColor, c); }
+ void setTextFillColor(const StyleColor& c) { SET_VAR_WITH_SETTER(rareInheritedData, textFillColor, setTextFillColor, c); }
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
@@ -1212,9 +1249,9 @@ public:
void setBoxDecorationBreak(EBoxDecorationBreak b) { SET_VAR(m_box, m_boxDecorationBreak, b); }
void setBoxDirection(EBoxDirection d) { inherited_flags._box_direction = d; }
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 setBoxFlexGroup(unsigned fg) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, flexGroup, 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 setBoxOrdinalGroup(unsigned og) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, ordinalGroup, 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(PassRefPtr<ShadowList>);
@@ -1222,19 +1259,24 @@ public:
void setBoxSizing(EBoxSizing s) { SET_VAR(m_box, m_boxSizing, s); }
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, length); }
- void setOrder(int o) { SET_VAR(rareNonInheritedData, m_order, o); }
+ void setFlexBasis(const Length& length) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexBasis, length); }
+ // We restrict the smallest value to int min + 2 because we use int min and int min + 1 as special values in a hash set.
+ void setOrder(int o) { SET_VAR(rareNonInheritedData, m_order, max(std::numeric_limits<int>::min() + 2, o)); }
void addCallbackSelector(const String& selector);
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 setAlignItems(ItemPosition a) { SET_VAR(rareNonInheritedData, m_alignItems, a); }
+ void setAlignItemsOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_alignItemsOverflowAlignment, overflowAlignment); }
+ void setAlignSelf(ItemPosition a) { SET_VAR(rareNonInheritedData, m_alignSelf, a); }
+ void setAlignSelfOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_alignSelfOverflowAlignment, overflowAlignment); }
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 setJustifySelf(ItemPosition justifySelf) { SET_VAR(rareNonInheritedData, m_justifySelf, justifySelf); }
+ void setJustifySelfOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_justifySelfOverflowAlignment, overflowAlignment); }
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 setGridDefinitionColumns(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridDefinitionColumns, lengths); }
- void setGridDefinitionRows(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridDefinitionRows, lengths); }
+ void setGridTemplateColumns(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridTemplateColumns, lengths); }
+ void setGridTemplateRows(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridTemplateRows, 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 setOrderedNamedGridColumnLines(const OrderedNamedGridLines& orderedNamedGridColumnLines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_orderedNamedGridColumnLines, orderedNamedGridColumnLines); }
@@ -1249,7 +1291,7 @@ public:
void setGridRowStart(const GridPosition& rowStartPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridRowStart, rowStartPosition); }
void setGridRowEnd(const GridPosition& rowEndPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridRowEnd, rowEndPosition); }
- void setMarqueeIncrement(Length f) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, f); }
+ void setMarqueeIncrement(const Length& f) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, f); }
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); }
@@ -1269,8 +1311,6 @@ public:
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(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); }
@@ -1278,7 +1318,7 @@ public:
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 setColumnRuleColor(const StyleColor& c) { SET_BORDERVALUE_COLOR(rareNonInheritedData.access()->m_multiCol, m_rule, c); }
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()); }
@@ -1287,18 +1327,15 @@ public:
// 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_VAR(rareNonInheritedData.access()->m_transform, m_operations, ops); }
- void setTransformOriginX(Length l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_x, l); }
- void setTransformOriginY(Length l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_y, l); }
+ void setTransformOriginX(const Length& l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_x, l); }
+ void setTransformOriginY(const Length& l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_y, l); }
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); }
- void setTextEmphasisColor(const Color& c) { SET_VAR(rareInheritedData, textEmphasisColor, c); }
+ void setTextDecorationColor(const StyleColor& c) { SET_VAR(rareNonInheritedData, m_textDecorationColor, c); }
+ void setTextEmphasisColor(const StyleColor& c) { SET_VAR_WITH_SETTER(rareInheritedData, textEmphasisColor, setTextEmphasisColor, c); }
void setTextEmphasisFill(TextEmphasisFill fill) { SET_VAR(rareInheritedData, textEmphasisFill, fill); }
void setTextEmphasisMark(TextEmphasisMark mark) { SET_VAR(rareInheritedData, textEmphasisMark, mark); }
void setTextEmphasisCustomMark(const AtomicString& mark) { SET_VAR(rareInheritedData, textEmphasisCustomMark, mark); }
@@ -1316,14 +1353,6 @@ public:
// End CSS3 Setters
- void setLineGrid(const AtomicString& lineGrid) { SET_VAR(rareInheritedData, m_lineGrid, lineGrid); }
- void setLineSnap(LineSnap lineSnap) { SET_VAR(rareInheritedData, m_lineSnap, lineSnap); }
- void setLineAlign(LineAlign lineAlign) { SET_VAR(rareInheritedData, m_lineAlign, lineAlign); }
-
- void setFlowThread(const AtomicString& flowThread) { SET_VAR(rareNonInheritedData, m_flowThread, flowThread); }
- 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); }
@@ -1340,19 +1369,22 @@ public:
rareNonInheritedData.access()->m_transitions.clear();
}
- 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 l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, l); }
- void setPerspectiveOriginY(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, l); }
- void setPageSize(LengthSize s) { SET_VAR(rareNonInheritedData, m_pageSize, s); }
+ void setPerspectiveOriginX(const Length& l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, l); }
+ void setPerspectiveOriginY(const Length& l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, l); }
+ void setPageSize(const LengthSize& s) { SET_VAR(rareNonInheritedData, m_pageSize, s); }
void setPageSizeType(PageSizeType t) { SET_VAR(rareNonInheritedData, m_pageSizeType, t); }
void resetPageSizeType() { SET_VAR(rareNonInheritedData, m_pageSizeType, PAGE_SIZE_AUTO); }
- void setIsRunningAcceleratedAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_runningAcceleratedAnimation, b); }
+ void setHasCurrentOpacityAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_hasCurrentOpacityAnimation, b); }
+ void setHasCurrentTransformAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_hasCurrentTransformAnimation, b); }
+ void setHasCurrentFilterAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_hasCurrentFilterAnimation, b); }
+
+ void setIsRunningOpacityAnimationOnCompositor(bool b = true) { SET_VAR(rareNonInheritedData, m_runningOpacityAnimationOnCompositor, b); }
+ void setIsRunningTransformAnimationOnCompositor(bool b = true) { SET_VAR(rareNonInheritedData, m_runningTransformAnimationOnCompositor, b); }
+ void setIsRunningFilterAnimationOnCompositor(bool b = true) { SET_VAR(rareNonInheritedData, m_runningFilterAnimationOnCompositor, b); }
void setLineBoxContain(LineBoxContain c) { SET_VAR(rareInheritedData, m_lineBoxContain, c); }
void setLineClamp(LineClampValue c) { SET_VAR(rareNonInheritedData, lineClamp, c); }
@@ -1361,6 +1393,16 @@ public:
void setTouchAction(TouchAction t) { SET_VAR(rareNonInheritedData, m_touchAction, t); }
void setTouchActionDelay(TouchActionDelay t) { SET_VAR(rareInheritedData, m_touchActionDelay, t); }
+ void setScrollBehavior(ScrollBehavior b) { SET_VAR(rareNonInheritedData, m_scrollBehavior, b); }
+
+ void setWillChangeProperties(const Vector<CSSPropertyID>& properties) { SET_VAR(rareNonInheritedData.access()->m_willChange, m_properties, properties); }
+ void setWillChangeContents(bool b) { SET_VAR(rareNonInheritedData.access()->m_willChange, m_contents, b); }
+ void setWillChangeScrollPosition(bool b) { SET_VAR(rareNonInheritedData.access()->m_willChange, m_scrollPosition, b); }
+ void setSubtreeWillChangeContents(bool b) { SET_VAR(rareInheritedData, m_subtreeWillChangeContents, b); }
+
+ bool requiresAcceleratedCompositingForExternalReasons(bool b) { return rareNonInheritedData->m_requiresAcceleratedCompositingForExternalReasons; }
+ void setRequiresAcceleratedCompositingForExternalReasons(bool b) { SET_VAR(rareNonInheritedData, m_requiresAcceleratedCompositingForExternalReasons, b); }
+
const SVGRenderStyle* svgStyle() const { return m_svgStyle.get(); }
SVGRenderStyle* accessSVGStyle() { return m_svgStyle.access(); }
@@ -1375,12 +1417,12 @@ 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); }
- 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); }
- SVGLength strokeDashOffset() const { return svgStyle()->strokeDashOffset(); }
- void setStrokeDashOffset(SVGLength d) { accessSVGStyle()->setStrokeDashOffset(d); }
+ SVGLength* strokeWidth() const { return svgStyle()->strokeWidth(); }
+ void setStrokeWidth(PassRefPtr<SVGLength> w) { accessSVGStyle()->setStrokeWidth(w); }
+ SVGLengthList* strokeDashArray() const { return svgStyle()->strokeDashArray(); }
+ void setStrokeDashArray(PassRefPtr<SVGLengthList> array) { accessSVGStyle()->setStrokeDashArray(array); }
+ SVGLength* strokeDashOffset() const { return svgStyle()->strokeDashOffset(); }
+ void setStrokeDashOffset(PassRefPtr<SVGLength> d) { accessSVGStyle()->setStrokeDashOffset(d); }
float strokeMiterLimit() const { return svgStyle()->strokeMiterLimit(); }
void setStrokeMiterLimit(float f) { accessSVGStyle()->setStrokeMiterLimit(f); }
@@ -1394,25 +1436,8 @@ public:
void setFloodColor(const Color& c) { accessSVGStyle()->setFloodColor(c); }
void setLightingColor(const Color& c) { accessSVGStyle()->setLightingColor(c); }
- SVGLength baselineShiftValue() const { return svgStyle()->baselineShiftValue(); }
- void setBaselineShiftValue(SVGLength s) { accessSVGStyle()->setBaselineShiftValue(s); }
- SVGLength kerning() const { return svgStyle()->kerning(); }
- void setKerning(SVGLength k) { accessSVGStyle()->setKerning(k); }
-
- 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;
- }
+ SVGLength* baselineShiftValue() const { return svgStyle()->baselineShiftValue(); }
+ void setBaselineShiftValue(PassRefPtr<SVGLength> s) { accessSVGStyle()->setBaselineShiftValue(s); }
void setShapeOutside(PassRefPtr<ShapeValue> value)
{
@@ -1422,7 +1447,6 @@ public:
}
ShapeValue* shapeOutside() const { return rareNonInheritedData->m_shapeOutside.get(); }
- static ShapeValue* initialShapeInside() { return 0; }
static ShapeValue* initialShapeOutside() { return 0; }
void setClipPath(PassRefPtr<ClipPathOperation> operation)
@@ -1434,12 +1458,8 @@ public:
static ClipPathOperation* initialClipPath() { return 0; }
- Length shapePadding() const { return rareNonInheritedData->m_shapePadding; }
- void setShapePadding(Length shapePadding) { SET_VAR(rareNonInheritedData, m_shapePadding, shapePadding); }
- static Length initialShapePadding() { return Length(0, Fixed); }
-
- Length shapeMargin() const { return rareNonInheritedData->m_shapeMargin; }
- void setShapeMargin(Length shapeMargin) { SET_VAR(rareNonInheritedData, m_shapeMargin, shapeMargin); }
+ const Length& shapeMargin() const { return rareNonInheritedData->m_shapeMargin; }
+ void setShapeMargin(const Length& shapeMargin) { SET_VAR(rareNonInheritedData, m_shapeMargin, shapeMargin); }
static Length initialShapeMargin() { return Length(0, Fixed); }
float shapeImageThreshold() const { return rareNonInheritedData->m_shapeImageThreshold; }
@@ -1471,17 +1491,9 @@ public:
bool inheritedNotEqual(const RenderStyle*) const;
bool inheritedDataShared(const RenderStyle*) const;
- StyleDifference diff(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
-
bool isDisplayReplacedType() const { return isDisplayReplacedType(display()); }
bool isDisplayInlineType() const { return isDisplayInlineType(display()); }
bool isOriginalDisplayInlineType() const { return isDisplayInlineType(originalDisplay()); }
- bool isDisplayRegionType() const
- {
- return display() == BLOCK || display() == INLINE_BLOCK
- || display() == TABLE_CELL || display() == TABLE_CAPTION
- || display() == LIST_ITEM;
- }
bool setWritingMode(WritingMode v)
{
@@ -1505,6 +1517,8 @@ public:
bool lastChildState() const { return noninherited_flags.lastChildState; }
void setLastChildState() { setUnique(); noninherited_flags.lastChildState = true; }
+ StyleColor visitedDependentDecorationStyleColor() const;
+ Color visitedDependentDecorationColor() const;
Color visitedDependentColor(int colorProperty) const;
void setHasExplicitlyInheritedProperties() { noninherited_flags.explicitInheritance = true; }
@@ -1521,8 +1535,6 @@ public:
static LengthSize initialBorderRadius() { return LengthSize(Length(0, Fixed), Length(0, Fixed)); }
static ECaptionSide initialCaptionSide() { return CAPTOP; }
static EClear initialClear() { return CNONE; }
- 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; }
@@ -1560,6 +1572,7 @@ public:
static Length initialPadding() { return Length(Fixed); }
static Length initialTextIndent() { return Length(Fixed); }
static TextIndentLine initialTextIndentLine() { return TextIndentFirstLine; }
+ static TextIndentType initialTextIndentType() { return TextIndentNormal; }
static EVerticalAlign initialVerticalAlign() { return BASELINE; }
static short initialWidows() { return 2; }
static short initialOrphans() { return 2; }
@@ -1580,8 +1593,8 @@ public:
static EBoxOrient initialBoxOrient() { return HORIZONTAL; }
static EBoxPack initialBoxPack() { return Start; }
static float initialBoxFlex() { return 0.0f; }
- static unsigned int initialBoxFlexGroup() { return 1; }
- static unsigned int initialBoxOrdinalGroup() { return 1; }
+ static unsigned initialBoxFlexGroup() { return 1; }
+ static unsigned initialBoxOrdinalGroup() { return 1; }
static EBoxSizing initialBoxSizing() { return CONTENT_BOX; }
static StyleReflection* initialBoxReflect() { return 0; }
static float initialFlexGrow() { return 0; }
@@ -1589,11 +1602,15 @@ public:
static Length initialFlexBasis() { return Length(Auto); }
static int initialOrder() { return 0; }
static EAlignContent initialAlignContent() { return AlignContentStretch; }
- static EAlignItems initialAlignItems() { return AlignStretch; }
- static EAlignItems initialAlignSelf() { return AlignAuto; }
+ static ItemPosition initialAlignItems() { return ItemPositionStretch; }
+ static OverflowAlignment initialAlignItemsOverflowAlignment() { return OverflowAlignmentDefault; }
+ static ItemPosition initialAlignSelf() { return ItemPositionAuto; }
+ static OverflowAlignment initialAlignSelfOverflowAlignment() { return OverflowAlignmentDefault; }
static EFlexDirection initialFlexDirection() { return FlowRow; }
static EFlexWrap initialFlexWrap() { return FlexNoWrap; }
static EJustifyContent initialJustifyContent() { return JustifyFlexStart; }
+ static ItemPosition initialJustifySelf() { return ItemPositionAuto; }
+ static OverflowAlignment initialJustifySelfOverflowAlignment() { return OverflowAlignmentDefault; }
static int initialMarqueeLoopCount() { return -1; }
static int initialMarqueeSpeed() { return 85; }
static Length initialMarqueeIncrement() { return Length(6, Fixed); }
@@ -1653,15 +1670,16 @@ public:
static TouchActionDelay initialTouchActionDelay() { return TouchActionDelayScript; }
static ShadowList* initialBoxShadow() { return 0; }
static ShadowList* initialTextShadow() { return 0; }
+ static ScrollBehavior initialScrollBehavior() { return ScrollBehaviorInstant; }
// The initial value is 'none' for grid tracks.
- static Vector<GridTrackSize> initialGridDefinitionColumns() { return Vector<GridTrackSize>(); }
- static Vector<GridTrackSize> initialGridDefinitionRows() { return Vector<GridTrackSize>(); }
+ static Vector<GridTrackSize> initialGridTemplateColumns() { return Vector<GridTrackSize>(); }
+ static Vector<GridTrackSize> initialGridTemplateRows() { return Vector<GridTrackSize>(); }
static GridAutoFlow initialGridAutoFlow() { return AutoFlowNone; }
- static GridTrackSize initialGridAutoColumns() { return GridTrackSize(Auto); }
- static GridTrackSize initialGridAutoRows() { return GridTrackSize(Auto); }
+ static GridTrackSize initialGridAutoColumns() { return GridTrackSize(Length(Auto)); }
+ static GridTrackSize initialGridAutoRows() { return GridTrackSize(Length(Auto)); }
static NamedGridLinesMap initialNamedGridColumnLines() { return NamedGridLinesMap(); }
static NamedGridLinesMap initialNamedGridRowLines() { return NamedGridLinesMap(); }
@@ -1680,14 +1698,6 @@ public:
static unsigned initialTabSize() { return 8; }
- static const AtomicString& initialLineGrid() { return nullAtom; }
- static LineSnap initialLineSnap() { return LineSnapNone; }
- static LineAlign initialLineAlign() { return LineAlignNone; }
-
- static const AtomicString& initialFlowThread() { return nullAtom; }
- static const AtomicString& initialRegionThread() { return nullAtom; }
- static RegionFragment initialRegionFragment() { return AutoRegionFragment; }
-
static WrapFlow initialWrapFlow() { return WrapFlowAuto; }
static WrapThrough initialWrapThrough() { return WrapThroughWrap; }
@@ -1703,17 +1713,17 @@ public:
static EIsolation initialIsolation() { return IsolationAuto; }
private:
void setVisitedLinkColor(const Color&);
- void setVisitedLinkBackgroundColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBackgroundColor, v); }
- void setVisitedLinkBorderLeftColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderLeftColor, v); }
- void setVisitedLinkBorderRightColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderRightColor, v); }
- 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_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 setVisitedLinkBackgroundColor(const StyleColor& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBackgroundColor, v); }
+ void setVisitedLinkBorderLeftColor(const StyleColor& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderLeftColor, v); }
+ void setVisitedLinkBorderRightColor(const StyleColor& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderRightColor, v); }
+ void setVisitedLinkBorderBottomColor(const StyleColor& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderBottomColor, v); }
+ void setVisitedLinkBorderTopColor(const StyleColor& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderTopColor, v); }
+ void setVisitedLinkOutlineColor(const StyleColor& v) { SET_VAR(rareNonInheritedData, m_visitedLinkOutlineColor, v); }
+ void setVisitedLinkColumnRuleColor(const StyleColor& v) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_visitedLinkColumnRuleColor, v); }
+ void setVisitedLinkTextDecorationColor(const StyleColor& v) { SET_VAR(rareNonInheritedData, m_visitedLinkTextDecorationColor, v); }
+ void setVisitedLinkTextEmphasisColor(const StyleColor& v) { SET_VAR_WITH_SETTER(rareInheritedData, visitedLinkTextEmphasisColor, setVisitedLinkTextEmphasisColor, v); }
+ void setVisitedLinkTextFillColor(const StyleColor& v) { SET_VAR_WITH_SETTER(rareInheritedData, visitedLinkTextFillColor, setVisitedLinkTextFillColor, v); }
+ void setVisitedLinkTextStrokeColor(const StyleColor& v) { SET_VAR_WITH_SETTER(rareInheritedData, visitedLinkTextStrokeColor, setVisitedLinkTextStrokeColor, v); }
void inheritUnicodeBidiFrom(const RenderStyle* parent) { noninherited_flags._unicodeBidi = parent->noninherited_flags._unicodeBidi; }
void getShadowExtent(const ShadowList*, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const;
@@ -1741,31 +1751,30 @@ private:
}
// Color accessors are all private to make sure callers use visitedDependentColor instead to access them.
- 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(); }
- Color borderBottomColor() const { return surround->border.bottom().color(); }
- Color backgroundColor() const { return m_background->color(); }
+ StyleColor borderLeftColor() const { return surround->border.left().color(); }
+ StyleColor borderRightColor() const { return surround->border.right().color(); }
+ StyleColor borderTopColor() const { return surround->border.top().color(); }
+ StyleColor borderBottomColor() const { return surround->border.bottom().color(); }
+ StyleColor backgroundColor() const { return m_background->color(); }
Color color() const;
- Color columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }
- Color outlineColor() const { return m_background->outline().color(); }
- Color textEmphasisColor() const { return rareInheritedData->textEmphasisColor; }
- Color textFillColor() const { return rareInheritedData->textFillColor; }
- Color textStrokeColor() const { return rareInheritedData->textStrokeColor; }
+ StyleColor columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }
+ StyleColor outlineColor() const { return m_background->outline().color(); }
+ StyleColor textEmphasisColor() const { return rareInheritedData->textEmphasisColor(); }
+ StyleColor textFillColor() const { return rareInheritedData->textFillColor(); }
+ StyleColor textStrokeColor() const { return rareInheritedData->textStrokeColor(); }
Color visitedLinkColor() const;
- Color visitedLinkBackgroundColor() const { return rareNonInheritedData->m_visitedLinkBackgroundColor; }
- Color visitedLinkBorderLeftColor() const { return rareNonInheritedData->m_visitedLinkBorderLeftColor; }
- Color visitedLinkBorderRightColor() const { return rareNonInheritedData->m_visitedLinkBorderRightColor; }
- Color visitedLinkBorderBottomColor() const { return rareNonInheritedData->m_visitedLinkBorderBottomColor; }
- Color visitedLinkBorderTopColor() const { return rareNonInheritedData->m_visitedLinkBorderTopColor; }
- Color visitedLinkOutlineColor() const { return rareNonInheritedData->m_visitedLinkOutlineColor; }
- Color visitedLinkColumnRuleColor() const { return rareNonInheritedData->m_multiCol->m_visitedLinkColumnRuleColor; }
- Color textDecorationColor() const { return rareNonInheritedData->m_textDecorationColor; }
- Color visitedLinkTextDecorationColor() const { return rareNonInheritedData->m_visitedLinkTextDecorationColor; }
- Color visitedLinkTextEmphasisColor() const { return rareInheritedData->visitedLinkTextEmphasisColor; }
- Color visitedLinkTextFillColor() const { return rareInheritedData->visitedLinkTextFillColor; }
- Color visitedLinkTextStrokeColor() const { return rareInheritedData->visitedLinkTextStrokeColor; }
+ StyleColor visitedLinkBackgroundColor() const { return rareNonInheritedData->m_visitedLinkBackgroundColor; }
+ StyleColor visitedLinkBorderLeftColor() const { return rareNonInheritedData->m_visitedLinkBorderLeftColor; }
+ StyleColor visitedLinkBorderRightColor() const { return rareNonInheritedData->m_visitedLinkBorderRightColor; }
+ StyleColor visitedLinkBorderBottomColor() const { return rareNonInheritedData->m_visitedLinkBorderBottomColor; }
+ StyleColor visitedLinkBorderTopColor() const { return rareNonInheritedData->m_visitedLinkBorderTopColor; }
+ StyleColor visitedLinkOutlineColor() const { return rareNonInheritedData->m_visitedLinkOutlineColor; }
+ StyleColor visitedLinkColumnRuleColor() const { return rareNonInheritedData->m_multiCol->m_visitedLinkColumnRuleColor; }
+ StyleColor textDecorationColor() const { return rareNonInheritedData->m_textDecorationColor; }
+ StyleColor visitedLinkTextDecorationColor() const { return rareNonInheritedData->m_visitedLinkTextDecorationColor; }
+ StyleColor visitedLinkTextEmphasisColor() const { return rareInheritedData->visitedLinkTextEmphasisColor(); }
+ StyleColor visitedLinkTextFillColor() const { return rareInheritedData->visitedLinkTextFillColor(); }
+ StyleColor visitedLinkTextStrokeColor() const { return rareInheritedData->visitedLinkTextStrokeColor(); }
Color colorIncludingFallback(int colorProperty, bool visitedLink) const;
@@ -1774,22 +1783,32 @@ private:
Color lightingColor() const { return svgStyle()->lightingColor(); }
void appendContent(PassOwnPtr<ContentData>);
- StyleDifference repaintOnlyDiff(const RenderStyle* other, unsigned& changedContextSensitiveProperties) const;
+ void addAppliedTextDecoration(const AppliedTextDecoration&);
+
+ bool diffNeedsFullLayoutAndRepaint(const RenderStyle& other) const;
+ bool diffNeedsFullLayout(const RenderStyle& other) const;
+ bool diffNeedsRepaintLayer(const RenderStyle& other) const;
+ bool diffNeedsRepaintObject(const RenderStyle& other) const;
+ bool diffNeedsRecompositeLayer(const RenderStyle& other) const;
+ unsigned computeChangedContextSensitiveProperties(const RenderStyle& other, StyleDifference) const;
};
+// FIXME: Reduce/remove the dependency on zoom adjusted int values.
+// The float or LayoutUnit versions of layout values should be used.
inline int adjustForAbsoluteZoom(int value, float zoomFactor)
{
if (zoomFactor == 1)
return value;
// Needed because computeLengthInt truncates (rather than rounds) when scaling up.
+ float fvalue = value;
if (zoomFactor > 1) {
if (value < 0)
- value--;
+ fvalue -= 0.5f;
else
- value++;
+ fvalue += 0.5f;
}
- return roundForImpreciseConversion<int>(value / zoomFactor);
+ return roundForImpreciseConversion<int>(fvalue / zoomFactor);
}
inline int adjustForAbsoluteZoom(int value, const RenderStyle* style)
@@ -1802,6 +1821,11 @@ inline float adjustFloatForAbsoluteZoom(float value, const RenderStyle& style)
return value / style.effectiveZoom();
}
+inline double adjustDoubleForAbsoluteZoom(double value, const RenderStyle& style)
+{
+ return value / style.effectiveZoom();
+}
+
inline LayoutUnit adjustLayoutUnitForAbsoluteZoom(LayoutUnit value, const RenderStyle& style)
{
return value / style.effectiveZoom();
@@ -1830,8 +1854,6 @@ inline bool RenderStyle::isSharable() const
return false;
if (hasUniquePseudoStyle())
return false;
- if (transitions() || animations())
- return false;
return true;
}
@@ -1863,6 +1885,13 @@ inline void RenderStyle::setHasPseudoStyle(PseudoId pseudo)
noninherited_flags._pseudoBits |= 1 << (pseudo - 1);
}
+inline bool RenderStyle::hasPseudoElementStyle() const
+{
+ return noninherited_flags._pseudoBits & PSEUDO_ELEMENT_MASK;
+}
+
+float calcBorderRadiiConstraintScaleFor(const FloatRect&, const FloatRoundedRect::Radii&);
+
} // namespace WebCore
#endif // RenderStyle_h
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/RenderStyleConstants.h b/chromium/third_party/WebKit/Source/core/rendering/style/RenderStyleConstants.h
index 45531d20231..f2a3d006af0 100755..100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/RenderStyleConstants.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/RenderStyleConstants.h
@@ -31,9 +31,11 @@ namespace WebCore {
enum StyleRecalcChange {
NoChange,
NoInherit,
+ UpdatePseudoElements,
Inherit,
Force,
Reattach,
+ ReattachNoRenderer
};
static const size_t PrintColorAdjustBits = 1;
@@ -42,37 +44,18 @@ enum PrintColorAdjust {
PrintColorAdjustExact
};
-// The difference between two styles. The following values are used:
-// (1) StyleDifferenceEqual - The two styles are identical.
-// (2) StyleDifferenceRecompositeLayer - The layer needs its position and transform updated, but no repaint.
-// (3) StyleDifferenceRepaint - The object just needs to be repainted.
-// (4) StyleDifferenceRepaintIfTextOrColorChange - The object needs to be repainted if it contains text or properties dependent on color (e.g., border or outline).
-// (5) StyleDifferenceRepaintLayer - The layer and its descendant layers needs to be repainted.
-// (6) StyleDifferenceLayoutPositionedMovementOnly - Only the position of this positioned object has been updated.
-// (7) StyleDifferenceSimplifiedLayout - Only overflow needs to be recomputed.
-// (8) StyleDifferenceSimplifiedLayoutAndPositionedMovement - Both positioned movement and simplified layout updates are required.
-// (9) StyleDifferenceLayout - A full layout is required.
-enum StyleDifference {
- StyleDifferenceEqual,
- StyleDifferenceRecompositeLayer,
- StyleDifferenceRepaint,
- StyleDifferenceRepaintIfTextOrColorChange,
- StyleDifferenceRepaintLayer,
- StyleDifferenceLayoutPositionedMovementOnly,
- StyleDifferenceSimplifiedLayout,
- StyleDifferenceSimplifiedLayoutAndPositionedMovement,
- StyleDifferenceLayout
-};
-
// When some style properties change, different amounts of work have to be done depending on
// context (e.g. whether the property is changing on an element which has a compositing layer).
// A simple StyleDifference does not provide enough information so we return a bit mask of
-// StyleDifferenceContextSensitiveProperties from RenderStyle::diff() too.
+// StyleDifferenceContextSensitiveProperties from RenderStyle::visualInvalidationDiff() too.
enum StyleDifferenceContextSensitiveProperty {
ContextSensitivePropertyNone = 0,
ContextSensitivePropertyTransform = (1 << 0),
ContextSensitivePropertyOpacity = (1 << 1),
- ContextSensitivePropertyFilter = (1 << 2)
+ ContextSensitivePropertyZIndex = (1 << 2),
+ ContextSensitivePropertyFilter = (1 << 3),
+ // The object needs to be repainted if it contains text or properties dependent on color (e.g., border or outline).
+ ContextSensitivePropertyTextOrColor = (1 << 4)
};
// Static pseudo styles. Dynamic ones are produced on the fly.
@@ -81,13 +64,13 @@ enum PseudoId {
// If you add or remove a public ID, you must update _pseudoBits in RenderStyle.
NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, BACKDROP, SELECTION, FIRST_LINE_INHERITED, SCROLLBAR,
// Internal IDs follow:
- SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER,
- INPUT_LIST_BUTTON,
+ SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER, INPUT_LIST_BUTTON,
+ // Special values follow:
AFTER_LAST_INTERNAL_PSEUDOID,
- FULL_SCREEN, FULL_SCREEN_DOCUMENT, FULL_SCREEN_ANCESTOR,
FIRST_PUBLIC_PSEUDOID = FIRST_LINE,
FIRST_INTERNAL_PSEUDOID = SCROLLBAR_THUMB,
- PUBLIC_PSEUDOID_MASK = ((1 << FIRST_INTERNAL_PSEUDOID) - 1) & ~((1 << FIRST_PUBLIC_PSEUDOID) - 1)
+ PUBLIC_PSEUDOID_MASK = ((1 << FIRST_INTERNAL_PSEUDOID) - 1) & ~((1 << FIRST_PUBLIC_PSEUDOID) - 1),
+ PSEUDO_ELEMENT_MASK = (1 << (BEFORE - 1)) | (1 << (AFTER - 1)) | (1 << (BACKDROP - 1))
};
enum ColumnFill { ColumnFillBalance, ColumnFillAuto };
@@ -191,7 +174,6 @@ 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 EJustifyContent { JustifyFlexStart, JustifyFlexEnd, JustifyCenter, JustifySpaceBetween, JustifySpaceAround };
@@ -330,11 +312,9 @@ enum QuoteType {
enum EBorderFit { BorderFitBorder, BorderFitLines };
-enum EAnimationFillMode { AnimationFillModeNone, AnimationFillModeForwards, AnimationFillModeBackwards, AnimationFillModeBoth };
-
enum EAnimPlayState {
- AnimPlayStatePlaying = 0x0,
- AnimPlayStatePaused = 0x1
+ AnimPlayStatePlaying,
+ AnimPlayStatePaused
};
enum EWhiteSpace {
@@ -413,8 +393,8 @@ enum ECursor {
CURSOR_PROGRESS,
CURSOR_NO_DROP,
CURSOR_NOT_ALLOWED,
- CURSOR_WEBKIT_ZOOM_IN,
- CURSOR_WEBKIT_ZOOM_OUT,
+ CURSOR_ZOOM_IN,
+ CURSOR_ZOOM_OUT,
CURSOR_E_RESIZE,
CURSOR_NE_RESIZE,
CURSOR_NW_RESIZE,
@@ -450,7 +430,9 @@ enum EDisplay {
TABLE_CAPTION, BOX, INLINE_BOX,
FLEX, INLINE_FLEX,
GRID, INLINE_GRID,
- NONE
+ NONE,
+ FIRST_TABLE_DISPLAY = TABLE,
+ LAST_TABLE_DISPLAY = TABLE_CAPTION
};
enum EInsideLink {
@@ -495,16 +477,6 @@ enum ImageResolutionSnap { ImageResolutionNoSnap = 0, ImageResolutionSnapPixels
enum Order { LogicalOrder = 0, VisualOrder };
-enum RegionFragment { AutoRegionFragment, BreakRegionFragment };
-
-enum ColumnAxis { HorizontalColumnAxis, VerticalColumnAxis, AutoColumnAxis };
-
-enum ColumnProgression { NormalColumnProgression, ReverseColumnProgression };
-
-enum LineSnap { LineSnapNone, LineSnapBaseline, LineSnapContain };
-
-enum LineAlign { LineAlignNone, LineAlignEdges };
-
enum WrapFlow { WrapFlowAuto, WrapFlowBoth, WrapFlowStart, WrapFlowEnd, WrapFlowMaximum, WrapFlowClear };
enum WrapThrough { WrapThroughWrap, WrapThroughNone };
@@ -515,12 +487,13 @@ enum GridAutoFlow { AutoFlowNone, AutoFlowColumn, AutoFlowRow };
enum DraggableRegionMode { DraggableRegionNone, DraggableRegionDrag, DraggableRegionNoDrag };
-static const size_t TouchActionBits = 3;
+static const size_t TouchActionBits = 4;
enum TouchAction {
TouchActionAuto = 0x0,
TouchActionNone = 0x1,
TouchActionPanX = 0x2,
- TouchActionPanY = 0x4
+ TouchActionPanY = 0x4,
+ TouchActionPinchZoom = 0x8,
};
inline TouchAction operator| (TouchAction a, TouchAction b) { return TouchAction(int(a) | int(b)); }
inline TouchAction& operator|= (TouchAction& a, TouchAction b) { return a = a | b; }
@@ -531,12 +504,34 @@ enum EIsolation { IsolationAuto, IsolationIsolate };
enum TouchActionDelay { TouchActionDelayNone, TouchActionDelayScript };
+enum ItemPosition {
+ ItemPositionAuto,
+ ItemPositionStretch,
+ ItemPositionBaseline,
+ ItemPositionCenter,
+ ItemPositionStart,
+ ItemPositionEnd,
+ ItemPositionSelfStart,
+ ItemPositionSelfEnd,
+ ItemPositionFlexStart,
+ ItemPositionFlexEnd,
+ ItemPositionLeft,
+ ItemPositionRight
+};
+
+enum OverflowAlignment {
+ OverflowAlignmentDefault,
+ OverflowAlignmentTrue,
+ OverflowAlignmentSafe
+};
+
// Reasonable maximum to prevent insane font sizes from causing crashes on some platforms (such as Windows).
static const float maximumAllowedFontSize = 1000000.0f;
enum TextIndentLine { TextIndentFirstLine, TextIndentEachLine };
+enum TextIndentType { TextIndentNormal, TextIndentHanging };
-enum LayoutBox { MarginBox, BorderBox, PaddingBox, ContentBox };
+enum CSSBoxType { BoxMissing = 0, MarginBox, BorderBox, PaddingBox, ContentBox };
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp
index 947c39db641..2e0646ed587 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp
@@ -40,7 +40,6 @@ SVGRenderStyle::SVGRenderStyle()
fill = defaultStyle->fill;
stroke = defaultStyle->stroke;
- text = defaultStyle->text;
stops = defaultStyle->stops;
misc = defaultStyle->misc;
inheritedResources = defaultStyle->inheritedResources;
@@ -55,7 +54,6 @@ SVGRenderStyle::SVGRenderStyle(CreateDefaultType)
fill.init();
stroke.init();
- text.init();
stops.init();
misc.init();
inheritedResources.init();
@@ -67,7 +65,6 @@ SVGRenderStyle::SVGRenderStyle(const SVGRenderStyle& other)
{
fill = other.fill;
stroke = other.stroke;
- text = other.text;
stops = other.stops;
misc = other.misc;
inheritedResources = other.inheritedResources;
@@ -85,7 +82,6 @@ bool SVGRenderStyle::operator==(const SVGRenderStyle& other) const
{
return fill == other.fill
&& stroke == other.stroke
- && text == other.text
&& stops == other.stops
&& misc == other.misc
&& inheritedResources == other.inheritedResources
@@ -98,7 +94,6 @@ bool SVGRenderStyle::inheritedNotEqual(const SVGRenderStyle* other) const
{
return fill != other->fill
|| stroke != other->stroke
- || text != other->text
|| inheritedResources != other->inheritedResources
|| svg_inherited_flags != other->svg_inherited_flags;
}
@@ -110,7 +105,6 @@ void SVGRenderStyle::inheritFrom(const SVGRenderStyle* svgInheritParent)
fill = svgInheritParent->fill;
stroke = svgInheritParent->stroke;
- text = svgInheritParent->text;
inheritedResources = svgInheritParent->inheritedResources;
svg_inherited_flags = svgInheritParent->svg_inherited_flags;
@@ -126,19 +120,27 @@ void SVGRenderStyle::copyNonInheritedFrom(const SVGRenderStyle* other)
StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const
{
- // NOTE: All comparisions that may return StyleDifferenceLayout have to go before those who return StyleDifferenceRepaint
+ StyleDifference styleDifference;
- // If kerning changes, we need a relayout, to force SVGCharacterData to be recalculated in the SVGRootInlineBox.
- if (text != other->text)
- return StyleDifferenceLayout;
+ if (diffNeedsLayoutAndRepaint(other)) {
+ styleDifference.setNeedsFullLayout();
+ styleDifference.setNeedsRepaintObject();
+ } else if (diffNeedsRepaint(other)) {
+ styleDifference.setNeedsRepaintObject();
+ }
+
+ return styleDifference;
+}
+bool SVGRenderStyle::diffNeedsLayoutAndRepaint(const SVGRenderStyle* other) const
+{
// If resources change, we need a relayout, as the presence of resources influences the repaint rect.
if (resources != other->resources)
- return StyleDifferenceLayout;
+ return true;
// If markers change, we need a relayout, as marker boundaries are cached in RenderSVGPath.
if (inheritedResources != other->inheritedResources)
- return StyleDifferenceLayout;
+ return true;
// All text related properties influence layout.
if (svg_inherited_flags._textAnchor != other->svg_inherited_flags._textAnchor
@@ -148,20 +150,23 @@ StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const
|| svg_noninherited_flags.f._alignmentBaseline != other->svg_noninherited_flags.f._alignmentBaseline
|| svg_noninherited_flags.f._dominantBaseline != other->svg_noninherited_flags.f._dominantBaseline
|| svg_noninherited_flags.f._baselineShift != other->svg_noninherited_flags.f._baselineShift)
- return StyleDifferenceLayout;
+ return true;
// Text related properties influence layout.
- bool miscNotEqual = misc != other->misc;
- if (miscNotEqual && misc->baselineShiftValue != other->misc->baselineShiftValue)
- return StyleDifferenceLayout;
+ if (misc->baselineShiftValue != other->misc->baselineShiftValue)
+ return true;
// These properties affect the cached stroke bounding box rects.
if (svg_inherited_flags._capStyle != other->svg_inherited_flags._capStyle
|| svg_inherited_flags._joinStyle != other->svg_inherited_flags._joinStyle)
- return StyleDifferenceLayout;
+ return true;
+
+ // vector-effect changes require a re-layout.
+ if (svg_noninherited_flags.f._vectorEffect != other->svg_noninherited_flags.f._vectorEffect)
+ return true;
// Some stroke properties, requires relayouts, as the cached stroke boundaries need to be recalculated.
- if (stroke != other->stroke) {
+ if (stroke.get() != other->stroke.get()) {
if (stroke->width != other->stroke->width
|| stroke->paintType != other->stroke->paintType
|| stroke->paintColor != other->stroke->paintColor
@@ -172,35 +177,37 @@ StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const
|| stroke->visitedLinkPaintColor != other->stroke->visitedLinkPaintColor
|| stroke->visitedLinkPaintUri != other->stroke->visitedLinkPaintUri
|| stroke->visitedLinkPaintType != other->stroke->visitedLinkPaintType)
- return StyleDifferenceLayout;
-
- // Only the stroke-opacity case remains, where we only need a repaint.
- ASSERT(stroke->opacity != other->stroke->opacity);
- return StyleDifferenceRepaint;
+ return true;
}
- // vector-effect changes require a re-layout.
- if (svg_noninherited_flags.f._vectorEffect != other->svg_noninherited_flags.f._vectorEffect)
- return StyleDifferenceLayout;
+ return false;
+}
- // NOTE: All comparisions below may only return StyleDifferenceRepaint
+bool SVGRenderStyle::diffNeedsRepaint(const SVGRenderStyle* other) const
+{
+ if (stroke->opacity != other->stroke->opacity)
+ return true;
// Painting related properties only need repaints.
- if (miscNotEqual) {
+ if (misc.get() != other->misc.get()) {
if (misc->floodColor != other->misc->floodColor
|| misc->floodOpacity != other->misc->floodOpacity
|| misc->lightingColor != other->misc->lightingColor)
- return StyleDifferenceRepaint;
+ return true;
}
// If fill changes, we just need to repaint. Fill boundaries are not influenced by this, only by the Path, that RenderSVGPath contains.
- if (fill->paintType != other->fill->paintType || fill->paintColor != other->fill->paintColor
- || fill->paintUri != other->fill->paintUri || fill->opacity != other->fill->opacity)
- return StyleDifferenceRepaint;
+ if (fill.get() != other->fill.get()) {
+ if (fill->paintType != other->fill->paintType
+ || fill->paintColor != other->fill->paintColor
+ || fill->paintUri != other->fill->paintUri
+ || fill->opacity != other->fill->opacity)
+ return true;
+ }
// If gradient stops change, we just need to repaint. Style updates are already handled through RenderSVGGradientSTop.
if (stops != other->stops)
- return StyleDifferenceRepaint;
+ return true;
// Changes of these flags only cause repaints.
if (svg_inherited_flags._colorRendering != other->svg_inherited_flags._colorRendering
@@ -210,15 +217,15 @@ StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const
|| svg_inherited_flags._colorInterpolation != other->svg_inherited_flags._colorInterpolation
|| svg_inherited_flags._colorInterpolationFilters != other->svg_inherited_flags._colorInterpolationFilters
|| svg_inherited_flags._paintOrder != other->svg_inherited_flags._paintOrder)
- return StyleDifferenceRepaint;
+ return true;
if (svg_noninherited_flags.f.bufferedRendering != other->svg_noninherited_flags.f.bufferedRendering)
- return StyleDifferenceRepaint;
+ return true;
if (svg_noninherited_flags.f.maskType != other->svg_noninherited_flags.f.maskType)
- return StyleDifferenceRepaint;
+ return true;
- return StyleDifferenceEqual;
+ return false;
}
EPaintOrderType SVGRenderStyle::paintOrderType(unsigned index) const
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.h b/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.h
index dba333e1ddf..128ed626aa7 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.h
@@ -28,16 +28,13 @@
#include "core/rendering/style/DataRef.h"
#include "core/rendering/style/RenderStyleConstants.h"
#include "core/rendering/style/SVGRenderStyleDefs.h"
+#include "core/rendering/style/StyleDifference.h"
#include "core/svg/SVGPaint.h"
#include "platform/graphics/GraphicsTypes.h"
#include "platform/graphics/Path.h"
namespace WebCore {
-class FloatRect;
-class IntRect;
-class RenderObject;
-
class SVGRenderStyle : public RefCounted<SVGRenderStyle> {
public:
static PassRefPtr<SVGRenderStyle> create() { return adoptRef(new SVGRenderStyle); }
@@ -79,48 +76,41 @@ public:
static SVGPaint::SVGPaintType initialStrokePaintType() { return SVGPaint::SVG_PAINTTYPE_NONE; }
static Color initialStrokePaintColor() { return Color(); }
static String initialStrokePaintUri() { return String(); }
- static Vector<SVGLength> initialStrokeDashArray() { return Vector<SVGLength>(); }
+ static PassRefPtr<SVGLengthList> initialStrokeDashArray() { return SVGLengthList::create(); }
static float initialStrokeMiterLimit() { return 4; }
static float initialStopOpacity() { return 1; }
static Color initialStopColor() { return Color(0, 0, 0); }
static float initialFloodOpacity() { return 1; }
static Color initialFloodColor() { return Color(0, 0, 0); }
static Color initialLightingColor() { return Color(255, 255, 255); }
- 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 const AtomicString& initialClipperResource() { return nullAtom; }
+ static const AtomicString& initialFilterResource() { return nullAtom; }
+ static const AtomicString& initialMaskerResource() { return nullAtom; }
+ static const AtomicString& initialMarkerStartResource() { return nullAtom; }
+ static const AtomicString& initialMarkerMidResource() { return nullAtom; }
+ static const AtomicString& initialMarkerEndResource() { return nullAtom; }
static EMaskType initialMaskType() { return MT_LUMINANCE; }
static EPaintOrder initialPaintOrder() { return PO_NORMAL; }
- static SVGLength initialBaselineShiftValue()
- {
- SVGLength length;
- length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION);
- return length;
- }
-
- static SVGLength initialKerning()
+ static PassRefPtr<SVGLength> initialBaselineShiftValue()
{
- SVGLength length;
- length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION);
- return length;
+ RefPtr<SVGLength> length = SVGLength::create();
+ length->newValueSpecifiedUnits(LengthTypeNumber, 0);
+ return length.release();
}
- static SVGLength initialStrokeDashOffset()
+ static PassRefPtr<SVGLength> initialStrokeDashOffset()
{
- SVGLength length;
- length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION);
- return length;
+ RefPtr<SVGLength> length = SVGLength::create();
+ length->newValueSpecifiedUnits(LengthTypeNumber, 0);
+ return length.release();
}
- static SVGLength initialStrokeWidth()
+ static PassRefPtr<SVGLength> initialStrokeWidth()
{
- SVGLength length;
- length.newValueSpecifiedUnits(LengthTypeNumber, 1, ASSERT_NO_EXCEPTION);
- return length;
+ RefPtr<SVGLength> length = SVGLength::create();
+ length->newValueSpecifiedUnits(LengthTypeNumber, 1);
+ return length.release();
}
// SVG CSS Property setters
@@ -196,7 +186,7 @@ public:
}
}
- void setStrokeDashArray(const Vector<SVGLength>& obj)
+ void setStrokeDashArray(PassRefPtr<SVGLengthList> obj)
{
if (!(stroke->dashArray == obj))
stroke.access()->dashArray = obj;
@@ -208,24 +198,18 @@ public:
stroke.access()->miterLimit = obj;
}
- void setStrokeWidth(const SVGLength& obj)
+ void setStrokeWidth(PassRefPtr<SVGLength> obj)
{
if (!(stroke->width == obj))
stroke.access()->width = obj;
}
- void setStrokeDashOffset(const SVGLength& obj)
+ void setStrokeDashOffset(PassRefPtr<SVGLength> obj)
{
if (!(stroke->dashOffset == obj))
stroke.access()->dashOffset = obj;
}
- void setKerning(const SVGLength& obj)
- {
- if (!(text->kerning == obj))
- text.access()->kerning = obj;
- }
-
void setStopOpacity(float obj)
{
if (!(stops->opacity == obj))
@@ -256,45 +240,45 @@ public:
misc.access()->lightingColor = obj;
}
- void setBaselineShiftValue(const SVGLength& obj)
+ void setBaselineShiftValue(PassRefPtr<SVGLength> obj)
{
if (!(misc->baselineShiftValue == obj))
misc.access()->baselineShiftValue = obj;
}
// Setters for non-inherited resources
- void setClipperResource(const String& obj)
+ void setClipperResource(const AtomicString& obj)
{
if (!(resources->clipper == obj))
resources.access()->clipper = obj;
}
- void setFilterResource(const String& obj)
+ void setFilterResource(const AtomicString& obj)
{
if (!(resources->filter == obj))
resources.access()->filter = obj;
}
- void setMaskerResource(const String& obj)
+ void setMaskerResource(const AtomicString& obj)
{
if (!(resources->masker == obj))
resources.access()->masker = obj;
}
// Setters for inherited resources
- void setMarkerStartResource(const String& obj)
+ void setMarkerStartResource(const AtomicString& obj)
{
if (!(inheritedResources->markerStart == obj))
inheritedResources.access()->markerStart = obj;
}
- void setMarkerMidResource(const String& obj)
+ void setMarkerMidResource(const AtomicString& obj)
{
if (!(inheritedResources->markerMid == obj))
inheritedResources.access()->markerMid = obj;
}
- void setMarkerEndResource(const String& obj)
+ void setMarkerEndResource(const AtomicString& obj)
{
if (!(inheritedResources->markerEnd == obj))
inheritedResources.access()->markerEnd = obj;
@@ -326,23 +310,22 @@ public:
const SVGPaint::SVGPaintType& strokePaintType() const { return stroke->paintType; }
const Color& strokePaintColor() const { return stroke->paintColor; }
const String& strokePaintUri() const { return stroke->paintUri; }
- Vector<SVGLength> strokeDashArray() const { return stroke->dashArray; }
+ SVGLengthList* strokeDashArray() const { return stroke->dashArray.get(); }
float strokeMiterLimit() const { return stroke->miterLimit; }
- SVGLength strokeWidth() const { return stroke->width; }
- SVGLength strokeDashOffset() const { return stroke->dashOffset; }
- SVGLength kerning() const { return text->kerning; }
+ SVGLength* strokeWidth() const { return stroke->width.get(); }
+ SVGLength* strokeDashOffset() const { return stroke->dashOffset.get(); }
float stopOpacity() const { return stops->opacity; }
const Color& stopColor() const { return stops->color; }
float floodOpacity() const { return misc->floodOpacity; }
const Color& floodColor() const { return misc->floodColor; }
const Color& lightingColor() const { return misc->lightingColor; }
- SVGLength baselineShiftValue() const { return misc->baselineShiftValue; }
- 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; }
+ SVGLength* baselineShiftValue() const { return misc->baselineShiftValue.get(); }
+ const AtomicString& clipperResource() const { return resources->clipper; }
+ const AtomicString& filterResource() const { return resources->filter; }
+ const AtomicString& maskerResource() const { return resources->masker; }
+ const AtomicString& markerStartResource() const { return inheritedResources->markerStart; }
+ const AtomicString& markerMidResource() const { return inheritedResources->markerMid; }
+ const AtomicString& markerEndResource() const { return inheritedResources->markerEnd; }
EMaskType maskType() const { return (EMaskType) svg_noninherited_flags.f.maskType; }
EPaintOrder paintOrder() const { return (EPaintOrder) svg_inherited_flags._paintOrder; }
EPaintOrderType paintOrderType(unsigned index) const;
@@ -360,7 +343,7 @@ public:
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 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; }
@@ -427,7 +410,6 @@ protected:
// inherited attributes
DataRef<StyleFillData> fill;
DataRef<StyleStrokeData> stroke;
- DataRef<StyleTextData> text;
DataRef<StyleInheritedResourceData> inheritedResources;
// non-inherited attributes
@@ -442,6 +424,9 @@ private:
SVGRenderStyle(const SVGRenderStyle&);
SVGRenderStyle(CreateDefaultType); // Used to create the default style.
+ bool diffNeedsLayoutAndRepaint(const SVGRenderStyle* other) const;
+ bool diffNeedsRepaint(const SVGRenderStyle* other) const;
+
void setBitDefaults()
{
svg_inherited_flags._clipRule = initialClipRule();
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyleDefs.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyleDefs.cpp
index 56e4a06ed5f..7a7f562b4d3 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyleDefs.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyleDefs.cpp
@@ -86,9 +86,9 @@ StyleStrokeData::StyleStrokeData(const StyleStrokeData& other)
: RefCounted<StyleStrokeData>()
, opacity(other.opacity)
, miterLimit(other.miterLimit)
- , width(other.width)
- , dashOffset(other.dashOffset)
- , dashArray(other.dashArray)
+ , width(other.width->clone())
+ , dashOffset(other.dashOffset->clone())
+ , dashArray(other.dashArray->clone())
, paintType(other.paintType)
, paintColor(other.paintColor)
, paintUri(other.paintUri)
@@ -100,11 +100,11 @@ StyleStrokeData::StyleStrokeData(const StyleStrokeData& other)
bool StyleStrokeData::operator==(const StyleStrokeData& other) const
{
- return width == other.width
+ return *width == *other.width
&& opacity == other.opacity
&& miterLimit == other.miterLimit
- && dashOffset == other.dashOffset
- && dashArray == other.dashArray
+ && *dashOffset == *other.dashOffset
+ && *dashArray == *other.dashArray
&& paintType == other.paintType
&& paintColor == other.paintColor
&& paintUri == other.paintUri
@@ -132,22 +132,6 @@ bool StyleStopData::operator==(const StyleStopData& other) const
&& opacity == other.opacity;
}
-StyleTextData::StyleTextData()
- : kerning(SVGRenderStyle::initialKerning())
-{
-}
-
-StyleTextData::StyleTextData(const StyleTextData& other)
- : RefCounted<StyleTextData>()
- , kerning(other.kerning)
-{
-}
-
-bool StyleTextData::operator==(const StyleTextData& other) const
-{
- return kerning == other.kerning;
-}
-
StyleMiscData::StyleMiscData()
: floodColor(SVGRenderStyle::initialFloodColor())
, floodOpacity(SVGRenderStyle::initialFloodOpacity())
@@ -161,7 +145,7 @@ StyleMiscData::StyleMiscData(const StyleMiscData& other)
, floodColor(other.floodColor)
, floodOpacity(other.floodOpacity)
, lightingColor(other.lightingColor)
- , baselineShiftValue(other.baselineShiftValue)
+ , baselineShiftValue(other.baselineShiftValue->clone())
{
}
@@ -170,7 +154,7 @@ bool StyleMiscData::operator==(const StyleMiscData& other) const
return floodOpacity == other.floodOpacity
&& floodColor == other.floodColor
&& lightingColor == other.lightingColor
- && baselineShiftValue == other.baselineShiftValue;
+ && *baselineShiftValue == *other.baselineShiftValue;
}
StyleResourceData::StyleResourceData()
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyleDefs.h b/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyleDefs.h
index 9b32f78a578..abd12379dd6 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyleDefs.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyleDefs.h
@@ -29,6 +29,7 @@
#define SVGRenderStyleDefs_h
#include "core/svg/SVGLength.h"
+#include "core/svg/SVGLengthList.h"
#include "core/svg/SVGPaint.h"
#include "wtf/OwnPtr.h"
#include "wtf/PassOwnPtr.h"
@@ -103,10 +104,6 @@ namespace WebCore {
typedef unsigned EPaintOrder;
const unsigned PO_NORMAL = PT_FILL | PT_STROKE << 2 | PT_MARKERS << 4;
- class CSSValue;
- class CSSValueList;
- class SVGPaint;
-
// Inherited/Non-Inherited Style Datastructures
class StyleFillData : public RefCounted<StyleFillData> {
public:
@@ -146,9 +143,9 @@ namespace WebCore {
float opacity;
float miterLimit;
- SVGLength width;
- SVGLength dashOffset;
- Vector<SVGLength> dashArray;
+ RefPtr<SVGLength> width;
+ RefPtr<SVGLength> dashOffset;
+ RefPtr<SVGLengthList> dashArray;
SVGPaint::SVGPaintType paintType;
Color paintColor;
@@ -181,24 +178,6 @@ namespace WebCore {
StyleStopData(const StyleStopData&);
};
- class StyleTextData : public RefCounted<StyleTextData> {
- public:
- static PassRefPtr<StyleTextData> create() { return adoptRef(new StyleTextData); }
- PassRefPtr<StyleTextData> copy() const { return adoptRef(new StyleTextData(*this)); }
-
- bool operator==(const StyleTextData& other) const;
- bool operator!=(const StyleTextData& other) const
- {
- return !(*this == other);
- }
-
- SVGLength kerning;
-
- private:
- StyleTextData();
- StyleTextData(const StyleTextData&);
- };
-
// Note: the rule for this class is, *no inheritance* of these props
class StyleMiscData : public RefCounted<StyleMiscData> {
public:
@@ -215,8 +194,7 @@ namespace WebCore {
float floodOpacity;
Color lightingColor;
- // non-inherited text stuff lives here not in StyleTextData.
- SVGLength baselineShiftValue;
+ RefPtr<SVGLength> baselineShiftValue;
private:
StyleMiscData();
@@ -235,9 +213,9 @@ namespace WebCore {
return !(*this == other);
}
- String clipper;
- String filter;
- String masker;
+ AtomicString clipper;
+ AtomicString filter;
+ AtomicString masker;
private:
StyleResourceData();
@@ -256,9 +234,9 @@ namespace WebCore {
return !(*this == other);
}
- String markerStart;
- String markerMid;
- String markerEnd;
+ AtomicString markerStart;
+ AtomicString markerMid;
+ AtomicString markerEnd;
private:
StyleInheritedResourceData();
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/ShadowData.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/ShadowData.cpp
index 7f81d909f6b..d89b03e74e8 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/ShadowData.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/ShadowData.cpp
@@ -41,7 +41,7 @@ ShadowData ShadowData::blend(const ShadowData& from, double progress) const
return *this;
return ShadowData(WebCore::blend(from.location(), location(), progress),
- clampTo<int>(WebCore::blend(from.blur(), blur(), progress), 0),
+ clampTo(WebCore::blend(from.blur(), blur(), progress), 0.0f),
WebCore::blend(from.spread(), spread(), progress),
style(),
WebCore::blend(from.color(), color(), progress));
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/ShadowData.h b/chromium/third_party/WebKit/Source/core/rendering/style/ShadowData.h
index 574b3f8214e..fa5a063cf34 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/ShadowData.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/ShadowData.h
@@ -25,7 +25,7 @@
#ifndef ShadowData_h
#define ShadowData_h
-#include "platform/geometry/IntPoint.h"
+#include "platform/geometry/FloatPoint.h"
#include "platform/graphics/Color.h"
namespace WebCore {
@@ -36,7 +36,7 @@ enum ShadowStyle { Normal, Inset };
class ShadowData {
WTF_MAKE_FAST_ALLOCATED;
public:
- ShadowData(const IntPoint& location, int blur, int spread, ShadowStyle style, const Color& color)
+ ShadowData(const FloatPoint& location, float blur, float spread, ShadowStyle style, const Color& color)
: m_location(location)
, m_blur(blur)
, m_spread(spread)
@@ -50,18 +50,19 @@ public:
ShadowData blend(const ShadowData& from, double progress) const;
- int x() const { return m_location.x(); }
- int y() const { return m_location.y(); }
- IntPoint location() const { return m_location; }
- int blur() const { return m_blur; }
- int spread() const { return m_spread; }
+ float x() const { return m_location.x(); }
+ float y() const { return m_location.y(); }
+ FloatPoint location() const { return m_location; }
+ float blur() const { return m_blur; }
+ float spread() const { return m_spread; }
ShadowStyle style() const { return m_style; }
const Color& color() const { return m_color; }
private:
- IntPoint m_location;
- int m_blur;
- int m_spread;
+ FloatPoint m_location;
+ float m_blur;
+ float m_spread;
+ // FIXME: We should use StyleColor here to allow currentColor to work correctly with visited links
Color m_color;
ShadowStyle m_style;
};
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/ShadowList.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/ShadowList.cpp
index 675effec90b..b0f414a1162 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/ShadowList.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/ShadowList.cpp
@@ -32,11 +32,10 @@
#include "core/rendering/style/ShadowList.h"
#include "platform/geometry/FloatRect.h"
-#include "platform/geometry/LayoutRect.h"
namespace WebCore {
-static inline void calculateShadowExtent(const ShadowList* shadowList, int additionalOutlineSize, int& shadowLeft, int& shadowRight, int& shadowTop, int& shadowBottom)
+static inline void calculateShadowExtent(const ShadowList* shadowList, float additionalOutlineSize, float& shadowLeft, float& shadowRight, float& shadowTop, float& shadowBottom)
{
ASSERT(shadowList);
size_t shadowCount = shadowList->shadows().size();
@@ -44,7 +43,7 @@ static inline void calculateShadowExtent(const ShadowList* shadowList, int addit
const ShadowData& shadow = shadowList->shadows()[i];
if (shadow.style() == Inset)
continue;
- int blurAndSpread = shadow.blur() + shadow.spread() + additionalOutlineSize;
+ float blurAndSpread = shadow.blur() + shadow.spread() + additionalOutlineSize;
shadowLeft = std::min(shadow.x() - blurAndSpread, shadowLeft);
shadowRight = std::max(shadow.x() + blurAndSpread, shadowRight);
shadowTop = std::min(shadow.y() - blurAndSpread, shadowTop);
@@ -52,25 +51,19 @@ static inline void calculateShadowExtent(const ShadowList* shadowList, int addit
}
}
-void ShadowList::adjustRectForShadow(LayoutRect& rect, int additionalOutlineSize) const
+void ShadowList::adjustRectForShadow(LayoutRect& rect, float additionalOutlineSize) const
{
- int shadowLeft = 0;
- int shadowRight = 0;
- int shadowTop = 0;
- int shadowBottom = 0;
- calculateShadowExtent(this, additionalOutlineSize, shadowLeft, shadowRight, shadowTop, shadowBottom);
-
- rect.move(shadowLeft, shadowTop);
- rect.setWidth(rect.width() - shadowLeft + shadowRight);
- rect.setHeight(rect.height() - shadowTop + shadowBottom);
+ FloatRect floatRect(rect);
+ adjustRectForShadow(floatRect);
+ rect = LayoutRect(floatRect);
}
-void ShadowList::adjustRectForShadow(FloatRect& rect, int additionalOutlineSize) const
+void ShadowList::adjustRectForShadow(FloatRect& rect, float additionalOutlineSize) const
{
- int shadowLeft = 0;
- int shadowRight = 0;
- int shadowTop = 0;
- int shadowBottom = 0;
+ float shadowLeft = 0;
+ float shadowRight = 0;
+ float shadowTop = 0;
+ float shadowBottom = 0;
calculateShadowExtent(this, additionalOutlineSize, shadowLeft, shadowRight, shadowTop, shadowBottom);
rect.move(shadowLeft, shadowTop);
@@ -83,12 +76,12 @@ PassRefPtr<ShadowList> ShadowList::blend(const ShadowList* from, const ShadowLis
size_t fromLength = from ? from->shadows().size() : 0;
size_t toLength = to ? to->shadows().size() : 0;
if (!fromLength && !toLength)
- return 0;
+ return nullptr;
ShadowDataVector shadows;
- DEFINE_STATIC_LOCAL(ShadowData, defaultShadowData, (IntPoint(), 0, 0, Normal, Color::transparent));
- DEFINE_STATIC_LOCAL(ShadowData, defaultInsetShadowData, (IntPoint(), 0, 0, Inset, Color::transparent));
+ DEFINE_STATIC_LOCAL(ShadowData, defaultShadowData, (FloatPoint(), 0, 0, Normal, Color::transparent));
+ DEFINE_STATIC_LOCAL(ShadowData, defaultInsetShadowData, (FloatPoint(), 0, 0, Inset, Color::transparent));
size_t maxLength = std::max(fromLength, toLength);
for (size_t i = 0; i < maxLength; ++i) {
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/ShadowList.h b/chromium/third_party/WebKit/Source/core/rendering/style/ShadowList.h
index 12acedf4801..6a1a4c1c9ad 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/ShadowList.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/ShadowList.h
@@ -32,6 +32,7 @@
#define ShadowList_h
#include "core/rendering/style/ShadowData.h"
+#include "platform/geometry/LayoutRect.h"
#include "wtf/RefCounted.h"
#include "wtf/Vector.h"
@@ -57,8 +58,8 @@ public:
static PassRefPtr<ShadowList> blend(const ShadowList* from, const ShadowList* to, double progress);
- void adjustRectForShadow(LayoutRect&, int additionalOutlineSize = 0) const;
- void adjustRectForShadow(FloatRect&, int additionalOutlineSize = 0) const;
+ void adjustRectForShadow(LayoutRect&, float additionalOutlineSize = 0) const;
+ void adjustRectForShadow(FloatRect&, float additionalOutlineSize = 0) const;
private:
ShadowList(ShadowDataVector& shadows)
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/ShapeValue.h b/chromium/third_party/WebKit/Source/core/rendering/style/ShapeValue.h
index 6b872807dce..dc12b4f1ff8 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/ShapeValue.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/ShapeValue.h
@@ -44,23 +44,17 @@ public:
// The Auto value is defined by a null ShapeValue*
Shape,
Box,
- Outside,
Image
};
- static PassRefPtr<ShapeValue> createShapeValue(PassRefPtr<BasicShape> shape)
+ static PassRefPtr<ShapeValue> createShapeValue(PassRefPtr<BasicShape> shape, CSSBoxType cssBox)
{
- return adoptRef(new ShapeValue(shape));
+ return adoptRef(new ShapeValue(shape, cssBox));
}
- static PassRefPtr<ShapeValue> createOutsideValue()
+ static PassRefPtr<ShapeValue> createBoxShapeValue(CSSBoxType cssBox)
{
- return adoptRef(new ShapeValue(Outside));
- }
-
- static PassRefPtr<ShapeValue> createLayoutBoxValue(LayoutBox layoutBox)
- {
- return adoptRef(new ShapeValue(layoutBox));
+ return adoptRef(new ShapeValue(cssBox));
}
static PassRefPtr<ShapeValue> createImageValue(PassRefPtr<StyleImage> image)
@@ -72,39 +66,45 @@ public:
BasicShape* shape() const { return m_shape.get(); }
StyleImage* image() const { return m_image.get(); }
- bool isImageValid() const { return image() && image()->cachedImage() && image()->cachedImage()->hasImage(); }
+ bool isImageValid() const
+ {
+ if (!image())
+ return false;
+ if (image()->isImageResource() || image()->isImageResourceSet())
+ return image()->cachedImage() && image()->cachedImage()->hasImage();
+ return image()->isGeneratedImage();
+ }
void setImage(PassRefPtr<StyleImage> image)
{
ASSERT(type() == Image);
if (m_image != image)
m_image = image;
}
- LayoutBox layoutBox() const { return m_layoutBox; }
- void setLayoutBox(LayoutBox layoutBox) { m_layoutBox = layoutBox; }
+ CSSBoxType cssBox() const { return m_cssBox; }
- bool operator==(const ShapeValue& other) const { return type() == other.type(); }
+ bool operator==(const ShapeValue& other) const;
private:
- ShapeValue(PassRefPtr<BasicShape> shape)
+ ShapeValue(PassRefPtr<BasicShape> shape, CSSBoxType cssBox)
: m_type(Shape)
, m_shape(shape)
- , m_layoutBox(ContentBox)
+ , m_cssBox(cssBox)
{
}
ShapeValue(ShapeValueType type)
: m_type(type)
- , m_layoutBox(ContentBox)
+ , m_cssBox(BoxMissing)
{
}
ShapeValue(PassRefPtr<StyleImage> image)
: m_type(Image)
, m_image(image)
- , m_layoutBox(ContentBox)
+ , m_cssBox(ContentBox)
{
}
- ShapeValue(LayoutBox layoutBox)
+ ShapeValue(CSSBoxType cssBox)
: m_type(Box)
- , m_layoutBox(layoutBox)
+ , m_cssBox(cssBox)
{
}
@@ -112,9 +112,27 @@ private:
ShapeValueType m_type;
RefPtr<BasicShape> m_shape;
RefPtr<StyleImage> m_image;
- LayoutBox m_layoutBox;
+ CSSBoxType m_cssBox;
};
+inline bool ShapeValue::operator==(const ShapeValue& other) const
+{
+ if (type() != other.type())
+ return false;
+
+ switch (type()) {
+ case Shape:
+ return shape() == other.shape() && cssBox() == other.cssBox();
+ case Box:
+ return cssBox() == other.cssBox();
+ case Image:
+ return image() == other.image();
+ }
+
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
}
#endif
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleBackgroundData.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleBackgroundData.cpp
index d0b7ba4ff27..1dcfc53fb58 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleBackgroundData.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleBackgroundData.cpp
@@ -46,4 +46,9 @@ bool StyleBackgroundData::operator==(const StyleBackgroundData& o) const
return m_background == o.m_background && m_color == o.m_color && m_outline == o.m_outline;
}
+bool StyleBackgroundData::visuallyEqual(const StyleBackgroundData& o) const
+{
+ return m_background == o.m_background && m_color == o.m_color && m_outline.visuallyEqual(o.m_outline);
+}
+
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleBackgroundData.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleBackgroundData.h
index fda242f38f2..f25efbd9f05 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleBackgroundData.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleBackgroundData.h
@@ -45,8 +45,10 @@ public:
return !(*this == o);
}
+ bool visuallyEqual(const StyleBackgroundData&) const;
+
const FillLayer& background() const { return m_background; }
- const Color& color() const { return m_color; }
+ const StyleColor& color() const { return m_color; }
const OutlineValue& outline() const { return m_outline; }
private:
@@ -56,7 +58,7 @@ private:
StyleBackgroundData(const StyleBackgroundData&);
FillLayer m_background;
- Color m_color;
+ StyleColor m_color;
OutlineValue m_outline;
};
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleBoxData.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleBoxData.h
index 9b2296641df..6814b3a92e7 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleBoxData.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleBoxData.h
@@ -43,16 +43,16 @@ public:
return !(*this == o);
}
- Length width() const { return m_width; }
- Length height() const { return m_height; }
+ const Length& width() const { return m_width; }
+ const Length& height() const { return m_height; }
- Length minWidth() const { return m_minWidth; }
- Length minHeight() const { return m_minHeight; }
+ const Length& minWidth() const { return m_minWidth; }
+ const Length& minHeight() const { return m_minHeight; }
- Length maxWidth() const { return m_maxWidth; }
- Length maxHeight() const { return m_maxHeight; }
+ const Length& maxWidth() const { return m_maxWidth; }
+ const Length& maxHeight() const { return m_maxHeight; }
- Length verticalAlign() const { return m_verticalAlign; }
+ const Length& verticalAlign() const { return m_verticalAlign; }
int zIndex() const { return m_zIndex; }
bool hasAutoZIndex() const { return m_hasAutoZIndex; }
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgram.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgram.cpp
deleted file mode 100644
index 31c3d64d662..00000000000
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgram.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2013 Adobe Systems Incorporated. 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 THE COPYRIGHT HOLDER “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 HOLDER 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 "core/rendering/style/StyleCustomFilterProgram.h"
-
-#include "core/rendering/style/StyleCustomFilterProgramCache.h"
-
-namespace WebCore {
-
-StyleCustomFilterProgram::~StyleCustomFilterProgram()
-{
- if (m_cache)
- m_cache->remove(this);
-}
-
-} // namespace WebCore
-
-
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgram.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgram.h
deleted file mode 100644
index d79cf6368f5..00000000000
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgram.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. 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 THE COPYRIGHT HOLDER “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 HOLDER 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 StyleCustomFilterProgram_h
-#define StyleCustomFilterProgram_h
-
-#include "core/fetch/ResourceClient.h"
-#include "core/fetch/ResourcePtr.h"
-#include "core/fetch/ShaderResource.h"
-#include "core/rendering/style/StyleShader.h"
-#include "platform/graphics/filters/custom/CustomFilterProgram.h"
-#include "platform/weborigin/KURL.h"
-#include "wtf/FastAllocBase.h"
-
-namespace WebCore {
-
-// CSS Shaders
-
-class StyleCustomFilterProgramCache;
-
-class StyleCustomFilterProgram : public CustomFilterProgram, public ResourceClient {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- static PassRefPtr<StyleCustomFilterProgram> create(KURL vertexShaderURL, PassRefPtr<StyleShader> vertexShader,
- KURL fragmentShaderURL, PassRefPtr<StyleShader> fragmentShader, CustomFilterProgramType programType,
- const CustomFilterProgramMixSettings& mixSettings, CustomFilterMeshType meshType)
- {
- return adoptRef(new StyleCustomFilterProgram(vertexShaderURL, vertexShader, fragmentShaderURL, fragmentShader, programType, mixSettings, meshType));
- }
-
- void setVertexShader(PassRefPtr<StyleShader> shader)
- {
- // The shader is immutable while in the cache.
- ASSERT(!m_cache);
- m_vertexShader = shader;
- }
- StyleShader* vertexShader() const { return m_vertexShader.get(); }
-
- void setFragmentShader(PassRefPtr<StyleShader> shader)
- {
- // The shader is immutable while in the cache.
- ASSERT(!m_cache);
- m_fragmentShader = shader;
- }
- StyleShader* fragmentShader() const { return m_fragmentShader.get(); }
-
- virtual String vertexShaderString() const
- {
- ASSERT(isLoaded());
- return m_cachedVertexShader.get() ? m_cachedVertexShader->shaderString() : String();
- }
-
- virtual String fragmentShaderString() const
- {
- ASSERT(isLoaded());
- return m_cachedFragmentShader.get() ? m_cachedFragmentShader->shaderString() : String();
- }
-
- virtual bool isLoaded() const
- {
- // Do not use the Resource:isLoaded method here, because it actually means !isLoading(),
- // so missing and canceled resources will have isLoaded set to true, even if they are not loaded yet.
- ASSERT(!m_vertexShader || m_vertexShader->isShaderResource());
- ASSERT(!m_fragmentShader || m_fragmentShader->isShaderResource());
-
- // If we failed to create resources for the vertex shader or the
- // fragment shader, they won't be set here.
- // This can happen if the ResourceFetcher is no longer accepting fetch
- // requests because the page is being torn down.
- if (!m_vertexShader && !m_fragmentShader)
- return false;
-
- ASSERT(m_cachedVertexShader.get() || m_cachedFragmentShader.get());
- return (!m_cachedVertexShader.get() || m_isVertexShaderLoaded)
- && (!m_cachedFragmentShader.get() || m_isFragmentShaderLoaded);
- }
-
- virtual void willHaveClients()
- {
- if (m_vertexShader) {
- m_cachedVertexShader = m_vertexShader->resource();
- m_cachedVertexShader->addClient(this);
- }
- if (m_fragmentShader) {
- m_cachedFragmentShader = m_fragmentShader->resource();
- m_cachedFragmentShader->addClient(this);
- }
- }
-
- virtual void didRemoveLastClient()
- {
- if (m_cachedVertexShader.get()) {
- m_cachedVertexShader->removeClient(this);
- m_cachedVertexShader = 0;
- m_isVertexShaderLoaded = false;
- }
- if (m_cachedFragmentShader.get()) {
- m_cachedFragmentShader->removeClient(this);
- m_cachedFragmentShader = 0;
- m_isFragmentShaderLoaded = false;
- }
- }
-
- virtual void notifyFinished(Resource* resource)
- {
- if (resource->errorOccurred())
- return;
- // Note that m_cachedVertexShader might be equal to m_cachedFragmentShader and it would only get one event in that case.
- if (resource == m_cachedVertexShader.get())
- m_isVertexShaderLoaded = true;
- if (resource == m_cachedFragmentShader.get())
- m_isFragmentShaderLoaded = true;
- if (isLoaded())
- notifyClients();
- }
-
- bool hasPendingShaders() const
- {
- return (m_vertexShader && m_vertexShader->isPendingShader())
- || (m_fragmentShader && m_fragmentShader->isPendingShader());
- }
-
- // StyleCustomFilterProgramCache is responsible with updating the reference to the cache.
- void setCache(StyleCustomFilterProgramCache* cache) { m_cache = cache; }
- bool inCache() const { return m_cache; }
-
- KURL vertexShaderURL() const { return m_vertexShaderURL; }
- KURL fragmentShaderURL() const { return m_fragmentShaderURL; }
-
-private:
- StyleCustomFilterProgram(KURL vertexShaderURL, PassRefPtr<StyleShader> vertexShader, KURL fragmentShaderURL, PassRefPtr<StyleShader> fragmentShader,
- CustomFilterProgramType programType, const CustomFilterProgramMixSettings& mixSettings, CustomFilterMeshType meshType)
- : CustomFilterProgram(programType, mixSettings, meshType)
- , m_vertexShader(vertexShader)
- , m_fragmentShader(fragmentShader)
- , m_vertexShaderURL(vertexShaderURL)
- , m_fragmentShaderURL(fragmentShaderURL)
- , m_cache(0)
- , m_isVertexShaderLoaded(false)
- , m_isFragmentShaderLoaded(false)
- {
- }
-
- ~StyleCustomFilterProgram();
-
- RefPtr<StyleShader> m_vertexShader;
- RefPtr<StyleShader> m_fragmentShader;
-
- ResourcePtr<ShaderResource> m_cachedVertexShader;
- ResourcePtr<ShaderResource> m_cachedFragmentShader;
-
- // The URLs form the key of the StyleCustomFilterProgram in the cache and are used
- // to lookup the StyleCustomFilterProgram when it's removed from the cache.
- KURL m_vertexShaderURL;
- KURL m_fragmentShaderURL;
-
- // The Cache is responsible of invalidating this reference.
- StyleCustomFilterProgramCache* m_cache;
-
- bool m_isVertexShaderLoaded;
- bool m_isFragmentShaderLoaded;
-};
-
-} // namespace WebCore
-
-
-#endif // StyleCustomFilterProgram_h
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgramCache.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgramCache.cpp
deleted file mode 100644
index 87d3aba9b66..00000000000
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgramCache.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2013 Adobe Systems Incorporated. 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 THE COPYRIGHT HOLDER “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 HOLDER 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 "core/rendering/style/StyleCustomFilterProgramCache.h"
-
-#include "core/rendering/style/StyleCustomFilterProgram.h"
-
-namespace WebCore {
-
-static CustomFilterProgramInfo programCacheKey(StyleCustomFilterProgram* program)
-{
- ASSERT(program->vertexShaderURL().isValid() || program->fragmentShaderURL().isValid());
- return CustomFilterProgramInfo(program->vertexShaderURL().string(), program->fragmentShaderURL().string(),
- program->programType(), program->mixSettings(), program->meshType());
-}
-
-PassOwnPtr<StyleCustomFilterProgramCache> StyleCustomFilterProgramCache::create()
-{
- return adoptPtr(new StyleCustomFilterProgramCache());
-}
-
-StyleCustomFilterProgramCache::~StyleCustomFilterProgramCache()
-{
- // Make sure the programs are not calling back into this object.
- for (CacheMap::iterator iter = m_cache.begin(), end = m_cache.end(); iter != end; ++iter)
- iter->value->setCache(0);
-}
-
-StyleCustomFilterProgram* StyleCustomFilterProgramCache::lookup(const CustomFilterProgramInfo& programInfo) const
-{
- CacheMap::const_iterator iter = m_cache.find(programInfo);
- return iter != m_cache.end() ? iter->value : 0;
-}
-
-StyleCustomFilterProgram* StyleCustomFilterProgramCache::lookup(StyleCustomFilterProgram* program) const
-{
- return lookup(programCacheKey(program));
-}
-
-void StyleCustomFilterProgramCache::add(StyleCustomFilterProgram* program)
-{
- CustomFilterProgramInfo key = programCacheKey(program);
- ASSERT(m_cache.find(key) == m_cache.end());
- m_cache.set(key, program);
- program->setCache(this);
-}
-
-void StyleCustomFilterProgramCache::remove(StyleCustomFilterProgram* program)
-{
- CacheMap::iterator iter = m_cache.find(programCacheKey(program));
- ASSERT_WITH_SECURITY_IMPLICATION(iter != m_cache.end());
- m_cache.remove(iter);
-}
-
-
-} // namespace WebCore
-
-
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgramCache.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgramCache.h
deleted file mode 100644
index 2bc1652d0e6..00000000000
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgramCache.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2013 Adobe Systems Incorporated. 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 THE COPYRIGHT HOLDER “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 HOLDER 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 StyleCustomFilterProgramCache_h
-#define StyleCustomFilterProgramCache_h
-
-#include "platform/graphics/filters/custom/CustomFilterProgramInfo.h"
-#include "wtf/FastAllocBase.h"
-#include "wtf/HashMap.h"
-
-namespace WebCore {
-
-class StyleCustomFilterProgram;
-class CustomFilterProgramInfo;
-
-class StyleCustomFilterProgramCache {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- static PassOwnPtr<StyleCustomFilterProgramCache> create();
- ~StyleCustomFilterProgramCache();
-
- // Lookups a StyleCustomFilterProgram that has similar parameters with the specified program.
- StyleCustomFilterProgram* lookup(StyleCustomFilterProgram*) const;
- StyleCustomFilterProgram* lookup(const CustomFilterProgramInfo&) const;
-
- void add(StyleCustomFilterProgram*);
- void remove(StyleCustomFilterProgram*);
-
-private:
- StyleCustomFilterProgramCache() { }
-
- typedef HashMap<CustomFilterProgramInfo, StyleCustomFilterProgram*> CacheMap;
- CacheMap m_cache;
-};
-
-} // namespace WebCore
-
-
-#endif // StyleCustomFilterProgramCache_h
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleDeprecatedFlexibleBoxData.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleDeprecatedFlexibleBoxData.cpp
index 4b3ff280e23..2c030fcc86a 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleDeprecatedFlexibleBoxData.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleDeprecatedFlexibleBoxData.cpp
@@ -28,8 +28,8 @@ namespace WebCore {
StyleDeprecatedFlexibleBoxData::StyleDeprecatedFlexibleBoxData()
: flex(RenderStyle::initialBoxFlex())
- , flex_group(RenderStyle::initialBoxFlexGroup())
- , ordinal_group(RenderStyle::initialBoxOrdinalGroup())
+ , flexGroup(RenderStyle::initialBoxFlexGroup())
+ , ordinalGroup(RenderStyle::initialBoxOrdinalGroup())
, align(RenderStyle::initialBoxAlign())
, pack(RenderStyle::initialBoxPack())
, orient(RenderStyle::initialBoxOrient())
@@ -40,8 +40,8 @@ StyleDeprecatedFlexibleBoxData::StyleDeprecatedFlexibleBoxData()
StyleDeprecatedFlexibleBoxData::StyleDeprecatedFlexibleBoxData(const StyleDeprecatedFlexibleBoxData& o)
: RefCounted<StyleDeprecatedFlexibleBoxData>()
, flex(o.flex)
- , flex_group(o.flex_group)
- , ordinal_group(o.ordinal_group)
+ , flexGroup(o.flexGroup)
+ , ordinalGroup(o.ordinalGroup)
, align(o.align)
, pack(o.pack)
, orient(o.orient)
@@ -51,9 +51,7 @@ StyleDeprecatedFlexibleBoxData::StyleDeprecatedFlexibleBoxData(const StyleDeprec
bool StyleDeprecatedFlexibleBoxData::operator==(const StyleDeprecatedFlexibleBoxData& o) const
{
- return flex == o.flex && flex_group == o.flex_group &&
- ordinal_group == o.ordinal_group && align == o.align &&
- pack == o.pack && orient == o.orient && lines == o.lines;
+ return flex == o.flex && flexGroup == o.flexGroup && ordinalGroup == o.ordinalGroup && align == o.align && pack == o.pack && orient == o.orient && lines == o.lines;
}
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleDeprecatedFlexibleBoxData.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleDeprecatedFlexibleBoxData.h
index 501157cc15d..adfee1f1717 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleDeprecatedFlexibleBoxData.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleDeprecatedFlexibleBoxData.h
@@ -42,8 +42,8 @@ public:
}
float flex;
- unsigned int flex_group;
- unsigned int ordinal_group;
+ unsigned flexGroup;
+ unsigned ordinalGroup;
unsigned align : 3; // EBoxAlignment
unsigned pack: 2; // EBoxPack
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleDifference.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleDifference.h
new file mode 100644
index 00000000000..d8418217b83
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleDifference.h
@@ -0,0 +1,80 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef StyleDifference_h
+#define StyleDifference_h
+
+#include "wtf/Assertions.h"
+
+namespace WebCore {
+
+// This class represents the difference between two computed styles (RenderStyle).
+// The difference can be combination of 3 types according to the actions needed:
+// - Difference needing layout
+// - Difference needing repaint
+// - Difference needing recompositing layers
+class StyleDifference {
+public:
+ StyleDifference()
+ : m_needsRecompositeLayer(false)
+ , m_repaintType(NoRepaint)
+ , m_layoutType(NoLayout) { }
+
+ // The two styles are identical.
+ bool hasNoChange() const { return !m_needsRecompositeLayer && !m_repaintType && !m_layoutType; }
+
+ // The layer needs its position and transform updated. Implied by other repaint and layout flags.
+ bool needsRecompositeLayer() const { return m_needsRecompositeLayer || needsRepaint() || needsLayout(); }
+ void setNeedsRecompositeLayer() { m_needsRecompositeLayer = true; }
+
+ bool needsRepaint() const { return m_repaintType != NoRepaint; }
+ void clearNeedsRepaint() { m_repaintType = NoRepaint; }
+
+ // The object just needs to be repainted.
+ bool needsRepaintObject() const { return m_repaintType == RepaintObject; }
+ void setNeedsRepaintObject()
+ {
+ ASSERT(!needsRepaintLayer());
+ m_repaintType = RepaintObject;
+ }
+
+ // The layer and its descendant layers need to be repainted.
+ bool needsRepaintLayer() const { return m_repaintType == RepaintLayer; }
+ void setNeedsRepaintLayer() { m_repaintType = RepaintLayer; }
+
+ bool needsLayout() const { return m_layoutType != NoLayout; }
+ void clearNeedsLayout() { m_layoutType = NoLayout; }
+
+ // The offset of this positioned object has been updated.
+ bool needsPositionedMovementLayout() const { return m_layoutType == PositionedMovement; }
+ void setNeedsPositionedMovementLayout()
+ {
+ ASSERT(!needsFullLayout());
+ m_layoutType = PositionedMovement;
+ }
+
+ bool needsFullLayout() const { return m_layoutType == FullLayout; }
+ void setNeedsFullLayout() { m_layoutType = FullLayout; }
+
+private:
+ unsigned m_needsRecompositeLayer : 1;
+
+ enum RepaintType {
+ NoRepaint = 0,
+ RepaintObject,
+ RepaintLayer
+ };
+ unsigned m_repaintType : 2;
+
+ enum LayoutType {
+ NoLayout = 0,
+ PositionedMovement,
+ FullLayout
+ };
+ unsigned m_layoutType : 2;
+};
+
+} // namespace WebCore
+
+#endif // StyleDifference_h
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.cpp
index 31dc65a0452..e53dc04ada8 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.cpp
@@ -24,6 +24,7 @@
#include "config.h"
#include "core/rendering/style/StyleFetchedImage.h"
+#include "core/css/CSSImageValue.h"
#include "core/fetch/ImageResource.h"
#include "core/rendering/RenderObject.h"
@@ -41,12 +42,12 @@ StyleFetchedImage::~StyleFetchedImage()
m_image->removeClient(this);
}
-PassRefPtr<CSSValue> StyleFetchedImage::cssValue() const
+PassRefPtrWillBeRawPtr<CSSValue> StyleFetchedImage::cssValue() const
{
- return CSSPrimitiveValue::create(m_image->url().string(), CSSPrimitiveValue::CSS_URI);
+ return CSSImageValue::create(m_image->url(), const_cast<StyleFetchedImage*>(this));
}
-bool StyleFetchedImage::canRender(const RenderObject* renderer, float multiplier) const
+bool StyleFetchedImage::canRender(const RenderObject& renderer, float multiplier) const
{
return m_image->canRender(renderer, multiplier);
}
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.h
index e783439b195..e74c26c9168 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.h
@@ -32,28 +32,28 @@ namespace WebCore {
class ImageResource;
-class StyleFetchedImage : public StyleImage, private ImageResourceClient {
+class StyleFetchedImage FINAL : public StyleImage, private ImageResourceClient {
WTF_MAKE_FAST_ALLOCATED;
public:
static PassRefPtr<StyleFetchedImage> create(ImageResource* image) { return adoptRef(new StyleFetchedImage(image)); }
virtual ~StyleFetchedImage();
- virtual WrappedImagePtr data() const { return m_image.get(); }
+ virtual WrappedImagePtr data() const OVERRIDE { return m_image.get(); }
- virtual PassRefPtr<CSSValue> cssValue() const;
+ virtual PassRefPtrWillBeRawPtr<CSSValue> cssValue() const OVERRIDE;
- virtual bool canRender(const RenderObject*, float multiplier) const;
- virtual bool isLoaded() const;
- virtual bool errorOccurred() const;
+ virtual bool canRender(const RenderObject&, float multiplier) const OVERRIDE;
+ virtual bool isLoaded() const OVERRIDE;
+ virtual bool errorOccurred() const OVERRIDE;
virtual LayoutSize imageSize(const RenderObject*, float multiplier) const OVERRIDE;
- virtual bool imageHasRelativeWidth() const;
- virtual bool imageHasRelativeHeight() const;
- virtual void computeIntrinsicDimensions(const RenderObject*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio);
- virtual bool usesImageContainerSize() const;
- virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize&, float);
- virtual void addClient(RenderObject*);
- virtual void removeClient(RenderObject*);
- virtual PassRefPtr<Image> image(RenderObject*, const IntSize&) const;
+ virtual bool imageHasRelativeWidth() const OVERRIDE;
+ virtual bool imageHasRelativeHeight() const OVERRIDE;
+ virtual void computeIntrinsicDimensions(const RenderObject*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) OVERRIDE;
+ virtual bool usesImageContainerSize() const OVERRIDE;
+ virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize&, float) OVERRIDE;
+ virtual void addClient(RenderObject*) OVERRIDE;
+ virtual void removeClient(RenderObject*) OVERRIDE;
+ virtual PassRefPtr<Image> image(RenderObject*, const IntSize&) const OVERRIDE;
virtual bool knownToBeOpaque(const RenderObject*) const OVERRIDE;
virtual ImageResource* cachedImage() const OVERRIDE { return m_image.get(); }
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.cpp
index 04a8d9d5961..2aacd2fedd9 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.cpp
@@ -47,12 +47,12 @@ StyleFetchedImageSet::~StyleFetchedImageSet()
m_bestFitImage->removeClient(this);
}
-PassRefPtr<CSSValue> StyleFetchedImageSet::cssValue() const
+PassRefPtrWillBeRawPtr<CSSValue> StyleFetchedImageSet::cssValue() const
{
return m_imageSetValue;
}
-bool StyleFetchedImageSet::canRender(const RenderObject* renderer, float multiplier) const
+bool StyleFetchedImageSet::canRender(const RenderObject& renderer, float multiplier) const
{
return m_bestFitImage->canRender(renderer, multiplier);
}
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.h
index 873c14299ef..cee20a65846 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.h
@@ -38,7 +38,7 @@ class CSSImageSetValue;
// This class keeps one cached image and has access to a set of alternatives.
-class StyleFetchedImageSet : public StyleImage, private ImageResourceClient {
+class StyleFetchedImageSet FINAL : public StyleImage, private ImageResourceClient {
WTF_MAKE_FAST_ALLOCATED;
public:
static PassRefPtr<StyleFetchedImageSet> create(ImageResource* image, float imageScaleFactor, CSSImageSetValue* value)
@@ -47,28 +47,28 @@ public:
}
virtual ~StyleFetchedImageSet();
- virtual PassRefPtr<CSSValue> cssValue() const;
+ virtual PassRefPtrWillBeRawPtr<CSSValue> cssValue() const OVERRIDE;
// FIXME: This is used by StyleImage for equals comparison, but this implementation
// only looks at the image from the set that we have loaded. I'm not sure if that is
// meaningful enough or not.
- virtual WrappedImagePtr data() const { return m_bestFitImage.get(); }
+ virtual WrappedImagePtr data() const OVERRIDE { return m_bestFitImage.get(); }
void clearImageSetValue() { m_imageSetValue = 0; }
- virtual bool canRender(const RenderObject*, float multiplier) const;
- virtual bool isLoaded() const;
- virtual bool errorOccurred() const;
- virtual LayoutSize imageSize(const RenderObject*, float multiplier) const;
- virtual bool imageHasRelativeWidth() const;
- virtual bool imageHasRelativeHeight() const;
- virtual void computeIntrinsicDimensions(const RenderObject*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio);
- virtual bool usesImageContainerSize() const;
- virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize&, float);
- virtual void addClient(RenderObject*);
- virtual void removeClient(RenderObject*);
- virtual PassRefPtr<Image> image(RenderObject*, const IntSize&) const;
- virtual float imageScaleFactor() const { return m_imageScaleFactor; }
+ virtual bool canRender(const RenderObject&, float multiplier) const OVERRIDE;
+ virtual bool isLoaded() const OVERRIDE;
+ virtual bool errorOccurred() const OVERRIDE;
+ virtual LayoutSize imageSize(const RenderObject*, float multiplier) const OVERRIDE;
+ virtual bool imageHasRelativeWidth() const OVERRIDE;
+ virtual bool imageHasRelativeHeight() const OVERRIDE;
+ virtual void computeIntrinsicDimensions(const RenderObject*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) OVERRIDE;
+ virtual bool usesImageContainerSize() const OVERRIDE;
+ virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize&, float) OVERRIDE;
+ virtual void addClient(RenderObject*) OVERRIDE;
+ virtual void removeClient(RenderObject*) OVERRIDE;
+ virtual PassRefPtr<Image> image(RenderObject*, const IntSize&) const OVERRIDE;
+ virtual float imageScaleFactor() const OVERRIDE { return m_imageScaleFactor; }
virtual bool knownToBeOpaque(const RenderObject*) const OVERRIDE;
virtual ImageResource* cachedImage() const OVERRIDE { return m_bestFitImage.get(); }
@@ -77,6 +77,11 @@ private:
ResourcePtr<ImageResource> m_bestFitImage;
float m_imageScaleFactor;
+
+ // FIXME: oilpan: Change to RawPtrWillBeMember when moving this class onto oilpan heap.
+ // Also add "if !ENABLE(OILPAN)" around clearImageSetValue above as well as around its
+ // caller since it should not be needed once both of the objects are on the heap and
+ // oilpan is enabled.
CSSImageSetValue* m_imageSetValue; // Not retained; it owns us.
};
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.cpp
deleted file mode 100644
index 13a8b98c36a..00000000000
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2011 Adobe Systems Incorporated. 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 THE COPYRIGHT HOLDER “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 HOLDER 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 "core/rendering/style/StyleFetchedShader.h"
-
-#include "core/css/CSSPrimitiveValue.h"
-#include "core/fetch/ShaderResource.h"
-
-namespace WebCore {
-
-
-StyleFetchedShader::StyleFetchedShader(ShaderResource* shader)
- : m_shader(shader)
-{
- m_isShaderResource = true;
-}
-
-PassRefPtr<CSSValue> StyleFetchedShader::cssValue() const
-{
- return CSSPrimitiveValue::create(m_shader->url().string(), CSSPrimitiveValue::CSS_URI);
-}
-
-} // namespace WebCore
-
-
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.h
deleted file mode 100644
index 104a90cc871..00000000000
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2011 Adobe Systems Incorporated. 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 THE COPYRIGHT HOLDER “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 HOLDER 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 StyleFetchedShader_h
-#define StyleFetchedShader_h
-
-#include "core/fetch/ResourcePtr.h"
-#include "core/rendering/style/StyleShader.h"
-
-namespace WebCore {
-
-class ShaderResource;
-
-class StyleFetchedShader : public StyleShader {
-public:
- // FIXME: Keep a reference to the actual ShaderResource in this class.
- static PassRefPtr<StyleFetchedShader> create(ShaderResource* shader) { return adoptRef(new StyleFetchedShader(shader)); }
-
- virtual PassRefPtr<CSSValue> cssValue() const;
-
- virtual ShaderResource* resource() const { return m_shader.get(); }
-
-private:
- StyleFetchedShader(ShaderResource*);
-
- ResourcePtr<ShaderResource> m_shader;
-};
-
-}
-
-#endif // StyleFetchedShader_h
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleGeneratedImage.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleGeneratedImage.cpp
index 2ec1c87de4e..f675fa5b0b5 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleGeneratedImage.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleGeneratedImage.cpp
@@ -30,16 +30,16 @@
namespace WebCore {
-StyleGeneratedImage::StyleGeneratedImage(PassRefPtr<CSSImageGeneratorValue> value)
+StyleGeneratedImage::StyleGeneratedImage(PassRefPtrWillBeRawPtr<CSSImageGeneratorValue> value)
: m_imageGeneratorValue(value)
, m_fixedSize(m_imageGeneratorValue->isFixedSize())
{
m_isGeneratedImage = true;
}
-PassRefPtr<CSSValue> StyleGeneratedImage::cssValue() const
+PassRefPtrWillBeRawPtr<CSSValue> StyleGeneratedImage::cssValue() const
{
- return m_imageGeneratorValue;
+ return m_imageGeneratorValue.get();
}
LayoutSize StyleGeneratedImage::imageSize(const RenderObject* renderer, float multiplier) const
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleGeneratedImage.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleGeneratedImage.h
index bf93af475da..219f47e241d 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleGeneratedImage.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleGeneratedImage.h
@@ -31,32 +31,33 @@ namespace WebCore {
class CSSValue;
class CSSImageGeneratorValue;
-class StyleGeneratedImage : public StyleImage {
+class StyleGeneratedImage FINAL : public StyleImage {
public:
static PassRefPtr<StyleGeneratedImage> create(CSSImageGeneratorValue* value)
{
return adoptRef(new StyleGeneratedImage(value));
}
- virtual WrappedImagePtr data() const { return m_imageGeneratorValue.get(); }
+ virtual WrappedImagePtr data() const OVERRIDE { return m_imageGeneratorValue.get(); }
- virtual PassRefPtr<CSSValue> cssValue() const;
+ virtual PassRefPtrWillBeRawPtr<CSSValue> cssValue() const OVERRIDE;
virtual LayoutSize imageSize(const RenderObject*, float multiplier) const OVERRIDE;
- virtual bool imageHasRelativeWidth() const { return !m_fixedSize; }
- virtual bool imageHasRelativeHeight() const { return !m_fixedSize; }
- virtual void computeIntrinsicDimensions(const RenderObject*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio);
- virtual bool usesImageContainerSize() const { return !m_fixedSize; }
- virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize& containerSize, float) { m_containerSize = containerSize; }
- virtual void addClient(RenderObject*);
- virtual void removeClient(RenderObject*);
- virtual PassRefPtr<Image> image(RenderObject*, const IntSize&) const;
+ virtual bool imageHasRelativeWidth() const OVERRIDE { return !m_fixedSize; }
+ virtual bool imageHasRelativeHeight() const OVERRIDE { return !m_fixedSize; }
+ virtual void computeIntrinsicDimensions(const RenderObject*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) OVERRIDE;
+ virtual bool usesImageContainerSize() const OVERRIDE { return !m_fixedSize; }
+ virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize& containerSize, float) OVERRIDE { m_containerSize = containerSize; }
+ virtual void addClient(RenderObject*) OVERRIDE;
+ virtual void removeClient(RenderObject*) OVERRIDE;
+ virtual PassRefPtr<Image> image(RenderObject*, const IntSize&) const OVERRIDE;
virtual bool knownToBeOpaque(const RenderObject*) const OVERRIDE;
private:
- StyleGeneratedImage(PassRefPtr<CSSImageGeneratorValue>);
+ StyleGeneratedImage(PassRefPtrWillBeRawPtr<CSSImageGeneratorValue>);
- RefPtr<CSSImageGeneratorValue> m_imageGeneratorValue;
+ // FIXME: oilpan: change to member once StyleImage is moved to the oilpan heap
+ RefPtrWillBePersistent<CSSImageGeneratorValue> m_imageGeneratorValue;
IntSize m_containerSize;
bool m_fixedSize;
};
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleGridData.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleGridData.cpp
index a3f8a348017..d323864b32b 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleGridData.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleGridData.cpp
@@ -31,8 +31,8 @@
namespace WebCore {
StyleGridData::StyleGridData()
- : m_gridDefinitionColumns(RenderStyle::initialGridDefinitionColumns())
- , m_gridDefinitionRows(RenderStyle::initialGridDefinitionRows())
+ : m_gridTemplateColumns(RenderStyle::initialGridTemplateColumns())
+ , m_gridTemplateRows(RenderStyle::initialGridTemplateRows())
, m_namedGridColumnLines(RenderStyle::initialNamedGridColumnLines())
, m_namedGridRowLines(RenderStyle::initialNamedGridRowLines())
, m_orderedNamedGridColumnLines(RenderStyle::initialOrderedNamedGridColumnLines())
@@ -48,8 +48,8 @@ StyleGridData::StyleGridData()
StyleGridData::StyleGridData(const StyleGridData& o)
: RefCounted<StyleGridData>()
- , m_gridDefinitionColumns(o.m_gridDefinitionColumns)
- , m_gridDefinitionRows(o.m_gridDefinitionRows)
+ , m_gridTemplateColumns(o.m_gridTemplateColumns)
+ , m_gridTemplateRows(o.m_gridTemplateRows)
, m_namedGridColumnLines(o.m_namedGridColumnLines)
, m_namedGridRowLines(o.m_namedGridRowLines)
, m_orderedNamedGridColumnLines(o.m_orderedNamedGridColumnLines)
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleGridData.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleGridData.h
index c7f5e5430e7..da14eaa2989 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleGridData.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleGridData.h
@@ -46,7 +46,7 @@ public:
bool operator==(const StyleGridData& o) const
{
- return m_gridDefinitionColumns == o.m_gridDefinitionColumns && m_gridDefinitionRows == o.m_gridDefinitionRows && 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_orderedNamedGridColumnLines == o.m_orderedNamedGridColumnLines && m_orderedNamedGridRowLines == o.m_orderedNamedGridRowLines && m_namedGridArea == o.m_namedGridArea && m_namedGridArea == o.m_namedGridArea && m_namedGridAreaRowCount == o.m_namedGridAreaRowCount && m_namedGridAreaColumnCount == o.m_namedGridAreaColumnCount;
+ return m_gridTemplateColumns == o.m_gridTemplateColumns && m_gridTemplateRows == o.m_gridTemplateRows && 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_orderedNamedGridColumnLines == o.m_orderedNamedGridColumnLines && m_orderedNamedGridRowLines == o.m_orderedNamedGridRowLines && 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
@@ -54,8 +54,8 @@ public:
return !(*this == o);
}
- Vector<GridTrackSize> m_gridDefinitionColumns;
- Vector<GridTrackSize> m_gridDefinitionRows;
+ Vector<GridTrackSize> m_gridTemplateColumns;
+ Vector<GridTrackSize> m_gridTemplateRows;
NamedGridLinesMap m_namedGridColumnLines;
NamedGridLinesMap m_namedGridRowLines;
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleImage.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleImage.h
index bca329ac568..b487e2c33ce 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleImage.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleImage.h
@@ -49,9 +49,9 @@ public:
return data() == other.data();
}
- virtual PassRefPtr<CSSValue> cssValue() const = 0;
+ virtual PassRefPtrWillBeRawPtr<CSSValue> cssValue() const = 0;
- virtual bool canRender(const RenderObject*, float /*multiplier*/) const { return true; }
+ virtual bool canRender(const RenderObject&, float /*multiplier*/) const { return true; }
virtual bool isLoaded() const { return true; }
virtual bool errorOccurred() const { return false; }
virtual LayoutSize imageSize(const RenderObject*, float multiplier) const = 0;
@@ -73,16 +73,6 @@ public:
ALWAYS_INLINE bool isGeneratedImage() const { return m_isGeneratedImage; }
ALWAYS_INLINE bool isImageResourceSet() const { return m_isImageResourceSet; }
- static bool imagesEquivalent(const StyleImage* image1, const StyleImage* image2)
- {
- if (image1 != image2) {
- if (!image1 || !image2)
- return false;
- return *image1 == *image2;
- }
- return true;
- }
-
protected:
StyleImage()
: m_isImageResource(false)
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleInheritedData.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleInheritedData.cpp
index 063e7d2286c..1b961aa497e 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleInheritedData.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleInheritedData.cpp
@@ -32,6 +32,7 @@ StyleInheritedData::StyleInheritedData()
, line_height(RenderStyle::initialLineHeight())
, color(RenderStyle::initialColor())
, visitedLinkColor(RenderStyle::initialColor())
+ , textAutosizingMultiplier(1)
{
}
@@ -47,6 +48,7 @@ StyleInheritedData::StyleInheritedData(const StyleInheritedData& o)
, font(o.font)
, color(o.color)
, visitedLinkColor(o.visitedLinkColor)
+ , textAutosizingMultiplier(o.textAutosizingMultiplier)
{
}
@@ -57,6 +59,7 @@ bool StyleInheritedData::operator==(const StyleInheritedData& o) const
&& color == o.color
&& visitedLinkColor == o.visitedLinkColor
&& horizontal_border_spacing == o.horizontal_border_spacing
+ && textAutosizingMultiplier == o.textAutosizingMultiplier
&& vertical_border_spacing == o.vertical_border_spacing;
}
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleInheritedData.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleInheritedData.h
index 11613a4abf7..7466a7c78fd 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleInheritedData.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleInheritedData.h
@@ -56,6 +56,7 @@ public:
Font font;
Color color;
Color visitedLinkColor;
+ float textAutosizingMultiplier;
private:
StyleInheritedData();
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleMultiColData.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleMultiColData.cpp
index 90897bb28bf..f7a7c5337e5 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleMultiColData.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleMultiColData.cpp
@@ -30,6 +30,7 @@ StyleMultiColData::StyleMultiColData()
: m_width(0)
, m_count(RenderStyle::initialColumnCount())
, m_gap(0)
+ , m_visitedLinkColumnRuleColor(StyleColor::currentColor())
, m_autoWidth(true)
, m_autoCount(true)
, m_normalGap(true)
@@ -38,8 +39,6 @@ StyleMultiColData::StyleMultiColData()
, m_breakBefore(RenderStyle::initialPageBreak())
, m_breakAfter(RenderStyle::initialPageBreak())
, m_breakInside(RenderStyle::initialPageBreak())
- , m_axis(RenderStyle::initialColumnAxis())
- , m_progression(RenderStyle::initialColumnProgression())
{
}
@@ -58,8 +57,6 @@ StyleMultiColData::StyleMultiColData(const StyleMultiColData& o)
, 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)
{
}
@@ -69,8 +66,7 @@ bool StyleMultiColData::operator==(const StyleMultiColData& o) const
&& 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;
+ && m_breakAfter == o.m_breakAfter && m_breakInside == o.m_breakInside;
}
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleMultiColData.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleMultiColData.h
index fcf66802667..27441be85cd 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleMultiColData.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleMultiColData.h
@@ -57,7 +57,7 @@ public:
unsigned short m_count;
float m_gap;
BorderValue m_rule;
- Color m_visitedLinkColumnRuleColor;
+ StyleColor m_visitedLinkColumnRuleColor;
bool m_autoWidth : 1;
bool m_autoCount : 1;
@@ -67,8 +67,6 @@ public:
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
private:
StyleMultiColData();
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StylePendingImage.h b/chromium/third_party/WebKit/Source/core/rendering/style/StylePendingImage.h
index 4589f59a63d..d735175bb68 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StylePendingImage.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StylePendingImage.h
@@ -39,32 +39,32 @@ 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 : public StyleImage {
+class StylePendingImage FINAL : public StyleImage {
public:
static PassRefPtr<StylePendingImage> create(CSSValue* value) { return adoptRef(new StylePendingImage(value)); }
- virtual WrappedImagePtr data() const { return m_value; }
+ virtual WrappedImagePtr data() const OVERRIDE { return m_value; }
- virtual PassRefPtr<CSSValue> cssValue() const { return m_value; }
+ virtual PassRefPtrWillBeRawPtr<CSSValue> cssValue() const OVERRIDE { return m_value; }
CSSImageValue* cssImageValue() const { return m_value->isImageValue() ? toCSSImageValue(m_value) : 0; }
CSSImageGeneratorValue* cssImageGeneratorValue() const { return m_value->isImageGeneratorValue() ? toCSSImageGeneratorValue(m_value) : 0; }
CSSCursorImageValue* cssCursorImageValue() const { return m_value->isCursorImageValue() ? toCSSCursorImageValue(m_value) : 0; }
CSSImageSetValue* cssImageSetValue() const { return m_value->isImageSetValue() ? toCSSImageSetValue(m_value) : 0; }
virtual LayoutSize imageSize(const RenderObject*, float /*multiplier*/) const OVERRIDE { return LayoutSize(); }
- virtual bool imageHasRelativeWidth() const { return false; }
- virtual bool imageHasRelativeHeight() const { return false; }
- virtual void computeIntrinsicDimensions(const RenderObject*, Length& /* intrinsicWidth */ , Length& /* intrinsicHeight */, FloatSize& /* intrinsicRatio */) { }
- virtual bool usesImageContainerSize() const { return false; }
- virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize&, float) { }
- virtual void addClient(RenderObject*) { }
- virtual void removeClient(RenderObject*) { }
- virtual PassRefPtr<Image> image(RenderObject*, const IntSize&) const
+ virtual bool imageHasRelativeWidth() const OVERRIDE { return false; }
+ virtual bool imageHasRelativeHeight() const OVERRIDE { return false; }
+ virtual void computeIntrinsicDimensions(const RenderObject*, Length& /* intrinsicWidth */ , Length& /* intrinsicHeight */, FloatSize& /* intrinsicRatio */) OVERRIDE { }
+ virtual bool usesImageContainerSize() const OVERRIDE { return false; }
+ virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize&, float) OVERRIDE { }
+ virtual void addClient(RenderObject*) OVERRIDE { }
+ virtual void removeClient(RenderObject*) OVERRIDE { }
+ virtual PassRefPtr<Image> image(RenderObject*, const IntSize&) const OVERRIDE
{
ASSERT_NOT_REACHED();
- return 0;
+ return nullptr;
}
- virtual bool knownToBeOpaque(const RenderObject*) const { return false; }
+ virtual bool knownToBeOpaque(const RenderObject*) const OVERRIDE { return false; }
private:
StylePendingImage(CSSValue* value)
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StylePendingShader.h b/chromium/third_party/WebKit/Source/core/rendering/style/StylePendingShader.h
deleted file mode 100644
index 1158e33a740..00000000000
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StylePendingShader.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2011 Adobe Systems Incorporated. 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 THE COPYRIGHT HOLDER “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 HOLDER 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 StylePendingShader_h
-#define StylePendingShader_h
-
-#include "core/css/CSSShaderValue.h"
-#include "core/css/CSSValue.h"
-#include "core/rendering/style/StyleShader.h"
-#include "wtf/PassRefPtr.h"
-
-namespace WebCore {
-
-class WebKitCSSShaderValue;
-
-class StylePendingShader : public StyleShader {
-public:
- static PassRefPtr<StylePendingShader> create(CSSShaderValue* value) { return adoptRef(new StylePendingShader(value)); }
-
- virtual PassRefPtr<CSSValue> cssValue() const { return m_value; }
- CSSShaderValue* cssShaderValue() const { return m_value; }
-private:
- StylePendingShader(CSSShaderValue* value)
- : m_value(value)
- {
- m_isPendingShader = true;
- }
-
- CSSShaderValue* m_value; // Not retained; it owns us.
-};
-
-}
-
-#endif // StylePendingShader_h
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleRareInheritedData.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleRareInheritedData.cpp
index 1a1769c787f..741d22d7801 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleRareInheritedData.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleRareInheritedData.cpp
@@ -22,7 +22,9 @@
#include "config.h"
#include "core/rendering/style/StyleRareInheritedData.h"
-#include "core/rendering/style/CursorList.h"
+#include "core/rendering/style/AppliedTextDecoration.h"
+#include "core/rendering/style/CursorData.h"
+#include "core/rendering/style/DataEquivalency.h"
#include "core/rendering/style/QuotesData.h"
#include "core/rendering/style/RenderStyle.h"
#include "core/rendering/style/RenderStyleConstants.h"
@@ -37,8 +39,8 @@ struct SameSizeAsStyleRareInheritedData : public RefCounted<SameSizeAsStyleRareI
float firstFloat;
Color colors[5];
void* ownPtrs[1];
- AtomicString atomicStrings[5];
- void* refPtrs[2];
+ AtomicString atomicStrings[4];
+ void* refPtrs[3];
Length lengths[1];
float secondFloat;
unsigned m_bitfields[2];
@@ -47,8 +49,6 @@ struct SameSizeAsStyleRareInheritedData : public RefCounted<SameSizeAsStyleRareI
short hyphenationShorts[3];
Color touchColors;
-
- void* variableDataRefs[1];
};
COMPILE_ASSERT(sizeof(StyleRareInheritedData) == sizeof(SameSizeAsStyleRareInheritedData), StyleRareInheritedData_should_bit_pack);
@@ -62,6 +62,12 @@ StyleRareInheritedData::StyleRareInheritedData()
, orphans(RenderStyle::initialOrphans())
, m_hasAutoWidows(true)
, m_hasAutoOrphans(true)
+ , m_textStrokeColorIsCurrentColor(true)
+ , m_textFillColorIsCurrentColor(true)
+ , m_textEmphasisColorIsCurrentColor(true)
+ , m_visitedLinkTextStrokeColorIsCurrentColor(true)
+ , m_visitedLinkTextFillColorIsCurrentColor(true)
+ , m_visitedLinkTextEmphasisColorIsCurrentColor(true)
, textSecurity(RenderStyle::initialTextSecurity())
, userModify(READ_ONLY)
, wordBreak(RenderStyle::initialWordBreak())
@@ -78,33 +84,31 @@ StyleRareInheritedData::StyleRareInheritedData()
, m_textJustify(RenderStyle::initialTextJustify())
, m_textOrientation(TextOrientationVerticalRight)
, m_textIndentLine(RenderStyle::initialTextIndentLine())
+ , m_textIndentType(RenderStyle::initialTextIndentLine())
, m_lineBoxContain(RenderStyle::initialLineBoxContain())
, m_imageRendering(RenderStyle::initialImageRendering())
- , m_lineSnap(RenderStyle::initialLineSnap())
- , m_lineAlign(RenderStyle::initialLineAlign())
, m_textUnderlinePosition(RenderStyle::initialTextUnderlinePosition())
, m_rubyPosition(RenderStyle::initialRubyPosition())
, m_touchActionDelay(RenderStyle::initialTouchActionDelay())
+ , m_subtreeWillChangeContents(false)
, hyphenationLimitBefore(-1)
, hyphenationLimitAfter(-1)
, hyphenationLimitLines(-1)
- , m_lineGrid(RenderStyle::initialLineGrid())
, m_tabSize(RenderStyle::initialTabSize())
, tapHighlightColor(RenderStyle::initialTapHighlightColor())
{
- m_variables.init();
}
StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o)
: RefCounted<StyleRareInheritedData>()
, listStyleImage(o.listStyleImage)
- , textStrokeColor(o.textStrokeColor)
+ , m_textStrokeColor(o.m_textStrokeColor)
, textStrokeWidth(o.textStrokeWidth)
- , textFillColor(o.textFillColor)
- , textEmphasisColor(o.textEmphasisColor)
- , visitedLinkTextStrokeColor(o.visitedLinkTextStrokeColor)
- , visitedLinkTextFillColor(o.visitedLinkTextFillColor)
- , visitedLinkTextEmphasisColor(o.visitedLinkTextEmphasisColor)
+ , m_textFillColor(o.m_textFillColor)
+ , m_textEmphasisColor(o.m_textEmphasisColor)
+ , m_visitedLinkTextStrokeColor(o.m_visitedLinkTextStrokeColor)
+ , m_visitedLinkTextFillColor(o.m_visitedLinkTextFillColor)
+ , m_visitedLinkTextEmphasisColor(o.m_visitedLinkTextEmphasisColor)
, textShadow(o.textShadow)
, highlight(o.highlight)
, cursorData(o.cursorData)
@@ -114,6 +118,12 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o)
, orphans(o.orphans)
, m_hasAutoWidows(o.m_hasAutoWidows)
, m_hasAutoOrphans(o.m_hasAutoOrphans)
+ , m_textStrokeColorIsCurrentColor(o.m_textStrokeColorIsCurrentColor)
+ , m_textFillColorIsCurrentColor(o.m_textFillColorIsCurrentColor)
+ , m_textEmphasisColorIsCurrentColor(o.m_textEmphasisColorIsCurrentColor)
+ , m_visitedLinkTextStrokeColorIsCurrentColor(o.m_visitedLinkTextStrokeColorIsCurrentColor)
+ , m_visitedLinkTextFillColorIsCurrentColor(o.m_visitedLinkTextFillColorIsCurrentColor)
+ , m_visitedLinkTextEmphasisColorIsCurrentColor(o.m_visitedLinkTextEmphasisColorIsCurrentColor)
, textSecurity(o.textSecurity)
, userModify(o.userModify)
, wordBreak(o.wordBreak)
@@ -130,23 +140,22 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o)
, m_textJustify(o.m_textJustify)
, m_textOrientation(o.m_textOrientation)
, m_textIndentLine(o.m_textIndentLine)
+ , m_textIndentType(o.m_textIndentType)
, m_lineBoxContain(o.m_lineBoxContain)
, m_imageRendering(o.m_imageRendering)
- , m_lineSnap(o.m_lineSnap)
- , m_lineAlign(o.m_lineAlign)
, m_textUnderlinePosition(o.m_textUnderlinePosition)
, m_rubyPosition(o.m_rubyPosition)
, m_touchActionDelay(o.m_touchActionDelay)
+ , m_subtreeWillChangeContents(o.m_subtreeWillChangeContents)
, 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)
, tapHighlightColor(o.tapHighlightColor)
- , m_variables(o.m_variables)
+ , appliedTextDecorations(o.appliedTextDecorations)
{
}
@@ -154,34 +163,31 @@ 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);
-}
-
bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
{
- return textStrokeColor == o.textStrokeColor
+ return m_textStrokeColor == o.m_textStrokeColor
&& textStrokeWidth == o.textStrokeWidth
- && textFillColor == o.textFillColor
- && textEmphasisColor == o.textEmphasisColor
- && visitedLinkTextStrokeColor == o.visitedLinkTextStrokeColor
- && visitedLinkTextFillColor == o.visitedLinkTextFillColor
- && visitedLinkTextEmphasisColor == o.visitedLinkTextEmphasisColor
+ && m_textFillColor == o.m_textFillColor
+ && m_textEmphasisColor == o.m_textEmphasisColor
+ && m_visitedLinkTextStrokeColor == o.m_visitedLinkTextStrokeColor
+ && m_visitedLinkTextFillColor == o.m_visitedLinkTextFillColor
+ && m_visitedLinkTextEmphasisColor == o.m_visitedLinkTextEmphasisColor
&& tapHighlightColor == o.tapHighlightColor
&& shadowDataEquivalent(o)
&& highlight == o.highlight
- && cursorDataEquivalent(cursorData.get(), o.cursorData.get())
+ && dataEquivalent(cursorData.get(), o.cursorData.get())
&& indent == o.indent
&& m_effectiveZoom == o.m_effectiveZoom
&& widows == o.widows
&& orphans == o.orphans
&& m_hasAutoWidows == o.m_hasAutoWidows
&& m_hasAutoOrphans == o.m_hasAutoOrphans
+ && m_textStrokeColorIsCurrentColor == o.m_textStrokeColorIsCurrentColor
+ && m_textFillColorIsCurrentColor == o.m_textFillColorIsCurrentColor
+ && m_textEmphasisColorIsCurrentColor == o.m_textEmphasisColorIsCurrentColor
+ && m_visitedLinkTextStrokeColorIsCurrentColor == o.m_visitedLinkTextStrokeColorIsCurrentColor
+ && m_visitedLinkTextFillColorIsCurrentColor == o.m_visitedLinkTextFillColorIsCurrentColor
+ && m_visitedLinkTextEmphasisColorIsCurrentColor == o.m_visitedLinkTextEmphasisColorIsCurrentColor
&& textSecurity == o.textSecurity
&& userModify == o.userModify
&& wordBreak == o.wordBreak
@@ -202,29 +208,29 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
&& m_textJustify == o.m_textJustify
&& m_textOrientation == o.m_textOrientation
&& m_textIndentLine == o.m_textIndentLine
+ && m_textIndentType == o.m_textIndentType
&& m_lineBoxContain == o.m_lineBoxContain
+ && m_subtreeWillChangeContents == o.m_subtreeWillChangeContents
&& hyphenationString == o.hyphenationString
&& locale == o.locale
&& textEmphasisCustomMark == o.textEmphasisCustomMark
- && QuotesData::equals(quotes.get(), o.quotes.get())
+ && quotesDataEquivalent(o)
&& m_tabSize == o.m_tabSize
- && m_lineGrid == o.m_lineGrid
&& m_imageRendering == o.m_imageRendering
&& m_textUnderlinePosition == o.m_textUnderlinePosition
&& m_rubyPosition == o.m_rubyPosition
- && m_lineSnap == o.m_lineSnap
- && m_variables == o.m_variables
- && m_lineAlign == o.m_lineAlign
- && StyleImage::imagesEquivalent(listStyleImage.get(), o.listStyleImage.get());
+ && dataEquivalent(listStyleImage.get(), o.listStyleImage.get())
+ && dataEquivalent(appliedTextDecorations, o.appliedTextDecorations);
}
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;
+ return dataEquivalent(textShadow.get(), o.textShadow.get());
+}
+
+bool StyleRareInheritedData::quotesDataEquivalent(const StyleRareInheritedData& o) const
+{
+ return dataEquivalent(quotes, o.quotes);
}
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleRareInheritedData.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleRareInheritedData.h
index 11d3c4b0f52..4dd0ba554a2 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleRareInheritedData.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleRareInheritedData.h
@@ -25,21 +25,26 @@
#ifndef StyleRareInheritedData_h
#define StyleRareInheritedData_h
+#include "core/css/StyleColor.h"
#include "core/rendering/style/DataRef.h"
-#include "core/rendering/style/StyleVariableData.h"
#include "platform/Length.h"
#include "platform/graphics/Color.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
+#include "wtf/RefVector.h"
#include "wtf/text/AtomicString.h"
namespace WebCore {
-class CursorList;
+class AppliedTextDecoration;
+class CursorData;
class QuotesData;
class ShadowList;
class StyleImage;
+typedef RefVector<AppliedTextDecoration> AppliedTextDecorationList;
+typedef RefVector<CursorData> CursorList;
+
// This struct is for rarely used inherited CSS3, CSS2, and WebKit-specific properties.
// By grouping them together, we save space, and only allocate this object when someone
// actually uses one of these properties.
@@ -55,17 +60,32 @@ public:
return !(*this == o);
}
bool shadowDataEquivalent(const StyleRareInheritedData&) const;
+ bool quotesDataEquivalent(const StyleRareInheritedData&) const;
RefPtr<StyleImage> listStyleImage;
- Color textStrokeColor;
+ StyleColor textStrokeColor() const { return m_textStrokeColorIsCurrentColor ? StyleColor::currentColor() : StyleColor(m_textStrokeColor); }
+ StyleColor textFillColor() const { return m_textFillColorIsCurrentColor ? StyleColor::currentColor() : StyleColor(m_textFillColor); }
+ StyleColor textEmphasisColor() const { return m_textEmphasisColorIsCurrentColor ? StyleColor::currentColor() : StyleColor(m_textEmphasisColor); }
+ StyleColor visitedLinkTextStrokeColor() const { return m_visitedLinkTextStrokeColorIsCurrentColor ? StyleColor::currentColor() : StyleColor(m_visitedLinkTextStrokeColor); }
+ StyleColor visitedLinkTextFillColor() const { return m_visitedLinkTextFillColorIsCurrentColor ? StyleColor::currentColor() : StyleColor(m_visitedLinkTextFillColor); }
+ StyleColor visitedLinkTextEmphasisColor() const { return m_visitedLinkTextEmphasisColorIsCurrentColor ? StyleColor::currentColor() : StyleColor(m_visitedLinkTextEmphasisColor); }
+
+ void setTextStrokeColor(const StyleColor& color) { m_textStrokeColor = color.resolve(Color()); m_textStrokeColorIsCurrentColor = color.isCurrentColor(); }
+ void setTextFillColor(const StyleColor& color) { m_textFillColor = color.resolve(Color()); m_textFillColorIsCurrentColor = color.isCurrentColor(); }
+ void setTextEmphasisColor(const StyleColor& color) { m_textEmphasisColor = color.resolve(Color()); m_textEmphasisColorIsCurrentColor = color.isCurrentColor(); }
+ void setVisitedLinkTextStrokeColor(const StyleColor& color) { m_visitedLinkTextStrokeColor = color.resolve(Color()); m_visitedLinkTextStrokeColorIsCurrentColor = color.isCurrentColor(); }
+ void setVisitedLinkTextFillColor(const StyleColor& color) { m_visitedLinkTextFillColor = color.resolve(Color()); m_visitedLinkTextFillColorIsCurrentColor = color.isCurrentColor(); }
+ void setVisitedLinkTextEmphasisColor(const StyleColor& color) { m_visitedLinkTextEmphasisColor = color.resolve(Color()); m_visitedLinkTextEmphasisColorIsCurrentColor = color.isCurrentColor(); }
+
+ Color m_textStrokeColor;
float textStrokeWidth;
- Color textFillColor;
- Color textEmphasisColor;
+ Color m_textFillColor;
+ Color m_textEmphasisColor;
- Color visitedLinkTextStrokeColor;
- Color visitedLinkTextFillColor;
- Color visitedLinkTextEmphasisColor;
+ Color m_visitedLinkTextStrokeColor;
+ Color m_visitedLinkTextFillColor;
+ Color m_visitedLinkTextEmphasisColor;
RefPtr<ShadowList> textShadow; // Our text shadow information for shadowed text drawing.
AtomicString highlight; // Apple-specific extension for custom highlight rendering.
@@ -80,6 +100,13 @@ public:
unsigned m_hasAutoWidows : 1;
unsigned m_hasAutoOrphans : 1;
+ unsigned m_textStrokeColorIsCurrentColor : 1;
+ unsigned m_textFillColorIsCurrentColor : 1;
+ unsigned m_textEmphasisColorIsCurrentColor : 1;
+ unsigned m_visitedLinkTextStrokeColorIsCurrentColor : 1;
+ unsigned m_visitedLinkTextFillColorIsCurrentColor : 1;
+ unsigned m_visitedLinkTextEmphasisColorIsCurrentColor : 1;
+
unsigned textSecurity : 2; // ETextSecurity
unsigned userModify : 2; // EUserModify (editing)
unsigned wordBreak : 2; // EWordBreak
@@ -96,15 +123,18 @@ public:
unsigned m_textJustify : 2; // TextJustify
unsigned m_textOrientation : 2; // TextOrientation
unsigned m_textIndentLine : 1; // TextIndentEachLine
+ unsigned m_textIndentType : 1; // TextIndentHanging
unsigned m_lineBoxContain: 7; // LineBoxContain
// CSS Image Values Level 3
unsigned m_imageRendering : 2; // EImageRendering
- unsigned m_lineSnap : 2; // LineSnap
- unsigned m_lineAlign : 1; // LineAlign
unsigned m_textUnderlinePosition : 2; // TextUnderlinePosition
unsigned m_rubyPosition : 1; // RubyPosition
unsigned m_touchActionDelay : 1; // TouchActionDelay
+ // Though will-change is not itself an inherited property, the intent
+ // expressed by 'will-change: contents' includes descendants.
+ unsigned m_subtreeWillChangeContents : 1;
+
AtomicString hyphenationString;
short hyphenationLimitBefore;
short hyphenationLimitAfter;
@@ -115,12 +145,11 @@ public:
AtomicString textEmphasisCustomMark;
RefPtr<QuotesData> quotes;
- AtomicString m_lineGrid;
unsigned m_tabSize;
Color tapHighlightColor;
- DataRef<StyleVariableData> m_variables;
+ RefPtr<AppliedTextDecorationList> appliedTextDecorations;
private:
StyleRareInheritedData();
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleRareNonInheritedData.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleRareNonInheritedData.cpp
index 2d312788ec6..165edc705a4 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleRareNonInheritedData.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleRareNonInheritedData.cpp
@@ -23,6 +23,7 @@
#include "core/rendering/style/StyleRareNonInheritedData.h"
#include "core/rendering/style/ContentData.h"
+#include "core/rendering/style/DataEquivalency.h"
#include "core/rendering/style/RenderStyle.h"
#include "core/rendering/style/ShadowList.h"
#include "core/rendering/style/StyleFilterData.h"
@@ -42,27 +43,28 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
, m_draggableRegionMode(DraggableRegionNone)
, m_mask(MaskFillLayer, true)
, m_pageSize()
- , m_shapeInside(RenderStyle::initialShapeInside())
, m_shapeOutside(RenderStyle::initialShapeOutside())
, m_shapeMargin(RenderStyle::initialShapeMargin())
- , m_shapePadding(RenderStyle::initialShapePadding())
, m_shapeImageThreshold(RenderStyle::initialShapeImageThreshold())
, m_clipPath(RenderStyle::initialClipPath())
+ , m_textDecorationColor(StyleColor::currentColor())
+ , m_visitedLinkTextDecorationColor(StyleColor::currentColor())
, m_visitedLinkBackgroundColor(RenderStyle::initialBackgroundColor())
+ , m_visitedLinkOutlineColor(StyleColor::currentColor())
+ , m_visitedLinkBorderLeftColor(StyleColor::currentColor())
+ , m_visitedLinkBorderRightColor(StyleColor::currentColor())
+ , m_visitedLinkBorderTopColor(StyleColor::currentColor())
+ , m_visitedLinkBorderBottomColor(StyleColor::currentColor())
, m_order(RenderStyle::initialOrder())
, m_objectPosition(RenderStyle::initialObjectPosition())
- , m_flowThread(RenderStyle::initialFlowThread())
- , m_regionThread(RenderStyle::initialRegionThread())
- , 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_alignItemsOverflowAlignment(RenderStyle::initialAlignItemsOverflowAlignment())
, m_alignSelf(RenderStyle::initialAlignSelf())
+ , m_alignSelfOverflowAlignment(RenderStyle::initialAlignSelfOverflowAlignment())
, m_justifyContent(RenderStyle::initialJustifyContent())
, userDrag(RenderStyle::initialUserDrag())
, textOverflow(RenderStyle::initialTextOverflow())
@@ -74,12 +76,21 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
, m_textDecorationStyle(RenderStyle::initialTextDecorationStyle())
, m_wrapFlow(RenderStyle::initialWrapFlow())
, m_wrapThrough(RenderStyle::initialWrapThrough())
- , m_runningAcceleratedAnimation(false)
+ , m_hasCurrentOpacityAnimation(false)
+ , m_hasCurrentTransformAnimation(false)
+ , m_hasCurrentFilterAnimation(false)
+ , m_runningOpacityAnimationOnCompositor(false)
+ , m_runningTransformAnimationOnCompositor(false)
+ , m_runningFilterAnimationOnCompositor(false)
, m_hasAspectRatio(false)
, m_effectiveBlendMode(RenderStyle::initialBlendMode())
, m_touchAction(RenderStyle::initialTouchAction())
, m_objectFit(RenderStyle::initialObjectFit())
, m_isolation(RenderStyle::initialIsolation())
+ , m_justifySelf(RenderStyle::initialJustifySelf())
+ , m_justifySelfOverflowAlignment(RenderStyle::initialJustifySelfOverflowAlignment())
+ , m_scrollBehavior(RenderStyle::initialScrollBehavior())
+ , m_requiresAcceleratedCompositingForExternalReasons(false)
{
m_maskBoxImage.setMaskDefaults();
}
@@ -99,6 +110,7 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
, m_marquee(o.m_marquee)
, m_multiCol(o.m_multiCol)
, m_transform(o.m_transform)
+ , m_willChange(o.m_willChange)
, m_filter(o.m_filter)
, m_grid(o.m_grid)
, m_gridItem(o.m_gridItem)
@@ -106,15 +118,13 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
, m_counterDirectives(o.m_counterDirectives ? clone(*o.m_counterDirectives) : nullptr)
, m_boxShadow(o.m_boxShadow)
, m_boxReflect(o.m_boxReflect)
- , m_animations(o.m_animations ? adoptPtr(new CSSAnimationDataList(*o.m_animations)) : nullptr)
- , m_transitions(o.m_transitions ? adoptPtr(new CSSAnimationDataList(*o.m_transitions)) : nullptr)
+ , m_animations(o.m_animations ? CSSAnimationData::create(*o.m_animations) : nullptr)
+ , m_transitions(o.m_transitions ? CSSTransitionData::create(*o.m_transitions) : nullptr)
, m_mask(o.m_mask)
, m_maskBoxImage(o.m_maskBoxImage)
, m_pageSize(o.m_pageSize)
- , 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)
, m_clipPath(o.m_clipPath)
, m_textDecorationColor(o.m_textDecorationColor)
@@ -127,18 +137,14 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
, m_visitedLinkBorderBottomColor(o.m_visitedLinkBorderBottomColor)
, m_order(o.m_order)
, m_objectPosition(o.m_objectPosition)
- , m_flowThread(o.m_flowThread)
- , 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_alignItemsOverflowAlignment(o.m_alignItemsOverflowAlignment)
, m_alignSelf(o.m_alignSelf)
+ , m_alignSelfOverflowAlignment(o.m_alignSelfOverflowAlignment)
, m_justifyContent(o.m_justifyContent)
, userDrag(o.userDrag)
, textOverflow(o.textOverflow)
@@ -150,12 +156,21 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
, m_textDecorationStyle(o.m_textDecorationStyle)
, m_wrapFlow(o.m_wrapFlow)
, m_wrapThrough(o.m_wrapThrough)
- , m_runningAcceleratedAnimation(o.m_runningAcceleratedAnimation)
+ , m_hasCurrentOpacityAnimation(o.m_hasCurrentOpacityAnimation)
+ , m_hasCurrentTransformAnimation(o.m_hasCurrentTransformAnimation)
+ , m_hasCurrentFilterAnimation(o.m_hasCurrentFilterAnimation)
+ , m_runningOpacityAnimationOnCompositor(o.m_runningOpacityAnimationOnCompositor)
+ , m_runningTransformAnimationOnCompositor(o.m_runningTransformAnimationOnCompositor)
+ , m_runningFilterAnimationOnCompositor(o.m_runningFilterAnimationOnCompositor)
, m_hasAspectRatio(o.m_hasAspectRatio)
, m_effectiveBlendMode(o.m_effectiveBlendMode)
, m_touchAction(o.m_touchAction)
, m_objectFit(o.m_objectFit)
, m_isolation(o.m_isolation)
+ , m_justifySelf(o.m_justifySelf)
+ , m_justifySelfOverflowAlignment(o.m_justifySelfOverflowAlignment)
+ , m_scrollBehavior(o.m_scrollBehavior)
+ , m_requiresAcceleratedCompositingForExternalReasons(o.m_requiresAcceleratedCompositingForExternalReasons)
{
}
@@ -181,6 +196,7 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
&& m_marquee == o.m_marquee
&& m_multiCol == o.m_multiCol
&& m_transform == o.m_transform
+ && m_willChange == o.m_willChange
&& m_filter == o.m_filter
&& m_grid == o.m_grid
&& m_gridItem == o.m_gridItem
@@ -193,10 +209,8 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
&& m_mask == o.m_mask
&& m_maskBoxImage == o.m_maskBoxImage
&& m_pageSize == o.m_pageSize
- && 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
&& m_clipPath == o.m_clipPath
&& m_textDecorationColor == o.m_textDecorationColor
@@ -210,18 +224,14 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
&& m_order == o.m_order
&& m_objectPosition == o.m_objectPosition
&& m_callbackSelectors == o.m_callbackSelectors
- && m_flowThread == o.m_flowThread
- && 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_alignItemsOverflowAlignment == o.m_alignItemsOverflowAlignment
&& m_alignSelf == o.m_alignSelf
+ && m_alignSelfOverflowAlignment == o.m_alignSelfOverflowAlignment
&& m_justifyContent == o.m_justifyContent
&& userDrag == o.userDrag
&& textOverflow == o.textOverflow
@@ -233,12 +243,18 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
&& m_textDecorationStyle == o.m_textDecorationStyle
&& m_wrapFlow == o.m_wrapFlow
&& m_wrapThrough == o.m_wrapThrough
- && !m_runningAcceleratedAnimation && !o.m_runningAcceleratedAnimation
+ && m_hasCurrentOpacityAnimation == o.m_hasCurrentOpacityAnimation
+ && m_hasCurrentTransformAnimation == o.m_hasCurrentTransformAnimation
+ && m_hasCurrentFilterAnimation == o.m_hasCurrentFilterAnimation
&& m_effectiveBlendMode == o.m_effectiveBlendMode
&& m_hasAspectRatio == o.m_hasAspectRatio
&& m_touchAction == o.m_touchAction
&& m_objectFit == o.m_objectFit
- && m_isolation == o.m_isolation;
+ && m_isolation == o.m_isolation
+ && m_justifySelf == o.m_justifySelf
+ && m_justifySelfOverflowAlignment == o.m_justifySelfOverflowAlignment
+ && m_scrollBehavior == o.m_scrollBehavior
+ && m_requiresAcceleratedCompositingForExternalReasons == o.m_requiresAcceleratedCompositingForExternalReasons;
}
bool StyleRareNonInheritedData::contentDataEquivalent(const StyleRareNonInheritedData& o) const
@@ -256,50 +272,35 @@ bool StyleRareNonInheritedData::contentDataEquivalent(const StyleRareNonInherite
bool StyleRareNonInheritedData::counterDataEquivalent(const StyleRareNonInheritedData& o) const
{
- 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;
+ return dataEquivalent(m_counterDirectives, o.m_counterDirectives);
}
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;
+ return dataEquivalent(m_boxShadow, o.m_boxShadow);
}
bool StyleRareNonInheritedData::reflectionDataEquivalent(const StyleRareNonInheritedData& o) const
{
- if (m_boxReflect != o.m_boxReflect) {
- if (!m_boxReflect || !o.m_boxReflect)
- return false;
- return *m_boxReflect == *o.m_boxReflect;
- }
- return true;
+ return dataEquivalent(m_boxReflect, o.m_boxReflect);
}
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))
+ if (!m_animations && !o.m_animations)
+ return true;
+ if (!m_animations || !o.m_animations)
return false;
- return true;
+ return m_animations->animationsMatchForStyleRecalc(*o.m_animations);
}
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))
+ if (!m_transitions && !o.m_transitions)
+ return true;
+ if (!m_transitions || !o.m_transitions)
return false;
- return true;
+ return m_transitions->transitionsMatchForStyleRecalc(*o.m_transitions);
}
bool StyleRareNonInheritedData::hasFilters() const
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleRareNonInheritedData.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleRareNonInheritedData.h
index 9ce04870219..f23461abab3 100755..100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleRareNonInheritedData.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleRareNonInheritedData.h
@@ -25,6 +25,7 @@
#ifndef StyleRareNonInheritedData_h
#define StyleRareNonInheritedData_h
+#include "core/css/StyleColor.h"
#include "core/rendering/ClipPathOperation.h"
#include "core/rendering/style/BasicShapes.h"
#include "core/rendering/style/CounterDirectives.h"
@@ -43,7 +44,9 @@
namespace WebCore {
class ContentData;
-class CSSAnimationDataList;
+class CSSAnimationData;
+class CSSTransitionData;
+class LengthSize;
class ShadowList;
class StyleDeprecatedFlexibleBoxData;
class StyleFilterData;
@@ -53,10 +56,8 @@ class StyleGridItemData;
class StyleMarqueeData;
class StyleMultiColData;
class StyleReflection;
-class StyleResolver;
class StyleTransformData;
-
-struct LengthSize;
+class StyleWillChangeData;
// Page size type.
// StyleRareNonInheritedData::m_pageSize is meaningful only when
@@ -106,6 +107,7 @@ public:
DataRef<StyleMarqueeData> m_marquee; // Marquee properties
DataRef<StyleMultiColData> m_multiCol; // CSS3 multicol properties
DataRef<StyleTransformData> m_transform; // Transform properties (rotate, scale, skew, etc.)
+ DataRef<StyleWillChangeData> m_willChange; // CSS Will Change
DataRef<StyleFilterData> m_filter; // Filter operations (url, sepia, blur, etc.)
@@ -119,30 +121,28 @@ public:
RefPtr<StyleReflection> m_boxReflect;
- OwnPtr<CSSAnimationDataList> m_animations;
- OwnPtr<CSSAnimationDataList> m_transitions;
+ OwnPtrWillBePersistent<CSSAnimationData> m_animations;
+ OwnPtrWillBePersistent<CSSTransitionData> m_transitions;
FillLayer m_mask;
NinePieceImage m_maskBoxImage;
LengthSize m_pageSize;
- RefPtr<ShapeValue> m_shapeInside;
RefPtr<ShapeValue> m_shapeOutside;
Length m_shapeMargin;
- Length m_shapePadding;
float m_shapeImageThreshold;
RefPtr<ClipPathOperation> m_clipPath;
- Color m_textDecorationColor;
- Color m_visitedLinkTextDecorationColor;
- Color m_visitedLinkBackgroundColor;
- Color m_visitedLinkOutlineColor;
- Color m_visitedLinkBorderLeftColor;
- Color m_visitedLinkBorderRightColor;
- Color m_visitedLinkBorderTopColor;
- Color m_visitedLinkBorderBottomColor;
+ StyleColor m_textDecorationColor;
+ StyleColor m_visitedLinkTextDecorationColor;
+ StyleColor m_visitedLinkBackgroundColor;
+ StyleColor m_visitedLinkOutlineColor;
+ StyleColor m_visitedLinkBorderLeftColor;
+ StyleColor m_visitedLinkBorderRightColor;
+ StyleColor m_visitedLinkBorderTopColor;
+ StyleColor m_visitedLinkBorderBottomColor;
int m_order;
@@ -150,21 +150,15 @@ public:
Vector<String> m_callbackSelectors;
- AtomicString m_flowThread;
- AtomicString m_regionThread;
- 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_alignItems : 4; // ItemPosition
+ unsigned m_alignItemsOverflowAlignment : 2; // OverflowAlignment
+ unsigned m_alignSelf : 4; // ItemPosition
+ unsigned m_alignSelfOverflowAlignment : 2; // OverflowAlignment
unsigned m_justifyContent : 3; // EJustifyContent
unsigned userDrag : 2; // EUserDrag
@@ -179,7 +173,12 @@ public:
unsigned m_wrapFlow: 3; // WrapFlow
unsigned m_wrapThrough: 1; // WrapThrough
- unsigned m_runningAcceleratedAnimation : 1;
+ unsigned m_hasCurrentOpacityAnimation : 1;
+ unsigned m_hasCurrentTransformAnimation : 1;
+ unsigned m_hasCurrentFilterAnimation : 1;
+ unsigned m_runningOpacityAnimationOnCompositor : 1;
+ unsigned m_runningTransformAnimationOnCompositor : 1;
+ unsigned m_runningFilterAnimationOnCompositor : 1;
unsigned m_hasAspectRatio : 1; // Whether or not an aspect ratio has been specified.
@@ -191,6 +190,19 @@ public:
unsigned m_isolation : 1; // Isolation
+ unsigned m_justifySelf : 4; // ItemPosition
+ unsigned m_justifySelfOverflowAlignment : 2; // OverflowAlignment
+
+ // ScrollBehavior. 'scroll-behavior' has 2 accepted values, but ScrollBehavior has a third
+ // value (that can only be specified using CSSOM scroll APIs) so 2 bits are needed.
+ unsigned m_scrollBehavior: 2;
+
+ // Plugins require accelerated compositing for reasons external to blink.
+ // In which case, we need to update the RenderStyle on the RenderEmbeddedObject,
+ // so store this bit so that the style actually changes when the plugin
+ // becomes composited.
+ unsigned m_requiresAcceleratedCompositingForExternalReasons: 1;
+
private:
StyleRareNonInheritedData();
StyleRareNonInheritedData(const StyleRareNonInheritedData&);
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleShader.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleShader.h
deleted file mode 100644
index c5927e67591..00000000000
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleShader.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2011 Adobe Systems Incorporated. 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 THE COPYRIGHT HOLDER “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 HOLDER 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 StyleShader_h
-#define StyleShader_h
-
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class ShaderResource;
-class CSSValue;
-
-class StyleShader : public RefCounted<StyleShader> {
-public:
- virtual ~StyleShader() { }
-
- ALWAYS_INLINE bool isShaderResource() const { return m_isShaderResource; }
- ALWAYS_INLINE bool isPendingShader() const { return m_isPendingShader; }
-
- virtual PassRefPtr<CSSValue> cssValue() const = 0;
-
- virtual ShaderResource* resource() const { return 0; }
-
-protected:
- StyleShader()
- : m_isShaderResource(false)
- , m_isPendingShader(false)
- {
- }
- bool m_isShaderResource : 1;
- bool m_isPendingShader : 1;
-};
-
-}
-
-
-#endif // StyleShader_h
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleVariableData.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleVariableData.h
deleted file mode 100644
index 23429f19c2e..00000000000
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleVariableData.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2012 Google 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:
- *
- * * 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 StyleVariableData_h
-#define StyleVariableData_h
-
-#include "wtf/Forward.h"
-#include "wtf/HashMap.h"
-#include "wtf/RefCounted.h"
-#include "wtf/text/AtomicStringHash.h"
-
-namespace WebCore {
-
-class CursorList;
-class QuotesData;
-class ShadowData;
-
-class StyleVariableData : public RefCounted<StyleVariableData> {
-public:
- static PassRefPtr<StyleVariableData> create() { return adoptRef(new StyleVariableData()); }
- PassRefPtr<StyleVariableData> copy() const { return adoptRef(new StyleVariableData(*this)); }
-
- bool operator==(const StyleVariableData& other) const { return other.m_data == m_data; }
- bool operator!=(const StyleVariableData& other) const { return !(*this == other); }
-
- void setVariable(const AtomicString& name, const String& value) { m_data.set(name, value); }
-
- HashMap<AtomicString, String> m_data;
-private:
- explicit StyleVariableData() : RefCounted<StyleVariableData>() { }
- StyleVariableData(const StyleVariableData& other) : RefCounted<StyleVariableData>(), m_data(HashMap<AtomicString, String>(other.m_data)) { }
-};
-
-} // namespace WebCore
-
-#endif /* StyleVariableData_h */
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleVisualData.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleVisualData.cpp
index db87122431b..e2774374bef 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleVisualData.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleVisualData.cpp
@@ -29,7 +29,6 @@ namespace WebCore {
StyleVisualData::StyleVisualData()
: hasClip(false)
, textDecoration(RenderStyle::initialTextDecoration())
- , m_textAutosizingMultiplier(1)
, m_zoom(RenderStyle::initialZoom())
{
}
@@ -43,7 +42,6 @@ StyleVisualData::StyleVisualData(const StyleVisualData& o)
, clip(o.clip)
, hasClip(o.hasClip)
, textDecoration(o.textDecoration)
- , m_textAutosizingMultiplier(o.m_textAutosizingMultiplier)
, m_zoom(RenderStyle::initialZoom())
{
}
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleVisualData.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleVisualData.h
index 2657b93ceec..ed79ea1aece 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleVisualData.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleVisualData.h
@@ -43,7 +43,6 @@ public:
return clip == o.clip
&& hasClip == o.hasClip
&& textDecoration == o.textDecoration
- && m_textAutosizingMultiplier == o.m_textAutosizingMultiplier
&& m_zoom == o.m_zoom;
}
bool operator!=(const StyleVisualData& o) const { return !(*this == o); }
@@ -52,7 +51,6 @@ public:
bool hasClip : 1;
unsigned textDecoration : TextDecorationBits; // Text decorations defined *only* by this element.
- float m_textAutosizingMultiplier;
float m_zoom;
private:
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleWillChangeData.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleWillChangeData.cpp
new file mode 100644
index 00000000000..7cd2bcbf0aa
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleWillChangeData.cpp
@@ -0,0 +1,24 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/rendering/style/StyleWillChangeData.h"
+
+namespace WebCore {
+
+StyleWillChangeData::StyleWillChangeData()
+ : m_contents(false)
+ , m_scrollPosition(false)
+{
+}
+
+StyleWillChangeData::StyleWillChangeData(const StyleWillChangeData& o)
+ : RefCounted<StyleWillChangeData>()
+ , m_properties(o.m_properties)
+ , m_contents(o.m_contents)
+ , m_scrollPosition(o.m_scrollPosition)
+{
+}
+
+} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleWillChangeData.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleWillChangeData.h
new file mode 100644
index 00000000000..9a9b6e76212
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleWillChangeData.h
@@ -0,0 +1,42 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef StyleWillChangeData_h
+#define StyleWillChangeData_h
+
+#include "core/CSSPropertyNames.h"
+#include "core/CSSValueKeywords.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
+
+namespace WebCore {
+
+class StyleWillChangeData : public RefCounted<StyleWillChangeData> {
+public:
+ static PassRefPtr<StyleWillChangeData> create() { return adoptRef(new StyleWillChangeData); }
+ PassRefPtr<StyleWillChangeData> copy() const { return adoptRef(new StyleWillChangeData(*this)); }
+
+ bool operator==(const StyleWillChangeData& o) const
+ {
+ return m_properties == o.m_properties && m_contents == o.m_contents && m_scrollPosition == o.m_scrollPosition;
+ }
+
+ bool operator!=(const StyleWillChangeData& o) const
+ {
+ return !(*this == o);
+ }
+
+ Vector<CSSPropertyID> m_properties;
+ unsigned m_contents : 1;
+ unsigned m_scrollPosition : 1;
+
+private:
+ StyleWillChangeData();
+ StyleWillChangeData(const StyleWillChangeData&);
+};
+
+} // namespace WebCore
+
+#endif // StyleWillChangeData_h