зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
3665e908b7
Коммит
3688023262
|
@ -56,7 +56,6 @@
|
||||||
|
|
||||||
#include "nsIViewManager.h"
|
#include "nsIViewManager.h"
|
||||||
#include "nsIScrollableView.h"
|
#include "nsIScrollableView.h"
|
||||||
#include "nsIDeviceContext.h"
|
|
||||||
#include "nsIFrame.h"
|
#include "nsIFrame.h"
|
||||||
|
|
||||||
#include "nsICategoryManager.h"
|
#include "nsICategoryManager.h"
|
||||||
|
@ -380,20 +379,12 @@ NS_IMETHODIMP mozXMLTermStream::SizeToContentHeight(PRInt32 maxHeight)
|
||||||
if (NS_FAILED(result) || !scrollableView)
|
if (NS_FAILED(result) || !scrollableView)
|
||||||
return NS_ERROR_FAILURE;
|
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
|
// Determine twips to pixels conversion factor
|
||||||
float pixelScale;
|
float pixelScale;
|
||||||
pixelScale = presContext->TwipsToPixels();
|
pixelScale = presContext->TwipsToPixels();
|
||||||
|
|
||||||
// Get scrollbar dimensions in pixels
|
// Get scrollbar dimensions in pixels. Ideally we'd measure the actual scrollbars here.
|
||||||
float sbWidth, sbHeight;
|
float sbWidth = 15.0, sbHeight = 15.0;
|
||||||
deviceContext->GetScrollBarDimensions(sbWidth, sbHeight);
|
|
||||||
PRInt32 scrollBarWidth = PRInt32(sbWidth*pixelScale);
|
PRInt32 scrollBarWidth = PRInt32(sbWidth*pixelScale);
|
||||||
PRInt32 scrollBarHeight = PRInt32(sbHeight*pixelScale);
|
PRInt32 scrollBarHeight = PRInt32(sbHeight*pixelScale);
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,7 @@
|
||||||
#include "nsContentCreatorFunctions.h"
|
#include "nsContentCreatorFunctions.h"
|
||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
#include "nsDisplayList.h"
|
#include "nsDisplayList.h"
|
||||||
|
#include "nsBoxLayoutState.h"
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsComboboxControlFrame::RedisplayTextEvent::Run()
|
nsComboboxControlFrame::RedisplayTextEvent::Run()
|
||||||
|
@ -659,15 +660,13 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
|
||||||
// First reflow our dropdown so that we know how tall we should be.
|
// First reflow our dropdown so that we know how tall we should be.
|
||||||
ReflowDropdown(aPresContext, aReflowState);
|
ReflowDropdown(aPresContext, aReflowState);
|
||||||
|
|
||||||
// Get the default size of the scrollbar.
|
// Get the width of the vertical scrollbar. That will be the width of the
|
||||||
// That will be the default width of the dropdown button.
|
// dropdown button.
|
||||||
// The height will be the height of the text
|
nsIScrollableFrame* scrollable;
|
||||||
// Can we cache this in a meaningful way?
|
CallQueryInterface(mListControlFrame, &scrollable);
|
||||||
float w, h;
|
NS_ASSERTION(scrollable, "List must be a scrollable frame");
|
||||||
// Get the width in Device pixels times p2t
|
nsBoxLayoutState bls(GetPresContext(), aReflowState.rendContext);
|
||||||
aPresContext->DeviceContext()->GetScrollBarDimensions(w, h);
|
nscoord buttonWidth = scrollable->GetDesiredScrollbarSizes(&bls).LeftRight();
|
||||||
|
|
||||||
nscoord buttonWidth = NSToCoordRound(w);
|
|
||||||
|
|
||||||
if (buttonWidth > aReflowState.mComputedWidth) {
|
if (buttonWidth > aReflowState.mComputedWidth) {
|
||||||
buttonWidth = 0;
|
buttonWidth = 0;
|
||||||
|
|
|
@ -1360,24 +1360,18 @@ nsTextControlFrame::CalcIntrinsicSize(nsIRenderingContext* aRenderingContext,
|
||||||
|
|
||||||
// Add in the size of the scrollbars for textarea
|
// Add in the size of the scrollbars for textarea
|
||||||
if (IsTextArea()) {
|
if (IsTextArea()) {
|
||||||
float p2t;
|
nsIFrame* first = GetFirstChild(nsnull);
|
||||||
p2t = presContext->PixelsToTwips();
|
|
||||||
|
|
||||||
nsIDeviceContext *dx = presContext->DeviceContext();
|
nsIScrollableFrame *scrollableFrame;
|
||||||
|
CallQueryInterface(first, &scrollableFrame);
|
||||||
|
NS_ASSERTION(scrollableFrame, "Child must be scrollable");
|
||||||
|
|
||||||
float scale;
|
nsBoxLayoutState bls(GetPresContext(), aRenderingContext);
|
||||||
dx->GetCanonicalPixelScale(scale);
|
nsMargin scrollbarSizes = scrollableFrame->GetDesiredScrollbarSizes(&bls);
|
||||||
|
|
||||||
float sbWidth;
|
aIntrinsicSize.width += scrollbarSizes.LeftRight();
|
||||||
float sbHeight;
|
|
||||||
dx->GetScrollBarDimensions(sbWidth, sbHeight);
|
aIntrinsicSize.height += scrollbarSizes.TopBottom();;
|
||||||
|
|
||||||
nscoord scrollbarWidth = PRInt32(sbWidth * scale);
|
|
||||||
nscoord scrollbarHeight = PRInt32(sbHeight * scale);
|
|
||||||
|
|
||||||
aIntrinsicSize.height += scrollbarHeight;
|
|
||||||
|
|
||||||
aIntrinsicSize.width += scrollbarWidth;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче