1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 19:45:07 +00:00
serenity/Userland/Libraries/LibWeb/Painting/PaintContext.cpp
Sam Atkins d3476c28ba LibWeb+WebContent+headless-browser: Remove PaintContext::scroll_offset()
Nobody uses this. They get the scroll_offset from the BlockContainer
instead.
2022-12-10 12:03:19 +00:00

35 lines
770 B
C++

/*
* Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Painting/PaintContext.h>
namespace Web {
PaintContext::PaintContext(Gfx::Painter& painter, Palette const& palette)
: m_painter(painter)
, m_palette(palette)
{
}
SVGContext& PaintContext::svg_context()
{
// FIXME: This is a total hack to avoid crashing on content that has SVG elements embedded directly in HTML without an <svg> element.
if (!m_svg_context.has_value())
m_svg_context = SVGContext { {} };
return m_svg_context.value();
}
void PaintContext::set_svg_context(SVGContext context)
{
m_svg_context = move(context);
}
void PaintContext::clear_svg_context()
{
m_svg_context.clear();
}
}