зеркало из https://github.com/mozilla/gecko-dev.git
Give nsHTMLReflowState an explicit copy-constructor and assignment operator to fix up mCBReflowState and fix regressions from previous patch. b=143706 r=bzbarsky sr=waterson
This commit is contained in:
Родитель
0cc2ec0655
Коммит
b7e8be94dd
|
@ -262,9 +262,13 @@ struct nsHTMLReflowState {
|
|||
static const char* ReasonToString(nsReflowReason aReason);
|
||||
#endif
|
||||
|
||||
// Note: The copy constructor is written by the compiler
|
||||
// automatically. You can use that and then override specific values
|
||||
// if you want, or you can call Init as desired...
|
||||
// A simple copy constructor. (It fixes up |mCBReflowState|, which
|
||||
// can point to |this|, to point to the copy's |this|.)
|
||||
nsHTMLReflowState(const nsHTMLReflowState& aOther);
|
||||
|
||||
// A simple assignment operator. It does the same fixups as the
|
||||
// copy-consturctor.
|
||||
nsHTMLReflowState& operator=(const nsHTMLReflowState& aOther);
|
||||
|
||||
// Initialize a <b>root</b> reflow state with a rendering context to
|
||||
// use for measuring things.
|
||||
|
|
|
@ -88,6 +88,27 @@ nsHTMLReflowState::ReasonToString(nsReflowReason aReason)
|
|||
}
|
||||
#endif
|
||||
|
||||
nsHTMLReflowState::nsHTMLReflowState(const nsHTMLReflowState& aOther)
|
||||
{
|
||||
// Use assignment operator below.
|
||||
*this = aOther;
|
||||
}
|
||||
|
||||
nsHTMLReflowState&
|
||||
nsHTMLReflowState::operator=(const nsHTMLReflowState &aOther)
|
||||
{
|
||||
// Copy everything.
|
||||
// XXX This won't work anymore if someone adds member variables that
|
||||
// have nontrivial constructors or assignment operators (e.g.,
|
||||
// nsCOMPtr).
|
||||
memcpy(this, &aOther, sizeof(*this));
|
||||
|
||||
// Fix up the |mCBReflowState| member, which should continue to point
|
||||
// to |this|.
|
||||
if (aOther.mCBReflowState == &aOther)
|
||||
mCBReflowState = this;
|
||||
}
|
||||
|
||||
// Initialize a <b>root</b> reflow state with a rendering context to
|
||||
// use for measuring things.
|
||||
nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
|
||||
|
|
|
@ -262,9 +262,13 @@ struct nsHTMLReflowState {
|
|||
static const char* ReasonToString(nsReflowReason aReason);
|
||||
#endif
|
||||
|
||||
// Note: The copy constructor is written by the compiler
|
||||
// automatically. You can use that and then override specific values
|
||||
// if you want, or you can call Init as desired...
|
||||
// A simple copy constructor. (It fixes up |mCBReflowState|, which
|
||||
// can point to |this|, to point to the copy's |this|.)
|
||||
nsHTMLReflowState(const nsHTMLReflowState& aOther);
|
||||
|
||||
// A simple assignment operator. It does the same fixups as the
|
||||
// copy-consturctor.
|
||||
nsHTMLReflowState& operator=(const nsHTMLReflowState& aOther);
|
||||
|
||||
// Initialize a <b>root</b> reflow state with a rendering context to
|
||||
// use for measuring things.
|
||||
|
|
|
@ -88,6 +88,27 @@ nsHTMLReflowState::ReasonToString(nsReflowReason aReason)
|
|||
}
|
||||
#endif
|
||||
|
||||
nsHTMLReflowState::nsHTMLReflowState(const nsHTMLReflowState& aOther)
|
||||
{
|
||||
// Use assignment operator below.
|
||||
*this = aOther;
|
||||
}
|
||||
|
||||
nsHTMLReflowState&
|
||||
nsHTMLReflowState::operator=(const nsHTMLReflowState &aOther)
|
||||
{
|
||||
// Copy everything.
|
||||
// XXX This won't work anymore if someone adds member variables that
|
||||
// have nontrivial constructors or assignment operators (e.g.,
|
||||
// nsCOMPtr).
|
||||
memcpy(this, &aOther, sizeof(*this));
|
||||
|
||||
// Fix up the |mCBReflowState| member, which should continue to point
|
||||
// to |this|.
|
||||
if (aOther.mCBReflowState == &aOther)
|
||||
mCBReflowState = this;
|
||||
}
|
||||
|
||||
// Initialize a <b>root</b> reflow state with a rendering context to
|
||||
// use for measuring things.
|
||||
nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
|
||||
|
|
Загрузка…
Ссылка в новой задаче