Bug 838699 - Move the "Browse" button l10n to nsFileControlFrame.cpp. r=bz

This commit is contained in:
Mounir Lamouri
2013-02-09 10:48:20 +00:00
parent 06d97d4c0d
commit ef70012ec2
3 changed files with 6 additions and 23 deletions

View File

@@ -117,6 +117,12 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
mBrowse->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
NS_LITERAL_STRING("button"), false);
// Set the file picking button text depending on the current locale.
nsXPIDLString buttonValue;
nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
"Browse", buttonValue);
mBrowse->SetAttr(kNameSpaceID_None, nsGkAtoms::value, buttonValue, false);
// Make sure access key and tab order for the element actually redirect to the
// file picking button.
nsCOMPtr<nsIDOMHTMLInputElement> fileContent = do_QueryInterface(mContent);

View File

@@ -50,24 +50,6 @@ nsGfxButtonControlFrame::GetType() const
return nsGkAtoms::gfxButtonControlFrame;
}
// Special check for the browse button of a file input.
//
// We'll return true if type is NS_FORM_INPUT_BUTTON and our parent
// is a file input.
bool
nsGfxButtonControlFrame::IsFileBrowseButton(int32_t type) const
{
bool rv = false;
if (NS_FORM_INPUT_BUTTON == type) {
// Check to see if parent is a file input
nsCOMPtr<nsIFormControl> formCtrl =
do_QueryInterface(mContent->GetParent());
rv = formCtrl && formCtrl->GetType() == NS_FORM_INPUT_FILE;
}
return rv;
}
#ifdef DEBUG
NS_IMETHODIMP
nsGfxButtonControlFrame::GetFrameName(nsAString& aResult) const
@@ -172,9 +154,6 @@ nsGfxButtonControlFrame::GetDefaultLabel(nsXPIDLString& aString) const
else if (type == NS_FORM_INPUT_SUBMIT) {
prop = "Submit";
}
else if (IsFileBrowseButton(type)) {
prop = "Browse";
}
else {
aString.Truncate();
return NS_OK;

View File

@@ -62,8 +62,6 @@ protected:
nsresult GetLabel(nsXPIDLString& aLabel);
bool IsFileBrowseButton(int32_t type) const; // Browse button of file input
virtual bool IsInput() MOZ_OVERRIDE { return true; }
private:
nsCOMPtr<nsIContent> mTextContent;