Skip to content

Instantly share code, notes, and snippets.

@fujii
Created December 23, 2021 05:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fujii/141f8b4f2fd0f0603e48a835e7a50222 to your computer and use it in GitHub Desktop.
Save fujii/141f8b4f2fd0f0603e48a835e7a50222 to your computer and use it in GitHub Desktop.
// cl -std:c++20 /permissive- -c r20.cpp
// https://webkit.org/b/234546
template<typename T>
struct RefPtr {
RefPtr(T* ptr) : m_ptr(ptr) { }
T* operator->() { return m_ptr; }
bool operator!() const { return !m_ptr; }
T* m_ptr;
};
struct Element {
Element* parentElement();
bool isSVGElement();
};
template<typename AnimationFunction>
class SVGPropertyAnimator {
public:
bool computeInheritedCSSPropertyValue(Element& targetElement) const
{
RefPtr parent = targetElement.parentElement();
return !(parent->isSVGElement());
}
bool computeInheritedCSSPropertyValue2(Element& targetElement) const
{
RefPtr parent = targetElement.parentElement();
return !parent;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment