зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1578661 - Merge the stylesheet use counters, report them, and add tests. r=boris
C'est fini. Now to do the same with the unimplemented ones remains, but it should be straight-forward. Differential Revision: https://phabricator.services.mozilla.com/D44698 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2adb14b20a
Коммит
65b3948518
|
@ -14420,6 +14420,7 @@ void Document::PropagateUseCounters(Document* aParentDocument) {
|
|||
return;
|
||||
}
|
||||
|
||||
SetCssUseCounterBits();
|
||||
contentParent->mChildDocumentUseCounters |= mUseCounters;
|
||||
contentParent->mChildDocumentUseCounters |= mChildDocumentUseCounters;
|
||||
}
|
||||
|
@ -14476,6 +14477,19 @@ static_assert(size_t(eUseCounter_Count) * 2 ==
|
|||
#undef CSS_PROP_PUBLIC_OR_PRIVATE
|
||||
#undef ASSERT_CSS_COUNTER
|
||||
|
||||
void Document::SetCssUseCounterBits() {
|
||||
if (!mStyleUseCounters) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < eCSSProperty_COUNT_with_aliases; ++i) {
|
||||
auto id = nsCSSPropertyID(i);
|
||||
if (Servo_IsPropertyIdRecordedInUseCounter(mStyleUseCounters.get(), id)) {
|
||||
SetUseCounter(nsCSSProps::UseCounterFor(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Document::PropagateUseCountersToPage() {
|
||||
if (mDisplayDocument) {
|
||||
|
@ -14514,6 +14528,7 @@ void Document::ReportUseCounters() {
|
|||
}
|
||||
|
||||
mReportedUseCounters = true;
|
||||
SetCssUseCounterBits();
|
||||
|
||||
// Call ReportUseCounters in all our outstanding subdocuments and resources
|
||||
// and such. This needs to be here so that all our sub documents propagate our
|
||||
|
|
|
@ -4039,6 +4039,10 @@ class Document : public nsINode,
|
|||
private:
|
||||
void InitializeLocalization(nsTArray<nsString>& aResourceIds);
|
||||
|
||||
// Takes the bits from mStyleUseCounters if appropriate, and sets them in
|
||||
// mUseCounters.
|
||||
void SetCssUseCounterBits();
|
||||
|
||||
// Returns true if there is any valid value in the viewport meta tag.
|
||||
bool ParseWidthAndHeightInMetaViewport(const nsAString& aWidthString,
|
||||
const nsAString& aHeightString,
|
||||
|
|
|
@ -24,6 +24,7 @@ support-files =
|
|||
file_messagemanager_unload.html
|
||||
file_pluginAudio.html
|
||||
file_use_counter_outer.html
|
||||
file_use_counter_style.html
|
||||
file_use_counter_svg_getElementById.svg
|
||||
file_use_counter_svg_currentScale.svg
|
||||
file_use_counter_svg_fill_pattern_definition.svg
|
||||
|
|
|
@ -51,6 +51,24 @@ add_task(async function() {
|
|||
"SVGSVGELEMENT_CURRENTSCALE_setter"
|
||||
);
|
||||
|
||||
// Check for longhands.
|
||||
await check_use_counter_iframe(
|
||||
"file_use_counter_style.html",
|
||||
"CSS_PROPERTY_BackgroundImage"
|
||||
);
|
||||
|
||||
// Check for shorthands.
|
||||
await check_use_counter_iframe(
|
||||
"file_use_counter_style.html",
|
||||
"CSS_PROPERTY_Padding"
|
||||
);
|
||||
|
||||
// Check for aliases.
|
||||
await check_use_counter_iframe(
|
||||
"file_use_counter_style.html",
|
||||
"CSS_PROPERTY_MozTransform"
|
||||
);
|
||||
|
||||
// Check that even loads from the imglib cache update use counters. The
|
||||
// images should still be there, because we just loaded them in the last
|
||||
// set of tests. But we won't get updated counts for the document
|
||||
|
@ -95,8 +113,9 @@ add_task(async function() {
|
|||
// that reference patterns defined in the same file or in data: URLs.
|
||||
await check_use_counter_direct(
|
||||
"file_use_counter_svg_fill_pattern_internal.svg",
|
||||
"CSS_PROPERTY_FillOpacity",
|
||||
"CSS_PROPERTY_FillOpacity"
|
||||
);
|
||||
|
||||
// data: URLs don't correctly propagate to their referring document yet.
|
||||
//yield check_use_counter_direct("file_use_counter_svg_fill_pattern_data.svg",
|
||||
// "PROPERTY_FILL_OPACITY");
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<!doctype html>
|
||||
<style>
|
||||
div {
|
||||
background-image: none;
|
||||
padding: 10px;
|
||||
-moz-transform: scale(10);
|
||||
}
|
||||
</style>
|
||||
<!-- We currently count even if we don't match it, but well just in case we change that... -->
|
||||
<div></div>
|
|
@ -6552,6 +6552,15 @@ pub unsafe extern "C" fn Servo_UseCounters_Merge(
|
|||
doc_counters.merge(sheet_counters)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn Servo_IsPropertyIdRecordedInUseCounter(
|
||||
use_counters: &UseCounters,
|
||||
id: nsCSSPropertyID,
|
||||
) -> bool {
|
||||
let id = NonCustomPropertyId::from_nscsspropertyid(id).unwrap();
|
||||
use_counters.non_custom_properties.recorded(id)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn Servo_IsCssPropertyRecordedInUseCounter(
|
||||
use_counters: &UseCounters,
|
||||
|
|
Загрузка…
Ссылка в новой задаче