Bug 1299335 (part 2) - Streamline nsIWidget::SetIcon. r=mstange.

This patch does the following.

- Removes the return value, because none of the call sites check it.

- Removes the empty implementations from several nsIWidget instances, because
  they can use the nsBaseWidget one.

--HG--
extra : rebase_source : a1a04193bc3940f1468c7c235f6d6e0341d0f1c2
This commit is contained in:
Nicholas Nethercote 2016-12-16 10:54:11 +11:00
Родитель 3970265787
Коммит efc5071ff2
8 изменённых файлов: 12 добавлений и 23 удалений

Просмотреть файл

@ -203,7 +203,6 @@ public:
void* GetNativeData(uint32_t aDataType) override;
void SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
NS_IMETHOD SetTitle(const nsAString& aTitle) override { return NS_OK; }
NS_IMETHOD SetIcon(const nsAString& aIconSpec) override { return NS_OK; }
virtual MOZ_MUST_USE nsresult GetAttention(int32_t aCycleCount) override { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,

Просмотреть файл

@ -1805,11 +1805,11 @@ nsWindow::SetTitle(const nsAString& aTitle)
return NS_OK;
}
NS_IMETHODIMP
void
nsWindow::SetIcon(const nsAString& aIconSpec)
{
if (!mShell)
return NS_OK;
return;
nsAutoCString iconName;
@ -1866,8 +1866,6 @@ nsWindow::SetIcon(const nsAString& aIconSpec)
if (foundIcon) {
gtk_window_set_icon_name(GTK_WINDOW(mShell), iconName.get());
}
return NS_OK;
}

Просмотреть файл

@ -142,7 +142,7 @@ public:
virtual void* GetNativeData(uint32_t aDataType) override;
void SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
NS_IMETHOD SetTitle(const nsAString& aTitle) override;
NS_IMETHOD SetIcon(const nsAString& aIconSpec) override;
virtual void SetIcon(const nsAString& aIconSpec) override;
virtual void SetWindowClass(const nsAString& xulWinType) override;
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
virtual void CaptureMouse(bool aCapture) override;

Просмотреть файл

@ -1610,12 +1610,6 @@ nsBaseWidget::HasPendingInputEvent()
return false;
}
NS_IMETHODIMP
nsBaseWidget::SetIcon(const nsAString&)
{
return NS_OK;
}
bool
nsBaseWidget::ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect)
{

Просмотреть файл

@ -247,7 +247,7 @@ public:
GetAttention(int32_t aCycleCount) override
{ return NS_OK; }
virtual bool HasPendingInputEvent() override;
NS_IMETHOD SetIcon(const nsAString &anIconSpec) override;
virtual void SetIcon(const nsAString &aIconSpec) override {}
virtual void SetWindowTitlebarColor(nscolor aColor, bool aActive)
override {}
virtual void SetDrawsInTitlebar(bool aState) override {}

Просмотреть файл

@ -1318,19 +1318,17 @@ class nsIWidget : public nsISupports
*
* @param aTitle string displayed as the title of the widget
*/
NS_IMETHOD SetTitle(const nsAString& aTitle) = 0;
/**
* Set the widget's icon.
* Must be called after Create.
*
* @param anIconSpec string specifying the icon to use; convention is to pass
* a resource: URL from which a platform-dependent resource
* file name will be constructed
* @param aIconSpec string specifying the icon to use; convention is to
* pass a resource: URL from which a platform-dependent
* resource file name will be constructed
*/
NS_IMETHOD SetIcon(const nsAString& anIconSpec) = 0;
virtual void SetIcon(const nsAString& aIconSpec) = 0;
/**
* Return this widget's origin in screen coordinates.

Просмотреть файл

@ -3532,7 +3532,8 @@ NS_IMETHODIMP nsWindow::SetTitle(const nsAString& aTitle)
*
**************************************************************/
NS_IMETHODIMP nsWindow::SetIcon(const nsAString& aIconSpec)
void
nsWindow::SetIcon(const nsAString& aIconSpec)
{
// Assume the given string is a local identifier for an icon file.
@ -3540,7 +3541,7 @@ NS_IMETHODIMP nsWindow::SetIcon(const nsAString& aIconSpec)
ResolveIconName(aIconSpec, NS_LITERAL_STRING(".ico"),
getter_AddRefs(iconFile));
if (!iconFile)
return NS_OK; // not an error if icon is not found
return;
nsAutoString iconPath;
iconFile->GetPath(iconPath);
@ -3590,7 +3591,6 @@ NS_IMETHODIMP nsWindow::SetIcon(const nsAString& aIconSpec)
cPath.get(), ::GetLastError()));
}
#endif
return NS_OK;
}
/**************************************************************

Просмотреть файл

@ -161,7 +161,7 @@ public:
void SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
virtual void FreeNativeData(void * data, uint32_t aDataType) override;
NS_IMETHOD SetTitle(const nsAString& aTitle) override;
NS_IMETHOD SetIcon(const nsAString& aIconSpec) override;
virtual void SetIcon(const nsAString& aIconSpec) override;
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
virtual LayoutDeviceIntSize ClientToWindowSize(const LayoutDeviceIntSize& aClientSize) override;
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,