зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1367904 - Part 4: stylo: Replace real ComputedValues with bindgenned ComputedValues2; r=bholley
MozReview-Commit-ID: GRkycXueUVr
This commit is contained in:
Родитель
25536ab88d
Коммит
387babf22c
|
@ -67,6 +67,12 @@ class nsStyleCoord;
|
||||||
struct nsStyleDisplay;
|
struct nsStyleDisplay;
|
||||||
class nsXBLBinding;
|
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_) \
|
#define NS_DECL_THREADSAFE_FFI_REFCOUNTING(class_, name_) \
|
||||||
void Gecko_AddRef##name_##ArbitraryThread(class_* aPtr); \
|
void Gecko_AddRef##name_##ArbitraryThread(class_* aPtr); \
|
||||||
void Gecko_Release##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::ServoWritingMode", servo = "::logical_geometry::WritingMode" },
|
||||||
{ generic = false, gecko = "mozilla::ServoFontComputationData", servo = "::properties::FontComputationData" },
|
{ generic = false, gecko = "mozilla::ServoFontComputationData", servo = "::properties::FontComputationData" },
|
||||||
{ generic = false, gecko = "mozilla::ServoCustomPropertiesMap", servo = "Option<::stylearc::Arc<::custom_properties::CustomPropertiesMap>>" },
|
{ 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::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" },
|
{ generic = true, gecko = "mozilla::ServoRawOffsetArc", servo = "::stylearc::RawOffsetArc" },
|
||||||
]
|
]
|
||||||
fixups = [
|
fixups = [
|
||||||
|
|
|
@ -146,6 +146,10 @@ struct ServoCustomPropertiesMap {
|
||||||
uintptr_t mPtr;
|
uintptr_t mPtr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ServoRuleNode {
|
||||||
|
uintptr_t mPtr;
|
||||||
|
};
|
||||||
|
|
||||||
struct ServoVisitedStyle {
|
struct ServoVisitedStyle {
|
||||||
uintptr_t mPtr;
|
uintptr_t mPtr;
|
||||||
};
|
};
|
||||||
|
@ -155,6 +159,17 @@ struct ServoRawOffsetArc {
|
||||||
T* mPtr;
|
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
|
* 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
|
* so we define this type on the C++ side and use the bindgenned version
|
||||||
|
@ -166,13 +181,23 @@ struct ServoRawOffsetArc {
|
||||||
* <div rustbindgen nocopy></div>
|
* <div rustbindgen nocopy></div>
|
||||||
*/
|
*/
|
||||||
struct ServoComputedValues2 {
|
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"
|
#include "nsStyleStructList.h"
|
||||||
#undef STYLE_STRUCT
|
#undef STYLE_STRUCT
|
||||||
|
#undef STYLE_STRUCT_LIST_IGNORE_VARIABLES
|
||||||
ServoCustomPropertiesMap custom_properties;
|
ServoCustomPropertiesMap custom_properties;
|
||||||
ServoWritingMode writing_mode;
|
ServoWritingMode writing_mode;
|
||||||
ServoFontComputationData font_computation_data;
|
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;
|
ServoVisitedStyle visited_style;
|
||||||
|
ServoComputedValueFlags flags;
|
||||||
~ServoComputedValues2() {} // do nothing, but prevent Copy from being impl'd by bindgen
|
~ServoComputedValues2() {} // do nothing, but prevent Copy from being impl'd by bindgen
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -88,10 +88,14 @@ for i in range(count):
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
def printEntry(header, i):
|
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)
|
print("STYLE_STRUCT_%s(%s, %s)" % STYLE_STRUCTS[i][:3], file=header)
|
||||||
for dep in STYLE_STRUCTS[i][3]:
|
for dep in STYLE_STRUCTS[i][3]:
|
||||||
print("STYLE_STRUCT_DEP(%s)" % (dep,), file=header)
|
print("STYLE_STRUCT_DEP(%s)" % (dep,), file=header)
|
||||||
print("STYLE_STRUCT_END()", 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 */
|
HEADER = """/* THIS FILE IS AUTOGENERATED BY generate-stylestructlist.py - DO NOT EDIT */
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче