зеркало из https://github.com/mozilla/pjs.git
Fixes for bugs 24969 and 27109.
This commit is contained in:
Родитель
0fe65de726
Коммит
6db260e802
|
@ -46,11 +46,11 @@ XUL_ATOM(slider, "slider")
|
|||
XUL_ATOM(colorpicker, "colorpicker")
|
||||
XUL_ATOM(palettename, "palettename")
|
||||
XUL_ATOM(fontpicker, "fontpicker")
|
||||
XUL_ATOM(radio, "radio")
|
||||
XUL_ATOM(text, "text")
|
||||
XUL_ATOM(toolbar, "toolbar")
|
||||
XUL_ATOM(toolbaritem, "toolbaritem")
|
||||
XUL_ATOM(toolbox, "toolbox")
|
||||
XUL_ATOM(image, "image")
|
||||
|
||||
// The tree atoms
|
||||
XUL_ATOM(tree, "tree") // The start of a tree view
|
||||
|
|
|
@ -2033,6 +2033,7 @@ nsCSSFrameConstructor::TableIsValidCellContent(nsIPresContext* aPresContext,
|
|||
#ifdef INCLUDE_XUL
|
||||
if ( (nsXULAtoms::button == tag.get()) ||
|
||||
(nsXULAtoms::titledbutton == tag.get()) ||
|
||||
(nsXULAtoms::image == tag.get()) ||
|
||||
(nsXULAtoms::grippy == tag.get()) ||
|
||||
(nsXULAtoms::splitter == tag.get()) ||
|
||||
(nsXULAtoms::slider == tag.get()) ||
|
||||
|
@ -2042,7 +2043,6 @@ nsCSSFrameConstructor::TableIsValidCellContent(nsIPresContext* aPresContext,
|
|||
(nsXULAtoms::thumb == tag.get()) ||
|
||||
(nsXULAtoms::colorpicker == tag.get()) ||
|
||||
(nsXULAtoms::fontpicker == tag.get()) ||
|
||||
(nsXULAtoms::radio == tag.get()) ||
|
||||
(nsXULAtoms::text == tag.get()) ||
|
||||
(nsXULAtoms::widget == tag.get()) ||
|
||||
(nsXULAtoms::tree == tag.get()) ||
|
||||
|
@ -4293,7 +4293,9 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
} // End of BOX CONSTRUCTION logic
|
||||
|
||||
// TITLED BUTTON CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::titledbutton) {
|
||||
else if (aTag == nsXULAtoms::titledbutton ||
|
||||
aTag == nsXULAtoms::image ||
|
||||
aTag == nsXULAtoms::text) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewTitledButtonFrame(aPresShell, &newFrame);
|
||||
|
|
|
@ -2033,6 +2033,7 @@ nsCSSFrameConstructor::TableIsValidCellContent(nsIPresContext* aPresContext,
|
|||
#ifdef INCLUDE_XUL
|
||||
if ( (nsXULAtoms::button == tag.get()) ||
|
||||
(nsXULAtoms::titledbutton == tag.get()) ||
|
||||
(nsXULAtoms::image == tag.get()) ||
|
||||
(nsXULAtoms::grippy == tag.get()) ||
|
||||
(nsXULAtoms::splitter == tag.get()) ||
|
||||
(nsXULAtoms::slider == tag.get()) ||
|
||||
|
@ -2042,7 +2043,6 @@ nsCSSFrameConstructor::TableIsValidCellContent(nsIPresContext* aPresContext,
|
|||
(nsXULAtoms::thumb == tag.get()) ||
|
||||
(nsXULAtoms::colorpicker == tag.get()) ||
|
||||
(nsXULAtoms::fontpicker == tag.get()) ||
|
||||
(nsXULAtoms::radio == tag.get()) ||
|
||||
(nsXULAtoms::text == tag.get()) ||
|
||||
(nsXULAtoms::widget == tag.get()) ||
|
||||
(nsXULAtoms::tree == tag.get()) ||
|
||||
|
@ -4293,7 +4293,9 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
} // End of BOX CONSTRUCTION logic
|
||||
|
||||
// TITLED BUTTON CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::titledbutton) {
|
||||
else if (aTag == nsXULAtoms::titledbutton ||
|
||||
aTag == nsXULAtoms::image ||
|
||||
aTag == nsXULAtoms::text) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewTitledButtonFrame(aPresShell, &newFrame);
|
||||
|
|
|
@ -29,6 +29,7 @@ include $(DEPTH)/config/autoconf.mk
|
|||
MODULE = layout
|
||||
|
||||
EXPORTS = \
|
||||
nsIMenuFrame.h \
|
||||
nsIPopupSetFrame.h \
|
||||
nsITreeFrame.h \
|
||||
$(NULL)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
nsIMenuFrame.h
|
||||
nsIPopupSetFrame.h
|
||||
nsITreeFrame.h
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
DEPTH=..\..\..\..
|
||||
|
||||
EXPORTS = \
|
||||
nsIMenuFrame.h \
|
||||
nsIPopupSetFrame.h \
|
||||
nsITreeFrame.h \
|
||||
$(NULL)
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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/
|
||||
*
|
||||
* 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 Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIMenuFrame_h___
|
||||
#define nsIMenuFrame_h___
|
||||
|
||||
// {6A4CDE51-6C05-11d3-BB50-00104B7B7DEB}
|
||||
#define NS_IMENUFRAME_IID \
|
||||
{ 0x6a4cde51, 0x6c05, 0x11d3, { 0xbb, 0x50, 0x0, 0x10, 0x4b, 0x7b, 0x7d, 0xeb } }
|
||||
|
||||
class nsIMenuParent;
|
||||
|
||||
enum nsMenuType {
|
||||
eMenuType_Normal = 0,
|
||||
eMenuType_Checkbox = 1,
|
||||
eMenuType_Radio = 2
|
||||
};
|
||||
|
||||
class nsIMenuFrame : public nsISupports {
|
||||
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IMENUFRAME_IID; return iid; }
|
||||
|
||||
NS_IMETHOD ActivateMenu(PRBool aFlag) = 0;
|
||||
NS_IMETHOD SelectMenu(PRBool aFlag) = 0;
|
||||
NS_IMETHOD OpenMenu(PRBool aFlag) = 0;
|
||||
|
||||
NS_IMETHOD MenuIsOpen(PRBool& aResult) = 0;
|
||||
NS_IMETHOD MenuIsContainer(PRBool& aResult) = 0;
|
||||
NS_IMETHOD MenuIsChecked(PRBool& aResult) = 0;
|
||||
|
||||
NS_IMETHOD SelectFirstItem() = 0;
|
||||
|
||||
NS_IMETHOD Escape(PRBool& aHandledFlag) = 0;
|
||||
NS_IMETHOD Enter() = 0;
|
||||
NS_IMETHOD ShortcutNavigation(PRUint32 aLetter, PRBool& aHandledFlag) = 0;
|
||||
NS_IMETHOD KeyboardNavigation(PRUint32 aDirection, PRBool& aHandledFlag) = 0;
|
||||
|
||||
NS_IMETHOD GetMenuParent(nsIMenuParent** aMenuParent) = 0;
|
||||
NS_IMETHOD GetRadioGroupName(nsString &aName) = 0;
|
||||
NS_IMETHOD GetMenuType(nsMenuType &aType) = 0;
|
||||
|
||||
NS_IMETHOD MarkAsGenerated() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -180,25 +180,12 @@ nsMenuBarListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
nsresult
|
||||
nsMenuBarListener::MouseUp(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if (!mMenuBarFrame->IsOpen() && mMenuBarFrame->IsActive()) {
|
||||
mMenuBarFrame->ToggleMenuActiveState();
|
||||
PRBool handled;
|
||||
mMenuBarFrame->Escape(handled);
|
||||
mAltKeyDown = PR_FALSE;
|
||||
}
|
||||
return NS_OK; // means I am NOT consuming event
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMenuBarListener::MouseClick(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if (!mMenuBarFrame->IsOpen() && mMenuBarFrame->IsActive()) {
|
||||
mMenuBarFrame->ToggleMenuActiveState();
|
||||
PRBool handled;
|
||||
mMenuBarFrame->Escape(handled);
|
||||
mAltKeyDown = PR_FALSE;
|
||||
}
|
||||
|
||||
return NS_OK; // means I am NOT consuming event
|
||||
}
|
||||
|
||||
|
|
|
@ -324,22 +324,6 @@ nsToolbarFrame :: HandleEvent ( nsIPresContext* aPresContext,
|
|||
if ( !aEvent )
|
||||
return nsEventStatus_eIgnore;
|
||||
|
||||
switch (aEvent->message) {
|
||||
|
||||
case NS_MOUSE_ACTIVATE:
|
||||
// Does the toolbar accept activation/focus? Check style
|
||||
nsCOMPtr<nsIStyleContext> context;
|
||||
GetStyleContext(getter_AddRefs(context));
|
||||
|
||||
const nsStyleUserInterface* styleStruct = (const nsStyleUserInterface*)context->GetStyleData(eStyleStruct_UserInterface);
|
||||
if (NS_STYLE_USER_FOCUS_IGNORE == styleStruct->mUserFocus) {
|
||||
// we want to surpress the blur and the following focus
|
||||
if(aEvent->eventStructType == NS_MOUSE_EVENT)
|
||||
((nsMouseEvent*)aEvent)->acceptActivation = PR_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//XXX this needs to change when I am really handling the D&D events
|
||||
return nsBoxFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
||||
|
|
|
@ -51,6 +51,9 @@
|
|||
#include "nsIViewManager.h"
|
||||
#include "nsIView.h"
|
||||
|
||||
// XXX This should probably be based off the height of a row in pixels
|
||||
#define SCROLL_FACTOR 16
|
||||
|
||||
// I added the following function to improve keeping the frame
|
||||
// chains in synch with the table. repackage as appropriate - karnaze
|
||||
void GetRowStartAndCount(nsIFrame* aFrame,
|
||||
|
@ -689,17 +692,21 @@ nsTreeRowGroupFrame::ComputeTotalRowCount(PRInt32& aCount, nsIContent* aParent)
|
|||
NS_IMETHODIMP
|
||||
nsTreeRowGroupFrame::PositionChanged(nsIPresContext* aPresContext, PRInt32 aOldIndex, PRInt32 aNewIndex)
|
||||
{
|
||||
PRInt32 oldIndex, newIndex;
|
||||
oldIndex = aOldIndex / SCROLL_FACTOR;
|
||||
newIndex = aNewIndex / SCROLL_FACTOR;
|
||||
|
||||
#ifdef DEBUG_tree
|
||||
printf("PositionChanged from %d to %d (mCurrentIndex is %d)\n",
|
||||
aOldIndex, aNewIndex, mCurrentIndex);
|
||||
oldIndex, newIndex, mCurrentIndex);
|
||||
#endif
|
||||
if (aNewIndex < 0)
|
||||
if (newIndex < 0)
|
||||
return NS_OK;
|
||||
|
||||
if (aOldIndex == aNewIndex)
|
||||
if (oldIndex == newIndex)
|
||||
return NS_OK;
|
||||
|
||||
mCurrentIndex = aNewIndex;
|
||||
mCurrentIndex = newIndex;
|
||||
|
||||
// Get our row count.
|
||||
PRInt32 rowCount;
|
||||
|
@ -710,7 +717,7 @@ nsTreeRowGroupFrame::PositionChanged(nsIPresContext* aPresContext, PRInt32 aOldI
|
|||
nsTableFrame::GetTableFrame(this, tableFrame);
|
||||
|
||||
// Figure out how many rows we need to lose (if we moved down) or gain (if we moved up).
|
||||
PRInt32 delta = aNewIndex > aOldIndex ? aNewIndex - aOldIndex : aOldIndex - aNewIndex;
|
||||
PRInt32 delta = newIndex > oldIndex ? newIndex - oldIndex : oldIndex - newIndex;
|
||||
|
||||
#ifdef DEBUG_tree
|
||||
printf("Scrolling, the delta is: %d\n", delta);
|
||||
|
@ -732,7 +739,7 @@ nsTreeRowGroupFrame::PositionChanged(nsIPresContext* aPresContext, PRInt32 aOldI
|
|||
PRInt32 loseRows = delta;
|
||||
|
||||
// scrolling down
|
||||
if (aNewIndex > aOldIndex) {
|
||||
if (newIndex > oldIndex) {
|
||||
// Figure out how many rows we have to lose off the top.
|
||||
DestroyRows(tableFrame, aPresContext, loseRows);
|
||||
}
|
||||
|
@ -775,7 +782,7 @@ nsTreeRowGroupFrame::PositionChanged(nsIPresContext* aPresContext, PRInt32 aOldI
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIContent> topRowContent;
|
||||
FindRowContentAtIndex(aNewIndex, mContent, getter_AddRefs(topRowContent));
|
||||
FindRowContentAtIndex(newIndex, mContent, getter_AddRefs(topRowContent));
|
||||
|
||||
if (topRowContent)
|
||||
ConstructContentChain(topRowContent);
|
||||
|
@ -801,6 +808,7 @@ nsTreeRowGroupFrame::PagedUpDown()
|
|||
mScrollbar->GetContent(getter_AddRefs(scrollbarContent));
|
||||
|
||||
rowGroupCount--;
|
||||
rowGroupCount *= SCROLL_FACTOR;
|
||||
char ch[100];
|
||||
sprintf(ch,"%d", rowGroupCount);
|
||||
|
||||
|
@ -825,8 +833,11 @@ nsTreeRowGroupFrame::SetScrollbarFrame(nsIPresContext* aPresContext, nsIFrame* a
|
|||
nsCOMPtr<nsIContent> scrollbarContent;
|
||||
aFrame->GetContent(getter_AddRefs(scrollbarContent));
|
||||
|
||||
nsAutoString scrollFactor;
|
||||
scrollFactor.Append(SCROLL_FACTOR);
|
||||
|
||||
scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, "0", PR_FALSE);
|
||||
scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::increment, "1", PR_FALSE);
|
||||
scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::increment, scrollFactor, PR_FALSE);
|
||||
scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::pageincrement, "1", PR_FALSE);
|
||||
scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::maxpos, "5000", PR_FALSE);
|
||||
|
||||
|
@ -1492,7 +1503,8 @@ void nsTreeRowGroupFrame::OnContentRemoved(nsIPresContext* aPresContext,
|
|||
if (mScrollbar) {
|
||||
mCurrentIndex--;
|
||||
nsAutoString indexStr;
|
||||
indexStr.Append(mCurrentIndex);
|
||||
PRInt32 pixelIndex = mCurrentIndex * SCROLL_FACTOR;
|
||||
indexStr.Append(pixelIndex);
|
||||
|
||||
nsCOMPtr<nsIContent> scrollbarContent;
|
||||
mScrollbar->GetContent(getter_AddRefs(scrollbarContent));
|
||||
|
@ -1619,6 +1631,7 @@ nsTreeRowGroupFrame::ReflowScrollbar(nsIPresContext* aPresContext)
|
|||
|
||||
rowCount -= (pageRowCount-2);
|
||||
|
||||
rowCount *= SCROLL_FACTOR;
|
||||
char ch[100];
|
||||
sprintf(ch,"%d", rowCount);
|
||||
maxpos = ch;
|
||||
|
@ -1831,6 +1844,7 @@ nsTreeRowGroupFrame::EnsureRowIsVisible(PRInt32 aRowIndex)
|
|||
value="";
|
||||
#endif
|
||||
|
||||
scrollTo *= SCROLL_FACTOR;
|
||||
value.Append(scrollTo);
|
||||
scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos,
|
||||
value, PR_TRUE);
|
||||
|
@ -1888,6 +1902,8 @@ void nsTreeRowGroupFrame::ScrollByLines(nsIPresContext* aPresContext,
|
|||
nsAutoString value;
|
||||
value.Append(scrollTo);
|
||||
|
||||
scrollTo *= SCROLL_FACTOR;
|
||||
|
||||
nsCOMPtr<nsIContent> scrollbarContent;
|
||||
mScrollbar->GetContent(getter_AddRefs(scrollbarContent));
|
||||
if (scrollbarContent)
|
||||
|
|
|
@ -46,11 +46,11 @@ XUL_ATOM(slider, "slider")
|
|||
XUL_ATOM(colorpicker, "colorpicker")
|
||||
XUL_ATOM(palettename, "palettename")
|
||||
XUL_ATOM(fontpicker, "fontpicker")
|
||||
XUL_ATOM(radio, "radio")
|
||||
XUL_ATOM(text, "text")
|
||||
XUL_ATOM(toolbar, "toolbar")
|
||||
XUL_ATOM(toolbaritem, "toolbaritem")
|
||||
XUL_ATOM(toolbox, "toolbox")
|
||||
XUL_ATOM(image, "image")
|
||||
|
||||
// The tree atoms
|
||||
XUL_ATOM(tree, "tree") // The start of a tree view
|
||||
|
|
Загрузка…
Ссылка в новой задаче