示例#1
0
static inline CSSBoxType referenceBox(const ShapeValue& shapeValue)
{
    if (shapeValue.cssBox() == BoxMissing) {
        if (shapeValue.type() == ShapeValue::Image)
            return ContentBox;
        return MarginBox;
    }
    return shapeValue.cssBox();
}
bool ShapeInsideInfo::isEnabledFor(const RenderBlock* renderer)
{
    ShapeValue* shapeValue = renderer->style()->resolvedShapeInside();
    if (!shapeValue || shapeValue->type() != ShapeValue::Shape)
        return false;

    BasicShape* shape = shapeValue->shape();
    return shape && shape->type() != BasicShape::BasicShapeInsetRectangleType;
}
示例#3
0
const Shape* ShapeInfo<RenderType, shapeGetter, intervalGetter>::computedShape() const
{
    if (Shape* shape = m_shape.get())
        return shape;

    ShapeValue* shapeValue = (m_renderer->style()->*shapeGetter)();
    BasicShape* shape = (shapeValue && shapeValue->type() == ShapeValue::Shape) ? shapeValue->shape() : 0;

    ASSERT(shape);

    m_shape = Shape::createShape(shape, LayoutSize(m_shapeLogicalWidth, m_shapeLogicalHeight), m_renderer->style()->writingMode(), m_renderer->style()->shapeMargin(), m_renderer->style()->shapePadding());
    ASSERT(m_shape);
    return m_shape.get();
}
示例#4
0
bool ShapeInsideInfo::isEnabledFor(const RenderBlock* renderer)
{
    ShapeValue* shapeValue = renderer->style()->resolvedShapeInside();
    if (!shapeValue)
        return false;

    switch (shapeValue->type()) {
    case ShapeValue::Shape:
        return shapeValue->shape() && shapeValue->shape()->type() != BasicShape::BasicShapeInsetRectangleType;
    case ShapeValue::Image:
        return shapeValue->isImageValid();
    default:
        return false;
    }
}
示例#5
0
bool ShapeOutsideInfo::isEnabledFor(const RenderBox& box)
{
    ShapeValue* shapeValue = box.style().shapeOutside();
    if (!box.isFloating() || !shapeValue)
        return false;

    switch (shapeValue->type()) {
    case ShapeValue::Shape: return shapeValue->shape();
    case ShapeValue::Image: return shapeValue->isImageValid() && checkShapeImageOrigin(box.document(), *(shapeValue->image()));
    case ShapeValue::Box: return true;
    }

    ASSERT_NOT_REACHED();
    return false;
}
示例#6
0
bool ShapeOutsideInfo::isEnabledFor(const RenderBox* box)
{
    ShapeValue* shapeValue = box->style()->shapeOutside();
    if (!box->isFloating() || !shapeValue)
        return false;

    switch (shapeValue->type()) {
    case ShapeValue::Shape:
        return shapeValue->shape();
    case ShapeValue::Image:
        return shapeValue->isImageValid();
    default:
        return false;
    }
}
示例#7
0
bool ShapeOutsideInfo::isEnabledFor(const RenderBox* box)
{
    ShapeValue* shapeValue = box->style().shapeOutside();
    if (!box->isFloating() || !shapeValue)
        return false;

    switch (shapeValue->type()) {
    case ShapeValue::Shape:
        return shapeValue->shape();
    case ShapeValue::Image:
        return shapeValue->isImageValid() && checkShapeImageOrigin(box->document(), *(shapeValue->image()->cachedImage()));
    default:
        return false;
    }
}
bool ShapeInsideInfo::isEnabledFor(const RenderBlock* renderer)
{
    ShapeValue* shapeValue = renderer->style()->resolvedShapeInside();
    if (!shapeValue)
        return false;

    switch (shapeValue->type()) {
    case ShapeValue::Shape:
        return shapeValue->shape() && shapeValue->shape()->type() != BasicShape::BasicShapeInsetRectangleType && shapeValue->shape()->type() != BasicShape::BasicShapeInsetType;
    case ShapeValue::Image:
        return shapeValue->isImageValid() && checkShapeImageOrigin(renderer->document(), *(shapeValue->image()->cachedImage()));
    case ShapeValue::Box:
        return true;
    case ShapeValue::Outside:
        return false;
    }

    return false;
}
示例#9
0
static void getShapeImageAndRect(const ShapeValue& shapeValue, const RenderBox& renderBox, const LayoutSize& referenceBoxSize, Image*& image, LayoutRect& rect)
{
    ASSERT(shapeValue.isImageValid());
    StyleImage* styleImage = shapeValue.image();

    const LayoutSize& imageSize = renderBox.calculateImageIntrinsicDimensions(styleImage, roundedIntSize(referenceBoxSize), RenderImage::ScaleByEffectiveZoom);
    styleImage->setContainerSizeForRenderer(&renderBox, imageSize, renderBox.style().effectiveZoom());

    image = nullptr;
    if (styleImage->isCachedImage() || styleImage->isCachedImageSet())
        image = styleImage->cachedImage()->imageForRenderer(&renderBox);
    else if (styleImage->isGeneratedImage())
        image = styleImage->image(const_cast<RenderBox*>(&renderBox), imageSize).get();

    if (renderBox.isRenderImage())
        rect = toRenderImage(&renderBox)->replacedContentRect(renderBox.intrinsicSize());
    else
        rect = LayoutRect(LayoutPoint(), imageSize);
}
示例#10
0
bool ShapeInsideInfo::isEnabledFor(const RenderBlock& renderer)
{
    ShapeValue* shapeValue = renderer.style().resolvedShapeInside();
    if (!shapeValue)
        return false;

    switch (shapeValue->type()) {
    case ShapeValue::Shape:
        return shapeValue->shape() && shapeValue->shape()->type() != BasicShape::BasicShapeInsetRectangleType && shapeValue->shape()->type() != BasicShape::BasicShapeInsetType;
    case ShapeValue::Image:
        return shapeValue->isImageValid() && checkShapeImageOrigin(renderer.document(), *(shapeValue->image()->cachedImage()));
    case ShapeValue::Box:
        return false;
    case ShapeValue::Outside:
        // Outside value must already be resolved
        break;
    }
    ASSERT_NOT_REACHED();
    return false;
}
示例#11
0
CSSBoxType referenceBox(const ShapeValue& shapeValue)
{
    if (shapeValue.cssBox() == BoxMissing)
        return MarginBox;
    return shapeValue.cssBox();
}
示例#12
0
size_t ValueTraits<ShapeValue>::Cardinality(const ShapeValue& path) {
    return SkTo<size_t>(path.countVerbs());
}