mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Remove the consumers of GetScrollBarDimensions so that we can work on removing
the API too. Bug 364301, r+sr=roc
This commit is contained in:
parent
3665e908b7
commit
3688023262
@ -56,7 +56,6 @@
|
||||
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
#include "nsICategoryManager.h"
|
||||
@ -380,20 +379,12 @@ NS_IMETHODIMP mozXMLTermStream::SizeToContentHeight(PRInt32 maxHeight)
|
||||
if (NS_FAILED(result) || !scrollableView)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Get device context
|
||||
nsCOMPtr<nsIDeviceContext> deviceContext;
|
||||
result = mozXMLTermUtils::GetPresContextDeviceContext(presContext,
|
||||
getter_AddRefs(deviceContext));
|
||||
if (NS_FAILED(result) || !deviceContext)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Determine twips to pixels conversion factor
|
||||
float pixelScale;
|
||||
pixelScale = presContext->TwipsToPixels();
|
||||
|
||||
// Get scrollbar dimensions in pixels
|
||||
float sbWidth, sbHeight;
|
||||
deviceContext->GetScrollBarDimensions(sbWidth, sbHeight);
|
||||
// Get scrollbar dimensions in pixels. Ideally we'd measure the actual scrollbars here.
|
||||
float sbWidth = 15.0, sbHeight = 15.0;
|
||||
PRInt32 scrollBarWidth = PRInt32(sbWidth*pixelScale);
|
||||
PRInt32 scrollBarHeight = PRInt32(sbHeight*pixelScale);
|
||||
|
||||
|
@ -89,6 +89,7 @@
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsBoxLayoutState.h"
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComboboxControlFrame::RedisplayTextEvent::Run()
|
||||
@ -659,15 +660,13 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
|
||||
// First reflow our dropdown so that we know how tall we should be.
|
||||
ReflowDropdown(aPresContext, aReflowState);
|
||||
|
||||
// Get the default size of the scrollbar.
|
||||
// That will be the default width of the dropdown button.
|
||||
// The height will be the height of the text
|
||||
// Can we cache this in a meaningful way?
|
||||
float w, h;
|
||||
// Get the width in Device pixels times p2t
|
||||
aPresContext->DeviceContext()->GetScrollBarDimensions(w, h);
|
||||
|
||||
nscoord buttonWidth = NSToCoordRound(w);
|
||||
// Get the width of the vertical scrollbar. That will be the width of the
|
||||
// dropdown button.
|
||||
nsIScrollableFrame* scrollable;
|
||||
CallQueryInterface(mListControlFrame, &scrollable);
|
||||
NS_ASSERTION(scrollable, "List must be a scrollable frame");
|
||||
nsBoxLayoutState bls(GetPresContext(), aReflowState.rendContext);
|
||||
nscoord buttonWidth = scrollable->GetDesiredScrollbarSizes(&bls).LeftRight();
|
||||
|
||||
if (buttonWidth > aReflowState.mComputedWidth) {
|
||||
buttonWidth = 0;
|
||||
|
@ -1360,24 +1360,18 @@ nsTextControlFrame::CalcIntrinsicSize(nsIRenderingContext* aRenderingContext,
|
||||
|
||||
// Add in the size of the scrollbars for textarea
|
||||
if (IsTextArea()) {
|
||||
float p2t;
|
||||
p2t = presContext->PixelsToTwips();
|
||||
nsIFrame* first = GetFirstChild(nsnull);
|
||||
|
||||
nsIDeviceContext *dx = presContext->DeviceContext();
|
||||
nsIScrollableFrame *scrollableFrame;
|
||||
CallQueryInterface(first, &scrollableFrame);
|
||||
NS_ASSERTION(scrollableFrame, "Child must be scrollable");
|
||||
|
||||
float scale;
|
||||
dx->GetCanonicalPixelScale(scale);
|
||||
nsBoxLayoutState bls(GetPresContext(), aRenderingContext);
|
||||
nsMargin scrollbarSizes = scrollableFrame->GetDesiredScrollbarSizes(&bls);
|
||||
|
||||
float sbWidth;
|
||||
float sbHeight;
|
||||
dx->GetScrollBarDimensions(sbWidth, sbHeight);
|
||||
|
||||
nscoord scrollbarWidth = PRInt32(sbWidth * scale);
|
||||
nscoord scrollbarHeight = PRInt32(sbHeight * scale);
|
||||
|
||||
aIntrinsicSize.height += scrollbarHeight;
|
||||
|
||||
aIntrinsicSize.width += scrollbarWidth;
|
||||
aIntrinsicSize.width += scrollbarSizes.LeftRight();
|
||||
|
||||
aIntrinsicSize.height += scrollbarSizes.TopBottom();;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user