Bug 906116 - part3.3: Replace NS_STYLE_HINT_FRAMECHANGE with nsChangeHint_ReconstructFrame.
Use ReconstructFrame to replace NS_STYLE_HINT_FRAMECHANGE in many places, such
as HTML*Element::GetAttributeChangeHint and HTMLFrameSetElement::SetAttr.
MozReview-Commit-ID: EHbc4RMeuu0
--- a/dom/html/HTMLFrameSetElement.cpp
+++ b/dom/html/HTMLFrameSetElement.cpp
@@ -78,34 +78,34 @@ HTMLFrameSetElement::SetAttr(int32_t aNa
* nsGenericHTMLElement::SetAttr, which will end up calling
* GetAttributeChangeHint and notifying layout with that hint.
* Once nsGenericHTMLElement::SetAttr returns, we want to go back to our
* normal hint, which is NS_STYLE_HINT_REFLOW.
*/
if (aAttribute == nsGkAtoms::rows && aNameSpaceID == kNameSpaceID_None) {
int32_t oldRows = mNumRows;
ParseRowCol(aValue, mNumRows, &mRowSpecs);
-
+
if (mNumRows != oldRows) {
- mCurrentRowColHint = NS_STYLE_HINT_FRAMECHANGE;
+ mCurrentRowColHint = nsChangeHint_ReconstructFrame;
}
} else if (aAttribute == nsGkAtoms::cols &&
aNameSpaceID == kNameSpaceID_None) {
int32_t oldCols = mNumCols;
ParseRowCol(aValue, mNumCols, &mColSpecs);
if (mNumCols != oldCols) {
- mCurrentRowColHint = NS_STYLE_HINT_FRAMECHANGE;
+ mCurrentRowColHint = nsChangeHint_ReconstructFrame;
}
}
-
+
rv = nsGenericHTMLElement::SetAttr(aNameSpaceID, aAttribute, aPrefix,
aValue, aNotify);
mCurrentRowColHint = NS_STYLE_HINT_REFLOW;
-
+
return rv;
}
nsresult
HTMLFrameSetElement::GetRowSpec(int32_t *aNumValues,
const nsFramesetSpec** aSpecs)
{
NS_PRECONDITION(aNumValues, "Must have a pointer to an integer here!");
--- a/dom/html/HTMLImageElement.cpp
+++ b/dom/html/HTMLImageElement.cpp
@@ -338,21 +338,21 @@ HTMLImageElement::MapAttributesIntoRule(
nsChangeHint
HTMLImageElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
int32_t aModType) const
{
nsChangeHint retval =
nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsGkAtoms::usemap ||
aAttribute == nsGkAtoms::ismap) {
- retval |= NS_STYLE_HINT_FRAMECHANGE;
+ retval |= nsChangeHint_ReconstructFrame;
} else if (aAttribute == nsGkAtoms::alt) {
if (aModType == nsIDOMMutationEvent::ADDITION ||
aModType == nsIDOMMutationEvent::REMOVAL) {
- retval |= NS_STYLE_HINT_FRAMECHANGE;
+ retval |= nsChangeHint_ReconstructFrame;
}
}
return retval;
}
NS_IMETHODIMP_(bool)
HTMLImageElement::IsAttributeMapped(const nsIAtom* aAttribute) const
{
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -5677,30 +5677,30 @@ HTMLInputElement::GetAttributeChangeHint
{
nsChangeHint retval =
nsGenericHTMLFormElementWithState::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsGkAtoms::type ||
// The presence or absence of the 'directory' attribute determines what
// buttons we show for type=file.
aAttribute == nsGkAtoms::directory ||
aAttribute == nsGkAtoms::webkitdirectory) {
- retval |= NS_STYLE_HINT_FRAMECHANGE;
+ retval |= nsChangeHint_ReconstructFrame;
} else if (mType == NS_FORM_INPUT_IMAGE &&
(aAttribute == nsGkAtoms::alt ||
aAttribute == nsGkAtoms::value)) {
// We might need to rebuild our alt text. Just go ahead and
// reconstruct our frame. This should be quite rare..
- retval |= NS_STYLE_HINT_FRAMECHANGE;
+ retval |= nsChangeHint_ReconstructFrame;
} else if (aAttribute == nsGkAtoms::value) {
retval |= NS_STYLE_HINT_REFLOW;
} else if (aAttribute == nsGkAtoms::size &&
IsSingleLineTextControl(false)) {
retval |= NS_STYLE_HINT_REFLOW;
} else if (PlaceholderApplies() && aAttribute == nsGkAtoms::placeholder) {
- retval |= NS_STYLE_HINT_FRAMECHANGE;
+ retval |= nsChangeHint_ReconstructFrame;
}
return retval;
}
NS_IMETHODIMP_(bool)
HTMLInputElement::IsAttributeMapped(const nsIAtom* aAttribute) const
{
static const MappedAttributeEntry attributes[] = {
--- a/dom/html/HTMLSelectElement.cpp
+++ b/dom/html/HTMLSelectElement.cpp
@@ -1408,17 +1408,17 @@ HTMLSelectElement::MapAttributesIntoRule
nsChangeHint
HTMLSelectElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
int32_t aModType) const
{
nsChangeHint retval =
nsGenericHTMLFormElementWithState::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsGkAtoms::multiple ||
aAttribute == nsGkAtoms::size) {
- retval |= NS_STYLE_HINT_FRAMECHANGE;
+ retval |= nsChangeHint_ReconstructFrame;
}
return retval;
}
NS_IMETHODIMP_(bool)
HTMLSelectElement::IsAttributeMapped(const nsIAtom* aAttribute) const
{
static const MappedAttributeEntry* const map[] = {
--- a/dom/html/HTMLTextAreaElement.cpp
+++ b/dom/html/HTMLTextAreaElement.cpp
@@ -435,17 +435,17 @@ HTMLTextAreaElement::GetAttributeChangeH
nsChangeHint retval =
nsGenericHTMLFormElementWithState::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsGkAtoms::rows ||
aAttribute == nsGkAtoms::cols) {
retval |= NS_STYLE_HINT_REFLOW;
} else if (aAttribute == nsGkAtoms::wrap) {
retval |= nsChangeHint_ReconstructFrame;
} else if (aAttribute == nsGkAtoms::placeholder) {
- retval |= NS_STYLE_HINT_FRAMECHANGE;
+ retval |= nsChangeHint_ReconstructFrame;
}
return retval;
}
NS_IMETHODIMP_(bool)
HTMLTextAreaElement::IsAttributeMapped(const nsIAtom* aAttribute) const
{
static const MappedAttributeEntry attributes[] = {
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -1439,17 +1439,17 @@ nsXULElement::GetAttributeChangeHint(con
(aModType == nsIDOMMutationEvent::REMOVAL ||
aModType == nsIDOMMutationEvent::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 = NS_STYLE_HINT_FRAMECHANGE;
+ 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;
}
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -4672,17 +4672,17 @@ ElementRestyler::RestyleUndisplayedNodes
aParentContext,
undisplayed->mStyle,
rshint);
}
const nsStyleDisplay* display = undisplayedContext->StyleDisplay();
if (display->mDisplay != aDisplay) {
NS_ASSERTION(element, "Must have undisplayed content");
mChangeList->AppendChange(nullptr, element,
- NS_STYLE_HINT_FRAMECHANGE);
+ nsChangeHint_ReconstructFrame);
// The node should be removed from the undisplayed map when
// we reframe it.
} else {
// update the undisplayed node with the new context
undisplayed->mStyle = undisplayedContext;
if (aDisplay == NS_STYLE_DISPLAY_CONTENTS) {
DoRestyleUndisplayedDescendants(aChildRestyleHint, element,
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -9871,17 +9871,17 @@ ReResolveMenusAndTrees(nsIFrame *aFrame,
}
static bool
ReframeImageBoxes(nsIFrame *aFrame, void *aClosure)
{
nsStyleChangeList *list = static_cast<nsStyleChangeList*>(aClosure);
if (aFrame->GetType() == nsGkAtoms::imageBoxFrame) {
list->AppendChange(aFrame, aFrame->GetContent(),
- NS_STYLE_HINT_FRAMECHANGE);
+ nsChangeHint_ReconstructFrame);
return false; // don't walk descendants
}
return true; // walk descendants
}
static void
WalkFramesThroughPlaceholders(nsPresContext *aPresContext, nsIFrame *aFrame,
frameWalkerFn aFunc, void *aClosure)
--- a/layout/doc/adding-style-props.html
+++ b/layout/doc/adding-style-props.html
@@ -97,17 +97,17 @@ property, in other words, the meaning of
<h3><a name="CSSPropList">CSS Property Name / Constants / Hints</a></h3>
<p>
First, add the new name to the property list in <a href="http://lxr.mozilla.org/seamonkey/source/content/shared/public/nsCSSPropList.h">
nsCSSPropList.h</a>
Insert the property in the list alphabetically, using the existing
property names as a template. The format of the entry you will create is:
</p>
- <pre>CSS_PROP(-moz-force-broken-image-icons, force_broken_image_icons, MozForceBrokenImageIcons, NS_STYLE_HINT_FRAMECHANGE) // bug 58646</pre>
+ <pre>CSS_PROP(-moz-force-broken-image-icons, force_broken_image_icons, MozForceBrokenImageIcons, nsChangeHint_ReconstructFrame) // bug 58646</pre>
<p>The first value is the formal property name, in other words the property
name as it is seen by the CSS parser.<br>
The second value is the name of the property as it will appear internally.<br>
The third value is the name of the DOM property used to access your style.<br>
The last value indicates what must change when the value of the property
changes. It should be an
<a href="http://lxr.mozilla.org/seamonkey/source/content/shared/public/nsChangeHint.h">nsChangeHint</a>.</p>
@@ -330,17 +330,17 @@ is the CalcDifference change for our exa
return NS_STYLE_HINT_NONE;
}
return NS_STYLE_HINT_CONTENT;
}
return NS_STYLE_HINT_VISUAL;
}
return NS_STYLE_HINT_VISUAL;
}
- <b>return NS_STYLE_HINT_FRAMECHANGE;
+ <b>return nsChangeHint_ReconstructFrame;
</b>}
</pre>
<h3>CSSStyleRule</h3>
The nsCSSStyleRule must be updated to manage mapping the declaration to the
style struct. In the file <a href="http://lxr.mozilla.org/seamonkey/source/content/html/style/src/nsCSSStyleRule.cpp">
nsCSSStyleRule.cpp</a>
, locate the Declaration mapping function corresponding to the style struct
you have added your property to. For example, we <a href="http://bugzilla.mozilla.org/MapUIForDeclChange">