From 85ac9705bac2e1a494884874ff343ceabe88d32a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 18 Dec 2019 20:52:36 +0100 Subject: LibHTML: Add LayoutNode::is_image() and is helper --- Libraries/LibHTML/Layout/LayoutImage.h | 7 +++++++ Libraries/LibHTML/Layout/LayoutNode.h | 1 + 2 files changed, 8 insertions(+) (limited to 'Libraries/LibHTML') 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(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; } -- cgit v1.2.3