mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 56488 - Down scroll arrow hidden, draws behind resize widget when neither Status Bar nor horizontal scrollbar are displayed. r+sr=roc.
This commit is contained in:
parent
b16852c1cd
commit
45788e2145
@ -2497,6 +2497,34 @@ static void LayoutAndInvalidate(nsBoxLayoutState& aState,
|
||||
aBox->Invalidate(aBox->GetOverflowRect());
|
||||
}
|
||||
|
||||
static void AdjustScrollbarRect(nsIView* aView, nsPresContext* aPresContext,
|
||||
nsRect& aRect, PRBool aVertical)
|
||||
{
|
||||
if ((aVertical ? aRect.width : aRect.height) == 0)
|
||||
return;
|
||||
|
||||
nsPoint offset;
|
||||
nsIWidget* widget = aView->GetNearestWidget(&offset);
|
||||
|
||||
nsIntRect widgetRect;
|
||||
if (!widget->ShowsResizeIndicator(&widgetRect))
|
||||
return;
|
||||
|
||||
nsRect resizerRect =
|
||||
nsRect(aPresContext->DevPixelsToAppUnits(widgetRect.x) - offset.x,
|
||||
aPresContext->DevPixelsToAppUnits(widgetRect.y) - offset.y,
|
||||
aPresContext->DevPixelsToAppUnits(widgetRect.width),
|
||||
aPresContext->DevPixelsToAppUnits(widgetRect.height));
|
||||
|
||||
if (!aRect.Intersects(resizerRect))
|
||||
return;
|
||||
|
||||
if (aVertical)
|
||||
aRect.height = PR_MAX(0, resizerRect.y - aRect.y);
|
||||
else
|
||||
aRect.width = PR_MAX(0, resizerRect.x - aRect.x);
|
||||
}
|
||||
|
||||
void
|
||||
nsGfxScrollFrameInner::LayoutScrollbars(nsBoxLayoutState& aState,
|
||||
const nsRect& aContentArea,
|
||||
@ -2506,6 +2534,8 @@ nsGfxScrollFrameInner::LayoutScrollbars(nsBoxLayoutState& aState,
|
||||
NS_ASSERTION(!mSupppressScrollbarUpdate,
|
||||
"This should have been suppressed");
|
||||
|
||||
nsIView* view = mOuter->GetView();
|
||||
nsPresContext* presContext = mScrolledFrame->PresContext();
|
||||
if (mVScrollbarBox) {
|
||||
NS_PRECONDITION(mVScrollbarBox->IsBoxFrame(), "Must be a box frame!");
|
||||
nsRect vRect(aScrollArea);
|
||||
@ -2514,6 +2544,7 @@ nsGfxScrollFrameInner::LayoutScrollbars(nsBoxLayoutState& aState,
|
||||
nsMargin margin;
|
||||
mVScrollbarBox->GetMargin(margin);
|
||||
vRect.Deflate(margin);
|
||||
AdjustScrollbarRect(view, presContext, vRect, PR_TRUE);
|
||||
LayoutAndInvalidate(aState, mVScrollbarBox, vRect);
|
||||
}
|
||||
|
||||
@ -2525,6 +2556,7 @@ nsGfxScrollFrameInner::LayoutScrollbars(nsBoxLayoutState& aState,
|
||||
nsMargin margin;
|
||||
mHScrollbarBox->GetMargin(margin);
|
||||
hRect.Deflate(margin);
|
||||
AdjustScrollbarRect(view, presContext, hRect, PR_FALSE);
|
||||
LayoutAndInvalidate(aState, mHScrollbarBox, hRect);
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "nsISupports.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
#include "prthread.h"
|
||||
#include "nsEvent.h"
|
||||
@ -53,7 +54,6 @@ class nsIFontMetrics;
|
||||
class nsIRenderingContext;
|
||||
class nsIDeviceContext;
|
||||
class nsIRegion;
|
||||
struct nsRect;
|
||||
struct nsFont;
|
||||
class nsIEventListener;
|
||||
class nsIRollupListener;
|
||||
@ -94,10 +94,10 @@ typedef nsEventStatus (*PR_CALLBACK EVENT_CALLBACK)(nsGUIEvent *event);
|
||||
#define NS_NATIVE_PLUGIN_PORT_CG 101
|
||||
#endif
|
||||
|
||||
// 594d22a3-ef2d-4189-9bc1-3c3da586f47a
|
||||
// 3d304df2-8e6b-4f09-8782-98bd649c7e96
|
||||
#define NS_IWIDGET_IID \
|
||||
{ 0x594d22a3, 0xef2d, 0x4189, \
|
||||
{ 0x9b, 0xc1, 0x3c, 0x3d, 0xa5, 0x86, 0xf4, 0x7a } }
|
||||
{ 0x3d304df2, 0x8e6b, 0x4f09, \
|
||||
{ 0x87, 0x82, 0x98, 0xbd, 0x64, 0x9c, 0x7e, 0x96 } }
|
||||
|
||||
// Hide the native window systems real window type so as to avoid
|
||||
// including native window system types and APIs. This is necessary
|
||||
@ -1045,6 +1045,17 @@ class nsIWidget : public nsISupports {
|
||||
* windows.
|
||||
*/
|
||||
NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, PRBool aActive) = 0;
|
||||
|
||||
/*
|
||||
* Determine whether the widget shows a resize widget. If it does,
|
||||
* aResizerRect returns the resizer's rect.
|
||||
*
|
||||
* Returns false on any platform that does not support it.
|
||||
*
|
||||
* @param aResizerRect The resizer's rect in device pixels.
|
||||
* @return Whether a resize widget is shown.
|
||||
*/
|
||||
virtual PRBool ShowsResizeIndicator(nsIntRect* aResizerRect) = 0;
|
||||
|
||||
/**
|
||||
* Get the Thebes surface associated with this widget.
|
||||
|
@ -304,6 +304,7 @@ public:
|
||||
NS_IMETHOD ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect);
|
||||
NS_IMETHOD BeginResizingChildren(void);
|
||||
NS_IMETHOD EndResizingChildren(void);
|
||||
virtual PRBool ShowsResizeIndicator(nsIntRect* aResizerRect);
|
||||
|
||||
static PRBool ConvertStatus(nsEventStatus aStatus)
|
||||
{ return aStatus == nsEventStatus_eConsumeNoDefault; }
|
||||
|
@ -1158,6 +1158,29 @@ NS_IMETHODIMP nsChildView::EndResizingChildren(void)
|
||||
}
|
||||
|
||||
|
||||
static const PRInt32 resizeIndicatorWidth = 15;
|
||||
static const PRInt32 resizeIndicatorHeight = 15;
|
||||
PRBool nsChildView::ShowsResizeIndicator(nsIntRect* aResizerRect)
|
||||
{
|
||||
NSView *topLevelView = mView, *superView = nil;
|
||||
while (superView = [topLevelView superview])
|
||||
topLevelView = superView;
|
||||
|
||||
if (![[topLevelView window] showsResizeIndicator])
|
||||
return PR_FALSE;
|
||||
|
||||
if (aResizerRect) {
|
||||
NSSize bounds = [topLevelView bounds].size;
|
||||
NSPoint corner = NSMakePoint(bounds.width, [topLevelView isFlipped] ? bounds.height : 0);
|
||||
corner = [topLevelView convertPoint:corner toView:mView];
|
||||
aResizerRect->SetRect(NSToIntRound(corner.x) - resizeIndicatorWidth,
|
||||
NSToIntRound(corner.y) - resizeIndicatorHeight,
|
||||
resizeIndicatorWidth, resizeIndicatorHeight);
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsChildView::GetPluginClipRect(nsRect& outClipRect, nsPoint& outOrigin, PRBool& outWidgetVisible)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
@ -862,6 +862,12 @@ nsBaseWidget::SetWindowTitlebarColor(nscolor aColor, PRBool aActive)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsBaseWidget::ShowsResizeIndicator(nsIntRect* aResizerRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Modifies aFile to point at an icon file with the given name and suffix. The
|
||||
|
@ -133,6 +133,7 @@ public:
|
||||
NS_IMETHOD BeginSecureKeyboardInput();
|
||||
NS_IMETHOD EndSecureKeyboardInput();
|
||||
NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, PRBool aActive);
|
||||
virtual PRBool ShowsResizeIndicator(nsIntRect* aResizerRect);
|
||||
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) {}
|
||||
virtual void FreeNativeData(void * data, PRUint32 aDataType) {}
|
||||
NS_IMETHOD BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical);
|
||||
|
Loading…
Reference in New Issue
Block a user