Bug 1512993 - Get rid of XBL display usage for buttons and toolbarbuttons. r=mats

This is the last use of them!

Differential Revision: https://phabricator.services.mozilla.com/D21924

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-03-04 17:20:29 +00:00
Родитель 4f099b38c1
Коммит f1c235dc68
5 изменённых файлов: 48 добавлений и 24 удалений

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

@ -1091,28 +1091,33 @@ nsresult nsXULElement::PreHandleEvent(EventChainVisitor& aVisitor) {
nsChangeHint nsXULElement::GetAttributeChangeHint(const nsAtom* aAttribute,
int32_t aModType) const {
nsChangeHint retval(nsChangeHint(0));
if (aAttribute == nsGkAtoms::value &&
(aModType == MutationEvent_Binding::REMOVAL ||
aModType == MutationEvent_Binding::ADDITION)) {
if (IsAnyOfXULElements(nsGkAtoms::label, nsGkAtoms::description))
// Label and description dynamically morph between a normal
// block and a cropping single-line XUL text frame. If the
// value attribute is being added or removed, then we need to
// return a hint of frame change. (See bugzilla bug 95475 for
// details.)
retval = nsChangeHint_ReconstructFrame;
} else {
// if left or top changes we reflow. This will happen in xul
// containers that manage positioned children such as a stack.
if (nsGkAtoms::left == aAttribute || nsGkAtoms::top == aAttribute ||
nsGkAtoms::right == aAttribute || nsGkAtoms::bottom == aAttribute ||
nsGkAtoms::start == aAttribute || nsGkAtoms::end == aAttribute)
retval = NS_STYLE_HINT_REFLOW;
aModType == MutationEvent_Binding::ADDITION) &&
IsAnyOfXULElements(nsGkAtoms::label, nsGkAtoms::description)) {
// Label and description dynamically morph between a normal
// block and a cropping single-line XUL text frame. If the
// value attribute is being added or removed, then we need to
// return a hint of frame change. (See bugzilla bug 95475 for
// details.)
return nsChangeHint_ReconstructFrame;
}
return retval;
if (aAttribute == nsGkAtoms::type &&
IsAnyOfXULElements(nsGkAtoms::toolbarbutton, nsGkAtoms::button)) {
// type=menu switches from a button frame to a menu frame.
return nsChangeHint_ReconstructFrame;
}
// if left or top changes we reflow. This will happen in xul
// containers that manage positioned children such as a stack.
if (nsGkAtoms::left == aAttribute || nsGkAtoms::top == aAttribute ||
nsGkAtoms::right == aAttribute || nsGkAtoms::bottom == aAttribute ||
nsGkAtoms::start == aAttribute || nsGkAtoms::end == aAttribute) {
return NS_STYLE_HINT_REFLOW;
}
return nsChangeHint(0);
}
NS_IMETHODIMP_(bool)

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

@ -3960,7 +3960,6 @@ nsCSSFrameConstructor::FindXULTagData(const Element& aElement, nsAtom* aTag,
static const FrameConstructionDataByTag sXULTagData[] = {
#ifdef MOZ_XUL
SCROLLABLE_XUL_CREATE(button, NS_NewButtonBoxFrame),
SCROLLABLE_XUL_CREATE(thumb, NS_NewButtonBoxFrame),
SCROLLABLE_XUL_CREATE(checkbox, NS_NewButtonBoxFrame),
SCROLLABLE_XUL_CREATE(radio, NS_NewButtonBoxFrame),
@ -3974,6 +3973,8 @@ nsCSSFrameConstructor::FindXULTagData(const Element& aElement, nsAtom* aTag,
SIMPLE_XUL_CREATE(treechildren, NS_NewTreeBodyFrame),
SIMPLE_XUL_CREATE(treecol, NS_NewTreeColFrame),
SIMPLE_XUL_CREATE(text, NS_NewTextBoxFrame),
SIMPLE_TAG_CHAIN(button, nsCSSFrameConstructor::FindXULButtonData),
SIMPLE_TAG_CHAIN(toolbarbutton, nsCSSFrameConstructor::FindXULButtonData),
SIMPLE_TAG_CHAIN(label, nsCSSFrameConstructor::FindXULLabelData),
SIMPLE_TAG_CHAIN(description,
nsCSSFrameConstructor::FindXULDescriptionData),
@ -4019,6 +4020,22 @@ const nsCSSFrameConstructor::FrameConstructionData
nsCSSFrameConstructor::sXULTextBoxData =
SIMPLE_XUL_FCDATA(NS_NewTextBoxFrame);
/* static */
const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindXULButtonData(const Element& aElement,
ComputedStyle&) {
static const FrameConstructionData sXULMenuData =
SIMPLE_XUL_FCDATA(NS_NewMenuFrame);
if (aElement.AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
nsGkAtoms::menu, eCaseMatters)) {
return &sXULMenuData;
}
static const FrameConstructionData sXULButtonData =
SCROLLABLE_XUL_FCDATA(NS_NewButtonBoxFrame);
return &sXULButtonData;
}
/* static */
const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindXULLabelData(const Element& aElement,

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

@ -1523,6 +1523,8 @@ class nsCSSFrameConstructor final : public nsFrameManager {
ComputedStyle&);
// sXULTextBoxData used for both labels and descriptions
static const FrameConstructionData sXULTextBoxData;
static const FrameConstructionData* FindXULButtonData(const Element&,
ComputedStyle&);
static const FrameConstructionData* FindXULLabelData(const Element&,
ComputedStyle&);
static const FrameConstructionData* FindXULDescriptionData(const Element&,

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

@ -190,7 +190,7 @@
</handlers>
</binding>
<binding id="button" display="xul:button"
<binding id="button"
extends="chrome://global/content/bindings/button.xml#button-base">
<content>
<children includes="observes|template|menupopup|panel|tooltip"/>
@ -203,7 +203,7 @@
</content>
</binding>
<binding id="menu" display="xul:menu"
<binding id="menu"
extends="chrome://global/content/bindings/button.xml#button">
<content>
<children includes="observes|template|menupopup|panel|tooltip"/>

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

@ -9,7 +9,7 @@
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="toolbarbutton" display="xul:button"
<binding id="toolbarbutton"
extends="chrome://global/content/bindings/button.xml#button-base">
<implementation>
<property name="multilineLabel"
@ -28,7 +28,7 @@
</content>
</binding>
<binding id="menu" display="xul:menu"
<binding id="menu"
extends="chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton">
</binding>
@ -50,7 +50,7 @@
</content>
</binding>
<binding id="toolbarbutton-badged-menu" display="xul:menu"
<binding id="toolbarbutton-badged-menu"
extends="chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton-badged">
</binding>
</bindings>