bool ExclusionShapeInsideInfo::isExclusionShapeInsideInfoEnabledForRenderBlock(const RenderBlock* block) { // FIXME: Bug 89707: Enable shape inside for non-rectangular shapes ExclusionShapeValue* shapeValue = block->style()->shapeInside(); BasicShape* shape = (shapeValue && shapeValue->type() == ExclusionShapeValue::SHAPE) ? shapeValue->shape() : 0; return shape && (shape->type() == BasicShape::BASIC_SHAPE_RECTANGLE || shape->type() == BasicShape::BASIC_SHAPE_POLYGON); }
bool BasicShapeCircle::canBlend(const BasicShape& other) const { if (type() != other.type()) return false; return radius().canBlend(downcast<BasicShapeCircle>(other).radius()); }
bool BasicShapePolygon::canBlend(const BasicShape& other) const { if (type() != other.type()) return false; auto& otherPolygon = downcast<BasicShapePolygon>(other); return values().size() == otherPolygon.values().size() && windRule() == otherPolygon.windRule(); }
bool BasicShapePath::operator==(const BasicShape& other) const { if (type() != other.type()) return false; auto& otherPath = downcast<BasicShapePath>(other); return m_windRule == otherPath.m_windRule && *m_byteStream == *otherPath.m_byteStream; }
bool BasicShapeEllipse::canBlend(const BasicShape& other) const { if (type() != other.type()) return false; auto& otherEllipse = downcast<BasicShapeEllipse>(other); return radiusX().canBlend(otherEllipse.radiusX()) && radiusY().canBlend(otherEllipse.radiusY()); }
bool BasicShapePath::canBlend(const BasicShape& other) const { if (type() != other.type()) return false; auto& otherPath = downcast<BasicShapePath>(other); return windRule() == otherPath.windRule() && canBlendSVGPathByteStreams(*m_byteStream, *otherPath.pathData()); }
bool BasicShapePolygon::operator==(const BasicShape& other) const { if (type() != other.type()) return false; auto& otherPolygon = downcast<BasicShapePolygon>(other); return m_windRule == otherPolygon.m_windRule && m_values == otherPolygon.m_values; }
bool ExclusionShapeInsideInfo::isEnabledFor(const RenderBlock* renderer) { ExclusionShapeValue* shapeValue = renderer->style()->resolvedShapeInside(); if (!shapeValue || shapeValue->type() != ExclusionShapeValue::Shape) return false; BasicShape* shape = shapeValue->shape(); return shape && shape->type() != BasicShape::BasicShapeInsetRectangleType; }
bool BasicShapeCircle::operator==(const BasicShape& other) const { if (type() != other.type()) return false; auto& otherCircle = downcast<BasicShapeCircle>(other); return m_centerX == otherCircle.m_centerX && m_centerY == otherCircle.m_centerY && m_radius == otherCircle.m_radius; }
bool WrapShapeInfo::isWrapShapeInfoEnabledForRenderBlock(const RenderBlock* block) { // FIXME: Bug 89705: Enable shape inside for vertical writing modes if (!block->isHorizontalWritingMode()) return false; // FIXME: Bug 89707: Enable shape inside for non-rectangular shapes BasicShape* shape = block->style()->wrapShapeInside(); return (shape && shape->type() == BasicShape::BASIC_SHAPE_RECTANGLE); }
bool BasicShapeEllipse::operator==(const BasicShape& other) const { if (type() != other.type()) return false; auto& otherEllipse = downcast<BasicShapeEllipse>(other); return m_centerX == otherEllipse.m_centerX && m_centerY == otherEllipse.m_centerY && m_radiusX == otherEllipse.m_radiusX && m_radiusY == otherEllipse.m_radiusY; }
Ref<BasicShape> BasicShapeCircle::blend(const BasicShape& other, double progress) const { ASSERT(type() == other.type()); auto& otherCircle = downcast<BasicShapeCircle>(other); auto result = BasicShapeCircle::create(); result->setCenterX(m_centerX.blend(otherCircle.centerX(), progress)); result->setCenterY(m_centerY.blend(otherCircle.centerY(), progress)); result->setRadius(m_radius.blend(otherCircle.radius(), progress)); return WTFMove(result); }
Ref<BasicShape> BasicShapePath::blend(const BasicShape& from, double progress) const { ASSERT(type() == from.type()); auto& fromPath = downcast<BasicShapePath>(from); auto resultingPathBytes = std::make_unique<SVGPathByteStream>(); buildAnimatedSVGPathByteStream(*fromPath.m_byteStream, *m_byteStream, *resultingPathBytes, progress); auto result = BasicShapePath::create(WTFMove(resultingPathBytes)); result->setWindRule(windRule()); return WTFMove(result); }
bool BasicShapeInset::operator==(const BasicShape& other) const { if (type() != other.type()) return false; auto& otherInset = downcast<BasicShapeInset>(other); return m_right == otherInset.m_right && m_top == otherInset.m_top && m_bottom == otherInset.m_bottom && m_left == otherInset.m_left && m_topLeftRadius == otherInset.m_topLeftRadius && m_topRightRadius == otherInset.m_topRightRadius && m_bottomRightRadius == otherInset.m_bottomRightRadius && m_bottomLeftRadius == otherInset.m_bottomLeftRadius; }
Ref<BasicShape> BasicShapeInset::blend(const BasicShape& other, double progress) const { ASSERT(type() == other.type()); auto& otherInset = downcast<BasicShapeInset>(other); auto result = BasicShapeInset::create(); result->setTop(m_top.blend(otherInset.top(), progress)); result->setRight(m_right.blend(otherInset.right(), progress)); result->setBottom(m_bottom.blend(otherInset.bottom(), progress)); result->setLeft(m_left.blend(otherInset.left(), progress)); result->setTopLeftRadius(m_topLeftRadius.blend(otherInset.topLeftRadius(), progress)); result->setTopRightRadius(m_topRightRadius.blend(otherInset.topRightRadius(), progress)); result->setBottomRightRadius(m_bottomRightRadius.blend(otherInset.bottomRightRadius(), progress)); result->setBottomLeftRadius(m_bottomLeftRadius.blend(otherInset.bottomLeftRadius(), progress)); return WTFMove(result); }
Ref<BasicShape> BasicShapeEllipse::blend(const BasicShape& other, double progress) const { ASSERT(type() == other.type()); auto& otherEllipse = downcast<BasicShapeEllipse>(other); auto result = BasicShapeEllipse::create(); if (m_radiusX.type() != BasicShapeRadius::Value || otherEllipse.radiusX().type() != BasicShapeRadius::Value || m_radiusY.type() != BasicShapeRadius::Value || otherEllipse.radiusY().type() != BasicShapeRadius::Value) { result->setCenterX(otherEllipse.centerX()); result->setCenterY(otherEllipse.centerY()); result->setRadiusX(otherEllipse.radiusX()); result->setRadiusY(otherEllipse.radiusY()); return WTFMove(result); } result->setCenterX(m_centerX.blend(otherEllipse.centerX(), progress)); result->setCenterY(m_centerY.blend(otherEllipse.centerY(), progress)); result->setRadiusX(m_radiusX.blend(otherEllipse.radiusX(), progress)); result->setRadiusY(m_radiusY.blend(otherEllipse.radiusY(), progress)); return WTFMove(result); }
Ref<BasicShape> BasicShapePolygon::blend(const BasicShape& other, double progress) const { ASSERT(type() == other.type()); auto& otherPolygon = downcast<BasicShapePolygon>(other); ASSERT(m_values.size() == otherPolygon.values().size()); ASSERT(!(m_values.size() % 2)); size_t length = m_values.size(); auto result = BasicShapePolygon::create(); if (!length) return WTFMove(result); result->setWindRule(otherPolygon.windRule()); for (size_t i = 0; i < length; i = i + 2) { result->appendPoint(m_values.at(i).blend(otherPolygon.values().at(i), progress), m_values.at(i + 1).blend(otherPolygon.values().at(i + 1), progress)); } return WTFMove(result); }
bool BasicShapeInset::canBlend(const BasicShape& other) const { return type() == other.type(); }