Bug 838699 - Move the "Browse" button l10n to nsFileControlFrame.cpp. r=bz
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user