summaryrefslogtreecommitdiff
path: root/Libraries/LibHTML/Layout
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-12-18 20:52:36 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-12-18 20:52:36 +0100
commit85ac9705bac2e1a494884874ff343ceabe88d32a (patch)
treefca7a5355e7c91408fcc8dc785def3986e26c4f4 /Libraries/LibHTML/Layout
parent7cc4b90b169c8134bc1f806f7102370edc36ac5f (diff)
downloadserenity-85ac9705bac2e1a494884874ff343ceabe88d32a.zip
LibHTML: Add LayoutNode::is_image() and is<LayoutImage> helper
Diffstat (limited to 'Libraries/LibHTML/Layout')
-rw-r--r--Libraries/LibHTML/Layout/LayoutImage.h7
-rw-r--r--Libraries/LibHTML/Layout/LayoutNode.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/Libraries/LibHTML/Layout/LayoutImage.h b/Libraries/LibHTML/Layout/LayoutImage.h
index 344797769c..5fcf62ca55 100644
--- a/Libraries/LibHTML/Layout/LayoutImage.h
+++ b/Libraries/LibHTML/Layout/LayoutImage.h
@@ -19,4 +19,11 @@ public:
private:
virtual const char* class_name() const override { return "LayoutImage"; }
+ virtual bool is_image() const override { return true; }
};
+
+template<>
+inline bool is<LayoutImage>(const LayoutNode& node)
+{
+ return node.is_image();
+}
diff --git a/Libraries/LibHTML/Layout/LayoutNode.h b/Libraries/LibHTML/Layout/LayoutNode.h
index 7f80b73e91..35591ae77e 100644
--- a/Libraries/LibHTML/Layout/LayoutNode.h
+++ b/Libraries/LibHTML/Layout/LayoutNode.h
@@ -58,6 +58,7 @@ public:
virtual bool is_block() const { return false; }
virtual bool is_replaced() const { return false; }
virtual bool is_widget() const { return false; }
+ virtual bool is_image() const { return false; }
virtual bool is_box() const { return false; }
virtual bool is_table() const { return false; }
virtual bool is_table_row() const { return false; }