diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 4c2e4fd84b7f..3217f8b5c977 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -787,12 +787,13 @@ public: * accepts an *optional* pointer the style struct. */ #define STYLE_STRUCT(name_, checkdata_cb_) \ - const nsStyle##name_ * Style##name_ () const { \ + const nsStyle##name_ * Style##name_ () const MOZ_NONNULL_RETURN { \ NS_ASSERTION(mStyleContext, "No style context found!"); \ return mStyleContext->Style##name_ (); \ } \ const nsStyle##name_ * Style##name_##WithOptionalParam( \ - const nsStyle##name_ * aStyleStruct) const { \ + const nsStyle##name_ * aStyleStruct) const \ + MOZ_NONNULL_RETURN { \ if (aStyleStruct) { \ MOZ_ASSERT(aStyleStruct == Style##name_()); \ return aStyleStruct; \ diff --git a/layout/style/nsStyleContext.h b/layout/style/nsStyleContext.h index 632f1ac3dc57..161e8ea31906 100644 --- a/layout/style/nsStyleContext.h +++ b/layout/style/nsStyleContext.h @@ -345,7 +345,7 @@ public: * function, both because they're easier to read and because they're * faster. */ - const void* NS_FASTCALL StyleData(nsStyleStructID aSID); + const void* NS_FASTCALL StyleData(nsStyleStructID aSID) MOZ_NONNULL_RETURN; /** * Define typesafe getter functions for each style struct by @@ -354,9 +354,9 @@ public: * const nsStyleBorder* StyleBorder(); * const nsStyleColor* StyleColor(); */ - #define STYLE_STRUCT(name_, checkdata_cb_) \ - const nsStyle##name_ * Style##name_() { \ - return DoGetStyle##name_(); \ + #define STYLE_STRUCT(name_, checkdata_cb_) \ + const nsStyle##name_ * Style##name_() MOZ_NONNULL_RETURN { \ + return DoGetStyle##name_(); \ } #include "nsStyleStructList.h" #undef STYLE_STRUCT