зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1710533 - Apply the widget size constraints to newBounds r=mstange,gfx-reviewers
When nsView::CalcWidgetBounds() size might be applied to widget with modification. And next widget->GetClientBounds() could be different than nsView::CalcWidgetBounds() again with several reasons. But it seems OK to apply widget->ConstrainSize() in nsView::DoResetWidgetBounds(). It could remove repaint because of widget->ConstrainSize() call in the Resize(). Differential Revision: https://phabricator.services.mozilla.com/D114814
This commit is contained in:
Родитель
ba272367cd
Коммит
c94f215c05
|
@ -204,7 +204,7 @@ var tests = [
|
|||
is(screenRect.top, 210, testname + " screen top");
|
||||
}
|
||||
ok(screenRect.width >= 120 && screenRect.width <= 140, testname + " screen width");
|
||||
ok(screenRect.height >= 40 && screenRect.height <= 80, testname + " screen height");
|
||||
ok(screenRect.height >= 40 && screenRect.height <= 118, testname + " screen height");
|
||||
|
||||
var gotMouseEvent = false;
|
||||
function mouseMoved(event)
|
||||
|
|
|
@ -332,6 +332,9 @@ void nsView::DoResetWidgetBounds(bool aMoveOnly, bool aInvalidateChangedSize) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Apply the widget size constraints to newBounds.
|
||||
widget->ConstrainSize(&newBounds.width, &newBounds.height);
|
||||
|
||||
bool changedPos = curBounds.TopLeft() != newBounds.TopLeft();
|
||||
bool changedSize = curBounds.Size() != newBounds.Size();
|
||||
|
||||
|
|
|
@ -578,7 +578,7 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
|||
* @param aWidth width to constrain
|
||||
* @param aHeight height to constrain
|
||||
*/
|
||||
void ConstrainSize(int32_t* aWidth, int32_t* aHeight) {
|
||||
void ConstrainSize(int32_t* aWidth, int32_t* aHeight) override {
|
||||
SizeConstraints c = GetSizeConstraints();
|
||||
*aWidth = std::max(c.mMinSize.width, std::min(c.mMaxSize.width, *aWidth));
|
||||
*aHeight =
|
||||
|
|
|
@ -2079,6 +2079,14 @@ class nsIWidget : public nsISupports {
|
|||
*/
|
||||
virtual const SizeConstraints GetSizeConstraints() = 0;
|
||||
|
||||
/**
|
||||
* Apply the current size constraints to the given size.
|
||||
*
|
||||
* @param aWidth width to constrain
|
||||
* @param aHeight height to constrain
|
||||
*/
|
||||
virtual void ConstrainSize(int32_t* aWidth, int32_t* aHeight) = 0;
|
||||
|
||||
/**
|
||||
* If this is owned by a BrowserChild, return that. Otherwise return
|
||||
* null.
|
||||
|
|
Загрузка…
Ссылка в новой задаче