DisplayFillLayerImageGeometry.h [plain text]
#pragma once
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
#include "FloatRect.h"
#include "LayoutRect.h"
#include "RenderStyleConstants.h"
namespace WebCore {
class FillLayer;
class RenderStyle;
class StyleImage;
namespace Layout {
class Box;
class BoxGeometry;
}
namespace Display {
class Box;
class FillLayerImageGeometry {
public:
FillLayerImageGeometry(const FloatRect& destinationRect, const FloatSize& tileSize, const FloatSize& phase, const FloatSize& space, FillAttachment attachment)
: m_destRect(destinationRect)
, m_destOrigin(m_destRect.location())
, m_tileSize(tileSize)
, m_phase(phase)
, m_space(space)
, m_hasNonLocalGeometry(attachment == FillAttachment::FixedBackground)
{
}
FloatRect destRect() const { return m_destRect; }
FloatSize phase() const { return m_phase; }
FloatSize tileSize() const { return m_tileSize; }
FloatSize spaceSize() const { return m_space; }
bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; }
FloatSize relativePhase() const
{
FloatSize phase = m_phase;
phase += m_destRect.location() - m_destOrigin;
return phase;
}
void clip(const FloatRect& clipRect) { m_destRect.intersect(clipRect); }
private:
FloatRect m_destRect;
FloatPoint m_destOrigin;
FloatSize m_tileSize;
FloatSize m_phase;
FloatSize m_space;
bool m_hasNonLocalGeometry { false }; };
Vector<FillLayerImageGeometry, 1> calculateFillLayerImageGeometry(const RenderStyle&, const Layout::BoxGeometry&, LayoutSize offsetFromRoot, float pixelSnappingFactor);
} }
#endif // ENABLE(LAYOUT_FORMATTING_CONTEXT)