зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1642261 - Part 2: Add telemetry for -moz-appearance usage. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D77637
This commit is contained in:
Родитель
a2fad308ec
Коммит
8cf9670c90
|
@ -12,7 +12,7 @@
|
|||
//
|
||||
// (b) a comment, which is a line that begins with "//"
|
||||
//
|
||||
// (c) one of four possible use counter declarations:
|
||||
// (c) one of three possible use counter declarations:
|
||||
//
|
||||
// method <IDL interface name>.<IDL operation name>
|
||||
// attribute <IDL interface name>.<IDL attribute name>
|
||||
|
@ -26,6 +26,7 @@
|
|||
// To actually cause use counters to be incremented, DOM methods
|
||||
// and attributes must have a [UseCounter] extended attribute in
|
||||
// the Web IDL file.
|
||||
//
|
||||
// Custom counters are incremented when
|
||||
// SetUseCounter(eUseCounter_custom_MyName) is called on a Document object.
|
||||
//
|
||||
|
@ -342,3 +343,61 @@ method Window.webkitSpeechRecognitionEvent
|
|||
method Window.webkitStorageInfo
|
||||
method Window.Worklet
|
||||
method Window.WritableStream
|
||||
|
||||
// -moz-appearance property usage
|
||||
custom Appearance_Widget_Button sets -moz-appearance to button on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_Textfield sets -moz-appearance to textfield on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_MenulistButton sets -moz-appearance to menulist-button on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_Searchfield sets -moz-appearance to searchfield on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_Textarea sets -moz-appearance to textarea on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_Checkbox sets -moz-appearance to checkbox on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_Radio sets -moz-appearance to radio on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_Menulist sets -moz-appearance to menulist on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_Listbox sets -moz-appearance to listbox on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_Meter sets -moz-appearance to meter on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_ProgressBar sets -moz-appearance to progress-bar on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_NumberInput sets -moz-appearance to number-input on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_Range sets -moz-appearance to range on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_InnerSpinButton sets -moz-appearance to inner-spin-button on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_ProgressbarVertical sets -moz-appearance to progressbar-vertical on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_ScaleHorizontal sets -moz-appearance to scale-horizontal on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_ScaleVertical sets -moz-appearance to scale-vertical on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_ScalethumbHorizontal sets -moz-appearance to scalethumb-horizontal on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_ScalethumbVertical sets -moz-appearance to scalethumb-vertical on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_Scalethumbstart sets -moz-appearance to scalethumbstart on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_Scalethumbend sets -moz-appearance to scalethumbend on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_Scalethumbtick sets -moz-appearance to scalethumbtick on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_RangeThumb sets -moz-appearance to range-thumb on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_ScrollbarthumbHorizontal sets -moz-appearance to scrollbarthumb-horizontal on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_ScrollbarthumbVertical sets -moz-appearance to scrollbarthumb-vertical on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_ScrollbartrackHorizontal sets -moz-appearance to scrollbartrack-horizontal on an element that normally has some other non-none appearance
|
||||
custom Appearance_Widget_ScrollbartrackVertical sets -moz-appearance to scrollbartrack-vertical on an element that normally has some other non-none appearance
|
||||
custom Appearance_NonWidget_Button sets -moz-appearance to button on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_Textfield sets -moz-appearance to textfield on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_MenulistButton sets -moz-appearance to menulist-button on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_Searchfield sets -moz-appearance to searchfield on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_Textarea sets -moz-appearance to textarea on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_Checkbox sets -moz-appearance to checkbox on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_Radio sets -moz-appearance to radio on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_Menulist sets -moz-appearance to menulist on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_Listbox sets -moz-appearance to listbox on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_Meter sets -moz-appearance to meter on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_ProgressBar sets -moz-appearance to progress-bar on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_NumberInput sets -moz-appearance to number-input on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_Range sets -moz-appearance to range on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_InnerSpinButton sets -moz-appearance to inner-spin-button on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_ProgressbarVertical sets -moz-appearance to progressbar-vertical on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_ScaleHorizontal sets -moz-appearance to scale-horizontal on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_ScaleVertical sets -moz-appearance to scale-vertical on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_ScalethumbHorizontal sets -moz-appearance to scalethumb-horizontal on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_ScalethumbVertical sets -moz-appearance to scalethumb-vertical on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_Scalethumbstart sets -moz-appearance to scalethumbstart on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_Scalethumbend sets -moz-appearance to scalethumbend on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_Scalethumbtick sets -moz-appearance to scalethumbtick on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_RangeThumb sets -moz-appearance to range-thumb on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_ScrollbarthumbHorizontal sets -moz-appearance to scrollbarthumb-horizontal on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_ScrollbarthumbVertical sets -moz-appearance to scrollbarthumb-vertical on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_ScrollbartrackHorizontal sets -moz-appearance to scrollbartrack-horizontal on an element that normally has appearance none
|
||||
custom Appearance_NonWidget_ScrollbartrackVertical sets -moz-appearance to scrollbartrack-vertical on an element that normally has appearance none
|
||||
custom Appearance_Overridden_NumberInput used `-moz-appearance: number-input` to override some other value on an <input type=number>
|
||||
custom Appearance_Overridden_Range used `-moz-appearance: range` to override some other value on an <input type=range>
|
||||
|
|
|
@ -23,6 +23,7 @@ support-files =
|
|||
file_bug1303838_with_iframe.html
|
||||
file_messagemanager_unload.html
|
||||
file_pluginAudio.html
|
||||
file_use_counter_appearance.html
|
||||
file_use_counter_outer.html
|
||||
file_use_counter_style.html
|
||||
file_use_counter_svg_getElementById.svg
|
||||
|
|
|
@ -81,6 +81,38 @@ add_task(async function() {
|
|||
"CSS_PROPERTY_WebkitPaddingStart"
|
||||
);
|
||||
|
||||
// Check for -moz-appearance related use counters.
|
||||
const appearanceCounters = [
|
||||
["APPEARANCE_WIDGET_BUTTON", 0],
|
||||
["APPEARANCE_NONWIDGET_BUTTON", 0],
|
||||
["APPEARANCE_WIDGET_TEXTFIELD", 0],
|
||||
["APPEARANCE_NONWIDGET_TEXTFIELD", 0],
|
||||
["APPEARANCE_WIDGET_RADIO", 0],
|
||||
["APPEARANCE_NONWIDGET_RADIO", 0],
|
||||
["APPEARANCE_WIDGET_CHECKBOX", 1],
|
||||
["APPEARANCE_NONWIDGET_CHECKBOX", 0],
|
||||
["APPEARANCE_WIDGET_MENULISTBUTTON", 0],
|
||||
["APPEARANCE_NONWIDGET_MENULISTBUTTON", 1],
|
||||
["APPEARANCE_WIDGET_METER", 0],
|
||||
["APPEARANCE_NONWIDGET_METER", 0],
|
||||
["APPEARANCE_WIDGET_TEXTAREA", 0],
|
||||
["APPEARANCE_NONWIDGET_TEXTAREA", 0],
|
||||
["APPEARANCE_WIDGET_RANGE", 0],
|
||||
["APPEARANCE_NONWIDGET_RANGE", 0],
|
||||
["APPEARANCE_OVERRIDDEN_RANGE", 1],
|
||||
["APPEARANCE_WIDGET_NUMBERINPUT", 0],
|
||||
["APPEARANCE_NONWIDGET_NUMBERINPUT", 0],
|
||||
["APPEARANCE_OVERRIDDEN_NUMBERINPUT", 0],
|
||||
];
|
||||
for (let [name, value] of appearanceCounters) {
|
||||
await check_use_counter_iframe(
|
||||
"file_use_counter_appearance.html",
|
||||
name,
|
||||
/* check_documents = */ true,
|
||||
value
|
||||
);
|
||||
}
|
||||
|
||||
// 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
|
||||
|
@ -183,9 +215,12 @@ function grabHistogramsFromContent(use_counter_middlefix, page_before = null) {
|
|||
var check_use_counter_iframe = async function(
|
||||
file,
|
||||
use_counter_middlefix,
|
||||
check_documents = true
|
||||
check_documents = true,
|
||||
value = 1
|
||||
) {
|
||||
info("checking " + file + " with histogram " + use_counter_middlefix);
|
||||
info(
|
||||
`checking ${file} with histogram ${use_counter_middlefix} and expected value ${value}`
|
||||
);
|
||||
|
||||
let newTab = BrowserTestUtils.addTab(gBrowser, "about:blank");
|
||||
gBrowser.selectedTab = newTab;
|
||||
|
@ -240,17 +275,17 @@ var check_use_counter_iframe = async function(
|
|||
|
||||
is(
|
||||
histogram_page_after,
|
||||
histogram_page_before + 1,
|
||||
histogram_page_before + value,
|
||||
"page counts for " + use_counter_middlefix + " after are correct"
|
||||
);
|
||||
ok(
|
||||
histogram_toplevel_docs_after >= histogram_toplevel_docs_before + 1,
|
||||
histogram_toplevel_docs_after >= histogram_toplevel_docs_before + value,
|
||||
"top level document counts are correct"
|
||||
);
|
||||
if (check_documents) {
|
||||
is(
|
||||
histogram_document_after,
|
||||
histogram_document_before + 1,
|
||||
histogram_document_before + value,
|
||||
"document counts for " + use_counter_middlefix + " after are correct"
|
||||
);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<!-- a value set by the UA sheet -->
|
||||
<button>a button</button>
|
||||
|
||||
<!-- a value set on a widget that normally has that appearance -->
|
||||
<input style="-moz-appearance: textfield;">
|
||||
|
||||
<!-- a value set on a widget that doesn't normally have that appearance -->
|
||||
<input type="radio" style="-moz-appearance: checkbox;">
|
||||
|
||||
<!-- a value set on a non-widget -->
|
||||
<div style="-moz-appearance: menulist-button;"></div>
|
||||
|
||||
<!-- a standard value set on a widget that normally has that appearance, cascading over some other value -->
|
||||
<style>
|
||||
textarea { -moz-appearance: meter; }
|
||||
textarea { -moz-appearance: textarea; }
|
||||
</style>
|
||||
<textarea></textarea>
|
||||
|
||||
<!-- a non-standard value set on a widget that normally has that appearance, cascading over some other value -->
|
||||
<style>
|
||||
input[type=range] { -moz-appearance: none; }
|
||||
input[type=range] { -moz-appearance: range; }
|
||||
</style>
|
||||
<input type="range">
|
||||
|
||||
<!-- a non-standard value set by UA sheets, which we want to track for cascading over some other value -->
|
||||
<input type="number">
|
|
@ -1410,11 +1410,123 @@ void nsIFrame::DidSetComputedStyle(ComputedStyle* aOldComputedStyle) {
|
|||
}
|
||||
}
|
||||
|
||||
RecordAppearanceTelemetry();
|
||||
|
||||
RemoveStateBits(NS_FRAME_SIMPLE_EVENT_REGIONS | NS_FRAME_SIMPLE_DISPLAYLIST);
|
||||
|
||||
mMayHaveRoundedCorners = true;
|
||||
}
|
||||
|
||||
void nsIFrame::RecordAppearanceTelemetry() {
|
||||
// Record uses of -moz-appearance values in the wild that would affect our
|
||||
// ability to implement the css-ui-4 unprefixed appearance property.
|
||||
|
||||
StyleAppearance appearance = StyleDisplay()->mAppearance;
|
||||
StyleAppearance defaultAppearance = StyleDisplay()->mDefaultAppearance;
|
||||
|
||||
if ((appearance == StyleAppearance::None &&
|
||||
defaultAppearance == StyleAppearance::None) ||
|
||||
!mContent || mContent->IsInNativeAnonymousSubtree()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The css-ui-4 specification defines unprefixed appearance as taking values:
|
||||
//
|
||||
// none | auto | button | textfield | menulist-button | <compat-auto>
|
||||
//
|
||||
// where:
|
||||
//
|
||||
// <compat-auto> = searchfield | textarea | push-button |
|
||||
// slider-horizontal | checkbox | radio | square-button |
|
||||
// menulist | listbox | meter | progress-bar
|
||||
//
|
||||
// Of these, we don't currently support auto, push-button, slider-horizontal,
|
||||
// or square-button. The auto value we will support soon, but the other three
|
||||
// may not be required for compatibility. So we don't record any telemetry
|
||||
// for the use of those values.
|
||||
//
|
||||
// We support a number of values exposed to content, which are not in the
|
||||
// spec:
|
||||
//
|
||||
// number-input | range | inner-spin-button | progressbar-vertical |
|
||||
// scale-horizontal | scale-vertical | scalethumb-horizontal |
|
||||
// scalethumb-vertical | scalethumbstart | scalethumbend | scalethumbtick |
|
||||
// range-thumb | scrollbarthumb-horizontal | scrollbarthumb-vertical |
|
||||
// scrollbartrack-horizontal | scrollbartrack-vertical
|
||||
//
|
||||
// Of these, number-input and range are used by UA sheets (set on <input
|
||||
// type=number> and <input type=range> elements) and exposed to content. We
|
||||
// want to measure whether these values are being used to override some other
|
||||
// values (e.g. none) in author sheets on these elements, since that means we
|
||||
// should add them to the <compat-auto> set.
|
||||
if (appearance == defaultAppearance) {
|
||||
UseCounter counter = eUseCounter_UNKNOWN;
|
||||
switch (appearance) {
|
||||
case StyleAppearance::NumberInput:
|
||||
counter = eUseCounter_custom_Appearance_Overridden_NumberInput;
|
||||
break;
|
||||
case StyleAppearance::Range:
|
||||
counter = eUseCounter_custom_Appearance_Overridden_Range;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if (mComputedStyle->HasOverriddenAppearance(appearance)) {
|
||||
PresContext()->Document()->SetUseCounter(counter);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// For all values, we want to check whether they have been set on an element
|
||||
// that would not normally have that value from the UA sheets. We record
|
||||
// separate use counters for whether the -moz-appearance value was used with
|
||||
// an underlying value of none ("on a non-widget") or with some non-none value
|
||||
// ("on a widget").
|
||||
UseCounter onWidget;
|
||||
UseCounter onNonWidget;
|
||||
#define CASE(name_) \
|
||||
case StyleAppearance::name_: \
|
||||
onWidget = eUseCounter_custom_Appearance_Widget_##name_; \
|
||||
onNonWidget = eUseCounter_custom_Appearance_NonWidget_##name_; \
|
||||
break;
|
||||
switch (appearance) {
|
||||
CASE(Button)
|
||||
CASE(Textfield)
|
||||
CASE(MenulistButton)
|
||||
CASE(Searchfield)
|
||||
CASE(Textarea)
|
||||
CASE(Checkbox)
|
||||
CASE(Radio)
|
||||
CASE(Menulist)
|
||||
CASE(Listbox)
|
||||
CASE(Meter)
|
||||
CASE(ProgressBar)
|
||||
CASE(NumberInput)
|
||||
CASE(Range)
|
||||
CASE(InnerSpinButton)
|
||||
CASE(ProgressbarVertical)
|
||||
CASE(ScaleHorizontal)
|
||||
CASE(ScaleVertical)
|
||||
CASE(ScalethumbHorizontal)
|
||||
CASE(ScalethumbVertical)
|
||||
CASE(Scalethumbstart)
|
||||
CASE(Scalethumbend)
|
||||
CASE(Scalethumbtick)
|
||||
CASE(RangeThumb)
|
||||
CASE(ScrollbarthumbHorizontal)
|
||||
CASE(ScrollbarthumbVertical)
|
||||
CASE(ScrollbartrackHorizontal)
|
||||
CASE(ScrollbartrackVertical)
|
||||
default:
|
||||
return;
|
||||
}
|
||||
#undef CASE
|
||||
|
||||
auto counter =
|
||||
defaultAppearance == StyleAppearance::None ? onNonWidget : onWidget;
|
||||
PresContext()->Document()->SetUseCounter(counter);
|
||||
}
|
||||
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
void nsIFrame::AssertNewStyleIsSane(ComputedStyle& aNewStyle) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(
|
||||
|
|
|
@ -799,6 +799,9 @@ class nsIFrame : public nsQueryFrame {
|
|||
// Use PeekStyleData instead.
|
||||
virtual void DidSetComputedStyle(ComputedStyle* aOldComputedStyle);
|
||||
|
||||
private:
|
||||
void RecordAppearanceTelemetry();
|
||||
|
||||
public:
|
||||
/**
|
||||
* Define typesafe getter functions for each style struct by
|
||||
|
|
|
@ -411,4 +411,8 @@ bool ComputedStyle::EqualForCachedAnonymousContentStyle(
|
|||
|
||||
#endif
|
||||
|
||||
bool ComputedStyle::HasOverriddenAppearance(StyleAppearance aAppearance) const {
|
||||
return Servo_ComputedValues_HasOverriddenAppearance(this, aAppearance);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -297,6 +297,8 @@ class ComputedStyle {
|
|||
|
||||
StyleWritingMode WritingMode() const { return {mSource.WritingMode().mBits}; }
|
||||
|
||||
bool HasOverriddenAppearance(StyleAppearance) const;
|
||||
|
||||
protected:
|
||||
// Needs to be friend so that it can call the destructor without making it
|
||||
// public.
|
||||
|
|
|
@ -2229,6 +2229,7 @@ nsStyleDisplay::nsStyleDisplay(const Document& aDocument)
|
|||
mOriginalDisplay(StyleDisplay::Inline),
|
||||
mContain(StyleContain::NONE),
|
||||
mAppearance(StyleAppearance::None),
|
||||
mDefaultAppearance(StyleAppearance::None),
|
||||
mPosition(StylePositionProperty::Static),
|
||||
mFloat(StyleFloat::None),
|
||||
mBreakType(StyleClear::None),
|
||||
|
@ -2298,6 +2299,7 @@ nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource)
|
|||
mOriginalDisplay(aSource.mOriginalDisplay),
|
||||
mContain(aSource.mContain),
|
||||
mAppearance(aSource.mAppearance),
|
||||
mDefaultAppearance(aSource.mDefaultAppearance),
|
||||
mPosition(aSource.mPosition),
|
||||
mFloat(aSource.mFloat),
|
||||
mBreakType(aSource.mBreakType),
|
||||
|
@ -2471,6 +2473,10 @@ nsChangeHint nsStyleDisplay::CalcDifference(
|
|||
hint |= nsChangeHint_NeutralChange;
|
||||
}
|
||||
|
||||
if (mDefaultAppearance != aNewData.mDefaultAppearance) {
|
||||
hint |= nsChangeHint_NeutralChange;
|
||||
}
|
||||
|
||||
if (mOverflowX != aNewData.mOverflowX || mOverflowY != aNewData.mOverflowY) {
|
||||
const bool isScrollable = IsScrollableOverflow();
|
||||
if (isScrollable != aNewData.IsScrollableOverflow()) {
|
||||
|
|
|
@ -1216,6 +1216,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay {
|
|||
// mDisplay
|
||||
mozilla::StyleContain mContain;
|
||||
mozilla::StyleAppearance mAppearance;
|
||||
mozilla::StyleAppearance mDefaultAppearance;
|
||||
mozilla::StylePositionProperty mPosition;
|
||||
|
||||
mozilla::StyleFloat mFloat;
|
||||
|
|
|
@ -85,6 +85,7 @@ label {
|
|||
input {
|
||||
display: inline-block;
|
||||
-moz-appearance: textfield;
|
||||
-moz-default-appearance: textfield;
|
||||
/* The sum of border and padding on block-start and block-end
|
||||
must be the same here, for buttons, and for <select> (including its
|
||||
internal padding magic) */
|
||||
|
@ -107,6 +108,7 @@ input::placeholder {
|
|||
|
||||
textarea {
|
||||
-moz-appearance: textarea;
|
||||
-moz-default-appearance: textarea;
|
||||
margin-block: 1px;
|
||||
border: 2px inset ThreeDLightShadow;
|
||||
/* The 1px inline padding is for parity with Win/IE */
|
||||
|
@ -225,6 +227,7 @@ select {
|
|||
box-sizing: border-box;
|
||||
user-select: none;
|
||||
-moz-appearance: menulist;
|
||||
-moz-default-appearance: menulist;
|
||||
border-width: 2px;
|
||||
border-style: inset;
|
||||
overflow: -moz-hidden-unscrollable;
|
||||
|
@ -253,6 +256,7 @@ select:is([size], [multiple], [size][multiple]) {
|
|||
padding-inline: 0;
|
||||
vertical-align: text-bottom;
|
||||
-moz-appearance: listbox;
|
||||
-moz-default-appearance: listbox;
|
||||
}
|
||||
|
||||
select:is([size="0"], [size="1"]) {
|
||||
|
@ -262,6 +266,7 @@ select:is([size="0"], [size="1"]) {
|
|||
vertical-align: baseline;
|
||||
padding: unset;
|
||||
-moz-appearance: menulist;
|
||||
-moz-default-appearance: menulist;
|
||||
}
|
||||
|
||||
select > button {
|
||||
|
@ -439,6 +444,7 @@ optgroup:disabled {
|
|||
/* hidden inputs */
|
||||
input[type="hidden"] {
|
||||
-moz-appearance: none;
|
||||
-moz-default-appearance: none;
|
||||
display: none !important;
|
||||
padding: unset;
|
||||
border: 0;
|
||||
|
@ -449,6 +455,7 @@ input[type="hidden"] {
|
|||
/* image buttons */
|
||||
input[type="image"] {
|
||||
-moz-appearance: none;
|
||||
-moz-default-appearance: none;
|
||||
padding: unset;
|
||||
border: none;
|
||||
background-color: transparent;
|
||||
|
@ -476,6 +483,7 @@ input[type="image"]:disabled {
|
|||
/* radio buttons */
|
||||
input[type="radio"] {
|
||||
-moz-appearance: radio;
|
||||
-moz-default-appearance: radio;
|
||||
margin-block: 3px 0;
|
||||
margin-inline: 5px 3px;
|
||||
}
|
||||
|
@ -483,6 +491,7 @@ input[type="radio"] {
|
|||
/* check boxes */
|
||||
input[type="checkbox"] {
|
||||
-moz-appearance: checkbox;
|
||||
-moz-default-appearance: checkbox;
|
||||
margin-block: 3px;
|
||||
margin-inline: 4px 3px;
|
||||
}
|
||||
|
@ -529,6 +538,7 @@ button,
|
|||
::file-chooser-button,
|
||||
input:is([type="color"], [type="reset"], [type="button"], [type="submit"]) {
|
||||
-moz-appearance: button;
|
||||
-moz-default-appearance: button;
|
||||
/* The sum of border and padding on block-start and block-end
|
||||
must be the same here, for text inputs, and for <select>.
|
||||
Note -moz-focus-inner padding does not affect button size. */
|
||||
|
@ -673,6 +683,7 @@ input[type="file"] {
|
|||
|
||||
/* Revert rules which apply on all inputs. */
|
||||
-moz-appearance: none;
|
||||
-moz-default-appearance: none;
|
||||
cursor: default;
|
||||
|
||||
border: none;
|
||||
|
@ -756,6 +767,7 @@ output:-moz-ui-invalid {
|
|||
|
||||
progress {
|
||||
-moz-appearance: progress-bar;
|
||||
-moz-default-appearance: progress-bar;
|
||||
display: inline-block;
|
||||
vertical-align: -0.2em;
|
||||
|
||||
|
@ -785,6 +797,7 @@ progress {
|
|||
|
||||
meter {
|
||||
-moz-appearance: meter;
|
||||
-moz-default-appearance: meter;
|
||||
display: inline-block;
|
||||
vertical-align: -0.2em;
|
||||
background: linear-gradient(#e6e6e6, #e6e6e6, #eeeeee 20%, #cccccc 45%, #cccccc 55%);
|
||||
|
@ -817,6 +830,7 @@ meter {
|
|||
|
||||
input[type=range] {
|
||||
-moz-appearance: range;
|
||||
-moz-default-appearance: range;
|
||||
margin: 2px;
|
||||
/* Override some rules that apply on all input types: */
|
||||
cursor: default;
|
||||
|
@ -887,6 +901,7 @@ input[type=range]::-moz-range-thumb {
|
|||
* to get rid of it. The thumb's -moz-appearance is fixed.
|
||||
*/
|
||||
-moz-appearance: range-thumb !important;
|
||||
-moz-default-appearance: range-thumb: !important;
|
||||
/* Prevent styling that would change the type of frame we construct. */
|
||||
display: block !important;
|
||||
float: none !important;
|
||||
|
@ -905,6 +920,7 @@ input[type=range]::-moz-range-thumb {
|
|||
|
||||
input[type="number"] {
|
||||
-moz-appearance: number-input;
|
||||
-moz-default-appearance: number-input;
|
||||
}
|
||||
|
||||
input[type=number]::-moz-number-wrapper {
|
||||
|
|
|
@ -12,6 +12,7 @@ button,
|
|||
xul|button,
|
||||
* > input:not(:-moz-any([type="image"], [type="checkbox"], [type="radio"])) {
|
||||
-moz-appearance: none !important; /* See bug 598421 for fixing the platform */
|
||||
-moz-default-appearance: none !important;
|
||||
}
|
||||
|
||||
textarea,
|
||||
|
|
|
@ -22,6 +22,7 @@ const NON_CONTENT_ACCESSIBLE_PROPERTIES = [
|
|||
"-moz-font-smoothing-background-color",
|
||||
"-moz-min-font-size-ratio",
|
||||
"-moz-script-size-multiplier",
|
||||
"-moz-default-appearance",
|
||||
// TODO(emilio): Whenever we stop using `-moz-binding` in a gazillion tests
|
||||
// we should add it here.
|
||||
];
|
||||
|
|
|
@ -54,6 +54,7 @@ svg:not(:root), symbol, image, marker, pattern, foreignObject {
|
|||
|
||||
foreignObject {
|
||||
-moz-appearance: none ! important;
|
||||
-moz-default-appearance: none ! important;
|
||||
margin: 0 ! important;
|
||||
padding: 0 ! important;
|
||||
border-width: 0 ! important;
|
||||
|
@ -63,6 +64,7 @@ foreignObject {
|
|||
@media all and (-moz-is-resource-document) {
|
||||
foreignObject *|* {
|
||||
-moz-appearance: none !important;
|
||||
-moz-default-appearance: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -340,6 +340,21 @@ impl PropertyDeclarationBlock {
|
|||
.find(|(declaration, _)| declaration.id() == property)
|
||||
}
|
||||
|
||||
/// Get a declaration for a given property with the specified importance.
|
||||
#[inline]
|
||||
pub fn get_at_importance(
|
||||
&self,
|
||||
property: PropertyDeclarationId,
|
||||
importance: Importance,
|
||||
) -> Option<&PropertyDeclaration> {
|
||||
let (declaration, i) = self.get(property)?;
|
||||
if i == importance {
|
||||
Some(declaration)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Tries to serialize a given shorthand from the declarations in this
|
||||
/// block.
|
||||
pub fn shorthand_to_css(
|
||||
|
|
|
@ -638,6 +638,21 @@ ${helpers.predefined_type(
|
|||
gecko_ffi_name="mAppearance",
|
||||
)}
|
||||
|
||||
// A UA-sheet only property that is always set to the same value as
|
||||
// -moz-appearance. Used to record telemetry for when author sheets
|
||||
// override the value of -moz-appearance; see
|
||||
// nsIFrame::RecordAppearanceTelemetry.
|
||||
${helpers.predefined_type(
|
||||
"-moz-default-appearance",
|
||||
"Appearance",
|
||||
"computed::Appearance::None",
|
||||
engines="gecko",
|
||||
animation_value_type="none",
|
||||
spec="Internal (not web-exposed)",
|
||||
enabled_in="ua",
|
||||
gecko_ffi_name="mDefaultAppearance",
|
||||
)}
|
||||
|
||||
${helpers.single_keyword(
|
||||
"-moz-orient",
|
||||
"inline block horizontal vertical",
|
||||
|
|
|
@ -2111,7 +2111,8 @@ impl PropertyId {
|
|||
pub struct WideKeywordDeclaration {
|
||||
#[css(skip)]
|
||||
id: LonghandId,
|
||||
keyword: CSSWideKeyword,
|
||||
/// The CSS-wide keyword.
|
||||
pub keyword: CSSWideKeyword,
|
||||
}
|
||||
|
||||
/// An unparsed declaration that contains `var()` functions.
|
||||
|
|
|
@ -3983,6 +3983,41 @@ pub extern "C" fn Servo_ComputedValues_EqualForCachedAnonymousContentStyle(
|
|||
differing_properties.is_empty()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_ComputedValues_HasOverriddenAppearance(
|
||||
cv: &ComputedValues,
|
||||
appearance: specified::Appearance,
|
||||
) -> bool {
|
||||
use style::properties::{CSSWideKeyword, PropertyDeclaration};
|
||||
|
||||
let rules = match cv.rules {
|
||||
Some(ref rules) => rules,
|
||||
None => return false,
|
||||
};
|
||||
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
let guard = global_style_data.shared_lock.read();
|
||||
|
||||
let id = PropertyDeclarationId::Longhand(LonghandId::MozAppearance);
|
||||
|
||||
// Look for any -moz-appearance declarations on rules at the Author level
|
||||
// which set some non-default value. revert would cause us to revert to
|
||||
// the default value, so don't count that. Declarations with variables
|
||||
// could resolve to a default or non-default value depending on computed
|
||||
// style, but should be rare enough on -moz-appearance to be OK to count
|
||||
// as a non-default value.
|
||||
rules
|
||||
.self_and_ancestors()
|
||||
.filter(|n| n.cascade_level().origin() == Origin::Author)
|
||||
.flat_map(|n| n.style_source().unwrap().read(&guard).get_at_importance(id, n.importance()))
|
||||
.any(|declaration| {
|
||||
match declaration {
|
||||
PropertyDeclaration::MozAppearance(a) => *a != appearance,
|
||||
_ => declaration.get_css_wide_keyword() != Some(CSSWideKeyword::Revert),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_StyleSet_Init(doc: &structs::Document) -> *mut RawServoStyleSet {
|
||||
let data = Box::new(PerDocumentStyleData::new(doc));
|
||||
|
|
Загрузка…
Ссылка в новой задаче