From 23e03fa69bec51921e5e4fd328a3519a7ca8a675 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 6 Jul 2017 16:57:24 -0400 Subject: [PATCH] Bug 1378983 - Improve the packing of HTMLFormElement; r=mystor This brings the size of this node to 512 bytes on 64-bit debug builds. --- dom/html/HTMLFormElement.cpp | 16 ++++++++-------- dom/html/HTMLFormElement.h | 33 +++++++++++++++++---------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/dom/html/HTMLFormElement.cpp b/dom/html/HTMLFormElement.cpp index 8746689c65da..d132b6129359 100644 --- a/dom/html/HTMLFormElement.cpp +++ b/dom/html/HTMLFormElement.cpp @@ -100,14 +100,6 @@ HTMLFormElement::HTMLFormElement(already_AddRefed& aNode mSelectedRadioButtons(2), mRequiredRadioButtonCounts(2), mValueMissingRadioGroups(2), - mGeneratingSubmit(false), - mGeneratingReset(false), - mIsSubmitting(false), - mDeferSubmission(false), - mNotifiedObservers(false), - mNotifiedObserversResult(false), - mSubmitPopupState(openAbused), - mSubmitInitiatedFromUserInput(false), mPendingSubmission(nullptr), mSubmittingRequest(nullptr), mDefaultSubmitElement(nullptr), @@ -115,7 +107,15 @@ HTMLFormElement::HTMLFormElement(already_AddRefed& aNode mFirstSubmitNotInElements(nullptr), mImageNameLookupTable(FORM_CONTROL_LIST_HASHTABLE_LENGTH), mPastNameLookupTable(FORM_CONTROL_LIST_HASHTABLE_LENGTH), + mSubmitPopupState(openAbused), mInvalidElementsCount(0), + mGeneratingSubmit(false), + mGeneratingReset(false), + mIsSubmitting(false), + mDeferSubmission(false), + mNotifiedObservers(false), + mNotifiedObserversResult(false), + mSubmitInitiatedFromUserInput(false), mEverTriedInvalidSubmit(false) { // We start out valid. diff --git a/dom/html/HTMLFormElement.h b/dom/html/HTMLFormElement.h index 74a993be7c19..4f806b75f222 100644 --- a/dom/html/HTMLFormElement.h +++ b/dom/html/HTMLFormElement.h @@ -560,22 +560,6 @@ protected: nsDataHashtable mRequiredRadioButtonCounts; /** The value missing state of each group */ nsDataHashtable mValueMissingRadioGroups; - /** Whether we are currently processing a submit event or not */ - bool mGeneratingSubmit; - /** Whether we are currently processing a reset event or not */ - bool mGeneratingReset; - /** Whether we are submitting currently */ - bool mIsSubmitting; - /** Whether the submission is to be deferred in case a script triggers it */ - bool mDeferSubmission; - /** Whether we notified NS_FORMSUBMIT_SUBJECT listeners already */ - bool mNotifiedObservers; - /** If we notified the listeners early, what was the result? */ - bool mNotifiedObserversResult; - /** Keep track of what the popup state was when the submit was initiated */ - PopupControlState mSubmitPopupState; - /** Keep track of whether a submission was user-initiated or not */ - bool mSubmitInitiatedFromUserInput; /** The pending submission object */ nsAutoPtr mPendingSubmission; @@ -612,6 +596,9 @@ protected: nsInterfaceHashtable mPastNameLookupTable; + /** Keep track of what the popup state was when the submit was initiated */ + PopupControlState mSubmitPopupState; + /** * Number of invalid and candidate for constraint validation elements in the * form the last time UpdateValidity has been called. @@ -619,6 +606,20 @@ protected: */ int32_t mInvalidElementsCount; + /** Whether we are currently processing a submit event or not */ + bool mGeneratingSubmit; + /** Whether we are currently processing a reset event or not */ + bool mGeneratingReset; + /** Whether we are submitting currently */ + bool mIsSubmitting; + /** Whether the submission is to be deferred in case a script triggers it */ + bool mDeferSubmission; + /** Whether we notified NS_FORMSUBMIT_SUBJECT listeners already */ + bool mNotifiedObservers; + /** If we notified the listeners early, what was the result? */ + bool mNotifiedObserversResult; + /** Keep track of whether a submission was user-initiated or not */ + bool mSubmitInitiatedFromUserInput; /** * Whether the submission of this form has been ever prevented because of * being invalid.