mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:57:45 +00:00
LibWeb: Move HTML classes into the Web::HTML namespace
This commit is contained in:
parent
ebd2e7d9f5
commit
c46439f240
82 changed files with 238 additions and 247 deletions
|
@ -29,7 +29,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
LayoutBreak::LayoutBreak(DOM::Document& document, const HTMLBRElement& element)
|
||||
LayoutBreak::LayoutBreak(DOM::Document& document, const HTML::HTMLBRElement& element)
|
||||
: LayoutNodeWithStyleAndBoxModelMetrics(document, &element, CSS::StyleProperties::create())
|
||||
{
|
||||
set_inline(true);
|
||||
|
|
|
@ -33,10 +33,10 @@ namespace Web {
|
|||
|
||||
class LayoutBreak final : public LayoutNodeWithStyleAndBoxModelMetrics {
|
||||
public:
|
||||
LayoutBreak(DOM::Document&, const HTMLBRElement&);
|
||||
LayoutBreak(DOM::Document&, const HTML::HTMLBRElement&);
|
||||
virtual ~LayoutBreak() override;
|
||||
|
||||
const HTMLBRElement& node() const { return downcast<HTMLBRElement>(*LayoutNode::node()); }
|
||||
const HTML::HTMLBRElement& node() const { return downcast<HTML::HTMLBRElement>(*LayoutNode::node()); }
|
||||
|
||||
private:
|
||||
virtual bool is_break() const override { return true; }
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
LayoutCanvas::LayoutCanvas(DOM::Document& document, const HTMLCanvasElement& element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
LayoutCanvas::LayoutCanvas(DOM::Document& document, const HTML::HTMLCanvasElement& element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
: LayoutReplaced(document, element, move(style))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -31,24 +31,21 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
class HTMLCanvasElement;
|
||||
|
||||
class LayoutCanvas : public LayoutReplaced {
|
||||
public:
|
||||
LayoutCanvas(DOM::Document&, const HTMLCanvasElement&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
LayoutCanvas(DOM::Document&, const HTML::HTMLCanvasElement&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
virtual ~LayoutCanvas() override;
|
||||
|
||||
virtual void layout(LayoutMode = LayoutMode::Default) override;
|
||||
virtual void paint(PaintContext&, PaintPhase) override;
|
||||
|
||||
const HTMLCanvasElement& node() const { return static_cast<const HTMLCanvasElement&>(LayoutReplaced::node()); }
|
||||
const HTML::HTMLCanvasElement& node() const { return static_cast<const HTML::HTMLCanvasElement&>(LayoutReplaced::node()); }
|
||||
|
||||
private:
|
||||
virtual const char* class_name() const override { return "LayoutCanvas"; }
|
||||
virtual bool is_canvas() const override { return true; }
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::LayoutCanvas)
|
||||
|
|
|
@ -39,8 +39,8 @@ public:
|
|||
virtual void paint(PaintContext&, PaintPhase) override;
|
||||
virtual void layout(LayoutMode) override;
|
||||
|
||||
const HTMLIFrameElement& node() const { return static_cast<const HTMLIFrameElement&>(LayoutReplaced::node()); }
|
||||
HTMLIFrameElement& node() { return static_cast<HTMLIFrameElement&>(LayoutReplaced::node()); }
|
||||
const HTML::HTMLIFrameElement& node() const { return downcast<HTML::HTMLIFrameElement>(LayoutReplaced::node()); }
|
||||
HTML::HTMLIFrameElement& node() { return downcast<HTML::HTMLIFrameElement>(LayoutReplaced::node()); }
|
||||
|
||||
private:
|
||||
virtual bool is_frame() const final { return true; }
|
||||
|
|
|
@ -71,7 +71,7 @@ void LayoutImage::layout(LayoutMode layout_mode)
|
|||
}
|
||||
|
||||
if (renders_as_alt_text()) {
|
||||
auto& image_element = downcast<HTMLImageElement>(node());
|
||||
auto& image_element = downcast<HTML::HTMLImageElement>(node());
|
||||
auto& font = Gfx::Font::default_font();
|
||||
auto alt = image_element.alt();
|
||||
if (alt.is_empty())
|
||||
|
@ -101,7 +101,7 @@ void LayoutImage::paint(PaintContext& context, PaintPhase phase)
|
|||
|
||||
if (phase == PaintPhase::Foreground) {
|
||||
if (renders_as_alt_text()) {
|
||||
auto& image_element = downcast<HTMLImageElement>(node());
|
||||
auto& image_element = downcast<HTML::HTMLImageElement>(node());
|
||||
context.painter().set_font(Gfx::Font::default_font());
|
||||
Gfx::StylePainter::paint_frame(context.painter(), enclosing_int_rect(absolute_rect()), context.palette(), Gfx::FrameShape::Container, Gfx::FrameShadow::Sunken, 2);
|
||||
auto alt = image_element.alt();
|
||||
|
@ -116,7 +116,7 @@ void LayoutImage::paint(PaintContext& context, PaintPhase phase)
|
|||
|
||||
bool LayoutImage::renders_as_alt_text() const
|
||||
{
|
||||
if (is<HTMLImageElement>(node()))
|
||||
if (is<HTML::HTMLImageElement>(node()))
|
||||
return !m_image_loader.has_image();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
class HTMLImageElement;
|
||||
|
||||
class LayoutImage : public LayoutReplaced {
|
||||
public:
|
||||
LayoutImage(DOM::Document&, const DOM::Element&, NonnullRefPtr<CSS::StyleProperties>, const ImageLoader&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue