зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1553731 - Part 3: Make nsIFrame::Is___Frame() avoid reading from memory. r=mats
Differential Revision: https://phabricator.services.mozilla.com/D32605 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
11958c344f
Коммит
41de040ecf
|
@ -36,4 +36,4 @@ def generate_frame_type_list_h(output, *ignore):
|
|||
groups = grouped_frame_classes()
|
||||
output.write(HEADER)
|
||||
for group in groups:
|
||||
output.write("FRAME_TYPE(%s)\n" % group[0].ty)
|
||||
output.write("FRAME_TYPE(%s, %s, %s)\n" % (group[0].ty, group[0].cls, group[-1].cls))
|
||||
|
|
|
@ -169,7 +169,7 @@ class Selection;
|
|||
namespace mozilla {
|
||||
|
||||
enum class LayoutFrameType : uint8_t {
|
||||
#define FRAME_TYPE(ty_) ty_,
|
||||
#define FRAME_TYPE(ty_, ...) ty_,
|
||||
#include "mozilla/FrameTypeList.h"
|
||||
#undef FRAME_TYPE
|
||||
};
|
||||
|
@ -2795,13 +2795,23 @@ class nsIFrame : public nsQueryFrame {
|
|||
return sLayoutFrameTypes[uint8_t(mClass)];
|
||||
}
|
||||
|
||||
#define FRAME_TYPE(name_) \
|
||||
bool Is##name_##Frame() const { \
|
||||
return Type() == mozilla::LayoutFrameType::name_; \
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
#endif
|
||||
|
||||
#define FRAME_TYPE(name_, first_class_, last_class_) \
|
||||
bool Is##name_##Frame() const { \
|
||||
return uint8_t(mClass) >= uint8_t(ClassID::first_class_##_id) && \
|
||||
uint8_t(mClass) <= uint8_t(ClassID::last_class_##_id); \
|
||||
}
|
||||
#include "mozilla/FrameTypeList.h"
|
||||
#undef FRAME_TYPE
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns a transformation matrix that converts points in this frame's
|
||||
* coordinate space to points in some ancestor frame's coordinate space.
|
||||
|
|
Загрузка…
Ссылка в новой задаче