2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1998-10-13 21:31:26 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
1998-10-13 21:31:26 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1998-10-13 21:31:26 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:40:37 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-04-21 22:46:15 +00:00
|
|
|
|
|
|
|
#include "nsHTMLButtonControlFrame.h"
|
|
|
|
|
1999-02-12 17:45:58 +00:00
|
|
|
#include "nsCOMPtr.h"
|
1998-10-13 21:31:26 +00:00
|
|
|
#include "nsHTMLContainerFrame.h"
|
1999-01-22 15:32:57 +00:00
|
|
|
#include "nsFormControlHelper.h"
|
1998-10-13 21:31:26 +00:00
|
|
|
#include "nsIFormControlFrame.h"
|
|
|
|
#include "nsHTMLParts.h"
|
|
|
|
#include "nsIFormControl.h"
|
|
|
|
|
|
|
|
#include "nsIRenderingContext.h"
|
|
|
|
#include "nsIPresContext.h"
|
|
|
|
#include "nsIPresShell.h"
|
2003-02-22 00:32:13 +00:00
|
|
|
#include "nsStyleContext.h"
|
1998-10-13 21:31:26 +00:00
|
|
|
#include "nsLeafFrame.h"
|
|
|
|
#include "nsCSSRendering.h"
|
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsHTMLAtoms.h"
|
2002-11-17 15:37:56 +00:00
|
|
|
#include "nsCSSAnonBoxes.h"
|
1998-10-13 21:31:26 +00:00
|
|
|
#include "nsIImage.h"
|
|
|
|
#include "nsStyleConsts.h"
|
2002-03-27 00:13:57 +00:00
|
|
|
#include "nsIHTMLContent.h"
|
1998-10-13 21:31:26 +00:00
|
|
|
#include "nsIWidget.h"
|
1999-03-09 09:44:27 +00:00
|
|
|
#include "nsIComponentManager.h"
|
1998-10-13 21:31:26 +00:00
|
|
|
#include "nsIView.h"
|
|
|
|
#include "nsIViewManager.h"
|
|
|
|
#include "nsViewsCID.h"
|
1998-10-17 00:35:32 +00:00
|
|
|
#include "nsColor.h"
|
1999-01-22 23:10:02 +00:00
|
|
|
#include "nsIDocument.h"
|
1999-03-06 19:43:13 +00:00
|
|
|
#include "nsButtonFrameRenderer.h"
|
2000-01-08 15:53:48 +00:00
|
|
|
#include "nsFormControlFrame.h"
|
2000-09-12 19:41:27 +00:00
|
|
|
#include "nsIFrameManager.h"
|
2000-12-30 19:22:22 +00:00
|
|
|
#include "nsINameSpaceManager.h"
|
2002-06-04 00:44:04 +00:00
|
|
|
#include "nsReflowPath.h"
|
|
|
|
#include "nsIServiceManager.h"
|
2002-06-26 01:53:11 +00:00
|
|
|
#include "nsIDOMHTMLButtonElement.h"
|
|
|
|
#include "nsIDOMHTMLInputElement.h"
|
2001-08-17 03:13:07 +00:00
|
|
|
#ifdef ACCESSIBILITY
|
2001-05-11 21:11:38 +00:00
|
|
|
#include "nsIAccessibilityService.h"
|
2001-08-17 03:13:07 +00:00
|
|
|
#endif
|
1998-10-13 21:31:26 +00:00
|
|
|
|
2002-01-09 15:44:32 +00:00
|
|
|
#if 0
|
|
|
|
// see nsHTMLButtonControlFrame::Reflow()
|
1998-10-13 21:31:26 +00:00
|
|
|
static NS_DEFINE_IID(kViewCID, NS_VIEW_CID);
|
2002-01-09 15:44:32 +00:00
|
|
|
#endif
|
1998-10-13 21:31:26 +00:00
|
|
|
|
|
|
|
nsresult
|
1999-12-04 23:49:50 +00:00
|
|
|
NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
1998-10-13 21:31:26 +00:00
|
|
|
{
|
1999-05-11 22:03:29 +00:00
|
|
|
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
|
|
|
if (nsnull == aNewFrame) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
1999-12-04 23:49:50 +00:00
|
|
|
nsHTMLButtonControlFrame* it = new (aPresShell) nsHTMLButtonControlFrame;
|
1999-05-11 22:03:29 +00:00
|
|
|
if (!it) {
|
1998-10-13 21:31:26 +00:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
1999-05-11 22:03:29 +00:00
|
|
|
*aNewFrame = it;
|
1998-10-13 21:31:26 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-12-03 06:31:43 +00:00
|
|
|
nsHTMLButtonControlFrame::nsHTMLButtonControlFrame()
|
|
|
|
: nsHTMLContainerFrame()
|
1998-10-13 21:31:26 +00:00
|
|
|
{
|
|
|
|
mInline = PR_TRUE;
|
1998-10-14 23:01:44 +00:00
|
|
|
mPreviousCursor = eCursor_standard;
|
1998-10-17 00:35:32 +00:00
|
|
|
mTranslatedRect = nsRect(0,0,0,0);
|
1998-11-13 23:13:42 +00:00
|
|
|
mDidInit = PR_FALSE;
|
2000-01-08 15:53:48 +00:00
|
|
|
|
|
|
|
mCacheSize.width = -1;
|
|
|
|
mCacheSize.height = -1;
|
2003-01-09 14:26:32 +00:00
|
|
|
mCachedMaxElementWidth = -1;
|
1999-03-06 19:43:13 +00:00
|
|
|
}
|
|
|
|
|
1999-11-04 23:16:47 +00:00
|
|
|
nsHTMLButtonControlFrame::~nsHTMLButtonControlFrame()
|
|
|
|
{
|
2000-05-16 12:44:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLButtonControlFrame::Destroy(nsIPresContext *aPresContext)
|
|
|
|
{
|
|
|
|
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);
|
|
|
|
return nsHTMLContainerFrame::Destroy(aPresContext);
|
1999-11-04 23:16:47 +00:00
|
|
|
}
|
|
|
|
|
1999-03-06 19:43:13 +00:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsHTMLButtonControlFrame::Init(nsIPresContext* aPresContext,
|
1999-03-06 19:43:13 +00:00
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
2003-02-22 00:32:13 +00:00
|
|
|
nsStyleContext* aContext,
|
1999-03-06 19:43:13 +00:00
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
|
|
|
nsresult rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
|
|
|
mRenderer.SetFrame(this,aPresContext);
|
1999-11-12 01:45:53 +00:00
|
|
|
// cache our display type
|
|
|
|
const nsStyleDisplay* styleDisplay;
|
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) styleDisplay);
|
|
|
|
mInline = (NS_STYLE_DISPLAY_BLOCK != styleDisplay->mDisplay);
|
|
|
|
|
|
|
|
PRUint32 flags = NS_BLOCK_SPACE_MGR;
|
|
|
|
if (mInline) {
|
|
|
|
flags |= NS_BLOCK_SHRINK_WRAP;
|
|
|
|
}
|
1999-12-04 23:49:50 +00:00
|
|
|
|
|
|
|
nsCOMPtr<nsIPresShell> shell;
|
|
|
|
aPresContext->GetShell(getter_AddRefs(shell));
|
1999-11-12 01:45:53 +00:00
|
|
|
nsIFrame* areaFrame;
|
1999-12-04 23:49:50 +00:00
|
|
|
NS_NewAreaFrame(shell, &areaFrame, flags);
|
1999-11-12 01:45:53 +00:00
|
|
|
mFrames.SetFrames(areaFrame);
|
|
|
|
|
|
|
|
// Resolve style and initialize the frame
|
2003-02-22 00:32:13 +00:00
|
|
|
nsRefPtr<nsStyleContext> styleContext;
|
|
|
|
styleContext = aPresContext->ResolvePseudoStyleContextFor(mContent,
|
2002-11-17 15:37:56 +00:00
|
|
|
nsCSSAnonBoxes::buttonContent,
|
2003-02-22 00:32:13 +00:00
|
|
|
mStyleContext);
|
1999-11-12 01:45:53 +00:00
|
|
|
mFrames.FirstChild()->Init(aPresContext, mContent, this, styleContext, nsnull);
|
|
|
|
|
1999-03-06 19:43:13 +00:00
|
|
|
return rv;
|
1998-10-13 21:31:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsrefcnt nsHTMLButtonControlFrame::AddRef(void)
|
|
|
|
{
|
|
|
|
NS_WARNING("not supported");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsrefcnt nsHTMLButtonControlFrame::Release(void)
|
|
|
|
{
|
|
|
|
NS_WARNING("not supported");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
1999-11-02 01:50:15 +00:00
|
|
|
// Frames are not refcounted, no need to AddRef
|
|
|
|
NS_IMETHODIMP
|
1998-10-13 21:31:26 +00:00
|
|
|
nsHTMLButtonControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(0 != aInstancePtr, "null ptr");
|
|
|
|
if (NULL == aInstancePtr) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
2001-01-04 20:44:42 +00:00
|
|
|
if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) {
|
1998-10-13 21:31:26 +00:00
|
|
|
*aInstancePtr = (void*) ((nsIFormControlFrame*) this);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2001-05-11 21:11:38 +00:00
|
|
|
|
1998-10-13 21:31:26 +00:00
|
|
|
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
|
|
|
|
}
|
|
|
|
|
2001-08-17 03:13:07 +00:00
|
|
|
#ifdef ACCESSIBILITY
|
2001-05-17 23:52:32 +00:00
|
|
|
NS_IMETHODIMP nsHTMLButtonControlFrame::GetAccessible(nsIAccessible** aAccessible)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIAccessibilityService> accService = do_GetService("@mozilla.org/accessibilityService;1");
|
|
|
|
|
|
|
|
if (accService) {
|
2002-06-26 01:53:11 +00:00
|
|
|
nsCOMPtr<nsIContent> content;
|
|
|
|
GetContent(getter_AddRefs(content));
|
|
|
|
nsCOMPtr<nsIDOMHTMLButtonElement> buttonElement(do_QueryInterface(content));
|
|
|
|
if (buttonElement) //If turned XBL-base form control off, the frame contains HTML 4 button
|
|
|
|
return accService->CreateHTML4ButtonAccessible(NS_STATIC_CAST(nsIFrame*, this), aAccessible);
|
|
|
|
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(content));
|
|
|
|
if (inputElement) //If turned XBL-base form control on, the frame contains normal HTML button
|
|
|
|
return accService->CreateHTMLButtonAccessible(NS_STATIC_CAST(nsIFrame*, this), aAccessible);
|
2001-05-17 23:52:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
2001-08-17 03:13:07 +00:00
|
|
|
#endif
|
2001-05-17 23:52:32 +00:00
|
|
|
|
|
|
|
|
2002-12-18 23:38:09 +00:00
|
|
|
NS_IMETHODIMP_(PRInt32)
|
|
|
|
nsHTMLButtonControlFrame::GetType() const
|
1998-10-13 21:31:26 +00:00
|
|
|
{
|
2002-12-18 23:38:09 +00:00
|
|
|
return nsFormControlHelper::GetType(mContent);
|
1998-10-13 21:31:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2001-11-02 07:40:01 +00:00
|
|
|
nsHTMLButtonControlFrame::GetName(nsAString* aResult)
|
1998-10-13 21:31:26 +00:00
|
|
|
{
|
2002-08-06 23:50:08 +00:00
|
|
|
return nsFormControlHelper::GetName(mContent, aResult);
|
1998-10-13 21:31:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2001-11-02 07:40:01 +00:00
|
|
|
nsHTMLButtonControlFrame::GetValue(nsAString* aResult)
|
1998-10-13 21:31:26 +00:00
|
|
|
{
|
2002-08-06 23:50:08 +00:00
|
|
|
return nsFormControlHelper::GetValueAttr(mContent, aResult);
|
1998-10-13 21:31:26 +00:00
|
|
|
}
|
|
|
|
|
1999-09-13 20:40:59 +00:00
|
|
|
PRBool
|
|
|
|
nsHTMLButtonControlFrame::IsReset(PRInt32 type)
|
|
|
|
{
|
|
|
|
if (NS_FORM_BUTTON_RESET == type) {
|
|
|
|
return PR_TRUE;
|
|
|
|
} else {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
2001-09-19 13:00:23 +00:00
|
|
|
nsHTMLButtonControlFrame::IsSubmit(PRInt32 type)
|
1999-09-13 20:40:59 +00:00
|
|
|
{
|
2001-09-19 13:00:23 +00:00
|
|
|
if (NS_FORM_BUTTON_SUBMIT == type) {
|
1999-09-13 20:40:59 +00:00
|
|
|
return PR_TRUE;
|
|
|
|
} else {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-10-13 21:31:26 +00:00
|
|
|
void
|
|
|
|
nsHTMLButtonControlFrame::MouseClicked(nsIPresContext* aPresContext)
|
|
|
|
{
|
2002-02-08 23:50:51 +00:00
|
|
|
// This is no longer called; click events are handled in
|
|
|
|
// nsHTMLInputElement::HandleDOMEvent().
|
1998-10-13 21:31:26 +00:00
|
|
|
}
|
|
|
|
|
1998-10-22 23:00:37 +00:00
|
|
|
void
|
|
|
|
nsHTMLButtonControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
|
|
|
|
{
|
1998-10-17 00:35:32 +00:00
|
|
|
}
|
|
|
|
|
1999-08-21 00:09:24 +00:00
|
|
|
void
|
|
|
|
nsHTMLButtonControlFrame::ScrollIntoView(nsIPresContext* aPresContext)
|
|
|
|
{
|
|
|
|
if (aPresContext) {
|
|
|
|
nsCOMPtr<nsIPresShell> presShell;
|
|
|
|
aPresContext->GetShell(getter_AddRefs(presShell));
|
2000-09-08 05:53:28 +00:00
|
|
|
if (presShell) {
|
|
|
|
presShell->ScrollFrameIntoView(this,
|
2000-01-25 22:19:39 +00:00
|
|
|
NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE);
|
1999-08-21 00:09:24 +00:00
|
|
|
|
2000-09-08 05:53:28 +00:00
|
|
|
}
|
1999-08-21 00:09:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-10-17 00:35:32 +00:00
|
|
|
void
|
1999-10-26 04:44:41 +00:00
|
|
|
nsHTMLButtonControlFrame::GetTranslatedRect(nsIPresContext* aPresContext, nsRect& aRect)
|
1998-10-17 00:35:32 +00:00
|
|
|
{
|
|
|
|
nsIView* view;
|
|
|
|
nsPoint viewOffset(0,0);
|
1999-10-26 04:44:41 +00:00
|
|
|
GetOffsetFromView(aPresContext, viewOffset, &view);
|
1998-10-17 00:35:32 +00:00
|
|
|
while (nsnull != view) {
|
|
|
|
nsPoint tempOffset;
|
|
|
|
view->GetPosition(&tempOffset.x, &tempOffset.y);
|
|
|
|
viewOffset += tempOffset;
|
|
|
|
view->GetParent(view);
|
|
|
|
}
|
|
|
|
aRect = nsRect(viewOffset.x, viewOffset.y, mRect.width, mRect.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-03-06 19:43:13 +00:00
|
|
|
|
1998-11-18 05:25:26 +00:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsHTMLButtonControlFrame::HandleEvent(nsIPresContext* aPresContext,
|
1999-03-31 06:02:12 +00:00
|
|
|
nsGUIEvent* aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus)
|
1998-10-13 21:31:26 +00:00
|
|
|
{
|
1999-03-06 19:43:13 +00:00
|
|
|
// if disabled do nothing
|
|
|
|
if (mRenderer.isDisabled()) {
|
1998-10-17 00:35:32 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
1998-10-14 23:01:44 +00:00
|
|
|
|
2000-06-21 00:40:11 +00:00
|
|
|
// mouse clicks are handled by content
|
1999-05-13 01:35:16 +00:00
|
|
|
// we don't want our children to get any events. So just pass it to frame.
|
|
|
|
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
1998-10-13 21:31:26 +00:00
|
|
|
}
|
|
|
|
|
1998-10-14 23:01:44 +00:00
|
|
|
|
1998-11-18 05:25:26 +00:00
|
|
|
NS_IMETHODIMP
|
1999-10-26 04:44:41 +00:00
|
|
|
nsHTMLButtonControlFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|
|
|
const nsPoint& aPoint,
|
2000-03-22 02:43:08 +00:00
|
|
|
nsFramePaintLayer aWhichLayer,
|
1999-10-26 04:44:41 +00:00
|
|
|
nsIFrame** aFrame)
|
1998-11-18 05:25:26 +00:00
|
|
|
{
|
2002-04-06 15:31:53 +00:00
|
|
|
if (aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND &&
|
|
|
|
mRect.Contains(aPoint)) {
|
2001-05-31 22:19:43 +00:00
|
|
|
const nsStyleVisibility* vis =
|
|
|
|
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
|
|
|
|
|
|
|
|
if (vis->IsVisible()) {
|
2000-03-22 02:43:08 +00:00
|
|
|
*aFrame = this;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NS_ERROR_FAILURE;
|
1998-11-18 05:25:26 +00:00
|
|
|
}
|
|
|
|
|
1998-10-13 21:31:26 +00:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
1998-11-10 06:05:32 +00:00
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList)
|
1998-10-13 21:31:26 +00:00
|
|
|
{
|
2000-09-12 19:41:27 +00:00
|
|
|
// get the frame manager and the style context of the new parent frame
|
|
|
|
// this is used whent he children are reparented below
|
|
|
|
// NOTE: the whole reparenting should not need to happen: see bugzilla bug 51767
|
|
|
|
//
|
|
|
|
nsCOMPtr<nsIPresShell> shell;
|
|
|
|
nsCOMPtr<nsIFrameManager> frameManager;
|
2003-02-22 00:32:13 +00:00
|
|
|
nsStyleContext* newParentContext;
|
2000-09-12 19:41:27 +00:00
|
|
|
aPresContext->GetShell(getter_AddRefs(shell));
|
|
|
|
if (shell) {
|
|
|
|
shell->GetFrameManager(getter_AddRefs(frameManager));
|
|
|
|
}
|
|
|
|
// get the new parent context from the first child: that is the frame that the
|
|
|
|
// subsequent children will be made children of
|
2003-02-22 00:32:13 +00:00
|
|
|
newParentContext = mFrames.FirstChild()->GetStyleContext();
|
2000-09-12 19:41:27 +00:00
|
|
|
|
1999-01-14 05:16:23 +00:00
|
|
|
// Set the parent for each of the child frames
|
1999-02-10 06:13:38 +00:00
|
|
|
for (nsIFrame* frame = aChildList; nsnull != frame; frame->GetNextSibling(&frame)) {
|
1999-01-15 22:52:05 +00:00
|
|
|
frame->SetParent(mFrames.FirstChild());
|
2000-09-12 19:41:27 +00:00
|
|
|
// now reparent the contexts for the reparented frame too
|
|
|
|
if (frameManager) {
|
|
|
|
frameManager->ReParentStyleContext(aPresContext,frame,newParentContext);
|
|
|
|
}
|
1998-10-13 21:31:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Queue up the frames for the inline frame
|
1999-01-15 22:52:05 +00:00
|
|
|
return mFrames.FirstChild()->SetInitialChildList(aPresContext, nsnull, aChildList);
|
1998-10-13 21:31:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2001-09-19 12:35:19 +00:00
|
|
|
nsHTMLButtonControlFrame::Paint(nsIPresContext* aPresContext,
|
1998-10-13 21:31:26 +00:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
2001-09-19 12:35:19 +00:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
PRUint32 aFlags)
|
1998-10-13 21:31:26 +00:00
|
|
|
{
|
2001-01-27 14:09:34 +00:00
|
|
|
PRBool isVisible;
|
2002-04-06 15:31:53 +00:00
|
|
|
if (aWhichLayer != NS_FRAME_PAINT_LAYER_FOREGROUND ||
|
|
|
|
(NS_SUCCEEDED(IsVisibleForPainting(aPresContext, aRenderingContext, PR_TRUE, &isVisible)) && !isVisible)) {
|
2001-01-27 14:09:34 +00:00
|
|
|
return NS_OK;
|
1999-04-25 20:07:45 +00:00
|
|
|
}
|
1999-03-06 19:43:13 +00:00
|
|
|
|
2001-01-27 14:09:34 +00:00
|
|
|
nsRect rect(0, 0, mRect.width, mRect.height);
|
2002-04-06 15:31:53 +00:00
|
|
|
mRenderer.PaintButton(aPresContext, aRenderingContext, aDirtyRect, rect);
|
2001-01-27 14:09:34 +00:00
|
|
|
|
1999-11-03 00:05:30 +00:00
|
|
|
#if 0 // old way
|
2002-04-06 15:31:53 +00:00
|
|
|
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_BACKGROUND);
|
|
|
|
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FLOATERS);
|
|
|
|
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FOREGROUND);
|
1999-03-06 19:43:13 +00:00
|
|
|
|
1999-11-03 00:05:30 +00:00
|
|
|
#else // temporary
|
|
|
|
// XXX This is temporary
|
1999-12-02 22:07:43 +00:00
|
|
|
// clips to it's size minus the border
|
1999-11-03 00:05:30 +00:00
|
|
|
// but the real problem is the FirstChild (the AreaFrame)
|
|
|
|
// isn't being constrained properly
|
|
|
|
// Bug #17474
|
2001-02-07 09:57:26 +00:00
|
|
|
const nsStyleBorder* borderStyle;
|
|
|
|
GetStyleData(eStyleStruct_Border, (const nsStyleStruct *&)borderStyle);
|
1999-12-02 22:07:43 +00:00
|
|
|
nsMargin border;
|
|
|
|
border.SizeTo(0, 0, 0, 0);
|
2001-02-07 09:57:26 +00:00
|
|
|
borderStyle->CalcBorderFor(this, border);
|
1999-11-03 00:05:30 +00:00
|
|
|
|
1999-12-02 22:07:43 +00:00
|
|
|
rect.Deflate(border);
|
1999-11-03 00:05:30 +00:00
|
|
|
aRenderingContext.PushState();
|
|
|
|
PRBool clipEmpty;
|
|
|
|
|
1999-12-22 19:50:47 +00:00
|
|
|
aRenderingContext.SetClipRect(rect, nsClipCombine_kIntersect, clipEmpty);
|
1999-11-03 00:05:30 +00:00
|
|
|
|
2002-04-06 15:31:53 +00:00
|
|
|
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_BACKGROUND);
|
|
|
|
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FLOATERS);
|
|
|
|
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FOREGROUND);
|
1999-11-03 00:05:30 +00:00
|
|
|
|
|
|
|
aRenderingContext.PopState(clipEmpty);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2000-08-08 23:38:00 +00:00
|
|
|
// to draw border when selected in editor
|
|
|
|
return nsFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
1998-10-13 21:31:26 +00:00
|
|
|
}
|
|
|
|
|
1999-08-31 13:05:31 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLButtonControlFrame::AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aSuggestedReflowState)
|
|
|
|
{
|
|
|
|
aDesiredSize.width += aSuggestedReflowState.mComputedBorderPadding.left + aSuggestedReflowState.mComputedBorderPadding.right;
|
|
|
|
aDesiredSize.height += aSuggestedReflowState.mComputedBorderPadding.top + aSuggestedReflowState.mComputedBorderPadding.bottom;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-10-13 21:31:26 +00:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
1998-10-13 21:31:26 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
2000-04-21 21:51:35 +00:00
|
|
|
DO_GLOBAL_REFLOW_COUNT("nsHTMLButtonControlFrame", aReflowState.reason);
|
2001-11-14 13:40:03 +00:00
|
|
|
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
2000-04-21 21:51:35 +00:00
|
|
|
|
2002-06-04 00:44:04 +00:00
|
|
|
if (eReflowReason_Initial == aReflowState.reason) {
|
2000-02-09 19:34:39 +00:00
|
|
|
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
|
1999-09-13 20:40:59 +00:00
|
|
|
}
|
|
|
|
|
2000-02-09 19:34:39 +00:00
|
|
|
#if 0
|
2003-01-09 14:26:32 +00:00
|
|
|
nsresult skiprv = nsFormControlFrame::SkipResizeReflow(mCacheSize, mCachedMaxElementWidth, aPresContext,
|
2000-01-08 15:53:48 +00:00
|
|
|
aDesiredSize, aReflowState, aStatus);
|
|
|
|
if (NS_SUCCEEDED(skiprv)) {
|
|
|
|
return skiprv;
|
|
|
|
}
|
2000-02-09 19:34:39 +00:00
|
|
|
#endif
|
1999-03-06 19:43:13 +00:00
|
|
|
|
|
|
|
// commenting this out for now. We need a view to do mouse grabbing but
|
|
|
|
// it doesn't really seem to work correctly. When you press the only event
|
|
|
|
// you can get after that is a release. You need mouse enter and exit.
|
|
|
|
// the view also breaks the outline code. For some reason you can not reset
|
|
|
|
// the clip rect to draw outside you bounds if you have a view. And you need to
|
|
|
|
// because the outline must be drawn outside of our bounds according to CSS. -EDV
|
1999-11-19 15:33:29 +00:00
|
|
|
|
|
|
|
// XXX If you do decide you need a view, then create it in the Init() function
|
|
|
|
// and not here...
|
1999-03-06 19:43:13 +00:00
|
|
|
#if 0
|
1998-11-13 23:13:42 +00:00
|
|
|
if (!mDidInit) {
|
|
|
|
// create our view, we need a view to grab the mouse
|
|
|
|
nsIView* view;
|
1999-02-10 05:38:18 +00:00
|
|
|
GetView(&view);
|
1998-11-13 23:13:42 +00:00
|
|
|
if (!view) {
|
2001-01-04 20:44:42 +00:00
|
|
|
nsresult result = nsComponentManager::CreateInstance(kViewCID, nsnull, NS_GET_IID(nsIView), (void **)&view);
|
1999-02-12 17:45:58 +00:00
|
|
|
nsCOMPtr<nsIPresShell> presShell;
|
1999-11-24 06:03:41 +00:00
|
|
|
aPresContext->GetShell(getter_AddRefs(presShell));
|
1999-02-12 17:45:58 +00:00
|
|
|
nsCOMPtr<nsIViewManager> viewMan;
|
|
|
|
presShell->GetViewManager(getter_AddRefs(viewMan));
|
1998-11-13 23:13:42 +00:00
|
|
|
|
|
|
|
nsIFrame* parWithView;
|
|
|
|
nsIView *parView;
|
1999-02-10 05:38:18 +00:00
|
|
|
GetParentWithView(&parWithView);
|
|
|
|
parWithView->GetView(&parView);
|
1998-11-13 23:13:42 +00:00
|
|
|
// the view's size is not know yet, but its size will be kept in synch with our frame.
|
|
|
|
nsRect boundBox(0, 0, 500, 500);
|
|
|
|
result = view->Init(viewMan, boundBox, parView, nsnull);
|
|
|
|
viewMan->InsertChild(parView, view, 0);
|
|
|
|
SetView(view);
|
|
|
|
|
|
|
|
const nsStyleColor* color = (const nsStyleColor*) mStyleContext->GetStyleData(eStyleStruct_Color);
|
|
|
|
// set the opacity
|
|
|
|
viewMan->SetViewOpacity(view, color->mOpacity);
|
|
|
|
|
|
|
|
}
|
|
|
|
mDidInit = PR_TRUE;
|
|
|
|
}
|
1999-03-06 19:43:13 +00:00
|
|
|
#endif
|
1998-11-13 23:13:42 +00:00
|
|
|
|
1998-10-13 21:31:26 +00:00
|
|
|
// reflow the child
|
1999-01-15 22:52:05 +00:00
|
|
|
nsIFrame* firstKid = mFrames.FirstChild();
|
1999-07-23 00:11:21 +00:00
|
|
|
nsSize availSize(aReflowState.mComputedWidth, NS_INTRINSICSIZE);
|
1999-02-23 03:48:01 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
// indent the child inside us by the the focus border. We must do this separate from the
|
|
|
|
// regular border.
|
|
|
|
nsMargin focusPadding = mRenderer.GetAddedButtonBorderAndPadding();
|
1999-02-23 03:48:01 +00:00
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
|
1999-02-23 03:48:01 +00:00
|
|
|
if (NS_INTRINSICSIZE != availSize.width) {
|
1999-05-09 21:46:24 +00:00
|
|
|
availSize.width -= focusPadding.left + focusPadding.right;
|
1999-02-23 03:48:01 +00:00
|
|
|
availSize.width = PR_MAX(availSize.width,0);
|
|
|
|
}
|
|
|
|
if (NS_AUTOHEIGHT != availSize.height) {
|
1999-05-09 21:46:24 +00:00
|
|
|
availSize.height -= focusPadding.top + focusPadding.bottom;
|
1999-02-23 03:48:01 +00:00
|
|
|
availSize.height = PR_MAX(availSize.height,0);
|
|
|
|
}
|
1999-07-23 00:11:21 +00:00
|
|
|
|
1999-01-22 23:10:02 +00:00
|
|
|
// XXX Proper handling of incremental reflow...
|
2002-05-10 18:22:41 +00:00
|
|
|
nsReflowReason reason = aReflowState.reason;
|
|
|
|
if (eReflowReason_Incremental == reason) {
|
1999-01-22 23:10:02 +00:00
|
|
|
// See if it's targeted at us
|
2002-05-10 18:22:41 +00:00
|
|
|
nsHTMLReflowCommand *command = aReflowState.path->mReflowCommand;
|
|
|
|
if (command) {
|
1999-11-24 06:03:41 +00:00
|
|
|
Invalidate(aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
|
1999-07-23 00:11:21 +00:00
|
|
|
|
2001-12-17 22:39:59 +00:00
|
|
|
nsReflowType reflowType;
|
2002-05-10 18:22:41 +00:00
|
|
|
command->GetType(reflowType);
|
2001-12-17 22:39:59 +00:00
|
|
|
if (eReflowType_StyleChanged == reflowType) {
|
2002-05-10 18:22:41 +00:00
|
|
|
reason = eReflowReason_StyleChange;
|
1999-09-29 03:35:51 +00:00
|
|
|
}
|
|
|
|
else {
|
2002-05-10 18:22:41 +00:00
|
|
|
reason = eReflowReason_Resize;
|
1999-09-29 03:35:51 +00:00
|
|
|
}
|
1999-01-22 23:10:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-10 18:22:41 +00:00
|
|
|
nsHTMLReflowState reflowState(aPresContext, aReflowState, firstKid, availSize, reason);
|
|
|
|
//reflowState.computedWidth = availSize;
|
|
|
|
|
1999-11-19 15:33:29 +00:00
|
|
|
ReflowChild(firstKid, aPresContext, aDesiredSize, reflowState,
|
|
|
|
focusPadding.left + aReflowState.mComputedBorderPadding.left,
|
|
|
|
focusPadding.top + aReflowState.mComputedBorderPadding.top,
|
|
|
|
0, aStatus);
|
2002-11-12 19:17:51 +00:00
|
|
|
|
2000-12-20 15:12:06 +00:00
|
|
|
// calculate the min internal size so the contents gets centered correctly
|
2002-06-04 00:44:04 +00:00
|
|
|
// minInternalWidth is not being used at all and causes a warning--commenting
|
|
|
|
// out until someone wants it.
|
|
|
|
// nscoord minInternalWidth = aReflowState.mComputedMinWidth == 0?0:aReflowState.mComputedMinWidth -
|
|
|
|
// (aReflowState.mComputedBorderPadding.left + aReflowState.mComputedBorderPadding.right);
|
2000-12-20 15:12:06 +00:00
|
|
|
nscoord minInternalHeight = aReflowState.mComputedMinHeight == 0?0:aReflowState.mComputedMinHeight -
|
|
|
|
(aReflowState.mComputedBorderPadding.top + aReflowState.mComputedBorderPadding.bottom);
|
|
|
|
|
2000-01-18 20:29:22 +00:00
|
|
|
// center child vertically
|
|
|
|
nscoord yoff = 0;
|
|
|
|
if (aReflowState.mComputedHeight != NS_INTRINSICSIZE) {
|
|
|
|
yoff = (aReflowState.mComputedHeight - aDesiredSize.height)/2;
|
2000-12-20 15:12:06 +00:00
|
|
|
if (yoff < 0) {
|
|
|
|
yoff = 0;
|
|
|
|
}
|
|
|
|
} else if (aDesiredSize.height < minInternalHeight) {
|
|
|
|
yoff = (minInternalHeight - aDesiredSize.height) / 2;
|
2000-01-18 20:29:22 +00:00
|
|
|
}
|
|
|
|
|
2002-11-16 19:32:49 +00:00
|
|
|
// Place the child. If we have a non-intrinsic width, we want to
|
|
|
|
// reduce the left padding as needed to try and fit the text in the
|
|
|
|
// button
|
|
|
|
nscoord xoffset = focusPadding.left + aReflowState.mComputedBorderPadding.left;
|
|
|
|
if (aReflowState.mComputedWidth != NS_INTRINSICSIZE) {
|
|
|
|
// First, how much did we "overflow"? This is the width of our
|
|
|
|
// kid plus our special focus stuff (which did not get accounted
|
|
|
|
// for in calculating aReflowState.mComputedWidth minus the width
|
|
|
|
// we're forced to be.
|
|
|
|
nscoord extrawidth =
|
|
|
|
aDesiredSize.width + focusPadding.left + focusPadding.right
|
|
|
|
- aReflowState.mComputedWidth;
|
|
|
|
if (extrawidth > 0) {
|
|
|
|
// Split it evenly between right and left
|
|
|
|
extrawidth /= 2;
|
|
|
|
// But do not shoot out the left side of the button, please
|
|
|
|
extrawidth = PR_MIN(extrawidth, aReflowState.mComputedPadding.left);
|
|
|
|
xoffset -= extrawidth;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-10-13 21:31:26 +00:00
|
|
|
// Place the child
|
2001-12-07 14:51:12 +00:00
|
|
|
FinishReflowChild(firstKid, aPresContext, &reflowState, aDesiredSize,
|
2002-11-16 19:32:49 +00:00
|
|
|
xoffset,
|
2000-01-18 20:29:22 +00:00
|
|
|
yoff + focusPadding.top + aReflowState.mComputedBorderPadding.top, 0);
|
1998-10-13 21:31:26 +00:00
|
|
|
|
1999-11-03 00:05:30 +00:00
|
|
|
// if computed use the computed values.
|
|
|
|
if (aReflowState.mComputedWidth != NS_INTRINSICSIZE)
|
|
|
|
aDesiredSize.width = aReflowState.mComputedWidth;
|
|
|
|
else
|
|
|
|
aDesiredSize.width += focusPadding.left + focusPadding.right;
|
|
|
|
|
|
|
|
if (aReflowState.mComputedHeight != NS_INTRINSICSIZE)
|
|
|
|
aDesiredSize.height = aReflowState.mComputedHeight;
|
|
|
|
else
|
|
|
|
aDesiredSize.height += focusPadding.top + focusPadding.bottom;
|
|
|
|
|
1999-08-31 13:05:31 +00:00
|
|
|
AddComputedBorderPaddingToDesiredSize(aDesiredSize, aReflowState);
|
2002-11-12 19:17:51 +00:00
|
|
|
|
1999-08-31 13:05:31 +00:00
|
|
|
//aDesiredSize.width += aReflowState.mComputedBorderPadding.left + aReflowState.mComputedBorderPadding.right;
|
|
|
|
//aDesiredSize.height += aReflowState.mComputedBorderPadding.top + aReflowState.mComputedBorderPadding.bottom;
|
1998-10-13 21:31:26 +00:00
|
|
|
|
2003-01-09 14:26:32 +00:00
|
|
|
if (aDesiredSize.mComputeMEW) {
|
|
|
|
aDesiredSize.mMaxElementWidth = aDesiredSize.width;
|
2000-04-30 13:27:49 +00:00
|
|
|
}
|
1999-07-23 00:11:21 +00:00
|
|
|
|
2000-12-20 15:12:06 +00:00
|
|
|
// Make sure we obey min/max-width and min/max-height
|
|
|
|
if (aDesiredSize.width > aReflowState.mComputedMaxWidth) {
|
|
|
|
aDesiredSize.width = aReflowState.mComputedMaxWidth;
|
|
|
|
}
|
|
|
|
if (aDesiredSize.width < aReflowState.mComputedMinWidth) {
|
|
|
|
aDesiredSize.width = aReflowState.mComputedMinWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aDesiredSize.height > aReflowState.mComputedMaxHeight) {
|
|
|
|
aDesiredSize.height = aReflowState.mComputedMaxHeight;
|
|
|
|
}
|
|
|
|
if (aDesiredSize.height < aReflowState.mComputedMinHeight) {
|
|
|
|
aDesiredSize.height = aReflowState.mComputedMinHeight;
|
2002-11-12 19:17:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
aDesiredSize.ascent += aReflowState.mComputedBorderPadding.top + focusPadding.top;
|
|
|
|
aDesiredSize.descent = aDesiredSize.height - aDesiredSize.ascent;
|
|
|
|
|
1998-10-13 21:31:26 +00:00
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
2000-01-08 15:53:48 +00:00
|
|
|
|
2002-11-12 19:17:51 +00:00
|
|
|
nsFormControlFrame::SetupCachedSizes(mCacheSize, mCachedAscent,
|
2003-01-09 14:26:32 +00:00
|
|
|
mCachedMaxElementWidth, aDesiredSize);
|
2002-05-28 22:50:43 +00:00
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
1998-10-13 21:31:26 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2002-11-19 03:39:44 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLButtonControlFrame::IsPercentageBase(PRBool& aBase) const
|
|
|
|
{
|
|
|
|
aBase = PR_TRUE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-10-13 21:31:26 +00:00
|
|
|
PRIntn
|
|
|
|
nsHTMLButtonControlFrame::GetSkipSides() const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1999-01-22 15:32:57 +00:00
|
|
|
NS_IMETHODIMP
|
2000-02-09 19:34:39 +00:00
|
|
|
nsHTMLButtonControlFrame::GetFont(nsIPresContext* aPresContext,
|
|
|
|
const nsFont*& aFont)
|
1999-01-22 15:32:57 +00:00
|
|
|
{
|
2000-02-09 19:34:39 +00:00
|
|
|
return nsFormControlHelper::GetFont(this, aPresContext, mStyleContext, aFont);
|
1999-01-22 15:32:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLButtonControlFrame::GetFormContent(nsIContent*& aContent) const
|
|
|
|
{
|
1999-02-10 00:42:56 +00:00
|
|
|
nsIContent* content;
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
rv = GetContent(&content);
|
|
|
|
aContent = content;
|
|
|
|
return rv;
|
1999-01-22 15:32:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nscoord
|
1999-11-24 06:03:41 +00:00
|
|
|
nsHTMLButtonControlFrame::GetVerticalInsidePadding(nsIPresContext* aPresContext,
|
1999-09-30 11:30:04 +00:00
|
|
|
float aPixToTwip,
|
|
|
|
nscoord aInnerHeight) const
|
1999-01-22 15:32:57 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
nscoord
|
1999-11-24 06:03:41 +00:00
|
|
|
nsHTMLButtonControlFrame::GetHorizontalInsidePadding(nsIPresContext* aPresContext,
|
1999-01-22 15:32:57 +00:00
|
|
|
float aPixToTwip,
|
|
|
|
nscoord aInnerWidth,
|
|
|
|
nscoord aCharWidth) const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1999-03-06 19:43:13 +00:00
|
|
|
nsresult nsHTMLButtonControlFrame::RequiresWidget(PRBool& aRequiresWidget)
|
|
|
|
{
|
|
|
|
aRequiresWidget = PR_FALSE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-10-26 04:44:41 +00:00
|
|
|
NS_IMETHODIMP nsHTMLButtonControlFrame::SetProperty(nsIPresContext* aPresContext,
|
2002-03-23 22:26:36 +00:00
|
|
|
nsIAtom* aName, const nsAString& aValue)
|
1999-01-25 22:16:27 +00:00
|
|
|
{
|
2001-02-06 01:31:18 +00:00
|
|
|
if (nsHTMLAtoms::value == aName) {
|
|
|
|
nsCOMPtr<nsIHTMLContent> formControl(do_QueryInterface(mContent));
|
|
|
|
if (formControl) {
|
2001-08-17 08:14:14 +00:00
|
|
|
return formControl->SetAttr(kNameSpaceID_None, nsHTMLAtoms::value, aValue, PR_TRUE);
|
2001-02-06 01:31:18 +00:00
|
|
|
}
|
|
|
|
}
|
1999-01-25 22:16:27 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2002-03-23 22:26:36 +00:00
|
|
|
NS_IMETHODIMP nsHTMLButtonControlFrame::GetProperty(nsIAtom* aName, nsAString& aValue)
|
1999-01-25 22:16:27 +00:00
|
|
|
{
|
2001-02-06 01:31:18 +00:00
|
|
|
if (nsHTMLAtoms::value == aName) {
|
|
|
|
nsCOMPtr<nsIHTMLContent> formControl(do_QueryInterface(mContent));
|
|
|
|
if (formControl) {
|
2001-08-17 08:14:14 +00:00
|
|
|
formControl->GetAttr(kNameSpaceID_None, nsHTMLAtoms::value, aValue);
|
2001-02-06 01:31:18 +00:00
|
|
|
}
|
|
|
|
}
|
1999-01-25 22:16:27 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2003-02-22 00:32:13 +00:00
|
|
|
nsStyleContext*
|
|
|
|
nsHTMLButtonControlFrame::GetAdditionalStyleContext(PRInt32 aIndex) const
|
1999-09-03 23:36:32 +00:00
|
|
|
{
|
2003-02-22 00:32:13 +00:00
|
|
|
return mRenderer.GetStyleContext(aIndex);
|
1999-09-03 23:36:32 +00:00
|
|
|
}
|
|
|
|
|
2003-02-22 00:32:13 +00:00
|
|
|
void
|
1999-09-03 23:36:32 +00:00
|
|
|
nsHTMLButtonControlFrame::SetAdditionalStyleContext(PRInt32 aIndex,
|
2003-02-22 00:32:13 +00:00
|
|
|
nsStyleContext* aStyleContext)
|
1999-09-03 23:36:32 +00:00
|
|
|
{
|
2003-02-22 00:32:13 +00:00
|
|
|
mRenderer.SetStyleContext(aIndex, aStyleContext);
|
1999-09-03 23:36:32 +00:00
|
|
|
}
|
|
|
|
|
1999-03-06 19:43:13 +00:00
|
|
|
|
fixed bugs #6303, #6753, #6756, #6759
Re-wrote nsComboboxFrame.
removed the obsolete nsHTMLAtoms: comboText,comoTextSelected,comTextSelectedFocus,dropDownVisible,
dropdownHidden, dropDownBtnOut, dropDownBtnPressed,
Added nsHTMLAtoms::combobox, nsLayoutAtoms::popupList
Renamed dropDownList to dropDownListPseudo
Added "arrow.gif" as to be used the background-image for the combobox button
ua.css - added rules for select to differentiate between comboboxes and listboxes.
Added style rules to more closely match the XPTOOLKIT XPWidgets look.
removed the following :-moz-combobox-text, -moz-combobox-textselected
nsIFormControlFrame.h - Added SetSuggestedSize method.
nsButtonControlFrame - Implemented SetSuggestedSize.
nsCSSFrameConstructor.cpp - Rewrote ConstructSelectFrame.
nsIWidget.h -Added GetAbsoluteBounds method.
nsWindow.cpp - Implemented GetAbsoluteBounds.
1999-07-14 22:00:24 +00:00
|
|
|
NS_IMETHODIMP nsHTMLButtonControlFrame::SetSuggestedSize(nscoord aWidth, nscoord aHeight)
|
|
|
|
{
|
|
|
|
// mSuggestedWidth = aWidth;
|
|
|
|
// mSuggestedHeight = aHeight;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-03-06 19:43:13 +00:00
|
|
|
|
1999-01-25 22:16:27 +00:00
|
|
|
|
2000-08-02 22:16:12 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLButtonControlFrame::AppendFrames(nsIPresContext* aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
|
|
|
return mFrames.FirstChild()->AppendFrames(aPresContext,
|
|
|
|
aPresShell,
|
|
|
|
aListName,
|
|
|
|
aFrameList);
|
|
|
|
}
|
1998-10-13 21:31:26 +00:00
|
|
|
|
2001-11-02 07:40:01 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLButtonControlFrame::OnContentReset()
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|