mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-05 09:52:54 +00:00
LibDraw: Put all classes in the Gfx namespace
I started adding things to a Draw namespace, but it somehow felt really wrong seeing Draw::Rect and Draw::Bitmap, etc. So instead, let's rename the library to LibGfx. :^)
This commit is contained in:
parent
939a605334
commit
11580babbf
Notes:
sideshowbarker
2024-07-19 09:35:13 +09:00
Author: https://github.com/awesomekling
Commit: 11580babbf
269 changed files with 1513 additions and 1315 deletions
|
@ -162,7 +162,7 @@ Color Document::background_color(const Palette& palette) const
|
|||
return background_color.value()->to_color(*this);
|
||||
}
|
||||
|
||||
RefPtr<GraphicsBitmap> Document::background_image() const
|
||||
RefPtr<Gfx::Bitmap> Document::background_image() const
|
||||
{
|
||||
auto* body_element = body();
|
||||
if (!body_element)
|
||||
|
|
|
@ -40,7 +40,10 @@ namespace Core {
|
|||
class Timer;
|
||||
}
|
||||
|
||||
namespace Gfx {
|
||||
class Palette;
|
||||
}
|
||||
|
||||
class Frame;
|
||||
class HTMLBodyElement;
|
||||
class HTMLHtmlElement;
|
||||
|
@ -90,8 +93,8 @@ public:
|
|||
Frame* frame() { return m_frame.ptr(); }
|
||||
const Frame* frame() const { return m_frame.ptr(); }
|
||||
|
||||
Color background_color(const Palette&) const;
|
||||
RefPtr<GraphicsBitmap> background_image() const;
|
||||
Color background_color(const Gfx::Palette&) const;
|
||||
RefPtr<Gfx::Bitmap> background_image() const;
|
||||
|
||||
Color link_color() const;
|
||||
void set_link_color(Color);
|
||||
|
|
|
@ -60,7 +60,7 @@ void HTMLImageElement::load_image(const String& src)
|
|||
}
|
||||
|
||||
m_encoded_data = data;
|
||||
m_image_decoder = ImageDecoder::create(m_encoded_data.data(), m_encoded_data.size());
|
||||
m_image_decoder = Gfx::ImageDecoder::create(m_encoded_data.data(), m_encoded_data.size());
|
||||
document().update_layout();
|
||||
});
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ RefPtr<LayoutNode> HTMLImageElement::create_layout_node(const StyleProperties* p
|
|||
return adopt(*new LayoutImage(*this, move(style)));
|
||||
}
|
||||
|
||||
const GraphicsBitmap* HTMLImageElement::bitmap() const
|
||||
const Gfx::Bitmap* HTMLImageElement::bitmap() const
|
||||
{
|
||||
if (!m_image_decoder)
|
||||
return nullptr;
|
||||
|
@ -118,5 +118,5 @@ void HTMLImageElement::set_volatile(Badge<LayoutDocument>, bool v)
|
|||
bool has_image = m_image_decoder->set_nonvolatile();
|
||||
if (has_image)
|
||||
return;
|
||||
m_image_decoder = ImageDecoder::create(m_encoded_data.data(), m_encoded_data.size());
|
||||
m_image_decoder = Gfx::ImageDecoder::create(m_encoded_data.data(), m_encoded_data.size());
|
||||
}
|
||||
|
|
|
@ -44,8 +44,8 @@ public:
|
|||
int preferred_width() const;
|
||||
int preferred_height() const;
|
||||
|
||||
const GraphicsBitmap* bitmap() const;
|
||||
const ImageDecoder* image_decoder() const { return m_image_decoder; }
|
||||
const Gfx::Bitmap* bitmap() const;
|
||||
const Gfx::ImageDecoder* image_decoder() const { return m_image_decoder; }
|
||||
|
||||
void set_volatile(Badge<LayoutDocument>, bool);
|
||||
|
||||
|
@ -54,6 +54,6 @@ private:
|
|||
|
||||
virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) const override;
|
||||
|
||||
RefPtr<ImageDecoder> m_image_decoder;
|
||||
RefPtr<Gfx::ImageDecoder> m_image_decoder;
|
||||
ByteBuffer m_encoded_data;
|
||||
};
|
||||
|
|
|
@ -52,7 +52,7 @@ RefPtr<LayoutNode> HTMLInputElement::create_layout_node(const StyleProperties*)
|
|||
RefPtr<GUI::Widget> widget;
|
||||
if (type() == "submit") {
|
||||
auto button = GUI::Button::construct(value(), &html_view);
|
||||
int text_width = Font::default_font().width(value());
|
||||
int text_width = Gfx::Font::default_font().width(value());
|
||||
button->set_relative_rect(0, 0, text_width + 20, 20);
|
||||
button->on_click = [this](auto&) {
|
||||
if (auto* form = first_ancestor_of_type<HTMLFormElement>()) {
|
||||
|
@ -68,7 +68,7 @@ RefPtr<LayoutNode> HTMLInputElement::create_layout_node(const StyleProperties*)
|
|||
auto& widget = to<LayoutWidget>(layout_node())->widget();
|
||||
const_cast<HTMLInputElement*>(this)->set_attribute("value", static_cast<const GUI::TextBox&>(widget).text());
|
||||
};
|
||||
int text_width = Font::default_font().width(value());
|
||||
int text_width = Gfx::Font::default_font().width(value());
|
||||
text_box->set_relative_rect(0, 0, text_width + 20, 20);
|
||||
widget = text_box;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue