Attempt to fix perf regression from bug 258513 by fixing users of obsolete nsIBoxToBlockAdaptor interface. Also, removing this interface like I intended to do. r=dbaron.

This commit is contained in:
bryner%brianryner.com 2004-09-29 00:28:13 +00:00
parent 293a8dae80
commit dc62f4d4e5
4 changed files with 17 additions and 72 deletions

View File

@ -1359,6 +1359,9 @@ NS_PTR_TO_INT32(frame->GetProperty(nsLayoutAtoms::embeddingLevel))
NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough)=0;
NS_IMETHOD MarkChildrenStyleChange()=0;
NS_IMETHOD MarkStyleChange(nsBoxLayoutState& aState)=0;
NS_IMETHOD SetIncludeOverflow(PRBool aInclude) = 0;
NS_IMETHOD GetOverflow(nsSize& aOverflow) = 0;
#ifdef DEBUG_LAYOUT
NS_IMETHOD SetDebug(nsBoxLayoutState& aState, PRBool aDebug)=0;
NS_IMETHOD GetDebug(PRBool& aDebug)=0;

View File

@ -1359,6 +1359,9 @@ NS_PTR_TO_INT32(frame->GetProperty(nsLayoutAtoms::embeddingLevel))
NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough)=0;
NS_IMETHOD MarkChildrenStyleChange()=0;
NS_IMETHOD MarkStyleChange(nsBoxLayoutState& aState)=0;
NS_IMETHOD SetIncludeOverflow(PRBool aInclude) = 0;
NS_IMETHOD GetOverflow(nsSize& aOverflow) = 0;
#ifdef DEBUG_LAYOUT
NS_IMETHOD SetDebug(nsBoxLayoutState& aState, PRBool aDebug)=0;
NS_IMETHOD GetDebug(PRBool& aDebug)=0;

View File

@ -1,61 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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.
*
* The Original Code is Mozilla Communicator client code.
*
* 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.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsIBoxToBlockAdaptor_h___
#define nsIBoxToBlockAdaptor_h___
#include "nsISupports.h"
class nsPresContext;
// {162F6B61-F926-11d3-BA06-001083023C1E}
#define NS_IBOX_TO_BLOCK_ADAPTOR_IID { 0x162f6b61, 0xf926, 0x11d3, { 0xba, 0x6, 0x0, 0x10, 0x83, 0x2, 0x3c, 0x1e } }
class nsIBoxToBlockAdaptor : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IBOX_TO_BLOCK_ADAPTOR_IID)
NS_IMETHOD Recycle(nsIPresShell* aPresShell)=0;
NS_IMETHOD SetIncludeOverflow(PRBool aInclude)=0;
NS_IMETHOD GetOverflow(nsSize& aOverflow)=0;
};
#endif

View File

@ -53,7 +53,6 @@
#include "nsScrollBoxFrame.h"
#include "nsLayoutAtoms.h"
#include "nsBoxLayoutState.h"
#include "nsIBoxToBlockAdaptor.h"
#include "nsIScrollbarMediator.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
@ -306,19 +305,20 @@ nsScrollBoxFrame::DoLayout(nsBoxLayoutState& aState)
nsPresContext* presContext = aState.PresContext();
PRBool isBoxWrapped = kid->IsBoxWrapped();
// see if our child is html. If it is then
// never include the overflow. The child will be the size
// given but its view will include the overflow size.
nsCOMPtr<nsIBoxToBlockAdaptor> adaptor = do_QueryInterface(kid);
if (adaptor)
adaptor->SetIncludeOverflow(PR_FALSE);
if (isBoxWrapped)
kid->SetIncludeOverflow(PR_FALSE);
PRInt32 flags = NS_FRAME_NO_MOVE_VIEW;
// do we have an adaptor? No then we can't use
// min size the child technically can get as small as it wants
// if the child is not a box, then we can't use
// min size. the child technically can get as small as it wants
// to.
if (!adaptor) {
if (!isBoxWrapped) {
nsSize min(0,0);
kid->GetMinSize(aState, min);
@ -328,7 +328,7 @@ nsScrollBoxFrame::DoLayout(nsBoxLayoutState& aState)
if (min.width > childRect.width)
childRect.width = min.width;
} else {
// don't size the view if we have an adaptor
// don't size the view if our child isn't a box
flags |= NS_FRAME_NO_SIZE_VIEW;
}
@ -341,9 +341,9 @@ nsScrollBoxFrame::DoLayout(nsBoxLayoutState& aState)
clientRect.Inflate(margin);
// now size the view to the size including our overflow.
if (adaptor) {
if (isBoxWrapped) {
nsSize overflow(0,0);
adaptor->GetOverflow(overflow);
kid->GetOverflow(overflow);
childRect.width = overflow.width;
childRect.height = overflow.height;
}
@ -367,7 +367,7 @@ nsScrollBoxFrame::DoLayout(nsBoxLayoutState& aState)
SyncLayout(aState);
if (adaptor) {
if (isBoxWrapped) {
nsRect r(0, 0, childRect.width, childRect.height);
nsContainerFrame::SyncFrameViewAfterReflow(presContext, kid,
kid->GetView(), &r, NS_FRAME_NO_MOVE_VIEW);