Bug 1317367 part 4. Pass an explicit CallerType to HTMLInputElement::GetValueInternal. r=smaug

I'm not 100% sure that I'm being very consistent in my handling of
mFocusedValue, but since that's not used for file inputs, I don't think it
matters much...

A bigger problem is if people start using this caller type for things other than
file inputs.
This commit is contained in:
Boris Zbarsky
2016-11-15 12:46:32 -05:00
parent b2eaca6676
commit 0fa8643c26
13 changed files with 147 additions and 140 deletions

View File

@@ -8,6 +8,7 @@
#include "nsGkAtoms.h"
#include "mozilla/StyleSetHandle.h"
#include "mozilla/StyleSetHandleInlines.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "nsContentUtils.h"
// MouseEvent suppression in PP
#include "nsContentList.h"
@@ -139,20 +140,19 @@ nsGfxButtonControlFrame::GetLabel(nsXPIDLString& aLabel)
{
// Get the text from the "value" property on our content if there is
// one; otherwise set it to a default value (localized).
nsresult rv;
nsCOMPtr<nsIDOMHTMLInputElement> elt = do_QueryInterface(mContent);
dom::HTMLInputElement* elt = dom::HTMLInputElement::FromContent(mContent);
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::value) && elt) {
rv = elt->GetValue(aLabel);
elt->GetValue(aLabel, dom::CallerType::System);
} else {
// Generate localized label.
// We can't make any assumption as to what the default would be
// because the value is localized for non-english platforms, thus
// it might not be the string "Reset", "Submit Query", or "Browse..."
nsresult rv;
rv = GetDefaultLabel(aLabel);
NS_ENSURE_SUCCESS(rv, rv);
}
NS_ENSURE_SUCCESS(rv, rv);
// Compress whitespace out of label if needed.
if (!StyleText()->WhiteSpaceIsSignificant()) {
aLabel.CompressWhitespace();