Bug 1367904 - Part 4: stylo: Replace real ComputedValues with bindgenned ComputedValues2; r=bholley

MozReview-Commit-ID: GRkycXueUVr
This commit is contained in:
Manish Goregaokar 2017-07-17 11:41:41 -07:00
Родитель 25536ab88d
Коммит 387babf22c
4 изменённых файлов: 38 добавлений и 1 удалений

Просмотреть файл

@ -67,6 +67,12 @@ class nsStyleCoord;
struct nsStyleDisplay;
class nsXBLBinding;
namespace mozilla {
#define STYLE_STRUCT(name_, checkdata_cb_) struct Gecko##name_ {nsStyle##name_ gecko;};
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
}
#define NS_DECL_THREADSAFE_FFI_REFCOUNTING(class_, name_) \
void Gecko_AddRef##name_##ArbitraryThread(class_* aPtr); \
void Gecko_Release##name_##ArbitraryThread(class_* aPtr);

Просмотреть файл

@ -314,7 +314,9 @@ mapped-generic-types = [
{ generic = false, gecko = "mozilla::ServoWritingMode", servo = "::logical_geometry::WritingMode" },
{ generic = false, gecko = "mozilla::ServoFontComputationData", servo = "::properties::FontComputationData" },
{ generic = false, gecko = "mozilla::ServoCustomPropertiesMap", servo = "Option<::stylearc::Arc<::custom_properties::CustomPropertiesMap>>" },
{ generic = false, gecko = "mozilla::ServoRuleNode", servo = "Option<::rule_tree::StrongRuleNode>" },
{ generic = false, gecko = "mozilla::ServoVisitedStyle", servo = "Option<::stylearc::Arc<ServoComputedValues2>>" },
{ generic = false, gecko = "mozilla::ServoComputedValueFlags", servo = "::properties::computed_value_flags::ComputedValueFlags" },
{ generic = true, gecko = "mozilla::ServoRawOffsetArc", servo = "::stylearc::RawOffsetArc" },
]
fixups = [

Просмотреть файл

@ -146,6 +146,10 @@ struct ServoCustomPropertiesMap {
uintptr_t mPtr;
};
struct ServoRuleNode {
uintptr_t mPtr;
};
struct ServoVisitedStyle {
uintptr_t mPtr;
};
@ -155,6 +159,17 @@ struct ServoRawOffsetArc {
T* mPtr;
};
struct ServoComputedValueFlags {
uint8_t mFlags;
};
#define STYLE_STRUCT(name_, checkdata_cb_) struct Gecko##name_;
#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
/**
* We want C++ to be abe to read the style struct fields of ComputedValues
* so we define this type on the C++ side and use the bindgenned version
@ -166,13 +181,23 @@ struct ServoRawOffsetArc {
* <div rustbindgen nocopy></div>
*/
struct ServoComputedValues2 {
#define STYLE_STRUCT(name_, checkdata_cb_) ServoRawOffsetArc<nsStyle##name_> name_;
#define STYLE_STRUCT(name_, checkdata_cb_) ServoRawOffsetArc<Gecko##name_> name_;
#define STYLE_STRUCT_LIST_IGNORE_VARIABLES
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
ServoCustomPropertiesMap custom_properties;
ServoWritingMode writing_mode;
ServoFontComputationData font_computation_data;
/// The rule node representing the ordered list of rules matched for this
/// node. Can be None for default values and text nodes. This is
/// essentially an optimization to avoid referencing the root rule node.
ServoRuleNode rules;
/// The element's computed values if visited, only computed if there's a
/// relevant link for this element. A element's "relevant link" is the
/// element being matched if it is a link or the nearest ancestor link.
ServoVisitedStyle visited_style;
ServoComputedValueFlags flags;
~ServoComputedValues2() {} // do nothing, but prevent Copy from being impl'd by bindgen
};

Просмотреть файл

@ -88,10 +88,14 @@ for i in range(count):
exit(1)
def printEntry(header, i):
if STYLE_STRUCTS[i][1] == "Variables":
print("#ifndef STYLE_STRUCT_LIST_IGNORE_VARIABLES", file=header)
print("STYLE_STRUCT_%s(%s, %s)" % STYLE_STRUCTS[i][:3], file=header)
for dep in STYLE_STRUCTS[i][3]:
print("STYLE_STRUCT_DEP(%s)" % (dep,), file=header)
print("STYLE_STRUCT_END()", file=header)
if STYLE_STRUCTS[i][1] == "Variables":
print("#endif", file=header)
HEADER = """/* THIS FILE IS AUTOGENERATED BY generate-stylestructlist.py - DO NOT EDIT */