StyleInvalidation.h 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/CSS/PropertyID.h>
  8. namespace Web::CSS {
  9. struct RequiredInvalidationAfterStyleChange {
  10. bool repaint : 1 { false };
  11. bool rebuild_stacking_context_tree : 1 { false };
  12. bool relayout : 1 { false };
  13. bool rebuild_layout_tree : 1 { false };
  14. void operator|=(RequiredInvalidationAfterStyleChange const& other)
  15. {
  16. repaint |= other.repaint;
  17. rebuild_stacking_context_tree |= other.rebuild_stacking_context_tree;
  18. relayout |= other.relayout;
  19. rebuild_layout_tree |= other.rebuild_layout_tree;
  20. }
  21. [[nodiscard]] bool is_none() const { return !repaint && !rebuild_stacking_context_tree && !relayout && !rebuild_layout_tree; }
  22. static RequiredInvalidationAfterStyleChange full() { return { true, true, true, true }; }
  23. };
  24. RequiredInvalidationAfterStyleChange compute_property_invalidation(CSS::PropertyID property_id, RefPtr<CSS::StyleValue const> const& old_value, RefPtr<CSS::StyleValue const> const& new_value);
  25. }