diff --git a/mozilla/layout/forms/nsButtonFrameRenderer.cpp b/mozilla/layout/forms/nsButtonFrameRenderer.cpp index 700b5eb48b6..78545657674 100644 --- a/mozilla/layout/forms/nsButtonFrameRenderer.cpp +++ b/mozilla/layout/forms/nsButtonFrameRenderer.cpp @@ -38,8 +38,6 @@ #include "nsIRenderingContext.h" #include "nsCSSRendering.h" #include "nsPresContext.h" -#include "nsIView.h" -#include "nsIViewManager.h" #include "nsGkAtoms.h" #include "nsCSSPseudoElements.h" #include "nsINameSpaceManager.h" diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index dd9bdc4047b..7f95923ef83 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -495,11 +495,8 @@ nsComboboxControlFrame::ReflowDropdown(nsPresContext* aPresContext, return rv; } -nsresult -nsComboboxControlFrame::PositionDropdown(nsPresContext* aPresContext, - nscoord aHeight, - nsRect aAbsoluteTwipsRect, - nsRect aAbsolutePixelRect) +void +nsComboboxControlFrame::AbsolutelyPositionDropDown() { // Position the dropdown list. It is positioned below the display frame if there is enough // room on the screen to display the entire list. Otherwise it is placed above the display @@ -514,34 +511,33 @@ nsComboboxControlFrame::PositionDropdown(nsPresContext* aPresContext, // Use the height calculated for the area frame so it includes both // the display and button heights. - nsresult rv = NS_OK; - nscoord dropdownYOffset = aHeight; + nscoord dropdownYOffset = GetRect().height; + nsPresContext* presContext = GetPresContext(); // XXX: Enable this code to debug popping up above the display frame, rather than below it - nsRect dropdownRect = mDropdownFrame->GetRect(); + nsSize dropdownSize = mDropdownFrame->GetSize(); nscoord screenHeightInPixels = 0; - if (NS_SUCCEEDED(nsFormControlFrame::GetScreenHeight(aPresContext, screenHeightInPixels))) { - // Get the height of the dropdown list in pixels. - nscoord absoluteDropDownHeight = aPresContext->AppUnitsToDevPixels(dropdownRect.height); - - // Check to see if the drop-down list will go offscreen - if (NS_SUCCEEDED(rv) && ((aAbsolutePixelRect.y + aAbsolutePixelRect.height + absoluteDropDownHeight) > screenHeightInPixels)) { + if (NS_SUCCEEDED(nsFormControlFrame::GetScreenHeight(presContext, screenHeightInPixels))) { + // Get the height of the dropdown list in pixels. + nscoord absoluteDropDownHeight = presContext->AppUnitsToDevPixels(dropdownSize.height); + // Check to see if the drop-down list will go offscreen + if (GetScreenRect().YMost() + absoluteDropDownHeight > screenHeightInPixels) { // move the dropdown list up - dropdownYOffset = - (dropdownRect.height); + dropdownYOffset = - (dropdownSize.height); } } - + + nsPoint dropdownPosition; const nsStyleVisibility* vis = GetStyleVisibility(); if (vis->mDirection == NS_STYLE_DIRECTION_RTL) { // Align the right edge of the drop-down with the right edge of the control. - dropdownRect.x = aAbsoluteTwipsRect.width - dropdownRect.width; + dropdownPosition.x = GetRect().width - dropdownSize.width; } else { - dropdownRect.x = 0; + dropdownPosition.x = 0; } - dropdownRect.y = dropdownYOffset; + dropdownPosition.y = dropdownYOffset; - mDropdownFrame->SetRect(dropdownRect); - return rv; + mDropdownFrame->SetPosition(dropdownPosition); } //---------------------------------------------------------- @@ -750,17 +746,6 @@ nsComboboxControlFrame::ToggleList(nsPresContext* aPresContext) return NS_OK; } -void -nsComboboxControlFrame::AbsolutelyPositionDropDown() -{ - nsRect absoluteTwips; - nsRect absolutePixels; - - if (NS_SUCCEEDED(nsFormControlFrame::GetAbsoluteFramePosition(GetPresContext(), this, absoluteTwips, absolutePixels))) { - PositionDropdown(GetPresContext(), GetRect().height, absoluteTwips, absolutePixels); - } -} - /////////////////////////////////////////////////////////////// NS_IMETHODIMP diff --git a/mozilla/layout/forms/nsComboboxControlFrame.h b/mozilla/layout/forms/nsComboboxControlFrame.h index b6ebcf1bd19..b72ba12736b 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.h +++ b/mozilla/layout/forms/nsComboboxControlFrame.h @@ -203,11 +203,6 @@ protected: nsresult ReflowDropdown(nsPresContext* aPresContext, const nsHTMLReflowState& aReflowState); -public: - nsresult PositionDropdown(nsPresContext* aPresContext, - nscoord aHeight, - nsRect aAbsoluteTwipsRect, - nsRect aAbsolutePixelRect); protected: class RedisplayTextEvent; friend class RedisplayTextEvent; diff --git a/mozilla/layout/forms/nsFileControlFrame.cpp b/mozilla/layout/forms/nsFileControlFrame.cpp index 9317b5f1666..625c39d8710 100644 --- a/mozilla/layout/forms/nsFileControlFrame.cpp +++ b/mozilla/layout/forms/nsFileControlFrame.cpp @@ -44,7 +44,6 @@ #include "nsGkAtoms.h" #include "nsWidgetsCID.h" #include "nsIComponentManager.h" -#include "nsIView.h" #include "nsHTMLParts.h" #include "nsIDOMHTMLInputElement.h" #include "nsIFormControl.h" diff --git a/mozilla/layout/forms/nsFormControlFrame.cpp b/mozilla/layout/forms/nsFormControlFrame.cpp index 4e4212a03f1..9b04c0dc11c 100644 --- a/mozilla/layout/forms/nsFormControlFrame.cpp +++ b/mozilla/layout/forms/nsFormControlFrame.cpp @@ -41,15 +41,13 @@ #include "nsIEventStateManager.h" #include "nsIScrollableView.h" #include "nsILookAndFeel.h" -#include "nsIViewManager.h" //#define FCF_NOISY const PRInt32 kSizeNotSet = -1; nsFormControlFrame::nsFormControlFrame(nsStyleContext* aContext) : - nsLeafFrame(aContext), - mDidInit(PR_FALSE) + nsLeafFrame(aContext) { } @@ -60,8 +58,7 @@ nsFormControlFrame::~nsFormControlFrame() void nsFormControlFrame::Destroy() { - // XXXldb Do we really need to do this? Shouldn't only those frames - // that use it do it? + // Unregister the access key registered in reflow nsFormControlFrame::RegUnRegAccessKey(NS_STATIC_CAST(nsIFrame*, this), PR_FALSE); nsLeafFrame::Destroy(); } @@ -84,55 +81,15 @@ nsFormControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) nscoord nsFormControlFrame::GetIntrinsicWidth() { - // Intrinsic width is 144 twips. Why? I have no idea; that's what - // it was before I touched this code, and the original checkin - // comment is not so helpful. - return 144; + // Actual width is set in forms.css + return 0; } nscoord nsFormControlFrame::GetIntrinsicHeight() { - // Intrinsic height is 144 twips. Why? I have no idea; that's what - // it was before I touched this code, and the original checkin - // comment is not so helpful. - return 144; -} - -NS_IMETHODIMP -nsFormControlFrame::DidReflow(nsPresContext* aPresContext, - const nsHTMLReflowState* aReflowState, - nsDidReflowStatus aStatus) -{ - nsresult rv = nsLeafFrame::DidReflow(aPresContext, aReflowState, aStatus); - - - // The view is created hidden; once we have reflowed it and it has been - // positioned then we show it. - if (NS_FRAME_REFLOW_FINISHED == aStatus) { - nsIView* view = GetView(); - if (view) { - nsViewVisibility newVis = GetStyleVisibility()->IsVisible() - ? nsViewVisibility_kShow - : nsViewVisibility_kHide; - // only change if different. - if (newVis != view->GetVisibility()) { - nsIViewManager* vm = view->GetViewManager(); - if (vm) { - vm->SetViewVisibility(view, newVis); - } - } - } - } - - return rv; -} - -NS_IMETHODIMP -nsFormControlFrame::SetInitialChildList(nsIAtom* aListName, - nsIFrame* aChildList) -{ - return NS_OK; + // Actual width is set in forms.css + return 0; } NS_METHOD @@ -236,69 +193,3 @@ nsFormControlFrame::GetScreenHeight(nsPresContext* aPresContext, aHeight = aPresContext->AppUnitsToDevPixels(screen.height); return NS_OK; } - -// Calculate a frame's position in screen coordinates -nsresult -nsFormControlFrame::GetAbsoluteFramePosition(nsPresContext* aPresContext, - nsIFrame *aFrame, - nsRect& aAbsoluteTwipsRect, - nsRect& aAbsolutePixelRect) -{ - nsresult rv = NS_OK; - - aAbsoluteTwipsRect = aFrame->GetRect(); - // zero these out, - // because the GetOffsetFromView figures them out - // XXXbz why do we need to do this, really? Will we ever fail to - // get a containing view? - aAbsoluteTwipsRect.x = 0; - aAbsoluteTwipsRect.y = 0; - - // Start with frame's offset from it it's containing view - nsIView *view = nsnull; - nsPoint frameOffset; - rv = aFrame->GetOffsetFromView(frameOffset, &view); - - if (NS_SUCCEEDED(rv) && view) { - aAbsoluteTwipsRect.MoveTo(frameOffset); - - nsIWidget* widget; - // Walk up the views, looking for a widget - do { - // add in the offset of the view from its parent. - aAbsoluteTwipsRect += view->GetPosition(); - - widget = view->GetWidget(); - if (widget) { - // account for space above and to the left of the view origin. - // the widget is aligned with view's bounds, not its origin - - nsRect bounds = view->GetBounds(); - aAbsoluteTwipsRect.x -= bounds.x; - aAbsoluteTwipsRect.y -= bounds.y; - - // Add in the absolute offset of the widget. - nsRect absBounds; - nsRect zeroRect; - // XXX a twip version of this would be really nice here! - widget->WidgetToScreen(zeroRect, absBounds); - // Convert widget coordinates to twips - aAbsoluteTwipsRect.x += aPresContext->DevPixelsToAppUnits(absBounds.x); - aAbsoluteTwipsRect.y += aPresContext->DevPixelsToAppUnits(absBounds.y); - break; - } - - view = view->GetParent(); - } while (view); - } - - // convert to pixel coordinates - if (NS_SUCCEEDED(rv)) { - aAbsolutePixelRect.x = aPresContext->AppUnitsToDevPixels(aAbsoluteTwipsRect.x); - aAbsolutePixelRect.y = aPresContext->AppUnitsToDevPixels(aAbsoluteTwipsRect.y); - aAbsolutePixelRect.width = aPresContext->AppUnitsToDevPixels(aAbsoluteTwipsRect.width); - aAbsolutePixelRect.height = aPresContext->AppUnitsToDevPixels(aAbsoluteTwipsRect.height); - } - - return rv; -} diff --git a/mozilla/layout/forms/nsFormControlFrame.h b/mozilla/layout/forms/nsFormControlFrame.h index 4041b054627..51cdad8cb07 100644 --- a/mozilla/layout/forms/nsFormControlFrame.h +++ b/mozilla/layout/forms/nsFormControlFrame.h @@ -41,29 +41,6 @@ #include "nsIFormControlFrame.h" #include "nsLeafFrame.h" -#define ATTR_NOTSET -1 - -#ifdef DEBUG_rods - -#define COMPARE_QUIRK_SIZE(__class, __navWidth, __navHeight) \ -{ \ - float t2p; \ - t2p = aPresContext->TwipsToPixels(); \ - printf ("%-25s::Size=%4d,%4d %3d,%3d Nav:%3d,%3d Diffs: %3d,%3d\n", \ - (__class), \ - aDesiredSize.width, aDesiredSize.height, \ - NSToCoordRound(aDesiredSize.width * t2p), \ - NSToCoordRound(aDesiredSize.height * t2p), \ - (__navWidth), \ - (__navHeight), \ - NSToCoordRound(aDesiredSize.width * t2p) - (__navWidth), \ - NSToCoordRound(aDesiredSize.height * t2p) - (__navHeight)); \ -} - -#else -#define COMPARE_QUIRK_SIZE(__class, __navWidth, __navHeight) -#endif - /** * nsFormControlFrame is the base class for frames of form controls. It * provides a uniform way of creating widgets, resizing, and painting. @@ -91,13 +68,6 @@ public: nsGUIEvent* aEvent, nsEventStatus* aEventStatus); - NS_IMETHOD SetInitialChildList(nsIAtom* aListName, - nsIFrame* aChildList); - - NS_IMETHOD DidReflow(nsPresContext* aPresContext, - const nsHTMLReflowState* aReflowState, - nsDidReflowStatus aStatus); - /** * Respond to the request to resize and/or reflow * @see nsIFrame::Reflow @@ -127,14 +97,6 @@ public: */ static nsresult GetScreenHeight(nsPresContext* aPresContext, nscoord& aHeight); - /** - * Helper method to get the absolute position of a frame - * - */ - static nsresult GetAbsoluteFramePosition(nsPresContext* aPresContext, - nsIFrame *aFrame, - nsRect& aAbsoluteTwipsRect, - nsRect& aAbsolutePixelRect); protected: virtual ~nsFormControlFrame(); @@ -155,8 +117,6 @@ protected: void GetCurrentCheckState(PRBool* aState); - PRBool mDidInit; - private: NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; } diff --git a/mozilla/layout/forms/nsIsIndexFrame.cpp b/mozilla/layout/forms/nsIsIndexFrame.cpp index 2c62d4f5c49..c70556635a7 100644 --- a/mozilla/layout/forms/nsIsIndexFrame.cpp +++ b/mozilla/layout/forms/nsIsIndexFrame.cpp @@ -45,7 +45,6 @@ #include "nsPresState.h" #include "nsWidgetsCID.h" #include "nsIComponentManager.h" -#include "nsIView.h" #include "nsHTMLParts.h" #include "nsIDOMHTMLInputElement.h" #include "nsINameSpaceManager.h" @@ -254,18 +253,6 @@ nsIsIndexFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr); } -void -nsIsIndexFrame::ScrollIntoView(nsPresContext* aPresContext) -{ - if (aPresContext) { - nsIPresShell *presShell = aPresContext->GetPresShell(); - if (presShell) { - presShell->ScrollFrameIntoView(this, - NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); - } - } -} - nscoord nsIsIndexFrame::GetMinWidth(nsIRenderingContext *aRenderingContext) { diff --git a/mozilla/layout/forms/nsIsIndexFrame.h b/mozilla/layout/forms/nsIsIndexFrame.h index 3a4aaf6ec57..1c2d8984b89 100644 --- a/mozilla/layout/forms/nsIsIndexFrame.h +++ b/mozilla/layout/forms/nsIsIndexFrame.h @@ -96,7 +96,6 @@ public: PRInt32 aModType); void SetFocus(PRBool aOn, PRBool aRepaint); - void ScrollIntoView(nsPresContext* aPresContext); // from nsIAnonymousContentCreator NS_IMETHOD CreateAnonymousContent(nsPresContext* aPresContext, diff --git a/mozilla/layout/forms/nsListControlFrame.h b/mozilla/layout/forms/nsListControlFrame.h index 33674468e77..68afa6a72cc 100644 --- a/mozilla/layout/forms/nsListControlFrame.h +++ b/mozilla/layout/forms/nsListControlFrame.h @@ -62,10 +62,8 @@ class nsIDOMHTMLSelectElement; class nsIDOMHTMLOptionsCollection; class nsIDOMHTMLOptionElement; class nsIComboboxControlFrame; -class nsIViewManager; class nsPresContext; class nsVoidArray; -class nsIScrollableView; class nsVoidArray; class nsListEventListener; diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp index 1024b69bfb3..f3ec1e45df3 100644 --- a/mozilla/layout/forms/nsTextControlFrame.cpp +++ b/mozilla/layout/forms/nsTextControlFrame.cpp @@ -70,10 +70,6 @@ #include "nsIContent.h" #include "nsIAtom.h" #include "nsPresContext.h" -#ifdef USE_QI_IN_SUPPRESS_EVENT_HANDLERS -#include "nsIPrintContext.h" -#include "nsIPrintPreviewContext.h" -#endif // USE_QI_IN_SUPPRESS_EVENT_HANDLERS #include "nsGkAtoms.h" #include "nsLayoutUtils.h" #include "nsIComponentManager.h" @@ -1058,31 +1054,10 @@ SuppressEventHandlers(nsPresContext* aPresContext) // Right now we only suppress event handlers and controller manipulation // when in a print preview or print context! -#ifdef USE_QI_IN_SUPPRESS_EVENT_HANDLERS - - // Using QI to see if we're printing or print previewing is more - // accurate, but a bit more heavy weight then just checking - // the pagination bool, which will return the right answer to us - // with the current implementation. - - nsCOMPtr printContext = do_QueryInterface(aPresContext); - if (printContext) - suppressHandlers = PR_TRUE; - else - { - nsCOMPtr printPreviewContext = do_QueryInterface(aPresContext); - if (printPreviewContext) - suppressHandlers = PR_TRUE; - } - -#else - // In the current implementation, we only paginate when // printing or in print preview. suppressHandlers = aPresContext->IsPaginated(); - -#endif } return suppressHandlers;