Compare commits
7 Commits
Bugzilla_P
...
LAYOUT_SPL
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53bca04ec1 | ||
|
|
5839ecbb96 | ||
|
|
110cc954ef | ||
|
|
196f8f8337 | ||
|
|
10b288b51c | ||
|
|
a9e77a3600 | ||
|
|
a8118bd57f |
33
mozilla/content/base/public/nsCopySupport.h
Normal file
33
mozilla/content/base/public/nsCopySupport.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/* -*- 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.org 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsISelection;
|
||||
class nsIDocument;
|
||||
|
||||
class nsCopySupport
|
||||
{
|
||||
// class of static helper functions for copy support
|
||||
public:
|
||||
static nsresult HTMLCopy(nsISelection *aSel, nsIDocument *aDoc, PRInt16 aClipboardID);
|
||||
};
|
||||
154
mozilla/content/base/src/nsCopySupport.cpp
Normal file
154
mozilla/content/base/src/nsCopySupport.cpp
Normal file
@@ -0,0 +1,154 @@
|
||||
/* -*- 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.org 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nsCopySupport.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIClipboard.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIDOMNSHTMLInputElement.h"
|
||||
#include "nsIDOMNSHTMLTextAreaElement.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
|
||||
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
|
||||
static NS_DEFINE_CID(kCTransferableCID, NS_TRANSFERABLE_CID);
|
||||
static NS_DEFINE_CID(kHTMLConverterCID, NS_HTMLFORMATCONVERTER_CID);
|
||||
static NS_DEFINE_CID(kTextEncoderCID, NS_TEXT_ENCODER_CID);
|
||||
|
||||
// private clipboard data flavors for html copy, used by editor when pasting
|
||||
#define kHTMLContext "text/_moz_htmlcontext"
|
||||
#define kHTMLInfo "text/_moz_htmlinfo"
|
||||
|
||||
|
||||
nsresult nsCopySupport::HTMLCopy(nsISelection *aSel, nsIDocument *aDoc, PRInt16 aClipboardID)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDocumentEncoder> docEncoder;
|
||||
|
||||
docEncoder = do_CreateInstance(NS_HTMLCOPY_ENCODER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(docEncoder, NS_ERROR_FAILURE);
|
||||
|
||||
rv = docEncoder->Init(aDoc, NS_LITERAL_STRING("text/html"), 0);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = docEncoder->SetSelection(aSel);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsAutoString mimeType;
|
||||
rv = docEncoder->GetMimeType(mimeType);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString buffer, parents, info;
|
||||
PRBool bIsHTMLCopy = PR_FALSE;
|
||||
if (mimeType.EqualsWithConversion("text/html"))
|
||||
bIsHTMLCopy = PR_TRUE;
|
||||
|
||||
if (bIsHTMLCopy)
|
||||
{
|
||||
// encode the selection as html with contextual info
|
||||
rv = docEncoder->EncodeToStringWithContext(buffer, parents, info);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
// encode the selection
|
||||
rv = docEncoder->EncodeToString(buffer);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Get the Clipboard
|
||||
NS_WITH_SERVICE(nsIClipboard, clipboard, kCClipboardCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if ( clipboard )
|
||||
{
|
||||
// Create a transferable for putting data on the Clipboard
|
||||
nsCOMPtr<nsITransferable> trans = do_CreateInstance(kCTransferableCID);
|
||||
if ( trans )
|
||||
{
|
||||
if (bIsHTMLCopy)
|
||||
{
|
||||
// set up the data converter
|
||||
nsCOMPtr<nsIFormatConverter> htmlConverter = do_CreateInstance(kHTMLConverterCID);
|
||||
NS_ENSURE_TRUE(htmlConverter, NS_ERROR_FAILURE);
|
||||
trans->SetConverter(htmlConverter);
|
||||
|
||||
// Add the html DataFlavor to the transferable
|
||||
trans->AddDataFlavor(kHTMLMime);
|
||||
// Add the htmlcontext DataFlavor to the transferable
|
||||
trans->AddDataFlavor(kHTMLContext);
|
||||
// Add the htmlinfo DataFlavor to the transferable
|
||||
trans->AddDataFlavor(kHTMLInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add the unicode DataFlavor to the transferable
|
||||
trans->AddDataFlavor(kUnicodeMime);
|
||||
}
|
||||
|
||||
// get wStrings to hold clip data
|
||||
nsCOMPtr<nsISupportsWString> dataWrapper, contextWrapper, infoWrapper;
|
||||
dataWrapper = do_CreateInstance(NS_SUPPORTS_WSTRING_CONTRACTID);
|
||||
NS_ENSURE_TRUE(dataWrapper, NS_ERROR_FAILURE);
|
||||
if (bIsHTMLCopy)
|
||||
{
|
||||
contextWrapper = do_CreateInstance(NS_SUPPORTS_WSTRING_CONTRACTID);
|
||||
NS_ENSURE_TRUE(contextWrapper, NS_ERROR_FAILURE);
|
||||
infoWrapper = do_CreateInstance(NS_SUPPORTS_WSTRING_CONTRACTID);
|
||||
NS_ENSURE_TRUE(infoWrapper, NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
// populate the strings
|
||||
dataWrapper->SetData ( NS_CONST_CAST(PRUnichar*,buffer.GetUnicode()) );
|
||||
if (bIsHTMLCopy)
|
||||
{
|
||||
contextWrapper->SetData ( NS_CONST_CAST(PRUnichar*,parents.GetUnicode()) );
|
||||
infoWrapper->SetData ( NS_CONST_CAST(PRUnichar*,info.GetUnicode()) );
|
||||
}
|
||||
|
||||
// QI the data object an |nsISupports| so that when the transferable holds
|
||||
// onto it, it will addref the correct interface.
|
||||
nsCOMPtr<nsISupports> genericDataObj ( do_QueryInterface(dataWrapper) );
|
||||
if (bIsHTMLCopy)
|
||||
{
|
||||
trans->SetTransferData(kHTMLMime, genericDataObj, buffer.Length()*2);
|
||||
genericDataObj = do_QueryInterface(contextWrapper);
|
||||
trans->SetTransferData(kHTMLContext, genericDataObj, parents.Length()*2);
|
||||
genericDataObj = do_QueryInterface(infoWrapper);
|
||||
trans->SetTransferData(kHTMLInfo, genericDataObj, info.Length()*2);
|
||||
}
|
||||
else
|
||||
{
|
||||
trans->SetTransferData(kUnicodeMime, genericDataObj, buffer.Length()*2);
|
||||
}
|
||||
// put the transferable on the clipboard
|
||||
clipboard->SetData(trans, nsnull, aClipboardID);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
90
mozilla/content/html/content/public/nsIHTMLContent.h
Normal file
90
mozilla/content/html/content/public/nsIHTMLContent.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/* -*- 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.org 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 nsIHTMLContent_h___
|
||||
#define nsIHTMLContent_h___
|
||||
|
||||
#include "nsIXMLContent.h"
|
||||
#include "nsHTMLValue.h"
|
||||
class nsString;
|
||||
class nsIFrame;
|
||||
class nsIStyleRule;
|
||||
class nsIMutableStyleContext;
|
||||
class nsIPresContext;
|
||||
class nsIHTMLMappedAttributes;
|
||||
class nsIURI;
|
||||
|
||||
// IID for the nsIHTMLContent class
|
||||
#define NS_IHTMLCONTENT_IID \
|
||||
{ 0xb9e110b0, 0x94d6, 0x11d1, \
|
||||
{0x89, 0x5c, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
|
||||
|
||||
typedef void (*nsMapAttributesFunc)(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext);
|
||||
|
||||
// Abstract interface for all html content
|
||||
class nsIHTMLContent : public nsIXMLContent
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IHTMLCONTENT_IID)
|
||||
|
||||
/**
|
||||
* If this html content is a container, then compact asks it to minimize
|
||||
* it's storage usage.
|
||||
*/
|
||||
NS_IMETHOD Compact() = 0;
|
||||
|
||||
NS_IMETHOD SetHTMLAttribute(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
PRBool aNotify) = 0;
|
||||
|
||||
NS_IMETHOD GetHTMLAttribute(nsIAtom* aAttribute,
|
||||
nsHTMLValue& aValue) const = 0;
|
||||
NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
|
||||
nsMapAttributesFunc& aMapFunc) const = 0;
|
||||
|
||||
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsAWritableString& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsAReadableString& aValue,
|
||||
nsHTMLValue& aResult) = 0;
|
||||
|
||||
/**
|
||||
* Get the base URL for any relative URLs within this piece
|
||||
* of content. Generally, this is the document's base URL,
|
||||
* but certain content carries a local base for backward
|
||||
* compatibility.
|
||||
*/
|
||||
NS_IMETHOD GetBaseURL(nsIURI*& aBaseURL) const = 0;
|
||||
|
||||
/**
|
||||
* Get the base target for any links within this piece
|
||||
* of content. Generally, this is the document's base target,
|
||||
* but certain content carries a local base for backward
|
||||
* compatibility.
|
||||
*/
|
||||
NS_IMETHOD GetBaseTarget(nsAWritableString& aBaseTarget) const = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIHTMLContent_h___ */
|
||||
782
mozilla/content/html/style/src/nsStyleUtil.cpp
Normal file
782
mozilla/content/html/style/src/nsStyleUtil.cpp
Normal file
@@ -0,0 +1,782 @@
|
||||
/* -*- 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.org 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):
|
||||
* IBM Corp.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsUnitConversion.h"
|
||||
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsIXMLContent.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
#define POSITIVE_SCALE_FACTOR 1.10 /* 10% */
|
||||
#define NEGATIVE_SCALE_FACTOR .90 /* 10% */
|
||||
|
||||
#if DEBUG
|
||||
#define DUMP_FONT_SIZES 0
|
||||
#endif
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Return the scaling percentage given a font scaler
|
||||
* Lifted from layutil.c
|
||||
*/
|
||||
float nsStyleUtil::GetScalingFactor(PRInt32 aScaler)
|
||||
{
|
||||
double scale = 1.0;
|
||||
double mult;
|
||||
PRInt32 count;
|
||||
|
||||
if(aScaler < 0) {
|
||||
count = -aScaler;
|
||||
mult = NEGATIVE_SCALE_FACTOR;
|
||||
}
|
||||
else {
|
||||
count = aScaler;
|
||||
mult = POSITIVE_SCALE_FACTOR;
|
||||
}
|
||||
|
||||
/* use the percentage scaling factor to the power of the pref */
|
||||
while(count--) {
|
||||
scale *= mult;
|
||||
}
|
||||
|
||||
return (float)scale;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static PRBool gNavAlgorithmPref = PR_FALSE;
|
||||
|
||||
static int PR_CALLBACK NavAlgorithmPrefChangedCallback(const char * name, void * closure)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && prefs) {
|
||||
prefs->GetBoolPref(name, &gNavAlgorithmPref);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static PRBool UseNewFontAlgorithm()
|
||||
{
|
||||
static PRBool once = PR_TRUE;
|
||||
|
||||
if (once)
|
||||
{
|
||||
once = PR_FALSE;
|
||||
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && prefs) {
|
||||
prefs->GetBoolPref("font.size.nav4algorithm", &gNavAlgorithmPref);
|
||||
prefs->RegisterCallback("font.size.nav4algorithm", NavAlgorithmPrefChangedCallback, NULL);
|
||||
}
|
||||
}
|
||||
return (gNavAlgorithmPref ? PR_FALSE : PR_TRUE);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Lifted from winfe/cxdc.cpp
|
||||
*/
|
||||
static nscoord OldCalcFontPointSize(PRInt32 aHTMLSize, PRInt32 aBasePointSize,
|
||||
float aScalingFactor)
|
||||
{ // lifted directly from Nav 5.0 code to replicate rounding errors
|
||||
double dFontSize;
|
||||
|
||||
switch(aHTMLSize) {
|
||||
case 1:
|
||||
dFontSize = 7 * aBasePointSize / 10;
|
||||
break;
|
||||
case 2:
|
||||
dFontSize = 85 * aBasePointSize / 100;
|
||||
break;
|
||||
case 3:
|
||||
dFontSize = aBasePointSize;
|
||||
break;
|
||||
case 4:
|
||||
dFontSize = 12 * aBasePointSize / 10;
|
||||
break;
|
||||
case 5:
|
||||
dFontSize = 3 * aBasePointSize / 2;
|
||||
break;
|
||||
case 6:
|
||||
dFontSize = 2 * aBasePointSize;
|
||||
break;
|
||||
case 7:
|
||||
dFontSize = 3 * aBasePointSize;
|
||||
break;
|
||||
default:
|
||||
if (aHTMLSize < 1) {
|
||||
dFontSize = (7 * aBasePointSize / 10) * pow(1.1, aHTMLSize - 1);
|
||||
}
|
||||
else { // aHTMLSize > 7
|
||||
dFontSize = (3 * aBasePointSize) * pow(1.2, aHTMLSize - 7);
|
||||
}
|
||||
}
|
||||
|
||||
dFontSize *= aScalingFactor;
|
||||
|
||||
if (1.0 < dFontSize) {
|
||||
return (nscoord)dFontSize;
|
||||
}
|
||||
return (nscoord)1;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static nscoord NewCalcFontPointSize(PRInt32 aHTMLSize, PRInt32 aBasePointSize,
|
||||
float aScalingFactor, nsIPresContext* aPresContext,
|
||||
nsFontSizeType aFontSizeType)
|
||||
{
|
||||
#define sFontSizeTableMin 9
|
||||
#define sFontSizeTableMax 16
|
||||
|
||||
// This table seems to be the one used by MacIE5. We hope its adoption in Mozilla
|
||||
// and eventually in WinIE5.5 will help to establish a standard rendering across
|
||||
// platforms and browsers. For now, it is used only in Strict mode. More can be read
|
||||
// in the document written by Todd Farhner at:
|
||||
// http://style.verso.com/font_size_intervals/altintervals.html
|
||||
//
|
||||
static PRInt32 sStrictFontSizeTable[sFontSizeTableMax - sFontSizeTableMin + 1][8] =
|
||||
{
|
||||
{ 9, 9, 9, 9, 11, 14, 18, 27},
|
||||
{ 9, 9, 9, 10, 12, 15, 20, 30},
|
||||
{ 9, 9, 10, 11, 13, 17, 22, 33},
|
||||
{ 9, 9, 10, 12, 14, 18, 24, 36},
|
||||
{ 9, 10, 12, 13, 16, 20, 26, 39},
|
||||
{ 9, 10, 12, 14, 17, 21, 28, 42},
|
||||
{ 9, 10, 13, 15, 18, 23, 30, 45},
|
||||
{ 9, 10, 13, 16, 18, 24, 32, 48}
|
||||
};
|
||||
// HTML 1 2 3 4 5 6 7
|
||||
// CSS xxs xs s m l xl xxl
|
||||
// |
|
||||
// user pref
|
||||
//
|
||||
//------------------------------------------------------------
|
||||
//
|
||||
// This table gives us compatibility with WinNav4 for the default fonts only.
|
||||
// In WinNav4, the default fonts were:
|
||||
//
|
||||
// Times/12pt == Times/16px at 96ppi
|
||||
// Courier/10pt == Courier/13px at 96ppi
|
||||
//
|
||||
// The 2 lines below marked "anchored" have the exact pixel sizes used by
|
||||
// WinNav4 for Times/12pt and Courier/10pt at 96ppi. As you can see, the
|
||||
// HTML size 3 (user pref) for those 2 anchored lines is 13px and 16px.
|
||||
//
|
||||
// All values other than the anchored values were filled in by hand, never
|
||||
// going below 9px, and maintaining a "diagonal" relationship. See for
|
||||
// example the 13s -- they follow a diagonal line through the table.
|
||||
//
|
||||
static PRInt32 sQuirksFontSizeTable[sFontSizeTableMax - sFontSizeTableMin + 1][8] =
|
||||
{
|
||||
{ 9, 9, 9, 9, 11, 14, 18, 28 },
|
||||
{ 9, 9, 9, 10, 12, 15, 20, 31 },
|
||||
{ 9, 9, 9, 11, 13, 17, 22, 34 },
|
||||
{ 9, 9, 10, 12, 14, 18, 24, 37 },
|
||||
{ 9, 9, 10, 13, 16, 20, 26, 40 }, // anchored (13)
|
||||
{ 9, 9, 11, 14, 17, 21, 28, 42 },
|
||||
{ 9, 10, 12, 15, 17, 23, 30, 45 },
|
||||
{ 9, 10, 13, 16, 18, 24, 32, 48 } // anchored (16)
|
||||
};
|
||||
// HTML 1 2 3 4 5 6 7
|
||||
// CSS xxs xs s m l xl xxl
|
||||
// |
|
||||
// user pref
|
||||
|
||||
#if 0
|
||||
//
|
||||
// These are the exact pixel values used by WinIE5 at 96ppi.
|
||||
//
|
||||
{ ?, 8, 11, 12, 13, 16, 21, 32 }, // smallest
|
||||
{ ?, 9, 12, 13, 16, 21, 27, 40 }, // smaller
|
||||
{ ?, 10, 13, 16, 18, 24, 32, 48 }, // medium
|
||||
{ ?, 13, 16, 19, 21, 27, 37, ?? }, // larger
|
||||
{ ?, 16, 19, 21, 24, 32, 43, ?? } // largest
|
||||
//
|
||||
// HTML 1 2 3 4 5 6 7
|
||||
// CSS ? ? ? ? ? ? ? ?
|
||||
//
|
||||
// (CSS not tested yet.)
|
||||
//
|
||||
#endif
|
||||
|
||||
static PRInt32 sFontSizeFactors[8] = { 60,75,89,100,120,150,200,300 };
|
||||
|
||||
static PRInt32 sCSSColumns[7] = {0, 1, 2, 3, 4, 5, 6}; // xxs...xxl
|
||||
static PRInt32 sHTMLColumns[7] = {1, 2, 3, 4, 5, 6, 7}; // 1...7
|
||||
|
||||
double dFontSize;
|
||||
|
||||
if (aFontSizeType == eFontSize_HTML) {
|
||||
aHTMLSize--; // input as 1-7
|
||||
}
|
||||
|
||||
if (aHTMLSize < 0)
|
||||
aHTMLSize = 0;
|
||||
else if (aHTMLSize > 6)
|
||||
aHTMLSize = 6;
|
||||
|
||||
PRInt32* column;
|
||||
switch (aFontSizeType)
|
||||
{
|
||||
case eFontSize_HTML: column = sHTMLColumns; break;
|
||||
case eFontSize_CSS: column = sCSSColumns; break;
|
||||
}
|
||||
|
||||
float t2p;
|
||||
aPresContext->GetTwipsToPixels(&t2p);
|
||||
PRInt32 fontSize = NSTwipsToIntPixels(aBasePointSize, t2p);
|
||||
|
||||
if ((fontSize >= sFontSizeTableMin) && (fontSize <= sFontSizeTableMax))
|
||||
{
|
||||
float p2t;
|
||||
aPresContext->GetPixelsToTwips(&p2t);
|
||||
|
||||
PRInt32 row = fontSize - sFontSizeTableMin;
|
||||
|
||||
nsCompatibility mode;
|
||||
aPresContext->GetCompatibilityMode(&mode);
|
||||
if (mode == eCompatibility_NavQuirks) {
|
||||
dFontSize = NSIntPixelsToTwips(sQuirksFontSizeTable[row][column[aHTMLSize]], p2t);
|
||||
} else {
|
||||
dFontSize = NSIntPixelsToTwips(sStrictFontSizeTable[row][column[aHTMLSize]], p2t);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PRInt32 factor = sFontSizeFactors[column[aHTMLSize]];
|
||||
dFontSize = (factor * aBasePointSize) / 100;
|
||||
}
|
||||
|
||||
dFontSize *= aScalingFactor;
|
||||
|
||||
if (1.0 < dFontSize) {
|
||||
return (nscoord)dFontSize;
|
||||
}
|
||||
return (nscoord)1;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
nscoord nsStyleUtil::CalcFontPointSize(PRInt32 aHTMLSize, PRInt32 aBasePointSize,
|
||||
float aScalingFactor, nsIPresContext* aPresContext,
|
||||
nsFontSizeType aFontSizeType)
|
||||
{
|
||||
#if DUMP_FONT_SIZES
|
||||
extern void DumpFontSizes(nsIPresContext* aPresContext);
|
||||
DumpFontSizes(aPresContext);
|
||||
#endif
|
||||
if (UseNewFontAlgorithm())
|
||||
return NewCalcFontPointSize(aHTMLSize, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType);
|
||||
else
|
||||
return OldCalcFontPointSize(aHTMLSize, aBasePointSize, aScalingFactor);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PRInt32 nsStyleUtil::FindNextSmallerFontSize(nscoord aFontSize, PRInt32 aBasePointSize,
|
||||
float aScalingFactor, nsIPresContext* aPresContext,
|
||||
nsFontSizeType aFontSizeType)
|
||||
{
|
||||
PRInt32 index;
|
||||
PRInt32 indexMin;
|
||||
PRInt32 indexMax;
|
||||
PRInt32 fontSize = NSTwipsToFloorIntPoints(aFontSize);
|
||||
|
||||
if (aFontSizeType == eFontSize_HTML) {
|
||||
indexMin = 1;
|
||||
indexMax = 7;
|
||||
} else {
|
||||
indexMin = 0;
|
||||
indexMax = 6;
|
||||
}
|
||||
|
||||
if (NSTwipsToFloorIntPoints(CalcFontPointSize(indexMin, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)) < fontSize) {
|
||||
if (fontSize <= NSTwipsToFloorIntPoints(CalcFontPointSize(indexMax, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType))) { // in HTML table
|
||||
for (index = indexMax; index > indexMin; index--)
|
||||
if (fontSize > NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)))
|
||||
break;
|
||||
}
|
||||
else { // larger than HTML table
|
||||
return indexMax;
|
||||
// for (index = 8; ; index++)
|
||||
// if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext))) {
|
||||
// index--;
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
}
|
||||
else { // smaller than HTML table
|
||||
return indexMin;
|
||||
// for (index = 0; -25<index ; index--) //prevent infinite loop (bug 17045)
|
||||
// if (fontSize > NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext))) {
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PRInt32 nsStyleUtil::FindNextLargerFontSize(nscoord aFontSize, PRInt32 aBasePointSize,
|
||||
float aScalingFactor, nsIPresContext* aPresContext,
|
||||
nsFontSizeType aFontSizeType)
|
||||
{
|
||||
PRInt32 index;
|
||||
PRInt32 indexMin;
|
||||
PRInt32 indexMax;
|
||||
PRInt32 fontSize = NSTwipsToFloorIntPoints(aFontSize);
|
||||
|
||||
if (aFontSizeType == eFontSize_HTML) {
|
||||
indexMin = 1;
|
||||
indexMax = 7;
|
||||
} else {
|
||||
indexMin = 0;
|
||||
indexMax = 6;
|
||||
}
|
||||
|
||||
if (NSTwipsToFloorIntPoints(CalcFontPointSize(indexMin, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)) <= fontSize) {
|
||||
if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(indexMax, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType))) { // in HTML table
|
||||
for (index = indexMin; index < indexMax; index++)
|
||||
if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)))
|
||||
break;
|
||||
}
|
||||
else { // larger than HTML table
|
||||
return indexMax;
|
||||
// for (index = 8; ; index++)
|
||||
// if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext)))
|
||||
// break;
|
||||
}
|
||||
}
|
||||
else { // smaller than HTML table
|
||||
return indexMin;
|
||||
// for (index = 0; -25<index ; index--) //prevent infinite loop (bug 17045)
|
||||
// if (fontSize > NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext))) {
|
||||
// index++;
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PRInt32
|
||||
nsStyleUtil::ConstrainFontWeight(PRInt32 aWeight)
|
||||
{
|
||||
aWeight = ((aWeight < 100) ? 100 : ((aWeight > 900) ? 900 : aWeight));
|
||||
PRInt32 base = ((aWeight / 100) * 100);
|
||||
PRInt32 step = (aWeight % 100);
|
||||
PRBool negativeStep = PRBool(50 < step);
|
||||
PRInt32 maxStep;
|
||||
if (negativeStep) {
|
||||
step = 100 - step;
|
||||
maxStep = (base / 100);
|
||||
base += 100;
|
||||
}
|
||||
else {
|
||||
maxStep = ((900 - base) / 100);
|
||||
}
|
||||
if (maxStep < step) {
|
||||
step = maxStep;
|
||||
}
|
||||
return (base + ((negativeStep) ? -step : step));
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const nsStyleColor* nsStyleUtil::FindNonTransparentBackground(nsIStyleContext* aContext,
|
||||
PRBool aStartAtParent /*= PR_FALSE*/)
|
||||
{
|
||||
const nsStyleColor* result = nsnull;
|
||||
nsIStyleContext* context;
|
||||
if (aStartAtParent) {
|
||||
context = aContext->GetParent(); // balance ending release
|
||||
} else {
|
||||
context = aContext;
|
||||
NS_IF_ADDREF(context); // balance ending release
|
||||
}
|
||||
NS_ASSERTION( context != nsnull, "Cannot find NonTransparentBackground in a null context" );
|
||||
|
||||
while (nsnull != context) {
|
||||
result = (const nsStyleColor*)context->GetStyleData(eStyleStruct_Color);
|
||||
|
||||
if (0 == (result->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
nsIStyleContext* last = context;
|
||||
context = context->GetParent();
|
||||
NS_RELEASE(last);
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(context);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*static*/
|
||||
PRBool nsStyleUtil::IsHTMLLink(nsIContent *aContent, nsIAtom *aTag, nsIPresContext *aPresContext, nsLinkState *aState)
|
||||
{
|
||||
NS_ASSERTION(aContent && aState, "null arg in IsHTMLLink");
|
||||
|
||||
// check for:
|
||||
// - HTML ANCHOR with valid HREF
|
||||
// - HTML LINK with valid HREF
|
||||
// - HTML AREA with valid HREF
|
||||
|
||||
PRBool result = PR_FALSE;
|
||||
|
||||
if ((aTag == nsHTMLAtoms::a) ||
|
||||
(aTag == nsHTMLAtoms::link) ||
|
||||
(aTag == nsHTMLAtoms::area)) {
|
||||
|
||||
nsCOMPtr<nsILink> link( do_QueryInterface(aContent) );
|
||||
// In XML documents, this can be null.
|
||||
if (link) {
|
||||
nsLinkState linkState;
|
||||
link->GetLinkState(linkState);
|
||||
if (linkState == eLinkState_Unknown) {
|
||||
// if it is an anchor, area or link then check the href attribute
|
||||
// make sure this anchor has a link even if we are not testing state
|
||||
// if there is no link, then this anchor is not really a linkpseudo.
|
||||
// bug=23209
|
||||
|
||||
char* href;
|
||||
link->GetHrefCString(href);
|
||||
|
||||
if (href) {
|
||||
nsILinkHandler *linkHandler = nsnull;
|
||||
aPresContext->GetLinkHandler(&linkHandler);
|
||||
if (linkHandler) {
|
||||
linkHandler->GetLinkState(href, linkState);
|
||||
NS_RELEASE(linkHandler);
|
||||
}
|
||||
else {
|
||||
// no link handler? then all links are unvisited
|
||||
linkState = eLinkState_Unvisited;
|
||||
}
|
||||
nsCRT::free(href);
|
||||
} else {
|
||||
linkState = eLinkState_NotLink;
|
||||
}
|
||||
link->SetLinkState(linkState);
|
||||
}
|
||||
if (linkState != eLinkState_NotLink) {
|
||||
*aState = linkState;
|
||||
result = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*static*/
|
||||
PRBool nsStyleUtil::IsSimpleXlink(nsIContent *aContent, nsIPresContext *aPresContext, nsLinkState *aState)
|
||||
{
|
||||
// XXX PERF This function will cause serious performance problems on
|
||||
// pages with lots of XLinks. We should be caching the visited
|
||||
// state of the XLinks. Where???
|
||||
|
||||
NS_ASSERTION(aContent && aState, "invalid call to IsXlink with null content");
|
||||
|
||||
PRBool rv = PR_FALSE;
|
||||
|
||||
if (aContent && aState) {
|
||||
// first see if we have an XML element
|
||||
nsCOMPtr<nsIXMLContent> xml(do_QueryInterface(aContent));
|
||||
if (xml) {
|
||||
// see if it is type=simple (we don't deal with other types)
|
||||
nsAutoString val;
|
||||
aContent->GetAttribute(kNameSpaceID_XLink, nsHTMLAtoms::type, val);
|
||||
if (val == NS_LITERAL_STRING("simple")) {
|
||||
// see if there is an xlink namespace'd href attribute:
|
||||
// - get it if there is, if not no big deal, it is not required for xlinks
|
||||
// is it bad to re-use val here?
|
||||
aContent->GetAttribute(kNameSpaceID_XLink, nsHTMLAtoms::href, val);
|
||||
|
||||
// It's an XLink. Resolve it relative to its document.
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
nsCOMPtr<nsIHTMLContent> htmlContent = do_QueryInterface(aContent);
|
||||
if (htmlContent) {
|
||||
// XXX why do this? will nsIHTMLContent's
|
||||
// GetBaseURL() may return something different
|
||||
// than the URL of the document it lives in?
|
||||
htmlContent->GetBaseURL(*getter_AddRefs(baseURI));
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aContent->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
doc->GetBaseURL(*getter_AddRefs(baseURI));
|
||||
}
|
||||
}
|
||||
|
||||
// convert here, rather than twice in NS_MakeAbsoluteURI and
|
||||
// back again
|
||||
char * href = val.ToNewCString();
|
||||
char * absHREF = nsnull;
|
||||
(void) NS_MakeAbsoluteURI(&absHREF, href, baseURI);
|
||||
nsCRT::free(href);
|
||||
|
||||
nsILinkHandler *linkHandler = nsnull;
|
||||
aPresContext->GetLinkHandler(&linkHandler);
|
||||
if (linkHandler) {
|
||||
linkHandler->GetLinkState(absHREF, *aState);
|
||||
NS_RELEASE(linkHandler);
|
||||
}
|
||||
else {
|
||||
// no link handler? then all links are unvisited
|
||||
*aState = eLinkState_Unvisited;
|
||||
}
|
||||
nsCRT::free(absHREF);
|
||||
|
||||
rv = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#if DUMP_FONT_SIZES
|
||||
#include "nsIDeviceContext.h"
|
||||
PRInt32 RoundSize(nscoord aVal, nsIPresContext* aPresContext, bool aWinRounding)
|
||||
{
|
||||
|
||||
PRInt32 lfHeight;
|
||||
nsIDeviceContext* dc;
|
||||
aPresContext->GetDeviceContext(&dc);
|
||||
|
||||
float app2dev, app2twip, scale;
|
||||
dc->GetAppUnitsToDevUnits(app2dev);
|
||||
|
||||
if (aWinRounding)
|
||||
{
|
||||
dc->GetDevUnitsToTwips(app2twip);
|
||||
dc->GetCanonicalPixelScale(scale);
|
||||
app2twip *= app2dev * scale;
|
||||
|
||||
// This interesting bit of code rounds the font size off to the floor point
|
||||
// value. This is necessary for proper font scaling under windows.
|
||||
PRInt32 sizePoints = NSTwipsToFloorIntPoints(nscoord(aVal*app2twip));
|
||||
float rounded = ((float)NSIntPointsToTwips(sizePoints)) / app2twip;
|
||||
|
||||
// round font size off to floor point size to be windows compatible
|
||||
// this is proper (windows) rounding
|
||||
// lfHeight = NSToIntRound(rounded * app2dev);
|
||||
|
||||
// this floor rounding is to make ours compatible with Nav 4.0
|
||||
lfHeight = long(rounded * app2dev);
|
||||
return lfHeight;
|
||||
}
|
||||
else
|
||||
return NSToIntRound(aVal*app2dev);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#if DUMP_FONT_SIZES
|
||||
void DumpFontSizes(nsIPresContext* aPresContext)
|
||||
{
|
||||
static gOnce = true;
|
||||
if (gOnce)
|
||||
{
|
||||
gOnce = false;
|
||||
|
||||
PRInt32 baseSize;
|
||||
PRInt32 htmlSize;
|
||||
PRInt32 cssSize;
|
||||
nscoord val;
|
||||
nscoord oldVal;
|
||||
|
||||
nsIDeviceContext* dc;
|
||||
aPresContext->GetDeviceContext(&dc);
|
||||
float dev2app;
|
||||
dc->GetDevUnitsToAppUnits(dev2app);
|
||||
|
||||
bool doWinRounding = true;
|
||||
for (short i=0; i<2; i ++)
|
||||
{
|
||||
doWinRounding ^= true;
|
||||
printf("\n\n\n");
|
||||
printf("---------------------------------------------------------------\n");
|
||||
printf(" CSS \n");
|
||||
printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF"));
|
||||
printf("---------------------------------------------------------------\n");
|
||||
printf("\n");
|
||||
printf("NEW SIZES:\n");
|
||||
printf("----------\n");
|
||||
printf(" xx-small x-small small medium large x-large xx-large\n");
|
||||
for (baseSize = 9; baseSize <= 20; baseSize++) {
|
||||
printf("%2d: ", baseSize);
|
||||
for (cssSize = 0; cssSize <= 6; cssSize++) {
|
||||
val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS);
|
||||
printf("%2d ", RoundSize(val, aPresContext, false));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
printf("OLD SIZES:\n");
|
||||
printf("----------\n");
|
||||
printf(" xx-small x-small small medium large x-large xx-large\n");
|
||||
for (baseSize = 9; baseSize <= 20; baseSize++) {
|
||||
printf("%2d: ", baseSize);
|
||||
for (cssSize = 0; cssSize <= 6; cssSize++) {
|
||||
val = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f);
|
||||
printf("%2d ", RoundSize(val, aPresContext, doWinRounding));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
printf("DIFFS:\n");
|
||||
printf("------\n");
|
||||
printf(" xx-small x-small small medium large x-large xx-large\n");
|
||||
for (baseSize = 9; baseSize <= 20; baseSize++) {
|
||||
printf("%2d: ", baseSize);
|
||||
for (cssSize = 0; cssSize <= 6; cssSize++) {
|
||||
oldVal = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f);
|
||||
val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS);
|
||||
if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8)
|
||||
printf(" .");
|
||||
else
|
||||
printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding)));
|
||||
printf(" ");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
printf("\n\n\n");
|
||||
printf("---------------------------------------------------------------\n");
|
||||
printf(" HTML \n");
|
||||
printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF"));
|
||||
printf("---------------------------------------------------------------\n");
|
||||
printf("\n");
|
||||
printf("NEW SIZES:\n");
|
||||
printf("----------\n");
|
||||
printf(" #1 #2 #3 #4 #5 #6 #7\n");
|
||||
for (baseSize = 9; baseSize <= 20; baseSize++) {
|
||||
printf("%2d: ", baseSize);
|
||||
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
|
||||
val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML);
|
||||
printf("%2d ", RoundSize(val, aPresContext, false));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
printf("OLD SIZES:\n");
|
||||
printf("----------\n");
|
||||
printf(" #1 #2 #3 #4 #5 #6 #7\n");
|
||||
for (baseSize = 9; baseSize <= 20; baseSize++) {
|
||||
printf("%2d: ", baseSize);
|
||||
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
|
||||
val = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f);
|
||||
printf("%2d ", RoundSize(val, aPresContext, doWinRounding));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
printf("DIFFS:\n");
|
||||
printf("------\n");
|
||||
printf(" #1 #2 #3 #4 #5 #6 #7\n");
|
||||
for (baseSize = 9; baseSize <= 20; baseSize++) {
|
||||
printf("%2d: ", baseSize);
|
||||
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
|
||||
oldVal = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f);
|
||||
val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML);
|
||||
if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8)
|
||||
printf(" .");
|
||||
else
|
||||
printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding)));
|
||||
printf(" ");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n\n\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
300
mozilla/content/shared/public/nsHTMLAtomList.h
Normal file
300
mozilla/content/shared/public/nsHTMLAtomList.h
Normal file
@@ -0,0 +1,300 @@
|
||||
/* -*- 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/******
|
||||
|
||||
This file contains the list of all HTML atoms
|
||||
See nsHTMLAtoms.h for access to the atoms
|
||||
|
||||
It is designed to be used as inline input to nsHTMLAtoms.cpp *only*
|
||||
through the magic of C preprocessing.
|
||||
|
||||
All entires must be enclosed in the macro HTML_ATOM which will have cruel
|
||||
and unusual things done to it
|
||||
|
||||
The first argument to HTML_ATOM is the C++ name of the atom
|
||||
The second argument it HTML_ATOM is the string value of the atom
|
||||
|
||||
******/
|
||||
|
||||
HTML_ATOM(mozAnonymousBlock, ":-moz-anonymous-block")
|
||||
HTML_ATOM(mozAnonymousPositionedBlock, ":-moz-anonymous-positioned-block")
|
||||
HTML_ATOM(mozFirstLineFixup, ":-moz-first-line-fixup")
|
||||
HTML_ATOM(mozLetterFrame, ":-moz-letter-frame")
|
||||
HTML_ATOM(mozLineFrame, ":-moz-line-frame")
|
||||
HTML_ATOM(mozListBulletPseudo, ":-moz-list-bullet")
|
||||
HTML_ATOM(mozSingleLineTextControlFrame, ":-moz-singleline-textcontrol-frame")
|
||||
HTML_ATOM(mozFocusInnerPseudo, ":-moz-focus-inner")
|
||||
HTML_ATOM(mozFocusOuterPseudo, ":-moz-focus-outer")
|
||||
HTML_ATOM(mozDisplayComboboxControlFrame, ":-moz-display-comboboxcontrol-frame")
|
||||
|
||||
HTML_ATOM(_baseHref, NS_HTML_BASE_HREF)
|
||||
HTML_ATOM(_baseTarget, NS_HTML_BASE_TARGET)
|
||||
HTML_ATOM(a, "a")
|
||||
HTML_ATOM(abbr, "abbr")
|
||||
HTML_ATOM(above, "above")
|
||||
HTML_ATOM(accept, "accept")
|
||||
HTML_ATOM(acceptcharset, "accept-charset")
|
||||
HTML_ATOM(accesskey, "accesskey")
|
||||
HTML_ATOM(action, "action")
|
||||
HTML_ATOM(align, "align")
|
||||
HTML_ATOM(alink, "alink")
|
||||
HTML_ATOM(alt, "alt")
|
||||
HTML_ATOM(applet, "applet")
|
||||
HTML_ATOM(archive, "archive")
|
||||
HTML_ATOM(area, "area")
|
||||
HTML_ATOM(axis, "axis")
|
||||
HTML_ATOM(background, "background")
|
||||
HTML_ATOM(below, "below")
|
||||
HTML_ATOM(bgcolor, "bgcolor")
|
||||
HTML_ATOM(blockquote, "blockquote")
|
||||
HTML_ATOM(body, "body")
|
||||
HTML_ATOM(border, "border")
|
||||
HTML_ATOM(bordercolor, "bordercolor")
|
||||
HTML_ATOM(bottompadding, "bottompadding")
|
||||
HTML_ATOM(br, "br")
|
||||
HTML_ATOM(b, "b")
|
||||
HTML_ATOM(button, "button")
|
||||
HTML_ATOM(buttonContentPseudo, ":button-content")
|
||||
HTML_ATOM(caption, "caption")
|
||||
HTML_ATOM(cellContentPseudo, ":cell-content")
|
||||
HTML_ATOM(cellpadding, "cellpadding")
|
||||
HTML_ATOM(cellspacing, "cellspacing")
|
||||
HTML_ATOM(ch, "ch")
|
||||
HTML_ATOM(_char, "char")
|
||||
HTML_ATOM(charoff, "charoff")
|
||||
HTML_ATOM(charset, "charset")
|
||||
HTML_ATOM(checked, "checked")
|
||||
HTML_ATOM(choff, "choff")
|
||||
HTML_ATOM(cite, "cite")
|
||||
HTML_ATOM(kClass, "class")
|
||||
HTML_ATOM(classid, "classid")
|
||||
HTML_ATOM(clear, "clear")
|
||||
HTML_ATOM(clip, "clip")
|
||||
HTML_ATOM(code, "code")
|
||||
HTML_ATOM(codebase, "codebase")
|
||||
HTML_ATOM(codetype, "codetype")
|
||||
HTML_ATOM(color, "color")
|
||||
HTML_ATOM(col, "col")
|
||||
HTML_ATOM(colgroup, "colgroup")
|
||||
HTML_ATOM(cols, "cols")
|
||||
HTML_ATOM(colspan, "colspan")
|
||||
HTML_ATOM(combobox, "combobox")
|
||||
HTML_ATOM(columnPseudo, ":body-column")
|
||||
HTML_ATOM(commentPseudo, ":-moz-comment")
|
||||
HTML_ATOM(compact, "compact")
|
||||
HTML_ATOM(content, "content")
|
||||
HTML_ATOM(coords, "coords")
|
||||
HTML_ATOM(dd, "dd")
|
||||
HTML_ATOM(defaultchecked, "defaultchecked")
|
||||
HTML_ATOM(defaultselected, "defaultselected")
|
||||
HTML_ATOM(defaultvalue, "defaultvalue")
|
||||
HTML_ATOM(declare, "declare")
|
||||
HTML_ATOM(defer, "defer")
|
||||
HTML_ATOM(dir, "dir")
|
||||
HTML_ATOM(div, "div")
|
||||
HTML_ATOM(disabled, "disabled")
|
||||
HTML_ATOM(dl, "dl")
|
||||
HTML_ATOM(dropDownListPseudo, ":-moz-dropdown-list")
|
||||
HTML_ATOM(dt, "dt")
|
||||
|
||||
HTML_ATOM(datetime, "datetime")
|
||||
HTML_ATOM(data, "data")
|
||||
HTML_ATOM(dfn, "dfn")
|
||||
HTML_ATOM(em, "em")
|
||||
HTML_ATOM(embed, "embed")
|
||||
HTML_ATOM(encoding, "encoding")
|
||||
HTML_ATOM(enctype, "enctype")
|
||||
HTML_ATOM(face, "face")
|
||||
HTML_ATOM(fieldset, "fieldset")
|
||||
HTML_ATOM(fieldsetContentPseudo, ":fieldset-content")
|
||||
HTML_ATOM(firstLetterPseudo, ":first-letter")
|
||||
HTML_ATOM(firstLinePseudo, ":first-line")
|
||||
HTML_ATOM(font, "font")
|
||||
HTML_ATOM(fontWeight, "font-weight")
|
||||
HTML_ATOM(_for, "for")
|
||||
HTML_ATOM(form, "form")
|
||||
HTML_ATOM(frame, "frame")
|
||||
HTML_ATOM(frameborder, "frameborder")
|
||||
HTML_ATOM(frameset, "frameset")
|
||||
HTML_ATOM(framesetBlankPseudo, ":frameset-blank")
|
||||
HTML_ATOM(gutter, "gutter")
|
||||
HTML_ATOM(h1, "h1")
|
||||
HTML_ATOM(h2, "h2")
|
||||
HTML_ATOM(h3, "h3")
|
||||
HTML_ATOM(h4, "h4")
|
||||
HTML_ATOM(h5, "h5")
|
||||
HTML_ATOM(h6, "h6")
|
||||
HTML_ATOM(head, "head")
|
||||
HTML_ATOM(headerContentBase, "content-base")
|
||||
HTML_ATOM(headerContentLanguage, "content-language")
|
||||
HTML_ATOM(headerContentScriptType, "content-script-type")
|
||||
HTML_ATOM(headerContentStyleType, "content-style-type")
|
||||
HTML_ATOM(headerContentType, "content-type")
|
||||
HTML_ATOM(headerDefaultStyle, "default-style")
|
||||
HTML_ATOM(headerWindowTarget, "window-target")
|
||||
HTML_ATOM(headers, "headers")
|
||||
HTML_ATOM(height, "height")
|
||||
HTML_ATOM(hidden, "hidden")
|
||||
HTML_ATOM(horizontalFramesetBorderPseudo, ":hframeset-border")
|
||||
HTML_ATOM(hr, "hr")
|
||||
HTML_ATOM(href, "href")
|
||||
HTML_ATOM(hreflang, "hreflang")
|
||||
HTML_ATOM(hspace, "hspace")
|
||||
HTML_ATOM(html, "html")
|
||||
HTML_ATOM(httpEquiv, "http-equiv")
|
||||
HTML_ATOM(ibPseudo, ":ib-pseudo")
|
||||
HTML_ATOM(i, "i")
|
||||
HTML_ATOM(id, "id")
|
||||
HTML_ATOM(iframe, "iframe")
|
||||
HTML_ATOM(ilayer, "ilayer")
|
||||
HTML_ATOM(img, "img")
|
||||
HTML_ATOM(index, "index")
|
||||
HTML_ATOM(input, "input")
|
||||
HTML_ATOM(isindex, "isindex")
|
||||
HTML_ATOM(ismap, "ismap")
|
||||
HTML_ATOM(label, "label")
|
||||
HTML_ATOM(labelContentPseudo, ":label-content")
|
||||
HTML_ATOM(lang, "lang")
|
||||
HTML_ATOM(layer, "layer")
|
||||
HTML_ATOM(layout, "layout")
|
||||
HTML_ATOM(li, "li")
|
||||
HTML_ATOM(link, "link")
|
||||
HTML_ATOM(left, "left")
|
||||
HTML_ATOM(leftpadding, "leftpadding")
|
||||
HTML_ATOM(legend, "legend")
|
||||
HTML_ATOM(legendContentPseudo, ":legend-content")
|
||||
HTML_ATOM(length, "length")
|
||||
HTML_ATOM(longdesc, "longdesc")
|
||||
HTML_ATOM(lowsrc, "lowsrc")
|
||||
HTML_ATOM(marginheight, "marginheight")
|
||||
HTML_ATOM(marginwidth, "marginwidth")
|
||||
HTML_ATOM(maxlength, "maxlength")
|
||||
HTML_ATOM(mayscript, "mayscript")
|
||||
HTML_ATOM(media, "media")
|
||||
HTML_ATOM(menu, "menu")
|
||||
HTML_ATOM(meta, "meta")
|
||||
HTML_ATOM(method, "method")
|
||||
HTML_ATOM(multicol, "multicol")
|
||||
HTML_ATOM(multiple, "multiple")
|
||||
HTML_ATOM(name, "name")
|
||||
HTML_ATOM(nohref, "nohref")
|
||||
HTML_ATOM(noresize, "noresize")
|
||||
HTML_ATOM(noscript, "noscript")
|
||||
HTML_ATOM(noshade, "noshade")
|
||||
HTML_ATOM(nowrap, "nowrap")
|
||||
HTML_ATOM(object, "object")
|
||||
HTML_ATOM(ol, "ol")
|
||||
HTML_ATOM(option, "option")
|
||||
HTML_ATOM(overflow, "overflow")
|
||||
HTML_ATOM(p, "p")
|
||||
HTML_ATOM(pagex, "pagex")
|
||||
HTML_ATOM(pagey, "pagey")
|
||||
HTML_ATOM(param, "param")
|
||||
HTML_ATOM(placeholderPseudo, ":placeholder-frame")
|
||||
HTML_ATOM(pointSize, "point-size")
|
||||
HTML_ATOM(pre, "pre")
|
||||
HTML_ATOM(processingInstructionPseudo, ":-moz-pi")
|
||||
HTML_ATOM(profile, "profile")
|
||||
HTML_ATOM(prompt, "prompt")
|
||||
HTML_ATOM(radioPseudo, ":-moz-radio")
|
||||
HTML_ATOM(checkPseudo, ":-moz-checkbox")
|
||||
HTML_ATOM(readonly, "readonly")
|
||||
HTML_ATOM(rel, "rel")
|
||||
HTML_ATOM(repeat, "repeat")
|
||||
HTML_ATOM(rev, "rev")
|
||||
HTML_ATOM(rightpadding, "rightpadding")
|
||||
HTML_ATOM(rows, "rows")
|
||||
HTML_ATOM(rowspan, "rowspan")
|
||||
HTML_ATOM(rules, "rules")
|
||||
HTML_ATOM(s, "s")
|
||||
HTML_ATOM(scheme, "scheme")
|
||||
HTML_ATOM(scope, "scope")
|
||||
HTML_ATOM(script, "script")
|
||||
HTML_ATOM(scrolling, "scrolling")
|
||||
HTML_ATOM(select, "select")
|
||||
HTML_ATOM(selected, "selected")
|
||||
HTML_ATOM(selectedindex, "selectedindex")
|
||||
HTML_ATOM(shape, "shape")
|
||||
HTML_ATOM(size, "size")
|
||||
HTML_ATOM(spacer, "spacer")
|
||||
HTML_ATOM(span, "span")
|
||||
HTML_ATOM(src, "src")
|
||||
HTML_ATOM(standby, "standby")
|
||||
HTML_ATOM(start, "start")
|
||||
HTML_ATOM(strike, "strike")
|
||||
HTML_ATOM(strong, "strong")
|
||||
HTML_ATOM(style, "style")
|
||||
HTML_ATOM(summary, "summary")
|
||||
HTML_ATOM(suppress, "suppress")
|
||||
HTML_ATOM(tabindex, "tabindex")
|
||||
HTML_ATOM(table, "table")
|
||||
HTML_ATOM(tablePseudo, ":table")
|
||||
HTML_ATOM(tableCellPseudo, ":table-cell")
|
||||
HTML_ATOM(tableColGroupPseudo, ":table-column-group")
|
||||
HTML_ATOM(tableColPseudo, ":table-column")
|
||||
HTML_ATOM(tableOuterPseudo, ":table-outer")
|
||||
HTML_ATOM(tableRowGroupPseudo, ":table-row-group")
|
||||
HTML_ATOM(tableRowPseudo, ":table-row")
|
||||
HTML_ATOM(tabstop, "tabstop")
|
||||
HTML_ATOM(target, "target")
|
||||
HTML_ATOM(tbody, "tbody")
|
||||
HTML_ATOM(td, "td")
|
||||
HTML_ATOM(tfoot, "tfoot")
|
||||
HTML_ATOM(thead, "thead")
|
||||
HTML_ATOM(text, "text")
|
||||
HTML_ATOM(textarea, "textarea")
|
||||
HTML_ATOM(textPseudo, ":-moz-text")
|
||||
HTML_ATOM(th, "th")
|
||||
HTML_ATOM(title, "title")
|
||||
HTML_ATOM(top, "top")
|
||||
HTML_ATOM(toppadding, "toppadding")
|
||||
HTML_ATOM(tr, "tr")
|
||||
HTML_ATOM(tt, "tt")
|
||||
HTML_ATOM(type, "type")
|
||||
HTML_ATOM(u, "u")
|
||||
HTML_ATOM(ul, "ul")
|
||||
HTML_ATOM(usemap, "usemap")
|
||||
HTML_ATOM(valign, "valign")
|
||||
HTML_ATOM(value, "value")
|
||||
HTML_ATOM(valuetype, "valuetype")
|
||||
HTML_ATOM(variable, "variable")
|
||||
HTML_ATOM(vcard_name, "vcard_name")
|
||||
HTML_ATOM(version, "version")
|
||||
HTML_ATOM(verticalFramesetBorderPseudo, ":vframeset-border")
|
||||
HTML_ATOM(visibility, "visibility")
|
||||
HTML_ATOM(vlink, "vlink")
|
||||
HTML_ATOM(vspace, "vspace")
|
||||
HTML_ATOM(wbr, "wbr")
|
||||
HTML_ATOM(width, "width")
|
||||
HTML_ATOM(wrap, "wrap")
|
||||
HTML_ATOM(wrappedFramePseudo, ":wrapped-frame")
|
||||
HTML_ATOM(zindex, "zindex")
|
||||
HTML_ATOM(z_index, "z-index")
|
||||
|
||||
HTML_ATOM(moz_tristate, "moz-tristate")
|
||||
HTML_ATOM(moz_tristatevalue, "moz-tristatevalue")
|
||||
|
||||
#ifdef DEBUG
|
||||
HTML_ATOM(iform, "IForm")
|
||||
HTML_ATOM(form_control_list, "FormControlList")
|
||||
#endif
|
||||
54
mozilla/content/shared/public/nsHTMLAtoms.h
Normal file
54
mozilla/content/shared/public/nsHTMLAtoms.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* -*- 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.org 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 nsHTMLAtoms_h___
|
||||
#define nsHTMLAtoms_h___
|
||||
|
||||
#include "nsIAtom.h"
|
||||
|
||||
#define NS_HTML_BASE_HREF "_base_href"
|
||||
#define NS_HTML_BASE_TARGET "_base_target"
|
||||
|
||||
/**
|
||||
* This class wraps up the creation (and destruction) of the standard
|
||||
* set of html atoms used during normal html handling. This objects
|
||||
* are created when the first html content object is created and they
|
||||
* are destroyed when the last html content object is destroyed.
|
||||
*/
|
||||
class nsHTMLAtoms {
|
||||
public:
|
||||
|
||||
static void AddRefAtoms();
|
||||
static void ReleaseAtoms();
|
||||
|
||||
/* Declare all atoms
|
||||
|
||||
The atom names and values are stored in nsHTMLAtomList.h and
|
||||
are brought to you by the magic of C preprocessing
|
||||
|
||||
Add new atoms to nsHTMLAtomList and all support logic will be auto-generated
|
||||
*/
|
||||
#define HTML_ATOM(_name, _value) static nsIAtom* _name;
|
||||
#include "nsHTMLAtomList.h"
|
||||
#undef HTML_ATOM
|
||||
};
|
||||
|
||||
#endif /* nsHTMLAtoms_h___ */
|
||||
199
mozilla/content/shared/public/nsLayoutAtomList.h
Normal file
199
mozilla/content/shared/public/nsLayoutAtomList.h
Normal file
@@ -0,0 +1,199 @@
|
||||
/* -*- 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/******
|
||||
|
||||
This file contains the list of all layout nsIAtoms and their values
|
||||
|
||||
It is designed to be used as inline input to nsLayoutAtoms.cpp *only*
|
||||
through the magic of C preprocessing.
|
||||
|
||||
All entires must be enclosed in the macro LAYOUT_ATOM which will have cruel
|
||||
and unusual things done to it
|
||||
|
||||
It is recommended (but not strictly necessary) to keep all entries
|
||||
in alphabetical order
|
||||
|
||||
The first argument to LAYOUT_ATOM is the C++ identifier of the atom
|
||||
The second argument is the string value of the atom
|
||||
|
||||
******/
|
||||
|
||||
|
||||
// Alphabetical list of media type atoms
|
||||
LAYOUT_ATOM(all, "all") // Media atoms must be lower case
|
||||
LAYOUT_ATOM(aural, "aural")
|
||||
LAYOUT_ATOM(braille, "braille")
|
||||
LAYOUT_ATOM(embossed, "embossed")
|
||||
LAYOUT_ATOM(handheld, "handheld")
|
||||
LAYOUT_ATOM(print, "print")
|
||||
LAYOUT_ATOM(projection, "projection")
|
||||
LAYOUT_ATOM(screen, "screen")
|
||||
LAYOUT_ATOM(tty, "tty")
|
||||
LAYOUT_ATOM(tv, "tv")
|
||||
|
||||
// Alphabetical list of standard name space prefixes
|
||||
LAYOUT_ATOM(htmlNameSpace, "html")
|
||||
LAYOUT_ATOM(xmlNameSpace, "xml")
|
||||
LAYOUT_ATOM(xmlnsNameSpace, "xmlns")
|
||||
|
||||
// Alphabetical list of frame additional child list names
|
||||
LAYOUT_ATOM(absoluteList, "Absolute-list")
|
||||
LAYOUT_ATOM(bulletList, "Bullet-list")
|
||||
LAYOUT_ATOM(captionList, "Caption-list")
|
||||
LAYOUT_ATOM(colGroupList, "ColGroup-list")
|
||||
LAYOUT_ATOM(editorDisplayList, "EditorDisplay-List")
|
||||
LAYOUT_ATOM(fixedList, "Fixed-list")
|
||||
LAYOUT_ATOM(floaterList, "Floater-list")
|
||||
LAYOUT_ATOM(overflowList, "Overflow-list")
|
||||
LAYOUT_ATOM(popupList, "Popup-list")
|
||||
|
||||
// Alphabetical list of pseudo tag names for non-element content
|
||||
LAYOUT_ATOM(canvasPseudo, ":canvas")
|
||||
LAYOUT_ATOM(commentTagName, "__moz_comment")
|
||||
LAYOUT_ATOM(dummyOptionPseudo, ":-moz-dummy-option")
|
||||
LAYOUT_ATOM(optionSelectedPseudo, "-moz-option-selected")
|
||||
LAYOUT_ATOM(textTagName, "__moz_text")
|
||||
LAYOUT_ATOM(pagePseudo, ":-moz-page")
|
||||
LAYOUT_ATOM(pageSequencePseudo, ":-moz-page-sequence")
|
||||
LAYOUT_ATOM(processingInstructionTagName, "__moz_pi")
|
||||
LAYOUT_ATOM(scrolledContentPseudo, ":scrolled-content")
|
||||
LAYOUT_ATOM(viewportPseudo, ":viewport")
|
||||
LAYOUT_ATOM(viewportScrollPseudo, ":viewport-scroll")
|
||||
LAYOUT_ATOM(selectScrolledContentPseudo, ":-moz-select-scrolled-content")
|
||||
|
||||
// Alphabetical list of frame types
|
||||
LAYOUT_ATOM(areaFrame, "AreaFrame")
|
||||
LAYOUT_ATOM(blockFrame, "BlockFrame")
|
||||
LAYOUT_ATOM(brFrame, "BRFrame")
|
||||
LAYOUT_ATOM(bulletFrame, "BulletFrame")
|
||||
LAYOUT_ATOM(hrFrame, "HRFrame")
|
||||
LAYOUT_ATOM(htmlFrameInnerFrame, "htmlFrameInnerFrame")
|
||||
LAYOUT_ATOM(htmlFrameOuterFrame, "htmlFrameOuterFrame")
|
||||
LAYOUT_ATOM(imageFrame, "ImageFrame")
|
||||
LAYOUT_ATOM(inlineFrame, "InlineFrame")
|
||||
LAYOUT_ATOM(letterFrame, "LetterFrame")
|
||||
LAYOUT_ATOM(lineFrame, "LineFrame")
|
||||
LAYOUT_ATOM(objectFrame, "ObjectFrame")
|
||||
LAYOUT_ATOM(pageFrame, "PageFrame")
|
||||
LAYOUT_ATOM(placeholderFrame, "PlaceholderFrame")
|
||||
LAYOUT_ATOM(positionedInlineFrame, "PositionedInlineFrame")
|
||||
LAYOUT_ATOM(canvasFrame, "CanvasFrame")
|
||||
LAYOUT_ATOM(rootFrame, "RootFrame")
|
||||
LAYOUT_ATOM(scrollFrame, "ScrollFrame")
|
||||
LAYOUT_ATOM(tableCaptionFrame, "TableCaptionFrame")
|
||||
LAYOUT_ATOM(tableCellFrame, "TableCellFrame")
|
||||
LAYOUT_ATOM(tableColFrame, "TableColFrame")
|
||||
LAYOUT_ATOM(tableColGroupFrame, "TableColGroupFrame")
|
||||
LAYOUT_ATOM(tableFrame, "TableFrame")
|
||||
LAYOUT_ATOM(tableOuterFrame, "TableOuterFrame")
|
||||
LAYOUT_ATOM(tableRowGroupFrame, "TableRowGroupFrame")
|
||||
LAYOUT_ATOM(tableRowFrame, "TableRowFrame")
|
||||
LAYOUT_ATOM(textInputFrame,"TextInputFrame")
|
||||
LAYOUT_ATOM(textFrame, "TextFrame")
|
||||
LAYOUT_ATOM(viewportFrame, "ViewportFrame")
|
||||
|
||||
// Alphabetical list of frame property names
|
||||
LAYOUT_ATOM(collapseOffsetProperty, "CollapseOffsetProperty") // nsPoint*
|
||||
LAYOUT_ATOM(inlineFrameAnnotation, "InlineFrameAnnotation") // BOOL
|
||||
LAYOUT_ATOM(maxElementSizeProperty, "MaxElementSizeProperty") // nsSize*
|
||||
LAYOUT_ATOM(overflowAreaProperty, "OverflowArea") // nsRect*
|
||||
LAYOUT_ATOM(overflowProperty, "OverflowProperty") // list of nsIFrame*
|
||||
LAYOUT_ATOM(overflowLinesProperty, "OverflowLinesProperty") // list of nsLineBox*
|
||||
LAYOUT_ATOM(spaceManagerProperty, "SpaceManagerProperty") // the space manager for a block
|
||||
LAYOUT_ATOM(viewProperty, "ViewProperty") // nsView*
|
||||
|
||||
// Alphabetical list of event handler names
|
||||
LAYOUT_ATOM(onabort, "onabort")
|
||||
LAYOUT_ATOM(onblur, "onblur")
|
||||
LAYOUT_ATOM(onbroadcast, "onbroadcast")
|
||||
LAYOUT_ATOM(onchange, "onchange")
|
||||
LAYOUT_ATOM(onclick, "onclick")
|
||||
LAYOUT_ATOM(onclose, "onclose")
|
||||
LAYOUT_ATOM(oncommand, "oncommand")
|
||||
LAYOUT_ATOM(oncommandupdate, "oncommandupdate")
|
||||
LAYOUT_ATOM(oncreate, "oncreate")
|
||||
LAYOUT_ATOM(ondblclick, "ondblclick")
|
||||
LAYOUT_ATOM(ondestroy, "ondestroy")
|
||||
LAYOUT_ATOM(ondragdrop, "ondragdrop")
|
||||
LAYOUT_ATOM(ondragenter, "ondragenter")
|
||||
LAYOUT_ATOM(ondragexit, "ondragexit")
|
||||
LAYOUT_ATOM(ondraggesture, "ondraggesture")
|
||||
LAYOUT_ATOM(ondragover, "ondragover")
|
||||
LAYOUT_ATOM(onerror, "onerror")
|
||||
LAYOUT_ATOM(onfocus, "onfocus")
|
||||
LAYOUT_ATOM(oninput, "oninput")
|
||||
LAYOUT_ATOM(onkeydown, "onkeydown")
|
||||
LAYOUT_ATOM(onkeypress, "onkeypress")
|
||||
LAYOUT_ATOM(onkeyup, "onkeyup")
|
||||
LAYOUT_ATOM(onload, "onload")
|
||||
LAYOUT_ATOM(onmousedown, "onmousedown")
|
||||
LAYOUT_ATOM(onmousemove, "onmousemove")
|
||||
LAYOUT_ATOM(onmouseover, "onmouseover")
|
||||
LAYOUT_ATOM(onmouseout, "onmouseout")
|
||||
LAYOUT_ATOM(onmouseup, "onmouseup")
|
||||
LAYOUT_ATOM(onpaint, "onpaint")
|
||||
LAYOUT_ATOM(onreset, "onreset")
|
||||
LAYOUT_ATOM(onresize, "onresize")
|
||||
LAYOUT_ATOM(onscroll, "onscroll")
|
||||
LAYOUT_ATOM(onselect, "onselect")
|
||||
LAYOUT_ATOM(onsubmit, "onsubmit")
|
||||
LAYOUT_ATOM(onunload, "onunload")
|
||||
|
||||
// scrolling
|
||||
LAYOUT_ATOM(onoverflow, "onoverflow")
|
||||
LAYOUT_ATOM(onunderflow, "onunderflow")
|
||||
LAYOUT_ATOM(onoverflowchanged, "onoverflowchanged")
|
||||
|
||||
// mutation events
|
||||
LAYOUT_ATOM(onDOMSubtreeModified, "onDOMSubtreeModified")
|
||||
LAYOUT_ATOM(onDOMNodeInserted, "onDOMNodeInserted")
|
||||
LAYOUT_ATOM(onDOMNodeRemoved, "onDOMNodeRemoved")
|
||||
LAYOUT_ATOM(onDOMNodeRemovedFromDocument, "onDOMNodeRemovedFromDocument")
|
||||
LAYOUT_ATOM(onDOMNodeInsertedIntoDocument, "onDOMNodeInsertedIntoDocument")
|
||||
LAYOUT_ATOM(onDOMAttrModified, "onDOMAttrModified")
|
||||
LAYOUT_ATOM(onDOMCharacterDataModified, "onDOMCharacterDataModified")
|
||||
|
||||
// Alphabetical list of languages for lang-specific transforms
|
||||
LAYOUT_ATOM(Japanese, "ja")
|
||||
LAYOUT_ATOM(Korean, "ko")
|
||||
|
||||
// other
|
||||
LAYOUT_ATOM(wildcard, "*")
|
||||
LAYOUT_ATOM(mozdirty, "_moz_dirty")
|
||||
|
||||
#ifdef DEBUG
|
||||
// Alphabetical list of atoms used by debugging code
|
||||
LAYOUT_ATOM(cellMap, "TableCellMap")
|
||||
LAYOUT_ATOM(imageMap, "ImageMap")
|
||||
LAYOUT_ATOM(lineBoxBig, "LineBox:inline,big")
|
||||
LAYOUT_ATOM(lineBoxBlockBig, "LineBox:block,big")
|
||||
LAYOUT_ATOM(lineBoxBlockSmall, "LineBox:block,small")
|
||||
LAYOUT_ATOM(lineBoxFloaters, "LineBoxFloaters")
|
||||
LAYOUT_ATOM(lineBoxSmall, "LineBox:inline,small")
|
||||
LAYOUT_ATOM(spaceManager, "SpaceManager")
|
||||
LAYOUT_ATOM(tableColCache, "TableColumnCache")
|
||||
LAYOUT_ATOM(tableStrategy, "TableLayoutStrategy")
|
||||
LAYOUT_ATOM(textRun, "TextRun")
|
||||
LAYOUT_ATOM(xml_document_entities, "XMLDocumentEntities")
|
||||
LAYOUT_ATOM(xml_document_notations, "XMLDocumentNotations")
|
||||
#endif
|
||||
52
mozilla/content/shared/public/nsLayoutAtoms.h
Normal file
52
mozilla/content/shared/public/nsLayoutAtoms.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* -*- 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.org 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 nsLayoutAtoms_h___
|
||||
#define nsLayoutAtoms_h___
|
||||
|
||||
#include "nsIAtom.h"
|
||||
|
||||
/**
|
||||
* This class wraps up the creation (and destruction) of the standard
|
||||
* set of atoms used during layout processing. These objects
|
||||
* are created when the first presentation context is created and they
|
||||
* are destroyed when the last presentation context object is destroyed.
|
||||
*/
|
||||
|
||||
class nsLayoutAtoms {
|
||||
public:
|
||||
|
||||
static void AddRefAtoms();
|
||||
static void ReleaseAtoms();
|
||||
|
||||
/* Declare all atoms
|
||||
|
||||
The atom names and values are stored in nsLayoutAtomList.h and
|
||||
are brought to you by the magic of C preprocessing
|
||||
|
||||
Add new atoms to nsLayoutAtomList and all support logic will be auto-generated
|
||||
*/
|
||||
#define LAYOUT_ATOM(_name, _value) static nsIAtom* _name;
|
||||
#include "nsLayoutAtomList.h"
|
||||
#undef LAYOUT_ATOM
|
||||
};
|
||||
|
||||
#endif /* nsLayoutAtoms_h___ */
|
||||
458
mozilla/content/shared/public/nsStyleCoord.h
Normal file
458
mozilla/content/shared/public/nsStyleCoord.h
Normal file
@@ -0,0 +1,458 @@
|
||||
/* -*- 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.org 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 nsStyleCoord_h___
|
||||
#define nsStyleCoord_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsString.h"
|
||||
|
||||
enum nsStyleUnit {
|
||||
eStyleUnit_Null = 0, // (no value) value is not specified
|
||||
eStyleUnit_Normal = 1, // (no value)
|
||||
eStyleUnit_Auto = 2, // (no value)
|
||||
eStyleUnit_Inherit = 3, // (no value) value should be inherited
|
||||
eStyleUnit_Percent = 10, // (float) 1.0 == 100%
|
||||
eStyleUnit_Factor = 11, // (float) a multiplier
|
||||
eStyleUnit_Coord = 20, // (nscoord) value is twips
|
||||
eStyleUnit_Integer = 30, // (int) value is simple integer
|
||||
eStyleUnit_Proportional = 31, // (int) value has proportional meaning
|
||||
eStyleUnit_Enumerated = 32, // (int) value has enumerated meaning
|
||||
eStyleUnit_Chars = 33 // (int) value is number of characters
|
||||
};
|
||||
|
||||
typedef union {
|
||||
PRInt32 mInt; // nscoord is a PRInt32 for now
|
||||
float mFloat;
|
||||
} nsStyleUnion;
|
||||
|
||||
class nsStyleCoord {
|
||||
public:
|
||||
nsStyleCoord(nsStyleUnit aUnit = eStyleUnit_Null)
|
||||
: mUnit(aUnit) {
|
||||
NS_ASSERTION(aUnit < eStyleUnit_Percent, "not a valueless unit");
|
||||
if (aUnit >= eStyleUnit_Percent) {
|
||||
mUnit = eStyleUnit_Null;
|
||||
}
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
|
||||
nsStyleCoord(nscoord aValue)
|
||||
: mUnit(eStyleUnit_Coord) {
|
||||
mValue.mInt = aValue;
|
||||
}
|
||||
|
||||
nsStyleCoord(PRInt32 aValue, nsStyleUnit aUnit)
|
||||
: mUnit(aUnit) {
|
||||
//if you want to pass in eStyleUnit_Coord, don't. instead, use the
|
||||
//constructor just above this one... MMP
|
||||
NS_ASSERTION((aUnit == eStyleUnit_Proportional) ||
|
||||
(aUnit == eStyleUnit_Enumerated) ||
|
||||
(aUnit == eStyleUnit_Integer), "not an int value");
|
||||
if ((aUnit == eStyleUnit_Proportional) ||
|
||||
(aUnit == eStyleUnit_Enumerated) ||
|
||||
(aUnit == eStyleUnit_Integer)) {
|
||||
mValue.mInt = aValue;
|
||||
}
|
||||
else {
|
||||
mUnit = eStyleUnit_Null;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
nsStyleCoord(float aValue, nsStyleUnit aUnit)
|
||||
: mUnit(aUnit) {
|
||||
NS_ASSERTION((aUnit == eStyleUnit_Percent) ||
|
||||
(aUnit == eStyleUnit_Factor), "not a float value");
|
||||
if ((aUnit == eStyleUnit_Percent) ||
|
||||
(aUnit == eStyleUnit_Factor)) {
|
||||
mValue.mFloat = aValue;
|
||||
}
|
||||
else {
|
||||
mUnit = eStyleUnit_Null;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
nsStyleCoord(const nsStyleCoord& aCopy)
|
||||
: mUnit(aCopy.mUnit) {
|
||||
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
|
||||
mValue.mFloat = aCopy.mValue.mFloat;
|
||||
}
|
||||
else {
|
||||
mValue.mInt = aCopy.mValue.mInt;
|
||||
}
|
||||
}
|
||||
|
||||
nsStyleCoord& operator=(const nsStyleCoord& aCopy) {
|
||||
mUnit = aCopy.mUnit;
|
||||
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
|
||||
mValue.mFloat = aCopy.mValue.mFloat;
|
||||
}
|
||||
else {
|
||||
mValue.mInt = aCopy.mValue.mInt;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
PRBool operator==(const nsStyleCoord& aOther) const {
|
||||
if (mUnit == aOther.mUnit) {
|
||||
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
|
||||
return PRBool(mValue.mFloat == aOther.mValue.mFloat);
|
||||
}
|
||||
else {
|
||||
return PRBool(mValue.mInt == aOther.mValue.mInt);
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool operator!=(const nsStyleCoord& aOther) const;
|
||||
|
||||
nsStyleUnit GetUnit(void) const { return mUnit; }
|
||||
nscoord GetCoordValue(void) const;
|
||||
PRInt32 GetIntValue(void) const;
|
||||
float GetPercentValue(void) const;
|
||||
float GetFactorValue(void) const;
|
||||
void GetUnionValue(nsStyleUnion& aValue) const;
|
||||
|
||||
void Reset(void) {
|
||||
mUnit = eStyleUnit_Null;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
|
||||
void SetCoordValue(nscoord aValue) {
|
||||
mUnit = eStyleUnit_Coord;
|
||||
mValue.mInt = aValue;
|
||||
}
|
||||
|
||||
void SetIntValue(PRInt32 aValue, nsStyleUnit aUnit) {
|
||||
if ((aUnit == eStyleUnit_Proportional) ||
|
||||
(aUnit == eStyleUnit_Enumerated) ||
|
||||
(aUnit == eStyleUnit_Chars) ||
|
||||
(aUnit == eStyleUnit_Integer)) {
|
||||
mUnit = aUnit;
|
||||
mValue.mInt = aValue;
|
||||
}
|
||||
else {
|
||||
NS_WARNING("not an int value");
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
|
||||
void SetPercentValue(float aValue) {
|
||||
mUnit = eStyleUnit_Percent;
|
||||
mValue.mFloat = aValue;
|
||||
}
|
||||
|
||||
void SetFactorValue(float aValue) {
|
||||
mUnit = eStyleUnit_Factor;
|
||||
mValue.mFloat = aValue;
|
||||
}
|
||||
|
||||
void SetNormalValue(void) {
|
||||
mUnit = eStyleUnit_Normal;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
|
||||
void SetAutoValue(void) {
|
||||
mUnit = eStyleUnit_Auto;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
|
||||
void SetInheritValue(void) {
|
||||
mUnit = eStyleUnit_Inherit;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
|
||||
void SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit) {
|
||||
mUnit = aUnit;
|
||||
#if PR_BYTES_PER_INT == PR_BYTES_PER_FLOAT
|
||||
mValue.mInt = aValue.mInt;
|
||||
#else
|
||||
nsCRT::memcpy(&mValue, &aValue, sizeof(nsStyleUnion));
|
||||
#endif
|
||||
}
|
||||
|
||||
void AppendToString(nsString& aBuffer) const {
|
||||
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
|
||||
aBuffer.AppendFloat(mValue.mFloat);
|
||||
}
|
||||
else if ((eStyleUnit_Coord == mUnit) ||
|
||||
(eStyleUnit_Proportional == mUnit) ||
|
||||
(eStyleUnit_Enumerated == mUnit) ||
|
||||
(eStyleUnit_Integer == mUnit)) {
|
||||
aBuffer.AppendInt(mValue.mInt, 10);
|
||||
aBuffer.AppendWithConversion("[0x");
|
||||
aBuffer.AppendInt(mValue.mInt, 16);
|
||||
aBuffer.AppendWithConversion(']');
|
||||
}
|
||||
|
||||
switch (mUnit) {
|
||||
case eStyleUnit_Null: aBuffer.AppendWithConversion("Null"); break;
|
||||
case eStyleUnit_Coord: aBuffer.AppendWithConversion("tw"); break;
|
||||
case eStyleUnit_Percent: aBuffer.AppendWithConversion("%"); break;
|
||||
case eStyleUnit_Factor: aBuffer.AppendWithConversion("f"); break;
|
||||
case eStyleUnit_Normal: aBuffer.AppendWithConversion("Normal"); break;
|
||||
case eStyleUnit_Auto: aBuffer.AppendWithConversion("Auto"); break;
|
||||
case eStyleUnit_Inherit: aBuffer.AppendWithConversion("Inherit"); break;
|
||||
case eStyleUnit_Proportional: aBuffer.AppendWithConversion("*"); break;
|
||||
case eStyleUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break;
|
||||
case eStyleUnit_Integer: aBuffer.AppendWithConversion("int"); break;
|
||||
case eStyleUnit_Chars: aBuffer.AppendWithConversion("chars"); break;
|
||||
}
|
||||
aBuffer.AppendWithConversion(' ');
|
||||
}
|
||||
|
||||
void ToString(nsString& aBuffer) const {
|
||||
aBuffer.Truncate();
|
||||
AppendToString(aBuffer);
|
||||
}
|
||||
|
||||
public:
|
||||
nsStyleUnit mUnit;
|
||||
nsStyleUnion mValue;
|
||||
};
|
||||
|
||||
|
||||
#define COMPARE_SIDE(side) \
|
||||
if ((eStyleUnit_Percent <= m##side##Unit) && \
|
||||
(m##side##Unit < eStyleUnit_Coord)) { \
|
||||
if (m##side##Value.mFloat != aOther.m##side##Value.mFloat) \
|
||||
return PR_FALSE; \
|
||||
} \
|
||||
else { \
|
||||
if (m##side##Value.mInt != aOther.m##side##Value.mInt) \
|
||||
return PR_FALSE; \
|
||||
}
|
||||
|
||||
class nsStyleSides {
|
||||
public:
|
||||
nsStyleSides(void) {
|
||||
nsCRT::memset(this, 0x00, sizeof(nsStyleSides));
|
||||
}
|
||||
|
||||
// nsStyleSides& operator=(const nsStyleSides& aCopy); // use compiler's version
|
||||
PRBool operator==(const nsStyleSides& aOther) const {
|
||||
if ((mLeftUnit == aOther.mLeftUnit) &&
|
||||
(mTopUnit == aOther.mTopUnit) &&
|
||||
(mRightUnit == aOther.mRightUnit) &&
|
||||
(mBottomUnit == aOther.mBottomUnit)) {
|
||||
COMPARE_SIDE(Left);
|
||||
COMPARE_SIDE(Top);
|
||||
COMPARE_SIDE(Right);
|
||||
COMPARE_SIDE(Bottom);
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool operator!=(const nsStyleSides& aOther) const;
|
||||
|
||||
nsStyleUnit GetLeftUnit(void) const;
|
||||
nsStyleUnit GetTopUnit(void) const;
|
||||
nsStyleUnit GetRightUnit(void) const;
|
||||
nsStyleUnit GetBottomUnit(void) const;
|
||||
|
||||
nsStyleCoord& GetLeft(nsStyleCoord& aCoord) const;
|
||||
nsStyleCoord& GetTop(nsStyleCoord& aCoord) const;
|
||||
nsStyleCoord& GetRight(nsStyleCoord& aCoord) const;
|
||||
nsStyleCoord& GetBottom(nsStyleCoord& aCoord) const;
|
||||
|
||||
void Reset(void) {
|
||||
nsCRT::memset(this, 0x00, sizeof(nsStyleSides));
|
||||
}
|
||||
|
||||
void SetLeft(const nsStyleCoord& aCoord);
|
||||
void SetTop(const nsStyleCoord& aCoord);
|
||||
void SetRight(const nsStyleCoord& aCoord);
|
||||
void SetBottom(const nsStyleCoord& aCoord);
|
||||
|
||||
void AppendToString(nsString& aBuffer) const {
|
||||
nsStyleCoord temp;
|
||||
|
||||
GetLeft(temp);
|
||||
aBuffer.AppendWithConversion("left: ");
|
||||
temp.AppendToString(aBuffer);
|
||||
|
||||
GetTop(temp);
|
||||
aBuffer.AppendWithConversion("top: ");
|
||||
temp.AppendToString(aBuffer);
|
||||
|
||||
GetRight(temp);
|
||||
aBuffer.AppendWithConversion("right: ");
|
||||
temp.AppendToString(aBuffer);
|
||||
|
||||
GetBottom(temp);
|
||||
aBuffer.AppendWithConversion("bottom: ");
|
||||
temp.AppendToString(aBuffer);
|
||||
}
|
||||
|
||||
void ToString(nsString& aBuffer) const {
|
||||
aBuffer.Truncate();
|
||||
AppendToString(aBuffer);
|
||||
}
|
||||
|
||||
protected:
|
||||
PRUint8 mLeftUnit;
|
||||
PRUint8 mTopUnit;
|
||||
PRUint8 mRightUnit;
|
||||
PRUint8 mBottomUnit;
|
||||
nsStyleUnion mLeftValue;
|
||||
nsStyleUnion mTopValue;
|
||||
nsStyleUnion mRightValue;
|
||||
nsStyleUnion mBottomValue;
|
||||
};
|
||||
|
||||
// -------------------------
|
||||
// nsStyleCoord inlines
|
||||
//
|
||||
inline PRBool nsStyleCoord::operator!=(const nsStyleCoord& aOther) const
|
||||
{
|
||||
return PRBool(! ((*this) == aOther));
|
||||
}
|
||||
|
||||
inline PRInt32 nsStyleCoord::GetCoordValue(void) const
|
||||
{
|
||||
NS_ASSERTION((mUnit == eStyleUnit_Coord), "not a coord value");
|
||||
if (mUnit == eStyleUnit_Coord) {
|
||||
return mValue.mInt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline PRInt32 nsStyleCoord::GetIntValue(void) const
|
||||
{
|
||||
NS_ASSERTION((mUnit == eStyleUnit_Proportional) ||
|
||||
(mUnit == eStyleUnit_Enumerated) ||
|
||||
(mUnit == eStyleUnit_Chars) ||
|
||||
(mUnit == eStyleUnit_Integer), "not an int value");
|
||||
if ((mUnit == eStyleUnit_Proportional) ||
|
||||
(mUnit == eStyleUnit_Enumerated) ||
|
||||
(mUnit == eStyleUnit_Chars) ||
|
||||
(mUnit == eStyleUnit_Integer)) {
|
||||
return mValue.mInt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline float nsStyleCoord::GetPercentValue(void) const
|
||||
{
|
||||
NS_ASSERTION(mUnit == eStyleUnit_Percent, "not a percent value");
|
||||
if (mUnit == eStyleUnit_Percent) {
|
||||
return mValue.mFloat;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline float nsStyleCoord::GetFactorValue(void) const
|
||||
{
|
||||
NS_ASSERTION(mUnit == eStyleUnit_Factor, "not a factor value");
|
||||
if (mUnit == eStyleUnit_Factor) {
|
||||
return mValue.mFloat;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline void nsStyleCoord::GetUnionValue(nsStyleUnion& aValue) const
|
||||
{
|
||||
nsCRT::memcpy(&aValue, &mValue, sizeof(nsStyleUnion));
|
||||
}
|
||||
|
||||
// -------------------------
|
||||
// nsStyleSides inlines
|
||||
//
|
||||
inline PRBool nsStyleSides::operator!=(const nsStyleSides& aOther) const
|
||||
{
|
||||
return PRBool(! ((*this) == aOther));
|
||||
}
|
||||
|
||||
inline nsStyleUnit nsStyleSides::GetLeftUnit(void) const
|
||||
{
|
||||
return (nsStyleUnit)mLeftUnit;
|
||||
}
|
||||
|
||||
inline nsStyleUnit nsStyleSides::GetTopUnit(void) const
|
||||
{
|
||||
return (nsStyleUnit)mTopUnit;
|
||||
}
|
||||
|
||||
inline nsStyleUnit nsStyleSides::GetRightUnit(void) const
|
||||
{
|
||||
return (nsStyleUnit)mRightUnit;
|
||||
}
|
||||
|
||||
inline nsStyleUnit nsStyleSides::GetBottomUnit(void) const
|
||||
{
|
||||
return (nsStyleUnit)mBottomUnit;
|
||||
}
|
||||
|
||||
inline nsStyleCoord& nsStyleSides::GetLeft(nsStyleCoord& aCoord) const
|
||||
{
|
||||
aCoord.SetUnionValue(mLeftValue, (nsStyleUnit)mLeftUnit);
|
||||
return aCoord;
|
||||
}
|
||||
|
||||
inline nsStyleCoord& nsStyleSides::GetTop(nsStyleCoord& aCoord) const
|
||||
{
|
||||
aCoord.SetUnionValue(mTopValue, (nsStyleUnit)mTopUnit);
|
||||
return aCoord;
|
||||
}
|
||||
|
||||
inline nsStyleCoord& nsStyleSides::GetRight(nsStyleCoord& aCoord) const
|
||||
{
|
||||
aCoord.SetUnionValue(mRightValue, (nsStyleUnit)mRightUnit);
|
||||
return aCoord;
|
||||
}
|
||||
|
||||
inline nsStyleCoord& nsStyleSides::GetBottom(nsStyleCoord& aCoord) const
|
||||
{
|
||||
aCoord.SetUnionValue(mBottomValue, (nsStyleUnit)mBottomUnit);
|
||||
return aCoord;
|
||||
}
|
||||
|
||||
inline void nsStyleSides::SetLeft(const nsStyleCoord& aCoord)
|
||||
{
|
||||
mLeftUnit = aCoord.GetUnit();
|
||||
aCoord.GetUnionValue(mLeftValue);
|
||||
}
|
||||
|
||||
inline void nsStyleSides::SetTop(const nsStyleCoord& aCoord)
|
||||
{
|
||||
mTopUnit = aCoord.GetUnit();
|
||||
aCoord.GetUnionValue(mTopValue);
|
||||
}
|
||||
|
||||
inline void nsStyleSides::SetRight(const nsStyleCoord& aCoord)
|
||||
{
|
||||
mRightUnit = aCoord.GetUnit();
|
||||
aCoord.GetUnionValue(mRightValue);
|
||||
}
|
||||
|
||||
inline void nsStyleSides::SetBottom(const nsStyleCoord& aCoord)
|
||||
{
|
||||
mBottomUnit = aCoord.GetUnit();
|
||||
aCoord.GetUnionValue(mBottomValue);
|
||||
}
|
||||
|
||||
#endif /* nsStyleCoord_h___ */
|
||||
207
mozilla/content/shared/public/nsXULAtomList.h
Normal file
207
mozilla/content/shared/public/nsXULAtomList.h
Normal file
@@ -0,0 +1,207 @@
|
||||
/* -*- 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/******
|
||||
|
||||
This file contains the list of all XUL nsIAtoms and their values
|
||||
|
||||
It is designed to be used as inline input to nsXULAtoms.cpp *only*
|
||||
through the magic of C preprocessing.
|
||||
|
||||
All entires must be enclosed in the macro XUL_ATOM which will have cruel
|
||||
and unusual things done to it
|
||||
|
||||
It is recommended (but not strictly necessary) to keep all entries
|
||||
in alphabetical order
|
||||
|
||||
The first argument to XUL_ATOM is the C++ identifier of the atom
|
||||
The second argument is the string value of the atom
|
||||
|
||||
******/
|
||||
|
||||
|
||||
XUL_ATOM(button, "button")
|
||||
XUL_ATOM(spinner, "spinner")
|
||||
XUL_ATOM(scrollbar, "scrollbar")
|
||||
XUL_ATOM(slider, "slider")
|
||||
XUL_ATOM(palettename, "palettename")
|
||||
XUL_ATOM(fontpicker, "fontpicker")
|
||||
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
|
||||
XUL_ATOM(treecaption, "treecaption") // The caption of a tree view
|
||||
XUL_ATOM(treehead, "treehead") // The header of the tree view
|
||||
XUL_ATOM(treerow, "treerow") // A row in the tree view
|
||||
XUL_ATOM(treerows, "treerows") // A row in the tree view
|
||||
XUL_ATOM(treecell, "treecell") // An item in the tree view
|
||||
XUL_ATOM(treeitem, "treeitem") // A cell in the tree view
|
||||
XUL_ATOM(treechildren, "treechildren") // The children of an item in the tree view
|
||||
XUL_ATOM(treeindentation, "treeindentation") // Specifies that the indentation for the level should occur here.
|
||||
XUL_ATOM(allowevents, "allowevents") // Lets events be handled on the cell contents or in menus.
|
||||
XUL_ATOM(treecol, "treecol") // A column in the tree view
|
||||
XUL_ATOM(treecolgroup, "treecolgroup") // A column group in the tree view
|
||||
XUL_ATOM(treecols, "treecols") // A column group in the tree view
|
||||
XUL_ATOM(treefoot, "treefoot") // The footer of the tree view
|
||||
XUL_ATOM(scrollbarlist, "scrollbarlist") // An atom for internal use by the tree view
|
||||
XUL_ATOM(indent, "indent") // indicates that a cell should be indented
|
||||
XUL_ATOM(outer, "outer") // indicates that a treechildren is the outermost rowgroup
|
||||
XUL_ATOM(sizemode, "sizemode") // when set, measure strings to determine preferred width
|
||||
|
||||
XUL_ATOM(open, "open") // Whether or not a menu, tree, etc. is open
|
||||
|
||||
XUL_ATOM(outliner, "outliner")
|
||||
XUL_ATOM(outlinerbody, "outlinerbody")
|
||||
XUL_ATOM(outlinercol, "outlinercol")
|
||||
XUL_ATOM(cycler, "cycler")
|
||||
XUL_ATOM(primary, "primary")
|
||||
XUL_ATOM(current, "current")
|
||||
XUL_ATOM(mozoutlinerrow, ":-moz-outliner-row")
|
||||
XUL_ATOM(mozoutlinercell, ":-moz-outliner-cell")
|
||||
XUL_ATOM(mozoutlinercolumn, ":-moz-outliner-column")
|
||||
XUL_ATOM(mozoutlinercelltext, ":-moz-outliner-cell-text")
|
||||
XUL_ATOM(mozoutlinertwisty, ":-moz-outliner-twisty")
|
||||
XUL_ATOM(mozoutlinerindentation, ":-moz-outliner-indentation")
|
||||
|
||||
XUL_ATOM(menubar, "menubar") // An XP menu bar.
|
||||
XUL_ATOM(menu, "menu") // Represents an XP menu
|
||||
XUL_ATOM(menuitem, "menuitem") // Represents an XP menu item
|
||||
XUL_ATOM(menupopup, "menupopup") // The XP menu's children.
|
||||
XUL_ATOM(menutobedisplayed, "menutobedisplayed") // The menu is about to be displayed at the next sync w/ frame
|
||||
XUL_ATOM(menuactive, "menuactive") // Whether or not a menu is active (without necessarily being open)
|
||||
XUL_ATOM(accesskey, "accesskey") // The shortcut key for a menu or menu item
|
||||
XUL_ATOM(acceltext, "acceltext") // Text to use for the accelerator
|
||||
XUL_ATOM(popupset, "popupset") // Contains popup menus, context menus, and tooltips
|
||||
XUL_ATOM(popup, "popup") // The popup for a context menu, popup menu, or tooltip
|
||||
XUL_ATOM(menugenerated, "menugenerated") // Internal
|
||||
XUL_ATOM(popupanchor, "popupanchor") // Anchor for popups
|
||||
XUL_ATOM(popupalign, "popupalign") // Alignment for popups
|
||||
XUL_ATOM(ignorekeys, "ignorekeys") // Alignment for popups
|
||||
XUL_ATOM(sizetopopup, "sizetopopup") // Whether or not menus size to their popup children (used by menulists)
|
||||
|
||||
XUL_ATOM(key, "key") // The key element / attribute
|
||||
XUL_ATOM(keycode, "keycode") // The keycode attribute
|
||||
XUL_ATOM(keytext, "keytext") // The keytext attribute
|
||||
XUL_ATOM(modifiers, "modifiers") // The modifiers attribute
|
||||
XUL_ATOM(broadcaster, "broadcaster") // A broadcaster
|
||||
XUL_ATOM(observes, "observes") // The observes element
|
||||
XUL_ATOM(templateAtom, "template") // A XUL template
|
||||
|
||||
XUL_ATOM(progressbar, "progressbar")
|
||||
XUL_ATOM(crop, "crop")
|
||||
|
||||
XUL_ATOM(mode, "mode")
|
||||
XUL_ATOM(equalsize, "equalsize")
|
||||
XUL_ATOM(box, "box")
|
||||
XUL_ATOM(hbox, "hbox")
|
||||
XUL_ATOM(vbox, "vbox")
|
||||
XUL_ATOM(scrollbox, "scrollbox")
|
||||
XUL_ATOM(mousethrough, "mousethrough")
|
||||
XUL_ATOM(flex, "flex")
|
||||
XUL_ATOM(spring, "spring")
|
||||
XUL_ATOM(orient, "orient")
|
||||
XUL_ATOM(autostretch, "autostretch")
|
||||
XUL_ATOM(minwidth, "min-width")
|
||||
XUL_ATOM(minheight, "min-height")
|
||||
|
||||
XUL_ATOM(autorepeatbutton, "autorepeatbutton")
|
||||
|
||||
XUL_ATOM(bulletinboard, "bulletinboard")
|
||||
|
||||
XUL_ATOM(titledbox, "titledbox")
|
||||
XUL_ATOM(title, "title")
|
||||
XUL_ATOM(titledboxContentPseudo, ":titledbox-content")
|
||||
|
||||
XUL_ATOM(stack, "stack")
|
||||
XUL_ATOM(deck, "deck")
|
||||
XUL_ATOM(tabcontrol, "tabcontrol")
|
||||
XUL_ATOM(tab, "tab")
|
||||
XUL_ATOM(tabpanel, "tabpanel")
|
||||
XUL_ATOM(tabpage, "tabpage")
|
||||
XUL_ATOM(tabbox, "tabbox")
|
||||
XUL_ATOM(index, "index")
|
||||
XUL_ATOM(maxpos, "maxpos")
|
||||
XUL_ATOM(curpos, "curpos")
|
||||
XUL_ATOM(scrollbarbutton, "scrollbarbutton")
|
||||
XUL_ATOM(increment, "increment")
|
||||
XUL_ATOM(pageincrement, "pageincrement")
|
||||
XUL_ATOM(thumb, "thumb")
|
||||
XUL_ATOM(toggled, "toggled")
|
||||
XUL_ATOM(grippy, "grippy")
|
||||
XUL_ATOM(splitter, "splitter")
|
||||
XUL_ATOM(collapse, "collapse")
|
||||
XUL_ATOM(collapsed, "collapsed")
|
||||
XUL_ATOM(resizebefore, "resizebefore")
|
||||
XUL_ATOM(resizeafter, "resizeafter")
|
||||
XUL_ATOM(state, "state")
|
||||
XUL_ATOM(debug, "debug")
|
||||
|
||||
XUL_ATOM(fixed, "fixed")
|
||||
|
||||
// grid
|
||||
XUL_ATOM(grid, "grid")
|
||||
XUL_ATOM(rows, "rows")
|
||||
XUL_ATOM(columns, "columns")
|
||||
XUL_ATOM(row, "row")
|
||||
XUL_ATOM(column, "column")
|
||||
|
||||
// toolbar & toolbar d&d atoms
|
||||
XUL_ATOM(ddDropLocation, "dd-droplocation")
|
||||
XUL_ATOM(ddDropLocationCoord, "dd-droplocationcoord")
|
||||
XUL_ATOM(ddDropOn, "dd-dropon")
|
||||
XUL_ATOM(ddTriggerRepaintSorted, "dd-triggerrepaintsorted")
|
||||
XUL_ATOM(ddTriggerRepaintRestore, "dd-triggerrepaintrestore")
|
||||
XUL_ATOM(ddTriggerRepaint, "dd-triggerrepaint")
|
||||
XUL_ATOM(ddNoDropBetweenRows, "dd-nodropbetweenrows")
|
||||
XUL_ATOM(container, "container")
|
||||
XUL_ATOM(ddDragDropArea, "dragdroparea")
|
||||
XUL_ATOM(ddDropMarker, ":-moz-drop-marker")
|
||||
|
||||
XUL_ATOM(widget, "widget")
|
||||
XUL_ATOM(window, "window")
|
||||
|
||||
XUL_ATOM(iframe, "iframe")
|
||||
XUL_ATOM(browser, "browser")
|
||||
XUL_ATOM(editor, "editor")
|
||||
|
||||
//
|
||||
|
||||
XUL_ATOM(checkbox, "checkbox")
|
||||
XUL_ATOM(radio, "radio")
|
||||
XUL_ATOM(radiogroup, "radiogroup")
|
||||
XUL_ATOM(menulist, "menulist")
|
||||
XUL_ATOM(menubutton, "menubutton")
|
||||
XUL_ATOM(textfield, "textfield")
|
||||
XUL_ATOM(textarea, "textarea")
|
||||
XUL_ATOM(listbox, "listbox")
|
||||
|
||||
XUL_ATOM(blankrow, "blankrow")
|
||||
XUL_ATOM(titlebar, "titlebar")
|
||||
XUL_ATOM(resizer, "resizer")
|
||||
XUL_ATOM(dir, "dir")
|
||||
|
||||
60
mozilla/content/shared/public/nsXULAtoms.h
Normal file
60
mozilla/content/shared/public/nsXULAtoms.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* -*- 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.org 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.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsXULAtoms_h___
|
||||
#define nsXULAtoms_h___
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
class nsINameSpaceManager;
|
||||
|
||||
/**
|
||||
* This class wraps up the creation and destruction of the standard
|
||||
* set of xul atoms used during normal xul handling. This object
|
||||
* is created when the first xul content object is created, and
|
||||
* destroyed when the last such content object is destroyed.
|
||||
*/
|
||||
class nsXULAtoms {
|
||||
public:
|
||||
|
||||
static void AddRefAtoms();
|
||||
static void ReleaseAtoms();
|
||||
|
||||
// XUL namespace ID, good for the life of the nsXULAtoms object
|
||||
static PRInt32 nameSpaceID;
|
||||
|
||||
/* Declare all atoms
|
||||
|
||||
The atom names and values are stored in nsCSSAtomList.h and
|
||||
are brought to you by the magic of C preprocessing
|
||||
|
||||
Add new atoms to nsCSSAtomList and all support logic will be auto-generated
|
||||
*/
|
||||
#define XUL_ATOM(_name, _value) static nsIAtom* _name;
|
||||
#include "nsXULAtomList.h"
|
||||
#undef XUL_ATOM
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsXULAtoms_h___ */
|
||||
52
mozilla/content/shared/src/nsCSSAtoms.cpp
Normal file
52
mozilla/content/shared/src/nsCSSAtoms.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/* -*- 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.org 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):
|
||||
*/
|
||||
#include "nsCSSAtoms.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define CSS_ATOM(_name, _value) nsIAtom* nsCSSAtoms::_name;
|
||||
#include "nsCSSAtomList.h"
|
||||
#undef CSS_ATOM
|
||||
|
||||
|
||||
static nsrefcnt gRefCnt;
|
||||
|
||||
void nsCSSAtoms::AddRefAtoms()
|
||||
{
|
||||
if (0 == gRefCnt++) {
|
||||
// create atoms
|
||||
#define CSS_ATOM(_name, _value) _name = NS_NewAtom(_value);
|
||||
#include "nsCSSAtomList.h"
|
||||
#undef CSS_ATOM
|
||||
}
|
||||
}
|
||||
|
||||
void nsCSSAtoms::ReleaseAtoms()
|
||||
{
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
// release atoms
|
||||
#define CSS_ATOM(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsCSSAtomList.h"
|
||||
#undef CSS_ATOM
|
||||
}
|
||||
}
|
||||
|
||||
103
mozilla/content/shared/src/nsCSSKeywords.cpp
Normal file
103
mozilla/content/shared/src/nsCSSKeywords.cpp
Normal file
@@ -0,0 +1,103 @@
|
||||
/* -*- 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsCSSKeywords.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStaticNameTable.h"
|
||||
|
||||
// define an array of all CSS keywords
|
||||
#define CSS_KEY(_name,_id) #_name,
|
||||
const char* kCSSRawKeywords[] = {
|
||||
#include "nsCSSKeywordList.h"
|
||||
};
|
||||
#undef CSS_KEY
|
||||
|
||||
static PRInt32 gTableRefCount;
|
||||
static nsStaticCaseInsensitiveNameTable* gKeywordTable;
|
||||
|
||||
void
|
||||
nsCSSKeywords::AddRefTable(void)
|
||||
{
|
||||
if (0 == gTableRefCount++) {
|
||||
NS_ASSERTION(!gKeywordTable, "pre existing array!");
|
||||
gKeywordTable = new nsStaticCaseInsensitiveNameTable();
|
||||
if (gKeywordTable) {
|
||||
#ifdef DEBUG
|
||||
{
|
||||
// let's verify the table...
|
||||
for (PRInt32 index = 0; index < eCSSKeyword_COUNT; ++index) {
|
||||
nsCAutoString temp1(kCSSRawKeywords[index]);
|
||||
nsCAutoString temp2(kCSSRawKeywords[index]);
|
||||
temp1.ToLowerCase();
|
||||
NS_ASSERTION(temp1.Equals(temp2), "upper case char in table");
|
||||
NS_ASSERTION(-1 == temp1.FindChar('_'), "underscore char in table");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
gKeywordTable->Init(kCSSRawKeywords, eCSSKeyword_COUNT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSKeywords::ReleaseTable(void)
|
||||
{
|
||||
if (0 == --gTableRefCount) {
|
||||
if (gKeywordTable) {
|
||||
delete gKeywordTable;
|
||||
gKeywordTable = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsCSSKeyword
|
||||
nsCSSKeywords::LookupKeyword(const nsCString& aKeyword)
|
||||
{
|
||||
NS_ASSERTION(gKeywordTable, "no lookup table, needs addref");
|
||||
if (gKeywordTable) {
|
||||
return nsCSSKeyword(gKeywordTable->Lookup(aKeyword));
|
||||
}
|
||||
return eCSSKeyword_UNKNOWN;
|
||||
}
|
||||
|
||||
nsCSSKeyword
|
||||
nsCSSKeywords::LookupKeyword(const nsString& aKeyword)
|
||||
{
|
||||
NS_ASSERTION(gKeywordTable, "no lookup table, needs addref");
|
||||
if (gKeywordTable) {
|
||||
return nsCSSKeyword(gKeywordTable->Lookup(aKeyword));
|
||||
}
|
||||
return eCSSKeyword_UNKNOWN;
|
||||
}
|
||||
|
||||
const nsCString&
|
||||
nsCSSKeywords::GetStringValue(nsCSSKeyword aKeyword)
|
||||
{
|
||||
NS_ASSERTION(gKeywordTable, "no lookup table, needs addref");
|
||||
if (gKeywordTable) {
|
||||
return gKeywordTable->GetStringValue(PRInt32(aKeyword));
|
||||
} else {
|
||||
static nsCString kNullStr;
|
||||
return kNullStr;
|
||||
}
|
||||
}
|
||||
|
||||
1078
mozilla/content/shared/src/nsCSSProps.cpp
Normal file
1078
mozilla/content/shared/src/nsCSSProps.cpp
Normal file
File diff suppressed because it is too large
Load Diff
52
mozilla/content/shared/src/nsHTMLAtoms.cpp
Normal file
52
mozilla/content/shared/src/nsHTMLAtoms.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/* -*- 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.org 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):
|
||||
*/
|
||||
#include "nsHTMLAtoms.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define HTML_ATOM(_name, _value) nsIAtom* nsHTMLAtoms::_name;
|
||||
#include "nsHTMLAtomList.h"
|
||||
#undef HTML_ATOM
|
||||
|
||||
|
||||
static nsrefcnt gRefCnt;
|
||||
|
||||
void nsHTMLAtoms::AddRefAtoms()
|
||||
{
|
||||
if (0 == gRefCnt++) {
|
||||
// create atoms
|
||||
#define HTML_ATOM(_name, _value) _name = NS_NewAtom(_value);
|
||||
#include "nsHTMLAtomList.h"
|
||||
#undef HTML_ATOM
|
||||
}
|
||||
}
|
||||
|
||||
void nsHTMLAtoms::ReleaseAtoms()
|
||||
{
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
// release atoms
|
||||
#define HTML_ATOM(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsHTMLAtomList.h"
|
||||
#undef HTML_ATOM
|
||||
}
|
||||
}
|
||||
|
||||
52
mozilla/content/shared/src/nsLayoutAtoms.cpp
Normal file
52
mozilla/content/shared/src/nsLayoutAtoms.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/* -*- 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.org 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):
|
||||
*/
|
||||
#include "nsLayoutAtoms.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define LAYOUT_ATOM(_name, _value) nsIAtom* nsLayoutAtoms::_name;
|
||||
#include "nsLayoutAtomList.h"
|
||||
#undef LAYOUT_ATOM
|
||||
|
||||
|
||||
static nsrefcnt gRefCnt;
|
||||
|
||||
void nsLayoutAtoms::AddRefAtoms()
|
||||
{
|
||||
if (0 == gRefCnt++) {
|
||||
// create atoms
|
||||
#define LAYOUT_ATOM(_name, _value) _name = NS_NewAtom(_value);
|
||||
#include "nsLayoutAtomList.h"
|
||||
#undef LAYOUT_ATOM
|
||||
}
|
||||
}
|
||||
|
||||
void nsLayoutAtoms::ReleaseAtoms()
|
||||
{
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
// release atoms
|
||||
#define LAYOUT_ATOM(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsLayoutAtomList.h"
|
||||
#undef LAYOUT_ATOM
|
||||
}
|
||||
}
|
||||
|
||||
782
mozilla/content/shared/src/nsStyleUtil.cpp
Normal file
782
mozilla/content/shared/src/nsStyleUtil.cpp
Normal file
@@ -0,0 +1,782 @@
|
||||
/* -*- 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.org 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):
|
||||
* IBM Corp.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsUnitConversion.h"
|
||||
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsIXMLContent.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
#define POSITIVE_SCALE_FACTOR 1.10 /* 10% */
|
||||
#define NEGATIVE_SCALE_FACTOR .90 /* 10% */
|
||||
|
||||
#if DEBUG
|
||||
#define DUMP_FONT_SIZES 0
|
||||
#endif
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Return the scaling percentage given a font scaler
|
||||
* Lifted from layutil.c
|
||||
*/
|
||||
float nsStyleUtil::GetScalingFactor(PRInt32 aScaler)
|
||||
{
|
||||
double scale = 1.0;
|
||||
double mult;
|
||||
PRInt32 count;
|
||||
|
||||
if(aScaler < 0) {
|
||||
count = -aScaler;
|
||||
mult = NEGATIVE_SCALE_FACTOR;
|
||||
}
|
||||
else {
|
||||
count = aScaler;
|
||||
mult = POSITIVE_SCALE_FACTOR;
|
||||
}
|
||||
|
||||
/* use the percentage scaling factor to the power of the pref */
|
||||
while(count--) {
|
||||
scale *= mult;
|
||||
}
|
||||
|
||||
return (float)scale;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static PRBool gNavAlgorithmPref = PR_FALSE;
|
||||
|
||||
static int PR_CALLBACK NavAlgorithmPrefChangedCallback(const char * name, void * closure)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && prefs) {
|
||||
prefs->GetBoolPref(name, &gNavAlgorithmPref);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static PRBool UseNewFontAlgorithm()
|
||||
{
|
||||
static PRBool once = PR_TRUE;
|
||||
|
||||
if (once)
|
||||
{
|
||||
once = PR_FALSE;
|
||||
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && prefs) {
|
||||
prefs->GetBoolPref("font.size.nav4algorithm", &gNavAlgorithmPref);
|
||||
prefs->RegisterCallback("font.size.nav4algorithm", NavAlgorithmPrefChangedCallback, NULL);
|
||||
}
|
||||
}
|
||||
return (gNavAlgorithmPref ? PR_FALSE : PR_TRUE);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Lifted from winfe/cxdc.cpp
|
||||
*/
|
||||
static nscoord OldCalcFontPointSize(PRInt32 aHTMLSize, PRInt32 aBasePointSize,
|
||||
float aScalingFactor)
|
||||
{ // lifted directly from Nav 5.0 code to replicate rounding errors
|
||||
double dFontSize;
|
||||
|
||||
switch(aHTMLSize) {
|
||||
case 1:
|
||||
dFontSize = 7 * aBasePointSize / 10;
|
||||
break;
|
||||
case 2:
|
||||
dFontSize = 85 * aBasePointSize / 100;
|
||||
break;
|
||||
case 3:
|
||||
dFontSize = aBasePointSize;
|
||||
break;
|
||||
case 4:
|
||||
dFontSize = 12 * aBasePointSize / 10;
|
||||
break;
|
||||
case 5:
|
||||
dFontSize = 3 * aBasePointSize / 2;
|
||||
break;
|
||||
case 6:
|
||||
dFontSize = 2 * aBasePointSize;
|
||||
break;
|
||||
case 7:
|
||||
dFontSize = 3 * aBasePointSize;
|
||||
break;
|
||||
default:
|
||||
if (aHTMLSize < 1) {
|
||||
dFontSize = (7 * aBasePointSize / 10) * pow(1.1, aHTMLSize - 1);
|
||||
}
|
||||
else { // aHTMLSize > 7
|
||||
dFontSize = (3 * aBasePointSize) * pow(1.2, aHTMLSize - 7);
|
||||
}
|
||||
}
|
||||
|
||||
dFontSize *= aScalingFactor;
|
||||
|
||||
if (1.0 < dFontSize) {
|
||||
return (nscoord)dFontSize;
|
||||
}
|
||||
return (nscoord)1;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static nscoord NewCalcFontPointSize(PRInt32 aHTMLSize, PRInt32 aBasePointSize,
|
||||
float aScalingFactor, nsIPresContext* aPresContext,
|
||||
nsFontSizeType aFontSizeType)
|
||||
{
|
||||
#define sFontSizeTableMin 9
|
||||
#define sFontSizeTableMax 16
|
||||
|
||||
// This table seems to be the one used by MacIE5. We hope its adoption in Mozilla
|
||||
// and eventually in WinIE5.5 will help to establish a standard rendering across
|
||||
// platforms and browsers. For now, it is used only in Strict mode. More can be read
|
||||
// in the document written by Todd Farhner at:
|
||||
// http://style.verso.com/font_size_intervals/altintervals.html
|
||||
//
|
||||
static PRInt32 sStrictFontSizeTable[sFontSizeTableMax - sFontSizeTableMin + 1][8] =
|
||||
{
|
||||
{ 9, 9, 9, 9, 11, 14, 18, 27},
|
||||
{ 9, 9, 9, 10, 12, 15, 20, 30},
|
||||
{ 9, 9, 10, 11, 13, 17, 22, 33},
|
||||
{ 9, 9, 10, 12, 14, 18, 24, 36},
|
||||
{ 9, 10, 12, 13, 16, 20, 26, 39},
|
||||
{ 9, 10, 12, 14, 17, 21, 28, 42},
|
||||
{ 9, 10, 13, 15, 18, 23, 30, 45},
|
||||
{ 9, 10, 13, 16, 18, 24, 32, 48}
|
||||
};
|
||||
// HTML 1 2 3 4 5 6 7
|
||||
// CSS xxs xs s m l xl xxl
|
||||
// |
|
||||
// user pref
|
||||
//
|
||||
//------------------------------------------------------------
|
||||
//
|
||||
// This table gives us compatibility with WinNav4 for the default fonts only.
|
||||
// In WinNav4, the default fonts were:
|
||||
//
|
||||
// Times/12pt == Times/16px at 96ppi
|
||||
// Courier/10pt == Courier/13px at 96ppi
|
||||
//
|
||||
// The 2 lines below marked "anchored" have the exact pixel sizes used by
|
||||
// WinNav4 for Times/12pt and Courier/10pt at 96ppi. As you can see, the
|
||||
// HTML size 3 (user pref) for those 2 anchored lines is 13px and 16px.
|
||||
//
|
||||
// All values other than the anchored values were filled in by hand, never
|
||||
// going below 9px, and maintaining a "diagonal" relationship. See for
|
||||
// example the 13s -- they follow a diagonal line through the table.
|
||||
//
|
||||
static PRInt32 sQuirksFontSizeTable[sFontSizeTableMax - sFontSizeTableMin + 1][8] =
|
||||
{
|
||||
{ 9, 9, 9, 9, 11, 14, 18, 28 },
|
||||
{ 9, 9, 9, 10, 12, 15, 20, 31 },
|
||||
{ 9, 9, 9, 11, 13, 17, 22, 34 },
|
||||
{ 9, 9, 10, 12, 14, 18, 24, 37 },
|
||||
{ 9, 9, 10, 13, 16, 20, 26, 40 }, // anchored (13)
|
||||
{ 9, 9, 11, 14, 17, 21, 28, 42 },
|
||||
{ 9, 10, 12, 15, 17, 23, 30, 45 },
|
||||
{ 9, 10, 13, 16, 18, 24, 32, 48 } // anchored (16)
|
||||
};
|
||||
// HTML 1 2 3 4 5 6 7
|
||||
// CSS xxs xs s m l xl xxl
|
||||
// |
|
||||
// user pref
|
||||
|
||||
#if 0
|
||||
//
|
||||
// These are the exact pixel values used by WinIE5 at 96ppi.
|
||||
//
|
||||
{ ?, 8, 11, 12, 13, 16, 21, 32 }, // smallest
|
||||
{ ?, 9, 12, 13, 16, 21, 27, 40 }, // smaller
|
||||
{ ?, 10, 13, 16, 18, 24, 32, 48 }, // medium
|
||||
{ ?, 13, 16, 19, 21, 27, 37, ?? }, // larger
|
||||
{ ?, 16, 19, 21, 24, 32, 43, ?? } // largest
|
||||
//
|
||||
// HTML 1 2 3 4 5 6 7
|
||||
// CSS ? ? ? ? ? ? ? ?
|
||||
//
|
||||
// (CSS not tested yet.)
|
||||
//
|
||||
#endif
|
||||
|
||||
static PRInt32 sFontSizeFactors[8] = { 60,75,89,100,120,150,200,300 };
|
||||
|
||||
static PRInt32 sCSSColumns[7] = {0, 1, 2, 3, 4, 5, 6}; // xxs...xxl
|
||||
static PRInt32 sHTMLColumns[7] = {1, 2, 3, 4, 5, 6, 7}; // 1...7
|
||||
|
||||
double dFontSize;
|
||||
|
||||
if (aFontSizeType == eFontSize_HTML) {
|
||||
aHTMLSize--; // input as 1-7
|
||||
}
|
||||
|
||||
if (aHTMLSize < 0)
|
||||
aHTMLSize = 0;
|
||||
else if (aHTMLSize > 6)
|
||||
aHTMLSize = 6;
|
||||
|
||||
PRInt32* column;
|
||||
switch (aFontSizeType)
|
||||
{
|
||||
case eFontSize_HTML: column = sHTMLColumns; break;
|
||||
case eFontSize_CSS: column = sCSSColumns; break;
|
||||
}
|
||||
|
||||
float t2p;
|
||||
aPresContext->GetTwipsToPixels(&t2p);
|
||||
PRInt32 fontSize = NSTwipsToIntPixels(aBasePointSize, t2p);
|
||||
|
||||
if ((fontSize >= sFontSizeTableMin) && (fontSize <= sFontSizeTableMax))
|
||||
{
|
||||
float p2t;
|
||||
aPresContext->GetPixelsToTwips(&p2t);
|
||||
|
||||
PRInt32 row = fontSize - sFontSizeTableMin;
|
||||
|
||||
nsCompatibility mode;
|
||||
aPresContext->GetCompatibilityMode(&mode);
|
||||
if (mode == eCompatibility_NavQuirks) {
|
||||
dFontSize = NSIntPixelsToTwips(sQuirksFontSizeTable[row][column[aHTMLSize]], p2t);
|
||||
} else {
|
||||
dFontSize = NSIntPixelsToTwips(sStrictFontSizeTable[row][column[aHTMLSize]], p2t);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PRInt32 factor = sFontSizeFactors[column[aHTMLSize]];
|
||||
dFontSize = (factor * aBasePointSize) / 100;
|
||||
}
|
||||
|
||||
dFontSize *= aScalingFactor;
|
||||
|
||||
if (1.0 < dFontSize) {
|
||||
return (nscoord)dFontSize;
|
||||
}
|
||||
return (nscoord)1;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
nscoord nsStyleUtil::CalcFontPointSize(PRInt32 aHTMLSize, PRInt32 aBasePointSize,
|
||||
float aScalingFactor, nsIPresContext* aPresContext,
|
||||
nsFontSizeType aFontSizeType)
|
||||
{
|
||||
#if DUMP_FONT_SIZES
|
||||
extern void DumpFontSizes(nsIPresContext* aPresContext);
|
||||
DumpFontSizes(aPresContext);
|
||||
#endif
|
||||
if (UseNewFontAlgorithm())
|
||||
return NewCalcFontPointSize(aHTMLSize, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType);
|
||||
else
|
||||
return OldCalcFontPointSize(aHTMLSize, aBasePointSize, aScalingFactor);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PRInt32 nsStyleUtil::FindNextSmallerFontSize(nscoord aFontSize, PRInt32 aBasePointSize,
|
||||
float aScalingFactor, nsIPresContext* aPresContext,
|
||||
nsFontSizeType aFontSizeType)
|
||||
{
|
||||
PRInt32 index;
|
||||
PRInt32 indexMin;
|
||||
PRInt32 indexMax;
|
||||
PRInt32 fontSize = NSTwipsToFloorIntPoints(aFontSize);
|
||||
|
||||
if (aFontSizeType == eFontSize_HTML) {
|
||||
indexMin = 1;
|
||||
indexMax = 7;
|
||||
} else {
|
||||
indexMin = 0;
|
||||
indexMax = 6;
|
||||
}
|
||||
|
||||
if (NSTwipsToFloorIntPoints(CalcFontPointSize(indexMin, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)) < fontSize) {
|
||||
if (fontSize <= NSTwipsToFloorIntPoints(CalcFontPointSize(indexMax, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType))) { // in HTML table
|
||||
for (index = indexMax; index > indexMin; index--)
|
||||
if (fontSize > NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)))
|
||||
break;
|
||||
}
|
||||
else { // larger than HTML table
|
||||
return indexMax;
|
||||
// for (index = 8; ; index++)
|
||||
// if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext))) {
|
||||
// index--;
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
}
|
||||
else { // smaller than HTML table
|
||||
return indexMin;
|
||||
// for (index = 0; -25<index ; index--) //prevent infinite loop (bug 17045)
|
||||
// if (fontSize > NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext))) {
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PRInt32 nsStyleUtil::FindNextLargerFontSize(nscoord aFontSize, PRInt32 aBasePointSize,
|
||||
float aScalingFactor, nsIPresContext* aPresContext,
|
||||
nsFontSizeType aFontSizeType)
|
||||
{
|
||||
PRInt32 index;
|
||||
PRInt32 indexMin;
|
||||
PRInt32 indexMax;
|
||||
PRInt32 fontSize = NSTwipsToFloorIntPoints(aFontSize);
|
||||
|
||||
if (aFontSizeType == eFontSize_HTML) {
|
||||
indexMin = 1;
|
||||
indexMax = 7;
|
||||
} else {
|
||||
indexMin = 0;
|
||||
indexMax = 6;
|
||||
}
|
||||
|
||||
if (NSTwipsToFloorIntPoints(CalcFontPointSize(indexMin, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)) <= fontSize) {
|
||||
if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(indexMax, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType))) { // in HTML table
|
||||
for (index = indexMin; index < indexMax; index++)
|
||||
if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)))
|
||||
break;
|
||||
}
|
||||
else { // larger than HTML table
|
||||
return indexMax;
|
||||
// for (index = 8; ; index++)
|
||||
// if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext)))
|
||||
// break;
|
||||
}
|
||||
}
|
||||
else { // smaller than HTML table
|
||||
return indexMin;
|
||||
// for (index = 0; -25<index ; index--) //prevent infinite loop (bug 17045)
|
||||
// if (fontSize > NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext))) {
|
||||
// index++;
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PRInt32
|
||||
nsStyleUtil::ConstrainFontWeight(PRInt32 aWeight)
|
||||
{
|
||||
aWeight = ((aWeight < 100) ? 100 : ((aWeight > 900) ? 900 : aWeight));
|
||||
PRInt32 base = ((aWeight / 100) * 100);
|
||||
PRInt32 step = (aWeight % 100);
|
||||
PRBool negativeStep = PRBool(50 < step);
|
||||
PRInt32 maxStep;
|
||||
if (negativeStep) {
|
||||
step = 100 - step;
|
||||
maxStep = (base / 100);
|
||||
base += 100;
|
||||
}
|
||||
else {
|
||||
maxStep = ((900 - base) / 100);
|
||||
}
|
||||
if (maxStep < step) {
|
||||
step = maxStep;
|
||||
}
|
||||
return (base + ((negativeStep) ? -step : step));
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const nsStyleColor* nsStyleUtil::FindNonTransparentBackground(nsIStyleContext* aContext,
|
||||
PRBool aStartAtParent /*= PR_FALSE*/)
|
||||
{
|
||||
const nsStyleColor* result = nsnull;
|
||||
nsIStyleContext* context;
|
||||
if (aStartAtParent) {
|
||||
context = aContext->GetParent(); // balance ending release
|
||||
} else {
|
||||
context = aContext;
|
||||
NS_IF_ADDREF(context); // balance ending release
|
||||
}
|
||||
NS_ASSERTION( context != nsnull, "Cannot find NonTransparentBackground in a null context" );
|
||||
|
||||
while (nsnull != context) {
|
||||
result = (const nsStyleColor*)context->GetStyleData(eStyleStruct_Color);
|
||||
|
||||
if (0 == (result->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
nsIStyleContext* last = context;
|
||||
context = context->GetParent();
|
||||
NS_RELEASE(last);
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(context);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*static*/
|
||||
PRBool nsStyleUtil::IsHTMLLink(nsIContent *aContent, nsIAtom *aTag, nsIPresContext *aPresContext, nsLinkState *aState)
|
||||
{
|
||||
NS_ASSERTION(aContent && aState, "null arg in IsHTMLLink");
|
||||
|
||||
// check for:
|
||||
// - HTML ANCHOR with valid HREF
|
||||
// - HTML LINK with valid HREF
|
||||
// - HTML AREA with valid HREF
|
||||
|
||||
PRBool result = PR_FALSE;
|
||||
|
||||
if ((aTag == nsHTMLAtoms::a) ||
|
||||
(aTag == nsHTMLAtoms::link) ||
|
||||
(aTag == nsHTMLAtoms::area)) {
|
||||
|
||||
nsCOMPtr<nsILink> link( do_QueryInterface(aContent) );
|
||||
// In XML documents, this can be null.
|
||||
if (link) {
|
||||
nsLinkState linkState;
|
||||
link->GetLinkState(linkState);
|
||||
if (linkState == eLinkState_Unknown) {
|
||||
// if it is an anchor, area or link then check the href attribute
|
||||
// make sure this anchor has a link even if we are not testing state
|
||||
// if there is no link, then this anchor is not really a linkpseudo.
|
||||
// bug=23209
|
||||
|
||||
char* href;
|
||||
link->GetHrefCString(href);
|
||||
|
||||
if (href) {
|
||||
nsILinkHandler *linkHandler = nsnull;
|
||||
aPresContext->GetLinkHandler(&linkHandler);
|
||||
if (linkHandler) {
|
||||
linkHandler->GetLinkState(href, linkState);
|
||||
NS_RELEASE(linkHandler);
|
||||
}
|
||||
else {
|
||||
// no link handler? then all links are unvisited
|
||||
linkState = eLinkState_Unvisited;
|
||||
}
|
||||
nsCRT::free(href);
|
||||
} else {
|
||||
linkState = eLinkState_NotLink;
|
||||
}
|
||||
link->SetLinkState(linkState);
|
||||
}
|
||||
if (linkState != eLinkState_NotLink) {
|
||||
*aState = linkState;
|
||||
result = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*static*/
|
||||
PRBool nsStyleUtil::IsSimpleXlink(nsIContent *aContent, nsIPresContext *aPresContext, nsLinkState *aState)
|
||||
{
|
||||
// XXX PERF This function will cause serious performance problems on
|
||||
// pages with lots of XLinks. We should be caching the visited
|
||||
// state of the XLinks. Where???
|
||||
|
||||
NS_ASSERTION(aContent && aState, "invalid call to IsXlink with null content");
|
||||
|
||||
PRBool rv = PR_FALSE;
|
||||
|
||||
if (aContent && aState) {
|
||||
// first see if we have an XML element
|
||||
nsCOMPtr<nsIXMLContent> xml(do_QueryInterface(aContent));
|
||||
if (xml) {
|
||||
// see if it is type=simple (we don't deal with other types)
|
||||
nsAutoString val;
|
||||
aContent->GetAttribute(kNameSpaceID_XLink, nsHTMLAtoms::type, val);
|
||||
if (val == NS_LITERAL_STRING("simple")) {
|
||||
// see if there is an xlink namespace'd href attribute:
|
||||
// - get it if there is, if not no big deal, it is not required for xlinks
|
||||
// is it bad to re-use val here?
|
||||
aContent->GetAttribute(kNameSpaceID_XLink, nsHTMLAtoms::href, val);
|
||||
|
||||
// It's an XLink. Resolve it relative to its document.
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
nsCOMPtr<nsIHTMLContent> htmlContent = do_QueryInterface(aContent);
|
||||
if (htmlContent) {
|
||||
// XXX why do this? will nsIHTMLContent's
|
||||
// GetBaseURL() may return something different
|
||||
// than the URL of the document it lives in?
|
||||
htmlContent->GetBaseURL(*getter_AddRefs(baseURI));
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aContent->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
doc->GetBaseURL(*getter_AddRefs(baseURI));
|
||||
}
|
||||
}
|
||||
|
||||
// convert here, rather than twice in NS_MakeAbsoluteURI and
|
||||
// back again
|
||||
char * href = val.ToNewCString();
|
||||
char * absHREF = nsnull;
|
||||
(void) NS_MakeAbsoluteURI(&absHREF, href, baseURI);
|
||||
nsCRT::free(href);
|
||||
|
||||
nsILinkHandler *linkHandler = nsnull;
|
||||
aPresContext->GetLinkHandler(&linkHandler);
|
||||
if (linkHandler) {
|
||||
linkHandler->GetLinkState(absHREF, *aState);
|
||||
NS_RELEASE(linkHandler);
|
||||
}
|
||||
else {
|
||||
// no link handler? then all links are unvisited
|
||||
*aState = eLinkState_Unvisited;
|
||||
}
|
||||
nsCRT::free(absHREF);
|
||||
|
||||
rv = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#if DUMP_FONT_SIZES
|
||||
#include "nsIDeviceContext.h"
|
||||
PRInt32 RoundSize(nscoord aVal, nsIPresContext* aPresContext, bool aWinRounding)
|
||||
{
|
||||
|
||||
PRInt32 lfHeight;
|
||||
nsIDeviceContext* dc;
|
||||
aPresContext->GetDeviceContext(&dc);
|
||||
|
||||
float app2dev, app2twip, scale;
|
||||
dc->GetAppUnitsToDevUnits(app2dev);
|
||||
|
||||
if (aWinRounding)
|
||||
{
|
||||
dc->GetDevUnitsToTwips(app2twip);
|
||||
dc->GetCanonicalPixelScale(scale);
|
||||
app2twip *= app2dev * scale;
|
||||
|
||||
// This interesting bit of code rounds the font size off to the floor point
|
||||
// value. This is necessary for proper font scaling under windows.
|
||||
PRInt32 sizePoints = NSTwipsToFloorIntPoints(nscoord(aVal*app2twip));
|
||||
float rounded = ((float)NSIntPointsToTwips(sizePoints)) / app2twip;
|
||||
|
||||
// round font size off to floor point size to be windows compatible
|
||||
// this is proper (windows) rounding
|
||||
// lfHeight = NSToIntRound(rounded * app2dev);
|
||||
|
||||
// this floor rounding is to make ours compatible with Nav 4.0
|
||||
lfHeight = long(rounded * app2dev);
|
||||
return lfHeight;
|
||||
}
|
||||
else
|
||||
return NSToIntRound(aVal*app2dev);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#if DUMP_FONT_SIZES
|
||||
void DumpFontSizes(nsIPresContext* aPresContext)
|
||||
{
|
||||
static gOnce = true;
|
||||
if (gOnce)
|
||||
{
|
||||
gOnce = false;
|
||||
|
||||
PRInt32 baseSize;
|
||||
PRInt32 htmlSize;
|
||||
PRInt32 cssSize;
|
||||
nscoord val;
|
||||
nscoord oldVal;
|
||||
|
||||
nsIDeviceContext* dc;
|
||||
aPresContext->GetDeviceContext(&dc);
|
||||
float dev2app;
|
||||
dc->GetDevUnitsToAppUnits(dev2app);
|
||||
|
||||
bool doWinRounding = true;
|
||||
for (short i=0; i<2; i ++)
|
||||
{
|
||||
doWinRounding ^= true;
|
||||
printf("\n\n\n");
|
||||
printf("---------------------------------------------------------------\n");
|
||||
printf(" CSS \n");
|
||||
printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF"));
|
||||
printf("---------------------------------------------------------------\n");
|
||||
printf("\n");
|
||||
printf("NEW SIZES:\n");
|
||||
printf("----------\n");
|
||||
printf(" xx-small x-small small medium large x-large xx-large\n");
|
||||
for (baseSize = 9; baseSize <= 20; baseSize++) {
|
||||
printf("%2d: ", baseSize);
|
||||
for (cssSize = 0; cssSize <= 6; cssSize++) {
|
||||
val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS);
|
||||
printf("%2d ", RoundSize(val, aPresContext, false));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
printf("OLD SIZES:\n");
|
||||
printf("----------\n");
|
||||
printf(" xx-small x-small small medium large x-large xx-large\n");
|
||||
for (baseSize = 9; baseSize <= 20; baseSize++) {
|
||||
printf("%2d: ", baseSize);
|
||||
for (cssSize = 0; cssSize <= 6; cssSize++) {
|
||||
val = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f);
|
||||
printf("%2d ", RoundSize(val, aPresContext, doWinRounding));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
printf("DIFFS:\n");
|
||||
printf("------\n");
|
||||
printf(" xx-small x-small small medium large x-large xx-large\n");
|
||||
for (baseSize = 9; baseSize <= 20; baseSize++) {
|
||||
printf("%2d: ", baseSize);
|
||||
for (cssSize = 0; cssSize <= 6; cssSize++) {
|
||||
oldVal = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f);
|
||||
val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS);
|
||||
if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8)
|
||||
printf(" .");
|
||||
else
|
||||
printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding)));
|
||||
printf(" ");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
printf("\n\n\n");
|
||||
printf("---------------------------------------------------------------\n");
|
||||
printf(" HTML \n");
|
||||
printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF"));
|
||||
printf("---------------------------------------------------------------\n");
|
||||
printf("\n");
|
||||
printf("NEW SIZES:\n");
|
||||
printf("----------\n");
|
||||
printf(" #1 #2 #3 #4 #5 #6 #7\n");
|
||||
for (baseSize = 9; baseSize <= 20; baseSize++) {
|
||||
printf("%2d: ", baseSize);
|
||||
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
|
||||
val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML);
|
||||
printf("%2d ", RoundSize(val, aPresContext, false));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
printf("OLD SIZES:\n");
|
||||
printf("----------\n");
|
||||
printf(" #1 #2 #3 #4 #5 #6 #7\n");
|
||||
for (baseSize = 9; baseSize <= 20; baseSize++) {
|
||||
printf("%2d: ", baseSize);
|
||||
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
|
||||
val = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f);
|
||||
printf("%2d ", RoundSize(val, aPresContext, doWinRounding));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
printf("DIFFS:\n");
|
||||
printf("------\n");
|
||||
printf(" #1 #2 #3 #4 #5 #6 #7\n");
|
||||
for (baseSize = 9; baseSize <= 20; baseSize++) {
|
||||
printf("%2d: ", baseSize);
|
||||
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
|
||||
oldVal = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f);
|
||||
val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML);
|
||||
if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8)
|
||||
printf(" .");
|
||||
else
|
||||
printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding)));
|
||||
printf(" ");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n\n\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
76
mozilla/content/shared/src/nsXULAtoms.cpp
Normal file
76
mozilla/content/shared/src/nsXULAtoms.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
/* -*- 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.org 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.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsXULAtoms.h"
|
||||
#include "nsContentCID.h"
|
||||
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
||||
|
||||
static const char kXULNameSpace[] = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
|
||||
PRInt32 nsXULAtoms::nameSpaceID;
|
||||
|
||||
// define storage for all atoms
|
||||
#define XUL_ATOM(_name, _value) nsIAtom* nsXULAtoms::_name;
|
||||
#include "nsXULAtomList.h"
|
||||
#undef XUL_ATOM
|
||||
|
||||
|
||||
static nsrefcnt gRefCnt = 0;
|
||||
static nsINameSpaceManager* gNameSpaceManager;
|
||||
|
||||
void nsXULAtoms::AddRefAtoms() {
|
||||
|
||||
if (gRefCnt == 0) {
|
||||
/* XUL Atoms registers the XUL name space ID because it's a convenient
|
||||
place to do this, if you don't want a permanent, "well-known" ID.
|
||||
*/
|
||||
if (NS_SUCCEEDED(nsComponentManager::CreateInstance(kNameSpaceManagerCID,nsnull,NS_GET_IID(nsINameSpaceManager),(void**)&gNameSpaceManager))) {
|
||||
// gNameSpaceManager->CreateRootNameSpace(namespace);
|
||||
nsAutoString nameSpace; nameSpace.AssignWithConversion(kXULNameSpace);
|
||||
gNameSpaceManager->RegisterNameSpace(nameSpace, nameSpaceID);
|
||||
} else {
|
||||
NS_ASSERTION(0, "failed to create xul atoms namespace manager");
|
||||
}
|
||||
|
||||
// now register the atoms
|
||||
#define XUL_ATOM(_name, _value) _name = NS_NewAtom(_value);
|
||||
#include "nsXULAtomList.h"
|
||||
#undef XUL_ATOM
|
||||
}
|
||||
++gRefCnt;
|
||||
}
|
||||
|
||||
void nsXULAtoms::ReleaseAtoms() {
|
||||
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release of xul atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
#define XUL_ATOM(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsXULAtomList.h"
|
||||
#undef XUL_ATOM
|
||||
|
||||
NS_IF_RELEASE(gNameSpaceManager);
|
||||
}
|
||||
}
|
||||
46
mozilla/layout/Makefile.in
Normal file
46
mozilla/layout/Makefile.in
Normal file
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# 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.org 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):
|
||||
#
|
||||
|
||||
DEPTH = ..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = base html xml xul xbl xsl
|
||||
|
||||
ifdef MOZ_MATHML
|
||||
DIRS += mathml
|
||||
endif
|
||||
|
||||
ifdef MOZ_SVG
|
||||
DIRS += svg
|
||||
endif
|
||||
|
||||
DIRS += events build
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
DIRS += html/tests
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
32
mozilla/layout/base/Makefile.in
Normal file
32
mozilla/layout/base/Makefile.in
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# 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.org 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):
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
30
mozilla/layout/base/makefile.win
Normal file
30
mozilla/layout/base/makefile.win
Normal file
@@ -0,0 +1,30 @@
|
||||
#!nmake
|
||||
#
|
||||
# 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.org 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):
|
||||
|
||||
DEPTH=..\..
|
||||
|
||||
DIRS=public src \
|
||||
!if !defined(DISABLE_TESTS)
|
||||
tests \
|
||||
!endif
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
44
mozilla/layout/base/public/MANIFEST
Normal file
44
mozilla/layout/base/public/MANIFEST
Normal file
@@ -0,0 +1,44 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:layout directory
|
||||
#
|
||||
nsFrameList.h
|
||||
nsFrameTraversal.h
|
||||
nsHTMLReflowState.h
|
||||
nsIAutoCopy.h
|
||||
nsICaret.h
|
||||
nsIFocusTracker.h
|
||||
nsIFrame.h
|
||||
nsIFrameDebug.h
|
||||
nsIFrameImageLoader.h
|
||||
nsIFrameManager.h
|
||||
nsIFrameSelection.h
|
||||
nsIFrameUtil.h
|
||||
nsIIndependentSelection.h
|
||||
nsILayoutDebugger.h
|
||||
nsILayoutHistoryState.h
|
||||
nsIMutableStyleContext.h
|
||||
nsIPageSequenceFrame.h
|
||||
nsIPresContext.h
|
||||
nsIPresShell.h
|
||||
nsIPresState.h
|
||||
nsIPrintContext.h
|
||||
nsIReflowCallback.h
|
||||
nsIReflowCommand.h
|
||||
nsIScrollableFrame.h
|
||||
nsIScrollableViewProvider.h
|
||||
nsISpaceManager.h
|
||||
nsIStatefulFrame.h
|
||||
nsIStyleContext.h
|
||||
nsIStyleSet.h
|
||||
nslayout.h
|
||||
nsLayoutAtomList.h
|
||||
nsLayoutAtoms.h
|
||||
nsLayoutUtils.h
|
||||
nsStyleChangeList.h
|
||||
nsStyleConsts.h
|
||||
nsStyleCoord.h
|
||||
nsIStyleFrameConstruction.h
|
||||
nsStyleStruct.h
|
||||
nsIFrameTraversal.h
|
||||
nsIObjectFrame.h
|
||||
nsIImageFrame.h
|
||||
5
mozilla/layout/base/public/MANIFEST_IDL
Normal file
5
mozilla/layout/base/public/MANIFEST_IDL
Normal file
@@ -0,0 +1,5 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:idl directory
|
||||
#
|
||||
|
||||
nsIChromeEventHandler.idl
|
||||
84
mozilla/layout/base/public/Makefile.in
Normal file
84
mozilla/layout/base/public/Makefile.in
Normal file
@@ -0,0 +1,84 @@
|
||||
#
|
||||
# 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.org 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):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = layout
|
||||
XPIDL_MODULE = layout_base
|
||||
|
||||
EXPORTS = \
|
||||
nslayout.h \
|
||||
nsHTMLReflowState.h \
|
||||
nsIAutoCopy.h \
|
||||
nsICaret.h \
|
||||
nsIFocusTracker.h \
|
||||
nsIFrame.h \
|
||||
nsIImageFrame.h \
|
||||
nsIObjectFrame.h \
|
||||
nsIFrameTraversal.h \
|
||||
nsIFrameDebug.h \
|
||||
nsIFrameImageLoader.h \
|
||||
nsIFrameManager.h \
|
||||
nsIIndependentSelection.h \
|
||||
nsILayoutDebugger.h \
|
||||
nsIFrameUtil.h \
|
||||
nsIPageSequenceFrame.h \
|
||||
nsIPresContext.h \
|
||||
nsIPresShell.h \
|
||||
nsIPresState.h \
|
||||
nsIPrintContext.h \
|
||||
nsIReflowCallback.h \
|
||||
nsIReflowCommand.h \
|
||||
nsIFrameSelection.h \
|
||||
nsISpaceManager.h \
|
||||
nsIStyleContext.h \
|
||||
nsIMutableStyleContext.h \
|
||||
nsIStyleFrameConstruction.h \
|
||||
nsIStyleSet.h \
|
||||
nsLayoutAtoms.h \
|
||||
nsLayoutAtomList.h \
|
||||
nsLayoutUtils.h \
|
||||
nsFrameList.h \
|
||||
nsFrameTraversal.h \
|
||||
nsStyleChangeList.h \
|
||||
nsStyleConsts.h \
|
||||
nsStyleCoord.h \
|
||||
nsStyleStruct.h \
|
||||
nsILayoutHistoryState.h \
|
||||
nsIStatefulFrame.h \
|
||||
nsIScrollableFrame.h \
|
||||
nsIScrollableViewProvider.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIChromeEventHandler.idl \
|
||||
nsIPrintListener.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
77
mozilla/layout/base/public/makefile.win
Normal file
77
mozilla/layout/base/public/makefile.win
Normal file
@@ -0,0 +1,77 @@
|
||||
#!nmake
|
||||
#
|
||||
# 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.org 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):
|
||||
|
||||
DEPTH=..\..\..
|
||||
|
||||
EXPORTS = \
|
||||
nslayout.h \
|
||||
nsHTMLReflowState.h \
|
||||
nsIAutoCopy.h \
|
||||
nsICaret.h \
|
||||
nsIFocusTracker.h \
|
||||
nsIFrame.h \
|
||||
nsIObjectFrame.h \
|
||||
nsIImageFrame.h \
|
||||
nsIFrameTraversal.h \
|
||||
nsIFrameDebug.h \
|
||||
nsIFrameImageLoader.h \
|
||||
nsIFrameManager.h \
|
||||
nsIIndependentSelection.h \
|
||||
nsILayoutDebugger.h \
|
||||
nsIFrameUtil.h \
|
||||
nsIPageSequenceFrame.h \
|
||||
nsIPresContext.h \
|
||||
nsIPresShell.h \
|
||||
nsIPresState.h \
|
||||
nsIReflowCallback.h \
|
||||
nsIReflowCommand.h \
|
||||
nsIFrameSelection.h \
|
||||
nsISpaceManager.h \
|
||||
nsIStyleContext.h \
|
||||
nsIMutableStyleContext.h \
|
||||
nsIStyleFrameConstruction.h \
|
||||
nsIStyleSet.h \
|
||||
nsLayoutAtoms.h \
|
||||
nsLayoutAtomList.h \
|
||||
nsLayoutUtils.h \
|
||||
nsFrameList.h \
|
||||
nsFrameTraversal.h \
|
||||
nsStyleChangeList.h \
|
||||
nsStyleConsts.h \
|
||||
nsStyleCoord.h \
|
||||
nsStyleStruct.h \
|
||||
nsILayoutHistoryState.h \
|
||||
nsIStatefulFrame.h \
|
||||
nsIScrollableFrame.h \
|
||||
nsIScrollableViewProvider.h \
|
||||
nsIPrintContext.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE=layout_base
|
||||
|
||||
XPIDLSRCS= \
|
||||
.\nsIChromeEventHandler.idl \
|
||||
.\nsIPrintListener.idl \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
69
mozilla/layout/base/public/nsContentPolicyUtils.h
Normal file
69
mozilla/layout/base/public/nsContentPolicyUtils.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* 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 code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Zero-Knowledge Systems,
|
||||
* Inc. Portions created by Zero-Knowledge are Copyright (C) 2000
|
||||
* Zero-Knowledge Systems, Inc. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/*
|
||||
* Utility routines for checking content load/process policy settings.
|
||||
*/
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "nsIMemory.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#ifndef __nsContentPolicyUtils_h__
|
||||
#define __nsContentPolicyUtils_h__
|
||||
|
||||
class nsIDOMElement;
|
||||
|
||||
#define NS_CONTENTPOLICY_CONTRACTID "@mozilla.org/layout/content-policy;1"
|
||||
#define NS_CONTENTPOLICY_CATEGORY "content-policy"
|
||||
#define NS_CONTENTPOLICY_CID \
|
||||
{0x0e3afd3d, 0xeb60, 0x4c2b, \
|
||||
{ 0x96, 0x3b, 0x56, 0xd7, 0xc4, 0x39, 0xf1, 0x24 }}
|
||||
|
||||
/* takes contentType, aURL, and element from its context */
|
||||
#define CHECK_CONTENT_POLICY(action, result) \
|
||||
PR_BEGIN_MACRO \
|
||||
nsresult rv; \
|
||||
NS_WITH_SERVICE(nsIContentPolicy, policy, NS_CONTENTPOLICY_CONTRACTID, &rv); \
|
||||
if (NS_FAILED(rv)) \
|
||||
return rv; \
|
||||
\
|
||||
return policy->##action(contentType, element, aURL.GetUnicode(), result); \
|
||||
PR_END_MACRO
|
||||
|
||||
inline nsresult
|
||||
NS_CheckContentLoadPolicy(PRInt32 contentType, const nsString &aURL,
|
||||
nsIDOMElement *element, PRBool *shouldLoad)
|
||||
{
|
||||
CHECK_CONTENT_POLICY(ShouldLoad, shouldLoad);
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
NS_CheckContentProcessPolicy(PRInt32 contentType, nsString &aURL,
|
||||
nsIDOMElement *element, PRBool *shouldProcess)
|
||||
{
|
||||
CHECK_CONTENT_POLICY(ShouldProcess, shouldProcess);
|
||||
}
|
||||
|
||||
#undef CHECK_CONTENT_POLICY
|
||||
|
||||
#endif /* __nsContentPolicyUtils_h__ */
|
||||
135
mozilla/layout/base/public/nsFrameList.h
Normal file
135
mozilla/layout/base/public/nsFrameList.h
Normal file
@@ -0,0 +1,135 @@
|
||||
/* -*- 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 nsFrameList_h___
|
||||
#define nsFrameList_h___
|
||||
|
||||
#include "nsIFrame.h"
|
||||
|
||||
/**
|
||||
* A class for managing a singly linked list of frames. Frames are
|
||||
* linked together through their next-sibling pointer.
|
||||
*/
|
||||
class nsFrameList {
|
||||
public:
|
||||
nsFrameList() {
|
||||
mFirstChild = nsnull;
|
||||
}
|
||||
|
||||
nsFrameList(nsIFrame* aHead) {
|
||||
mFirstChild = aHead;
|
||||
}
|
||||
|
||||
~nsFrameList() {
|
||||
}
|
||||
|
||||
void DestroyFrames(nsIPresContext* aPresContext);
|
||||
|
||||
void SetFrames(nsIFrame* aFrameList) {
|
||||
mFirstChild = aFrameList;
|
||||
}
|
||||
|
||||
void AppendFrames(nsIFrame* aParent, nsIFrame* aFrameList);
|
||||
|
||||
void AppendFrames(nsIFrame* aParent, nsFrameList& aFrameList) {
|
||||
AppendFrames(aParent, aFrameList.mFirstChild);
|
||||
aFrameList.mFirstChild = nsnull;
|
||||
}
|
||||
|
||||
void AppendFrame(nsIFrame* aParent, nsIFrame* aFrame);
|
||||
|
||||
// Take aFrame out of the frame list. This also disconnects aFrame
|
||||
// from the sibling list. This will return PR_FALSE if aFrame is
|
||||
// nsnull or if aFrame is not in the list.
|
||||
PRBool RemoveFrame(nsIFrame* aFrame);
|
||||
|
||||
// Remove the first child from the list. The caller is assumed to be
|
||||
// holding a reference to the first child. This call is equivalent
|
||||
// in behavior to calling RemoveFrame(FirstChild()).
|
||||
PRBool RemoveFirstChild();
|
||||
|
||||
// Take aFrame out of the frame list and then destroy it. This also
|
||||
// disconnects aFrame from the sibling list. This will return
|
||||
// PR_FALSE if aFrame is nsnull or if aFrame is not in the list.
|
||||
PRBool DestroyFrame(nsIPresContext* aPresContext, nsIFrame* aFrame);
|
||||
|
||||
void InsertFrame(nsIFrame* aParent,
|
||||
nsIFrame* aPrevSibling,
|
||||
nsIFrame* aNewFrame);
|
||||
|
||||
void InsertFrames(nsIFrame* aParent,
|
||||
nsIFrame* aPrevSibling,
|
||||
nsIFrame* aFrameList);
|
||||
|
||||
void InsertFrames(nsIFrame* aParent, nsIFrame* aPrevSibling,
|
||||
nsFrameList& aFrameList) {
|
||||
InsertFrames(aParent, aPrevSibling, aFrameList.FirstChild());
|
||||
aFrameList.mFirstChild = nsnull;
|
||||
}
|
||||
|
||||
PRBool ReplaceFrame(nsIFrame* aParent,
|
||||
nsIFrame* aOldFrame,
|
||||
nsIFrame* aNewFrame);
|
||||
|
||||
PRBool ReplaceAndDestroyFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParent,
|
||||
nsIFrame* aOldFrame,
|
||||
nsIFrame* aNewFrame);
|
||||
|
||||
PRBool Split(nsIFrame* aAfterFrame, nsIFrame** aNextFrameResult);
|
||||
|
||||
nsIFrame* PullFrame(nsIFrame* aParent,
|
||||
nsIFrame* aLastChild,
|
||||
nsFrameList& aFromList);
|
||||
|
||||
nsIFrame* FirstChild() const {
|
||||
return mFirstChild;
|
||||
}
|
||||
|
||||
nsIFrame* LastChild() const;
|
||||
|
||||
nsIFrame* FrameAt(PRInt32 aIndex) const;
|
||||
|
||||
PRBool IsEmpty() const {
|
||||
return nsnull == mFirstChild;
|
||||
}
|
||||
|
||||
PRBool NotEmpty() const {
|
||||
return nsnull != mFirstChild;
|
||||
}
|
||||
|
||||
PRBool ContainsFrame(const nsIFrame* aFrame) const;
|
||||
|
||||
PRInt32 GetLength() const;
|
||||
|
||||
nsIFrame* GetPrevSiblingFor(nsIFrame* aFrame) const;
|
||||
|
||||
void VerifyParent(nsIFrame* aParent) const;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
void List(nsIPresContext* aPresContext, FILE* out) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
nsIFrame* mFirstChild;
|
||||
};
|
||||
|
||||
#endif /* nsFrameList_h___ */
|
||||
50
mozilla/layout/base/public/nsFrameTraversal.h
Normal file
50
mozilla/layout/base/public/nsFrameTraversal.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* -*- 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.org 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 NSFRAMETRAVERSAL_H
|
||||
#define NSFRAMETRAVERSAL_H
|
||||
|
||||
#include "nsIEnumerator.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIFrameTraversal.h"
|
||||
|
||||
nsresult NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
|
||||
nsTraversalType aType,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame *aStart);
|
||||
|
||||
nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
|
||||
|
||||
class nsFrameTraversal : public nsIFrameTraversal
|
||||
{
|
||||
public:
|
||||
nsFrameTraversal();
|
||||
virtual ~nsFrameTraversal();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
|
||||
PRUint32 aType,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame *aStart);
|
||||
};
|
||||
|
||||
#endif //NSFRAMETRAVERSAL_H
|
||||
397
mozilla/layout/base/public/nsHTMLReflowState.h
Normal file
397
mozilla/layout/base/public/nsHTMLReflowState.h
Normal file
@@ -0,0 +1,397 @@
|
||||
/* -*- 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.org 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 nsHTMLReflowState_h___
|
||||
#define nsHTMLReflowState_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIPresContext;
|
||||
class nsIReflowCommand;
|
||||
class nsIRenderingContext;
|
||||
class nsISpaceManager;
|
||||
class nsLineLayout;
|
||||
|
||||
struct nsStyleDisplay;
|
||||
struct nsStylePosition;
|
||||
struct nsStyleBorder;
|
||||
struct nsStyleMargin;
|
||||
struct nsStylePadding;
|
||||
struct nsStyleText;
|
||||
struct nsHypotheticalBox;
|
||||
|
||||
/**
|
||||
* Constant used to indicate an unconstrained size.
|
||||
*
|
||||
* @see #Reflow()
|
||||
*/
|
||||
#define NS_UNCONSTRAINEDSIZE NS_MAXSIZE
|
||||
|
||||
/**
|
||||
* The reason the frame is being reflowed.
|
||||
*
|
||||
* XXX Should probably be a #define so it can be extended for specialized
|
||||
* reflow interfaces...
|
||||
*
|
||||
* @see nsHTMLReflowState
|
||||
*/
|
||||
enum nsReflowReason {
|
||||
eReflowReason_Initial = 0, // initial reflow of a newly created frame
|
||||
eReflowReason_Incremental = 1, // an incremental change has occured. see the reflow command for details
|
||||
eReflowReason_Resize = 2, // general request to determine a desired size
|
||||
eReflowReason_StyleChange = 3, // request to reflow because of a style change. Note: you must reflow
|
||||
// all your child frames
|
||||
eReflowReason_Dirty = 4 // request to reflow because you and/or your children are dirty
|
||||
};
|
||||
|
||||
/**
|
||||
* CSS Frame type. Included as part of the reflow state.
|
||||
*/
|
||||
typedef PRUint32 nsCSSFrameType;
|
||||
|
||||
#define NS_CSS_FRAME_TYPE_UNKNOWN 0
|
||||
#define NS_CSS_FRAME_TYPE_INLINE 1
|
||||
#define NS_CSS_FRAME_TYPE_BLOCK 2 /* block-level in normal flow */
|
||||
#define NS_CSS_FRAME_TYPE_FLOATING 3
|
||||
#define NS_CSS_FRAME_TYPE_ABSOLUTE 4
|
||||
#define NS_CSS_FRAME_TYPE_INTERNAL_TABLE 5 /* row group frame, row frame, cell frame, ... */
|
||||
|
||||
/**
|
||||
* Bit-flag that indicates whether the element is replaced. Applies to inline,
|
||||
* block-level, floating, and absolutely positioned elements
|
||||
*/
|
||||
#define NS_CSS_FRAME_TYPE_REPLACED 0x8000
|
||||
|
||||
/**
|
||||
* Helper macros for telling whether items are replaced
|
||||
*/
|
||||
#define NS_FRAME_IS_REPLACED(_ft) \
|
||||
(NS_CSS_FRAME_TYPE_REPLACED == ((_ft) & NS_CSS_FRAME_TYPE_REPLACED))
|
||||
|
||||
#define NS_FRAME_REPLACED(_ft) \
|
||||
(NS_CSS_FRAME_TYPE_REPLACED | (_ft))
|
||||
|
||||
/**
|
||||
* A macro to extract the type. Masks off the 'replaced' bit-flag
|
||||
*/
|
||||
#define NS_FRAME_GET_TYPE(_ft) \
|
||||
((_ft) & ~NS_CSS_FRAME_TYPE_REPLACED)
|
||||
|
||||
#define NS_INTRINSICSIZE NS_UNCONSTRAINEDSIZE
|
||||
#define NS_SHRINKWRAPWIDTH NS_UNCONSTRAINEDSIZE
|
||||
#define NS_AUTOHEIGHT NS_UNCONSTRAINEDSIZE
|
||||
#define NS_AUTOMARGIN NS_UNCONSTRAINEDSIZE
|
||||
#define NS_AUTOOFFSET NS_UNCONSTRAINEDSIZE
|
||||
|
||||
/**
|
||||
* Reflow state passed to a frame during reflow.
|
||||
*
|
||||
* @see nsIFrame#Reflow()
|
||||
*/
|
||||
struct nsHTMLReflowState {
|
||||
// the reflow states are linked together. this is the pointer to the
|
||||
// parent's reflow state
|
||||
const nsHTMLReflowState* parentReflowState;
|
||||
|
||||
// the frame being reflowed
|
||||
nsIFrame* frame;
|
||||
|
||||
// the reason for the reflow
|
||||
nsReflowReason reason;
|
||||
|
||||
// the reflow command. only set for a reflow reason of eReflowReason_Incremental
|
||||
nsIReflowCommand* reflowCommand;
|
||||
|
||||
// the available space in which to reflow the frame. The space represents the
|
||||
// amount of room for the frame's border, padding, and content area (not the
|
||||
// margin area. The parent frame deals with the child frame's margins). The
|
||||
// frame size you choose should fit within the available space.
|
||||
// A value of NS_UNCONSTRAINEDSIZE for the available height means you can
|
||||
// choose whatever size you want. In galley mode the available height is always
|
||||
// NS_UNCONSTRAINEDSIZE, and only page mode involves a constrained height
|
||||
nscoord availableWidth, availableHeight;
|
||||
|
||||
// rendering context to use for measurement
|
||||
nsIRenderingContext* rendContext;
|
||||
|
||||
// is the current context at the top of a page?
|
||||
PRPackedBool isTopOfPage;
|
||||
|
||||
// The type of frame, from css's perspective. This value is
|
||||
// initialized by the Init method below.
|
||||
nsCSSFrameType mFrameType;
|
||||
|
||||
// pointer to the space manager associated with this area
|
||||
nsISpaceManager* mSpaceManager;
|
||||
|
||||
// LineLayout object (only for inline reflow; set to NULL otherwise)
|
||||
nsLineLayout* mLineLayout;
|
||||
|
||||
// The computed width specifies the frame's content area width, and it does
|
||||
// not apply to inline non-replaced elements
|
||||
//
|
||||
// For replaced inline frames, a value of NS_INTRINSICSIZE means you should
|
||||
// use your intrinsic width as the computed width
|
||||
//
|
||||
// For block-level frames, the computed width is based on the width of the
|
||||
// containing block, the margin/border/padding areas, and the min/max width.
|
||||
// A value of NS_SHRINKWRAPWIDTH means that you should choose a width based
|
||||
// on your content. The width may be as large as the specified maximum width
|
||||
// (see mComputedMaxWidth).
|
||||
nscoord mComputedWidth;
|
||||
|
||||
// The computed height specifies the frame's content height, and it does
|
||||
// not apply to inline non-replaced elements
|
||||
//
|
||||
// For replaced inline frames, a value of NS_INTRINSICSIZE means you should
|
||||
// use your intrinsic height as the computed height
|
||||
//
|
||||
// For non-replaced block-level frames in the flow and floated, a value of
|
||||
// NS_AUTOHEIGHT means you choose a height to shrink wrap around the normal
|
||||
// flow child frames. The height must be within the limit of the min/max
|
||||
// height if there is such a limit
|
||||
//
|
||||
// For replaced block-level frames, a value of NS_INTRINSICSIZE
|
||||
// means you use your intrinsic height as the computed height
|
||||
nscoord mComputedHeight;
|
||||
|
||||
// Computed margin values
|
||||
nsMargin mComputedMargin;
|
||||
|
||||
// Cached copy of the border values
|
||||
nsMargin mComputedBorderPadding;
|
||||
|
||||
// Computed padding values
|
||||
nsMargin mComputedPadding;
|
||||
|
||||
// Computed values for 'left/top/right/bottom' offsets. Only applies to
|
||||
// 'positioned' elements
|
||||
nsMargin mComputedOffsets;
|
||||
|
||||
// Computed values for 'min-width/max-width' and 'min-height/max-height'
|
||||
nscoord mComputedMinWidth, mComputedMaxWidth;
|
||||
nscoord mComputedMinHeight, mComputedMaxHeight;
|
||||
|
||||
// Compact margin available space
|
||||
nscoord mCompactMarginWidth;
|
||||
|
||||
// The following data members are relevant if nsStyleText.mTextAlign
|
||||
// == NS_STYLE_TEXT_ALIGN_CHAR
|
||||
|
||||
// distance from reference edge (as specified in nsStyleDisplay.mDirection)
|
||||
// to the align character (which will be specified in nsStyleTable)
|
||||
nscoord mAlignCharOffset;
|
||||
|
||||
// if true, the reflow honors alignCharOffset and does not
|
||||
// set it. if false, the reflow sets alignCharOffset
|
||||
PRPackedBool mUseAlignCharOffset;
|
||||
|
||||
// Cached pointers to the various style structs used during intialization
|
||||
const nsStyleDisplay* mStyleDisplay;
|
||||
const nsStylePosition* mStylePosition;
|
||||
const nsStyleBorder* mStyleBorder;
|
||||
const nsStyleMargin* mStyleMargin;
|
||||
const nsStylePadding* mStylePadding;
|
||||
const nsStyleText* mStyleText;
|
||||
|
||||
// This value keeps track of how deeply nested a given reflow state
|
||||
// is from the top of the frame tree.
|
||||
PRInt32 mReflowDepth;
|
||||
|
||||
#ifdef DEBUG
|
||||
// hook for attaching debug info (e.g. tables may attach a timer during reflow)
|
||||
void* mDebugHook;
|
||||
#endif
|
||||
|
||||
// Note: The copy constructor is written by the compiler
|
||||
// automatically. You can use that and then override specific values
|
||||
// if you want, or you can call Init as desired...
|
||||
|
||||
// Initialize a <b>root</b> reflow state with a rendering context to
|
||||
// use for measuring things.
|
||||
nsHTMLReflowState(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsReflowReason aReason,
|
||||
nsIRenderingContext* aRenderingContext,
|
||||
const nsSize& aAvailableSpace);
|
||||
|
||||
// Initialize a <b>root</b> reflow state for an <b>incremental</b>
|
||||
// reflow.
|
||||
nsHTMLReflowState(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIReflowCommand& aReflowCommand,
|
||||
nsIRenderingContext* aRenderingContext,
|
||||
const nsSize& aAvailableSpace);
|
||||
|
||||
// Initialize a reflow state for a child frames reflow. Some state
|
||||
// is copied from the parent reflow state; the remaining state is
|
||||
// computed.
|
||||
nsHTMLReflowState(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
nsIFrame* aFrame,
|
||||
const nsSize& aAvailableSpace,
|
||||
nsReflowReason aReason);
|
||||
|
||||
// Same as the previous except that the reason is taken from the
|
||||
// parent's reflow state.
|
||||
nsHTMLReflowState(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
nsIFrame* aFrame,
|
||||
const nsSize& aAvailableSpace);
|
||||
|
||||
// Used when you want to override the default containing block
|
||||
// width and height. Used by absolute positioning code
|
||||
nsHTMLReflowState(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
nsIFrame* aFrame,
|
||||
const nsSize& aAvailableSpace,
|
||||
nscoord aContainingBlockWidth,
|
||||
nscoord aContainingBlockHeight);
|
||||
|
||||
/**
|
||||
* Get the containing block reflow state, starting from a frames
|
||||
* <B>parent</B> reflow state (the parent reflow state may or may not end
|
||||
* up being the containing block reflow state)
|
||||
*/
|
||||
static const nsHTMLReflowState*
|
||||
GetContainingBlockReflowState(const nsHTMLReflowState* aParentRS);
|
||||
|
||||
/**
|
||||
* First find the containing block's reflow state using
|
||||
* GetContainingBlockReflowState, then ask the containing block for
|
||||
* it's content width using GetContentWidth
|
||||
*/
|
||||
static nscoord
|
||||
GetContainingBlockContentWidth(const nsHTMLReflowState* aParentRS);
|
||||
|
||||
/**
|
||||
* Get the page box reflow state, starting from a frames
|
||||
* <B>parent</B> reflow state (the parent reflow state may or may not end
|
||||
* up being the containing block reflow state)
|
||||
*/
|
||||
static const nsHTMLReflowState*
|
||||
GetPageBoxReflowState(const nsHTMLReflowState* aParentRS);
|
||||
|
||||
/**
|
||||
* Compute the border plus padding for <TT>aFrame</TT>. If a
|
||||
* percentage needs to be computed it will be computed by finding
|
||||
* the containing block, use GetContainingBlockReflowState.
|
||||
* aParentReflowState is aFrame's
|
||||
* parent's reflow state. The resulting computed border plus padding
|
||||
* is returned in aResult.
|
||||
*/
|
||||
static void ComputeBorderPaddingFor(nsIFrame* aFrame,
|
||||
const nsHTMLReflowState* aParentRS,
|
||||
nsMargin& aResult);
|
||||
|
||||
/**
|
||||
* Calculate the raw line-height property for the given frame. The return
|
||||
* value, if line-height was applied and is valid will be >= 0. Otherwise,
|
||||
* the return value will be <0 which is illegal (CSS2 spec: section 10.8.1).
|
||||
*/
|
||||
static nscoord CalcLineHeight(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext* aRenderingContext,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
static PRBool UseComputedHeight();
|
||||
|
||||
static nsCSSFrameType DetermineFrameType(nsIFrame* aFrame);
|
||||
|
||||
void ComputeContainingBlockRectangle(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState* aContainingBlockRS,
|
||||
nscoord& aContainingBlockWidth,
|
||||
nscoord& aContainingBlockHeight);
|
||||
|
||||
void CalculateBlockSideMargins(nscoord aAvailWidth,
|
||||
nscoord aComputedWidth);
|
||||
|
||||
|
||||
protected:
|
||||
// This method initializes various data members. It is automatically
|
||||
// called by the various constructors
|
||||
void Init(nsIPresContext* aPresContext,
|
||||
nscoord aContainingBlockWidth = -1,
|
||||
nscoord aContainingBlockHeight = -1);
|
||||
|
||||
void InitConstraints(nsIPresContext* aPresContext,
|
||||
nscoord aContainingBlockWidth,
|
||||
nscoord aContainingBlockHeight);
|
||||
|
||||
void CalculateHypotheticalBox(nsIPresContext* aPresContext,
|
||||
nsIFrame* aPlaceholderFrame,
|
||||
nsIFrame* aBlockFrame,
|
||||
nsMargin& aBlockContentArea,
|
||||
nsIFrame* aAbsoluteContainingBlockFrame,
|
||||
nsHypotheticalBox& aHypotheticalBox);
|
||||
|
||||
void InitAbsoluteConstraints(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState* cbrs,
|
||||
nscoord aContainingBlockWidth,
|
||||
nscoord aContainingBlockHeight);
|
||||
|
||||
void ComputeRelativeOffsets(const nsHTMLReflowState* cbrs,
|
||||
nscoord aContainingBlockWidth,
|
||||
nscoord aContainingBlockHeight);
|
||||
|
||||
void ComputeBlockBoxData(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState* cbrs,
|
||||
nsStyleUnit aWidthUnit,
|
||||
nsStyleUnit aHeightUnit,
|
||||
nscoord aContainingBlockWidth,
|
||||
nscoord aContainingBlockHeight);
|
||||
|
||||
void ComputeHorizontalValue(nscoord aContainingBlockWidth,
|
||||
nsStyleUnit aUnit,
|
||||
const nsStyleCoord& aCoord,
|
||||
nscoord& aResult);
|
||||
|
||||
void ComputeVerticalValue(nscoord aContainingBlockHeight,
|
||||
nsStyleUnit aUnit,
|
||||
const nsStyleCoord& aCoord,
|
||||
nscoord& aResult);
|
||||
|
||||
static nsCSSFrameType DetermineFrameType(nsIFrame* aFrame,
|
||||
const nsStylePosition* aPosition,
|
||||
const nsStyleDisplay* aDisplay);
|
||||
|
||||
// Computes margin values from the specified margin style information, and
|
||||
// fills in the mComputedMargin member
|
||||
void ComputeMargin(nscoord aContainingBlockWidth,
|
||||
const nsHTMLReflowState* aContainingBlockRS);
|
||||
|
||||
// Computes padding values from the specified padding style information, and
|
||||
// fills in the mComputedPadding member
|
||||
void ComputePadding(nscoord aContainingBlockWidth,
|
||||
const nsHTMLReflowState* aContainingBlockRS);
|
||||
|
||||
// Calculates the computed values for the 'min-Width', 'max-Width',
|
||||
// 'min-Height', and 'max-Height' properties, and stores them in the assorted
|
||||
// data members
|
||||
void ComputeMinMaxValues(nscoord aContainingBlockWidth,
|
||||
nscoord aContainingBlockHeight,
|
||||
const nsHTMLReflowState* aContainingBlockRS);
|
||||
|
||||
nscoord CalculateHorizBorderPaddingMargin(nscoord aContainingBlockWidth);
|
||||
};
|
||||
|
||||
#endif /* nsHTMLReflowState_h___ */
|
||||
|
||||
46
mozilla/layout/base/public/nsIAnonymousContent.h
Normal file
46
mozilla/layout/base/public/nsIAnonymousContent.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* -*- 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.org 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 nsIAnonymousContent_h___
|
||||
#define nsIAnonymousContent_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsISupportsArray;
|
||||
class nsIAtom;
|
||||
|
||||
#define NS_IANONYMOUS_CONTENT_IID { 0x41a69e00, 0x2d6d, 0x12d3, { 0xb0, 0x33, 0xa1, 0x38, 0x71, 0x39, 0x78, 0x7c } }
|
||||
|
||||
|
||||
/**
|
||||
* If a node is anonymous. Then it should implement this interface.
|
||||
*/
|
||||
class nsIAnonymousContent : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IANONYMOUS_CONTENT_IID; return iid; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
48
mozilla/layout/base/public/nsIAutoCopy.h
Normal file
48
mozilla/layout/base/public/nsIAutoCopy.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
|
||||
#ifndef nsIAutoCopyService_h__
|
||||
#define nsIAutoCopyService_h__
|
||||
|
||||
// {558B93CD-95C1-417d-A66E-F9CA66DC98A8}
|
||||
#define NS_IAUTOCOPYSERVICE_IID \
|
||||
{ 0x558b93cd, 0x95c1, 0x417d, { 0xa6, 0x6e, 0xf9, 0xca, 0x66, 0xdc, 0x98, 0xa8 } }
|
||||
|
||||
|
||||
class nsISelection;
|
||||
|
||||
class nsIAutoCopyService : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IAUTOCOPYSERVICE_IID; return iid; }
|
||||
|
||||
//This will add this service as a selection listener.
|
||||
NS_IMETHOD Listen(nsISelection *aDomSelection)=0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //nsIAutoCopyService_h__
|
||||
|
||||
131
mozilla/layout/base/public/nsICaret.h
Normal file
131
mozilla/layout/base/public/nsICaret.h
Normal file
@@ -0,0 +1,131 @@
|
||||
/* -*- 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.org 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 nsICaret_h__
|
||||
#define nsICaret_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
||||
class nsIRenderingContext;
|
||||
class nsIFrame;
|
||||
class nsIView;
|
||||
struct nsRect;
|
||||
struct nsPoint;
|
||||
|
||||
// IID for the nsICaret interface
|
||||
#define NS_ICARET_IID \
|
||||
{ 0xa6cf90e1, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
class nsICaret: public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ICARET_IID; return iid; }
|
||||
|
||||
typedef enum EViewCoordinates {
|
||||
eTopLevelWindowCoordinates,
|
||||
eRenderingViewCoordinates,
|
||||
eClosestViewCoordinates
|
||||
} EViewCoordinates;
|
||||
|
||||
NS_IMETHOD Init(nsIPresShell *inPresShell) = 0;
|
||||
|
||||
NS_IMETHOD SetCaretDOMSelection(nsISelection *aDOMSel) = 0;
|
||||
|
||||
/** SetCaretVisible will set the visibility of the caret
|
||||
* @param inMakeVisible PR_TRUE to show the caret, PR_FALSE to hide it
|
||||
*/
|
||||
NS_IMETHOD SetCaretVisible(PRBool inMakeVisible) = 0;
|
||||
|
||||
/** GetCaretVisible will get the visibility of the caret
|
||||
* @param inMakeVisible PR_TRUE it is shown, PR_FALSE it is hidden
|
||||
*/
|
||||
NS_IMETHOD GetCaretVisible(PRBool *outMakeVisible) = 0;
|
||||
|
||||
/** SetCaretReadOnly set the appearance of the caret
|
||||
* @param inMakeReadonly PR_TRUE to show the caret in a 'read only' state,
|
||||
* PR_FALSE to show the caret in normal, editing state
|
||||
*/
|
||||
NS_IMETHOD SetCaretReadOnly(PRBool inMakeReadonly) = 0;
|
||||
|
||||
/** GetCaretCoordinates
|
||||
* Get the position of the caret in coordinates relative to the typed specified (aRelativeToType).
|
||||
* If the selection is collapsed, this returns the caret location
|
||||
* and true in outIsCollapsed.
|
||||
* If the selection is not collapsed, this returns the location of the focus pos,
|
||||
* and false in outIsCollapsed.
|
||||
*/
|
||||
NS_IMETHOD GetCaretCoordinates(EViewCoordinates aRelativeToType, nsISelection *aDOMSel, nsRect *outCoordinates, PRBool *outIsCollapsed) = 0;
|
||||
|
||||
/** ClearFrameRefs
|
||||
* The caret stores a reference to the frame that the caret was last drawn in.
|
||||
* This is called to tell the caret that that frame is going away.
|
||||
*/
|
||||
NS_IMETHOD ClearFrameRefs(nsIFrame* aFrame) = 0;
|
||||
/** Erase Caret
|
||||
* this will erase the caret if its drawn and reset drawn status
|
||||
*/
|
||||
NS_IMETHOD EraseCaret() = 0;
|
||||
|
||||
/** Set Caret Width
|
||||
* this will set the caret width to the passed in value.
|
||||
*/
|
||||
NS_IMETHOD SetCaretWidth(nscoord aPixels) = 0;
|
||||
|
||||
};
|
||||
|
||||
extern nsresult NS_NewCaret(nsICaret** aInstancePtrResult);
|
||||
|
||||
|
||||
// handy stack-based class for temporarily disabling the caret
|
||||
|
||||
class StCaretHider
|
||||
{
|
||||
public:
|
||||
StCaretHider(nsICaret* aSelCon)
|
||||
: mWasVisible(PR_FALSE), mCaret(aSelCon)
|
||||
{
|
||||
if (mCaret)
|
||||
{
|
||||
mCaret->GetCaretVisible(&mWasVisible);
|
||||
if (mWasVisible)
|
||||
mCaret->SetCaretVisible(PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
~StCaretHider()
|
||||
{
|
||||
if (mCaret && mWasVisible)
|
||||
mCaret->SetCaretVisible(PR_TRUE);
|
||||
// nsCOMPtr releases mPresShell
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
PRBool mWasVisible;
|
||||
nsCOMPtr<nsICaret> mCaret;
|
||||
};
|
||||
|
||||
|
||||
#endif // nsICaret_h__
|
||||
|
||||
50
mozilla/layout/base/public/nsIChromeEventHandler.idl
Normal file
50
mozilla/layout/base/public/nsIChromeEventHandler.idl
Normal file
@@ -0,0 +1,50 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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 the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications, Inc. Portions created by Netscape are
|
||||
* Copyright (C) 1999, Mozilla. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Travis Bogard <travis@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "domstubs.idl"
|
||||
|
||||
%{ C++
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
%}
|
||||
|
||||
[ptr] native nsIPresContext(nsIPresContext);
|
||||
[ptr] native nsIDOMEvent(nsIDOMEvent);
|
||||
native nsEvent(nsEvent);
|
||||
[ptr] native nsEventPtr(nsEvent);
|
||||
native nsEventStatus(nsEventStatus);
|
||||
|
||||
/**
|
||||
* The nsIChromeEventHandler
|
||||
*/
|
||||
|
||||
[scriptable, uuid(7BC08970-9E6C-11d3-AFB2-00A024FFC08C)]
|
||||
interface nsIChromeEventHandler : nsISupports
|
||||
{
|
||||
/**
|
||||
* Handle a chrome DOM event.
|
||||
*/
|
||||
[noscript] void handleChromeEvent(in nsIPresContext aPresContext,
|
||||
in nsEventPtr aEvent, out nsIDOMEvent aDOMEvent, in unsigned long aFlags,
|
||||
inout nsEventStatus aStatus);
|
||||
};
|
||||
308
mozilla/layout/base/public/nsIContent.h
Normal file
308
mozilla/layout/base/public/nsIContent.h
Normal file
@@ -0,0 +1,308 @@
|
||||
/* -*- 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 nsIContent_h___
|
||||
#define nsIContent_h___
|
||||
|
||||
#include <stdio.h>
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsAWritableString.h"
|
||||
|
||||
// Forward declarations
|
||||
class nsIAtom;
|
||||
class nsIDocument;
|
||||
class nsIPresContext;
|
||||
class nsVoidArray;
|
||||
class nsIDOMEvent;
|
||||
class nsIContent;
|
||||
class nsISupportsArray;
|
||||
class nsIDOMRange;
|
||||
class nsISizeOfHandler;
|
||||
class nsINodeInfo;
|
||||
|
||||
// IID for the nsIContent interface
|
||||
#define NS_ICONTENT_IID \
|
||||
{ 0x78030220, 0x9447, 0x11d1, \
|
||||
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
// A node of content in a documents content model. This interface
|
||||
// is supported by all content objects.
|
||||
class nsIContent : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ICONTENT_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetDocument(nsIDocument*& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) = 0;
|
||||
|
||||
NS_IMETHOD GetParent(nsIContent*& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD SetParent(nsIContent* aParent) = 0;
|
||||
|
||||
/**
|
||||
* Get the namespace that this tag is defined in
|
||||
*/
|
||||
NS_IMETHOD GetNameSpaceID(PRInt32& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD GetTag(nsIAtom*& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD CanContainChildren(PRBool& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD ChildCount(PRInt32& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aIndex) const = 0;
|
||||
|
||||
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex,
|
||||
PRBool aNotify) = 0;
|
||||
|
||||
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex,
|
||||
PRBool aNotify) = 0;
|
||||
|
||||
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify) = 0;
|
||||
|
||||
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify) = 0;
|
||||
|
||||
/**
|
||||
* Normalizes an attribute string into an atom that represents the
|
||||
* qualified attribute name of the attribute. This method is intended
|
||||
* for character case conversion if the content object is case
|
||||
* insensitive (e.g. HTML).
|
||||
*
|
||||
* @param aStr the unparsed attribute string
|
||||
* @param aName out parameter representing the complete name of the
|
||||
* attribute
|
||||
*/
|
||||
NS_IMETHOD NormalizeAttributeString(const nsAReadableString& aStr,
|
||||
nsINodeInfo*& aNodeInfo) = 0;
|
||||
|
||||
/**
|
||||
* Set attribute values. All attribute values are assumed to have a
|
||||
* canonical String representation that can be used for these
|
||||
* methods. The setAttribute method is assumed to perform a translation
|
||||
* of the canonical form into the underlying content specific
|
||||
* form.
|
||||
*
|
||||
* @param aName the name of the attribute
|
||||
|
||||
* @param aValue may legitimately be the empty string.
|
||||
*
|
||||
* @param aUpdateMask specifies how whether or not the document should be
|
||||
* notified of the attribute change.
|
||||
*/
|
||||
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
const nsAReadableString& aValue,
|
||||
PRBool aNotify) = 0;
|
||||
|
||||
/**
|
||||
* Set attribute values. All attribute values are assumed to have a
|
||||
* canonical string representation that can be used for these
|
||||
* methods. The setAttribute method is assumed to perform a translation
|
||||
* of the canonical form into the underlying content specific
|
||||
* form.
|
||||
*
|
||||
* @param aNodeInfo the node info (name, prefix, namespace id) of the
|
||||
* attribute
|
||||
* @param aValue may legitimately be the empty string.
|
||||
*
|
||||
* @param aNotify specifies whether or not the document should be
|
||||
* notified of the attribute change.
|
||||
*/
|
||||
NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo,
|
||||
const nsAReadableString& aValue,
|
||||
PRBool aNotify) = 0;
|
||||
|
||||
/**
|
||||
* Get the current value of the attribute. This returns a form that is
|
||||
* suitable for passing back into setAttribute.
|
||||
*
|
||||
* <UL>
|
||||
*
|
||||
* <LI>If the attribute is not set and has no default value, return
|
||||
* NS_CONTENT_ATTR_NOT_THERE.
|
||||
*
|
||||
* <LI>If the attribute exists, but has no value, return
|
||||
* NS_CONTENT_ATTR_NO_VALUE.
|
||||
*
|
||||
* <LI>If the attribute has a non-empty value, set ret to
|
||||
* be the value, and return NS_CONTENT_ATTR_HAS_VALUE (== NS_OK).
|
||||
*
|
||||
* </UL>
|
||||
*/
|
||||
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
nsAWritableString& aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Get the current value and prefix of the attribute. This returns a form
|
||||
* that is suitable for passing back into setAttribute.
|
||||
*
|
||||
* <UL>
|
||||
*
|
||||
* <LI>If the attribute is not set and has no default value, return
|
||||
* NS_CONTENT_ATTR_NOT_THERE.
|
||||
*
|
||||
* <LI>If the attribute exists, but has no value, return
|
||||
* NS_CONTENT_ATTR_NO_VALUE.
|
||||
*
|
||||
* <LI>If the attribute has a non-empty value, set ret to
|
||||
* be the value, and return NS_CONTENT_ATTR_HAS_VALUE (== NS_OK).
|
||||
*
|
||||
* </UL>
|
||||
*
|
||||
* NOTE! aPrefix is an OUT parameter.
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
nsIAtom*& aPrefix, nsAWritableString& aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Remove an attribute so that it is no longer explicitly specified.
|
||||
*
|
||||
* @param aAttribute the name of the attribute to unset
|
||||
*
|
||||
* @param aNotify specifies whether or not the document should be
|
||||
* notified of the attribute change
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
PRBool aNotify) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Get the namespace & name of a given attribute.
|
||||
*
|
||||
* @param aIndex the index of the attribute name
|
||||
* @param aNameSpace an out param of the name space ID of the attribute name
|
||||
* @param aName an out param if the attribute name
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
|
||||
PRInt32& aNameSpaceID,
|
||||
nsIAtom*& aName,
|
||||
nsIAtom*& aPrefix) const = 0;
|
||||
|
||||
/**
|
||||
* Get the number of all specified attributes.
|
||||
*
|
||||
* @param aCountResult an out parameter to be filled in with
|
||||
* the number of attributes
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetAttributeCount(PRInt32& aCountResult) const = 0;
|
||||
|
||||
/**
|
||||
* Get the size of the content object. The size value should include
|
||||
* all subordinate data referenced by the content that is not
|
||||
* accounted for by child content. However, this value should not
|
||||
* include the frame objects, style contexts, views or other data
|
||||
* that lies logically outside the content model.
|
||||
*
|
||||
* If the implementation so chooses, instead of returning the total
|
||||
* subordinate data it may instead use the sizeof handler to store
|
||||
* away subordinate data under its own key so that the subordinate
|
||||
* data may be tabulated independently of the frame itself.
|
||||
*
|
||||
* The caller is responsible for recursing over all children that
|
||||
* the content contains.
|
||||
*/
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0;
|
||||
|
||||
/**
|
||||
* List the content (and anything it contains) out to the given
|
||||
* file stream. Use aIndent as the base indent during formatting.
|
||||
* Returns NS_OK unless a file error occurs.
|
||||
*/
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0;
|
||||
|
||||
/**
|
||||
* Dump the content (and anything it contains) out to the given
|
||||
* file stream. Use aIndent as the base indent during formatting.
|
||||
* Returns NS_OK unless a file error occurs.
|
||||
*/
|
||||
NS_IMETHOD DumpContent(FILE* out = stdout, PRInt32 aIndent = 0,PRBool aDumpAll=PR_TRUE) const = 0;
|
||||
|
||||
/**
|
||||
* Inform content of range ownership changes. This allows content
|
||||
* to do the right thing to ranges in the face of changes to the content
|
||||
* model.
|
||||
|
||||
* RangeAdd -- informs content that it owns one or both range endpoints
|
||||
* RangeRemove -- informs content that it no longer owns a range endpoint
|
||||
* GetRangeList -- returns the list of ranges that have one or both endpoints
|
||||
* within this content item
|
||||
*/
|
||||
NS_IMETHOD RangeAdd(nsIDOMRange& aRange) = 0;
|
||||
NS_IMETHOD RangeRemove(nsIDOMRange& aRange) = 0;
|
||||
NS_IMETHOD GetRangeList(nsVoidArray*& aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Handle a DOM event for this piece of content.
|
||||
*/
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus) = 0;
|
||||
|
||||
/**
|
||||
* Get and set a unique ID for this piece of content.
|
||||
* This ID is used as a key to store state information
|
||||
* about this content object and its associated frame object.
|
||||
* The state information is stored in a dictionary that is
|
||||
* manipulated by the frame manager (nsIFrameManager) inside layout.
|
||||
* An opaque pointer to this dictionary is passed to the session
|
||||
* history as a handle associated with the current document's state
|
||||
*/
|
||||
NS_IMETHOD GetContentID(PRUint32* aID) = 0;
|
||||
NS_IMETHOD SetContentID(PRUint32 aID) = 0;
|
||||
|
||||
/**
|
||||
* All content elements are potentially focusable (according to CSS3).
|
||||
* These methods are used to set and remove the focus on the content
|
||||
* element.
|
||||
*/
|
||||
NS_IMETHOD SetFocus(nsIPresContext* aPresContext) = 0;
|
||||
NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext) = 0;
|
||||
|
||||
/**
|
||||
* APIs for setting and obtaining the content node
|
||||
* with the binding responsible for our construction (and existence)
|
||||
* Used by anonymous content (XBL-generated). null for all explicit content.
|
||||
*/
|
||||
NS_IMETHOD SetBindingParent(nsIContent* aContent) = 0;
|
||||
NS_IMETHOD GetBindingParent(nsIContent** aContent) = 0;
|
||||
};
|
||||
|
||||
// nsresult codes for GetAttribute
|
||||
#define NS_CONTENT_ATTR_HAS_VALUE NS_OK
|
||||
|
||||
#define NS_CONTENT_ATTR_NO_VALUE \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_LAYOUT,0)
|
||||
|
||||
#define NS_CONTENT_ATTR_NOT_THERE \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_LAYOUT,1)
|
||||
|
||||
#endif /* nsIContent_h___ */
|
||||
113
mozilla/layout/base/public/nsIContentIterator.h
Normal file
113
mozilla/layout/base/public/nsIContentIterator.h
Normal file
@@ -0,0 +1,113 @@
|
||||
/* -*- Mode: C++; tab-width: 4; 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.org 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 __nsIContentIterator_h___
|
||||
#define __nsIContentIterator_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
|
||||
class nsIFocusTracker;
|
||||
class nsIContent;
|
||||
class nsIDOMRange;
|
||||
|
||||
#define NS_ICONTENTITERTOR_IID \
|
||||
{0xa6cf90e4, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
// {B4BC9F63-D9BA-11d3-9938-00108301233C}
|
||||
#define NS_IGENERATEDCONTENTITERTOR_IID \
|
||||
{ 0xb4bc9f63, 0xd9ba, 0x11d3, \
|
||||
{ 0x99, 0x38, 0x0, 0x10, 0x83, 0x1, 0x23, 0x3c } }
|
||||
|
||||
|
||||
class nsIContentIterator : public nsISupports {
|
||||
public:
|
||||
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ICONTENTITERTOR_IID; return iid; }
|
||||
|
||||
/* Initializes an iterator for the subtree rooted by the node aRoot
|
||||
*/
|
||||
NS_IMETHOD Init(nsIContent* aRoot)=0;
|
||||
|
||||
/* Initializes an iterator for the subtree defined by the range aRange
|
||||
*/
|
||||
NS_IMETHOD Init(nsIDOMRange* aRange)=0;
|
||||
|
||||
/** First will reset the list. will return NS_FAILED if no items
|
||||
*/
|
||||
NS_IMETHOD First()=0;
|
||||
|
||||
/** Last will reset the list to the end. will return NS_FAILED if no items
|
||||
*/
|
||||
NS_IMETHOD Last()=0;
|
||||
|
||||
/** Next will advance the list. will return failed if allready at end
|
||||
*/
|
||||
NS_IMETHOD Next()=0;
|
||||
|
||||
/** Prev will decrement the list. will return failed if allready at beginning
|
||||
*/
|
||||
NS_IMETHOD Prev()=0;
|
||||
|
||||
/** CurrentItem will return the CurrentItem item it will fail if the list is empty
|
||||
* @param aItem return value
|
||||
*/
|
||||
NS_IMETHOD CurrentNode(nsIContent **aNode)=0;
|
||||
|
||||
/** return if the collection is at the end. that is the beginning following a call to Prev
|
||||
* and it is the end of the list following a call to next
|
||||
* @param aItem return value
|
||||
*/
|
||||
NS_IMETHOD IsDone()=0;
|
||||
|
||||
/** PositionAt will position the iterator to the supplied node
|
||||
*/
|
||||
NS_IMETHOD PositionAt(nsIContent* aCurNode)=0;
|
||||
|
||||
/** MakePre will make the iterator a pre-order iterator
|
||||
*/
|
||||
NS_IMETHOD MakePre()=0;
|
||||
|
||||
/** MakePost will make the iterator a post-order iterator
|
||||
*/
|
||||
NS_IMETHOD MakePost()=0;
|
||||
|
||||
};
|
||||
|
||||
class nsIPresShell;
|
||||
|
||||
class nsIGeneratedContentIterator : public nsISupports {
|
||||
public:
|
||||
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IGENERATEDCONTENTITERTOR_IID; return iid; }
|
||||
|
||||
/* Initializes an iterator for the subtree rooted by the node aRoot
|
||||
*/
|
||||
NS_IMETHOD Init(nsIPresShell *aShell, nsIDOMRange* aRange)=0;
|
||||
|
||||
NS_IMETHOD Init(nsIPresShell *aShell, nsIContent* aContent)=0;
|
||||
};
|
||||
|
||||
|
||||
#endif // __nsIContentIterator_h___
|
||||
|
||||
56
mozilla/layout/base/public/nsIContentPolicy.idl
Normal file
56
mozilla/layout/base/public/nsIContentPolicy.idl
Normal file
@@ -0,0 +1,56 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* 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 code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Zero-Knowledge Systems,
|
||||
* Inc. Portions created by Zero-Knowledge are Copyright (C) 2000
|
||||
* Zero-Knowledge Systems, Inc. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIURL.idl"
|
||||
#include "domstubs.idl"
|
||||
|
||||
/**
|
||||
* Interface for content policy mechanism. Implementations of this
|
||||
* interface can be used to control loading of various types of out-of-line
|
||||
* content, or processing of certain types of in-line content.
|
||||
*/
|
||||
|
||||
[scriptable,uuid(1cb4085d-5407-4169-bcfe-4c5ba013fa5b)]
|
||||
interface nsIContentPolicy : nsISupports
|
||||
{
|
||||
const short CONTENT_OTHER = 0;
|
||||
const short CONTENT_SCRIPT = 1;
|
||||
const short CONTENT_IMAGE = 2;
|
||||
const short CONTENT_STYLESHEET = 3;
|
||||
const short CONTENT_OBJECT = 4;
|
||||
|
||||
/**
|
||||
* Should the content at this location be loaded and processed?
|
||||
*
|
||||
* XXX Permit URL-rewriting?
|
||||
* XXX Use MIME types for contentType?
|
||||
* XXX Use nsIURL for location?
|
||||
*/
|
||||
boolean shouldLoad(in PRInt32 contentType, in nsIDOMElement element,
|
||||
in wstring contentLocation);
|
||||
|
||||
/**
|
||||
* Should the contents of the element in question be processed?
|
||||
*/
|
||||
boolean shouldProcess(in PRInt32 contentType, in nsIDOMElement element,
|
||||
in wstring documentLocation);
|
||||
};
|
||||
82
mozilla/layout/base/public/nsIContentSerializer.h
Normal file
82
mozilla/layout/base/public/nsIContentSerializer.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/* -*- 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.org 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 _nsIContentSerializer_h__
|
||||
#define _nsIContentSerializer_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsAWritableString.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
class nsIDOMText; /* forward declaration */
|
||||
class nsIDOMCDATASection; /* forward declaration */
|
||||
class nsIDOMProcessingInstruction; /* forward declaration */
|
||||
class nsIDOMComment; /* forward declaration */
|
||||
class nsIDOMDocumentType; /* forward declaration */
|
||||
class nsIDOMElement; /* forward declaration */
|
||||
|
||||
/* starting interface: nsIContentSerializer */
|
||||
#define NS_ICONTENTSERIALIZER_IID_STR "61e9b9a3-d30c-429e-b0cf-ade73466df06"
|
||||
|
||||
#define NS_ICONTENTSERIALIZER_IID \
|
||||
{0x61e9b9a3, 0xd30c, 0x429e, \
|
||||
{ 0xb0, 0xcf, 0xad, 0xe7, 0x34, 0x66, 0xdf, 0x06 }}
|
||||
|
||||
class nsIContentSerializer : public nsISupports {
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICONTENTSERIALIZER_IID)
|
||||
|
||||
NS_IMETHOD Init(PRUint32 flags, PRUint32 aWrapColumn,
|
||||
nsIAtom* aCharSet) = 0;
|
||||
|
||||
NS_IMETHOD AppendText(nsIDOMText* aText, PRInt32 aStartOffset,
|
||||
PRInt32 aEndOffset, nsAWritableString& aStr) = 0;
|
||||
|
||||
NS_IMETHOD AppendCDATASection(nsIDOMCDATASection* aCDATASection,
|
||||
PRInt32 aStartOffset, PRInt32 aEndOffset,
|
||||
nsAWritableString& aStr) = 0;
|
||||
|
||||
NS_IMETHOD AppendProcessingInstruction(nsIDOMProcessingInstruction* aPI,
|
||||
PRInt32 aStartOffset,
|
||||
PRInt32 aEndOffset,
|
||||
nsAWritableString& aStr) = 0;
|
||||
|
||||
NS_IMETHOD AppendComment(nsIDOMComment* aComment, PRInt32 aStartOffset,
|
||||
PRInt32 aEndOffset, nsAWritableString& aStr) = 0;
|
||||
|
||||
NS_IMETHOD AppendDoctype(nsIDOMDocumentType *aDoctype,
|
||||
nsAWritableString& aStr) = 0;
|
||||
|
||||
NS_IMETHOD AppendElementStart(nsIDOMElement *aElement,
|
||||
nsAWritableString& aStr) = 0;
|
||||
|
||||
NS_IMETHOD AppendElementEnd(nsIDOMElement *aElement,
|
||||
nsAWritableString& aStr) = 0;
|
||||
|
||||
NS_IMETHOD Flush(nsAWritableString& aStr) = 0;
|
||||
};
|
||||
|
||||
#define NS_CONTENTSERIALIZER_CONTRACTID_PREFIX \
|
||||
"@mozilla.org/layout/contentserializer;1?mimetype="
|
||||
|
||||
#endif /* __gen_nsIContentSerializer_h__ */
|
||||
83
mozilla/layout/base/public/nsIDiskDocument.idl
Normal file
83
mozilla/layout/base/public/nsIDiskDocument.idl
Normal file
@@ -0,0 +1,83 @@
|
||||
/* -*- 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.org 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.
|
||||
*
|
||||
* Original Author: Simon Fraser (sfraser@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIFile.idl"
|
||||
|
||||
// {dd038282-d5a2-11d4-aedb-e1c4b1c8b9fc}
|
||||
[scriptable, uuid(dd038282-d5a2-11d4-aedb-e1c4b1c8b9fc)]
|
||||
interface nsIDiskDocument : nsISupports
|
||||
{
|
||||
/** An nsIFile pointing to the location of the file on disk. May be null if
|
||||
* this document has not been saved yet
|
||||
*/
|
||||
readonly attribute nsIFile fileSpec;
|
||||
|
||||
/** The modification count for the document. A +ve mod count indicates
|
||||
* that the document is dirty, and needs saving.
|
||||
*/
|
||||
readonly attribute long modificationCount;
|
||||
|
||||
/** Initialize the document output. This may be called on document
|
||||
* creation, or lazily before the first save. For a document read
|
||||
* in from disk, it should be called on document instantiation.
|
||||
*
|
||||
* @param aFile nsIFile for the file, if a disk version
|
||||
* of the file exists already. Otherwise nsnull.
|
||||
*/
|
||||
void InitDiskDocument(in nsIFile aFile);
|
||||
|
||||
|
||||
/** Save the file to disk. This will be called after the caller has
|
||||
* displayed a put file dialog, which the user confirmed. The internal
|
||||
* fileSpec of the document is only updated with the given fileSpec if inSaveCopy == PR_FALSE.
|
||||
*
|
||||
* @param aFile File to which to stream the document.
|
||||
* @param aReplaceExisting true if replacing an existing file, otherwise false.
|
||||
* If false and aFile exists, SaveFile returns an error.
|
||||
* @param aSaveCopy True to save a copy of the file, without changing the file
|
||||
* referenced internally.
|
||||
* @param aFileType Mime type to save (text/plain or text/html)
|
||||
* @param aFileCharset Charset to save the document in. If this is an empty
|
||||
* string, or "UCS2", then the doc will be saved as Unicode.
|
||||
* @param aSaveFlags Flags used by the document encoder (see nsIDocumentEncoder).
|
||||
* @param inWrapColumn Wrap column, assuming that flags specify wrapping.
|
||||
*/
|
||||
void SaveFile(in nsIFile aFile, in boolean aReplaceExisting, in boolean aSaveCopy,
|
||||
in wstring aFileType, in wstring aFileCharset, in unsigned long aSaveFlags,
|
||||
in unsigned long aWrapColumn);
|
||||
|
||||
/** Reset the modification count for the document. This marks the documents as
|
||||
* 'clean' and not in need of saving.
|
||||
*/
|
||||
void ResetModificationCount();
|
||||
|
||||
/** Increment the modification count for the document by the given
|
||||
* amount (which may be -ve).
|
||||
*/
|
||||
void IncrementModificationCount(in long aNumMods);
|
||||
|
||||
};
|
||||
|
||||
|
||||
336
mozilla/layout/base/public/nsIDocument.h
Normal file
336
mozilla/layout/base/public/nsIDocument.h
Normal file
@@ -0,0 +1,336 @@
|
||||
/* -*- 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.org 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 nsIDocument_h___
|
||||
#define nsIDocument_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsAWritableString.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIArena;
|
||||
class nsIContent;
|
||||
class nsIDocumentContainer;
|
||||
class nsIDocumentObserver;
|
||||
class nsIPresContext;
|
||||
class nsIPresShell;
|
||||
|
||||
class nsIStreamListener;
|
||||
class nsIStreamObserver;
|
||||
class nsIStyleSet;
|
||||
class nsIStyleSheet;
|
||||
class nsIStyleRule;
|
||||
class nsIURI;
|
||||
class nsILoadGroup;
|
||||
class nsIViewManager;
|
||||
class nsIScriptGlobalObject;
|
||||
class nsIDOMEvent;
|
||||
class nsIDeviceContext;
|
||||
class nsIParser;
|
||||
class nsIDOMNode;
|
||||
class nsINameSpaceManager;
|
||||
class nsIDOMDocumentFragment;
|
||||
class nsILineBreaker;
|
||||
class nsIWordBreaker;
|
||||
class nsISelection;
|
||||
class nsIChannel;
|
||||
class nsIPrincipal;
|
||||
class nsINodeInfoManager;
|
||||
class nsIDOMDocument;
|
||||
class nsIDOMDocumentType;
|
||||
class nsIBindingManager;
|
||||
class nsIObserver;
|
||||
class nsISupportsArray;
|
||||
|
||||
// IID for the nsIDocument interface
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0x94c6ceb0, 0x9447, 0x11d1, \
|
||||
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
// The base value for the content ID counter.
|
||||
// This counter is used by the document to
|
||||
// assign a monotonically increasing ID to each content
|
||||
// object it creates
|
||||
#define NS_CONTENT_ID_COUNTER_BASE 10000
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Document interface
|
||||
class nsIDocument : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOCUMENT_IID; return iid; }
|
||||
|
||||
// All documents have a memory arena associated with them which is
|
||||
// used for memory allocation during document creation. This call
|
||||
// returns the arena associated with this document.
|
||||
virtual nsIArena* GetArena() = 0;
|
||||
|
||||
NS_IMETHOD StartDocumentLoad(const char* aCommand,
|
||||
nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
nsISupports* aContainer,
|
||||
nsIStreamListener **aDocListener,
|
||||
PRBool aReset) = 0;
|
||||
|
||||
NS_IMETHOD StopDocumentLoad() = 0;
|
||||
|
||||
/**
|
||||
* Return the title of the document. May return null.
|
||||
*/
|
||||
virtual const nsString* GetDocumentTitle() const = 0;
|
||||
|
||||
/**
|
||||
* Return the URL for the document. May return null.
|
||||
*/
|
||||
virtual nsIURI* GetDocumentURL() const = 0;
|
||||
|
||||
/**
|
||||
* Return the principal responsible for this document.
|
||||
*/
|
||||
NS_IMETHOD GetPrincipal(nsIPrincipal **aPrincipal) = 0;
|
||||
|
||||
/**
|
||||
* Update principal responsible for this document to the intersection
|
||||
* of its previous value and aPrincipal.
|
||||
*/
|
||||
NS_IMETHOD AddPrincipal(nsIPrincipal *aPrincipal) = 0;
|
||||
|
||||
/**
|
||||
* Return the LoadGroup for the document. May return null.
|
||||
*/
|
||||
NS_IMETHOD GetDocumentLoadGroup(nsILoadGroup** aGroup) const = 0;
|
||||
|
||||
/**
|
||||
* Return the base URL for realtive URLs in the document. May return null (or the document URL).
|
||||
*/
|
||||
NS_IMETHOD GetBaseURL(nsIURI*& aURL) const = 0;
|
||||
|
||||
/**
|
||||
* Return the content (mime) type of this document.
|
||||
*/
|
||||
NS_IMETHOD GetContentType(nsAWritableString& aContentType) const = 0;
|
||||
|
||||
/**
|
||||
* Return a standard name for the document's character set. This will
|
||||
* trigger a startDocumentLoad if necessary to answer the question.
|
||||
*/
|
||||
NS_IMETHOD GetDocumentCharacterSet(nsAWritableString& oCharSetID) = 0;
|
||||
NS_IMETHOD SetDocumentCharacterSet(const nsAReadableString& aCharSetID) = 0;
|
||||
|
||||
/**
|
||||
* Add an observer that gets notified whenever the charset changes.
|
||||
*/
|
||||
NS_IMETHOD AddCharSetObserver(nsIObserver* aObserver) = 0;
|
||||
|
||||
/**
|
||||
* Remove a charset observer.
|
||||
*/
|
||||
NS_IMETHOD RemoveCharSetObserver(nsIObserver* aObserver) = 0;
|
||||
|
||||
/**
|
||||
* Return the Line Breaker for the document
|
||||
*/
|
||||
NS_IMETHOD GetLineBreaker(nsILineBreaker** aResult) = 0;
|
||||
NS_IMETHOD SetLineBreaker(nsILineBreaker* aLineBreaker) = 0;
|
||||
NS_IMETHOD GetWordBreaker(nsIWordBreaker** aResult) = 0;
|
||||
NS_IMETHOD SetWordBreaker(nsIWordBreaker* aWordBreaker) = 0;
|
||||
|
||||
/**
|
||||
* Access HTTP header data (this may also get set from other sources, like
|
||||
* HTML META tags).
|
||||
*/
|
||||
NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsAWritableString& aData) const = 0;
|
||||
NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsAReadableString& aData) = 0;
|
||||
|
||||
/**
|
||||
* Create a new presentation shell that will use aContext for
|
||||
* it's presentation context (presentation context's <b>must not</b> be
|
||||
* shared among multiple presentation shell's).
|
||||
*/
|
||||
NS_IMETHOD CreateShell(nsIPresContext* aContext,
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet,
|
||||
nsIPresShell** aInstancePtrResult) = 0;
|
||||
virtual PRBool DeleteShell(nsIPresShell* aShell) = 0;
|
||||
virtual PRInt32 GetNumberOfShells() = 0;
|
||||
virtual nsIPresShell* GetShellAt(PRInt32 aIndex) = 0;
|
||||
|
||||
/**
|
||||
* Return the parent document of this document. Will return null
|
||||
* unless this document is within a compound document and has a parent.
|
||||
*/
|
||||
virtual nsIDocument* GetParentDocument() = 0;
|
||||
virtual void SetParentDocument(nsIDocument* aParent) = 0;
|
||||
virtual void AddSubDocument(nsIDocument* aSubDoc) = 0;
|
||||
virtual PRInt32 GetNumberOfSubDocuments() = 0;
|
||||
virtual nsIDocument* GetSubDocumentAt(PRInt32 aIndex) = 0;
|
||||
|
||||
/**
|
||||
* Return the root content object for this document.
|
||||
*/
|
||||
virtual nsIContent* GetRootContent() = 0;
|
||||
virtual void SetRootContent(nsIContent* aRoot) = 0;
|
||||
|
||||
/**
|
||||
* Get the direct children of the document - content in
|
||||
* the prolog, the root content and content in the epilog.
|
||||
*/
|
||||
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const = 0;
|
||||
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aIndex) const = 0;
|
||||
NS_IMETHOD GetChildCount(PRInt32& aCount) = 0;
|
||||
|
||||
/**
|
||||
* Get the style sheets owned by this document.
|
||||
* Style sheets are ordered, most significant last.
|
||||
*/
|
||||
virtual PRInt32 GetNumberOfStyleSheets() = 0;
|
||||
virtual nsIStyleSheet* GetStyleSheetAt(PRInt32 aIndex) = 0;
|
||||
virtual PRInt32 GetIndexOfStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual void AddStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual void RemoveStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
NS_IMETHOD UpdateStyleSheets(nsISupportsArray* aOldSheets, nsISupportsArray* aNewSheets) = 0;
|
||||
|
||||
NS_IMETHOD InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex, PRBool aNotify) = 0;
|
||||
virtual void SetStyleSheetDisabledState(nsIStyleSheet* aSheet,
|
||||
PRBool mDisabled) = 0;
|
||||
|
||||
/**
|
||||
* Set the object from which a document can get a script context.
|
||||
* This is the context within which all scripts (during document
|
||||
* creation and during event handling) will run.
|
||||
*/
|
||||
NS_IMETHOD GetScriptGlobalObject(nsIScriptGlobalObject** aGlobalObject) = 0;
|
||||
NS_IMETHOD SetScriptGlobalObject(nsIScriptGlobalObject* aGlobalObject) = 0;
|
||||
|
||||
/**
|
||||
* Get the name space manager for this document
|
||||
*/
|
||||
NS_IMETHOD GetNameSpaceManager(nsINameSpaceManager*& aManager) = 0;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Document notification API's
|
||||
|
||||
/**
|
||||
* Add a new observer of document change notifications. Whenever
|
||||
* content is changed, appended, inserted or removed the observers are
|
||||
* informed.
|
||||
*/
|
||||
virtual void AddObserver(nsIDocumentObserver* aObserver) = 0;
|
||||
|
||||
/**
|
||||
* Remove an observer of document change notifications. This will
|
||||
* return false if the observer cannot be found.
|
||||
*/
|
||||
virtual PRBool RemoveObserver(nsIDocumentObserver* aObserver) = 0;
|
||||
|
||||
// Observation hooks used by content nodes to propagate
|
||||
// notifications to document observers.
|
||||
NS_IMETHOD BeginUpdate() = 0;
|
||||
NS_IMETHOD EndUpdate() = 0;
|
||||
NS_IMETHOD BeginLoad() = 0;
|
||||
NS_IMETHOD EndLoad() = 0;
|
||||
NS_IMETHOD ContentChanged(nsIContent* aContent,
|
||||
nsISupports* aSubContent) = 0;
|
||||
// notify that one or two content nodes changed state
|
||||
// either may be nsnull, but not both
|
||||
NS_IMETHOD ContentStatesChanged(nsIContent* aContent1,
|
||||
nsIContent* aContent2) = 0;
|
||||
NS_IMETHOD AttributeChanged(nsIContent* aChild,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
|
||||
NS_IMETHOD ContentAppended(nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer) = 0;
|
||||
NS_IMETHOD ContentInserted(nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
NS_IMETHOD ContentReplaced(nsIContent* aContainer,
|
||||
nsIContent* aOldChild,
|
||||
nsIContent* aNewChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
NS_IMETHOD ContentRemoved(nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
|
||||
// Observation hooks for style data to propogate notifications
|
||||
// to document observers
|
||||
NS_IMETHOD StyleRuleChanged(nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule,
|
||||
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
|
||||
NS_IMETHOD StyleRuleAdded(nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule) = 0;
|
||||
NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule) = 0;
|
||||
|
||||
/**
|
||||
* Finds text in content
|
||||
*/
|
||||
NS_IMETHOD FindNext(const nsAReadableString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) = 0;
|
||||
|
||||
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus) = 0;
|
||||
|
||||
NS_IMETHOD FlushPendingNotifications(PRBool aFlushReflows=PR_TRUE) = 0;
|
||||
|
||||
NS_IMETHOD GetAndIncrementContentID(PRInt32* aID) = 0;
|
||||
|
||||
NS_IMETHOD GetBindingManager(nsIBindingManager** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager) = 0;
|
||||
};
|
||||
|
||||
|
||||
// XXX These belong somewhere else
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewHTMLDocument(nsIDocument** aInstancePtrResult);
|
||||
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewXMLDocument(nsIDocument** aInstancePtrResult);
|
||||
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewImageDocument(nsIDocument** aInstancePtrResult);
|
||||
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewDocumentFragment(nsIDOMDocumentFragment** aInstancePtrResult,
|
||||
nsIDocument* aOwnerDocument);
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewDOMDocument(nsIDOMDocument** aInstancePtrResult,
|
||||
const nsAReadableString& aNamespaceURI,
|
||||
const nsAReadableString& aQualifiedName,
|
||||
nsIDOMDocumentType* aDoctype,
|
||||
nsIURI* aBaseURI);
|
||||
|
||||
// Note: The buffer passed into NewPostData(...) becomes owned by the IPostData
|
||||
// instance and is freed when the instance is destroyed...
|
||||
//
|
||||
#if 0
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewPostData(PRBool aIsFile, char *aData, nsIPostData** aInstancePtrResult);
|
||||
#endif
|
||||
|
||||
#endif /* nsIDocument_h___ */
|
||||
75
mozilla/layout/base/public/nsIDocumentContainer.h
Normal file
75
mozilla/layout/base/public/nsIDocumentContainer.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- 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.org 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 nsIDocumentContainer_h___
|
||||
#define nsIDocumentContainer_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
class nsIScriptable;
|
||||
class nsIScriptEnvironment;
|
||||
class nsIURI;
|
||||
|
||||
#define NS_IDOCUMENT_CONTAINER_IID \
|
||||
{ 0x8efd4470, 0x944d, 0x11d1, \
|
||||
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
class nIDocumentContainer : public nsISupports {
|
||||
public:
|
||||
/**
|
||||
* Display the specified URL with the given connection.
|
||||
*
|
||||
* @param url the URL to display
|
||||
* @param connection the connection to use.
|
||||
*/
|
||||
virtual void Display(nsIURI* aURL) = 0;
|
||||
|
||||
/**
|
||||
* Returns a script environment for the specified language and version.
|
||||
* The expectation is that the script environment already has been
|
||||
* set up with a container object. If a script environment has already
|
||||
* been requested for the given language, the same instance should
|
||||
* be returned.
|
||||
*
|
||||
* @param language the scripting language for the environment. If this
|
||||
* is null, returns the default scripting environment.
|
||||
* @param majorVersion the major version number of the language
|
||||
* @param minorVersion the minor version number of the language
|
||||
* @return the script environment for the language
|
||||
* @see mg.magellan.script.IScriptEnvrionment
|
||||
*/
|
||||
virtual nsIScriptEnvironment*
|
||||
GetScriptEnvironment(nsString* aLanguage,
|
||||
PRInt32 aMajorVersion,
|
||||
PRInt32 aMinorVersion) = 0;
|
||||
|
||||
/**
|
||||
* Returns the scriptable container object for the document container.
|
||||
* The scriptable object will be used as the scoping object in the
|
||||
* definition of scriptable classes used in the Document Object Model.
|
||||
*
|
||||
* @return the scriptable container for the application
|
||||
* @see mg.magellan.script.IScriptable
|
||||
* @see mg.magellan.script.IScriptEnvrionment
|
||||
*/
|
||||
virtual nsIScriptable* GetScriptableContainer() = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIDocumentContainer_h___ */
|
||||
209
mozilla/layout/base/public/nsIDocumentEncoder.h
Normal file
209
mozilla/layout/base/public/nsIDocumentEncoder.h
Normal file
@@ -0,0 +1,209 @@
|
||||
/* -*- 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.org 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 nsIDocumentEncoder_h__
|
||||
#define nsIDocumentEncoder_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsIDocumentEncoder;
|
||||
class nsIDocument;
|
||||
class nsIDOMRange;
|
||||
class nsISelection;
|
||||
class nsIOutputStream;
|
||||
class nsISupportsArray;
|
||||
class nsIDOMNode;
|
||||
|
||||
|
||||
#define NS_IDOCUMENT_ENCODER_IID \
|
||||
{ /* a6cf9103-15b3-11d2-932e-00805f8add32 */ \
|
||||
0xa6cf9103, \
|
||||
0x15b3, \
|
||||
0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} \
|
||||
}
|
||||
|
||||
#define NS_TEXT_ENCODER_CID \
|
||||
{ /* e7ba1480-1dea-11d3-830f-00104bed045e */ \
|
||||
0xe7ba1480, \
|
||||
0x1dea, \
|
||||
0x11d3, \
|
||||
{0x83, 0x0f, 0x00, 0x10, 0x4b, 0xed, 0x04, 0x5e} \
|
||||
}
|
||||
|
||||
#define NS_DOC_ENCODER_CONTRACTID_BASE "@mozilla.org/layout/documentEncoder;1?type="
|
||||
|
||||
// {7f915b01-98fc-11d4-8eb0-a803f80ff1bc}
|
||||
#define NS_HTMLCOPY_TEXT_ENCODER_CID \
|
||||
{ 0x7f915b01, 0x98fc, 0x11d4, { 0x8e, 0xb0, 0xa8, 0x03, 0xf8, 0x0f, 0xf1, 0xbc } }
|
||||
|
||||
// {0BC1FAC0-B710-11d4-959F-0020183BF181}
|
||||
#define NS_IDOCUMENTENCODERNODEFIXUP_IID \
|
||||
{ 0xbc1fac0, 0xb710, 0x11d4, { 0x95, 0x9f, 0x0, 0x20, 0x18, 0x3b, 0xf1, 0x81 } }
|
||||
|
||||
#define NS_HTMLCOPY_ENCODER_CONTRACTID "@mozilla.org/layout/htmlCopyEncoder;1"
|
||||
|
||||
class nsIDocumentEncoderNodeFixup : public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOCUMENTENCODERNODEFIXUP_IID)
|
||||
|
||||
/**
|
||||
* Create a fixed up version of a node. This method is called before
|
||||
* each node in a document is about to be persisted. The implementor
|
||||
* may return a new node with fixed up attributes or nsnull.
|
||||
*/
|
||||
NS_IMETHOD FixupNode(nsIDOMNode *aNode, nsIDOMNode **aOutNode) = 0;
|
||||
};
|
||||
|
||||
class nsIDocumentEncoder : public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_ENCODER_IID)
|
||||
|
||||
/**
|
||||
* Output methods flag bits.
|
||||
*
|
||||
* There are a frightening number of these,
|
||||
* because everyone wants something a little bit different!
|
||||
*
|
||||
* These should move to an idl file so that Javascript can
|
||||
* have access to the symbols, not just the constants.
|
||||
*/
|
||||
enum {
|
||||
// Output only the selection (as opposed to the whole document).
|
||||
OutputSelectionOnly = 1,
|
||||
|
||||
// Plaintext output: Convert html to plaintext that looks like the html.
|
||||
// Implies wrap (except inside <pre>), since html wraps.
|
||||
// HTML output: always do prettyprinting, ignoring existing formatting.
|
||||
// (Probably not well tested for HTML output.)
|
||||
OutputFormatted = 2,
|
||||
|
||||
// OutputRaw is used by copying text from widgets
|
||||
OutputRaw = 4,
|
||||
|
||||
// No html head tags
|
||||
OutputBodyOnly = 8,
|
||||
|
||||
// Wrap even if we're not doing formatted output (e.g. for text fields)
|
||||
OutputPreformatted = 16,
|
||||
|
||||
// Output as though the content is preformatted
|
||||
// (e.g. maybe it's wrapped in a MOZ_PRE or MOZ_PRE_WRAP style tag)
|
||||
OutputWrap = 32,
|
||||
|
||||
// Output for format flowed (RFC 2646). This is used when converting
|
||||
// to text for mail sending. This differs just slightly
|
||||
// but in an important way from normal formatted, and that is that
|
||||
// lines are space stuffed. This can't (correctly) be done later.
|
||||
OutputFormatFlowed = 64,
|
||||
|
||||
// Convert links, image src, and script src to absolute URLs when possible
|
||||
OutputAbsoluteLinks = 128,
|
||||
|
||||
// Encode entities when outputting to a string.
|
||||
// E.g. If set, we'll output if clear, we'll output 0xa0.
|
||||
OutputEncodeEntities = 256,
|
||||
|
||||
// LineBreak processing: we can do either platform line breaks,
|
||||
// CR, LF, or CRLF. If neither of these flags is set, then we
|
||||
// will use platform line breaks.
|
||||
OutputCRLineBreak = 512,
|
||||
OutputLFLineBreak = 1024
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize with a pointer to the document and the mime type.
|
||||
*/
|
||||
NS_IMETHOD Init(nsIDocument* aDocument, const nsAReadableString& aMimeType,
|
||||
PRUint32 flags) = 0;
|
||||
|
||||
/**
|
||||
* If the selection is set to a non-null value, then the
|
||||
* selection is used for encoding, otherwise the entire
|
||||
* document is encoded.
|
||||
*/
|
||||
NS_IMETHOD SetSelection(nsISelection* aSelection) = 0;
|
||||
|
||||
/**
|
||||
* If the range is set to a non-null value, then the
|
||||
* range is used for encoding, otherwise the entire
|
||||
* document or selection is encoded.
|
||||
*/
|
||||
NS_IMETHOD SetRange(nsIDOMRange* aRange) = 0;
|
||||
|
||||
/**
|
||||
* Documents typically have an intrinsic character set.
|
||||
* If no intrinsic value is found, the platform character set
|
||||
* is used.
|
||||
* aCharset overrides the both the intrinsic or platform
|
||||
* character set when encoding the document.
|
||||
*
|
||||
* Possible result codes: NS_ERROR_NO_CHARSET_CONVERTER
|
||||
*/
|
||||
NS_IMETHOD SetCharset(const nsAReadableString& aCharset) = 0;
|
||||
|
||||
/**
|
||||
* Set a wrap column. This may have no effect in some types of encoders.
|
||||
*/
|
||||
NS_IMETHOD SetWrapColumn(PRUint32 aWC) = 0;
|
||||
|
||||
/**
|
||||
* Get the mime type preferred by the encoder. This piece of api was
|
||||
* added because the copy encoder may need to switch mime types on you
|
||||
* if you ask it to copy html that really represents plaintext content.
|
||||
* Call this AFTER Init() and SetSelection() have both been called.
|
||||
*/
|
||||
NS_IMETHOD GetMimeType(nsAWritableString& aMimeType) = 0;
|
||||
|
||||
/**
|
||||
* The document is encoded, the result is sent to the
|
||||
* to nsIOutputStream.
|
||||
*
|
||||
* Possible result codes are passing along whatever stream errors
|
||||
* might have been encountered.
|
||||
*/
|
||||
NS_IMETHOD EncodeToStream(nsIOutputStream* aStream) = 0;
|
||||
NS_IMETHOD EncodeToString(nsAWritableString& aOutputString) = 0;
|
||||
|
||||
/**
|
||||
* The document is encoded, the result is sent to the
|
||||
* to aEncodedString. Parent heirarchy information is encoded
|
||||
* to aContextString. Extra context info is encoded in aInfoString.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD EncodeToStringWithContext(nsAWritableString& aEncodedString,
|
||||
nsAWritableString& aContextString,
|
||||
nsAWritableString& aInfoString) = 0;
|
||||
|
||||
/**
|
||||
* Set the fixup object associated with node persistence.
|
||||
*/
|
||||
NS_IMETHOD SetNodeFixup(nsIDocumentEncoderNodeFixup *aFixup) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIDocumentEncoder_h__ */
|
||||
|
||||
312
mozilla/layout/base/public/nsIDocumentObserver.h
Normal file
312
mozilla/layout/base/public/nsIDocumentObserver.h
Normal file
@@ -0,0 +1,312 @@
|
||||
/* -*- 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.org 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 nsIDocumentObserver_h___
|
||||
#define nsIDocumentObserver_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIContent;
|
||||
class nsIPresShell;
|
||||
class nsIStyleSheet;
|
||||
class nsIStyleRule;
|
||||
class nsString;
|
||||
class nsIDocument;
|
||||
|
||||
#define NS_IDOCUMENT_OBSERVER_IID \
|
||||
{ 0xb3f92460, 0x944c, 0x11d1, {0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
// Document observer interface
|
||||
class nsIDocumentObserver : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOCUMENT_OBSERVER_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Notify that a content model update is beginning. This call can be
|
||||
* nested.
|
||||
*/
|
||||
NS_IMETHOD BeginUpdate(nsIDocument *aDocument) = 0;
|
||||
|
||||
/**
|
||||
* Notify that a content model update is finished. This call can be
|
||||
* nested.
|
||||
*/
|
||||
NS_IMETHOD EndUpdate(nsIDocument *aDocument) = 0;
|
||||
|
||||
/**
|
||||
* Notify the observer that a document load is beginning.
|
||||
*/
|
||||
NS_IMETHOD BeginLoad(nsIDocument *aDocument) = 0;
|
||||
|
||||
/**
|
||||
* Notify the observer that a document load has finished. Note that
|
||||
* the associated reflow of the document will be done <b>before</b>
|
||||
* EndLoad is invoked, not after.
|
||||
*/
|
||||
NS_IMETHOD EndLoad(nsIDocument *aDocument) = 0;
|
||||
|
||||
/**
|
||||
* Notify the observer that the document is being reflowed in
|
||||
* the given presentation shell.
|
||||
*/
|
||||
NS_IMETHOD BeginReflow(nsIDocument *aDocument, nsIPresShell* aShell) = 0;
|
||||
|
||||
/**
|
||||
* Notify the observer that the document is done being reflowed in
|
||||
* the given presentation shell.
|
||||
*/
|
||||
NS_IMETHOD EndReflow(nsIDocument *aDocument, nsIPresShell* aShell) = 0;
|
||||
|
||||
/**
|
||||
* Notification that the content model has changed. This method is
|
||||
* called automatically by content objects when their state is changed
|
||||
* (therefore there is normally no need to invoke this method
|
||||
* directly). The notification is passed to any
|
||||
* IDocumentObservers. The notification is passed on to all of the
|
||||
* document observers. <p>
|
||||
*
|
||||
* This notification is not sent when a piece of content is
|
||||
* added/removed from the document (the other notifications are used
|
||||
* for that).
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aContent the piece of content that changed
|
||||
* @param aSubContent subrange information about the piece of content
|
||||
* that changed
|
||||
*/
|
||||
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent) = 0;
|
||||
|
||||
/**
|
||||
* Notification that the state of a content node has changed.
|
||||
* (ie: gained or lost focus, became active or hovered over)
|
||||
* This method is called automatically by content objects
|
||||
* when their state is changed (therefore there is normally
|
||||
* no need to invoke this method directly). The notification
|
||||
* is passed to any IDocumentObservers. The notification is
|
||||
* passed on to all of the document observers. <p>
|
||||
*
|
||||
* This notification is not sent when a piece of content is
|
||||
* added/removed from the document or the content itself changed
|
||||
* (the other notifications are used for that).
|
||||
*
|
||||
* The optional second content node is to allow optimization
|
||||
* of the case where state moves from one node to another
|
||||
* (as is likely for :focus and :hover)
|
||||
*
|
||||
* Either content node may be nsnull, but not both
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aContent1 the piece of content that changed
|
||||
* @param aContent2 optional second piece of content that changed
|
||||
*/
|
||||
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent1,
|
||||
nsIContent* aContent2) = 0;
|
||||
|
||||
/**
|
||||
* Notification that the content model has changed. This method is called
|
||||
* automatically by content objects when an attribute's value has changed
|
||||
* (therefore there is normally no need to invoke this method directly). The
|
||||
* notification is passed to any IDocumentObservers document observers. <p>
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aContent the piece of content whose attribute changed
|
||||
* @param aAttribute the atom name of the attribute
|
||||
*/
|
||||
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
|
||||
|
||||
/**
|
||||
* Notifcation that the content model has had data appended to the
|
||||
* given content object. This method is called automatically by the
|
||||
* content container objects when a new content object is appended to
|
||||
* the container (therefore there is normally no need to invoke this
|
||||
* method directly). The notification is passed on to all of the
|
||||
* document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aContainer the container that had a new child appended
|
||||
* @param aNewIndexInContainer the index in the container of the first
|
||||
* new child
|
||||
*/
|
||||
NS_IMETHOD ContentAppended(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer) = 0;
|
||||
|
||||
/**
|
||||
* Notification that content has been inserted. This method is called
|
||||
* automatically by the content container objects when a new content
|
||||
* object is inserted in the container (therefore there is normally no
|
||||
* need to invoke this method directly). The notification is passed on
|
||||
* to all of the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aContainer the container that now contains aChild
|
||||
* @param aChild the child that was inserted
|
||||
* @param aIndexInContainer the index of the child in the container
|
||||
*/
|
||||
NS_IMETHOD ContentInserted(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
|
||||
/**
|
||||
* Notification that content has been replaced. This method is called
|
||||
* automatically by the content container objects when a content object
|
||||
* is replaced in the container (therefore there is normally no need to
|
||||
* invoke this method directly). The notification is passed on to all
|
||||
* of the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aContainer the container that now contains aChild
|
||||
* @param aOldChild the child that was replaced
|
||||
* @param aNewChild the child that replaced aOldChild
|
||||
* @param aIndexInContainer the index of the old and new child in the
|
||||
* container
|
||||
*/
|
||||
NS_IMETHOD ContentReplaced(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aOldChild,
|
||||
nsIContent* aNewChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
|
||||
/**
|
||||
* Content has just been removed. This method is called automatically
|
||||
* by content container objects when a content object has just been
|
||||
* removed from the container (therefore there is normally no need to
|
||||
* invoke this method directly). The notification is passed on to all
|
||||
* of the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aContainer the container that had a child removed
|
||||
* @param aChild the child that was just removed
|
||||
* @param aIndexInContainer the index of the child in the container
|
||||
* before it was removed
|
||||
*/
|
||||
NS_IMETHOD ContentRemoved(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
|
||||
/**
|
||||
* A StyleSheet has just been added to the document.
|
||||
* This method is called automatically when a StyleSheet gets added
|
||||
* to the document. The notification is passed on to all of the
|
||||
* document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that has been added
|
||||
*/
|
||||
NS_IMETHOD StyleSheetAdded(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet) = 0;
|
||||
|
||||
/**
|
||||
* A StyleSheet has just been removed from the document.
|
||||
* This method is called automatically when a StyleSheet gets removed
|
||||
* from the document. The notification is passed on to all of the
|
||||
* document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that has been removed
|
||||
*/
|
||||
NS_IMETHOD StyleSheetRemoved(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet) = 0;
|
||||
|
||||
/**
|
||||
* A StyleSheet has just disabled or enabled.
|
||||
* This method is called automatically when the disabled state
|
||||
* of a StyleSheet gets changed. The style sheet passes this
|
||||
* notification to the document. The notification is passed on
|
||||
* to all of the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that has been added
|
||||
* @param aDisabled PR_TRUE if the sheet is disabled, PR_FALSE if
|
||||
* it is enabled
|
||||
*/
|
||||
NS_IMETHOD StyleSheetDisabledStateChanged(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
PRBool aDisabled) = 0;
|
||||
|
||||
/**
|
||||
* A StyleRule has just been modified within a style sheet.
|
||||
* This method is called automatically when the rule gets
|
||||
* modified. The style sheet passes this notification to
|
||||
* the document. The notification is passed on to all of
|
||||
* the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that contians the rule
|
||||
* @param aStyleRule the rule that was modified
|
||||
* @param aHint some possible info about the nature of the change
|
||||
*/
|
||||
NS_IMETHOD StyleRuleChanged(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule,
|
||||
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
|
||||
|
||||
/**
|
||||
* A StyleRule has just been added to a style sheet.
|
||||
* This method is called automatically when the rule gets
|
||||
* added to the sheet. The style sheet passes this
|
||||
* notification to the document. The notification is passed on
|
||||
* to all of the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that has been modified
|
||||
* @param aStyleRule the rule that was added
|
||||
*/
|
||||
NS_IMETHOD StyleRuleAdded(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule) = 0;
|
||||
|
||||
/**
|
||||
* A StyleRule has just been removed from a style sheet.
|
||||
* This method is called automatically when the rule gets
|
||||
* removed from the sheet. The style sheet passes this
|
||||
* notification to the document. The notification is passed on
|
||||
* to all of the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that has been modified
|
||||
* @param aStyleRule the rule that was removed
|
||||
*/
|
||||
NS_IMETHOD StyleRuleRemoved(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule) = 0;
|
||||
|
||||
/**
|
||||
* The document is in the process of being destroyed.
|
||||
* This method is called automatically during document
|
||||
* destruction.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
*/
|
||||
NS_IMETHOD DocumentWillBeDestroyed(nsIDocument *aDocument) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIDocumentObserver_h___ */
|
||||
59
mozilla/layout/base/public/nsIDocumentViewer.h
Normal file
59
mozilla/layout/base/public/nsIDocumentViewer.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/* -*- 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 nsIDocumentViewer_h___
|
||||
#define nsIDocumentViewer_h___
|
||||
|
||||
#include "nsIContentViewer.h"
|
||||
|
||||
class nsIDocument;
|
||||
class nsIPresContext;
|
||||
class nsIPresShell;
|
||||
class nsIStyleSheet;
|
||||
class nsITransformMediator;
|
||||
|
||||
#define NS_IDOCUMENT_VIEWER_IID \
|
||||
{ 0xa6cf9057, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
/**
|
||||
* A document viewer is a kind of content viewer that uses NGLayout
|
||||
* to manage the presentation of the content.
|
||||
*/
|
||||
class nsIDocumentViewer : public nsIContentViewer
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_VIEWER_IID)
|
||||
|
||||
NS_IMETHOD SetUAStyleSheet(nsIStyleSheet* aUAStyleSheet) = 0;
|
||||
|
||||
NS_IMETHOD GetDocument(nsIDocument*& aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetPresShell(nsIPresShell*& aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetPresContext(nsIPresContext*& aResult) = 0;
|
||||
|
||||
NS_IMETHOD CreateDocumentViewerUsing(nsIPresContext* aPresContext,
|
||||
nsIDocumentViewer*& aResult) = 0;
|
||||
|
||||
NS_IMETHOD SetTransformMediator(nsITransformMediator* aMediator)=0;
|
||||
};
|
||||
|
||||
#endif /* nsIDocumentViewer_h___ */
|
||||
55
mozilla/layout/base/public/nsIElementFactory.h
Normal file
55
mozilla/layout/base/public/nsIElementFactory.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* -*- 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 nsIElementFactory_h___
|
||||
#define nsIElementFactory_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsINodeInfo;
|
||||
|
||||
/* a6cf90fb-15b3-11d2-932e-00805f8add32 */
|
||||
#define NS_IELEMENT_FACTORY_IID \
|
||||
{ 0xa6cf90fb, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
/**
|
||||
* An API for creating html content objects
|
||||
*/
|
||||
class nsIElementFactory : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IELEMENT_FACTORY_IID; return iid; }
|
||||
|
||||
NS_IMETHOD CreateInstanceByTag(nsINodeInfo *aNodeInfo,
|
||||
nsIContent** aResult) = 0;
|
||||
};
|
||||
|
||||
// ContractIDs for element factory registration
|
||||
#define NS_ELEMENT_FACTORY_CONTRACTID "@mozilla.org/layout/element-factory;1"
|
||||
#define NS_ELEMENT_FACTORY_CONTRACTID_PREFIX NS_ELEMENT_FACTORY_CONTRACTID "?namespace="
|
||||
|
||||
#define NS_HTML_NAMESPACE "http://www.w3.org/1999/xhtml"
|
||||
#define NS_XML_NAMESPACE "http://www.w3.org/XML/1998/namespace"
|
||||
|
||||
#define NS_HTML_ELEMENT_FACTORY_CONTRACTID NS_ELEMENT_FACTORY_CONTRACTID_PREFIX NS_HTML_NAMESPACE
|
||||
#define NS_XML_ELEMENT_FACTORY_CONTRACTID NS_ELEMENT_FACTORY_CONTRACTID_PREFIX NS_XML_NAMESPACE
|
||||
|
||||
#endif /* nsIElementFactory_h___ */
|
||||
75
mozilla/layout/base/public/nsIFocusTracker.h
Normal file
75
mozilla/layout/base/public/nsIFocusTracker.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- 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.org 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.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
*/
|
||||
|
||||
#ifndef nsIFocusTracker_h___
|
||||
#define nsIFocusTracker_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
|
||||
class nsIPresContext;
|
||||
|
||||
|
||||
// IID for the nsIFocusTracker interface
|
||||
#define NS_IFOCUSTRACKER_IID \
|
||||
{ 0x81ac51d1, 0x923b, 0x11d2, \
|
||||
{ 0x91, 0x8f, 0x0, 0x80, 0xc8, 0xe4, 0x4d, 0xb5 } }
|
||||
|
||||
class nsIFocusTracker : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IFOCUSTRACKER_IID; return iid; }
|
||||
|
||||
/** ScrollFrameIntoView
|
||||
* limited version of nsPresShell::ScrollFrameIntoView
|
||||
* @param aFrame will be the frame to scroll into view.
|
||||
*/
|
||||
NS_IMETHOD ScrollFrameIntoView(nsIFrame *aFrame) = 0;
|
||||
|
||||
/**
|
||||
* Returns the primary frame associated with the content object.
|
||||
*
|
||||
* The primary frame is the frame that is most closely associated with the
|
||||
* content. A frame is more closely associated with the content that another
|
||||
* frame if the one frame contains directly or indirectly the other frame (e.g.,
|
||||
* when a frame is scrolled there is a scroll frame that contains the frame
|
||||
* being scrolled). The primary frame is always the first-in-flow.
|
||||
*
|
||||
* In the case of absolutely positioned elements and floated elements,
|
||||
* the primary frame is the frame that is out of the flow and not the
|
||||
* placeholder frame.
|
||||
*/
|
||||
NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent,
|
||||
nsIFrame** aPrimaryFrame) const = 0;
|
||||
|
||||
/**
|
||||
* GetPresContent will return the nsIPresContext Interface from this
|
||||
* FocusTracker
|
||||
* usefull for getting screen coordinates of current selection
|
||||
*/
|
||||
NS_IMETHOD GetPresContext(nsIPresContext **aContext) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif //nsIFocusTracker_h___
|
||||
1117
mozilla/layout/base/public/nsIFrame.h
Normal file
1117
mozilla/layout/base/public/nsIFrame.h
Normal file
File diff suppressed because it is too large
Load Diff
129
mozilla/layout/base/public/nsIFrameDebug.h
Normal file
129
mozilla/layout/base/public/nsIFrameDebug.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/* -*- 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.org 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 nsIFrameDebug_h___
|
||||
#define nsIFrameDebug_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIPresContext;
|
||||
|
||||
// IID for the nsIFrameDebug interface {a6cf9069-15b3-11d2-932e-00805f8add32}
|
||||
#define NS_IFRAMEDEBUG_IID \
|
||||
{ 0xa6cf9069, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
/**
|
||||
* Debug related functions
|
||||
*/
|
||||
class nsIFrameDebug : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IFRAMEDEBUG_IID; return iid; }
|
||||
|
||||
NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const = 0;
|
||||
|
||||
/**
|
||||
* Get a printable from of the name of the frame type.
|
||||
* XXX This should be eliminated and we use GetFrameType() instead...
|
||||
*/
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const = 0;
|
||||
/**
|
||||
* Called to dump out regression data that describes the layout
|
||||
* of the frame and it's children, and so on. The format of the
|
||||
* data is dictated to be XML (using a specific DTD); the
|
||||
* specific kind of data dumped is up to the frame itself, with
|
||||
* the caveat that some base types are defined.
|
||||
* For more information, see XXX.
|
||||
*
|
||||
* Argument aIncludeStyleData: if PR_TRUE, style information is dumpted, otherwise it is not
|
||||
*/
|
||||
NS_IMETHOD DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent, PRBool aIncludeStyleData) = 0;
|
||||
|
||||
/**
|
||||
* Get the size of the frame object. The size value should include
|
||||
* all subordinate data referenced by the frame that is not
|
||||
* accounted for by child frames. However, this value should not
|
||||
* include the content objects, style contexts, views or other data
|
||||
* that lies logically outside the frame system.
|
||||
*
|
||||
* If the implementation so chooses, instead of returning the total
|
||||
* subordinate data it may instead use the sizeof handler to store
|
||||
* away subordinate data under its own key so that the subordinate
|
||||
* data may be tabulated independently of the frame itself.
|
||||
*
|
||||
* The caller is responsible for recursing over all child-lists that
|
||||
* the frame supports.
|
||||
*/
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0;
|
||||
|
||||
NS_IMETHOD VerifyTree() const = 0;
|
||||
|
||||
/**
|
||||
* See if tree verification is enabled. To enable tree verification add
|
||||
* "frameverifytree:1" to your NSPR_LOG_MODULES environment variable
|
||||
* (any non-zero debug level will work). Or, call SetVerifyTreeEnable
|
||||
* with PR_TRUE.
|
||||
*/
|
||||
static NS_LAYOUT PRBool GetVerifyTreeEnable();
|
||||
|
||||
/**
|
||||
* Set the verify-tree enable flag.
|
||||
*/
|
||||
static NS_LAYOUT void SetVerifyTreeEnable(PRBool aEnabled);
|
||||
|
||||
/**
|
||||
* See if style tree verification is enabled. To enable style tree
|
||||
* verification add "styleverifytree:1" to your NSPR_LOG_MODULES
|
||||
* environment variable (any non-zero debug level will work). Or,
|
||||
* call SetVerifyStyleTreeEnable with PR_TRUE.
|
||||
*/
|
||||
static NS_LAYOUT PRBool GetVerifyStyleTreeEnable();
|
||||
|
||||
/**
|
||||
* Set the verify-style-tree enable flag.
|
||||
*/
|
||||
static NS_LAYOUT void SetVerifyStyleTreeEnable(PRBool aEnabled);
|
||||
|
||||
/**
|
||||
* The frame class and related classes share an nspr log module
|
||||
* for logging frame activity.
|
||||
*
|
||||
* Note: the log module is created during library initialization which
|
||||
* means that you cannot perform logging before then.
|
||||
*/
|
||||
static NS_LAYOUT PRLogModuleInfo* GetLogModuleInfo();
|
||||
|
||||
// Show frame borders when rendering
|
||||
static NS_LAYOUT void ShowFrameBorders(PRBool aEnable);
|
||||
static NS_LAYOUT PRBool GetShowFrameBorders();
|
||||
|
||||
// Show frame border of event target
|
||||
static NS_LAYOUT void ShowEventTargetFrameBorder(PRBool aEnable);
|
||||
static NS_LAYOUT PRBool GetShowEventTargetFrameBorder();
|
||||
|
||||
private:
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void) = 0;
|
||||
NS_IMETHOD_(nsrefcnt) Release(void) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIFrameDebug_h___ */
|
||||
114
mozilla/layout/base/public/nsIFrameImageLoader.h
Normal file
114
mozilla/layout/base/public/nsIFrameImageLoader.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/* -*- 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.org 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 nsIFrameImageLoader_h___
|
||||
#define nsIFrameImageLoader_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsColor.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIImage;
|
||||
class nsIImageGroup;
|
||||
class nsIPresContext;
|
||||
class nsString;
|
||||
struct nsSize;
|
||||
|
||||
/* a6cf90ec-15b3-11d2-932e-00805f8add32 */
|
||||
#define NS_IFRAME_IMAGE_LOADER_IID \
|
||||
{ 0xa6cf90ec, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
enum nsImageAnimation {
|
||||
eImageAnimation_Normal = 0, // looping controlled by image
|
||||
eImageAnimation_None = 1, // don't loop; just show first frame
|
||||
eImageAnimation_LoopOnce = 2 // loop just once
|
||||
};
|
||||
|
||||
// Type of callback function used during image loading. The frame
|
||||
// image loader will invoke this callback as notifications occur from
|
||||
// the image library.
|
||||
class nsIFrameImageLoader;
|
||||
typedef nsresult (*nsIFrameImageLoaderCB)(nsIPresContext* aPresContext,
|
||||
nsIFrameImageLoader* aLoader,
|
||||
nsIFrame* aFrame,
|
||||
void* aClosure,
|
||||
PRUint32 aStatus);
|
||||
|
||||
/**
|
||||
* Abstract interface for frame image loaders. Frame image loaders
|
||||
* know how to respond to nsIImageRequestObserver notifications and
|
||||
* generate the appropriate rendering/reflow operation for a target
|
||||
* frame.
|
||||
*/
|
||||
class nsIFrameImageLoader : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() {static nsIID iid = NS_IFRAME_IMAGE_LOADER_IID; return iid;}
|
||||
|
||||
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
||||
nsIImageGroup* aGroup,
|
||||
const nsString& aURL,
|
||||
const nscolor* aBackgroundColor,
|
||||
const nsSize* aDesiredSize,
|
||||
nsIFrame* aFrame,
|
||||
nsImageAnimation aAnimationMode,
|
||||
nsIFrameImageLoaderCB aCallBack,
|
||||
void* aClosure, void* aKey) = 0;
|
||||
|
||||
NS_IMETHOD StopImageLoad(PRBool aStopChrome = PR_TRUE) = 0;
|
||||
|
||||
NS_IMETHOD AbortImageLoad() = 0;
|
||||
|
||||
NS_IMETHOD IsSameImageRequest(const nsString& aURL,
|
||||
const nscolor* aBackgroundColor,
|
||||
const nsSize* aDesiredSize,
|
||||
PRBool* aResult) = 0;
|
||||
|
||||
NS_IMETHOD AddFrame(nsIFrame* aFrame, nsIFrameImageLoaderCB aCallBack,
|
||||
void* aClosure, void* aKey) = 0;
|
||||
|
||||
NS_IMETHOD RemoveFrame(void* aKey) = 0;
|
||||
|
||||
NS_IMETHOD SafeToDestroy(PRBool* aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetURL(nsString& aResult) = 0;
|
||||
NS_IMETHOD GetPresContext(nsIPresContext** aPresContext) = 0;
|
||||
|
||||
NS_IMETHOD GetImage(nsIImage** aResult) = 0;
|
||||
|
||||
// Return the size of the image, in twips
|
||||
NS_IMETHOD GetSize(nsSize& aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetImageLoadStatus(PRUint32* aLoadStatus) = 0;
|
||||
|
||||
// Return the intrinsic (or natural) size of the image, in twips.
|
||||
// Returns 0,0 if the dimensions are unknown
|
||||
NS_IMETHOD GetIntrinsicSize(nsSize& aResult) = 0;
|
||||
NS_IMETHOD GetNaturalImageSize(PRUint32* naturalWidth, PRUint32 *naturalHeight) = 0;
|
||||
};
|
||||
|
||||
// Image load status bit values
|
||||
#define NS_IMAGE_LOAD_STATUS_NONE 0x0
|
||||
#define NS_IMAGE_LOAD_STATUS_SIZE_AVAILABLE 0x1
|
||||
#define NS_IMAGE_LOAD_STATUS_IMAGE_READY 0x2
|
||||
#define NS_IMAGE_LOAD_STATUS_ERROR 0x4
|
||||
|
||||
#endif /* nsIFrameImageLoader_h___ */
|
||||
251
mozilla/layout/base/public/nsIFrameManager.h
Normal file
251
mozilla/layout/base/public/nsIFrameManager.h
Normal file
@@ -0,0 +1,251 @@
|
||||
/* -*- 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.org 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 nsIFrameManager_h___
|
||||
#define nsIFrameManager_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIStatefulFrame.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsIPresContext;
|
||||
class nsIPresShell;
|
||||
class nsIStyleSet;
|
||||
class nsIStyleContext;
|
||||
class nsILayoutHistoryState;
|
||||
class nsStyleChangeList;
|
||||
|
||||
#define NS_IFRAMEMANAGER_IID \
|
||||
{ 0xa6cf9107, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
// Calback function used to destroy the value associated with a
|
||||
// given property. used by RemoveFrameProperty()
|
||||
typedef void
|
||||
(*NSFMPropertyDtorFunc)(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIAtom* aPropertyName,
|
||||
void* aPropertyValue);
|
||||
|
||||
// Option flags for GetFrameProperty() member function
|
||||
#define NS_IFRAME_MGR_REMOVE_PROP 0x0001
|
||||
|
||||
// nsresult error codes for frame property functions
|
||||
#define NS_IFRAME_MGR_PROP_NOT_THERE \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_LAYOUT, 1)
|
||||
|
||||
#define NS_IFRAME_MGR_PROP_OVERWRITTEN \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_LAYOUT, 2)
|
||||
|
||||
/**
|
||||
* Frame manager interface. The frame manager serves two purposes:
|
||||
* <li>provides a serice for mapping from content to frame and from out-of-flow
|
||||
* frame to placeholder frame
|
||||
* <li>handles structural modifications to the frame model. If the frame model
|
||||
* lock can be acquired, then the changes are processed immediately; otherwise,
|
||||
* they're queued and processed later
|
||||
*/
|
||||
class nsIFrameManager : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() {static nsIID iid = NS_IFRAMEMANAGER_IID; return iid;}
|
||||
|
||||
// Initialization
|
||||
NS_IMETHOD Init(nsIPresShell* aPresShell, nsIStyleSet* aStyleSet) = 0;
|
||||
|
||||
// Gets and sets the root frame (typically the viewport). The lifetime of the
|
||||
// root frame is controlled by the frame manager. When the frame manager is
|
||||
// destroyed it destroys the entire frame hierarchy
|
||||
NS_IMETHOD GetRootFrame(nsIFrame** aRootFrame) const = 0;
|
||||
NS_IMETHOD SetRootFrame(nsIFrame* aRootFrame) = 0;
|
||||
|
||||
// Get the canvas frame. The canvas frame may or may not exist, so the
|
||||
// argument aCanvasFrame may be nsnull.
|
||||
NS_IMETHOD GetCanvasFrame(nsIPresContext* aPresContext, nsIFrame** aCanvasFrame) const = 0;
|
||||
|
||||
// Primary frame functions
|
||||
NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent, nsIFrame** aPrimaryFrame) = 0;
|
||||
NS_IMETHOD SetPrimaryFrameFor(nsIContent* aContent,
|
||||
nsIFrame* aPrimaryFrame) = 0;
|
||||
NS_IMETHOD ClearPrimaryFrameMap() = 0;
|
||||
|
||||
// Placeholder frame functions
|
||||
NS_IMETHOD GetPlaceholderFrameFor(nsIFrame* aFrame,
|
||||
nsIFrame** aPlaceholderFrame) const = 0;
|
||||
NS_IMETHOD SetPlaceholderFrameFor(nsIFrame* aFrame,
|
||||
nsIFrame* aPlaceholderFrame) = 0;
|
||||
NS_IMETHOD ClearPlaceholderFrameMap() = 0;
|
||||
|
||||
// Mapping undisplayed content
|
||||
NS_IMETHOD SetUndisplayedContent(nsIContent* aContent, nsIStyleContext* aStyleContext) = 0;
|
||||
NS_IMETHOD SetUndisplayedPseudoIn(nsIStyleContext* aPseudoContext,
|
||||
nsIContent* aParentContent) = 0;
|
||||
NS_IMETHOD ClearUndisplayedContentIn(nsIContent* aContent, nsIContent* aParentContent) = 0;
|
||||
NS_IMETHOD ClearAllUndisplayedContentIn(nsIContent* aParentContent) = 0;
|
||||
NS_IMETHOD ClearUndisplayedContentMap() = 0;
|
||||
|
||||
// Functions for manipulating the frame model
|
||||
NS_IMETHOD AppendFrames(nsIPresContext* aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aFrameList) = 0;
|
||||
NS_IMETHOD InsertFrames(nsIPresContext* aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aPrevFrame,
|
||||
nsIFrame* aFrameList) = 0;
|
||||
NS_IMETHOD RemoveFrame(nsIPresContext* aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame) = 0;
|
||||
NS_IMETHOD ReplaceFrame(nsIPresContext* aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame,
|
||||
nsIFrame* aNewFrame) = 0;
|
||||
|
||||
// Notification that we were unable to render a replaced element
|
||||
NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame) = 0;
|
||||
|
||||
// Notification that a frame is about to be destroyed. This allows any outstanding
|
||||
// references to the frame to be cleaned up
|
||||
NS_IMETHOD NotifyDestroyingFrame(nsIFrame* aFrame) = 0;
|
||||
|
||||
// reparent the style contexts of this frame sub tree to live under the
|
||||
// new given parent style context
|
||||
NS_IMETHOD ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIStyleContext* aNewParentContext) = 0;
|
||||
|
||||
// Re-resolve style contexts for frame tree
|
||||
NS_IMETHOD ComputeStyleChangeFor(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
PRInt32 aAttrNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
nsStyleChangeList& aChangeList,
|
||||
PRInt32 aMinChange,
|
||||
PRInt32& aTopLevelChange) = 0;
|
||||
|
||||
// Determine whether an attribute affects style
|
||||
NS_IMETHOD AttributeAffectsStyle(nsIAtom *aAttribute, nsIContent *aContent,
|
||||
PRBool &aAffects) = 0;
|
||||
|
||||
/**
|
||||
* Capture/restore frame state for the frame subtree rooted at aFrame.
|
||||
* aState is the document state storage object onto which each frame
|
||||
* stores its state.
|
||||
*/
|
||||
NS_IMETHOD CaptureFrameState(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsILayoutHistoryState* aState) = 0;
|
||||
NS_IMETHOD RestoreFrameState(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsILayoutHistoryState* aState) = 0;
|
||||
// Add/restore state for one frame (special, global type, like scroll position)
|
||||
NS_IMETHOD CaptureFrameStateFor(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsILayoutHistoryState* aState,
|
||||
nsIStatefulFrame::SpecialStateID aID = nsIStatefulFrame::eNoID) = 0;
|
||||
NS_IMETHOD RestoreFrameStateFor(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsILayoutHistoryState* aState,
|
||||
nsIStatefulFrame::SpecialStateID aID = nsIStatefulFrame::eNoID) = 0;
|
||||
|
||||
/**
|
||||
* Gets a property value for a given frame.
|
||||
*
|
||||
* @param aFrame the frame with the property
|
||||
* @param aPropertyName property name as an atom
|
||||
* @param aOptions optional flags
|
||||
* NS_IFRAME_MGR_REMOVE_PROP removes the property
|
||||
* @param aPropertyValue the property value or 0 if the property is not set
|
||||
* @return NS_OK if the property is set,
|
||||
* NS_IFRAME_MGR_PROP_NOT_THERE if the property is not set
|
||||
*/
|
||||
NS_IMETHOD GetFrameProperty(nsIFrame* aFrame,
|
||||
nsIAtom* aPropertyName,
|
||||
PRUint32 aOptions,
|
||||
void** aPropertyValue) = 0;
|
||||
|
||||
/**
|
||||
* Sets the property value for a given frame.
|
||||
*
|
||||
* A frame may only have one property value at a time for a given property
|
||||
* name. The existing property value (if there is one) is overwritten, and the
|
||||
* old value destroyed
|
||||
*
|
||||
* @param aFrame the frame to set the property on
|
||||
* @param aPropertyName property name as an atom
|
||||
* @param aPropertyValue the property value
|
||||
* @param aPropertyDtorFunc when setting a property you can specify the
|
||||
* dtor function (can be NULL) that will be used
|
||||
* to destroy the property value. There can be only
|
||||
* one dtor function for a given property name
|
||||
* @return NS_OK if successful,
|
||||
* NS_IFRAME_MGR_PROP_OVERWRITTEN if there is an existing property
|
||||
* value that was overwritten,
|
||||
* NS_ERROR_INVALID_ARG if the dtor function does not match the
|
||||
* existing dtor function
|
||||
*/
|
||||
NS_IMETHOD SetFrameProperty(nsIFrame* aFrame,
|
||||
nsIAtom* aPropertyName,
|
||||
void* aPropertyValue,
|
||||
NSFMPropertyDtorFunc aPropertyDtorFunc) = 0;
|
||||
|
||||
/**
|
||||
* Removes a property and destroys its property value by calling the dtor
|
||||
* function associated with the property name.
|
||||
*
|
||||
* When a frame is destroyed any remaining properties are automatically removed
|
||||
*
|
||||
* @param aFrame the frame to set the property on
|
||||
* @param aPropertyName property name as an atom
|
||||
* @return NS_OK if the property is successfully removed,
|
||||
* NS_IFRAME_MGR_PROP_NOT_THERE if the property is not set
|
||||
*/
|
||||
NS_IMETHOD RemoveFrameProperty(nsIFrame* aFrame,
|
||||
nsIAtom* aPropertyName) = 0;
|
||||
|
||||
NS_IMETHOD GetInsertionPoint(nsIPresShell* aShell, nsIFrame* aParent, nsIFrame* aChild, nsIFrame** aResult)=0;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
/**
|
||||
* DEBUG ONLY method to verify integrity of style tree versus frame tree
|
||||
*/
|
||||
NS_IMETHOD DebugVerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a frame manager. Upon success, call Init() before attempting to
|
||||
* use it.
|
||||
*/
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewFrameManager(nsIFrameManager** aInstancePtrResult);
|
||||
|
||||
#endif /* nsIFrameManager_h___ */
|
||||
371
mozilla/layout/base/public/nsIFrameSelection.h
Normal file
371
mozilla/layout/base/public/nsIFrameSelection.h
Normal file
@@ -0,0 +1,371 @@
|
||||
/* -*- 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.org 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):
|
||||
*/
|
||||
|
||||
/*
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* NOTE!! This is not a general class, but specific to layout and frames.
|
||||
* Consumers looking for the general selection interface should look at
|
||||
* nsISelection.
|
||||
*/
|
||||
|
||||
#ifndef nsIFrameSelection_h___
|
||||
#define nsIFrameSelection_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIFocusTracker.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
||||
|
||||
// IID for the nsIFrameSelection interface
|
||||
#define NS_IFRAMESELECTION_IID \
|
||||
{ 0xf46e4171, 0xdeaa, 0x11d1, \
|
||||
{ 0x97, 0xfc, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Selection interface
|
||||
|
||||
struct SelectionDetails
|
||||
{
|
||||
PRInt32 mStart;
|
||||
PRInt32 mEnd;
|
||||
SelectionType mType;
|
||||
SelectionDetails *mNext;
|
||||
};
|
||||
|
||||
/*PeekOffsetStruct
|
||||
* @param mTracker is used to get the PresContext usefull for measuring text ect.
|
||||
* @param mDesiredX is the "desired" location of the new caret
|
||||
* @param mAmount eWord, eCharacter, eLine
|
||||
* @param mDirection enum defined in this file to be eForward or eBackward
|
||||
* @param mStartOffset start offset to start the peek. 0 == beginning -1 = end
|
||||
* @param mResultContent content that actually is the next/previous
|
||||
* @param mResultOffset offset for result content
|
||||
* @param mResultFrame resulting frame for peeking
|
||||
* @param mEatingWS boolean to tell us the state of our search for Next/Prev
|
||||
* @param mPreferLeft true = prev line end, false = next line begin
|
||||
* @param mJumpLines if this is true then its ok to cross lines while peeking
|
||||
*/
|
||||
struct nsPeekOffsetStruct
|
||||
{
|
||||
void SetData(nsIFocusTracker *aTracker,
|
||||
nscoord aDesiredX,
|
||||
nsSelectionAmount aAmount,
|
||||
nsDirection aDirection,
|
||||
PRInt32 aStartOffset,
|
||||
PRBool aEatingWS,
|
||||
PRBool aPreferLeft,
|
||||
PRBool aJumpLines)
|
||||
{
|
||||
mTracker=aTracker;mDesiredX=aDesiredX;mAmount=aAmount;
|
||||
mDirection=aDirection;mStartOffset=aStartOffset;mEatingWS=aEatingWS;
|
||||
mPreferLeft=aPreferLeft;mJumpLines = aJumpLines;
|
||||
}
|
||||
nsIFocusTracker *mTracker;
|
||||
nscoord mDesiredX;
|
||||
nsSelectionAmount mAmount;
|
||||
nsDirection mDirection;
|
||||
PRInt32 mStartOffset;
|
||||
nsCOMPtr<nsIContent> mResultContent;
|
||||
PRInt32 mContentOffset;
|
||||
PRInt32 mContentOffsetEnd;
|
||||
nsIFrame *mResultFrame;
|
||||
PRBool mEatingWS;
|
||||
PRBool mPreferLeft;
|
||||
PRBool mJumpLines;
|
||||
};
|
||||
|
||||
class nsIScrollableView;
|
||||
|
||||
|
||||
class nsIFrameSelection : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IFRAMESELECTION_IID; return iid; }
|
||||
enum HINT {HINTLEFT=0,HINTRIGHT=1}mHint;//end of this line or beginning of next
|
||||
|
||||
/** Init will initialize the frame selector with the necessary focus tracker to
|
||||
* be used by most of the methods
|
||||
* @param aTracker is the parameter to be used for most of the other calls for callbacks ect
|
||||
* @param aLimiter limits the selection to nodes with aLimiter parents
|
||||
*/
|
||||
NS_IMETHOD Init(nsIFocusTracker *aTracker, nsIContent *aLimiter) = 0; //default since this isnt used for embedding
|
||||
|
||||
/* SetScrollView sets the scroll view
|
||||
* @param aScrollView is thr scroll view for this selection.
|
||||
*/
|
||||
NS_IMETHOD SetScrollableView(nsIScrollableView *aScrollView) =0;
|
||||
|
||||
/** ShutDown will be called when the owner of the frame selection is shutting down
|
||||
* this should be the time to release all member variable interfaces. all methods
|
||||
* called after ShutDown should return NS_ERROR_FAILURE
|
||||
*/
|
||||
NS_IMETHOD ShutDown() = 0;
|
||||
|
||||
/** HandleKeyEvent will accept an event and frame and
|
||||
* will return NS_OK if it handles the event or NS_COMFALSE if not.
|
||||
* <P>DOES NOT ADDREF<P>
|
||||
* @param aGuiEvent is the event that should be dealt with by aFocusFrame
|
||||
* @param aFrame is the frame that MAY handle the event
|
||||
*/
|
||||
NS_IMETHOD HandleTextEvent(nsGUIEvent *aGuiEvent) = 0;
|
||||
|
||||
/** HandleKeyEvent will accept an event and frame and
|
||||
* will return NS_OK if it handles the event or NS_COMFALSE if not.
|
||||
* <P>DOES NOT ADDREF<P>
|
||||
* @param aGuiEvent is the event that should be dealt with by aFocusFrame
|
||||
* @param aFrame is the frame that MAY handle the event
|
||||
*/
|
||||
NS_IMETHOD HandleKeyEvent(nsIPresContext* aPresContext, nsGUIEvent *aGuiEvent) = 0;
|
||||
|
||||
/** HandleClick will take the focus to the new frame at the new offset and
|
||||
* will either extend the selection from the old anchor, or replace the old anchor.
|
||||
* the old anchor and focus position may also be used to deselect things
|
||||
* @param aNewfocus is the content that wants the focus
|
||||
* @param aContentOffset is the content offset of the parent aNewFocus
|
||||
* @param aContentOffsetEnd is the content offset of the parent aNewFocus and is specified different
|
||||
* when you need to select to and include both start and end points
|
||||
* @param aContinueSelection is the flag that tells the selection to keep the old anchor point or not.
|
||||
* @param aMultipleSelection will tell the frame selector to replace /or not the old selection.
|
||||
* cannot coexist with aContinueSelection
|
||||
* @param aHint will tell the selection which direction geometrically to actually show the caret on.
|
||||
* 1 = end of this line 0 = beggining of this line
|
||||
*/
|
||||
NS_IMETHOD HandleClick(nsIContent *aNewFocus, PRUint32 aContentOffset, PRUint32 aContentEndOffset ,
|
||||
PRBool aContinueSelection, PRBool aMultipleSelection, PRBool aHint) = 0;
|
||||
|
||||
/** HandleDrag extends the selection to contain the frame closest to aPoint.
|
||||
* @param aPresContext is the context to use when figuring out what frame contains the point.
|
||||
* @param aFrame is the parent of all frames to use when searching for the closest frame to the point.
|
||||
* @param aPoint is relative to aFrame's parent view.
|
||||
*/
|
||||
NS_IMETHOD HandleDrag(nsIPresContext *aPresContext, nsIFrame *aFrame, nsPoint& aPoint) = 0;
|
||||
|
||||
/** HandleTableSelection will set selection to a table, cell, etc
|
||||
* depending on information contained in aFlags
|
||||
* @param aParentContent is the paretent of either a table or cell that user clicked or dragged the mouse in
|
||||
* @param aContentOffset is the offset of the table or cell
|
||||
* @param aTarget indicates what to select (defined in nsISelectionPrivate.idl/nsISelectionPrivate.h):
|
||||
* TABLESELECTION_CELL We should select a cell (content points to the cell)
|
||||
* TABLESELECTION_ROW We should select a row (content points to any cell in row)
|
||||
* TABLESELECTION_COLUMN We should select a row (content points to any cell in column)
|
||||
* TABLESELECTION_TABLE We should select a table (content points to the table)
|
||||
* TABLESELECTION_ALLCELLS We should select all cells (content points to any cell in table)
|
||||
* @param aMouseEvent passed in so we we can get where event occured and what keys are pressed
|
||||
*/
|
||||
NS_IMETHOD HandleTableSelection(nsIContent *aParentContent, PRInt32 aContentOffset, PRInt32 aTarget, nsMouseEvent *aMouseEvent) = 0;
|
||||
|
||||
/** StartAutoScrollTimer is responsible for scrolling the view so that aPoint is always
|
||||
* visible, and for selecting any frame that contains aPoint. The timer will also reset
|
||||
* itself to fire again if the view has not scrolled to the end of the document.
|
||||
* @param aPresContext is the context to use when figuring out what frame contains the point.
|
||||
* @param aFrame is the parent of all frames to use when searching for the closest frame to the point.
|
||||
* @param aPoint is relative to aFrame's parent view.
|
||||
* @param aDelay is the timer's interval.
|
||||
*/
|
||||
NS_IMETHOD StartAutoScrollTimer(nsIPresContext *aPresContext, nsIFrame *aFrame, nsPoint& aPoint, PRUint32 aDelay) = 0;
|
||||
|
||||
/** StopAutoScrollTimer stops any active auto scroll timer.
|
||||
*/
|
||||
NS_IMETHOD StopAutoScrollTimer() = 0;
|
||||
|
||||
/** EnableFrameNotification
|
||||
* mutch like start batching, except all dirty calls are ignored. no notifications will go
|
||||
* out until enableNotifications with a PR_TRUE is called
|
||||
*/
|
||||
NS_IMETHOD EnableFrameNotification(PRBool aEnable) = 0;
|
||||
|
||||
/** Lookup Selection
|
||||
* returns in frame coordinates the selection beginning and ending with the type of selection given
|
||||
* @param aContent is the content asking
|
||||
* @param aContentOffset is the starting content boundary
|
||||
* @param aContentLength is the length of the content piece asking
|
||||
* @param aReturnDetails linkedlist of return values for the selection.
|
||||
* @param aSlowCheck will check using slow method with no shortcuts
|
||||
*/
|
||||
NS_IMETHOD LookUpSelection(nsIContent *aContent, PRInt32 aContentOffset, PRInt32 aContentLength,
|
||||
SelectionDetails **aReturnDetails, PRBool aSlowCheck) = 0;
|
||||
|
||||
/** SetMouseDownState(PRBool);
|
||||
* sets the mouse state to aState for resons of drag state.
|
||||
* @param aState is the new state of mousedown
|
||||
*/
|
||||
NS_IMETHOD SetMouseDownState(PRBool aState)=0;
|
||||
|
||||
/** GetMouseDownState(PRBool *);
|
||||
* gets the mouse state to aState for resons of drag state.
|
||||
* @param aState will hold the state of mousedown
|
||||
*/
|
||||
NS_IMETHOD GetMouseDownState(PRBool *aState)=0;
|
||||
|
||||
/**
|
||||
if we are in table cell selection mode. aka ctrl click in table cell
|
||||
*/
|
||||
NS_IMETHOD GetTableCellSelection(PRBool *aState)=0;
|
||||
|
||||
/** GetTableCellSelectionStyleColor
|
||||
* this holds the color of the selection for table cells when they are selected.
|
||||
*/
|
||||
NS_IMETHOD GetTableCellSelectionStyleColor(const nsStyleColor **aStyleColor)=0;
|
||||
|
||||
/** GetSelection
|
||||
* no query interface for selection. must use this method now.
|
||||
* @param aSelectionType enum value defined in nsISelection for the seleciton you want.
|
||||
*/
|
||||
NS_IMETHOD GetSelection(SelectionType aSelectionType, nsISelection **aSelection)=0;
|
||||
|
||||
/**
|
||||
* ScrollSelectionIntoView scrolls a region of the selection,
|
||||
* so that it is visible in the scrolled view.
|
||||
*
|
||||
* @param aType the selection to scroll into view.
|
||||
* @param aRegion the region inside the selection to scroll into view.
|
||||
*/
|
||||
NS_IMETHOD ScrollSelectionIntoView(SelectionType aSelectionType, SelectionRegion aRegion)=0;
|
||||
|
||||
/** RepaintSelection repaints the selected frames that are inside the selection
|
||||
* specified by aSelectionType.
|
||||
* @param aSelectionType enum value defined in nsISelection for the seleciton you want.
|
||||
*/
|
||||
NS_IMETHOD RepaintSelection(nsIPresContext* aPresContext, SelectionType aSelectionType)=0;
|
||||
|
||||
/** GetFrameForNodeOffset given a node and its child offset, return the nsIFrame and
|
||||
* the offset into that frame.
|
||||
* @param aNode input parameter for the node to look at
|
||||
* @param aOffset offset into above node.
|
||||
* @param aReturnFrame will contain the return frame. MUST NOT BE NULL or will return error
|
||||
* @param aReturnOffset will contain offset into frame.
|
||||
*/
|
||||
NS_IMETHOD GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, HINT aHint, nsIFrame **aReturnFrame, PRInt32 *aReturnOffset)=0;
|
||||
|
||||
/** AdjustOffsetsFromStyle. Called after detecting that a click or drag will
|
||||
* select the frame, this function looks for user-select style on that frame or a parent
|
||||
* frame, and adjust the content and offsets accordingly.
|
||||
* @param aFrame the frame that was clicked
|
||||
* @param outContent content node to be selected
|
||||
* @param outStartOffset selection start offset
|
||||
* @param outEndOffset selection end offset
|
||||
*/
|
||||
NS_IMETHOD AdjustOffsetsFromStyle(nsIFrame *aFrame, PRBool *changeSelection,
|
||||
nsIContent** outContent, PRInt32* outStartOffset, PRInt32* outEndOffset)=0;
|
||||
|
||||
|
||||
NS_IMETHOD GetHint(HINT *aHint)=0;
|
||||
NS_IMETHOD SetHint(HINT aHint)=0;
|
||||
|
||||
/** CharacterMove will generally be called from the nsiselectioncontroller implementations.
|
||||
* the effect being the selection will move one character left or right.
|
||||
* @param aForward move forward in document.
|
||||
* @param aExtend continue selection
|
||||
*/
|
||||
NS_IMETHOD CharacterMove(PRBool aForward, PRBool aExtend)=0;
|
||||
|
||||
/** WordMove will generally be called from the nsiselectioncontroller implementations.
|
||||
* the effect being the selection will move one word left or right.
|
||||
* @param aForward move forward in document.
|
||||
* @param aExtend continue selection
|
||||
*/
|
||||
NS_IMETHOD WordMove(PRBool aForward, PRBool aExtend)=0;
|
||||
|
||||
/** LineMove will generally be called from the nsiselectioncontroller implementations.
|
||||
* the effect being the selection will move one line up or down.
|
||||
* @param aForward move forward in document.
|
||||
* @param aExtend continue selection
|
||||
*/
|
||||
NS_IMETHOD LineMove(PRBool aForward, PRBool aExtend)=0;
|
||||
|
||||
/** IntraLineMove will generally be called from the nsiselectioncontroller implementations.
|
||||
* the effect being the selection will move to beginning or end of line
|
||||
* @param aForward move forward in document.
|
||||
* @param aExtend continue selection
|
||||
*/
|
||||
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend)=0;
|
||||
|
||||
/** Select All will generally be called from the nsiselectioncontroller implementations.
|
||||
* it will select the whole doc
|
||||
*/
|
||||
NS_IMETHOD SelectAll()=0;
|
||||
|
||||
/** Sets/Gets The display selection enum.
|
||||
*/
|
||||
NS_IMETHOD SetDisplaySelection(PRInt16 aState)=0;
|
||||
NS_IMETHOD GetDisplaySelection(PRInt16 *aState)=0;
|
||||
|
||||
/** Allow applications to specify how we should place the caret
|
||||
* when the user clicks over an existing selection. A aDelay
|
||||
* value of PR_TRUE means delay clearing the selection and
|
||||
* placing the caret until MouseUp, when the user clicks over
|
||||
* an existing selection. This is especially usefull when applications
|
||||
* want to support Drag & Drop of the current selection. A value
|
||||
* of PR_FALSE means place the caret immediately. If the application
|
||||
* never calls this method, the nsIFrameSelection implementation
|
||||
* assumes the default value is PR_TRUE.
|
||||
* @param aDelay PR_TRUE if we should delay caret placement.
|
||||
*/
|
||||
NS_IMETHOD SetDelayCaretOverExistingSelection(PRBool aDelay)=0;
|
||||
|
||||
/** Get the current delay caret setting. If aDelay contains
|
||||
* a return value of PR_TRUE, the caret is placed on MouseUp
|
||||
* when clicking over an existing selection. If PR_FALSE,
|
||||
* the selection is cleared and caret is placed immediately
|
||||
* in all cases.
|
||||
* @param aDelay will contain the return value.
|
||||
*/
|
||||
NS_IMETHOD GetDelayCaretOverExistingSelection(PRBool *aDelay)=0;
|
||||
|
||||
/** If we are delaying caret placement til MouseUp (see
|
||||
* Set/GetDelayCaretOverExistingSelection()), this method
|
||||
* can be used to store the data received during the MouseDown
|
||||
* so that we can place the caret during the MouseUp event.
|
||||
* @aMouseEvent the event received by the selection MouseDown
|
||||
* handling method. A NULL value can be use to tell this method
|
||||
* that any data is storing is no longer valid.
|
||||
*/
|
||||
NS_IMETHOD SetDelayedCaretData(nsMouseEvent *aMouseEvent)=0;
|
||||
|
||||
/** Get the delayed MouseDown event data neccessary to place the
|
||||
* caret during MouseUp processing.
|
||||
* @aMouseEvent will contain a pointer to the event received
|
||||
* by the selection during MouseDown processing. It can be NULL
|
||||
* if the data is no longer valid.
|
||||
*/
|
||||
NS_IMETHOD GetDelayedCaretData(nsMouseEvent **aMouseEvent)=0;
|
||||
|
||||
|
||||
/** Get the content node that limits the selection
|
||||
* When searching up a nodes for parents, as in a text edit field
|
||||
* in an browser page, we must stop at this node else we reach into the
|
||||
* parent page, which is very bad!
|
||||
*/
|
||||
NS_IMETHOD GetLimiter(nsIContent **aLimiterContent)=0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* nsIFrameSelection_h___ */
|
||||
47
mozilla/layout/base/public/nsIFrameTraversal.h
Normal file
47
mozilla/layout/base/public/nsIFrameTraversal.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* -*- 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.org 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 NSIFRAMETRAVERSAL_H
|
||||
#define NSIFRAMETRAVERSAL_H
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIEnumerator.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
enum nsTraversalType{LEAF, EXTENSIVE, FASTEST};
|
||||
|
||||
// {1691E1F3-EE41-11d4-9885-00C04FA0CF4B}
|
||||
#define NS_IFRAMETRAVERSAL_IID \
|
||||
{ 0x1691e1f3, 0xee41, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
|
||||
|
||||
class nsIFrameTraversal : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFRAMETRAVERSAL_IID)
|
||||
|
||||
NS_IMETHOD NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
|
||||
PRUint32 aType,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame *aStart) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif //NSIFRAMETRAVERSAL_H
|
||||
56
mozilla/layout/base/public/nsIFrameUtil.h
Normal file
56
mozilla/layout/base/public/nsIFrameUtil.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* -*- 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 nsIFrameUtil_h___
|
||||
#define nsIFrameUtil_h___
|
||||
|
||||
#include "nsIXMLContent.h"
|
||||
class nsIURI;
|
||||
|
||||
/* a6cf90d4-15b3-11d2-932e-00805f8add32 */
|
||||
#define NS_IFRAME_UTIL_IID \
|
||||
{ 0xa6cf90d6, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
/**
|
||||
* Frame utility interface
|
||||
*/
|
||||
class nsIFrameUtil : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFRAME_UTIL_IID)
|
||||
/**
|
||||
* Compare two regression data dumps. The return status will be NS_OK
|
||||
* if the trees compare favoribly, otherwise the return will indicate
|
||||
* NS_ERROR_FAILURE. Other return status's will indicate some other
|
||||
* type of failure. The files, aFile1 and aFile2 are closed before
|
||||
* returning.
|
||||
*/
|
||||
NS_IMETHOD CompareRegressionData(FILE* aFile1, FILE* aFile2) = 0;
|
||||
|
||||
/**
|
||||
* Display the regression dump data stored in aInputFile1 to
|
||||
* aOutputFile . The file is closed before returning. If the
|
||||
* regression data is in error somehow then NS_ERROR_FAILURE will be
|
||||
* returned.
|
||||
*/
|
||||
NS_IMETHOD DumpRegressionData(FILE* aInputFile, FILE* aOutputFile) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIFrameUtil_h___ */
|
||||
48
mozilla/layout/base/public/nsIHTMLToTextSink.h
Normal file
48
mozilla/layout/base/public/nsIHTMLToTextSink.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* -*- 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.org 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 _nsIPlainTextSink_h__
|
||||
#define _nsIPlainTextSink_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsAWritableString.h"
|
||||
|
||||
#define NS_PLAINTEXTSINK_CONTRACTID "@mozilla.org/layout/plaintextsink;1"
|
||||
|
||||
/* starting interface: nsIContentSerializer */
|
||||
#define NS_IHTMLTOTEXTSINK_IID_STR "b12b5643-07cb-401e-aabb-64b2dcd2717f"
|
||||
|
||||
#define NS_IHTMLTOTEXTSINK_IID \
|
||||
{0xb12b5643, 0x07cb, 0x401e, \
|
||||
{ 0xaa, 0xbb, 0x64, 0xb2, 0xdc, 0xd2, 0x71, 0x7f }}
|
||||
|
||||
|
||||
class nsIHTMLToTextSink : public nsISupports {
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IHTMLTOTEXTSINK_IID)
|
||||
|
||||
NS_IMETHOD Initialize(nsAWritableString* aOutString,
|
||||
PRUint32 aFlags, PRUint32 aWrapCol) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
81
mozilla/layout/base/public/nsIImageFrame.h
Normal file
81
mozilla/layout/base/public/nsIImageFrame.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/* -*- 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.org 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 nsIImageFrame_h___
|
||||
#define nsIImageFrame_h___
|
||||
|
||||
#include "nsIPresContext.h"
|
||||
|
||||
class nsIFrame;
|
||||
struct nsHTMLReflowState;
|
||||
struct nsHTMLReflowMetrics;
|
||||
struct nsSize;
|
||||
|
||||
// {B261A0D5-E696-11d4-9885-00C04FA0CF4B}
|
||||
#define NS_IIMAGEFRAME_IID \
|
||||
{ 0xb261a0d5, 0xe696, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
|
||||
|
||||
class nsIImageFrame : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IIMAGEFRAME_IID)
|
||||
|
||||
NS_IMETHOD Destroy(nsIPresContext* aPresContext) = 0;
|
||||
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow) = 0;
|
||||
NS_IMETHOD Paint(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer) = 0;
|
||||
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus) = 0;
|
||||
NS_IMETHOD GetContentForEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIContent** aContent) = 0;
|
||||
NS_IMETHOD HandleEvent(nsIPresContext* aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus) = 0;
|
||||
NS_IMETHOD GetCursor(nsIPresContext* aPresContext,
|
||||
nsPoint& aPoint,
|
||||
PRInt32& aCursor) = 0;
|
||||
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint) = 0;
|
||||
NS_IMETHOD GetFrameType(nsIAtom** aResult) const = 0;
|
||||
NS_IMETHOD GetIntrinsicImageSize(nsSize& aSize) = 0;
|
||||
|
||||
NS_IMETHOD GetNaturalImageSize(PRUint32* naturalWidth,
|
||||
PRUint32 *naturalHeight) = 0;
|
||||
|
||||
NS_IMETHOD IsImageComplete(PRBool* aComplete) = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* nsIImageFrame_h___ */
|
||||
58
mozilla/layout/base/public/nsIIndependentSelection.h
Normal file
58
mozilla/layout/base/public/nsIIndependentSelection.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* -*- 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.org 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* NOTE!! This is not a general class, but specific to layout and frames.
|
||||
* Consumers looking for the general selection interface should look at
|
||||
* nsISelection.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef nsIIndependentSelection_h___
|
||||
#define nsIIndependentSelection_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
|
||||
|
||||
|
||||
#define NS_IINDEPENDENTSELECTION_IID \
|
||||
/* {3B7ABF61-33DB-4a47-8FFA-FFD6EA47CB1A} */ \
|
||||
{ 0x3b7abf61, 0x33db, 0x4a47, \
|
||||
{ 0x8f, 0xfa, 0xff, 0xd6, 0xea, 0x47, 0xcb, 0x1a } }
|
||||
|
||||
|
||||
|
||||
/*This interface is used to allow nsDOMSelection become more of an independent entity from nsSelection. */
|
||||
class nsIIndependentSelection: public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IINDEPENDENTSELECTION_IID; return iid; }
|
||||
|
||||
/** SetPresShell
|
||||
* this method sets the internal pres shell to aPresShell
|
||||
* @param aPresShell weak reference should be kept to this.
|
||||
*/
|
||||
NS_IMETHOD SetPresShell(nsIPresShell *aPresShell) =0;
|
||||
};
|
||||
|
||||
#endif //nsIIndependentSelection_h___
|
||||
60
mozilla/layout/base/public/nsILayoutDebugger.h
Normal file
60
mozilla/layout/base/public/nsILayoutDebugger.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* -*- 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 nsILayoutDebugger_h___
|
||||
#define nsILayoutDebugger_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIDocument;
|
||||
class nsIPresShell;
|
||||
|
||||
/* a6cf90f8-15b3-11d2-932e-00805f8add32 */
|
||||
#define NS_ILAYOUT_DEBUGGER_IID \
|
||||
{ 0xa6cf90f8, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
/**
|
||||
* API for access and control of layout debugging
|
||||
*/
|
||||
class nsILayoutDebugger : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILAYOUT_DEBUGGER_IID)
|
||||
|
||||
NS_IMETHOD SetShowFrameBorders(PRBool aEnable) = 0;
|
||||
|
||||
NS_IMETHOD GetShowFrameBorders(PRBool* aResult) = 0;
|
||||
|
||||
NS_IMETHOD SetShowEventTargetFrameBorder(PRBool aEnable) = 0;
|
||||
|
||||
NS_IMETHOD GetShowEventTargetFrameBorder(PRBool* aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetContentSize(nsIDocument* aDocument,
|
||||
PRInt32* aSizeInBytesResult) = 0;
|
||||
|
||||
NS_IMETHOD GetFrameSize(nsIPresShell* aPresentation,
|
||||
PRInt32* aSizeInBytesResult) = 0;
|
||||
|
||||
NS_IMETHOD GetStyleSize(nsIPresShell* aPresentation,
|
||||
PRInt32* aSizeInBytesResult) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsILayoutDebugger_h___ */
|
||||
27
mozilla/layout/base/public/nsILayoutHistoryState.h
Normal file
27
mozilla/layout/base/public/nsILayoutHistoryState.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef _nsILayoutHistoryState_h
|
||||
#define _nsILayoutHistoryState_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIStatefulFrame.h" // Get StateType enum
|
||||
#include "nsIPresState.h"
|
||||
|
||||
#define NS_ILAYOUTHISTORYSTATE_IID_STR "306c8ca0-5f0c-11d3-a9fb-000064657374"
|
||||
|
||||
#define NS_ILAYOUTHISTORYSTATE_IID \
|
||||
{0x306c8ca0, 0x5f0c, 0x11d3, \
|
||||
{0xa9, 0xfb, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
|
||||
|
||||
class nsILayoutHistoryState : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILAYOUTHISTORYSTATE_IID)
|
||||
|
||||
NS_IMETHOD AddState(PRUint32 aContentID, nsIPresState* aState, nsIStatefulFrame::StateType aStateType) = 0;
|
||||
NS_IMETHOD GetState(PRUint32 aContentID, nsIPresState** aState, nsIStatefulFrame::StateType aStateType) = 0;
|
||||
NS_IMETHOD RemoveState(PRUint32 aContentID, nsIStatefulFrame::StateType aStateType) = 0;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewLayoutHistoryState(nsILayoutHistoryState** aState);
|
||||
|
||||
#endif /* _nsILayoutHistoryState_h */
|
||||
|
||||
53
mozilla/layout/base/public/nsIMutableStyleContext.h
Normal file
53
mozilla/layout/base/public/nsIMutableStyleContext.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* -*- 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.org 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 nsIMutableStyleContext_h___
|
||||
#define nsIMutableStyleContext_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsStyleStruct.h"
|
||||
|
||||
|
||||
#define NS_IMUTABLESTYLECONTEXT_IID \
|
||||
{ 0x53cbb100, 0x8340, 0x11d3, \
|
||||
{0xba, 0x05, 0x00, 0x10, 0x83, 0x02, 0x3c, 0x2b} }
|
||||
|
||||
|
||||
class nsIMutableStyleContext : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IMUTABLESTYLECONTEXT_IID; return iid; }
|
||||
|
||||
virtual nsIStyleContext* GetParent(void) const = 0;
|
||||
|
||||
// Fill a style struct with data
|
||||
NS_IMETHOD GetStyle(nsStyleStructID aSID, nsStyleStruct& aStruct) const = 0;
|
||||
NS_IMETHOD SetStyle(nsStyleStructID aSID, const nsStyleStruct& aStruct) = 0;
|
||||
|
||||
//------------------------------------------------
|
||||
// TEMP methods these are here only to ease the transition
|
||||
// to the newer Get/SetStyle APIs above. Don't call these.
|
||||
// get a style data struct by ID
|
||||
virtual const nsStyleStruct* GetStyleData(nsStyleStructID aSID) = 0;
|
||||
virtual nsStyleStruct* GetMutableStyleData(nsStyleStructID aSID) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIMutableStyleContext_h___ */
|
||||
76
mozilla/layout/base/public/nsINameSpace.h
Normal file
76
mozilla/layout/base/public/nsINameSpace.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/* -*- 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 nsINameSpace_h___
|
||||
#define nsINameSpace_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nslayout.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsString;
|
||||
class nsINameSpaceManager;
|
||||
|
||||
#define NS_INAMESPACE_IID \
|
||||
{ 0xa6cf90d4, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
|
||||
/**
|
||||
* A nsINameSpace registers the NameSpace URI with the NameSpaceManager
|
||||
* (creating or finding an ID), and manages the relationship between
|
||||
* the NameSpace ID and the (optional) Prefix.
|
||||
*
|
||||
* New NameSpaces are created as a child of an existing NameSpace. Searches
|
||||
* for NameSpaces based on prefix search up the chain of nested NameSpaces
|
||||
*
|
||||
* Each NameSpace keeps a live reference on its parent and its Manager.
|
||||
*
|
||||
*/
|
||||
class nsINameSpace : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_INAMESPACE_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetNameSpaceManager(nsINameSpaceManager*& aManager) const = 0;
|
||||
|
||||
// Get data of this name space
|
||||
NS_IMETHOD GetNameSpaceID(PRInt32& aID) const = 0;
|
||||
NS_IMETHOD GetNameSpaceURI(nsAWritableString& aURI) const = 0;
|
||||
NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aPrefix) const = 0;
|
||||
|
||||
NS_IMETHOD GetParentNameSpace(nsINameSpace*& aParent) const = 0;
|
||||
|
||||
// find name space within self and parents (not children)
|
||||
NS_IMETHOD FindNameSpace(nsIAtom* aPrefix, nsINameSpace*& aNameSpace) const = 0;
|
||||
NS_IMETHOD FindNameSpaceID(nsIAtom* aPrefix, PRInt32& aNameSpaceID) const = 0;
|
||||
NS_IMETHOD FindNameSpacePrefix(PRInt32 aNameSpaceID, nsIAtom*& aPrefix) const = 0;
|
||||
|
||||
// create new child name space
|
||||
NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix,
|
||||
const nsAReadableString& aURI,
|
||||
nsINameSpace*& aChildNameSpace) = 0;
|
||||
|
||||
NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, PRInt32 aNameSpaceID,
|
||||
nsINameSpace*& aChildNameSpace) = 0;
|
||||
};
|
||||
|
||||
#endif // nsINameSpace_h___
|
||||
85
mozilla/layout/base/public/nsINameSpaceManager.h
Normal file
85
mozilla/layout/base/public/nsINameSpaceManager.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/* -*- 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 nsINameSpaceManager_h___
|
||||
#define nsINameSpaceManager_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nslayout.h"
|
||||
#include "nsAWritableString.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsString;
|
||||
class nsINameSpace;
|
||||
|
||||
#define kNameSpaceID_Unknown -1
|
||||
#define kNameSpaceID_None 0
|
||||
#define kNameSpaceID_XMLNS 1 // not really a namespace, but it needs to play the game
|
||||
#define kNameSpaceID_XML 2
|
||||
#define kNameSpaceID_HTML 3
|
||||
#define kNameSpaceID_XLink 4
|
||||
|
||||
// 'html' is by definition bound to the namespace name "urn:w3-org-ns:HTML" XXX ???
|
||||
// 'xml' is by definition bound to the namespace name "urn:Connolly:input:required" XXX
|
||||
|
||||
#define NS_INAMESPACEMANAGER_IID \
|
||||
{ 0xa6cf90d5, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
/**
|
||||
* The Name Space Manager tracks the associtation between a NameSpace
|
||||
* URI and the PRInt32 runtime id. Mappings between NameSpaces and
|
||||
* NameSpace prefixes are managed by nsINameSpaces
|
||||
*
|
||||
* All NameSpace URIs are stored in a global table so that IDs are
|
||||
* consistent accross the app. NameSpace IDs are only consistent at runtime
|
||||
* ie: they are not guaranteed to be consistent accross app sessions.
|
||||
*
|
||||
* The nsINameSpaceManager needs to have a live reference for as long as
|
||||
* the NameSpace IDs are needed. Generally, a document keeps a reference to
|
||||
* a nsINameSpaceManager. Also, each nsINameSpace that comes from the manager
|
||||
* keeps a reference to it.
|
||||
*
|
||||
* To create a stack of NameSpaces, call CreateRootNameSpace, and then create
|
||||
* child NameSpaces from the root.
|
||||
*
|
||||
* The "html" and "xml" namespaces come "pre-canned" from the root.
|
||||
*
|
||||
*/
|
||||
class nsINameSpaceManager : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_INAMESPACEMANAGER_IID; return iid; }
|
||||
|
||||
NS_IMETHOD CreateRootNameSpace(nsINameSpace*& aRootNameSpace) = 0;
|
||||
|
||||
NS_IMETHOD RegisterNameSpace(const nsAReadableString& aURI,
|
||||
PRInt32& aNameSpaceID) = 0;
|
||||
|
||||
NS_IMETHOD GetNameSpaceURI(PRInt32 aNameSpaceID, nsAWritableString& aURI) = 0;
|
||||
NS_IMETHOD GetNameSpaceID(const nsAReadableString& aURI, PRInt32& aNameSpaceID) = 0;
|
||||
};
|
||||
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewNameSpaceManager(nsINameSpaceManager** aInstancePtrResult);
|
||||
|
||||
|
||||
#endif // nsINameSpaceManager_h___
|
||||
234
mozilla/layout/base/public/nsINodeInfo.h
Normal file
234
mozilla/layout/base/public/nsINodeInfo.h
Normal file
@@ -0,0 +1,234 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
/*
|
||||
* nsINodeInfo is an interface to node info, such as name, prefix, namespace
|
||||
* ID and possibly other data that is shared between nodes (elements
|
||||
* and attributes) that have the same name, prefix and namespace ID within
|
||||
* the same document.
|
||||
*
|
||||
* nsINodeInfoManager is an interface to an object that manages a list of
|
||||
* nsINodeInfo's, every document object should hold a strong reference to
|
||||
* a nsINodeInfoManager and every nsINodeInfo also holds a strong reference
|
||||
* to their owning manager. When a nsINodeInfo is no longer used it will
|
||||
* automatically remove itself from its owner manager, and when all
|
||||
* nsINodeInfo's have been removed from a nsINodeInfoManager and all external
|
||||
* references are released the nsINodeInfoManager deletes itself.
|
||||
*
|
||||
* -- jst@netscape.com
|
||||
*/
|
||||
|
||||
#ifndef nsINodeInfo_h___
|
||||
#define nsINodeInfo_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsAWritableString.h"
|
||||
|
||||
// Forward declarations
|
||||
class nsIAtom;
|
||||
class nsINodeInfoManager;
|
||||
class nsINameSpaceManager;
|
||||
class nsString;
|
||||
|
||||
|
||||
// IID for the nsINodeInfo interface
|
||||
#define NS_INODEINFO_IID \
|
||||
{ 0x93dbfd8c, 0x2fb3, 0x4ef5, \
|
||||
{0xa2, 0xa0, 0xcf, 0xf2, 0x69, 0x6f, 0x07, 0x88} }
|
||||
|
||||
// IID for the nsINodeInfoManager interface
|
||||
#define NS_INODEINFOMANAGER_IID \
|
||||
{ 0xb622469b, 0x4dcf, 0x45c4, \
|
||||
{0xb0, 0xb9, 0xa7, 0x32, 0xbc, 0xee, 0xa5, 0xcc} }
|
||||
|
||||
#define NS_NODEINFOMANAGER_CONTRACTID "@mozilla.org/layout/nodeinfomanager;1"
|
||||
|
||||
|
||||
class nsINodeInfo : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_INODEINFO_IID)
|
||||
|
||||
/*
|
||||
* Get the name from this node as a string, this does not include the prefix.
|
||||
*
|
||||
* For the HTML element "<body>" this will return "body" and for the XML
|
||||
* element "<html:body>" this will return "body".
|
||||
*/
|
||||
NS_IMETHOD GetName(nsAWritableString& aName) = 0;
|
||||
|
||||
/*
|
||||
* Get the name from this node as an atom, this does not include the prefix.
|
||||
* This function never returns a null atom.
|
||||
*
|
||||
* For the HTML element "<body>" this will return the "body" atom and for
|
||||
* the XML element "<html:body>" this will return the "body" atom.
|
||||
*/
|
||||
NS_IMETHOD GetNameAtom(nsIAtom*& aAtom) = 0;
|
||||
|
||||
/*
|
||||
* Get the qualified name from this node as a string, the qualified name
|
||||
* includes the prefix, if one exists.
|
||||
*
|
||||
* For the HTML element "<body>" this will return "body" and for the XML
|
||||
* element "<html:body>" this will return "html:body".
|
||||
*/
|
||||
NS_IMETHOD GetQualifiedName(nsAWritableString& aQualifiedName) = 0;
|
||||
|
||||
/*
|
||||
* Get the local name from this node as a string, GetLocalName() gets the
|
||||
* same string as GetName() but only if the node has a prefix and/or a
|
||||
* namespace URI. If the node has neither a prefix nor a namespace URI the
|
||||
* local name is a null string.
|
||||
*
|
||||
* For the HTML element "<body>" in a HTML document this will return a null
|
||||
* string and for the XML element "<html:body>" this will return "body".
|
||||
*/
|
||||
NS_IMETHOD GetLocalName(nsAWritableString& aLocalName) = 0;
|
||||
|
||||
/*
|
||||
* Get the prefix from this node as a string.
|
||||
*
|
||||
* For the HTML element "<body>" this will return a null string and for
|
||||
* the XML element "<html:body>" this will return the string "html".
|
||||
*/
|
||||
NS_IMETHOD GetPrefix(nsAWritableString& aPrefix) = 0;
|
||||
|
||||
/*
|
||||
* Get the prefix from this node as an atom.
|
||||
*
|
||||
* For the HTML element "<body>" this will return a null atom and for
|
||||
* the XML element "<html:body>" this will return the "html" atom.
|
||||
*/
|
||||
NS_IMETHOD GetPrefixAtom(nsIAtom*& aAtom) = 0;
|
||||
|
||||
/*
|
||||
* Get the namespace URI for a node, if the node has a namespace URI.
|
||||
*
|
||||
* For the HTML element "<body>" in a HTML document this will return a null
|
||||
* string and for the XML element "<html:body>" (assuming that this element,
|
||||
* or one of it's ancestors has an
|
||||
* xmlns:html='http://www.w3.org/1999/xhtml' attribute) this will return
|
||||
* the string "http://www.w3.org/1999/xhtml".
|
||||
*/
|
||||
NS_IMETHOD GetNamespaceURI(nsAWritableString& aNameSpaceURI) = 0;
|
||||
|
||||
/*
|
||||
* Get the namespace ID for a node if the node has a namespace, if not this
|
||||
* returns kNameSpaceID_None.
|
||||
*
|
||||
* For the HTML element "<body>" in a HTML document this will return
|
||||
* kNameSpaceID_None and for the XML element "<html:body>" (assuming that
|
||||
* this element, or one of it's ancestors has an
|
||||
* xmlns:html='http://www.w3.org/1999/xhtml' attribute) this will return
|
||||
* the namespace ID for "http://www.w3.org/1999/xhtml".
|
||||
*/
|
||||
NS_IMETHOD GetNamespaceID(PRInt32& aResult) = 0;
|
||||
|
||||
/*
|
||||
* Get and set the ID attribute atom for this node.
|
||||
* See http://www.w3.org/TR/1998/REC-xml-19980210#sec-attribute-types
|
||||
* for the definition of an ID attribute.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetIDAttributeAtom(nsIAtom** aResult) = 0;
|
||||
NS_IMETHOD SetIDAttributeAtom(nsIAtom* aResult) = 0;
|
||||
|
||||
/*
|
||||
* Get the owning node info manager, this will never return null.
|
||||
*/
|
||||
NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager) = 0;
|
||||
|
||||
/*
|
||||
* Utility functions that can be used to check if a nodeinfo holds a specific
|
||||
* name, name and prefix, name and prefix and namespace ID, or just
|
||||
* namespace ID.
|
||||
*/
|
||||
NS_IMETHOD_(PRBool) Equals(nsINodeInfo *aNodeInfo) = 0;
|
||||
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom) = 0;
|
||||
NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName) = 0;
|
||||
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom) = 0;
|
||||
NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName,
|
||||
const nsAReadableString& aPrefix) = 0;
|
||||
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID) = 0;
|
||||
NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName, PRInt32 aNamespaceID) = 0;
|
||||
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom,
|
||||
PRInt32 aNamespaceID) = 0;
|
||||
NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName,
|
||||
const nsAReadableString& aPrefix,
|
||||
PRInt32 aNamespaceID) = 0;
|
||||
NS_IMETHOD_(PRBool) NamespaceEquals(PRInt32 aNamespaceID) = 0;
|
||||
NS_IMETHOD_(PRBool) NamespaceEquals(const nsAReadableString& aNamespaceURI) = 0;
|
||||
NS_IMETHOD_(PRBool) QualifiedNameEquals(const nsAReadableString& aQualifiedName) = 0;
|
||||
|
||||
/*
|
||||
* This is a convinience method that creates a new nsINodeInfo that differs
|
||||
* only by name from the one this is called on.
|
||||
*/
|
||||
NS_IMETHOD NameChanged(nsIAtom *aName, nsINodeInfo*& aResult) = 0;
|
||||
|
||||
/*
|
||||
* This is a convinience method that creates a new nsINodeInfo that differs
|
||||
* only by prefix from the one this is called on.
|
||||
*/
|
||||
NS_IMETHOD PrefixChanged(nsIAtom *aPrefix, nsINodeInfo*& aResult) = 0;
|
||||
};
|
||||
|
||||
|
||||
class nsINodeInfoManager : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_INODEINFOMANAGER_IID)
|
||||
|
||||
/*
|
||||
* Initialize the nodeinfo manager with a namespace manager, this should
|
||||
* allways be done.
|
||||
*/
|
||||
NS_IMETHOD Init(nsINameSpaceManager *aNameSpaceManager) = 0;
|
||||
|
||||
/*
|
||||
* Methods for creating nodeinfo's from atoms and/or strings.
|
||||
*/
|
||||
NS_IMETHOD GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
|
||||
PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo) = 0;
|
||||
NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, nsIAtom *aPrefix,
|
||||
PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo) = 0;
|
||||
NS_IMETHOD GetNodeInfo(const nsAReadableString& aName,
|
||||
const nsAReadableString& aPrefix,
|
||||
PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo) = 0;
|
||||
NS_IMETHOD GetNodeInfo(const nsAReadableString& aName,
|
||||
const nsAReadableString& aPrefix,
|
||||
const nsAReadableString& aNamespaceURI,
|
||||
nsINodeInfo*& aNodeInfo) = 0;
|
||||
NS_IMETHOD GetNodeInfo(const nsAReadableString& aQualifiedName,
|
||||
const nsAReadableString& aNamespaceURI,
|
||||
nsINodeInfo*& aNodeInfo) = 0;
|
||||
|
||||
/*
|
||||
* Getter for the namespace manager used by this nodeinfo manager.
|
||||
*/
|
||||
NS_IMETHOD GetNamespaceManager(nsINameSpaceManager*& aNameSpaceManager) = 0;
|
||||
};
|
||||
|
||||
extern nsresult NS_NewNodeInfoManager(nsINodeInfoManager** aResult);
|
||||
|
||||
#endif /* nsINodeInfo_h___ */
|
||||
75
mozilla/layout/base/public/nsIObjectFrame.h
Normal file
75
mozilla/layout/base/public/nsIObjectFrame.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- 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.org 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 nsIObjectFrame_h___
|
||||
#define nsIObjectFrame_h___
|
||||
|
||||
class nsIPresContext;
|
||||
class nsIPluginInstance;
|
||||
|
||||
// {6D10B07D-E75B-11d4-9885-00C04FA0CF4B}
|
||||
#define NS_IOBJECTFRAME_IID \
|
||||
{ 0x6d10b07d, 0xe75b, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
|
||||
|
||||
class nsIObjectFrame : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IOBJECTFRAME_IID)
|
||||
|
||||
NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList) = 0;
|
||||
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow) = 0;
|
||||
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus) = 0;
|
||||
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
|
||||
nsDidReflowStatus aStatus) = 0;
|
||||
NS_IMETHOD Paint(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer) = 0;
|
||||
|
||||
NS_IMETHOD HandleEvent(nsIPresContext* aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus) = 0;
|
||||
|
||||
NS_IMETHOD Scrolled(nsIView *aView) = 0;
|
||||
NS_IMETHOD GetFrameType(nsIAtom** aType) const = 0;
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const = 0;
|
||||
#endif
|
||||
|
||||
NS_IMETHOD Destroy(nsIPresContext* aPresContext) = 0;
|
||||
|
||||
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
nsISupports* aSubContent) = 0;
|
||||
|
||||
NS_IMETHOD GetPluginInstance(nsIPluginInstance*& aPluginInstance) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsIObjectFrame_h___ */
|
||||
129
mozilla/layout/base/public/nsIPageSequenceFrame.h
Normal file
129
mozilla/layout/base/public/nsIPageSequenceFrame.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/* -*- 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.org 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 nsIPageSequenceFrame_h___
|
||||
#define nsIPageSequenceFrame_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIPresContext;
|
||||
class nsIPrintOptions;
|
||||
|
||||
// IID for the nsIPageSequenceFrame interface
|
||||
// a6cf90d2-15b3-11d2-932e-00805f8add32
|
||||
#define NS_IPAGESEQUENCEFRAME_IID \
|
||||
{ 0xa6cf90d2, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
// IID for the nsIPrintStatusCallback interface
|
||||
// a6cf90d3-15b3-11d2-932e-00805f8add32
|
||||
#define NS_IPRINTSTATUSCALLBACK_IID \
|
||||
{ 0xa6cf90d3, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* List of status codes that provide additional information about the
|
||||
* progress of the print operation.
|
||||
* @see nsIPrintStatusCallback#OnProgress()
|
||||
*/
|
||||
enum nsPrintStatus {
|
||||
ePrintStatus_StartPage, // beginning the specified page
|
||||
ePrintStatus_EndPage // finished with the specified page
|
||||
};
|
||||
|
||||
/**
|
||||
* List of print error codes.
|
||||
* @see nsIPrintStatusCallback##OnError()
|
||||
*/
|
||||
enum nsPrintError {
|
||||
ePrintError_Error, // unspecified error
|
||||
ePrintError_Abort, // operation was aborted by the user
|
||||
ePrintError_OutOfDisk, // system is out of disk space
|
||||
ePrintError_OutOfMemory // system is out of memory
|
||||
};
|
||||
|
||||
/**
|
||||
* The page sequence frame provides information on the print operation by
|
||||
* calling notification methods on the client's nsIPrintStatusCallback
|
||||
* interface.
|
||||
*/
|
||||
class nsIPrintStatusCallback : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPRINTSTATUSCALLBACK_IID)
|
||||
|
||||
/**
|
||||
* Indicates the current progress of the print operation.
|
||||
*
|
||||
* @param aPageNumber the number of the current page
|
||||
* @param aTotalPages the total number of pages
|
||||
* @param aStatusCode additional information regarding the progress
|
||||
* @param aContinuePrinting return PR_TRUE to continue printing and
|
||||
* PR_FALSE to cancel the printing operation
|
||||
*/
|
||||
NS_IMETHOD OnProgress(PRInt32 aPageNumber,
|
||||
PRInt32 aTotalPages,
|
||||
nsPrintStatus aStatusCode,
|
||||
PRBool& aContinuePrinting) = 0;
|
||||
|
||||
/**
|
||||
* Notification that an error has occured.
|
||||
*/
|
||||
NS_IMETHOD OnError(nsPrintError aErrorCode) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Interface for accessing special capabilities of the page sequence frame.
|
||||
*
|
||||
* Today all that exists are member functions for printing.
|
||||
*/
|
||||
class nsIPageSequenceFrame : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPAGESEQUENCEFRAME_IID)
|
||||
|
||||
/**
|
||||
* Print the set of pages.
|
||||
*
|
||||
* @param aPrintOptions options for printing
|
||||
* @param aStatusCallback interface that the client provides to receive
|
||||
* progress notifications. Can be NULL
|
||||
* @return NS_OK if successful
|
||||
* NS_ERROR_ABORT if the client cancels printing using the callback
|
||||
* interface
|
||||
* NS_ERROR_INVALID_ARG if printing a range of pages (not all pages)
|
||||
* and the start page is greater than the total number of pages
|
||||
* NS_ERROR_FAILURE if there is an error
|
||||
* @see nsIPrintStatusCallback#OnProgress()
|
||||
*/
|
||||
NS_IMETHOD Print(nsIPresContext* aPresContext,
|
||||
nsIPrintOptions* aPrintOptions,
|
||||
nsIPrintStatusCallback* aStatusCallback) = 0;
|
||||
|
||||
private:
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void) = 0;
|
||||
NS_IMETHOD_(nsrefcnt) Release(void) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIPageSequenceFrame_h___ */
|
||||
|
||||
|
||||
411
mozilla/layout/base/public/nsIPresContext.h
Normal file
411
mozilla/layout/base/public/nsIPresContext.h
Normal file
@@ -0,0 +1,411 @@
|
||||
/* -*- 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.org 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):
|
||||
* IBM Corporation
|
||||
*
|
||||
* This Original Code has been modified by IBM Corporation.
|
||||
* Modifications made by IBM described herein are
|
||||
* Copyright (c) International Business Machines
|
||||
* Corporation, 2000
|
||||
*
|
||||
* Modifications to Mozilla code or documentation
|
||||
* identified per MPL Section 3.3
|
||||
*
|
||||
* Date Modified by Description of modification
|
||||
* 03/20/2000 IBM Corp. BiDi - ability to change the default direction of the browser
|
||||
*
|
||||
*/
|
||||
#ifndef nsIPresContext_h___
|
||||
#define nsIPresContext_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsIFrameImageLoader.h"
|
||||
#include "nsILanguageAtom.h"
|
||||
|
||||
struct nsFont;
|
||||
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIDeviceContext;
|
||||
class nsIFontMetrics;
|
||||
class nsIFrame;
|
||||
class nsIImage;
|
||||
class nsIImageGroup;
|
||||
class nsILinkHandler;
|
||||
class nsIPresShell;
|
||||
class nsIPref;
|
||||
class nsIStyleContext;
|
||||
class nsIAtom;
|
||||
class nsString;
|
||||
class nsIEventStateManager;
|
||||
class nsIURI;
|
||||
class nsILookAndFeel;
|
||||
class nsICSSPseudoComparator;
|
||||
|
||||
#define NS_IPRESCONTEXT_IID \
|
||||
{ 0x0a5d12e0, 0x944e, 0x11d1, \
|
||||
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
enum nsCompatibility {
|
||||
eCompatibility_Standard = 1,
|
||||
eCompatibility_NavQuirks = 2
|
||||
};
|
||||
|
||||
enum nsWidgetRendering {
|
||||
eWidgetRendering_Native = 1,
|
||||
eWidgetRendering_Gfx = 2,
|
||||
eWidgetRendering_PartialGfx = 3
|
||||
};
|
||||
|
||||
enum nsWidgetType {
|
||||
eWidgetType_Button = 1,
|
||||
eWidgetType_Checkbox = 2,
|
||||
eWidgetType_Radio = 3,
|
||||
eWidgetType_Text = 4
|
||||
};
|
||||
|
||||
enum nsLanguageSpecificTransformType {
|
||||
eLanguageSpecificTransformType_Unknown = -1,
|
||||
eLanguageSpecificTransformType_None = 0,
|
||||
eLanguageSpecificTransformType_Japanese,
|
||||
eLanguageSpecificTransformType_Korean
|
||||
};
|
||||
|
||||
// supported values for cached bool types
|
||||
const PRUint32 kPresContext_UseDocumentColors = 0x01;
|
||||
const PRUint32 kPresContext_UseDocumentFonts = 0x02;
|
||||
const PRUint32 kPresContext_UnderlineLinks = 0x03;
|
||||
|
||||
// An interface for presentation contexts. Presentation contexts are
|
||||
// objects that provide an outer context for a presentation shell.
|
||||
class nsIPresContext : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IPRESCONTEXT_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Initialize the presentation context from a particular device.
|
||||
*/
|
||||
NS_IMETHOD Init(nsIDeviceContext* aDeviceContext) = 0;
|
||||
|
||||
/**
|
||||
* Stop the presentation in preperation for destruction.
|
||||
* @param aStopChrome PR_TRUE to stop chrome as well.
|
||||
*/
|
||||
NS_IMETHOD Stop(PRBool aStopChrome = PR_TRUE) = 0;
|
||||
|
||||
/**
|
||||
* Set the presentation shell that this context is bound to.
|
||||
* A presentation context may only be bound to a single shell.
|
||||
*/
|
||||
NS_IMETHOD SetShell(nsIPresShell* aShell) = 0;
|
||||
|
||||
/**
|
||||
* Get the PresentationShell that this context is bound to.
|
||||
*/
|
||||
NS_IMETHOD GetShell(nsIPresShell** aResult) = 0;
|
||||
|
||||
/**
|
||||
* Access compatibility mode for this context
|
||||
*/
|
||||
NS_IMETHOD GetCompatibilityMode(nsCompatibility* aModeResult) = 0;
|
||||
NS_IMETHOD SetCompatibilityMode(nsCompatibility aMode) = 0;
|
||||
|
||||
/**
|
||||
* Access the widget rendering mode for this context
|
||||
*/
|
||||
NS_IMETHOD GetWidgetRenderingMode(nsWidgetRendering* aModeResult) = 0;
|
||||
NS_IMETHOD SetWidgetRenderingMode(nsWidgetRendering aMode) = 0;
|
||||
|
||||
/**
|
||||
* Access the image animation mode for this context
|
||||
*/
|
||||
NS_IMETHOD GetImageAnimationMode(nsImageAnimation* aModeResult) = 0;
|
||||
NS_IMETHOD SetImageAnimationMode(nsImageAnimation aMode) = 0;
|
||||
|
||||
/**
|
||||
* Get look and feel object
|
||||
*/
|
||||
NS_IMETHOD GetLookAndFeel(nsILookAndFeel** aLookAndFeel) = 0;
|
||||
|
||||
/**
|
||||
* Get base url for presentation
|
||||
*/
|
||||
NS_IMETHOD GetBaseURL(nsIURI** aURLResult) = 0;
|
||||
|
||||
/**
|
||||
* Get medium of presentation
|
||||
*/
|
||||
NS_IMETHOD GetMedium(nsIAtom** aMediumResult) = 0;
|
||||
|
||||
/**
|
||||
* Remap style from the root frame downwards, and reflow.
|
||||
*/
|
||||
NS_IMETHOD RemapStyleAndReflow(void) = 0;
|
||||
|
||||
/**
|
||||
* Resolve style for the given piece of content that will be a child
|
||||
* of the aParentContext. Don't use this for pseudo frames.
|
||||
*/
|
||||
NS_IMETHOD ResolveStyleContextFor(nsIContent* aContent,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRBool aForceUnique,
|
||||
nsIStyleContext** aResult) = 0;
|
||||
|
||||
/**
|
||||
* Resolve style for a pseudo frame within the given aParentContent & aParentContext.
|
||||
* The tag should be lowercase and inclue the colon.
|
||||
* ie: NS_NewAtom(":first-line");
|
||||
*/
|
||||
NS_IMETHOD ResolvePseudoStyleContextFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRBool aForceUnique,
|
||||
nsIStyleContext** aResult) = 0;
|
||||
|
||||
/**
|
||||
* Resolve style for a pseudo frame within the given aParentContent & aParentContext.
|
||||
* The tag should be lowercase and inclue the colon.
|
||||
* ie: NS_NewAtom(":first-line");
|
||||
*
|
||||
* Instead of matching solely on aPseudoTag, a comparator function can be
|
||||
* passed in to test.
|
||||
*/
|
||||
NS_IMETHOD ResolvePseudoStyleWithComparator(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRBool aForceUnique,
|
||||
nsICSSPseudoComparator* aComparator,
|
||||
nsIStyleContext** aResult) = 0;
|
||||
|
||||
/**
|
||||
* Probe style for a pseudo frame within the given aParentContent & aParentContext.
|
||||
* This will return nsnull id there are no explicit rules for the pseudo element.
|
||||
* The tag should be lowercase and inclue the colon.
|
||||
* ie: NS_NewAtom(":first-line");
|
||||
*/
|
||||
NS_IMETHOD ProbePseudoStyleContextFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRBool aForceUnique,
|
||||
nsIStyleContext** aResult) = 0;
|
||||
|
||||
/**
|
||||
* For a given frame tree, get a new style context that is the equivalent
|
||||
* but within a new parent
|
||||
*/
|
||||
NS_IMETHOD ReParentStyleContext(nsIFrame* aFrame,
|
||||
nsIStyleContext* aNewParentContext) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Get the font metrics for a given font.
|
||||
*/
|
||||
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics** aResult) = 0;
|
||||
|
||||
/** Get the default font */
|
||||
NS_IMETHOD GetDefaultFont(nsFont& aResult) = 0;
|
||||
/** Set the default font */
|
||||
NS_IMETHOD SetDefaultFont(const nsFont& aFont) = 0;
|
||||
virtual const nsFont& GetDefaultFontDeprecated() = 0;
|
||||
|
||||
/** Get the default fixed pitch font */
|
||||
NS_IMETHOD GetDefaultFixedFont(nsFont& aResult) = 0;
|
||||
/** Set the default fixed pitch font */
|
||||
NS_IMETHOD SetDefaultFixedFont(const nsFont& aFont) = 0;
|
||||
virtual const nsFont& GetDefaultFixedFontDeprecated() = 0;
|
||||
|
||||
/** Get a cached boolean pref, by its type
|
||||
if the type is not supported, then NS_ERROR_FAILURE is returned
|
||||
and the aValue argument is undfined, otherwise aValue is set
|
||||
to the value of the boolean pref */
|
||||
// * - initially created for bugs 31816, 20760, 22963
|
||||
NS_IMETHOD GetCachedBoolPref(PRUint32 prefType, PRBool &aValue) = 0;
|
||||
|
||||
/**
|
||||
* Access Nav's magic font scaler value
|
||||
*/
|
||||
NS_IMETHOD GetFontScaler(PRInt32* aResult) = 0;
|
||||
NS_IMETHOD SetFontScaler(PRInt32 aScaler) = 0;
|
||||
|
||||
/**
|
||||
* Get the default colors
|
||||
*/
|
||||
NS_IMETHOD GetDefaultColor(nscolor* aColor) = 0;
|
||||
NS_IMETHOD GetDefaultBackgroundColor(nscolor* aColor) = 0;
|
||||
NS_IMETHOD GetDefaultBackgroundImage(nsString& aImage) = 0;
|
||||
NS_IMETHOD GetDefaultBackgroundImageRepeat(PRUint8* aRepeat) = 0;
|
||||
NS_IMETHOD GetDefaultBackgroundImageOffset(nscoord* aX, nscoord* aY) = 0;
|
||||
NS_IMETHOD GetDefaultBackgroundImageAttachment(PRUint8* aRepeat) = 0;
|
||||
NS_IMETHOD GetDefaultLinkColor(nscolor* aColor) = 0;
|
||||
NS_IMETHOD GetDefaultVisitedLinkColor(nscolor* aColor) = 0;
|
||||
|
||||
NS_IMETHOD SetDefaultColor(nscolor aColor) = 0;
|
||||
NS_IMETHOD SetDefaultBackgroundColor(nscolor aColor) = 0;
|
||||
NS_IMETHOD SetDefaultBackgroundImage(const nsString& aImage) = 0;
|
||||
NS_IMETHOD SetDefaultBackgroundImageRepeat(PRUint8 aRepeat) = 0;
|
||||
NS_IMETHOD SetDefaultBackgroundImageOffset(nscoord aX, nscoord aY) = 0;
|
||||
NS_IMETHOD SetDefaultBackgroundImageAttachment(PRUint8 aRepeat) = 0;
|
||||
NS_IMETHOD SetDefaultLinkColor(nscolor aColor) = 0;
|
||||
NS_IMETHOD SetDefaultVisitedLinkColor(nscolor aColor) = 0;
|
||||
|
||||
NS_IMETHOD GetImageGroup(nsIImageGroup** aGroupResult) = 0;
|
||||
|
||||
/**
|
||||
* Load an image for the target frame. This call can be made
|
||||
* repeated with only a single image ever being loaded. If
|
||||
* aNeedSizeUpdate is PR_TRUE, then when the image's size is
|
||||
* determined the target frame will be reflowed (via a
|
||||
* ContentChanged notification on the presentation shell). When the
|
||||
* image's data is ready for rendering the target frame's Paint()
|
||||
* method will be invoked (via the ViewManager) so that the
|
||||
* appropriate damage repair is done.
|
||||
*
|
||||
* @param aBackgroundColor - If the background color is NULL, a mask
|
||||
* will be generated for transparent images. If the background
|
||||
* color is non-NULL, it indicates the RGB value to be folded
|
||||
* into the transparent areas of the image and no mask is created.
|
||||
*/
|
||||
NS_IMETHOD StartLoadImage(const nsString& aURL,
|
||||
const nscolor* aBackgroundColor,
|
||||
const nsSize* aDesiredSize,
|
||||
nsIFrame* aTargetFrame,
|
||||
nsIFrameImageLoaderCB aCallBack,
|
||||
void* aClosure,
|
||||
void* aKey,
|
||||
nsIFrameImageLoader** aResult) = 0;
|
||||
|
||||
/**
|
||||
* Stop a specific image load being done on behalf of the argument frame.
|
||||
*/
|
||||
NS_IMETHOD StopLoadImage(void* aKey,
|
||||
nsIFrameImageLoader* aLoader) = 0;
|
||||
|
||||
/**
|
||||
* Stop any image loading being done on behalf of the argument frame.
|
||||
*/
|
||||
NS_IMETHOD StopAllLoadImagesFor(nsIFrame* aTargetFrame, void* aKey) = 0;
|
||||
|
||||
NS_IMETHOD SetContainer(nsISupports* aContainer) = 0;
|
||||
|
||||
NS_IMETHOD GetContainer(nsISupports** aResult) = 0;
|
||||
|
||||
// XXX this are going to be replaced with set/get container
|
||||
NS_IMETHOD SetLinkHandler(nsILinkHandler* aHandler) = 0;
|
||||
NS_IMETHOD GetLinkHandler(nsILinkHandler** aResult) = 0;
|
||||
|
||||
/**
|
||||
* Get the visible area associated with this presentation context.
|
||||
* This is the size of the visiable area that is used for
|
||||
* presenting the document. The returned value is in the standard
|
||||
* nscoord units (as scaled by the device context).
|
||||
*/
|
||||
NS_IMETHOD GetVisibleArea(nsRect& aResult) = 0;
|
||||
|
||||
/**
|
||||
* Set the currently visible area. The units for r are standard
|
||||
* nscoord units (as scaled by the device context).
|
||||
*/
|
||||
NS_IMETHOD SetVisibleArea(const nsRect& r) = 0;
|
||||
|
||||
/**
|
||||
* Return true if this presentation context is a paginated
|
||||
* context.
|
||||
*/
|
||||
NS_IMETHOD IsPaginated(PRBool* aResult) = 0;
|
||||
|
||||
/**
|
||||
* Return the page width if this is a paginated context.
|
||||
*/
|
||||
NS_IMETHOD GetPageWidth(nscoord* aResult) = 0;
|
||||
|
||||
/**
|
||||
* Return the page height if this is a paginated context
|
||||
*/
|
||||
NS_IMETHOD GetPageHeight(nscoord* aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetPixelsToTwips(float* aResult) const = 0;
|
||||
|
||||
NS_IMETHOD GetTwipsToPixels(float* aResult) const = 0;
|
||||
|
||||
//XXX this is probably not an ideal name. MMP
|
||||
/**
|
||||
* Do pixels to twips conversion taking into account
|
||||
* differing size of a "pixel" from device to device.
|
||||
*/
|
||||
NS_IMETHOD GetScaledPixelsToTwips(float* aScale) const = 0;
|
||||
|
||||
//be sure to Relase() after you are done with the Get()
|
||||
NS_IMETHOD GetDeviceContext(nsIDeviceContext** aResult) const = 0;
|
||||
|
||||
NS_IMETHOD GetEventStateManager(nsIEventStateManager** aManager) = 0;
|
||||
NS_IMETHOD GetDefaultDirection(PRUint8* aDirection) = 0;
|
||||
NS_IMETHOD SetDefaultDirection(PRUint8 aDirection) = 0;
|
||||
NS_IMETHOD GetLanguage(nsILanguageAtom** aLanguage) = 0;
|
||||
|
||||
/**
|
||||
* Get the language-specific transform type for the current document.
|
||||
* This tells us whether we need to perform special language-dependent
|
||||
* transformations such as Unicode U+005C (backslash) to Japanese
|
||||
* Yen Sign (Unicode U+00A5, JIS 0x5C).
|
||||
*
|
||||
* @param aType returns type, must be non-NULL
|
||||
*/
|
||||
NS_IMETHOD GetLanguageSpecificTransformType(
|
||||
nsLanguageSpecificTransformType* aType) = 0;
|
||||
|
||||
/**
|
||||
* Render only Selection
|
||||
*/
|
||||
NS_IMETHOD SetIsRenderingOnlySelection(PRBool aResult) = 0;
|
||||
NS_IMETHOD IsRenderingOnlySelection(PRBool* aResult) = 0;
|
||||
|
||||
#ifdef MOZ_REFLOW_PERF
|
||||
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Bit values for StartLoadImage's aImageStatus
|
||||
#define NS_LOAD_IMAGE_STATUS_ERROR 0x1
|
||||
#define NS_LOAD_IMAGE_STATUS_SIZE 0x2
|
||||
#define NS_LOAD_IMAGE_STATUS_BITS 0x4
|
||||
|
||||
// Factory method to create a "galley" presentation context (galley is
|
||||
// a kind of view that has no limit to the size of a page)
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewGalleyContext(nsIPresContext** aInstancePtrResult);
|
||||
|
||||
// Factory method to create a "paginated" presentation context for
|
||||
// the screen.
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewPrintPreviewContext(nsIPresContext** aInstancePtrResult);
|
||||
|
||||
|
||||
|
||||
#ifdef MOZ_REFLOW_PERF
|
||||
#define DO_GLOBAL_REFLOW_COUNT(_name, _type) \
|
||||
aPresContext->CountReflows((_name), (_type));
|
||||
#else
|
||||
#define DO_GLOBAL_REFLOW_COUNT(_name, _type)
|
||||
#endif // MOZ_REFLOW_PERF
|
||||
|
||||
#endif /* nsIPresContext_h___ */
|
||||
524
mozilla/layout/base/public/nsIPresShell.h
Normal file
524
mozilla/layout/base/public/nsIPresShell.h
Normal file
@@ -0,0 +1,524 @@
|
||||
/* -*- 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.org 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):
|
||||
* Steve Clark (buster@netscape.com)
|
||||
*
|
||||
* IBM Corporation
|
||||
*
|
||||
* This Original Code has been modified by IBM Corporation.
|
||||
* Modifications made by IBM described herein are
|
||||
* Copyright (c) International Business Machines
|
||||
* Corporation, 2000
|
||||
*
|
||||
* Modifications to Mozilla code or documentation
|
||||
* identified per MPL Section 3.3
|
||||
*
|
||||
* Date Modified by Description of modification
|
||||
* 05/03/2000 IBM Corp. Observer related defines for reflow
|
||||
*/
|
||||
#ifndef nsIPresShell_h___
|
||||
#define nsIPresShell_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsIReflowCommand.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
#include "nsISelectionController.h" //for the selection enums.
|
||||
|
||||
|
||||
class nsIContent;
|
||||
class nsIContentIterator;
|
||||
class nsIDocument;
|
||||
class nsIDocumentObserver;
|
||||
class nsIFrame;
|
||||
class nsIPresContext;
|
||||
class nsIStyleSet;
|
||||
class nsIViewManager;
|
||||
class nsIDeviceContext;
|
||||
class nsIRenderingContext;
|
||||
class nsIPageSequenceFrame;
|
||||
class nsString;
|
||||
class nsStringArray;
|
||||
class nsICaret;
|
||||
class nsIStyleContext;
|
||||
class nsIFrameSelection;
|
||||
class nsIFrameManager;
|
||||
class nsILayoutHistoryState;
|
||||
class nsIArena;
|
||||
class nsIReflowCallback;
|
||||
class nsISupportsArray;
|
||||
|
||||
#define NS_IPRESSHELL_IID \
|
||||
{ 0x76e79c60, 0x944e, 0x11d1, \
|
||||
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
// Constants uses for ScrollFrameIntoView() function
|
||||
#define NS_PRESSHELL_SCROLL_TOP 0
|
||||
#define NS_PRESSHELL_SCROLL_BOTTOM 100
|
||||
#define NS_PRESSHELL_SCROLL_LEFT 0
|
||||
#define NS_PRESSHELL_SCROLL_RIGHT 100
|
||||
#define NS_PRESSHELL_SCROLL_CENTER 50
|
||||
#define NS_PRESSHELL_SCROLL_ANYWHERE -1
|
||||
#define NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE -2
|
||||
|
||||
// Observer related defines
|
||||
#define NS_PRESSHELL_REFLOW_TOPIC "REFLOW" // Observer Topic
|
||||
#define NS_PRESSHELL_INITIAL_REFLOW "INITIAL REFLOW" // Observer Data
|
||||
#define NS_PRESSHELL_RESIZE_REFLOW "RESIZE REFLOW" // Observer Data
|
||||
#define NS_PRESSHELL_STYLE_CHANGE_REFLOW "STYLE CHANGE REFLOW" // Observer Data
|
||||
|
||||
// debug VerifyReflow flags
|
||||
#define VERIFY_REFLOW_ON 0x01
|
||||
#define VERIFY_REFLOW_NOISY 0x02
|
||||
#define VERIFY_REFLOW_ALL 0x04
|
||||
#define VERIFY_REFLOW_DUMP_COMMANDS 0x08
|
||||
#define VERIFY_REFLOW_NOISY_RC 0x10
|
||||
#define VERIFY_REFLOW_REALLY_NOISY_RC 0x20
|
||||
#define VERIFY_REFLOW_INCLUDE_SPACE_MANAGER 0x40
|
||||
#define VERIFY_REFLOW_DURING_RESIZE_REFLOW 0x80
|
||||
|
||||
// for PostAttributeChanged
|
||||
enum nsAttributeChangeType {
|
||||
eChangeType_Set = 0, // Set attribute
|
||||
eChangeType_Remove = 1 // Remove attribute
|
||||
};
|
||||
|
||||
/**
|
||||
* Presentation shell interface. Presentation shells are the
|
||||
* controlling point for managing the presentation of a document. The
|
||||
* presentation shell holds a live reference to the document, the
|
||||
* presentation context, the style manager, the style set and the root
|
||||
* frame. <p>
|
||||
*
|
||||
* When this object is Release'd, it will release the document, the
|
||||
* presentation context, the style manager, the style set and the root
|
||||
* frame.
|
||||
*/
|
||||
class nsIPresShell : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IPRESSHELL_IID; return iid; }
|
||||
|
||||
NS_IMETHOD Init(nsIDocument* aDocument,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet) = 0;
|
||||
|
||||
// All frames owned by the shell are allocated from an arena. They are also recycled
|
||||
// using free lists (separate free lists being maintained for each size_t).
|
||||
// Methods for recycling frames.
|
||||
NS_IMETHOD AllocateFrame(size_t aSize, void** aResult) = 0;
|
||||
NS_IMETHOD FreeFrame(size_t aSize, void* aFreeChunk) = 0;
|
||||
|
||||
// Dynamic stack memory allocation
|
||||
NS_IMETHOD PushStackMemory() = 0;
|
||||
NS_IMETHOD PopStackMemory() = 0;
|
||||
NS_IMETHOD AllocateStackMemory(size_t aSize, void** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetDocument(nsIDocument** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetPresContext(nsIPresContext** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetViewManager(nsIViewManager** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetStyleSet(nsIStyleSet** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetActiveAlternateStyleSheet(nsString& aSheetTitle) = 0;
|
||||
|
||||
NS_IMETHOD SelectAlternateStyleSheet(const nsString& aSheetTitle) = 0;
|
||||
|
||||
/** Setup all style rules required to implement preferences
|
||||
* - used for background/text/link colors and link underlining
|
||||
* may be extended for any prefs that are implemented via style rules
|
||||
* - aForceReflow argument is used to force a full reframe to make the rules show
|
||||
* (only used when the current page needs to reflect changed pref rules)
|
||||
*
|
||||
* - initially created for bugs 31816, 20760, 22963
|
||||
*/
|
||||
NS_IMETHOD SetPreferenceStyleRules(PRBool aForceReflow) = 0;
|
||||
|
||||
/** Allow client to enable and disable the use of the preference style rules,
|
||||
* by type.
|
||||
* NOTE: type argument is currently ignored, but is in the API for
|
||||
* future refinement
|
||||
*
|
||||
* - initially created for bugs 31816, 20760, 22963
|
||||
*/
|
||||
NS_IMETHOD EnablePrefStyleRules(PRBool aEnable, PRUint8 aPrefType=0xFF) = 0;
|
||||
NS_IMETHOD ArePrefStyleRulesEnabled(PRBool& aEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Gather titles of all selectable (alternate and preferred) style sheets
|
||||
* fills void array with nsString* caller must free strings
|
||||
*/
|
||||
NS_IMETHOD ListAlternateStyleSheets(nsStringArray& aTitleList) = 0;
|
||||
|
||||
/**
|
||||
* GetFrameSelection will return the Frame based selection API you
|
||||
* cannot go back and forth anymore with QI with nsIDOM sel and nsIFrame sel.
|
||||
*/
|
||||
NS_IMETHOD GetFrameSelection(nsIFrameSelection** aSelection) = 0;
|
||||
|
||||
// Make shell be a document observer
|
||||
NS_IMETHOD BeginObservingDocument() = 0;
|
||||
|
||||
// Make shell stop being a document observer
|
||||
NS_IMETHOD EndObservingDocument() = 0;
|
||||
|
||||
/**
|
||||
* Perform the initial reflow. Constructs the frame for the root content
|
||||
* object and then reflows the frame model into the specified width and
|
||||
* height.
|
||||
*
|
||||
* The coordinates for aWidth and aHeight must be in standard nscoord's.
|
||||
*/
|
||||
NS_IMETHOD InitialReflow(nscoord aWidth, nscoord aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Reflow the frame model into a new width and height. The
|
||||
* coordinates for aWidth and aHeight must be in standard nscoord's.
|
||||
*/
|
||||
NS_IMETHOD ResizeReflow(nscoord aWidth, nscoord aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Reflow the frame model with a reflow reason of eReflowReason_StyleChange
|
||||
*/
|
||||
NS_IMETHOD StyleChangeReflow() = 0;
|
||||
|
||||
NS_IMETHOD GetRootFrame(nsIFrame** aFrame) const = 0;
|
||||
|
||||
/**
|
||||
* Returns the page sequence frame associated with the frame hierarchy.
|
||||
* Returns NULL if not a paginated view.
|
||||
*/
|
||||
NS_IMETHOD GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Gets the primary frame associated with the content object. This is a
|
||||
* helper function that just forwards the request to the frame manager.
|
||||
*
|
||||
* The primary frame is the frame that is most closely associated with the
|
||||
* content. A frame is more closely associated with the content that another
|
||||
* frame if the one frame contains directly or indirectly the other frame (e.g.,
|
||||
* when a frame is scrolled there is a scroll frame that contains the frame
|
||||
* being scrolled). The primary frame is always the first-in-flow.
|
||||
*
|
||||
* In the case of absolutely positioned elements and floated elements,
|
||||
* the primary frame is the frame that is out of the flow and not the
|
||||
* placeholder frame.
|
||||
*/
|
||||
NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent,
|
||||
nsIFrame** aPrimaryFrame) const = 0;
|
||||
|
||||
/** Returns the style context associated with the frame.
|
||||
* Used by code outside of layout that can't use nsIFrame methods to get
|
||||
* the style context directly.
|
||||
*/
|
||||
NS_IMETHOD GetStyleContextFor(nsIFrame* aFrame,
|
||||
nsIStyleContext** aStyleContext) const = 0;
|
||||
|
||||
/**
|
||||
* Returns a layout object associated with the primary frame for the content object.
|
||||
*
|
||||
* @param aContent the content object for which we seek a layout object
|
||||
* @param aResult the resulting layout object as an nsISupports, if found. Refcounted.
|
||||
*/
|
||||
NS_IMETHOD GetLayoutObjectFor(nsIContent* aContent,
|
||||
nsISupports** aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Returns the object that acts as a subshell for aContent.
|
||||
* For example, for an html frame aResult will be an nsIDocShell.
|
||||
*/
|
||||
NS_IMETHOD GetSubShellFor(nsIContent* aContent,
|
||||
nsISupports** aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Establish a relationship between aContent and aSubShell.
|
||||
* aSubShell will be returned from GetSubShellFor(aContent, ...);
|
||||
*/
|
||||
NS_IMETHOD SetSubShellFor(nsIContent* aContent,
|
||||
nsISupports* aSubShell) = 0;
|
||||
|
||||
/**
|
||||
* Gets the placeholder frame associated with the specified frame. This is
|
||||
* a helper frame that forwards the request to the frame manager.
|
||||
*/
|
||||
NS_IMETHOD GetPlaceholderFrameFor(nsIFrame* aFrame,
|
||||
nsIFrame** aPlaceholderFrame) const = 0;
|
||||
|
||||
/**
|
||||
* Reflow commands
|
||||
*/
|
||||
NS_IMETHOD AppendReflowCommand(nsIReflowCommand* aReflowCommand) = 0;
|
||||
NS_IMETHOD CancelReflowCommand(nsIFrame* aTargetFrame, nsIReflowCommand::ReflowType* aCmdType) = 0;
|
||||
NS_IMETHOD CancelAllReflowCommands() = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Determine if it is safe to flush all pending notifications
|
||||
* @param aIsSafeToFlush PR_TRUE if it is safe, PR_FALSE otherwise.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush) = 0;
|
||||
|
||||
/**
|
||||
* Flush all pending notifications such that the presentation is
|
||||
* in sync with the content.
|
||||
*/
|
||||
NS_IMETHOD FlushPendingNotifications() = 0;
|
||||
|
||||
/**
|
||||
* Post a request to handle a DOM event after Reflow has finished.
|
||||
*/
|
||||
NS_IMETHOD PostDOMEvent(nsIContent* aContent, nsEvent* aEvent)=0;
|
||||
|
||||
/**
|
||||
* Post a request to set and attribute after reflow has finished.
|
||||
*/
|
||||
NS_IMETHOD PostAttributeChange(nsIContent* aContent,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aName,
|
||||
const nsString& aValue,
|
||||
PRBool aNotify,
|
||||
nsAttributeChangeType aType) = 0;
|
||||
|
||||
NS_IMETHOD PostReflowCallback(nsIReflowCallback* aCallback) = 0;
|
||||
NS_IMETHOD CancelReflowCallback(nsIReflowCallback* aCallback) = 0;
|
||||
/**
|
||||
* Reflow batching
|
||||
*/
|
||||
NS_IMETHOD BeginReflowBatching() = 0;
|
||||
NS_IMETHOD EndReflowBatching(PRBool aFlushPendingReflows) = 0;
|
||||
NS_IMETHOD GetReflowBatchingStatus(PRBool* aIsBatching) = 0;
|
||||
|
||||
NS_IMETHOD ClearFrameRefs(nsIFrame* aFrame) = 0;
|
||||
|
||||
/**
|
||||
* Given a frame, create a rendering context suitable for use with
|
||||
* the frame.
|
||||
*/
|
||||
NS_IMETHOD CreateRenderingContext(nsIFrame *aFrame,
|
||||
nsIRenderingContext** aContext) = 0;
|
||||
|
||||
/**
|
||||
* Notification that we were unable to render a replaced element.
|
||||
* Called when the replaced element can not be rendered, and we should
|
||||
* instead render the element's contents.
|
||||
* The content object associated with aFrame should either be a IMG
|
||||
* element, an OBJECT element, or an APPLET element
|
||||
*/
|
||||
NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Scrolls the view of the document so that the anchor with the specified
|
||||
* name is displayed at the top of the window
|
||||
*/
|
||||
NS_IMETHOD GoToAnchor(const nsString& aAnchorName) const = 0;
|
||||
|
||||
/**
|
||||
* Scrolls the view of the document so that the frame is displayed at the
|
||||
* top of the window.
|
||||
*
|
||||
* @param aFrame The frame to scroll into view
|
||||
* @param aVPercent How to align the frame vertically. A value of 0
|
||||
* (NS_PRESSHELL_SCROLL_TOP) means the frame's upper edge is
|
||||
* aligned with the top edge of the visible area. A value of
|
||||
* 100 (NS_PRESSHELL_SCROLL_BOTTOM) means the frame's bottom
|
||||
* edge is aligned with the bottom edge of the visible area.
|
||||
* For values in between, the point "aVPercent" down the frame
|
||||
* is placed at the point "aVPercent" down the visible area. A
|
||||
* value of 50 (NS_PRESSHELL_SCROLL_CENTER) centers the frame
|
||||
* vertically. A value of NS_PRESSHELL_SCROLL_ANYWHERE means move
|
||||
* the frame the minimum amount necessary in order for the entire
|
||||
* frame to be visible vertically (if possible)
|
||||
* @param aHPercent How to align the frame horizontally. A value of 0
|
||||
* (NS_PRESSHELL_SCROLL_LEFT) means the frame's left edge is
|
||||
* aligned with the left edge of the visible area. A value of
|
||||
* 100 (NS_PRESSHELL_SCROLL_RIGHT) means the frame's right
|
||||
* edge is aligned with the right edge of the visible area.
|
||||
* For values in between, the point "aVPercent" across the frame
|
||||
* is placed at the point "aVPercent" across the visible area.
|
||||
* A value of 50 (NS_PRESSHELL_SCROLL_CENTER) centers the frame
|
||||
* horizontally . A value of NS_PRESSHELL_SCROLL_ANYWHERE means move
|
||||
* the frame the minimum amount necessary in order for the entire
|
||||
* frame to be visible horizontally (if possible)
|
||||
*/
|
||||
NS_IMETHOD ScrollFrameIntoView(nsIFrame *aFrame,
|
||||
PRIntn aVPercent,
|
||||
PRIntn aHPercent) const = 0;
|
||||
|
||||
/**
|
||||
* Notification sent by a frame informing the pres shell that it is about to
|
||||
* be destroyed.
|
||||
* This allows any outstanding references to the frame to be cleaned up
|
||||
*/
|
||||
NS_IMETHOD NotifyDestroyingFrame(nsIFrame* aFrame) = 0;
|
||||
|
||||
/**
|
||||
* Returns the frame manager object
|
||||
*/
|
||||
NS_IMETHOD GetFrameManager(nsIFrameManager** aFrameManager) const = 0;
|
||||
|
||||
/**
|
||||
* Notify the Clipboard that we have something to copy.
|
||||
*/
|
||||
NS_IMETHOD DoCopy() = 0;
|
||||
|
||||
/**
|
||||
* Get the caret, if it exists. AddRefs it.
|
||||
*/
|
||||
NS_IMETHOD GetCaret(nsICaret **aOutCaret) = 0;
|
||||
|
||||
/**
|
||||
* Should the images have borders etc. Actual visual effects are determined
|
||||
* by the frames. Visual effects may not effect layout, only display.
|
||||
* Takes effect on next repaint, does not force a repaint itself.
|
||||
*
|
||||
* @param aEnabled if PR_TRUE, visual selection effects are enabled
|
||||
* if PR_FALSE visual selection effects are disabled
|
||||
* @return always NS_OK
|
||||
*/
|
||||
NS_IMETHOD SetDisplayNonTextSelection(PRBool aInEnable) = 0;
|
||||
|
||||
/**
|
||||
* Gets the current state of non text selection effects
|
||||
* @param aEnabled [OUT] set to the current state of non text selection,
|
||||
* as set by SetDisplayNonTextSelection
|
||||
* @return if aOutEnabled==null, returns NS_ERROR_INVALID_ARG
|
||||
* else NS_OK
|
||||
*/
|
||||
NS_IMETHOD GetDisplayNonTextSelection(PRBool *aOutEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Interface to dispatch events via the presshell
|
||||
*/
|
||||
NS_IMETHOD HandleEventWithTarget(nsEvent* aEvent,
|
||||
nsIFrame* aFrame,
|
||||
nsIContent* aContent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aStatus) = 0;
|
||||
|
||||
/**
|
||||
* Dispatch event to content only (NOT full processing)
|
||||
*/
|
||||
NS_IMETHOD HandleDOMEventWithTarget(nsIContent* aTargetContent,
|
||||
nsEvent* aEvent,
|
||||
nsEventStatus* aStatus) = 0;
|
||||
|
||||
/**
|
||||
* Gets the current target event frame from the PresShell
|
||||
*/
|
||||
NS_IMETHOD GetEventTargetFrame(nsIFrame** aFrame) = 0;
|
||||
|
||||
/**
|
||||
* Get and set the history state for the current document
|
||||
*/
|
||||
|
||||
NS_IMETHOD CaptureHistoryState(nsILayoutHistoryState** aLayoutHistoryState, PRBool aLeavingPage = PR_FALSE) = 0;
|
||||
NS_IMETHOD GetHistoryState(nsILayoutHistoryState** aLayoutHistoryState) = 0;
|
||||
NS_IMETHOD SetHistoryState(nsILayoutHistoryState* aLayoutHistoryState) = 0;
|
||||
|
||||
/**
|
||||
* Determine if reflow is currently locked
|
||||
* @param aIsReflowLocked returns PR_TRUE if reflow is locked, PR_FALSE otherwise
|
||||
*/
|
||||
NS_IMETHOD IsReflowLocked(PRBool* aIsLocked) = 0;
|
||||
|
||||
/**
|
||||
* Returns a content iterator to iterate the generated content nodes.
|
||||
* You must specify whether you want to iterate the "before" generated
|
||||
* content or the "after" generated content. If there is no generated
|
||||
* content of the specified type for the promary frame associated with
|
||||
* with the content object then NULL is returned
|
||||
*/
|
||||
enum GeneratedContentType {Before, After};
|
||||
NS_IMETHOD GetGeneratedContentIterator(nsIContent* aContent,
|
||||
GeneratedContentType aType,
|
||||
nsIContentIterator** aIterator) const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Store the nsIAnonymousContentCreator-generated anonymous
|
||||
* content that's associated with an element.
|
||||
* @param aContent the element with which the anonymous
|
||||
* content is to be associated with
|
||||
* @param aAnonymousElements an array of nsIContent
|
||||
* objects, or null to indicate that any anonymous
|
||||
* content should be dissociated from the aContent
|
||||
*/
|
||||
NS_IMETHOD SetAnonymousContentFor(nsIContent* aContent, nsISupportsArray* aAnonymousElements) = 0;
|
||||
|
||||
/**
|
||||
* Retrieve the nsIAnonymousContentCreator-generated anonymous
|
||||
* content that's associated with an element.
|
||||
* @param aContent the element for which to retrieve the
|
||||
* associated anonymous content
|
||||
* @param aAnonymousElements an array of nsIContent objects,
|
||||
* or null to indicate that there are no anonymous elements
|
||||
* associated with aContent
|
||||
*/
|
||||
NS_IMETHOD GetAnonymousContentFor(nsIContent* aContent, nsISupportsArray** aAnonymousElements) = 0;
|
||||
|
||||
/**
|
||||
* Release all nsIAnonymousContentCreator-generated
|
||||
* anonymous content associated with the shell.
|
||||
*/
|
||||
NS_IMETHOD ReleaseAnonymousContent() = 0;
|
||||
|
||||
/**
|
||||
* See if reflow verification is enabled. To enable reflow verification add
|
||||
* "verifyreflow:1" to your NSPR_LOG_MODULES environment variable
|
||||
* (any non-zero debug level will work). Or, call SetVerifyReflowEnable
|
||||
* with PR_TRUE.
|
||||
*/
|
||||
static NS_LAYOUT PRBool GetVerifyReflowEnable();
|
||||
|
||||
/**
|
||||
* Set the verify-reflow enable flag.
|
||||
*/
|
||||
static NS_LAYOUT void SetVerifyReflowEnable(PRBool aEnabled);
|
||||
|
||||
/**
|
||||
* Get the flags associated with the VerifyReflow debug tool
|
||||
*/
|
||||
static NS_LAYOUT PRInt32 GetVerifyReflowFlags();
|
||||
|
||||
|
||||
#ifdef MOZ_REFLOW_PERF
|
||||
NS_IMETHOD ClearTotals() = 0;
|
||||
NS_IMETHOD DumpReflows() = 0;
|
||||
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType) = 0;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a new empty presentation shell. Upon success, call Init
|
||||
* before attempting to use the shell.
|
||||
*/
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewPresShell(nsIPresShell** aInstancePtrResult);
|
||||
|
||||
#endif /* nsIPresShell_h___ */
|
||||
31
mozilla/layout/base/public/nsIPresState.h
Normal file
31
mozilla/layout/base/public/nsIPresState.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef _nsIPresState_h
|
||||
#define _nsIPresState_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {98DABCE1-C9D7-11d3-BF87-00105A1B0627}
|
||||
#define NS_IPRESSTATE_IID \
|
||||
{ 0x98dabce1, 0xc9d7, 0x11d3, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
|
||||
|
||||
class nsIPresState : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPRESSTATE_IID)
|
||||
|
||||
NS_IMETHOD GetStatePropertyAsSupports(const nsAReadableString& aName,
|
||||
nsISupports** aResult) = 0;
|
||||
NS_IMETHOD SetStatePropertyAsSupports(const nsAReadableString& aName,
|
||||
nsISupports* aValue) = 0;
|
||||
|
||||
NS_IMETHOD GetStateProperty(const nsAReadableString& aName,
|
||||
nsAWritableString& aResult) = 0;
|
||||
NS_IMETHOD SetStateProperty(const nsAReadableString& aProperty,
|
||||
const nsAReadableString& aValue) = 0;
|
||||
|
||||
NS_IMETHOD RemoveStateProperty(const nsAReadableString& aName) = 0;
|
||||
};
|
||||
|
||||
extern nsresult
|
||||
NS_NewPresState(nsIPresState** aResult);
|
||||
|
||||
#endif /* _nsIPresState_h */
|
||||
56
mozilla/layout/base/public/nsIPrintContext.h
Normal file
56
mozilla/layout/base/public/nsIPrintContext.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* -*- 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.org 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):
|
||||
*
|
||||
* This Original Code has been modified by IBM Corporation.
|
||||
* Modifications made by IBM described herein are
|
||||
* Copyright (c) International Business Machines
|
||||
* Corporation, 2000
|
||||
*
|
||||
*/
|
||||
#ifndef nsIPrintContext_h___
|
||||
#define nsIPrintContext_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nscore.h"
|
||||
|
||||
|
||||
#define NS_IPRINTCONTEXT_IID \
|
||||
{ 0xa05e0e40, 0xe1bf, 0x11d4, \
|
||||
{ 0xa8, 0x5d, 0x0, 0x10, 0x5a, 0x18, 0x34, 0x19 } }
|
||||
|
||||
|
||||
// An interface for presentation printing contexts
|
||||
class nsIPrintContext : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPRINTCONTEXT_IID)
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Factory method to create a "paginated" presentation context for
|
||||
// printing
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewPrintContext(nsIPrintContext** aInstancePtrResult);
|
||||
|
||||
#endif
|
||||
34
mozilla/layout/base/public/nsIPrintListener.idl
Normal file
34
mozilla/layout/base/public/nsIPrintListener.idl
Normal file
@@ -0,0 +1,34 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(DB8D9F25-F183-11d3-8F9F-00A024A7D144)]
|
||||
|
||||
/* Use this for any object that wants to listen to print requests */
|
||||
|
||||
interface nsIPrintListener : nsISupports
|
||||
{
|
||||
void OnStartPrinting();
|
||||
void OnProgressPrinting(in PRUint32 aProgress, in PRUint32 aProgressMax);
|
||||
void OnEndPrinting(in PRUint32 aStatus);
|
||||
};
|
||||
49
mozilla/layout/base/public/nsIPrivateDOMImplementation.h
Normal file
49
mozilla/layout/base/public/nsIPrivateDOMImplementation.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/* -*- 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.org 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 nsIPrivateDOMImplementation_h__
|
||||
#define nsIPrivateDOMImplementation_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIURI;
|
||||
|
||||
/*
|
||||
* Event listener manager interface.
|
||||
*/
|
||||
#define NS_IPRIVATEDOMIMPLEMENTATION_IID \
|
||||
{ /* d3205fb8-2652-11d4-ba06-0060b0fc76dd */ \
|
||||
0xd3205fb8, 0x2652, 0x11d4, \
|
||||
{0xba, 0x06, 0x00, 0x60, 0xb0, 0xfc, 0x76, 0xdd} }
|
||||
|
||||
class nsIPrivateDOMImplementation : public nsISupports {
|
||||
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IPRIVATEDOMIMPLEMENTATION_IID; return iid; }
|
||||
|
||||
NS_IMETHOD Init(nsIURI* aBaseURI) = 0;
|
||||
};
|
||||
|
||||
NS_LAYOUT nsresult
|
||||
NS_NewDOMImplementation(nsIDOMDOMImplementation** aInstancePtrResult);
|
||||
|
||||
#endif // nsIPrivateDOMImplementation_h__
|
||||
43
mozilla/layout/base/public/nsIReflowCallback.h
Normal file
43
mozilla/layout/base/public/nsIReflowCallback.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Original Author: David Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsIReflowCallback_h___
|
||||
#define nsIReflowCallback_h___
|
||||
|
||||
// {03E6FD70-889C-44b1-8639-A7EF5A80ED5C}
|
||||
#define NS_IREFLOWCALLBACK_IID \
|
||||
{ 0x3e6fd70, 0x889c, 0x44b1, { 0x86, 0x39, 0xa7, 0xef, 0x5a, 0x80, 0xed, 0x5c } }
|
||||
|
||||
class nsIPresShell;
|
||||
|
||||
/**
|
||||
* Reflow callback interface
|
||||
*/
|
||||
class nsIReflowCallback : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IREFLOWCALLBACK_IID; return iid; }
|
||||
|
||||
NS_IMETHOD ReflowFinished(nsIPresShell* aShell, PRBool* aFlushFlag) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIFrameUtil_h___ */
|
||||
176
mozilla/layout/base/public/nsIReflowCommand.h
Normal file
176
mozilla/layout/base/public/nsIReflowCommand.h
Normal file
@@ -0,0 +1,176 @@
|
||||
/* -*- 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.org 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 nsIReflowCommand_h___
|
||||
#define nsIReflowCommand_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include <stdio.h>
|
||||
|
||||
class nsIAtom;
|
||||
class nsIFrame;
|
||||
class nsIPresContext;
|
||||
class nsIRenderingContext;
|
||||
struct nsHTMLReflowMetrics;
|
||||
struct nsSize;
|
||||
|
||||
// IID for the nsIReflowCommand interface {C3658E40-FF20-11d1-85BC-00A02468FAB6}
|
||||
#define NS_IREFLOWCOMMAND_IID \
|
||||
{ 0xc3658e40, 0xff20, 0x11d1, \
|
||||
{0x85, 0xbc, 0x0, 0xa0, 0x24, 0x68, 0xfa, 0xb6}}
|
||||
|
||||
// Reflow command flags
|
||||
#define NS_RC_CREATED_DURING_DOCUMENT_LOAD 0x0001
|
||||
|
||||
/**
|
||||
* A reflow command is an object that is generated in response to a content
|
||||
* model change notification. The reflow command is given to a presentation
|
||||
* shell where it is queued and then dispatched by invoking the reflow
|
||||
* commands's Dispatch() member function.
|
||||
*
|
||||
* Reflow command processing follows a path from the root frame down to the
|
||||
* target frame (the frame for which the reflow command is destined). Reflow
|
||||
* commands are processed by invoking the frame's Reflow() member function.
|
||||
*
|
||||
* The typical flow of control for a given reflow command starts with a content
|
||||
* change notification. The content notifications are sent to document observers.
|
||||
* The presentation shell forwards the notifications to the style set. The style
|
||||
* system responds to the notifications by creating new frame (or destroying
|
||||
* existing frames) as appropriate, and then generating a reflow command.
|
||||
*
|
||||
* @see nsIDocumentObserver
|
||||
* @see nsIStyleSet
|
||||
* @see nsIFrameReflow#Reflow()
|
||||
* @see nsIPresShell#AppendReflowCommand()
|
||||
* @see nsIPresShell#ProcessReflowCommands()
|
||||
*/
|
||||
class nsIReflowCommand : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IREFLOWCOMMAND_IID; return iid; }
|
||||
|
||||
enum ReflowType {
|
||||
// This reflow command is used when a leaf node's content changes
|
||||
// (e.g. some text in a text run, an image's source, etc.). The
|
||||
// target of the reflow command is the frame that changed (see
|
||||
// nsIFrame#ContentChanged() for how the target frame is
|
||||
// determined).
|
||||
ContentChanged,
|
||||
|
||||
// This reflow command is used when the style for a frame has
|
||||
// changed. This also implies that if the frame is a container
|
||||
// that its childrens style has also changed. The target of the
|
||||
// reflow command is the frame that changed style.
|
||||
StyleChanged,
|
||||
|
||||
// When an incremental reflow operation affects a next-in-flow,
|
||||
// these commands are used to get the next-in-flow to update
|
||||
// itself.
|
||||
PullupReflow,
|
||||
PushReflow,
|
||||
|
||||
// This command is used to see if a prev-in-flow wants to pullup
|
||||
// some children from a next-in-flow that has changed because of
|
||||
// an incremental reflow.
|
||||
CheckPullupReflow,
|
||||
|
||||
// Reflow dirty stuff (really a per-frame extension)
|
||||
ReflowDirty,
|
||||
|
||||
// Trap door for extensions.
|
||||
UserDefined
|
||||
};
|
||||
|
||||
/**
|
||||
* Dispatch the reflow command.
|
||||
*
|
||||
* Builds a path from the target frame back to the root frame, and then
|
||||
* invokes the root frame's Reflow() member function.
|
||||
*
|
||||
* @see nsIFrame#Reflow()
|
||||
*/
|
||||
NS_IMETHOD Dispatch(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsSize& aMaxSize,
|
||||
nsIRenderingContext& aRendContext) = 0;
|
||||
|
||||
/**
|
||||
* Get the next frame in the command processing path. If requested removes the
|
||||
* the frame from the path. You must remove the frame from the path before
|
||||
* dispatching the reflow command to the next frame in the chain.
|
||||
*/
|
||||
NS_IMETHOD GetNext(nsIFrame*& aNextFrame, PRBool aRemove = PR_TRUE) = 0;
|
||||
|
||||
/**
|
||||
* Get the target of the reflow command.
|
||||
*/
|
||||
NS_IMETHOD GetTarget(nsIFrame*& aTargetFrame) const = 0;
|
||||
|
||||
/**
|
||||
* Change the target of the reflow command.
|
||||
*/
|
||||
NS_IMETHOD SetTarget(nsIFrame* aTargetFrame) = 0;
|
||||
|
||||
/**
|
||||
* Get the type of reflow command.
|
||||
*/
|
||||
NS_IMETHOD GetType(ReflowType& aReflowType) const = 0;
|
||||
|
||||
/**
|
||||
* Get the child frame associated with the reflow command.
|
||||
*/
|
||||
NS_IMETHOD GetChildFrame(nsIFrame*& aChildFrame) const = 0;
|
||||
|
||||
/**
|
||||
* Returns the name of the child list to which the child frame belongs.
|
||||
* Only used for reflow command types FrameAppended, FrameInserted, and
|
||||
* FrameRemoved
|
||||
*
|
||||
* Returns nsnull if the child frame is associated with the unnamed
|
||||
* principal child list
|
||||
*/
|
||||
NS_IMETHOD GetChildListName(nsIAtom*& aListName) const = 0;
|
||||
|
||||
/**
|
||||
* Sets the name of the child list to which the child frame belongs.
|
||||
* Only used for reflow command types FrameAppended, FrameInserted, and
|
||||
* FrameRemoved
|
||||
*/
|
||||
NS_IMETHOD SetChildListName(nsIAtom* aListName) = 0;
|
||||
|
||||
/**
|
||||
* Get the previous sibling frame associated with the reflow command.
|
||||
* This is used for FrameInserted reflow commands.
|
||||
*/
|
||||
NS_IMETHOD GetPrevSiblingFrame(nsIFrame*& aSiblingFrame) const = 0;
|
||||
|
||||
/**
|
||||
* Dump out the reflow-command to out
|
||||
*/
|
||||
NS_IMETHOD List(FILE* out) const = 0;
|
||||
|
||||
/**
|
||||
* Get/set reflow command flags
|
||||
*/
|
||||
NS_IMETHOD GetFlags(PRInt32* aFlags) = 0;
|
||||
NS_IMETHOD SetFlags(PRInt32 aFlags) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIReflowCommand_h___ */
|
||||
124
mozilla/layout/base/public/nsIScrollableFrame.h
Normal file
124
mozilla/layout/base/public/nsIScrollableFrame.h
Normal file
@@ -0,0 +1,124 @@
|
||||
/* -*- 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.org 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 nsIScrollFrame_h___
|
||||
#define nsIScrollFrame_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsIViewManager.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIBox;
|
||||
class nsIPresContext;
|
||||
|
||||
// IID for the nsIScrollableFrame interface
|
||||
#define NS_ISCROLLABLE_FRAME_IID \
|
||||
{ 0xc95f1831, 0xc372, 0x11d1, \
|
||||
{ 0xb7, 0x21, 0x0, 0x64, 0x9, 0x92, 0xd8, 0xc9 } }
|
||||
|
||||
class nsIScrollableFrame : public nsISupports {
|
||||
public:
|
||||
|
||||
enum nsScrollPref {
|
||||
Auto = 0,
|
||||
NeverScroll,
|
||||
AlwaysScroll,
|
||||
AlwaysScrollVertical,
|
||||
AlwaysScrollHorizontal
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISCROLLABLE_FRAME_IID)
|
||||
|
||||
/**
|
||||
* Set the view that we are scrolling within the scrolling view.
|
||||
*/
|
||||
NS_IMETHOD SetScrolledFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame *aScrolledFrame) = 0;
|
||||
|
||||
/**
|
||||
* Get the view that we are scrolling within the scrollable frame.
|
||||
* @result child view
|
||||
*/
|
||||
NS_IMETHOD GetScrolledFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame *&aScrolledFrame) const = 0;
|
||||
|
||||
/**
|
||||
* Gets the size of the area that lies inside the scrollbars but clips the scrolled frame
|
||||
*/
|
||||
NS_IMETHOD GetClipSize(nsIPresContext* aPresContext,
|
||||
nscoord *aWidth,
|
||||
nscoord *aHeight) const = 0;
|
||||
/**
|
||||
* Get information about whether the vertical and horizontal scrollbars
|
||||
* are currently visible
|
||||
*/
|
||||
NS_IMETHOD GetScrollbarVisibility(nsIPresContext* aPresContext,
|
||||
PRBool *aVerticalVisible,
|
||||
PRBool *aHorizontalVisible) const = 0;
|
||||
|
||||
/**
|
||||
* Query whether scroll bars should be displayed all the time, never or
|
||||
* only when necessary.
|
||||
* @return current scrollbar selection
|
||||
*/
|
||||
NS_IMETHOD GetScrollPreference(nsIPresContext* aPresContext, nsScrollPref* aScrollPreference) const = 0;
|
||||
|
||||
/**
|
||||
* Gets the size of the area that lies inside the scrollbars but clips the scrolled frame
|
||||
*/
|
||||
NS_IMETHOD GetScrollbarSizes(nsIPresContext* aPresContext,
|
||||
nscoord *aVbarWidth,
|
||||
nscoord *aHbarHeight) const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Get the position of the scrolled view.
|
||||
*/
|
||||
NS_IMETHOD GetScrollPosition(nsIPresContext* aContext, nscoord &aX, nscoord& aY) const=0;
|
||||
|
||||
/**
|
||||
* Scroll the view to the given x,y, update's the scrollbar's thumb
|
||||
* positions and the view's offset. Clamps the values to be
|
||||
* legal. Updates the display based on aUpdateFlags.
|
||||
* @param aX left edge to scroll to
|
||||
* @param aY top edge to scroll to
|
||||
* @param aUpdateFlags passed onto nsIViewManager->UpdateView()
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD ScrollTo(nsIPresContext* aContext, nscoord aX, nscoord aY, PRUint32 aFlags = NS_VMREFRESH_NO_SYNC)=0;
|
||||
|
||||
NS_IMETHOD GetScrollableView(nsIPresContext* aContext, nsIScrollableView** aResult)=0;
|
||||
|
||||
|
||||
/**
|
||||
* Set information about whether the vertical and horizontal scrollbars
|
||||
* are currently visible
|
||||
*/
|
||||
NS_IMETHOD SetScrollbarVisibility(nsIPresContext* aPresContext,
|
||||
PRBool aVerticalVisible,
|
||||
PRBool aHorizontalVisible) = 0;
|
||||
|
||||
NS_IMETHOD GetScrollbarBox(PRBool aVertical, nsIBox** aResult) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
43
mozilla/layout/base/public/nsIScrollableViewProvider.h
Normal file
43
mozilla/layout/base/public/nsIScrollableViewProvider.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsIScrollableViewProvider_h
|
||||
#define _nsIScrollableViewProvider_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
#define NS_ISCROLLABLEVIEWPROVIDER_IID_STR "2b2e0d30-1dd2-11b2-9169-eb82b04f6775"
|
||||
|
||||
#define NS_ISCROLLABLEVIEWPROVIDER_IID \
|
||||
{0x2b2e0d30, 0x1dd2, 0x11b2, \
|
||||
{0x91, 0x69, 0xeb, 0x82, 0xb0, 0x4f, 0x67, 0x75}}
|
||||
|
||||
class nsIScrollableView;
|
||||
|
||||
class nsIScrollableViewProvider : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISCROLLABLEVIEWPROVIDER_IID)
|
||||
|
||||
NS_IMETHOD GetScrollableView(nsIScrollableView** aView)=0;
|
||||
};
|
||||
|
||||
#endif /* _nsIScrollableViewProvider_h */
|
||||
66
mozilla/layout/base/public/nsISelection.idl
Normal file
66
mozilla/layout/base/public/nsISelection.idl
Normal file
@@ -0,0 +1,66 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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.org 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):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "domstubs.idl"
|
||||
#include "nsISelectionListener.idl"
|
||||
#include "nsIEnumerator.idl"
|
||||
|
||||
%{C++
|
||||
class nsIDOMNode;
|
||||
class nsIDOMRange;
|
||||
class nsISelectionListener;
|
||||
%}
|
||||
|
||||
[scriptable, uuid(B2C7ED59-8634-4352-9E37-5484C8B6E4E1)]
|
||||
interface nsISelection : nsISupports
|
||||
{
|
||||
readonly attribute nsIDOMNode anchorNode;
|
||||
readonly attribute long anchorOffset;
|
||||
|
||||
readonly attribute nsIDOMNode focusNode;
|
||||
readonly attribute long focusOffset;
|
||||
|
||||
readonly attribute boolean isCollapsed;
|
||||
|
||||
readonly attribute long rangeCount;
|
||||
|
||||
nsIDOMRange getRangeAt(in long index);
|
||||
|
||||
void collapse(in nsIDOMNode parentNode, in long offset);
|
||||
void extend(in nsIDOMNode parentNode, in long offset);
|
||||
|
||||
void collapseToStart();
|
||||
void collapseToEnd();
|
||||
|
||||
boolean containsNode(in nsIDOMNode node, in boolean recursive);
|
||||
|
||||
void selectAllChildren(in nsIDOMNode parentNode);
|
||||
|
||||
void addRange(in nsIDOMRange range);
|
||||
void removeRange(in nsIDOMRange range);
|
||||
void removeAllRanges();
|
||||
|
||||
void deleteFromDocument();
|
||||
|
||||
wstring toString();
|
||||
};
|
||||
104
mozilla/layout/base/public/nsISelectionControler.h
Normal file
104
mozilla/layout/base/public/nsISelectionControler.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/* -*- 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.org 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):
|
||||
*/
|
||||
|
||||
/*
|
||||
* !!Note this is for a javascriptable pres shell currently for accessing selection
|
||||
* the selection refers only to that which listens to keybindings which is the "NORMAL"
|
||||
* selection this will be IDLIZED LATER
|
||||
*/
|
||||
|
||||
#ifndef nsISelectionControler_h___
|
||||
#define nsISelectionControler_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
|
||||
#define NS_ISELECTIONCONTROLER_IID_STR "D2D1D179-85A7-11d3-9932-00108301233C"
|
||||
|
||||
#define NS_ISELECTIONCONTROLER_IID \
|
||||
{ 0xd2d1d179, 0x85a7, 0x11d3, \
|
||||
{ 0x99, 0x32, 0x0, 0x10, 0x83, 0x1, 0x23, 0x3c }}
|
||||
|
||||
|
||||
class nsISelectionControler : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ISELECTIONCONTROLER_IID; return iid; }
|
||||
|
||||
/** CharacterMove will move the selection one character forward/backward in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
NS_IMETHOD CharacterMove(PRBool aForward, PRBool aExtend) = 0;
|
||||
|
||||
/** WordMove will move the selection one word forward/backward in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
NS_IMETHOD WordMove(PRBool aForward, PRBool aExtend) = 0;
|
||||
|
||||
/** LineMove will move the selection one line forward/backward in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
NS_IMETHOD LineMove(PRBool aForward, PRBool aExtend) = 0;
|
||||
|
||||
/** IntraLineMove will move the selection to the front of the line or end of the line
|
||||
* in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend) = 0;
|
||||
|
||||
/** PageMove will move the selection one page forward/backward in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
NS_IMETHOD PageMove(PRBool aForward, PRBool aExtend) = 0;
|
||||
|
||||
/** ScrollPage will scroll the page without affecting the selection.
|
||||
* @param aForward scroll forward or backwards in selection
|
||||
*/
|
||||
NS_IMETHOD ScrollPage(PRBool aForward) = 0;
|
||||
|
||||
/** SelectAll will select the whole page
|
||||
*/
|
||||
NS_IMETHOD SelectAll() = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* nsISelectionControler_h___ */
|
||||
233
mozilla/layout/base/public/nsISelectionController.idl
Normal file
233
mozilla/layout/base/public/nsISelectionController.idl
Normal file
@@ -0,0 +1,233 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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.org 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):
|
||||
* Sammy Ford
|
||||
*/
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "domstubs.idl"
|
||||
#include "nsISelection.idl"
|
||||
|
||||
%{C++
|
||||
|
||||
class nsISelection;
|
||||
typedef short SelectionType;
|
||||
typedef short SelectionRegion;
|
||||
class nsIDOMNode;
|
||||
%}
|
||||
|
||||
|
||||
[scriptable, uuid(D2D1D179-85A7-11d3-9932-00108301233C)]
|
||||
interface nsISelectionController : nsISupports
|
||||
{
|
||||
const short SELECTION_NONE=0;
|
||||
const short SELECTION_NORMAL=1;
|
||||
const short SELECTION_SPELLCHECK=2;
|
||||
const short SELECTION_IME_RAWINPUT=4;
|
||||
const short SELECTION_IME_SELECTEDRAWTEXT=8;
|
||||
const short SELECTION_IME_CONVERTEDTEXT=16;
|
||||
const short SELECTION_IME_SELECTEDCONVERTEDTEXT=32;
|
||||
const short NUM_SELECTIONTYPES=6;
|
||||
|
||||
|
||||
const short SELECTION_ANCHOR_REGION = 0;
|
||||
const short SELECTION_FOCUS_REGION = 1;
|
||||
const short NUM_SELECTION_REGIONS = 2;
|
||||
|
||||
const short SELECTION_OFF = 0;
|
||||
const short SELECTION_HIDDEN =1;//>HIDDEN displays selection
|
||||
const short SELECTION_ON = 2;
|
||||
const short SELECTION_DISABLED = 3;
|
||||
|
||||
/**
|
||||
* SetDisplaySelection will set the display mode for the selection. OFF,ON,DISABLED
|
||||
*/
|
||||
void setDisplaySelection(in short toggle);
|
||||
|
||||
/**
|
||||
* GetDisplaySelection will get the display mode for the selection. OFF,ON,DISABLED
|
||||
*/
|
||||
short getDisplaySelection();
|
||||
|
||||
/**
|
||||
* SetDisplayNonTextSelection used to set whether you want to see HRULES/IMAGES with border.
|
||||
* also used to tell if the presshell is an editor right now. this should change
|
||||
*/
|
||||
void setDisplayNonTextSelection(in boolean toggle);
|
||||
|
||||
/**
|
||||
* GetDisplayNonTextSelection used to get whether you want to see HRULES/IMAGES with border.
|
||||
* also used to tell if the presshell is an editor right now. this should change
|
||||
*/
|
||||
boolean getDisplayNonTextSelection();
|
||||
|
||||
/**
|
||||
* GetSelection will return the selection that the presentation
|
||||
* shell may implement.
|
||||
*
|
||||
* @param aType will hold the type of selection //SelectionType
|
||||
* @param _return will hold the return value
|
||||
*/
|
||||
nsISelection getSelection(in short type);
|
||||
|
||||
/**
|
||||
* ScrollSelectionIntoView scrolls a region of the selection,
|
||||
* so that it is visible in the scrolled view.
|
||||
*
|
||||
* @param aType the selection to scroll into view. //SelectionType
|
||||
* @param aRegion the region inside the selection to scroll into view. //SelectionRegion
|
||||
*/
|
||||
void scrollSelectionIntoView(in short type, in short region);
|
||||
/**
|
||||
* RepaintSelection repaints the selection specified by aType.
|
||||
*
|
||||
* @param aType specifies the selection to repaint.
|
||||
*/
|
||||
void repaintSelection(in short type);
|
||||
|
||||
/**
|
||||
* Set the caret as enabled or disabled. An enabled caret will
|
||||
* draw or blink when made visible. A disabled caret will never show up.
|
||||
* Can be called any time.
|
||||
* @param aEnable PR_TRUE to enable caret. PR_FALSE to disable.
|
||||
* @return always NS_OK
|
||||
*/
|
||||
|
||||
void setCaretEnabled(in boolean enabled);
|
||||
/**
|
||||
* Set the carets width
|
||||
* Can be called any time.
|
||||
* @param pixels, the width of the caret in pixels
|
||||
* @return always NS_OK if successful, NS_ERROR_FAILURE if not.
|
||||
*/
|
||||
void setCaretWidth(in short pixels);
|
||||
|
||||
/**
|
||||
* Set the caret readonly or not. An readonly caret will
|
||||
* draw but not blink when made visible.
|
||||
* @param aReadOnly PR_TRUE to enable caret. PR_FALSE to disable.
|
||||
* @return always NS_OK
|
||||
*/
|
||||
void setCaretReadOnly(in boolean readOnly);
|
||||
|
||||
/**
|
||||
* Gets the current state of the caret.
|
||||
* @param aEnabled [OUT] set to the current caret state, as set by SetCaretEnabled
|
||||
* @return if aOutEnabled==null, returns NS_ERROR_INVALID_ARG
|
||||
* else NS_OK
|
||||
*/
|
||||
boolean getCaretEnabled();
|
||||
|
||||
/** CharacterMove will move the selection one character forward/backward in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
void characterMove(in boolean forward, in boolean extend);
|
||||
|
||||
/** WordMove will move the selection one word forward/backward in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
|
||||
void wordMove(in boolean forward, in boolean extend);
|
||||
|
||||
/** LineMove will move the selection one line forward/backward in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
void lineMove(in boolean forward, in boolean extend);
|
||||
|
||||
/** IntraLineMove will move the selection to the front of the line or end of the line
|
||||
* in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
void intraLineMove(in boolean forward, in boolean extend);
|
||||
|
||||
/** PageMove will move the selection one page forward/backward in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
void pageMove(in boolean forward, in boolean extend);
|
||||
|
||||
/** CompleteScroll will move page view to the top or bottom of the document
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
*/
|
||||
void completeScroll(in boolean forward);
|
||||
|
||||
/** CompleteMove will move page view to the top or bottom of the document
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
void completeMove(in boolean forward, in boolean extend);
|
||||
|
||||
|
||||
/** ScrollPage will scroll the page without affecting the selection.
|
||||
* @param aForward scroll forward or backwards in selection
|
||||
*/
|
||||
void scrollPage(in boolean forward);
|
||||
|
||||
/** ScrolLine will scroll line up or down dependent on the boolean
|
||||
* @param aForward scroll forward or backwards in selection
|
||||
*/
|
||||
void scrollLine(in boolean forward);
|
||||
|
||||
/** ScrolHorizontal will scroll left or right dependent on the boolean
|
||||
* @param aLeft if true will scroll left. if not will scroll right.
|
||||
*/
|
||||
void scrollHorizontal(in boolean left);
|
||||
/** SelectAll will select the whole page
|
||||
*/
|
||||
void selectAll();
|
||||
|
||||
/** CheckVisibility will return true if textnode and offsets are actually rendered
|
||||
* in the current precontext.
|
||||
* @param aNode textNode to test
|
||||
* @param aStartOffset offset in dom to first char of textnode to test
|
||||
* @param aEndOffset offset in dom to last char of textnode to test
|
||||
* @param aReturnBool boolean returned TRUE if visible FALSE if not
|
||||
*/
|
||||
boolean checkVisibility(in nsIDOMNode node, in short startOffset, in short endOffset);
|
||||
|
||||
};
|
||||
%{ C++
|
||||
#define NS_ISELECTIONCONTROLLER_CID \
|
||||
{ 0xd2d1d179, 0x85a7, 0x11d3, \
|
||||
{ 0x99, 0x32, 0x0, 0x10, 0x83, 0x1, 0x23, 0x3c }}
|
||||
%}
|
||||
44
mozilla/layout/base/public/nsISelectionListener.idl
Normal file
44
mozilla/layout/base/public/nsISelectionListener.idl
Normal file
@@ -0,0 +1,44 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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.org 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):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "domstubs.idl"
|
||||
|
||||
%{C++
|
||||
class nsIDOMDocument;
|
||||
%}
|
||||
interface nsISelection;
|
||||
|
||||
[scriptable, uuid(A6CF90E2-15B3-11d2-932E-00805F8ADD32)]
|
||||
interface nsISelectionListener : nsISupports
|
||||
{
|
||||
const short NO_REASON=0;
|
||||
const short DRAG_REASON=1;
|
||||
const short MOUSEDOWN_REASON=2;/*bitflags*/
|
||||
const short MOUSEUP_REASON=4;/*bitflags*/
|
||||
const short KEYPRESS_REASON=8;/*bitflags*/
|
||||
const short SELECTALL_REASON=16;
|
||||
|
||||
void notifySelectionChanged(in nsIDOMDocument doc, in nsISelection sel, in short reason);
|
||||
};
|
||||
|
||||
|
||||
75
mozilla/layout/base/public/nsISelectionPrivate.idl
Normal file
75
mozilla/layout/base/public/nsISelectionPrivate.idl
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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.org 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):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "domstubs.idl"
|
||||
#include "nsISelectionListener.idl"
|
||||
#include "nsIEnumerator.idl"
|
||||
|
||||
%{C++
|
||||
class nsIDOMNode;
|
||||
class nsIDOMRange;
|
||||
class nsISelectionListener;
|
||||
%}
|
||||
|
||||
[scriptable, uuid(2d5535e2-1dd2-11b2-8e38-d53ec833adf6)]
|
||||
interface nsISelectionPrivate : nsISupports
|
||||
{
|
||||
const short ENDOFPRECEDINGLINE=0;
|
||||
const short STARTOFNEXTLINE=1;
|
||||
|
||||
attribute boolean interlinePosition;
|
||||
|
||||
/* startBatchChanges
|
||||
match this up with endbatchChanges. will stop ui updates while multiple selection methods are called
|
||||
*/
|
||||
void startBatchChanges();
|
||||
|
||||
/* endBatchChanges
|
||||
match this up with startBatchChanges
|
||||
*/
|
||||
void endBatchChanges();
|
||||
|
||||
nsIEnumerator getEnumerator();
|
||||
wstring toStringWithFormat(in string formatType, in unsigned long flags, in PRInt32 wrapColumn);
|
||||
void addSelectionListener(in nsISelectionListener newListener);
|
||||
void removeSelectionListener(in nsISelectionListener listenerToRemove);
|
||||
|
||||
/* Table selection stuff
|
||||
We should probably move this and table-related
|
||||
items in nsIFrameSelection to a
|
||||
new nsITableSelection interface
|
||||
*/
|
||||
const long TABLESELECTION_NONE = 0;
|
||||
const long TABLESELECTION_CELL = 1;
|
||||
const long TABLESELECTION_ROW = 2;
|
||||
const long TABLESELECTION_COLUMN = 3;
|
||||
const long TABLESELECTION_TABLE = 4;
|
||||
const long TABLESELECTION_ALLCELLS = 5;
|
||||
|
||||
/** Test if supplied range points to a single table element:
|
||||
* Result is one of above constants. "None" means
|
||||
* a table element isn't selected.
|
||||
*/
|
||||
long getTableSelectionType(in nsIDOMRange range);
|
||||
};
|
||||
|
||||
254
mozilla/layout/base/public/nsISpaceManager.h
Normal file
254
mozilla/layout/base/public/nsISpaceManager.h
Normal file
@@ -0,0 +1,254 @@
|
||||
/* -*- 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.org 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 nsISpaceManager_h___
|
||||
#define nsISpaceManager_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsVoidArray;
|
||||
class nsISizeOfHandler;
|
||||
struct nsSize;
|
||||
|
||||
// IID for the nsISpaceManager interface {17C8FB50-BE96-11d1-80B5-00805F8A274D}
|
||||
#define NS_ISPACEMANAGER_IID \
|
||||
{ 0x17c8fb50, 0xbe96, 0x11d1, \
|
||||
{0x80, 0xb5, 0x0, 0x80, 0x5f, 0x8a, 0x27, 0x4d}}
|
||||
|
||||
/**
|
||||
* Information about a particular trapezoid within a band. The space described
|
||||
* by the trapezoid is in one of three states:
|
||||
* <ul>
|
||||
* <li>available
|
||||
* <li>occupied by one frame
|
||||
* <li>occupied by more than one frame
|
||||
* </ul>
|
||||
*/
|
||||
struct nsBandTrapezoid {
|
||||
enum State {Available, Occupied, OccupiedMultiple};
|
||||
|
||||
nscoord mTopY, mBottomY; // top and bottom y-coordinates
|
||||
nscoord mTopLeftX, mBottomLeftX; // left edge x-coordinates
|
||||
nscoord mTopRightX, mBottomRightX; // right edge x-coordinates
|
||||
State mState; // state of the space
|
||||
union {
|
||||
nsIFrame* mFrame; // single frame occupying the space
|
||||
const nsVoidArray* mFrames; // list of frames occupying the space
|
||||
};
|
||||
|
||||
// Get the height of the trapezoid
|
||||
nscoord GetHeight() const {return mBottomY - mTopY;}
|
||||
|
||||
// Get the bouding rect of the trapezoid
|
||||
void GetRect(nsRect& aRect) const;
|
||||
|
||||
// Set the trapezoid from a rectangle
|
||||
void operator=(const nsRect& aRect);
|
||||
|
||||
/** does a binary compare of this object with aTrap */
|
||||
PRBool Equals(const nsBandTrapezoid aTrap) const;
|
||||
|
||||
/** does a semantic compare only of geometric data in this object and aTrap */
|
||||
PRBool EqualGeometry(const nsBandTrapezoid aTrap) const;
|
||||
|
||||
nsBandTrapezoid() {
|
||||
mTopY = mBottomY = mTopLeftX = mBottomLeftX = mTopRightX = mBottomRightX = 0;
|
||||
mFrame = nsnull;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Structure used for describing the space within a band.
|
||||
* @see #GetBandData()
|
||||
*/
|
||||
struct nsBandData {
|
||||
PRInt32 mCount; // [out] actual number of trapezoids in the band data
|
||||
PRInt32 mSize; // [in] the size of the array (number of trapezoids)
|
||||
nsBandTrapezoid* mTrapezoids; // [out] array of length 'size'
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface for dealing with bands of available space. The space manager defines a coordinate
|
||||
* space with an origin at (0, 0) that grows down and to the right.
|
||||
*
|
||||
* @see nsIRunaround
|
||||
*/
|
||||
class nsISpaceManager : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ISPACEMANAGER_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Get the frame that's associated with the space manager. This frame created
|
||||
* the space manager, and the world coordinate space is relative to this frame.
|
||||
*
|
||||
* You can use QueryInterface() on this frame to get any additional interfaces
|
||||
*/
|
||||
NS_IMETHOD GetFrame(nsIFrame*& aFrame) const = 0;
|
||||
|
||||
/**
|
||||
* Translate the current origin by the specified (dx, dy). This creates a new
|
||||
* local coordinate space relative to the current coordinate space.
|
||||
*/
|
||||
NS_IMETHOD Translate(nscoord aDx, nscoord aDy) = 0;
|
||||
|
||||
/**
|
||||
* Returns the current translation from local coordinate space to world
|
||||
* coordinate space. This represents the accumulated calls to Translate().
|
||||
*/
|
||||
NS_IMETHOD GetTranslation(nscoord& aX, nscoord& aY) const = 0;
|
||||
|
||||
/**
|
||||
* Returns the y-most of the bottommost band or 0 if there are no bands.
|
||||
*
|
||||
* @return NS_OK if there are bands and NS_ERROR_ABORT if there are
|
||||
* no bands
|
||||
*/
|
||||
NS_IMETHOD YMost(nscoord& aYMost) const = 0;
|
||||
|
||||
/**
|
||||
* Returns a band starting at the specified y-offset. The band data indicates
|
||||
* which parts of the band are available, and which parts are unavailable
|
||||
*
|
||||
* The band data that is returned is in the coordinate space of the local
|
||||
* coordinate system.
|
||||
*
|
||||
* The local coordinate space origin, the y-offset, and the max size describe
|
||||
* a rectangle that's used to clip the underlying band of available space, i.e.
|
||||
* {0, aYOffset, aMaxSize.width, aMaxSize.height} in the local coordinate space
|
||||
*
|
||||
* @param aYOffset the y-offset of where the band begins. The coordinate is
|
||||
* relative to the upper-left corner of the local coordinate space
|
||||
* @param aMaxSize the size to use to constrain the band data
|
||||
* @param aBandData [in,out] used to return the list of trapezoids that
|
||||
* describe the available space and the unavailable space
|
||||
* @return NS_OK if successful and NS_ERROR_FAILURE if the band data is not
|
||||
* not large enough. The 'count' member of the band data struct
|
||||
* indicates how large the array of trapezoids needs to be
|
||||
*/
|
||||
NS_IMETHOD GetBandData(nscoord aYOffset,
|
||||
const nsSize& aMaxSize,
|
||||
nsBandData& aBandData) const = 0;
|
||||
|
||||
/**
|
||||
* Add a rectangular region of unavailable space. The space is relative to
|
||||
* the local coordinate system.
|
||||
*
|
||||
* The region is tagged with a frame
|
||||
*
|
||||
* @param aFrame the frame used to identify the region. Must not be NULL
|
||||
* @param aUnavailableSpace the bounding rect of the unavailable space
|
||||
* @return NS_OK if successful
|
||||
* NS_ERROR_FAILURE if there is already a region tagged with aFrame
|
||||
*/
|
||||
NS_IMETHOD AddRectRegion(nsIFrame* aFrame,
|
||||
const nsRect& aUnavailableSpace) = 0;
|
||||
|
||||
/**
|
||||
* Resize the rectangular region associated with aFrame by the specified
|
||||
* deltas. The height change always applies to the bottom edge or the existing
|
||||
* rect. You specify whether the width change applies to the left or right edge
|
||||
*
|
||||
* Returns NS_OK if successful, NS_ERROR_INVALID_ARG if there is no region
|
||||
* tagged with aFrame
|
||||
*/
|
||||
enum AffectedEdge {LeftEdge, RightEdge};
|
||||
NS_IMETHOD ResizeRectRegion(nsIFrame* aFrame,
|
||||
nscoord aDeltaWidth,
|
||||
nscoord aDeltaHeight,
|
||||
AffectedEdge aEdge = RightEdge) = 0;
|
||||
|
||||
/**
|
||||
* Offset the region associated with aFrame by the specified amount.
|
||||
*
|
||||
* Returns NS_OK if successful, NS_ERROR_INVALID_ARG if there is no region
|
||||
* tagged with aFrame
|
||||
*/
|
||||
NS_IMETHOD OffsetRegion(nsIFrame* aFrame, nscoord dx, nscoord dy) = 0;
|
||||
|
||||
/**
|
||||
* Remove the region associated with aFrane.
|
||||
*
|
||||
* Returns NS_OK if successful and NS_ERROR_INVALID_ARG if there is no region
|
||||
* tagged with aFrame
|
||||
*/
|
||||
NS_IMETHOD RemoveRegion(nsIFrame* aFrame) = 0;
|
||||
|
||||
/**
|
||||
* Clears the list of regions representing the unavailable space.
|
||||
*/
|
||||
NS_IMETHOD ClearRegions() = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
/**
|
||||
* Dump the state of the spacemanager out to a file
|
||||
*/
|
||||
NS_IMETHOD List(FILE* out) = 0;
|
||||
|
||||
virtual void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
inline void nsBandTrapezoid::GetRect(nsRect& aRect) const
|
||||
{
|
||||
aRect.x = PR_MIN(mTopLeftX, mBottomLeftX);
|
||||
aRect.y = mTopY;
|
||||
aRect.width = PR_MAX(mTopRightX, mBottomRightX) - aRect.x;
|
||||
aRect.height = mBottomY - mTopY;
|
||||
}
|
||||
|
||||
inline void nsBandTrapezoid::operator=(const nsRect& aRect)
|
||||
{
|
||||
mTopLeftX = mBottomLeftX = aRect.x;
|
||||
mTopRightX = mBottomRightX = aRect.XMost();
|
||||
mTopY = aRect.y;
|
||||
mBottomY = aRect.YMost();
|
||||
}
|
||||
|
||||
inline PRBool nsBandTrapezoid::Equals(const nsBandTrapezoid aTrap) const
|
||||
{
|
||||
return (
|
||||
mTopLeftX == aTrap.mTopLeftX &&
|
||||
mBottomLeftX == aTrap.mBottomLeftX &&
|
||||
mTopRightX == aTrap.mTopRightX &&
|
||||
mBottomRightX == aTrap.mBottomRightX &&
|
||||
mTopY == aTrap.mTopY &&
|
||||
mBottomY == aTrap.mBottomY &&
|
||||
mState == aTrap.mState &&
|
||||
mFrame == aTrap.mFrame
|
||||
);
|
||||
}
|
||||
|
||||
inline PRBool nsBandTrapezoid::EqualGeometry(const nsBandTrapezoid aTrap) const
|
||||
{
|
||||
return (
|
||||
mTopLeftX == aTrap.mTopLeftX &&
|
||||
mBottomLeftX == aTrap.mBottomLeftX &&
|
||||
mTopRightX == aTrap.mTopRightX &&
|
||||
mBottomRightX == aTrap.mBottomRightX &&
|
||||
mTopY == aTrap.mTopY &&
|
||||
mBottomY == aTrap.mBottomY
|
||||
);
|
||||
}
|
||||
|
||||
#endif /* nsISpaceManager_h___ */
|
||||
38
mozilla/layout/base/public/nsIStatefulFrame.h
Normal file
38
mozilla/layout/base/public/nsIStatefulFrame.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef _nsIStatefulFrame_h
|
||||
#define _nsIStatefulFrame_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIPresContext;
|
||||
class nsIPresState;
|
||||
|
||||
#define NS_ISTATEFULFRAME_IID_STR "306c8ca0-5f0c-11d3-a9fb-000064657374"
|
||||
|
||||
#define NS_ISTATEFULFRAME_IID \
|
||||
{0x306c8ca0, 0x5f0c, 0x11d3, \
|
||||
{0xa9, 0xfb, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
|
||||
|
||||
class nsIStatefulFrame : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTATEFULFRAME_IID)
|
||||
|
||||
// If you implement nsIStatefulFrame, add an entry to this enum and use it
|
||||
// in your GetStateType method to prevent collisions.
|
||||
enum StateType {eNoType=-1, eCheckboxType, eFileType, eRadioType, eSelectType,
|
||||
eTextType, eScrollType, eNumStateTypes};
|
||||
|
||||
// If you create a special type stateful frame (e.g. scroll) that needs
|
||||
// to be captured outside of the standard pass through the frames, you'll need
|
||||
// a special ID by which to refer to that type.
|
||||
//
|
||||
// There is space reserved between standard ID's and special ID's by the
|
||||
// offset NS_CONTENT_ID_COUNTER_BASE
|
||||
enum SpecialStateID {eNoID=0, eDocumentScrollState};
|
||||
|
||||
|
||||
NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType) = 0;
|
||||
NS_IMETHOD SaveState(nsIPresContext* aPresContext, nsIPresState** aState) = 0;
|
||||
NS_IMETHOD RestoreState(nsIPresContext* aPresContext, nsIPresState* aState) = 0;
|
||||
};
|
||||
|
||||
#endif /* _nsIStatefulFrame_h */
|
||||
921
mozilla/layout/base/public/nsIStyleContext.h
Normal file
921
mozilla/layout/base/public/nsIStyleContext.h
Normal file
@@ -0,0 +1,921 @@
|
||||
/* -*- 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.org 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 nsIStyleContext_h___
|
||||
#define nsIStyleContext_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsMargin.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsFont.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsStyleCoord.h"
|
||||
#include "nsStyleStruct.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIStyleSet.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsILanguageAtom.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
class nsISizeOfHandler;
|
||||
|
||||
class nsIFrame;
|
||||
class nsIPresContext;
|
||||
class nsISupportsArray;
|
||||
class nsIStyleContext;
|
||||
|
||||
|
||||
inline void CalcSidesFor(const nsIFrame* aFrame, const nsStyleSides& aSides,
|
||||
PRUint8 aSpacing,
|
||||
const nscoord* aEnumTable, PRInt32 aNumEnums,
|
||||
nsMargin& aResult);
|
||||
|
||||
|
||||
#define SHARE_STYLECONTEXTS
|
||||
|
||||
// The lifetime of these objects is managed by the nsIStyleContext.
|
||||
|
||||
struct nsStyleFont : public nsStyleStruct {
|
||||
nsStyleFont(void)
|
||||
: mFont(nsnull, NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
|
||||
NS_FONT_WEIGHT_NORMAL, NS_FONT_DECORATION_NONE, 0),
|
||||
mFixedFont(nsnull, NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
|
||||
NS_FONT_WEIGHT_NORMAL, NS_FONT_DECORATION_NONE, 0)
|
||||
{}
|
||||
~nsStyleFont(void) {};
|
||||
|
||||
nsFont mFont; // [inherited]
|
||||
nsFont mFixedFont; // [inherited]
|
||||
PRUint8 mFlags; // [inherited] See nsStyleConsts.h
|
||||
|
||||
protected:
|
||||
nsStyleFont(const nsFont& aVariableFont, const nsFont& aFixedFont);
|
||||
nsStyleFont(nsIPresContext* aPresContext);
|
||||
};
|
||||
|
||||
struct nsStyleColor : public nsStyleStruct {
|
||||
nsStyleColor(void) {}
|
||||
~nsStyleColor(void) {}
|
||||
|
||||
nscolor mColor; // [inherited]
|
||||
|
||||
PRUint8 mBackgroundAttachment; // [reset] See nsStyleConsts.h
|
||||
PRUint8 mBackgroundFlags; // [reset] See nsStyleConsts.h
|
||||
PRUint8 mBackgroundRepeat; // [reset] See nsStyleConsts.h
|
||||
|
||||
nscolor mBackgroundColor; // [reset]
|
||||
nscoord mBackgroundXPosition; // [reset]
|
||||
nscoord mBackgroundYPosition; // [reset]
|
||||
nsString mBackgroundImage; // [reset] absolute url string
|
||||
|
||||
PRUint8 mCursor; // [reset] See nsStyleConsts.h NS_STYLE_CURSOR_*
|
||||
nsString mCursorImage; // [reset] url string
|
||||
float mOpacity; // [inherited] percentage
|
||||
|
||||
PRBool BackgroundIsTransparent() const {return (mBackgroundFlags &
|
||||
(NS_STYLE_BG_COLOR_TRANSPARENT | NS_STYLE_BG_IMAGE_NONE)) ==
|
||||
(NS_STYLE_BG_COLOR_TRANSPARENT | NS_STYLE_BG_IMAGE_NONE);}
|
||||
};
|
||||
|
||||
|
||||
#define BORDER_COLOR_DEFINED 0x80
|
||||
#define BORDER_COLOR_SPECIAL 0x40
|
||||
#define BORDER_STYLE_MASK 0x3F
|
||||
|
||||
#define NS_SPACING_MARGIN 0
|
||||
#define NS_SPACING_PADDING 1
|
||||
#define NS_SPACING_BORDER 2
|
||||
|
||||
|
||||
struct nsStyleMargin: public nsStyleStruct {
|
||||
nsStyleMargin(void) {};
|
||||
~nsStyleMargin(void) {};
|
||||
|
||||
nsStyleSides mMargin; // [reset] length, percent, auto, inherit
|
||||
|
||||
PRBool GetMargin(nsMargin& aMargin) const
|
||||
{
|
||||
if (mHasCachedMargin) {
|
||||
aMargin = mCachedMargin;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// XXX this is a deprecated method
|
||||
void CalcMarginFor(const nsIFrame* aFrame, nsMargin& aMargin) const
|
||||
{
|
||||
if (mHasCachedMargin) {
|
||||
aMargin = mCachedMargin;
|
||||
} else {
|
||||
CalcSidesFor(aFrame, mMargin, NS_SPACING_MARGIN, nsnull, 0, aMargin);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
PRPackedBool mHasCachedMargin;
|
||||
nsMargin mCachedMargin;
|
||||
};
|
||||
|
||||
|
||||
struct nsStylePadding: public nsStyleStruct {
|
||||
nsStylePadding(void) {};
|
||||
~nsStylePadding(void) {};
|
||||
|
||||
nsStyleSides mPadding; // [reset] length, percent, inherit
|
||||
|
||||
PRBool GetPadding(nsMargin& aPadding) const
|
||||
{
|
||||
if (mHasCachedPadding) {
|
||||
aPadding = mCachedPadding;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// XXX this is a deprecated method
|
||||
void CalcPaddingFor(const nsIFrame* aFrame, nsMargin& aPadding) const
|
||||
{
|
||||
if (mHasCachedPadding) {
|
||||
aPadding = mCachedPadding;
|
||||
} else {
|
||||
CalcSidesFor(aFrame, mPadding, NS_SPACING_PADDING, nsnull, 0, aPadding);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
PRPackedBool mHasCachedPadding;
|
||||
nsMargin mCachedPadding;
|
||||
};
|
||||
|
||||
|
||||
struct nsStyleBorder: public nsStyleStruct {
|
||||
nsStyleBorder(void) {};
|
||||
~nsStyleBorder(void) {};
|
||||
|
||||
nsStyleSides mBorder; // [reset] length, enum (see nsStyleConsts.h)
|
||||
nsStyleSides mBorderRadius; // [reset] length, percent, inherit
|
||||
PRUint8 mFloatEdge; // [reset] see nsStyleConsts.h
|
||||
|
||||
PRBool GetBorder(nsMargin& aBorder) const
|
||||
{
|
||||
if (mHasCachedBorder) {
|
||||
aBorder = mCachedBorder;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRUint8 GetBorderStyle(PRUint8 aSide) const
|
||||
{
|
||||
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
||||
return (mBorderStyle[aSide] & BORDER_STYLE_MASK);
|
||||
}
|
||||
|
||||
void SetBorderStyle(PRUint8 aSide, PRUint8 aStyle)
|
||||
{
|
||||
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
||||
mBorderStyle[aSide] &= ~BORDER_STYLE_MASK;
|
||||
mBorderStyle[aSide] |= (aStyle & BORDER_STYLE_MASK);
|
||||
|
||||
}
|
||||
|
||||
// PR_FALSE means TRANSPARENT
|
||||
PRBool GetBorderColor(PRUint8 aSide, nscolor& aColor) const
|
||||
{
|
||||
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
||||
if ((mBorderStyle[aSide] & BORDER_COLOR_SPECIAL) == 0) {
|
||||
aColor = mBorderColor[aSide];
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void SetBorderColor(PRUint8 aSide, nscolor aColor)
|
||||
{
|
||||
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
||||
mBorderColor[aSide] = aColor;
|
||||
mBorderStyle[aSide] &= ~BORDER_COLOR_SPECIAL;
|
||||
mBorderStyle[aSide] |= BORDER_COLOR_DEFINED;
|
||||
}
|
||||
|
||||
void SetBorderTransparent(PRUint8 aSide)
|
||||
{
|
||||
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
||||
mBorderStyle[aSide] |= (BORDER_COLOR_DEFINED | BORDER_COLOR_SPECIAL);
|
||||
}
|
||||
|
||||
void UnsetBorderColor(PRUint8 aSide)
|
||||
{
|
||||
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
||||
mBorderStyle[aSide] &= BORDER_STYLE_MASK;
|
||||
}
|
||||
|
||||
// XXX these are deprecated methods
|
||||
void CalcBorderFor(const nsIFrame* aFrame, nsMargin& aBorder) const
|
||||
{
|
||||
if (mHasCachedBorder) {
|
||||
aBorder = mCachedBorder;
|
||||
} else {
|
||||
CalcSidesFor(aFrame, mBorder, NS_SPACING_BORDER, mBorderWidths, 3, aBorder);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
PRPackedBool mHasCachedBorder;
|
||||
nsMargin mCachedBorder;
|
||||
|
||||
PRUint8 mBorderStyle[4]; // [reset] See nsStyleConsts.h
|
||||
nscolor mBorderColor[4]; // [reset]
|
||||
|
||||
// XXX remove with deprecated methods
|
||||
nscoord mBorderWidths[3];
|
||||
};
|
||||
|
||||
|
||||
struct nsStyleBorderPadding: public nsStyleStruct {
|
||||
nsStyleBorderPadding(void) { mHasCachedBorderPadding = PR_FALSE; };
|
||||
~nsStyleBorderPadding(void) {};
|
||||
|
||||
PRBool GetBorderPadding(nsMargin& aBorderPadding) const {
|
||||
if (mHasCachedBorderPadding) {
|
||||
aBorderPadding = mCachedBorderPadding;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void SetBorderPadding(nsMargin aBorderPadding) {
|
||||
mCachedBorderPadding = aBorderPadding;
|
||||
mHasCachedBorderPadding = PR_TRUE;
|
||||
}
|
||||
|
||||
protected:
|
||||
nsMargin mCachedBorderPadding;
|
||||
PRPackedBool mHasCachedBorderPadding;
|
||||
};
|
||||
|
||||
|
||||
struct nsStyleOutline: public nsStyleStruct {
|
||||
nsStyleOutline(void) {};
|
||||
~nsStyleOutline(void) {};
|
||||
|
||||
nsStyleSides mOutlineRadius; // [reset] length, percent, inherit
|
||||
// (top=topLeft, right=topRight, bottom=bottomRight, left=bottomLeft)
|
||||
|
||||
nsStyleCoord mOutlineWidth; // [reset] length, enum (see nsStyleConsts.h)
|
||||
|
||||
PRBool GetOutlineWidth(nscoord& aWidth) const
|
||||
{
|
||||
if (mHasCachedOutline) {
|
||||
aWidth = mCachedOutlineWidth;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRUint8 GetOutlineStyle(void) const
|
||||
{
|
||||
return (mOutlineStyle & BORDER_STYLE_MASK);
|
||||
}
|
||||
|
||||
void SetOutlineStyle(PRUint8 aStyle)
|
||||
{
|
||||
mOutlineStyle &= ~BORDER_STYLE_MASK;
|
||||
mOutlineStyle |= (aStyle & BORDER_STYLE_MASK);
|
||||
}
|
||||
|
||||
// PR_FALSE means INVERT
|
||||
PRBool GetOutlineColor(nscolor& aColor) const
|
||||
{
|
||||
if ((mOutlineStyle & BORDER_COLOR_SPECIAL) == 0) {
|
||||
aColor = mOutlineColor;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void SetOutlineColor(nscolor aColor)
|
||||
{
|
||||
mOutlineColor = aColor;
|
||||
mOutlineStyle &= ~BORDER_COLOR_SPECIAL;
|
||||
mOutlineStyle |= BORDER_COLOR_DEFINED;
|
||||
}
|
||||
|
||||
void SetOutlineInvert(void)
|
||||
{
|
||||
mOutlineStyle |= (BORDER_COLOR_DEFINED | BORDER_COLOR_SPECIAL);
|
||||
}
|
||||
|
||||
protected:
|
||||
PRPackedBool mHasCachedOutline;
|
||||
nscoord mCachedOutlineWidth;
|
||||
|
||||
PRUint8 mOutlineStyle; // [reset] See nsStyleConsts.h
|
||||
nscolor mOutlineColor; // [reset]
|
||||
|
||||
// XXX remove with deprecated methods
|
||||
nscoord mBorderWidths[3];
|
||||
};
|
||||
|
||||
|
||||
struct nsStyleList : public nsStyleStruct {
|
||||
nsStyleList(void);
|
||||
~nsStyleList(void);
|
||||
|
||||
PRUint8 mListStyleType; // [inherited] See nsStyleConsts.h
|
||||
PRUint8 mListStylePosition; // [inherited]
|
||||
nsString mListStyleImage; // [inherited] absolute url string
|
||||
};
|
||||
|
||||
struct nsStylePosition : public nsStyleStruct {
|
||||
nsStylePosition(void);
|
||||
~nsStylePosition(void);
|
||||
|
||||
PRUint8 mPosition; // [reset] see nsStyleConsts.h
|
||||
|
||||
nsStyleSides mOffset; // [reset]
|
||||
nsStyleCoord mWidth; // [reset] coord, percent, auto, inherit
|
||||
nsStyleCoord mMinWidth; // [reset] coord, percent, inherit
|
||||
nsStyleCoord mMaxWidth; // [reset] coord, percent, null, inherit
|
||||
nsStyleCoord mHeight; // [reset] coord, percent, auto, inherit
|
||||
nsStyleCoord mMinHeight; // [reset] coord, percent, inherit
|
||||
nsStyleCoord mMaxHeight; // [reset] coord, percent, null, inherit
|
||||
PRUint8 mBoxSizing; // [reset] see nsStyleConsts.h
|
||||
|
||||
nsStyleCoord mZIndex; // [reset]
|
||||
|
||||
PRBool IsAbsolutelyPositioned() const {return (NS_STYLE_POSITION_ABSOLUTE == mPosition) ||
|
||||
(NS_STYLE_POSITION_FIXED == mPosition);}
|
||||
|
||||
PRBool IsPositioned() const {return IsAbsolutelyPositioned() ||
|
||||
(NS_STYLE_POSITION_RELATIVE == mPosition);}
|
||||
};
|
||||
|
||||
struct nsStyleText : public nsStyleStruct {
|
||||
nsStyleText(void);
|
||||
~nsStyleText(void);
|
||||
|
||||
PRUint8 mTextAlign; // [inherited] see nsStyleConsts.h
|
||||
PRUint8 mTextDecoration; // [reset] see nsStyleConsts.h
|
||||
PRUint8 mTextTransform; // [inherited] see nsStyleConsts.h
|
||||
PRUint8 mWhiteSpace; // [inherited] see nsStyleConsts.h
|
||||
|
||||
nsStyleCoord mLetterSpacing; // [inherited]
|
||||
nsStyleCoord mLineHeight; // [inherited]
|
||||
nsStyleCoord mTextIndent; // [inherited]
|
||||
nsStyleCoord mWordSpacing; // [inherited]
|
||||
nsStyleCoord mVerticalAlign; // [reset] see nsStyleConsts.h for enums
|
||||
|
||||
PRBool WhiteSpaceIsSignificant() const {
|
||||
return mWhiteSpace == NS_STYLE_WHITESPACE_PRE;
|
||||
}
|
||||
};
|
||||
|
||||
struct nsStyleDisplay : public nsStyleStruct {
|
||||
nsStyleDisplay(void) {};
|
||||
~nsStyleDisplay(void) {};
|
||||
|
||||
PRUint8 mDirection; // [inherited] see nsStyleConsts.h NS_STYLE_DIRECTION_*
|
||||
PRUint8 mDisplay; // [reset] see nsStyleConsts.h NS_STYLE_DISPLAY_*
|
||||
PRUint8 mFloats; // [reset] see nsStyleConsts.h NS_STYLE_FLOAT_*
|
||||
PRUint8 mBreakType; // [reset] see nsStyleConsts.h NS_STYLE_CLEAR_*
|
||||
PRPackedBool mBreakBefore; // [reset]
|
||||
PRPackedBool mBreakAfter; // [reset]
|
||||
PRUint8 mVisible; // [inherited]
|
||||
PRUint8 mOverflow; // [reset] see nsStyleConsts.h
|
||||
|
||||
PRUint8 mClipFlags; // [reset] see nsStyleConsts.h
|
||||
#if 0
|
||||
// XXX This is how it is defined in the CSS2 spec, but the errata
|
||||
// changed it to be consistent with the positioning draft and how
|
||||
// Nav and IE implement it
|
||||
nsMargin mClip; // [reset] offsets from respective edge
|
||||
#else
|
||||
nsRect mClip; // [reset] offsets from upper-left border edge
|
||||
#endif
|
||||
nsCOMPtr<nsILanguageAtom> mLanguage; // [inherited]
|
||||
|
||||
PRBool IsBlockLevel() const {return (NS_STYLE_DISPLAY_BLOCK == mDisplay) ||
|
||||
(NS_STYLE_DISPLAY_LIST_ITEM == mDisplay) ||
|
||||
(NS_STYLE_DISPLAY_TABLE == mDisplay);}
|
||||
|
||||
PRBool IsFloating() const {
|
||||
return NS_STYLE_FLOAT_NONE != mFloats;
|
||||
}
|
||||
|
||||
PRBool IsVisible() const {
|
||||
return (mVisible == NS_STYLE_VISIBILITY_VISIBLE);
|
||||
}
|
||||
|
||||
PRBool IsVisibleOrCollapsed() const {
|
||||
return ((mVisible == NS_STYLE_VISIBILITY_VISIBLE) ||
|
||||
(mVisible == NS_STYLE_VISIBILITY_COLLAPSE));
|
||||
}
|
||||
};
|
||||
|
||||
struct nsStyleTable: public nsStyleStruct {
|
||||
nsStyleTable(void);
|
||||
~nsStyleTable(void);
|
||||
|
||||
PRUint8 mLayoutStrategy;// [reset] see nsStyleConsts.h NS_STYLE_TABLE_LAYOUT_*
|
||||
PRUint8 mFrame; // [reset] see nsStyleConsts.h NS_STYLE_TABLE_FRAME_*
|
||||
PRUint8 mRules; // [reset] see nsStyleConsts.h NS_STYLE_TABLE_RULES_*
|
||||
PRUint8 mBorderCollapse;// [inherited]
|
||||
nsStyleCoord mBorderSpacingX;// [inherited]
|
||||
nsStyleCoord mBorderSpacingY;// [inherited]
|
||||
nsStyleCoord mCellPadding; // [reset]
|
||||
PRUint8 mCaptionSide; // [inherited]
|
||||
PRUint8 mEmptyCells; // [inherited]
|
||||
PRInt32 mCols; // [reset] an integer if set, or see nsStyleConsts.h NS_STYLE_TABLE_COLS_*
|
||||
PRInt32 mSpan; // [reset] the number of columns spanned by a colgroup or col
|
||||
nsStyleCoord mSpanWidth; // [reset] the amount of width this col gets from a spanning cell, if any
|
||||
};
|
||||
|
||||
enum nsStyleContentType {
|
||||
eStyleContentType_String = 1,
|
||||
eStyleContentType_URL = 10,
|
||||
eStyleContentType_Attr = 20,
|
||||
eStyleContentType_Counter = 30,
|
||||
eStyleContentType_Counters = 31,
|
||||
eStyleContentType_OpenQuote = 40,
|
||||
eStyleContentType_CloseQuote = 41,
|
||||
eStyleContentType_NoOpenQuote = 42,
|
||||
eStyleContentType_NoCloseQuote = 43
|
||||
};
|
||||
|
||||
struct nsStyleContentData {
|
||||
nsStyleContentType mType;
|
||||
nsString mContent;
|
||||
};
|
||||
|
||||
struct nsStyleCounterData {
|
||||
nsString mCounter;
|
||||
PRInt32 mValue;
|
||||
};
|
||||
|
||||
|
||||
#define DELETE_ARRAY_IF(array) if (array) { delete[] array; array = nsnull; }
|
||||
|
||||
struct nsStyleContent: public nsStyleStruct {
|
||||
nsStyleContent(void);
|
||||
~nsStyleContent(void);
|
||||
|
||||
PRUint32 ContentCount(void) const { return mContentCount; } // [reset]
|
||||
nsresult GetContentAt(PRUint32 aIndex, nsStyleContentType& aType, nsString& aContent) const {
|
||||
if (aIndex < mContentCount) {
|
||||
aType = mContents[aIndex].mType;
|
||||
aContent = mContents[aIndex].mContent;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
nsresult AllocateContents(PRUint32 aCount) {
|
||||
if (aCount != mContentCount) {
|
||||
DELETE_ARRAY_IF(mContents);
|
||||
if (aCount) {
|
||||
mContents = new nsStyleContentData[aCount];
|
||||
if (! mContents) {
|
||||
mContentCount = 0;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
mContentCount = aCount;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult SetContentAt(PRUint32 aIndex, nsStyleContentType aType, const nsString& aContent) {
|
||||
if (aIndex < mContentCount) {
|
||||
mContents[aIndex].mType = aType;
|
||||
if (aType < eStyleContentType_OpenQuote) {
|
||||
mContents[aIndex].mContent = aContent;
|
||||
}
|
||||
else {
|
||||
mContents[aIndex].mContent.Truncate();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
PRUint32 CounterIncrementCount(void) const { return mIncrementCount; } // [reset]
|
||||
nsresult GetCounterIncrementAt(PRUint32 aIndex, nsString& aCounter, PRInt32& aIncrement) const {
|
||||
if (aIndex < mIncrementCount) {
|
||||
aCounter = mIncrements[aIndex].mCounter;
|
||||
aIncrement = mIncrements[aIndex].mValue;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
nsresult AllocateCounterIncrements(PRUint32 aCount) {
|
||||
if (aCount != mIncrementCount) {
|
||||
DELETE_ARRAY_IF(mIncrements);
|
||||
if (aCount) {
|
||||
mIncrements = new nsStyleCounterData[aCount];
|
||||
if (! mIncrements) {
|
||||
mIncrementCount = 0;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
mIncrementCount = aCount;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult SetCounterIncrementAt(PRUint32 aIndex, const nsString& aCounter, PRInt32 aIncrement) {
|
||||
if (aIndex < mIncrementCount) {
|
||||
mIncrements[aIndex].mCounter = aCounter;
|
||||
mIncrements[aIndex].mValue = aIncrement;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
PRUint32 CounterResetCount(void) const { return mResetCount; } // [reset]
|
||||
nsresult GetCounterResetAt(PRUint32 aIndex, nsString& aCounter, PRInt32& aValue) const {
|
||||
if (aIndex < mResetCount) {
|
||||
aCounter = mResets[aIndex].mCounter;
|
||||
aValue = mResets[aIndex].mValue;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
nsresult AllocateCounterResets(PRUint32 aCount) {
|
||||
if (aCount != mResetCount) {
|
||||
DELETE_ARRAY_IF(mResets);
|
||||
if (aCount) {
|
||||
mResets = new nsStyleCounterData[aCount];
|
||||
if (! mResets) {
|
||||
mResetCount = 0;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
mResetCount = aCount;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult SetCounterResetAt(PRUint32 aIndex, const nsString& aCounter, PRInt32 aValue) {
|
||||
if (aIndex < mResetCount) {
|
||||
mResets[aIndex].mCounter = aCounter;
|
||||
mResets[aIndex].mValue = aValue;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
nsStyleCoord mMarkerOffset; // [reset]
|
||||
|
||||
PRUint32 QuotesCount(void) const { return mQuotesCount; } // [inherited]
|
||||
nsresult GetQuotesAt(PRUint32 aIndex, nsString& aOpen, nsString& aClose) const {
|
||||
if (aIndex < mQuotesCount) {
|
||||
aIndex *= 2;
|
||||
aOpen = mQuotes[aIndex];
|
||||
aClose = mQuotes[++aIndex];
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
nsresult AllocateQuotes(PRUint32 aCount) {
|
||||
if (aCount != mQuotesCount) {
|
||||
DELETE_ARRAY_IF(mQuotes);
|
||||
if (aCount) {
|
||||
mQuotes = new nsString[aCount * 2];
|
||||
if (! mQuotes) {
|
||||
mQuotesCount = 0;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
mQuotesCount = aCount;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult SetQuotesAt(PRUint32 aIndex, const nsString& aOpen, const nsString& aClose) {
|
||||
if (aIndex < mQuotesCount) {
|
||||
aIndex *= 2;
|
||||
mQuotes[aIndex] = aOpen;
|
||||
mQuotes[++aIndex] = aClose;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
protected:
|
||||
PRUint32 mContentCount;
|
||||
nsStyleContentData* mContents;
|
||||
|
||||
PRUint32 mIncrementCount;
|
||||
nsStyleCounterData* mIncrements;
|
||||
|
||||
PRUint32 mResetCount;
|
||||
nsStyleCounterData* mResets;
|
||||
|
||||
PRUint32 mQuotesCount;
|
||||
nsString* mQuotes;
|
||||
};
|
||||
|
||||
struct nsStyleUserInterface: public nsStyleStruct {
|
||||
nsStyleUserInterface(void);
|
||||
~nsStyleUserInterface(void);
|
||||
|
||||
PRUint8 mUserInput; // [inherited]
|
||||
PRUint8 mUserModify; // [inherited] (modify-content)
|
||||
PRUint8 mUserSelect; // [reset] (selection-style)
|
||||
PRUint8 mUserFocus; // [inherited] (auto-select)
|
||||
PRUnichar mKeyEquivalent; // [reset] XXX what type should this be?
|
||||
PRUint8 mResizer; // [reset]
|
||||
nsString mBehavior; // [reset] absolute url string
|
||||
|
||||
};
|
||||
|
||||
struct nsStylePrint: public nsStyleStruct {
|
||||
nsStylePrint(void);
|
||||
~nsStylePrint(void);
|
||||
|
||||
PRUint8 mPageBreakBefore; // [reset] see nsStyleConsts.h NS_STYLE_PAGE_BREAK_*
|
||||
PRUint8 mPageBreakAfter; // [reset] see nsStyleConsts.h NS_STYLE_PAGE_BREAK_*
|
||||
PRUint8 mPageBreakInside; // [reset] see nsStyleConsts.h NS_STYLE_PAGE_BREAK_*
|
||||
nsString mPage;
|
||||
PRUint32 mWidows; // [reset] = 2, number of isolated lines at the top of a page
|
||||
PRUint32 mOrphans; // [reset] = 2, number of isolated lines at the bottom of a page
|
||||
PRUint8 mMarks; // [reset] see nsStyleConsts.h NS_STYLE_PAGE_MARKS_*
|
||||
nsStyleCoord mSizeWidth; // [reset] length, enum: see nsStyleConsts.h NS_STYLE_PAGE_SIZE_*
|
||||
nsStyleCoord mSizeHeight; // [reset] length, enum: see nsStyleConsts.h NS_STYLE_PAGE_SIZE_*
|
||||
};
|
||||
|
||||
#define BORDER_PRECEDENT_EQUAL 0
|
||||
#define BORDER_PRECEDENT_LOWER 1
|
||||
#define BORDER_PRECEDENT_HIGHER 2
|
||||
|
||||
struct nsBorderEdges;
|
||||
|
||||
/** an encapsulation of border edge info */
|
||||
struct nsBorderEdge
|
||||
{
|
||||
/** the thickness of the edge */
|
||||
nscoord mWidth;
|
||||
/** the length of the edge */
|
||||
nscoord mLength;
|
||||
PRUint8 mStyle;
|
||||
nscolor mColor;
|
||||
/** which side does this edge represent? */
|
||||
PRUint8 mSide;
|
||||
/** if this edge is an outside edge, the border infor for the adjacent inside object */
|
||||
nsBorderEdges * mInsideNeighbor;
|
||||
|
||||
nsBorderEdge();
|
||||
};
|
||||
|
||||
inline nsBorderEdge::nsBorderEdge()
|
||||
{
|
||||
mWidth=0;
|
||||
mLength=0;
|
||||
mStyle=NS_STYLE_BORDER_STYLE_NONE;
|
||||
mColor=0;
|
||||
mSide=NS_SIDE_LEFT;
|
||||
mInsideNeighbor = nsnull;
|
||||
};
|
||||
|
||||
/** an encapsulation of a border defined by its edges
|
||||
* owner of this struct is responsible for freeing any data stored in mEdges
|
||||
*/
|
||||
struct nsBorderEdges
|
||||
{
|
||||
nsVoidArray mEdges[4];
|
||||
nsMargin mMaxBorderWidth;
|
||||
PRPackedBool mOutsideEdge;
|
||||
|
||||
nsBorderEdges();
|
||||
};
|
||||
|
||||
inline nsBorderEdges::nsBorderEdges()
|
||||
{
|
||||
mMaxBorderWidth.SizeTo(0,0,0,0);
|
||||
mOutsideEdge = PR_TRUE;
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#define NS_ISTYLECONTEXT_IID \
|
||||
{ 0x26a4d970, 0xa342, 0x11d1, \
|
||||
{0x89, 0x74, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
|
||||
|
||||
class nsIStyleContext : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ISTYLECONTEXT_IID; return iid; }
|
||||
|
||||
virtual PRBool Equals(const nsIStyleContext* aOther) const = 0;
|
||||
virtual PRUint32 HashValue(void) const = 0;
|
||||
|
||||
virtual nsIStyleContext* GetParent(void) const = 0;
|
||||
virtual nsISupportsArray* GetStyleRules(void) const = 0;
|
||||
virtual PRInt32 GetStyleRuleCount(void) const = 0;
|
||||
NS_IMETHOD GetPseudoType(nsIAtom*& aPseudoTag) const = 0;
|
||||
|
||||
NS_IMETHOD FindChildWithRules(const nsIAtom* aPseudoTag,
|
||||
nsISupportsArray* aRules,
|
||||
nsIStyleContext*& aResult) = 0;
|
||||
|
||||
// Fill a style struct with data
|
||||
NS_IMETHOD GetStyle(nsStyleStructID aSID, nsStyleStruct& aStruct) const = 0;
|
||||
|
||||
// compute the effective difference between two contexts
|
||||
NS_IMETHOD CalcStyleDifference(nsIStyleContext* aOther, PRInt32& aHint, PRBool aStopAtFirst = PR_FALSE) const = 0;
|
||||
|
||||
// debugging
|
||||
virtual void List(FILE* out, PRInt32 aIndent) = 0;
|
||||
|
||||
virtual void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize) = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
virtual void DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) = 0;
|
||||
#endif
|
||||
|
||||
#ifdef SHARE_STYLECONTEXTS
|
||||
// sets aMatches to PR_TRUE if the style data of aStyleContextToMatch matches the
|
||||
// style data of this, PR_FALSE otherwise
|
||||
NS_IMETHOD StyleDataMatches(nsIStyleContext* aStyleContextToMatch, PRBool *aMatches) = 0;
|
||||
NS_IMETHOD GetStyleContextKey(scKey &aKey) const = 0;
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// DEPRECATED METHODS - these are all going away, stop using them
|
||||
// get a style data struct by ID, may return null
|
||||
// Replace calls to this with calls to GetStyle();
|
||||
virtual const nsStyleStruct* GetStyleData(nsStyleStructID aSID) = 0;
|
||||
|
||||
// get a style data struct by ID, may return null
|
||||
virtual nsStyleStruct* GetMutableStyleData(nsStyleStructID aSID) = 0;
|
||||
|
||||
// call this to prevent context from getting shared
|
||||
virtual void ForceUnique(void) = 0;
|
||||
|
||||
NS_IMETHOD RemapStyle(nsIPresContext* aPresContext, PRBool aRecurse = PR_TRUE) = 0;
|
||||
|
||||
// call if you change style data after creation
|
||||
virtual void RecalcAutomaticData(nsIPresContext* aPresContext) = 0;
|
||||
|
||||
// utility function: more convenient than 2 calls to GetStyleData to get border and padding
|
||||
virtual void CalcBorderPaddingFor(const nsIFrame* aFrame, nsMargin& aBorderPadding) const = 0;
|
||||
};
|
||||
|
||||
|
||||
// XXX this is here to support deprecated calc spacing methods only
|
||||
inline nscoord CalcSideFor(const nsIFrame* aFrame, const nsStyleCoord& aCoord,
|
||||
PRUint8 aSpacing, PRUint8 aSide,
|
||||
const nscoord* aEnumTable, PRInt32 aNumEnums)
|
||||
{
|
||||
nscoord result = 0;
|
||||
|
||||
switch (aCoord.GetUnit()) {
|
||||
case eStyleUnit_Auto:
|
||||
// Auto margins are handled by layout
|
||||
break;
|
||||
|
||||
case eStyleUnit_Inherit:
|
||||
nsIFrame* parentFrame;
|
||||
aFrame->GetParent(&parentFrame); // XXX may not be direct parent...
|
||||
if (nsnull != parentFrame) {
|
||||
nsIStyleContext* parentContext;
|
||||
parentFrame->GetStyleContext(&parentContext);
|
||||
if (nsnull != parentContext) {
|
||||
nsMargin parentSpacing;
|
||||
switch (aSpacing) {
|
||||
case NS_SPACING_MARGIN:
|
||||
{
|
||||
const nsStyleMargin* parentMargin = (const nsStyleMargin*)parentContext->GetStyleData(eStyleStruct_Margin);
|
||||
parentMargin->CalcMarginFor(parentFrame, parentSpacing);
|
||||
}
|
||||
|
||||
break;
|
||||
case NS_SPACING_PADDING:
|
||||
{
|
||||
const nsStylePadding* parentPadding = (const nsStylePadding*)parentContext->GetStyleData(eStyleStruct_Padding);
|
||||
parentPadding->CalcPaddingFor(parentFrame, parentSpacing);
|
||||
}
|
||||
|
||||
break;
|
||||
case NS_SPACING_BORDER:
|
||||
{
|
||||
const nsStyleBorder* parentBorder = (const nsStyleBorder*)parentContext->GetStyleData(eStyleStruct_Border);
|
||||
parentBorder->CalcBorderFor(parentFrame, parentSpacing);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
switch (aSide) {
|
||||
case NS_SIDE_LEFT: result = parentSpacing.left; break;
|
||||
case NS_SIDE_TOP: result = parentSpacing.top; break;
|
||||
case NS_SIDE_RIGHT: result = parentSpacing.right; break;
|
||||
case NS_SIDE_BOTTOM: result = parentSpacing.bottom; break;
|
||||
}
|
||||
NS_RELEASE(parentContext);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case eStyleUnit_Percent:
|
||||
{
|
||||
nscoord baseWidth = 0;
|
||||
PRBool isBase = PR_FALSE;
|
||||
nsIFrame* frame;
|
||||
aFrame->GetParent(&frame);
|
||||
while (nsnull != frame) {
|
||||
frame->IsPercentageBase(isBase);
|
||||
if (isBase) {
|
||||
nsSize size;
|
||||
frame->GetSize(size);
|
||||
baseWidth = size.width; // not really width, need to subtract out padding...
|
||||
break;
|
||||
}
|
||||
frame->GetParent(&frame);
|
||||
}
|
||||
result = (nscoord)((float)baseWidth * aCoord.GetPercentValue());
|
||||
}
|
||||
break;
|
||||
|
||||
case eStyleUnit_Coord:
|
||||
result = aCoord.GetCoordValue();
|
||||
break;
|
||||
|
||||
case eStyleUnit_Enumerated:
|
||||
if (nsnull != aEnumTable) {
|
||||
PRInt32 value = aCoord.GetIntValue();
|
||||
if ((0 <= value) && (value < aNumEnums)) {
|
||||
return aEnumTable[aCoord.GetIntValue()];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case eStyleUnit_Null:
|
||||
case eStyleUnit_Normal:
|
||||
case eStyleUnit_Integer:
|
||||
case eStyleUnit_Proportional:
|
||||
default:
|
||||
result = 0;
|
||||
break;
|
||||
}
|
||||
if ((NS_SPACING_PADDING == aSpacing) || (NS_SPACING_BORDER == aSpacing)) {
|
||||
if (result < 0) {
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
inline void CalcSidesFor(const nsIFrame* aFrame, const nsStyleSides& aSides,
|
||||
PRUint8 aSpacing,
|
||||
const nscoord* aEnumTable, PRInt32 aNumEnums,
|
||||
nsMargin& aResult)
|
||||
{
|
||||
nsStyleCoord coord;
|
||||
|
||||
aResult.left = CalcSideFor(aFrame, aSides.GetLeft(coord), aSpacing, NS_SIDE_LEFT,
|
||||
aEnumTable, aNumEnums);
|
||||
aResult.top = CalcSideFor(aFrame, aSides.GetTop(coord), aSpacing, NS_SIDE_TOP,
|
||||
aEnumTable, aNumEnums);
|
||||
aResult.right = CalcSideFor(aFrame, aSides.GetRight(coord), aSpacing, NS_SIDE_RIGHT,
|
||||
aEnumTable, aNumEnums);
|
||||
aResult.bottom = CalcSideFor(aFrame, aSides.GetBottom(coord), aSpacing, NS_SIDE_BOTTOM,
|
||||
aEnumTable, aNumEnums);
|
||||
}
|
||||
|
||||
|
||||
// this is private to nsStyleSet, don't call it
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewStyleContext(nsIStyleContext** aInstancePtrResult,
|
||||
nsIStyleContext* aParentContext,
|
||||
nsIAtom* aPseudoType,
|
||||
nsISupportsArray* aRules,
|
||||
nsIPresContext* aPresContext);
|
||||
|
||||
|
||||
#endif /* nsIStyleContext_h___ */
|
||||
328
mozilla/layout/base/public/nsIStyleFrameConstruction.h
Normal file
328
mozilla/layout/base/public/nsIStyleFrameConstruction.h
Normal file
@@ -0,0 +1,328 @@
|
||||
/* -*- 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.org 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 nsIStyleFrameConstruction_h___
|
||||
#define nsIStyleFrameConstruction_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIStyleSet.h"
|
||||
|
||||
class nsIPresShell;
|
||||
class nsIPresContext;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsIAtom;
|
||||
class nsIStyleSheet;
|
||||
class nsIStyleRule;
|
||||
class nsStyleChangeList;
|
||||
class nsIFrameManager;
|
||||
class nsILayoutHistoryState;
|
||||
|
||||
// IID for the nsIStyleSet interface {a6cf9066-15b3-11d2-932e-00805f8add32}
|
||||
#define NS_ISTYLE_FRAME_CONSTRUCTION_IID \
|
||||
{0xa6cf9066, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
/** Interface for objects that handle frame construction based on style.
|
||||
* All frame construction goes through an object that implements this interface.
|
||||
* Frames are built based on the state of the content model and the style model.
|
||||
* Changes to either content or style can cause changes to the frame model.
|
||||
*/
|
||||
class nsIStyleFrameConstruction : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTYLE_FRAME_CONSTRUCTION_IID)
|
||||
|
||||
/**
|
||||
* Create frames for the root content element and its child content.
|
||||
*
|
||||
* @param aPresShell the presentation shell for which we will consturct a root frame
|
||||
* @param aPresContext the presentation context
|
||||
* @param aDocElement the content node to map into a root frame
|
||||
* @param aFrameSubTree [OUT] the resulting frame tree (a root frame and its children)
|
||||
*
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_IMETHOD ConstructRootFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aDocElement,
|
||||
nsIFrame*& aFrameSubTree) = 0;
|
||||
|
||||
/**
|
||||
* Causes reconstruction of a frame hierarchy rooted by the
|
||||
* document element frame. This is often called when radical style
|
||||
* change precludes incremental reflow.
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
*
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_IMETHOD ReconstructDocElementHierarchy(nsIPresContext* aPresContext) = 0;
|
||||
|
||||
|
||||
/////////////// Content change notifications //////////////////
|
||||
|
||||
/**
|
||||
* Notification that content was appended in the content tree.
|
||||
* This may have the side effect of creating frames for the new content.
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aContainer the content node into which content was appended
|
||||
* @param aNewIndexInContainer the index in aContainer at which the first
|
||||
* content node was appended.
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD ContentAppended(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer) = 0;
|
||||
|
||||
/**
|
||||
* Notification that content was inserted in the content tree.
|
||||
* This may have the side effect of creating frames for the new content.
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aContainer the content node into which content was appended
|
||||
* @param aChild the content node that was inserted
|
||||
* @param aNewIndexInContainer the index of aChild in aContainer
|
||||
* @param aFrameState the layout history object used to initialize the new frame(s)
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD ContentInserted(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer,
|
||||
nsILayoutHistoryState* aFrameState) = 0;
|
||||
|
||||
/**
|
||||
* Notification that content was replaced in the content tree.
|
||||
* This may have the side effect of creating frames for the new content.
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aContainer the content node into which content was appended
|
||||
* @param aOldChild the content node that was replaced
|
||||
* @param aNewChild the new content node that replaced aOldChild
|
||||
* @param aNewIndexInContainer the index of aNewChild in aContainer
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD ContentReplaced(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aOldChild,
|
||||
nsIContent* aNewChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
|
||||
/**
|
||||
* Notification that content was inserted in the content tree.
|
||||
* This may have the side effect of changing the frame tree
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aContainer the content node into which content was appended
|
||||
* @param aChild the content node that was inserted
|
||||
* @param aNewIndexInContainer the index of aChild in aContainer
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD ContentRemoved(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
|
||||
/**
|
||||
* Notification that content was changed in the content tree.
|
||||
* This may have the side effect of changing the frame tree
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aContent the content node that was changed
|
||||
* @param aSubContent a hint to the frame system about the change
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Notification that the state of a content node has changed.
|
||||
* (ie: gained or lost focus, became active or hovered over)
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aContent1 the content node whose state was changed
|
||||
* @param aContent2 an optional second content node whose state
|
||||
* has also changed. The meaning of aContent2
|
||||
* depends on the type of state change.
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent1,
|
||||
nsIContent* aContent2) = 0;
|
||||
|
||||
/**
|
||||
* Notification that an attribute was changed for a content node
|
||||
* This may have the side effect of changing the frame tree
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aContent the content node on which an attribute was changed
|
||||
* @param aNameSpaceID the name space for the changed attribute
|
||||
* @param aAttribute the attribute that was changed
|
||||
* @param aHint a hint about the effect of the change
|
||||
* see nsStyleConsts.h for legal values
|
||||
* any of the consts of the form NS_STYLE_HINT_*
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint) = 0;
|
||||
|
||||
|
||||
/////////////// Style change notifications //////////////////
|
||||
|
||||
/**
|
||||
* A StyleRule has just been modified within a style sheet.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that contians the rule
|
||||
* @param aStyleRule the rule that was modified
|
||||
* @param aHint some possible info about the nature of the change.
|
||||
* see nsStyleConsts for hint values
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD StyleRuleChanged(nsIPresContext* aPresContext,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule,
|
||||
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
|
||||
|
||||
/**
|
||||
* A StyleRule has just been added to a style sheet.
|
||||
* This method is called automatically when the rule gets
|
||||
* added to the sheet. The style sheet passes this
|
||||
* notification to the document. The notification is passed on
|
||||
* to all of the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that has been modified
|
||||
* @param aStyleRule the rule that was added
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD StyleRuleAdded(nsIPresContext* aPresContext,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule) = 0;
|
||||
|
||||
/**
|
||||
* A StyleRule has just been removed from a style sheet.
|
||||
* This method is called automatically when the rule gets
|
||||
* removed from the sheet. The style sheet passes this
|
||||
* notification to the document. The notification is passed on
|
||||
* to all of the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that has been modified
|
||||
* @param aStyleRule the rule that was removed
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD StyleRuleRemoved(nsIPresContext* aPresContext,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule) = 0;
|
||||
|
||||
/**
|
||||
* Method that actually handles style changes for effected frames.
|
||||
* Note: this may not need to be a public method. Use with extreme caution.
|
||||
*
|
||||
* @param aRestyleArray A list of effected frames.
|
||||
* @param aPresContext The presentation context.
|
||||
*
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_IMETHOD ProcessRestyledFrames(nsStyleChangeList& aRestyleArray,
|
||||
nsIPresContext* aPresContext) = 0;
|
||||
|
||||
/////////////// misc methods //////////////////////
|
||||
|
||||
/**
|
||||
* Notification that we were unable to render a replaced element.
|
||||
* Called when the replaced element can not be rendered, and we should
|
||||
* instead render the element's contents.
|
||||
* For HTML, the content object associated with aFrame should either be a IMG
|
||||
* element or an OBJECT element.
|
||||
* This may have the side effect of changing the frame tree.
|
||||
*
|
||||
* @param aPresShell the presentation shell
|
||||
* @param aPresContext the presentation context
|
||||
* @param aFrame the frame constructed for the replaced element
|
||||
*
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_IMETHOD CantRenderReplacedElement(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame) = 0;
|
||||
|
||||
/**
|
||||
* Request to create a continuing frame
|
||||
*
|
||||
* @param aPresShell the presentation shell
|
||||
* @param aPresContext the presentation context
|
||||
* @param aFrame the frame for which we need a continuation
|
||||
* @param aParentFrame the parent of aFrame
|
||||
* @param aContinuingFrame [OUT] the resulting frame
|
||||
*
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_IMETHOD CreateContinuingFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame** aContinuingFrame) = 0;
|
||||
|
||||
/** Request to find the primary frame associated with a given content object.
|
||||
* This is typically called by the pres shell when there is no mapping in
|
||||
* the pres shell hash table
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aFrameManager the frame manager for the frame being sought
|
||||
* @param aContent the content node for which we seek a frame
|
||||
* @param aFrame [OUT] the resulting frame, if any. may be null,
|
||||
* indicating that no frame maps aContent
|
||||
* @param aHint an optional hint used to make the search for aFrame faster
|
||||
*/
|
||||
NS_IMETHOD FindPrimaryFrameFor(nsIPresContext* aPresContext,
|
||||
nsIFrameManager* aFrameManager,
|
||||
nsIContent* aContent,
|
||||
nsIFrame** aFrame,
|
||||
nsFindFrameHint* aHint=nsnull) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIStyleFrameConstruction_h___ */
|
||||
61
mozilla/layout/base/public/nsIStyleRule.h
Normal file
61
mozilla/layout/base/public/nsIStyleRule.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/* -*- 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.org 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 nsIStyleRule_h___
|
||||
#define nsIStyleRule_h___
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsISizeOfHandler;
|
||||
|
||||
class nsIStyleSheet;
|
||||
class nsIMutableStyleContext;
|
||||
class nsIPresContext;
|
||||
class nsIContent;
|
||||
|
||||
// IID for the nsIStyleRule interface {40ae5c90-ad6a-11d1-8031-006008159b5a}
|
||||
#define NS_ISTYLE_RULE_IID \
|
||||
{0x40ae5c90, 0xad6a, 0x11d1, {0x80, 0x31, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
class nsIStyleRule : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ISTYLE_RULE_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const = 0;
|
||||
|
||||
// Strength is an out-of-band weighting, useful for mapping CSS ! important
|
||||
NS_IMETHOD GetStrength(PRInt32& aStrength) const = 0;
|
||||
|
||||
// Map only font data into style context
|
||||
NS_IMETHOD MapFontStyleInto(nsIMutableStyleContext* aContext, nsIPresContext* aPresContext) = 0;
|
||||
// Map all non-font info into style context
|
||||
NS_IMETHOD MapStyleInto(nsIMutableStyleContext* aContext, nsIPresContext* aPresContext) = 0;
|
||||
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0;
|
||||
|
||||
virtual void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsIStyleRule_h___ */
|
||||
78
mozilla/layout/base/public/nsIStyleRuleProcessor.h
Normal file
78
mozilla/layout/base/public/nsIStyleRuleProcessor.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/* -*- 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.org 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 nsIStyleRuleProcessor_h___
|
||||
#define nsIStyleRuleProcessor_h___
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsISizeOfHandler;
|
||||
|
||||
class nsIStyleSheet;
|
||||
class nsIStyleContext;
|
||||
class nsIPresContext;
|
||||
class nsIContent;
|
||||
class nsISupportsArray;
|
||||
class nsIAtom;
|
||||
class nsICSSPseudoComparator;
|
||||
|
||||
// IID for the nsIStyleRuleProcessor interface {015575fe-7b6c-11d3-ba05-001083023c2b}
|
||||
#define NS_ISTYLE_RULE_PROCESSOR_IID \
|
||||
{0x015575fe, 0x7b6c, 0x11d3, {0xba, 0x05, 0x00, 0x10, 0x83, 0x02, 0x3c, 0x2b}}
|
||||
|
||||
/* The style rule processor interface is a mechanism to seperate the matching
|
||||
* of style rules from style sheet instances.
|
||||
* Simple style sheets can and will act as their own processor.
|
||||
* Sheets where rule ordering interlaces between multiple sheets, will need to
|
||||
* share a single rule processor between them (CSS sheets do this for cascading order)
|
||||
*/
|
||||
class nsIStyleRuleProcessor : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ISTYLE_RULE_PROCESSOR_IID; return iid; }
|
||||
|
||||
// populate supports array with nsIStyleRule*
|
||||
// rules are ordered, those with higher precedence come last
|
||||
NS_IMETHOD RulesMatching(nsIPresContext* aPresContext,
|
||||
nsIAtom* aMedium,
|
||||
nsIContent* aContent,
|
||||
nsIStyleContext* aParentContext,
|
||||
nsISupportsArray* aResults) = 0;
|
||||
|
||||
NS_IMETHOD RulesMatching(nsIPresContext* aPresContext,
|
||||
nsIAtom* aMedium,
|
||||
nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsIStyleContext* aParentContext,
|
||||
nsICSSPseudoComparator* aComparator,
|
||||
nsISupportsArray* aResults) = 0;
|
||||
|
||||
// Test if style is dependent on content state
|
||||
NS_IMETHOD HasStateDependentStyle(nsIPresContext* aPresContext,
|
||||
nsIAtom* aMedium,
|
||||
nsIContent* aContent) = 0;
|
||||
|
||||
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIStyleRuleProcessor_h___ */
|
||||
24
mozilla/layout/base/public/nsIStyleRuleSupplier.h
Normal file
24
mozilla/layout/base/public/nsIStyleRuleSupplier.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef _nsIStyleRuleSupplier_h
|
||||
#define _nsIStyleRuleSupplier_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsISupportsArray.h"
|
||||
|
||||
// {2D77A45B-4F3A-4203-A7D2-F4B84D0C1EE4}
|
||||
#define NS_ISTYLERULESUPPLIER_IID \
|
||||
{ 0x2d77a45b, 0x4f3a, 0x4203, { 0xa7, 0xd2, 0xf4, 0xb8, 0x4d, 0xc, 0x1e, 0xe4 } }
|
||||
|
||||
class nsIContent;
|
||||
class nsIStyleSet;
|
||||
|
||||
class nsIStyleRuleSupplier : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTYLERULESUPPLIER_IID)
|
||||
|
||||
NS_IMETHOD UseDocumentRules(nsIContent* aContent, PRBool* aResult)=0;
|
||||
NS_IMETHOD WalkRules(nsIStyleSet* aStyleSet,
|
||||
nsISupportsArrayEnumFunc aFunc, void* aData,
|
||||
nsIContent* aContent)=0;
|
||||
};
|
||||
|
||||
#endif /* _nsIStyleRuleSupplier_h */
|
||||
324
mozilla/layout/base/public/nsIStyleSet.h
Normal file
324
mozilla/layout/base/public/nsIStyleSet.h
Normal file
@@ -0,0 +1,324 @@
|
||||
/* -*- 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.org 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 nsStyleSet_h___
|
||||
#define nsStyleSet_h___
|
||||
|
||||
#include <stdio.h>
|
||||
#include "nsISupports.h"
|
||||
#include "nslayout.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIStyleRule;
|
||||
class nsIStyleSheet;
|
||||
class nsIStyleContext;
|
||||
class nsIStyleRuleSupplier;
|
||||
class nsIPresContext;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsIDocument;
|
||||
class nsIFrameManager;
|
||||
class nsISupportsArray;
|
||||
struct nsFindFrameHint;
|
||||
|
||||
#include "nsVoidArray.h"
|
||||
class nsISizeOfHandler;
|
||||
|
||||
class nsICSSPseudoComparator;
|
||||
|
||||
#define SHARE_STYLECONTEXTS
|
||||
|
||||
#ifdef SHARE_STYLECONTEXTS
|
||||
#include "nsHashtable.h"
|
||||
#endif
|
||||
|
||||
// IID for the nsIStyleSet interface {e59396b0-b244-11d1-8031-006008159b5a}
|
||||
#define NS_ISTYLE_SET_IID \
|
||||
{0xe59396b0, 0xb244, 0x11d1, {0x80, 0x31, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
#ifdef SHARE_STYLECONTEXTS
|
||||
typedef PRUint32 scKey; // key for style contexts: it is a CRC32 value actually...
|
||||
#endif
|
||||
|
||||
class nsIStyleSet : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ISTYLE_SET_IID; return iid; }
|
||||
|
||||
// Style sheets are ordered, most significant first
|
||||
// NOTE: this is the reverse of the way documents store the sheets
|
||||
virtual void AppendOverrideStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual void InsertOverrideStyleSheetAfter(nsIStyleSheet* aSheet,
|
||||
nsIStyleSheet* aAfterSheet) = 0;
|
||||
virtual void InsertOverrideStyleSheetBefore(nsIStyleSheet* aSheet,
|
||||
nsIStyleSheet* aBeforeSheet) = 0;
|
||||
virtual void RemoveOverrideStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual PRInt32 GetNumberOfOverrideStyleSheets() = 0;
|
||||
virtual nsIStyleSheet* GetOverrideStyleSheetAt(PRInt32 aIndex) = 0;
|
||||
|
||||
// the ordering of document style sheets is given by the document
|
||||
virtual void AddDocStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocument) = 0;
|
||||
virtual void RemoveDocStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual PRInt32 GetNumberOfDocStyleSheets() = 0;
|
||||
virtual nsIStyleSheet* GetDocStyleSheetAt(PRInt32 aIndex) = 0;
|
||||
|
||||
virtual void AppendBackstopStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual void InsertBackstopStyleSheetAfter(nsIStyleSheet* aSheet,
|
||||
nsIStyleSheet* aAfterSheet) = 0;
|
||||
virtual void InsertBackstopStyleSheetBefore(nsIStyleSheet* aSheet,
|
||||
nsIStyleSheet* aBeforeSheet) = 0;
|
||||
virtual void RemoveBackstopStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual PRInt32 GetNumberOfBackstopStyleSheets() = 0;
|
||||
virtual nsIStyleSheet* GetBackstopStyleSheetAt(PRInt32 aIndex) = 0;
|
||||
virtual void ReplaceBackstopStyleSheets(nsISupportsArray* aNewSheets) = 0;
|
||||
|
||||
// enable / disable the Quirk style sheet:
|
||||
// returns NS_FAILURE if none is found, otherwise NS_OK
|
||||
NS_IMETHOD EnableQuirkStyleSheet(PRBool aEnable) = 0;
|
||||
|
||||
|
||||
NS_IMETHOD NotifyStyleSheetStateChanged(PRBool aDisabled) = 0;
|
||||
|
||||
// get a style context for a non-pseudo frame
|
||||
virtual nsIStyleContext* ResolveStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRBool aForceUnique = PR_FALSE) = 0;
|
||||
|
||||
// get a style context for a pseudo-frame (ie: tag = NS_NewAtom(":first-line");
|
||||
virtual nsIStyleContext* ResolvePseudoStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRBool aForceUnique = PR_FALSE,
|
||||
nsICSSPseudoComparator* aComparator = nsnull) = 0;
|
||||
|
||||
// This funtions just like ResolvePseudoStyleFor except that it will
|
||||
// return nsnull if there are no explicit style rules for that
|
||||
// pseudo element
|
||||
virtual nsIStyleContext* ProbePseudoStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRBool aForceUnique = PR_FALSE) = 0;
|
||||
|
||||
// Get a new style context that lives in a different parent
|
||||
// The new context will be the same as the old if the new parent == the old parent
|
||||
NS_IMETHOD ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIStyleContext* aNewParentContext,
|
||||
nsIStyleContext** aNewStyleContext) = 0;
|
||||
|
||||
// Test if style is dependent on content state
|
||||
NS_IMETHOD HasStateDependentStyle(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent) = 0;
|
||||
|
||||
// Create frames for the root content element and its child content
|
||||
NS_IMETHOD ConstructRootFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aDocElement,
|
||||
nsIFrame*& aFrameSubTree) = 0;
|
||||
|
||||
// Causes reconstruction of a frame hierarchy rooted by the
|
||||
// frame document element frame. This is often called when radical style
|
||||
// change precludes incremental reflow.
|
||||
NS_IMETHOD ReconstructDocElementHierarchy(nsIPresContext* aPresContext) = 0;
|
||||
|
||||
// Notifications of changes to the content mpodel
|
||||
NS_IMETHOD ContentAppended(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer) = 0;
|
||||
NS_IMETHOD ContentInserted(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
NS_IMETHOD ContentReplaced(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aOldChild,
|
||||
nsIContent* aNewChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
NS_IMETHOD ContentRemoved(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
|
||||
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent) = 0;
|
||||
NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent1,
|
||||
nsIContent* aContent2) = 0;
|
||||
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
|
||||
|
||||
// Style change notifications
|
||||
NS_IMETHOD StyleRuleChanged(nsIPresContext* aPresContext,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule,
|
||||
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
|
||||
NS_IMETHOD StyleRuleAdded(nsIPresContext* aPresContext,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule) = 0;
|
||||
NS_IMETHOD StyleRuleRemoved(nsIPresContext* aPresContext,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule) = 0;
|
||||
|
||||
// Notification that we were unable to render a replaced element.
|
||||
// Called when the replaced element can not be rendered, and we should
|
||||
// instead render the element's contents.
|
||||
// The content object associated with aFrame should either be a IMG
|
||||
// element or an OBJECT element.
|
||||
NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame) = 0;
|
||||
|
||||
// Request to create a continuing frame
|
||||
NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame** aContinuingFrame) = 0;
|
||||
|
||||
/** Request to find the primary frame associated with a given content object.
|
||||
* This is typically called by the pres shell when there is no mapping in
|
||||
* the pres shell hash table.
|
||||
* @param aPresContext the pres context
|
||||
* @param aFrameManager the frame manager
|
||||
* @param aContent the content we need to find a frame for
|
||||
* @param aFrame [OUT] the resulting frame
|
||||
* @param aHint optional performance hint, may be null
|
||||
*
|
||||
* @return NS_OK. aFrame will be null if no frame could be found
|
||||
*/
|
||||
NS_IMETHOD FindPrimaryFrameFor(nsIPresContext* aPresContext,
|
||||
nsIFrameManager* aFrameManager,
|
||||
nsIContent* aContent,
|
||||
nsIFrame** aFrame,
|
||||
nsFindFrameHint* aHint=0) = 0;
|
||||
|
||||
// APIs for registering objects that can supply additional
|
||||
// rules during processing.
|
||||
NS_IMETHOD SetStyleRuleSupplier(nsIStyleRuleSupplier* aSupplier)=0;
|
||||
NS_IMETHOD GetStyleRuleSupplier(nsIStyleRuleSupplier** aSupplier)=0;
|
||||
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) = 0;
|
||||
virtual void ListContexts(nsIStyleContext* aRootContext, FILE* out = stdout, PRInt32 aIndent = 0) = 0;
|
||||
|
||||
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize) = 0;
|
||||
virtual void ResetUniqueStyleItems(void) = 0;
|
||||
|
||||
// If changing the given attribute cannot affect style context, aAffects
|
||||
// will be PR_FALSE on return.
|
||||
NS_IMETHOD AttributeAffectsStyle(nsIAtom *aAttribute, nsIContent *aContent,
|
||||
PRBool &aAffects) = 0;
|
||||
|
||||
#ifdef SHARE_STYLECONTEXTS
|
||||
// add and remove from the cache of all contexts
|
||||
NS_IMETHOD AddStyleContext(nsIStyleContext *aNewStyleContext) = 0;
|
||||
NS_IMETHOD RemoveStyleContext(nsIStyleContext *aNewStyleContext) = 0;
|
||||
// find another context with the same style data
|
||||
// - if an exact match is found, the out-param aMatchingContext is set (AddRef'd)
|
||||
NS_IMETHOD FindMatchingContext(nsIStyleContext *aStyleContextToMatch,
|
||||
nsIStyleContext **aMatchingContext) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewStyleSet(nsIStyleSet** aInstancePtrResult);
|
||||
|
||||
|
||||
class nsUniqueStyleItems : private nsVoidArray
|
||||
{
|
||||
public :
|
||||
// return a singleton instance of the nsUniqueStyleItems object
|
||||
static nsUniqueStyleItems *GetUniqueStyleItems( void ){
|
||||
if(mInstance == nsnull){
|
||||
#ifdef DEBUG
|
||||
nsUniqueStyleItems *pInstance =
|
||||
#endif
|
||||
new nsUniqueStyleItems;
|
||||
|
||||
NS_ASSERTION(pInstance == mInstance, "Singleton?");
|
||||
|
||||
// the ctor sets the mInstance static member variable...
|
||||
// if it is null, then we just end up returning null...
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
void *GetItem(void *aPtr){
|
||||
PRInt32 index = nsVoidArray::IndexOf(aPtr);
|
||||
if( index != -1){
|
||||
return nsVoidArray::ElementAt(index);
|
||||
} else {
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool AddItem(void *aPtr){
|
||||
if(nsVoidArray::IndexOf(aPtr) == -1){
|
||||
return nsVoidArray::AppendElement(aPtr);
|
||||
} else {
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool RemoveItem(void *aPtr){
|
||||
return nsVoidArray::RemoveElement(aPtr);
|
||||
}
|
||||
|
||||
PRInt32 Count(void){
|
||||
return nsVoidArray::Count();
|
||||
}
|
||||
|
||||
void Clear(void){
|
||||
nsVoidArray::Clear();
|
||||
}
|
||||
protected:
|
||||
// disallow these:
|
||||
nsUniqueStyleItems( const nsUniqueStyleItems& src);
|
||||
nsUniqueStyleItems& operator =(const nsUniqueStyleItems& src);
|
||||
|
||||
// make this accessable to factory only
|
||||
nsUniqueStyleItems(void) : nsVoidArray(){
|
||||
NS_ASSERTION(mInstance == nsnull, "singleton?");
|
||||
mInstance=this;
|
||||
}
|
||||
|
||||
static nsUniqueStyleItems *mInstance;
|
||||
};
|
||||
|
||||
#define UNIQUE_STYLE_ITEMS(__ptr) \
|
||||
nsUniqueStyleItems* __ptr = nsUniqueStyleItems::GetUniqueStyleItems(); \
|
||||
NS_ASSERTION(__ptr != nsnull, "UniqueItems cannot be null: error in nsUniqueStyleItems factory");
|
||||
|
||||
/** a simple struct (that may someday be expanded)
|
||||
* that contains data supplied by the caller to help
|
||||
* the style set find a frame for a content node
|
||||
*/
|
||||
struct nsFindFrameHint
|
||||
{
|
||||
nsIFrame *mPrimaryFrameForPrevSibling; // weak ref to the primary frame for the content for which we need a frame
|
||||
nsFindFrameHint() {
|
||||
mPrimaryFrameForPrevSibling = nsnull;
|
||||
};
|
||||
};
|
||||
|
||||
#endif /* nsIStyleSet_h___ */
|
||||
81
mozilla/layout/base/public/nsIStyleSheet.h
Normal file
81
mozilla/layout/base/public/nsIStyleSheet.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/* -*- 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.org 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 nsIStyleSheet_h___
|
||||
#define nsIStyleSheet_h___
|
||||
|
||||
#include <stdio.h>
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsISizeOfHandler;
|
||||
|
||||
class nsIAtom;
|
||||
class nsString;
|
||||
class nsIURI;
|
||||
class nsIStyleRule;
|
||||
class nsISupportsArray;
|
||||
class nsIPresContext;
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIStyleContext;
|
||||
class nsIStyleRuleProcessor;
|
||||
|
||||
// IID for the nsIStyleSheet interface {8c4a80a0-ad6a-11d1-8031-006008159b5a}
|
||||
#define NS_ISTYLE_SHEET_IID \
|
||||
{0x8c4a80a0, 0xad6a, 0x11d1, {0x80, 0x31, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
class nsIStyleSheet : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ISTYLE_SHEET_IID; return iid; }
|
||||
|
||||
// basic style sheet data
|
||||
NS_IMETHOD GetURL(nsIURI*& aURL) const = 0;
|
||||
NS_IMETHOD GetTitle(nsString& aTitle) const = 0;
|
||||
NS_IMETHOD GetType(nsString& aType) const = 0;
|
||||
NS_IMETHOD GetMediumCount(PRInt32& aCount) const = 0;
|
||||
NS_IMETHOD GetMediumAt(PRInt32 aIndex, nsIAtom*& aMedium) const = 0;
|
||||
NS_IMETHOD UseForMedium(nsIAtom* aMedium) const = 0;
|
||||
|
||||
NS_IMETHOD GetEnabled(PRBool& aEnabled) const = 0;
|
||||
NS_IMETHOD SetEnabled(PRBool aEnabled) = 0;
|
||||
|
||||
// style sheet owner info
|
||||
NS_IMETHOD GetParentSheet(nsIStyleSheet*& aParent) const = 0; // may be null
|
||||
NS_IMETHOD GetOwningDocument(nsIDocument*& aDocument) const = 0; // may be null
|
||||
NS_IMETHOD SetOwningDocument(nsIDocument* aDocument) = 0;
|
||||
|
||||
// style rule processor access
|
||||
NS_IMETHOD GetStyleRuleProcessor(nsIStyleRuleProcessor*& aProcessor,
|
||||
nsIStyleRuleProcessor* aPrevProcessor) = 0;
|
||||
|
||||
// XXX style rule enumerations
|
||||
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0;
|
||||
|
||||
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize) = 0;
|
||||
|
||||
// If changing the given attribute cannot affect style context, aAffects
|
||||
// will be PR_FALSE on return.
|
||||
NS_IMETHOD AttributeAffectsStyle(nsIAtom *aAttribute, nsIContent *aContent,
|
||||
PRBool &aAffects) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIStyleSheet_h___ */
|
||||
56
mozilla/layout/base/public/nsIStyleSheetLinkingElement.h
Normal file
56
mozilla/layout/base/public/nsIStyleSheetLinkingElement.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* -*- 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.org 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 nsIStyleSheetLinkingElement_h__
|
||||
#define nsIStyleSheetLinkingElement_h__
|
||||
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
#define NS_ISTYLESHEETLINKINGELEMENT_IID \
|
||||
{0xa6cf90e9, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
class nsIStyleSheet;
|
||||
|
||||
class nsIStyleSheetLinkingElement : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTYLESHEETLINKINGELEMENT_IID)
|
||||
|
||||
/**
|
||||
* Used to make the association between a style sheet and
|
||||
* the element that linked it to the document.
|
||||
*
|
||||
* @param aStyleSheet the style sheet associated with this
|
||||
* element.
|
||||
*/
|
||||
NS_IMETHOD SetStyleSheet(nsIStyleSheet* aStyleSheet) = 0;
|
||||
|
||||
/**
|
||||
* Used to obtain the style sheet linked in by this element.
|
||||
*
|
||||
* @param aStyleSheet out parameter that returns the style
|
||||
* sheet associated with this element.
|
||||
*/
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aStyleSheet) = 0;
|
||||
};
|
||||
|
||||
#endif // nsILinkingElement_h__
|
||||
62
mozilla/layout/base/public/nsIStyledContent.h
Normal file
62
mozilla/layout/base/public/nsIStyledContent.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* -*- 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.org 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 nsIStyledContent_h___
|
||||
#define nsIStyledContent_h___
|
||||
|
||||
#include "nsIContent.h"
|
||||
|
||||
class nsString;
|
||||
class nsIStyleRule;
|
||||
class nsIStyleContext;
|
||||
class nsISupportsArray;
|
||||
|
||||
// IID for the nsIStyledContent class
|
||||
#define NS_ISTYLEDCONTENT_IID \
|
||||
{ 0xc1e84e01, 0xcd15, 0x11d2, { 0x96, 0xed, 0x0, 0x10, 0x4b, 0x7b, 0x7d, 0xeb } }
|
||||
|
||||
// Abstract interface for all styled content (that supports ID, CLASS, STYLE, and
|
||||
// the ability to specify style hints on an attribute change).
|
||||
class nsIStyledContent : public nsIContent {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ISTYLEDCONTENT_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetID(nsIAtom*& aResult) const = 0;
|
||||
NS_IMETHOD GetClasses(nsVoidArray& aArray) const = 0;
|
||||
NS_IMETHOD HasClass(nsIAtom* aClass) const = 0;
|
||||
|
||||
NS_IMETHOD GetContentStyleRules(nsISupportsArray* aRules) = 0;
|
||||
NS_IMETHOD GetInlineStyleRules(nsISupportsArray* aRules) = 0;
|
||||
|
||||
/** NRA ***
|
||||
* Get a hint that tells the style system what to do when
|
||||
* an attribute on this node changes.
|
||||
* This only applies to attributes that map their value
|
||||
* DIRECTLY into style contexts via NON-CSS style rules
|
||||
* Only HTML currently does this.
|
||||
* All other attributes return NS_STYLE_HINT_CONTENT
|
||||
*/
|
||||
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint) const = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIStyledContent_h___ */
|
||||
135
mozilla/layout/base/public/nsITextContent.h
Normal file
135
mozilla/layout/base/public/nsITextContent.h
Normal file
@@ -0,0 +1,135 @@
|
||||
/* -*- 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.org 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 nsITextContent_h___
|
||||
#define nsITextContent_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsIContent.h"
|
||||
class nsString;
|
||||
class nsTextFragment;
|
||||
|
||||
// IID for the nsITextContent interface
|
||||
#define NS_ITEXT_CONTENT_IID \
|
||||
{0xa6cf9065, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
/**
|
||||
* Interface for textual content. This interface is used to provide
|
||||
* an efficient access to text content.
|
||||
*/
|
||||
class nsITextContent : public nsIContent {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ITEXT_CONTENT_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Get direct access (but read only) to the text in the text content.
|
||||
*/
|
||||
NS_IMETHOD GetText(const nsTextFragment** aFragmentsResult) = 0;
|
||||
|
||||
/**
|
||||
* Get the length of the text content.
|
||||
*/
|
||||
NS_IMETHOD GetTextLength(PRInt32* aLengthResult) = 0;
|
||||
|
||||
/**
|
||||
* Make a copy of the text content in aResult.
|
||||
*/
|
||||
NS_IMETHOD CopyText(nsAWritableString& aResult) = 0;
|
||||
|
||||
/**
|
||||
* Set the text to the given value. If aNotify is PR_TRUE then
|
||||
* the document is notified of the content change.
|
||||
*/
|
||||
NS_IMETHOD SetText(const PRUnichar* aBuffer,
|
||||
PRInt32 aLength,
|
||||
PRBool aNotify) = 0;
|
||||
|
||||
/**
|
||||
* Set the text to the given value. If aNotify is PR_TRUE then
|
||||
* the document is notified of the content change.
|
||||
*/
|
||||
NS_IMETHOD SetText(const nsAReadableString& aStr,
|
||||
PRBool aNotify) = 0;
|
||||
|
||||
/**
|
||||
* Set the text to the given value. If aNotify is PR_TRUE then
|
||||
* the document is notified of the content change.
|
||||
*/
|
||||
NS_IMETHOD SetText(const char* aBuffer,
|
||||
PRInt32 aLength,
|
||||
PRBool aNotify) = 0;
|
||||
|
||||
/**
|
||||
* Query method to see if the frame is nothing but whitespace
|
||||
*/
|
||||
NS_IMETHOD IsOnlyWhitespace(PRBool* aResult) = 0;
|
||||
|
||||
/**
|
||||
* Clone this content node. Unlike the nsIDOMNode equivalent, this
|
||||
* method allows you to specify whether to copy the text as well.
|
||||
*/
|
||||
NS_IMETHOD CloneContent(PRBool aCloneText, nsITextContent** aClone) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/* a6cf905e-15b3-11d2-932e-00805f8add32 */
|
||||
#define NS_ITEXT_CONTENT_CHANGE_DATA_IID \
|
||||
{0xa6cf905e, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
// Simple interface for encapsulating change data for a ContentChanged
|
||||
// notification.
|
||||
class nsITextContentChangeData : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITEXT_CONTENT_CHANGE_DATA_IID);
|
||||
|
||||
enum ChangeType {
|
||||
Insert,
|
||||
Append,
|
||||
Replace
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the type of change associated with the ContentChanged
|
||||
* notification.
|
||||
*/
|
||||
NS_IMETHOD GetChangeType(ChangeType* aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetInsertData(PRInt32* aOffset,
|
||||
PRInt32* aInsertLength) = 0;
|
||||
|
||||
NS_IMETHOD GetAppendData(PRInt32* aOffset,
|
||||
PRInt32* aAppendLength) = 0;
|
||||
|
||||
NS_IMETHOD GetReplaceData(PRInt32* aOffset,
|
||||
PRInt32* aSourceLength,
|
||||
PRInt32* aReplaceLength) = 0;
|
||||
};
|
||||
|
||||
// XXX These belong elsewhere
|
||||
extern nsresult
|
||||
NS_NewTextNode(nsIContent** aResult);
|
||||
|
||||
extern nsresult
|
||||
NS_NewCommentNode(nsIContent** aResult);
|
||||
|
||||
|
||||
#endif /* nsITextContent_h___ */
|
||||
199
mozilla/layout/base/public/nsLayoutAtomList.h
Normal file
199
mozilla/layout/base/public/nsLayoutAtomList.h
Normal file
@@ -0,0 +1,199 @@
|
||||
/* -*- 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/******
|
||||
|
||||
This file contains the list of all layout nsIAtoms and their values
|
||||
|
||||
It is designed to be used as inline input to nsLayoutAtoms.cpp *only*
|
||||
through the magic of C preprocessing.
|
||||
|
||||
All entires must be enclosed in the macro LAYOUT_ATOM which will have cruel
|
||||
and unusual things done to it
|
||||
|
||||
It is recommended (but not strictly necessary) to keep all entries
|
||||
in alphabetical order
|
||||
|
||||
The first argument to LAYOUT_ATOM is the C++ identifier of the atom
|
||||
The second argument is the string value of the atom
|
||||
|
||||
******/
|
||||
|
||||
|
||||
// Alphabetical list of media type atoms
|
||||
LAYOUT_ATOM(all, "all") // Media atoms must be lower case
|
||||
LAYOUT_ATOM(aural, "aural")
|
||||
LAYOUT_ATOM(braille, "braille")
|
||||
LAYOUT_ATOM(embossed, "embossed")
|
||||
LAYOUT_ATOM(handheld, "handheld")
|
||||
LAYOUT_ATOM(print, "print")
|
||||
LAYOUT_ATOM(projection, "projection")
|
||||
LAYOUT_ATOM(screen, "screen")
|
||||
LAYOUT_ATOM(tty, "tty")
|
||||
LAYOUT_ATOM(tv, "tv")
|
||||
|
||||
// Alphabetical list of standard name space prefixes
|
||||
LAYOUT_ATOM(htmlNameSpace, "html")
|
||||
LAYOUT_ATOM(xmlNameSpace, "xml")
|
||||
LAYOUT_ATOM(xmlnsNameSpace, "xmlns")
|
||||
|
||||
// Alphabetical list of frame additional child list names
|
||||
LAYOUT_ATOM(absoluteList, "Absolute-list")
|
||||
LAYOUT_ATOM(bulletList, "Bullet-list")
|
||||
LAYOUT_ATOM(captionList, "Caption-list")
|
||||
LAYOUT_ATOM(colGroupList, "ColGroup-list")
|
||||
LAYOUT_ATOM(editorDisplayList, "EditorDisplay-List")
|
||||
LAYOUT_ATOM(fixedList, "Fixed-list")
|
||||
LAYOUT_ATOM(floaterList, "Floater-list")
|
||||
LAYOUT_ATOM(overflowList, "Overflow-list")
|
||||
LAYOUT_ATOM(popupList, "Popup-list")
|
||||
|
||||
// Alphabetical list of pseudo tag names for non-element content
|
||||
LAYOUT_ATOM(canvasPseudo, ":canvas")
|
||||
LAYOUT_ATOM(commentTagName, "__moz_comment")
|
||||
LAYOUT_ATOM(dummyOptionPseudo, ":-moz-dummy-option")
|
||||
LAYOUT_ATOM(optionSelectedPseudo, "-moz-option-selected")
|
||||
LAYOUT_ATOM(textTagName, "__moz_text")
|
||||
LAYOUT_ATOM(pagePseudo, ":-moz-page")
|
||||
LAYOUT_ATOM(pageSequencePseudo, ":-moz-page-sequence")
|
||||
LAYOUT_ATOM(processingInstructionTagName, "__moz_pi")
|
||||
LAYOUT_ATOM(scrolledContentPseudo, ":scrolled-content")
|
||||
LAYOUT_ATOM(viewportPseudo, ":viewport")
|
||||
LAYOUT_ATOM(viewportScrollPseudo, ":viewport-scroll")
|
||||
LAYOUT_ATOM(selectScrolledContentPseudo, ":-moz-select-scrolled-content")
|
||||
|
||||
// Alphabetical list of frame types
|
||||
LAYOUT_ATOM(areaFrame, "AreaFrame")
|
||||
LAYOUT_ATOM(blockFrame, "BlockFrame")
|
||||
LAYOUT_ATOM(brFrame, "BRFrame")
|
||||
LAYOUT_ATOM(bulletFrame, "BulletFrame")
|
||||
LAYOUT_ATOM(hrFrame, "HRFrame")
|
||||
LAYOUT_ATOM(htmlFrameInnerFrame, "htmlFrameInnerFrame")
|
||||
LAYOUT_ATOM(htmlFrameOuterFrame, "htmlFrameOuterFrame")
|
||||
LAYOUT_ATOM(imageFrame, "ImageFrame")
|
||||
LAYOUT_ATOM(inlineFrame, "InlineFrame")
|
||||
LAYOUT_ATOM(letterFrame, "LetterFrame")
|
||||
LAYOUT_ATOM(lineFrame, "LineFrame")
|
||||
LAYOUT_ATOM(objectFrame, "ObjectFrame")
|
||||
LAYOUT_ATOM(pageFrame, "PageFrame")
|
||||
LAYOUT_ATOM(placeholderFrame, "PlaceholderFrame")
|
||||
LAYOUT_ATOM(positionedInlineFrame, "PositionedInlineFrame")
|
||||
LAYOUT_ATOM(canvasFrame, "CanvasFrame")
|
||||
LAYOUT_ATOM(rootFrame, "RootFrame")
|
||||
LAYOUT_ATOM(scrollFrame, "ScrollFrame")
|
||||
LAYOUT_ATOM(tableCaptionFrame, "TableCaptionFrame")
|
||||
LAYOUT_ATOM(tableCellFrame, "TableCellFrame")
|
||||
LAYOUT_ATOM(tableColFrame, "TableColFrame")
|
||||
LAYOUT_ATOM(tableColGroupFrame, "TableColGroupFrame")
|
||||
LAYOUT_ATOM(tableFrame, "TableFrame")
|
||||
LAYOUT_ATOM(tableOuterFrame, "TableOuterFrame")
|
||||
LAYOUT_ATOM(tableRowGroupFrame, "TableRowGroupFrame")
|
||||
LAYOUT_ATOM(tableRowFrame, "TableRowFrame")
|
||||
LAYOUT_ATOM(textInputFrame,"TextInputFrame")
|
||||
LAYOUT_ATOM(textFrame, "TextFrame")
|
||||
LAYOUT_ATOM(viewportFrame, "ViewportFrame")
|
||||
|
||||
// Alphabetical list of frame property names
|
||||
LAYOUT_ATOM(collapseOffsetProperty, "CollapseOffsetProperty") // nsPoint*
|
||||
LAYOUT_ATOM(inlineFrameAnnotation, "InlineFrameAnnotation") // BOOL
|
||||
LAYOUT_ATOM(maxElementSizeProperty, "MaxElementSizeProperty") // nsSize*
|
||||
LAYOUT_ATOM(overflowAreaProperty, "OverflowArea") // nsRect*
|
||||
LAYOUT_ATOM(overflowProperty, "OverflowProperty") // list of nsIFrame*
|
||||
LAYOUT_ATOM(overflowLinesProperty, "OverflowLinesProperty") // list of nsLineBox*
|
||||
LAYOUT_ATOM(spaceManagerProperty, "SpaceManagerProperty") // the space manager for a block
|
||||
LAYOUT_ATOM(viewProperty, "ViewProperty") // nsView*
|
||||
|
||||
// Alphabetical list of event handler names
|
||||
LAYOUT_ATOM(onabort, "onabort")
|
||||
LAYOUT_ATOM(onblur, "onblur")
|
||||
LAYOUT_ATOM(onbroadcast, "onbroadcast")
|
||||
LAYOUT_ATOM(onchange, "onchange")
|
||||
LAYOUT_ATOM(onclick, "onclick")
|
||||
LAYOUT_ATOM(onclose, "onclose")
|
||||
LAYOUT_ATOM(oncommand, "oncommand")
|
||||
LAYOUT_ATOM(oncommandupdate, "oncommandupdate")
|
||||
LAYOUT_ATOM(oncreate, "oncreate")
|
||||
LAYOUT_ATOM(ondblclick, "ondblclick")
|
||||
LAYOUT_ATOM(ondestroy, "ondestroy")
|
||||
LAYOUT_ATOM(ondragdrop, "ondragdrop")
|
||||
LAYOUT_ATOM(ondragenter, "ondragenter")
|
||||
LAYOUT_ATOM(ondragexit, "ondragexit")
|
||||
LAYOUT_ATOM(ondraggesture, "ondraggesture")
|
||||
LAYOUT_ATOM(ondragover, "ondragover")
|
||||
LAYOUT_ATOM(onerror, "onerror")
|
||||
LAYOUT_ATOM(onfocus, "onfocus")
|
||||
LAYOUT_ATOM(oninput, "oninput")
|
||||
LAYOUT_ATOM(onkeydown, "onkeydown")
|
||||
LAYOUT_ATOM(onkeypress, "onkeypress")
|
||||
LAYOUT_ATOM(onkeyup, "onkeyup")
|
||||
LAYOUT_ATOM(onload, "onload")
|
||||
LAYOUT_ATOM(onmousedown, "onmousedown")
|
||||
LAYOUT_ATOM(onmousemove, "onmousemove")
|
||||
LAYOUT_ATOM(onmouseover, "onmouseover")
|
||||
LAYOUT_ATOM(onmouseout, "onmouseout")
|
||||
LAYOUT_ATOM(onmouseup, "onmouseup")
|
||||
LAYOUT_ATOM(onpaint, "onpaint")
|
||||
LAYOUT_ATOM(onreset, "onreset")
|
||||
LAYOUT_ATOM(onresize, "onresize")
|
||||
LAYOUT_ATOM(onscroll, "onscroll")
|
||||
LAYOUT_ATOM(onselect, "onselect")
|
||||
LAYOUT_ATOM(onsubmit, "onsubmit")
|
||||
LAYOUT_ATOM(onunload, "onunload")
|
||||
|
||||
// scrolling
|
||||
LAYOUT_ATOM(onoverflow, "onoverflow")
|
||||
LAYOUT_ATOM(onunderflow, "onunderflow")
|
||||
LAYOUT_ATOM(onoverflowchanged, "onoverflowchanged")
|
||||
|
||||
// mutation events
|
||||
LAYOUT_ATOM(onDOMSubtreeModified, "onDOMSubtreeModified")
|
||||
LAYOUT_ATOM(onDOMNodeInserted, "onDOMNodeInserted")
|
||||
LAYOUT_ATOM(onDOMNodeRemoved, "onDOMNodeRemoved")
|
||||
LAYOUT_ATOM(onDOMNodeRemovedFromDocument, "onDOMNodeRemovedFromDocument")
|
||||
LAYOUT_ATOM(onDOMNodeInsertedIntoDocument, "onDOMNodeInsertedIntoDocument")
|
||||
LAYOUT_ATOM(onDOMAttrModified, "onDOMAttrModified")
|
||||
LAYOUT_ATOM(onDOMCharacterDataModified, "onDOMCharacterDataModified")
|
||||
|
||||
// Alphabetical list of languages for lang-specific transforms
|
||||
LAYOUT_ATOM(Japanese, "ja")
|
||||
LAYOUT_ATOM(Korean, "ko")
|
||||
|
||||
// other
|
||||
LAYOUT_ATOM(wildcard, "*")
|
||||
LAYOUT_ATOM(mozdirty, "_moz_dirty")
|
||||
|
||||
#ifdef DEBUG
|
||||
// Alphabetical list of atoms used by debugging code
|
||||
LAYOUT_ATOM(cellMap, "TableCellMap")
|
||||
LAYOUT_ATOM(imageMap, "ImageMap")
|
||||
LAYOUT_ATOM(lineBoxBig, "LineBox:inline,big")
|
||||
LAYOUT_ATOM(lineBoxBlockBig, "LineBox:block,big")
|
||||
LAYOUT_ATOM(lineBoxBlockSmall, "LineBox:block,small")
|
||||
LAYOUT_ATOM(lineBoxFloaters, "LineBoxFloaters")
|
||||
LAYOUT_ATOM(lineBoxSmall, "LineBox:inline,small")
|
||||
LAYOUT_ATOM(spaceManager, "SpaceManager")
|
||||
LAYOUT_ATOM(tableColCache, "TableColumnCache")
|
||||
LAYOUT_ATOM(tableStrategy, "TableLayoutStrategy")
|
||||
LAYOUT_ATOM(textRun, "TextRun")
|
||||
LAYOUT_ATOM(xml_document_entities, "XMLDocumentEntities")
|
||||
LAYOUT_ATOM(xml_document_notations, "XMLDocumentNotations")
|
||||
#endif
|
||||
52
mozilla/layout/base/public/nsLayoutAtoms.h
Normal file
52
mozilla/layout/base/public/nsLayoutAtoms.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* -*- 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.org 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 nsLayoutAtoms_h___
|
||||
#define nsLayoutAtoms_h___
|
||||
|
||||
#include "nsIAtom.h"
|
||||
|
||||
/**
|
||||
* This class wraps up the creation (and destruction) of the standard
|
||||
* set of atoms used during layout processing. These objects
|
||||
* are created when the first presentation context is created and they
|
||||
* are destroyed when the last presentation context object is destroyed.
|
||||
*/
|
||||
|
||||
class nsLayoutAtoms {
|
||||
public:
|
||||
|
||||
static void AddRefAtoms();
|
||||
static void ReleaseAtoms();
|
||||
|
||||
/* Declare all atoms
|
||||
|
||||
The atom names and values are stored in nsLayoutAtomList.h and
|
||||
are brought to you by the magic of C preprocessing
|
||||
|
||||
Add new atoms to nsLayoutAtomList and all support logic will be auto-generated
|
||||
*/
|
||||
#define LAYOUT_ATOM(_name, _value) static nsIAtom* _name;
|
||||
#include "nsLayoutAtomList.h"
|
||||
#undef LAYOUT_ATOM
|
||||
};
|
||||
|
||||
#endif /* nsLayoutAtoms_h___ */
|
||||
75
mozilla/layout/base/public/nsLayoutUtils.h
Normal file
75
mozilla/layout/base/public/nsLayoutUtils.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- 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 oqr
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code, released
|
||||
* March 31, 1998.
|
||||
*
|
||||
* 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):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU Public License (the "GPL"), in which case the
|
||||
* provisions of the GPL are applicable instead of those above.
|
||||
* If you wish to allow use of your version of this file only
|
||||
* under the terms of the GPL and not to allow others to use your
|
||||
* version of this file under the NPL, indicate your decision by
|
||||
* deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this
|
||||
* file under either the NPL or the GPL.
|
||||
*/
|
||||
|
||||
/* A namespace class for static layout utilities. */
|
||||
|
||||
#ifndef nsLayoutUtils_h___
|
||||
#define nsLayoutUtils_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "jspubtd.h"
|
||||
#include "nsAReadableString.h"
|
||||
|
||||
class nsIScriptContext;
|
||||
class nsIScriptGlobalObject;
|
||||
|
||||
class nsLayoutUtils
|
||||
{
|
||||
public:
|
||||
|
||||
// These are copied from nsJSUtils.h
|
||||
|
||||
static nsresult GetStaticScriptGlobal(JSContext* aContext,
|
||||
JSObject* aObj,
|
||||
nsIScriptGlobalObject** aNativeGlobal);
|
||||
|
||||
static nsresult GetStaticScriptContext(JSContext* aContext,
|
||||
JSObject* aObj,
|
||||
nsIScriptContext** aScriptContext);
|
||||
|
||||
static nsresult GetDynamicScriptGlobal(JSContext *aContext,
|
||||
nsIScriptGlobalObject** aNativeGlobal);
|
||||
|
||||
static nsresult GetDynamicScriptContext(JSContext *aContext,
|
||||
nsIScriptContext** aScriptContext);
|
||||
|
||||
static PRUint32 CopyNewlineNormalizedUnicodeTo(const nsAReadableString& aSource,
|
||||
PRUint32 aSrcOffset,
|
||||
PRUnichar* aDest,
|
||||
PRUint32 aLength);
|
||||
|
||||
static PRUint32 CopyNewlineNormalizedUnicodeTo(nsReadingIterator<PRUnichar>& aSrcStart, const nsReadingIterator<PRUnichar>& aSrcEnd, nsAWritableString& aDest);
|
||||
};
|
||||
|
||||
#endif /* nsLayoutUtils_h___ */
|
||||
66
mozilla/layout/base/public/nsStyleChangeList.h
Normal file
66
mozilla/layout/base/public/nsStyleChangeList.h
Normal file
@@ -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.org 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 nsStyleChangeList_h___
|
||||
#define nsStyleChangeList_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsError.h"
|
||||
class nsIFrame;
|
||||
class nsIContent;
|
||||
|
||||
// XXX would all platforms support putting this inside the list?
|
||||
struct nsStyleChangeData {
|
||||
nsIFrame* mFrame;
|
||||
nsIContent* mContent;
|
||||
PRInt32 mHint;
|
||||
};
|
||||
|
||||
static const PRUint32 kStyleChangeBufferSize = 10;
|
||||
|
||||
class NS_LAYOUT nsStyleChangeList {
|
||||
public:
|
||||
nsStyleChangeList(void);
|
||||
~nsStyleChangeList(void);
|
||||
|
||||
PRInt32 Count(void) const {
|
||||
return mCount;
|
||||
}
|
||||
|
||||
nsresult ChangeAt(PRInt32 aIndex, nsIFrame*& aFrame, nsIContent*& aContent,
|
||||
PRInt32& aHint) const;
|
||||
|
||||
nsresult AppendChange(nsIFrame* aFrame, nsIContent* aContent, PRInt32 aHint);
|
||||
|
||||
void Clear(void);
|
||||
|
||||
protected:
|
||||
nsStyleChangeList& operator=(const nsStyleChangeList& aCopy);
|
||||
PRBool operator==(const nsStyleChangeList& aOther) const;
|
||||
|
||||
nsStyleChangeData* mArray;
|
||||
PRInt32 mArraySize;
|
||||
PRInt32 mCount;
|
||||
nsStyleChangeData mBuffer[kStyleChangeBufferSize];
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsStyleChangeList_h___ */
|
||||
564
mozilla/layout/base/public/nsStyleConsts.h
Normal file
564
mozilla/layout/base/public/nsStyleConsts.h
Normal file
@@ -0,0 +1,564 @@
|
||||
/* -*- 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.org 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 nsStyleConsts_h___
|
||||
#define nsStyleConsts_h___
|
||||
|
||||
#include "nsFont.h"
|
||||
|
||||
// XXX fold this into nsIStyleContext and group by nsStyleXXX struct
|
||||
|
||||
// Defines for various style related constants
|
||||
|
||||
// Style change hints
|
||||
#define NS_STYLE_HINT_UNKNOWN -1
|
||||
#define NS_STYLE_HINT_NONE 0 // change has no impact
|
||||
#define NS_STYLE_HINT_ATTRCHANGE 1 // change should cause notification to frame but nothing else
|
||||
#define NS_STYLE_HINT_AURAL 2 // change was aural
|
||||
#define NS_STYLE_HINT_CONTENT 3 // change was contentual (ie: SRC=)
|
||||
#define NS_STYLE_HINT_VISUAL 4 // change was visual only (ie: COLOR=)
|
||||
#define NS_STYLE_HINT_REFLOW 5 // change requires reflow (ie: WIDTH=)
|
||||
#define NS_STYLE_HINT_FRAMECHANGE 6 // change requires frame change (ie: display:)
|
||||
#define NS_STYLE_HINT_RECONSTRUCT_ALL 7 // change requires reconstruction of entire document (ie: style sheet change)
|
||||
#define NS_STYLE_HINT_MAX NS_STYLE_HINT_RECONSTRUCT_ALL
|
||||
|
||||
// Indicies into border/padding/margin arrays
|
||||
#define NS_SIDE_TOP 0
|
||||
#define NS_SIDE_RIGHT 1
|
||||
#define NS_SIDE_BOTTOM 2
|
||||
#define NS_SIDE_LEFT 3
|
||||
|
||||
|
||||
// box-sizing
|
||||
#define NS_STYLE_BOX_SIZING_CONTENT 0
|
||||
#define NS_STYLE_BOX_SIZING_PADDING 1
|
||||
#define NS_STYLE_BOX_SIZING_BORDER 2
|
||||
|
||||
// float-edge
|
||||
#define NS_STYLE_FLOAT_EDGE_CONTENT 0
|
||||
#define NS_STYLE_FLOAT_EDGE_PADDING 1
|
||||
#define NS_STYLE_FLOAT_EDGE_BORDER 2
|
||||
#define NS_STYLE_FLOAT_EDGE_MARGIN 3
|
||||
|
||||
// key-equivalent
|
||||
#define NS_STYLE_KEY_EQUIVALENT_NONE 0
|
||||
|
||||
// resizer
|
||||
#define NS_STYLE_RESIZER_NONE 0x00
|
||||
#define NS_STYLE_RESIZER_HORIZONTAL 0x01 // bits
|
||||
#define NS_STYLE_RESIZER_VERTICAL 0x02 // bits
|
||||
#define NS_STYLE_RESIZER_BOTH 0x03 // bits
|
||||
#define NS_STYLE_RESIZER_AUTO 0x04 // bits
|
||||
|
||||
// user-focus
|
||||
#define NS_STYLE_USER_FOCUS_NONE 0
|
||||
#define NS_STYLE_USER_FOCUS_IGNORE 1
|
||||
#define NS_STYLE_USER_FOCUS_NORMAL 2
|
||||
#define NS_STYLE_USER_FOCUS_SELECT_ALL 3
|
||||
#define NS_STYLE_USER_FOCUS_SELECT_BEFORE 4
|
||||
#define NS_STYLE_USER_FOCUS_SELECT_AFTER 5
|
||||
#define NS_STYLE_USER_FOCUS_SELECT_SAME 6
|
||||
#define NS_STYLE_USER_FOCUS_SELECT_MENU 7
|
||||
|
||||
// user-select
|
||||
#define NS_STYLE_USER_SELECT_NONE 0
|
||||
#define NS_STYLE_USER_SELECT_TEXT 1
|
||||
#define NS_STYLE_USER_SELECT_ELEMENT 2
|
||||
#define NS_STYLE_USER_SELECT_ELEMENTS 3
|
||||
#define NS_STYLE_USER_SELECT_ALL 4
|
||||
#define NS_STYLE_USER_SELECT_TOGGLE 5
|
||||
#define NS_STYLE_USER_SELECT_TRI_STATE 6
|
||||
#define NS_STYLE_USER_SELECT_AUTO 7 // internal value - please use nsFrame::IsSelectable()
|
||||
#define NS_STYLE_USER_SELECT_MOZ_ALL 8 // force selection of all children - bug 48096
|
||||
|
||||
// user-input
|
||||
#define NS_STYLE_USER_INPUT_NONE 0
|
||||
#define NS_STYLE_USER_INPUT_ENABLED 1
|
||||
#define NS_STYLE_USER_INPUT_DISABLED 2
|
||||
#define NS_STYLE_USER_INPUT_AUTO 3
|
||||
|
||||
// user-modify
|
||||
#define NS_STYLE_USER_MODIFY_READ_ONLY 0
|
||||
#define NS_STYLE_USER_MODIFY_READ_WRITE 1
|
||||
#define NS_STYLE_USER_MODIFY_WRITE_ONLY 2
|
||||
|
||||
|
||||
|
||||
// Azimuth - See nsStyleAural
|
||||
#define NS_STYLE_AZIMUTH_LEFT_SIDE 0x00
|
||||
#define NS_STYLE_AZIMUTH_FAR_LEFT 0x01
|
||||
#define NS_STYLE_AZIMUTH_LEFT 0x02
|
||||
#define NS_STYLE_AZIMUTH_CENTER_LEFT 0x03
|
||||
#define NS_STYLE_AZIMUTH_CENTER 0x04
|
||||
#define NS_STYLE_AZIMUTH_CENTER_RIGHT 0x05
|
||||
#define NS_STYLE_AZIMUTH_RIGHT 0x06
|
||||
#define NS_STYLE_AZIMUTH_FAR_RIGHT 0x07
|
||||
#define NS_STYLE_AZIMUTH_RIGHT_SIDE 0x08
|
||||
#define NS_STYLE_AZIMUTH_BEHIND 0x80 // bits
|
||||
#define NS_STYLE_AZIMUTH_LEFTWARDS 0x10 // bits
|
||||
#define NS_STYLE_AZIMUTH_RIGHTWARDS 0x20 // bits
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_ELEVATION_BELOW 1
|
||||
#define NS_STYLE_ELEVATION_LEVEL 2
|
||||
#define NS_STYLE_ELEVATION_ABOVE 3
|
||||
#define NS_STYLE_ELEVATION_HIGHER 4
|
||||
#define NS_STYLE_ELEVATION_LOWER 5
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_PITCH_X_LOW 1
|
||||
#define NS_STYLE_PITCH_LOW 2
|
||||
#define NS_STYLE_PITCH_MEDIUM 3
|
||||
#define NS_STYLE_PITCH_HIGH 4
|
||||
#define NS_STYLE_PITCH_X_HIGH 5
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_PLAY_DURING_MIX 0x01 // bit field
|
||||
#define NS_STYLE_PLAY_DURING_REPEAT 0x02
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_SPEAK_NONE 0
|
||||
#define NS_STYLE_SPEAK_NORMAL 1
|
||||
#define NS_STYLE_SPEAK_SPELL_OUT 2
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_SPEAK_HEADER_ONCE 0
|
||||
#define NS_STYLE_SPEAK_HEADER_ALWAYS 1
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_SPEAK_NUMERAL_DIGITS 0
|
||||
#define NS_STYLE_SPEAK_NUMERAL_CONTINUOUS 1
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_SPEAK_PUNCTUATION_NONE 0
|
||||
#define NS_STYLE_SPEAK_PUNCTUATION_CODE 1
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_SPEECH_RATE_X_SLOW 0
|
||||
#define NS_STYLE_SPEECH_RATE_SLOW 1
|
||||
#define NS_STYLE_SPEECH_RATE_MEDIUM 2
|
||||
#define NS_STYLE_SPEECH_RATE_FAST 3
|
||||
#define NS_STYLE_SPEECH_RATE_X_FAST 4
|
||||
#define NS_STYLE_SPEECH_RATE_FASTER 10
|
||||
#define NS_STYLE_SPEECH_RATE_SLOWER 11
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_VOLUME_SILENT 0
|
||||
#define NS_STYLE_VOLUME_X_SOFT 1
|
||||
#define NS_STYLE_VOLUME_SOFT 2
|
||||
#define NS_STYLE_VOLUME_MEDIUM 3
|
||||
#define NS_STYLE_VOLUME_LOUD 4
|
||||
#define NS_STYLE_VOLUME_X_LOUD 5
|
||||
|
||||
// See nsStyleColor
|
||||
#define NS_STYLE_BG_ATTACHMENT_SCROLL 0
|
||||
#define NS_STYLE_BG_ATTACHMENT_FIXED 1
|
||||
|
||||
// See nsStyleColor
|
||||
#define NS_STYLE_COLOR_TRANSPARENT 0
|
||||
#define NS_STYLE_COLOR_INVERT 1
|
||||
|
||||
// See nsStyleColor
|
||||
#define NS_STYLE_BG_COLOR_TRANSPARENT 0x01
|
||||
#define NS_STYLE_BG_IMAGE_NONE 0x02
|
||||
#define NS_STYLE_BG_X_POSITION_PERCENT 0x04
|
||||
#define NS_STYLE_BG_X_POSITION_LENGTH 0x08
|
||||
#define NS_STYLE_BG_Y_POSITION_PERCENT 0x10
|
||||
#define NS_STYLE_BG_Y_POSITION_LENGTH 0x20
|
||||
#define NS_STYLE_BG_PROPAGATED_TO_PARENT 0x40 // for the BodyFixupRule
|
||||
#define NS_STYLE_BG_PROPAGATED_FROM_CHILD 0x80 // '' ''
|
||||
|
||||
// See nsStyleColor
|
||||
#define NS_STYLE_BG_REPEAT_OFF 0x00
|
||||
#define NS_STYLE_BG_REPEAT_X 0x01
|
||||
#define NS_STYLE_BG_REPEAT_Y 0x02
|
||||
#define NS_STYLE_BG_REPEAT_XY 0x03
|
||||
|
||||
// See nsStyleTable
|
||||
#define NS_STYLE_BORDER_COLLAPSE 0
|
||||
#define NS_STYLE_BORDER_SEPARATE 1
|
||||
|
||||
// See nsStyleBorder mBorder enum values
|
||||
#define NS_STYLE_BORDER_WIDTH_THIN 0
|
||||
#define NS_STYLE_BORDER_WIDTH_MEDIUM 1
|
||||
#define NS_STYLE_BORDER_WIDTH_THICK 2
|
||||
// XXX chopping block #define NS_STYLE_BORDER_WIDTH_LENGTH_VALUE 3
|
||||
|
||||
// See nsStyleBorder mBorderStyle
|
||||
#define NS_STYLE_BORDER_STYLE_NONE 0
|
||||
#define NS_STYLE_BORDER_STYLE_GROOVE 1
|
||||
#define NS_STYLE_BORDER_STYLE_RIDGE 2
|
||||
#define NS_STYLE_BORDER_STYLE_DOTTED 3
|
||||
#define NS_STYLE_BORDER_STYLE_DASHED 4
|
||||
#define NS_STYLE_BORDER_STYLE_SOLID 5
|
||||
#define NS_STYLE_BORDER_STYLE_DOUBLE 6
|
||||
#define NS_STYLE_BORDER_STYLE_BLANK 7
|
||||
#define NS_STYLE_BORDER_STYLE_INSET 8
|
||||
#define NS_STYLE_BORDER_STYLE_OUTSET 9
|
||||
#define NS_STYLE_BORDER_STYLE_HIDDEN 10
|
||||
#define NS_STYLE_BORDER_STYLE_BG_INSET 11
|
||||
#define NS_STYLE_BORDER_STYLE_BG_OUTSET 12
|
||||
|
||||
// See nsStyleDisplay
|
||||
#define NS_STYLE_CLEAR_NONE 0
|
||||
#define NS_STYLE_CLEAR_LEFT 1
|
||||
#define NS_STYLE_CLEAR_RIGHT 2
|
||||
#define NS_STYLE_CLEAR_LEFT_AND_RIGHT 3
|
||||
#define NS_STYLE_CLEAR_LINE 4
|
||||
#define NS_STYLE_CLEAR_BLOCK 5
|
||||
#define NS_STYLE_CLEAR_COLUMN 6
|
||||
#define NS_STYLE_CLEAR_PAGE 7
|
||||
#define NS_STYLE_CLEAR_LAST_VALUE NS_STYLE_CLEAR_PAGE
|
||||
|
||||
// See
|
||||
#define NS_STYLE_CONTENT_OPEN_QUOTE 0
|
||||
#define NS_STYLE_CONTENT_CLOSE_QUOTE 1
|
||||
#define NS_STYLE_CONTENT_NO_OPEN_QUOTE 2
|
||||
#define NS_STYLE_CONTENT_NO_CLOSE_QUOTE 3
|
||||
|
||||
// See nsStyleColor
|
||||
#define NS_STYLE_CURSOR_AUTO 1
|
||||
#define NS_STYLE_CURSOR_CROSSHAIR 2
|
||||
#define NS_STYLE_CURSOR_DEFAULT 3 // ie: an arrow
|
||||
#define NS_STYLE_CURSOR_POINTER 4 // for links
|
||||
#define NS_STYLE_CURSOR_MOVE 5
|
||||
#define NS_STYLE_CURSOR_E_RESIZE 6
|
||||
#define NS_STYLE_CURSOR_NE_RESIZE 7
|
||||
#define NS_STYLE_CURSOR_NW_RESIZE 8
|
||||
#define NS_STYLE_CURSOR_N_RESIZE 9
|
||||
#define NS_STYLE_CURSOR_SE_RESIZE 10
|
||||
#define NS_STYLE_CURSOR_SW_RESIZE 11
|
||||
#define NS_STYLE_CURSOR_S_RESIZE 12
|
||||
#define NS_STYLE_CURSOR_W_RESIZE 13
|
||||
#define NS_STYLE_CURSOR_TEXT 14 // ie: i-beam
|
||||
#define NS_STYLE_CURSOR_WAIT 15
|
||||
#define NS_STYLE_CURSOR_HELP 16
|
||||
#define NS_STYLE_CURSOR_COPY 17 // CSS3
|
||||
#define NS_STYLE_CURSOR_ALIAS 18
|
||||
#define NS_STYLE_CURSOR_CONTEXT_MENU 19
|
||||
#define NS_STYLE_CURSOR_CELL 20
|
||||
#define NS_STYLE_CURSOR_GRAB 21
|
||||
#define NS_STYLE_CURSOR_GRABBING 22
|
||||
#define NS_STYLE_CURSOR_SPINNING 23
|
||||
#define NS_STYLE_CURSOR_COUNT_UP 24
|
||||
#define NS_STYLE_CURSOR_COUNT_DOWN 25
|
||||
#define NS_STYLE_CURSOR_COUNT_UP_DOWN 26
|
||||
|
||||
|
||||
// See nsStyleDisplay
|
||||
#define NS_STYLE_DIRECTION_LTR 0
|
||||
#define NS_STYLE_DIRECTION_RTL 1
|
||||
#define NS_STYLE_DIRECTION_INHERIT 2
|
||||
|
||||
// See nsStyleDisplay
|
||||
#define NS_STYLE_DISPLAY_NONE 0
|
||||
#define NS_STYLE_DISPLAY_BLOCK 1
|
||||
#define NS_STYLE_DISPLAY_INLINE 2
|
||||
#define NS_STYLE_DISPLAY_INLINE_BLOCK 3
|
||||
#define NS_STYLE_DISPLAY_LIST_ITEM 4
|
||||
#define NS_STYLE_DISPLAY_MARKER 5
|
||||
#define NS_STYLE_DISPLAY_RUN_IN 6
|
||||
#define NS_STYLE_DISPLAY_COMPACT 7
|
||||
#define NS_STYLE_DISPLAY_TABLE 8
|
||||
#define NS_STYLE_DISPLAY_INLINE_TABLE 9
|
||||
#define NS_STYLE_DISPLAY_TABLE_ROW_GROUP 10
|
||||
#define NS_STYLE_DISPLAY_TABLE_COLUMN 11
|
||||
#define NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP 12
|
||||
#define NS_STYLE_DISPLAY_TABLE_HEADER_GROUP 13
|
||||
#define NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP 14
|
||||
#define NS_STYLE_DISPLAY_TABLE_ROW 15
|
||||
#define NS_STYLE_DISPLAY_TABLE_CELL 16
|
||||
#define NS_STYLE_DISPLAY_TABLE_CAPTION 17
|
||||
#define NS_STYLE_DISPLAY_MENU 18
|
||||
|
||||
// See nsStyleDisplay
|
||||
#define NS_STYLE_FLOAT_NONE 0
|
||||
#define NS_STYLE_FLOAT_LEFT 1
|
||||
#define NS_STYLE_FLOAT_RIGHT 2
|
||||
|
||||
// See nsStyleFont
|
||||
#define NS_STYLE_FONT_STYLE_NORMAL 0
|
||||
#define NS_STYLE_FONT_STYLE_ITALIC 1
|
||||
#define NS_STYLE_FONT_STYLE_OBLIQUE 2
|
||||
|
||||
// See nsStyleFont
|
||||
#define NS_STYLE_FONT_VARIANT_NORMAL 0
|
||||
#define NS_STYLE_FONT_VARIANT_SMALL_CAPS 1
|
||||
|
||||
// See nsStyleFont
|
||||
#define NS_STYLE_FONT_WEIGHT_NORMAL 400
|
||||
#define NS_STYLE_FONT_WEIGHT_BOLD 700
|
||||
#define NS_STYLE_FONT_WEIGHT_BOLDER 1
|
||||
#define NS_STYLE_FONT_WEIGHT_LIGHTER -1
|
||||
|
||||
// See nsStyleFont
|
||||
#define NS_STYLE_FONT_SIZE_XXSMALL 0
|
||||
#define NS_STYLE_FONT_SIZE_XSMALL 1
|
||||
#define NS_STYLE_FONT_SIZE_SMALL 2
|
||||
#define NS_STYLE_FONT_SIZE_MEDIUM 3
|
||||
#define NS_STYLE_FONT_SIZE_LARGE 4
|
||||
#define NS_STYLE_FONT_SIZE_XLARGE 5
|
||||
#define NS_STYLE_FONT_SIZE_XXLARGE 6
|
||||
#define NS_STYLE_FONT_SIZE_LARGER 7
|
||||
#define NS_STYLE_FONT_SIZE_SMALLER 8
|
||||
|
||||
// See nsStyleFont
|
||||
#define NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED -4
|
||||
#define NS_STYLE_FONT_STRETCH_EXTRA_CONDENSED -3
|
||||
#define NS_STYLE_FONT_STRETCH_CONDENSED -2
|
||||
#define NS_STYLE_FONT_STRETCH_SEMI_CONDENSED -1
|
||||
#define NS_STYLE_FONT_STRETCH_NORMAL 0
|
||||
#define NS_STYLE_FONT_STRETCH_SEMI_EXPANDED 1
|
||||
#define NS_STYLE_FONT_STRETCH_EXPANDED 2
|
||||
#define NS_STYLE_FONT_STRETCH_EXTRA_EXPANDED 3
|
||||
#define NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED 4
|
||||
#define NS_STYLE_FONT_STRETCH_WIDER 10
|
||||
#define NS_STYLE_FONT_STRETCH_NARROWER -10
|
||||
|
||||
// See nsStyleFont mFlags
|
||||
#define NS_STYLE_FONT_DEFAULT 0x00
|
||||
#define NS_STYLE_FONT_SIZE_EXPLICIT 0x01
|
||||
#define NS_STYLE_FONT_FACE_EXPLICIT 0x02
|
||||
#define NS_STYLE_FONT_USE_FIXED 0x04
|
||||
|
||||
// See nsStyleFont - system fonts
|
||||
#define NS_STYLE_FONT_CAPTION 1 // css2
|
||||
#define NS_STYLE_FONT_ICON 2
|
||||
#define NS_STYLE_FONT_MENU 3
|
||||
#define NS_STYLE_FONT_MESSAGE_BOX 4
|
||||
#define NS_STYLE_FONT_SMALL_CAPTION 5
|
||||
#define NS_STYLE_FONT_STATUS_BAR 6
|
||||
#define NS_STYLE_FONT_WINDOW 7 // css3
|
||||
#define NS_STYLE_FONT_DOCUMENT 8
|
||||
#define NS_STYLE_FONT_WORKSPACE 9
|
||||
#define NS_STYLE_FONT_DESKTOP 10
|
||||
#define NS_STYLE_FONT_INFO 11
|
||||
#define NS_STYLE_FONT_DIALOG 12
|
||||
#define NS_STYLE_FONT_BUTTON 13
|
||||
#define NS_STYLE_FONT_PULL_DOWN_MENU 14
|
||||
#define NS_STYLE_FONT_LIST 15
|
||||
#define NS_STYLE_FONT_FIELD 16
|
||||
|
||||
// See nsStylePosition.mPosition
|
||||
#define NS_STYLE_POSITION_NORMAL 0
|
||||
#define NS_STYLE_POSITION_RELATIVE 1
|
||||
#define NS_STYLE_POSITION_ABSOLUTE 2
|
||||
#define NS_STYLE_POSITION_FIXED 3
|
||||
|
||||
// See nsStylePosition.mClip
|
||||
#define NS_STYLE_CLIP_AUTO 0x00
|
||||
#define NS_STYLE_CLIP_INHERIT 0x01
|
||||
#define NS_STYLE_CLIP_RECT 0x02
|
||||
#define NS_STYLE_CLIP_TYPE_MASK 0x0F
|
||||
#define NS_STYLE_CLIP_LEFT_AUTO 0x10
|
||||
#define NS_STYLE_CLIP_TOP_AUTO 0x20
|
||||
#define NS_STYLE_CLIP_RIGHT_AUTO 0x40
|
||||
#define NS_STYLE_CLIP_BOTTOM_AUTO 0x80
|
||||
|
||||
// FRAME/FRAMESET/IFRAME specific values including backward compatibility. Boolean values with
|
||||
// the same meaning (e.g. 1 & yes) may need to be distinguished for correct mode processing
|
||||
#define NS_STYLE_FRAME_YES 0
|
||||
#define NS_STYLE_FRAME_NO 1
|
||||
#define NS_STYLE_FRAME_0 2
|
||||
#define NS_STYLE_FRAME_1 3
|
||||
#define NS_STYLE_FRAME_ON 4
|
||||
#define NS_STYLE_FRAME_OFF 5
|
||||
#define NS_STYLE_FRAME_AUTO 6
|
||||
#define NS_STYLE_FRAME_SCROLL 7
|
||||
#define NS_STYLE_FRAME_NOSCROLL 8
|
||||
|
||||
// See nsStylePosition.mOverflow
|
||||
#define NS_STYLE_OVERFLOW_VISIBLE 0
|
||||
#define NS_STYLE_OVERFLOW_HIDDEN 1
|
||||
#define NS_STYLE_OVERFLOW_SCROLL 2
|
||||
#define NS_STYLE_OVERFLOW_AUTO 3
|
||||
#define NS_STYLE_OVERFLOW_SCROLLBARS_NONE 4
|
||||
#define NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL 5
|
||||
#define NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL 6
|
||||
|
||||
// See nsStyleList
|
||||
#define NS_STYLE_LIST_STYLE_NONE 0
|
||||
#define NS_STYLE_LIST_STYLE_DISC 1
|
||||
#define NS_STYLE_LIST_STYLE_CIRCLE 2
|
||||
#define NS_STYLE_LIST_STYLE_SQUARE 3
|
||||
#define NS_STYLE_LIST_STYLE_DECIMAL 4
|
||||
#define NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO 5
|
||||
#define NS_STYLE_LIST_STYLE_LOWER_ROMAN 6
|
||||
#define NS_STYLE_LIST_STYLE_UPPER_ROMAN 7
|
||||
#define NS_STYLE_LIST_STYLE_LOWER_GREEK 8
|
||||
#define NS_STYLE_LIST_STYLE_LOWER_ALPHA 9
|
||||
#define NS_STYLE_LIST_STYLE_LOWER_LATIN 9 // == ALPHA
|
||||
#define NS_STYLE_LIST_STYLE_UPPER_ALPHA 10
|
||||
#define NS_STYLE_LIST_STYLE_UPPER_LATIN 10 // == ALPHA
|
||||
#define NS_STYLE_LIST_STYLE_HEBREW 11
|
||||
#define NS_STYLE_LIST_STYLE_ARMENIAN 12
|
||||
#define NS_STYLE_LIST_STYLE_GEORGIAN 13
|
||||
#define NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC 14
|
||||
#define NS_STYLE_LIST_STYLE_HIRAGANA 15
|
||||
#define NS_STYLE_LIST_STYLE_KATAKANA 16
|
||||
#define NS_STYLE_LIST_STYLE_HIRAGANA_IROHA 17
|
||||
#define NS_STYLE_LIST_STYLE_KATAKANA_IROHA 18
|
||||
#define NS_STYLE_LIST_STYLE_OLD_LOWER_ROMAN 19
|
||||
#define NS_STYLE_LIST_STYLE_OLD_UPPER_ROMAN 20
|
||||
#define NS_STYLE_LIST_STYLE_OLD_LOWER_ALPHA 21
|
||||
#define NS_STYLE_LIST_STYLE_OLD_UPPER_ALPHA 22
|
||||
#define NS_STYLE_LIST_STYLE_OLD_DECIMAL 23
|
||||
#define NS_STYLE_LIST_STYLE_CJK_HEAVENLY_STEM 24
|
||||
#define NS_STYLE_LIST_STYLE_CJK_EARTHLY_BRANCH 25
|
||||
#define NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL 26
|
||||
#define NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL 27
|
||||
#define NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL 28
|
||||
#define NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL 29
|
||||
#define NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL 30
|
||||
#define NS_STYLE_LIST_STYLE_JAPANESE_FORMAL 31
|
||||
#define NS_STYLE_LIST_STYLE_ARABIC_INDIC 32
|
||||
#define NS_STYLE_LIST_STYLE_PERSIAN 33
|
||||
#define NS_STYLE_LIST_STYLE_URDU 34
|
||||
#define NS_STYLE_LIST_STYLE_DEVANAGARI 35
|
||||
#define NS_STYLE_LIST_STYLE_GURMUKHI 36
|
||||
#define NS_STYLE_LIST_STYLE_GUJARATI 37
|
||||
#define NS_STYLE_LIST_STYLE_ORIYA 38
|
||||
#define NS_STYLE_LIST_STYLE_KANNADA 39
|
||||
#define NS_STYLE_LIST_STYLE_MALAYALAM 40
|
||||
#define NS_STYLE_LIST_STYLE_BENGALI 41
|
||||
#define NS_STYLE_LIST_STYLE_TAMIL 42
|
||||
#define NS_STYLE_LIST_STYLE_TELUGU 43
|
||||
#define NS_STYLE_LIST_STYLE_THAI 44
|
||||
#define NS_STYLE_LIST_STYLE_LAO 45
|
||||
#define NS_STYLE_LIST_STYLE_MYANMAR 46
|
||||
#define NS_STYLE_LIST_STYLE_KHMER 47
|
||||
#define NS_STYLE_LIST_STYLE_BASIC 100 // not in css
|
||||
|
||||
// See nsStyleList
|
||||
#define NS_STYLE_LIST_STYLE_POSITION_INSIDE 0
|
||||
#define NS_STYLE_LIST_STYLE_POSITION_OUTSIDE 1
|
||||
|
||||
// See nsStyleMargin
|
||||
#define NS_STYLE_MARGIN_SIZE_AUTO 0
|
||||
|
||||
// See nsStyleText
|
||||
//
|
||||
// Note: make sure the numbers are less than the numbers that start
|
||||
// the vertical_align values below!
|
||||
#define NS_STYLE_TEXT_ALIGN_DEFAULT 0
|
||||
#define NS_STYLE_TEXT_ALIGN_LEFT 1
|
||||
#define NS_STYLE_TEXT_ALIGN_RIGHT 2
|
||||
#define NS_STYLE_TEXT_ALIGN_CENTER 3
|
||||
#define NS_STYLE_TEXT_ALIGN_JUSTIFY 4
|
||||
#define NS_STYLE_TEXT_ALIGN_CHAR 5 //align based on a certain character, for table cell
|
||||
#define NS_STYLE_TEXT_ALIGN_MOZ_CENTER 6
|
||||
#define NS_STYLE_TEXT_ALIGN_MOZ_RIGHT 7
|
||||
|
||||
// See nsStyleText, nsStyleFont
|
||||
#define NS_STYLE_TEXT_DECORATION_NONE 0
|
||||
#define NS_STYLE_TEXT_DECORATION_UNDERLINE NS_FONT_DECORATION_UNDERLINE
|
||||
#define NS_STYLE_TEXT_DECORATION_OVERLINE NS_FONT_DECORATION_OVERLINE
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_THROUGH NS_FONT_DECORATION_LINE_THROUGH
|
||||
#define NS_STYLE_TEXT_DECORATION_BLINK 0x8
|
||||
|
||||
// See nsStyleText
|
||||
#define NS_STYLE_TEXT_TRANSFORM_NONE 0
|
||||
#define NS_STYLE_TEXT_TRANSFORM_CAPITALIZE 1
|
||||
#define NS_STYLE_TEXT_TRANSFORM_LOWERCASE 2
|
||||
#define NS_STYLE_TEXT_TRANSFORM_UPPERCASE 3
|
||||
|
||||
// See nsStyleText
|
||||
// Note: these values pickup after the text-align values because there
|
||||
// are a few html cases where an object can have both types of
|
||||
// alignment applied with a single attribute
|
||||
#define NS_STYLE_VERTICAL_ALIGN_BASELINE 10
|
||||
#define NS_STYLE_VERTICAL_ALIGN_SUB 11
|
||||
#define NS_STYLE_VERTICAL_ALIGN_SUPER 12
|
||||
#define NS_STYLE_VERTICAL_ALIGN_TOP 13
|
||||
#define NS_STYLE_VERTICAL_ALIGN_TEXT_TOP 14
|
||||
#define NS_STYLE_VERTICAL_ALIGN_MIDDLE 15
|
||||
#define NS_STYLE_VERTICAL_ALIGN_TEXT_BOTTOM 16
|
||||
#define NS_STYLE_VERTICAL_ALIGN_BOTTOM 17
|
||||
|
||||
// See nsStyleDisplay
|
||||
#define NS_STYLE_VISIBILITY_HIDDEN 0
|
||||
#define NS_STYLE_VISIBILITY_VISIBLE 1
|
||||
#define NS_STYLE_VISIBILITY_COLLAPSE 2
|
||||
|
||||
// See nsStyleText
|
||||
#define NS_STYLE_WHITESPACE_NORMAL 0
|
||||
#define NS_STYLE_WHITESPACE_PRE 1
|
||||
#define NS_STYLE_WHITESPACE_NOWRAP 2
|
||||
#define NS_STYLE_WHITESPACE_MOZ_PRE_WRAP 3
|
||||
|
||||
// See nsStyleText
|
||||
#define NS_STYLE_UNICODE_BIDI_NORMAL 0
|
||||
#define NS_STYLE_UNICODE_BIDI_EMBED 1
|
||||
#define NS_STYLE_UNICODE_BIDI_OVERRIDE 2
|
||||
|
||||
// See nsStyleTable (here for HTML 4.0 for now, should probably change to side flags)
|
||||
#define NS_STYLE_TABLE_FRAME_NONE 0
|
||||
#define NS_STYLE_TABLE_FRAME_ABOVE 1
|
||||
#define NS_STYLE_TABLE_FRAME_BELOW 2
|
||||
#define NS_STYLE_TABLE_FRAME_HSIDES 3
|
||||
#define NS_STYLE_TABLE_FRAME_VSIDES 4
|
||||
#define NS_STYLE_TABLE_FRAME_LEFT 5
|
||||
#define NS_STYLE_TABLE_FRAME_RIGHT 6
|
||||
#define NS_STYLE_TABLE_FRAME_BOX 7
|
||||
#define NS_STYLE_TABLE_FRAME_BORDER 8
|
||||
|
||||
// See nsStyleTable
|
||||
#define NS_STYLE_TABLE_RULES_NONE 0
|
||||
#define NS_STYLE_TABLE_RULES_GROUPS 1
|
||||
#define NS_STYLE_TABLE_RULES_ROWS 2
|
||||
#define NS_STYLE_TABLE_RULES_COLS 3
|
||||
#define NS_STYLE_TABLE_RULES_ALL 4
|
||||
|
||||
#define NS_STYLE_TABLE_COLS_NONE (-1)
|
||||
#define NS_STYLE_TABLE_COLS_ALL PRInt32(1 << 30)
|
||||
|
||||
#define NS_STYLE_TABLE_LAYOUT_AUTO 0
|
||||
#define NS_STYLE_TABLE_LAYOUT_FIXED 1
|
||||
|
||||
#define NS_STYLE_TABLE_EMPTY_CELLS_HIDE 0
|
||||
#define NS_STYLE_TABLE_EMPTY_CELLS_SHOW 1
|
||||
|
||||
// CAPTION_SIDE uses NS_SIDE_*
|
||||
|
||||
// constants for cell "scope" attribute
|
||||
#define NS_STYLE_CELL_SCOPE_ROW 0
|
||||
#define NS_STYLE_CELL_SCOPE_COL 1
|
||||
#define NS_STYLE_CELL_SCOPE_ROWGROUP 2
|
||||
#define NS_STYLE_CELL_SCOPE_COLGROUP 3
|
||||
|
||||
// See nsStylePage
|
||||
#define NS_STYLE_PAGE_MARKS_NONE 0x00
|
||||
#define NS_STYLE_PAGE_MARKS_CROP 0x01
|
||||
#define NS_STYLE_PAGE_MARKS_REGISTER 0x02
|
||||
|
||||
// See nsStylePage
|
||||
#define NS_STYLE_PAGE_SIZE_AUTO 0
|
||||
#define NS_STYLE_PAGE_SIZE_PORTRAIT 1
|
||||
#define NS_STYLE_PAGE_SIZE_LANDSCAPE 2
|
||||
|
||||
// See nsStyleBreaks
|
||||
#define NS_STYLE_PAGE_BREAK_AUTO 0
|
||||
#define NS_STYLE_PAGE_BREAK_ALWAYS 1
|
||||
#define NS_STYLE_PAGE_BREAK_AVOID 2
|
||||
#define NS_STYLE_PAGE_BREAK_LEFT 3
|
||||
#define NS_STYLE_PAGE_BREAK_RIGHT 4
|
||||
|
||||
#endif /* nsStyleConsts_h___ */
|
||||
458
mozilla/layout/base/public/nsStyleCoord.h
Normal file
458
mozilla/layout/base/public/nsStyleCoord.h
Normal file
@@ -0,0 +1,458 @@
|
||||
/* -*- 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.org 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 nsStyleCoord_h___
|
||||
#define nsStyleCoord_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsString.h"
|
||||
|
||||
enum nsStyleUnit {
|
||||
eStyleUnit_Null = 0, // (no value) value is not specified
|
||||
eStyleUnit_Normal = 1, // (no value)
|
||||
eStyleUnit_Auto = 2, // (no value)
|
||||
eStyleUnit_Inherit = 3, // (no value) value should be inherited
|
||||
eStyleUnit_Percent = 10, // (float) 1.0 == 100%
|
||||
eStyleUnit_Factor = 11, // (float) a multiplier
|
||||
eStyleUnit_Coord = 20, // (nscoord) value is twips
|
||||
eStyleUnit_Integer = 30, // (int) value is simple integer
|
||||
eStyleUnit_Proportional = 31, // (int) value has proportional meaning
|
||||
eStyleUnit_Enumerated = 32, // (int) value has enumerated meaning
|
||||
eStyleUnit_Chars = 33 // (int) value is number of characters
|
||||
};
|
||||
|
||||
typedef union {
|
||||
PRInt32 mInt; // nscoord is a PRInt32 for now
|
||||
float mFloat;
|
||||
} nsStyleUnion;
|
||||
|
||||
class nsStyleCoord {
|
||||
public:
|
||||
nsStyleCoord(nsStyleUnit aUnit = eStyleUnit_Null)
|
||||
: mUnit(aUnit) {
|
||||
NS_ASSERTION(aUnit < eStyleUnit_Percent, "not a valueless unit");
|
||||
if (aUnit >= eStyleUnit_Percent) {
|
||||
mUnit = eStyleUnit_Null;
|
||||
}
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
|
||||
nsStyleCoord(nscoord aValue)
|
||||
: mUnit(eStyleUnit_Coord) {
|
||||
mValue.mInt = aValue;
|
||||
}
|
||||
|
||||
nsStyleCoord(PRInt32 aValue, nsStyleUnit aUnit)
|
||||
: mUnit(aUnit) {
|
||||
//if you want to pass in eStyleUnit_Coord, don't. instead, use the
|
||||
//constructor just above this one... MMP
|
||||
NS_ASSERTION((aUnit == eStyleUnit_Proportional) ||
|
||||
(aUnit == eStyleUnit_Enumerated) ||
|
||||
(aUnit == eStyleUnit_Integer), "not an int value");
|
||||
if ((aUnit == eStyleUnit_Proportional) ||
|
||||
(aUnit == eStyleUnit_Enumerated) ||
|
||||
(aUnit == eStyleUnit_Integer)) {
|
||||
mValue.mInt = aValue;
|
||||
}
|
||||
else {
|
||||
mUnit = eStyleUnit_Null;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
nsStyleCoord(float aValue, nsStyleUnit aUnit)
|
||||
: mUnit(aUnit) {
|
||||
NS_ASSERTION((aUnit == eStyleUnit_Percent) ||
|
||||
(aUnit == eStyleUnit_Factor), "not a float value");
|
||||
if ((aUnit == eStyleUnit_Percent) ||
|
||||
(aUnit == eStyleUnit_Factor)) {
|
||||
mValue.mFloat = aValue;
|
||||
}
|
||||
else {
|
||||
mUnit = eStyleUnit_Null;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
nsStyleCoord(const nsStyleCoord& aCopy)
|
||||
: mUnit(aCopy.mUnit) {
|
||||
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
|
||||
mValue.mFloat = aCopy.mValue.mFloat;
|
||||
}
|
||||
else {
|
||||
mValue.mInt = aCopy.mValue.mInt;
|
||||
}
|
||||
}
|
||||
|
||||
nsStyleCoord& operator=(const nsStyleCoord& aCopy) {
|
||||
mUnit = aCopy.mUnit;
|
||||
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
|
||||
mValue.mFloat = aCopy.mValue.mFloat;
|
||||
}
|
||||
else {
|
||||
mValue.mInt = aCopy.mValue.mInt;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
PRBool operator==(const nsStyleCoord& aOther) const {
|
||||
if (mUnit == aOther.mUnit) {
|
||||
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
|
||||
return PRBool(mValue.mFloat == aOther.mValue.mFloat);
|
||||
}
|
||||
else {
|
||||
return PRBool(mValue.mInt == aOther.mValue.mInt);
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool operator!=(const nsStyleCoord& aOther) const;
|
||||
|
||||
nsStyleUnit GetUnit(void) const { return mUnit; }
|
||||
nscoord GetCoordValue(void) const;
|
||||
PRInt32 GetIntValue(void) const;
|
||||
float GetPercentValue(void) const;
|
||||
float GetFactorValue(void) const;
|
||||
void GetUnionValue(nsStyleUnion& aValue) const;
|
||||
|
||||
void Reset(void) {
|
||||
mUnit = eStyleUnit_Null;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
|
||||
void SetCoordValue(nscoord aValue) {
|
||||
mUnit = eStyleUnit_Coord;
|
||||
mValue.mInt = aValue;
|
||||
}
|
||||
|
||||
void SetIntValue(PRInt32 aValue, nsStyleUnit aUnit) {
|
||||
if ((aUnit == eStyleUnit_Proportional) ||
|
||||
(aUnit == eStyleUnit_Enumerated) ||
|
||||
(aUnit == eStyleUnit_Chars) ||
|
||||
(aUnit == eStyleUnit_Integer)) {
|
||||
mUnit = aUnit;
|
||||
mValue.mInt = aValue;
|
||||
}
|
||||
else {
|
||||
NS_WARNING("not an int value");
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
|
||||
void SetPercentValue(float aValue) {
|
||||
mUnit = eStyleUnit_Percent;
|
||||
mValue.mFloat = aValue;
|
||||
}
|
||||
|
||||
void SetFactorValue(float aValue) {
|
||||
mUnit = eStyleUnit_Factor;
|
||||
mValue.mFloat = aValue;
|
||||
}
|
||||
|
||||
void SetNormalValue(void) {
|
||||
mUnit = eStyleUnit_Normal;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
|
||||
void SetAutoValue(void) {
|
||||
mUnit = eStyleUnit_Auto;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
|
||||
void SetInheritValue(void) {
|
||||
mUnit = eStyleUnit_Inherit;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
|
||||
void SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit) {
|
||||
mUnit = aUnit;
|
||||
#if PR_BYTES_PER_INT == PR_BYTES_PER_FLOAT
|
||||
mValue.mInt = aValue.mInt;
|
||||
#else
|
||||
nsCRT::memcpy(&mValue, &aValue, sizeof(nsStyleUnion));
|
||||
#endif
|
||||
}
|
||||
|
||||
void AppendToString(nsString& aBuffer) const {
|
||||
if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) {
|
||||
aBuffer.AppendFloat(mValue.mFloat);
|
||||
}
|
||||
else if ((eStyleUnit_Coord == mUnit) ||
|
||||
(eStyleUnit_Proportional == mUnit) ||
|
||||
(eStyleUnit_Enumerated == mUnit) ||
|
||||
(eStyleUnit_Integer == mUnit)) {
|
||||
aBuffer.AppendInt(mValue.mInt, 10);
|
||||
aBuffer.AppendWithConversion("[0x");
|
||||
aBuffer.AppendInt(mValue.mInt, 16);
|
||||
aBuffer.AppendWithConversion(']');
|
||||
}
|
||||
|
||||
switch (mUnit) {
|
||||
case eStyleUnit_Null: aBuffer.AppendWithConversion("Null"); break;
|
||||
case eStyleUnit_Coord: aBuffer.AppendWithConversion("tw"); break;
|
||||
case eStyleUnit_Percent: aBuffer.AppendWithConversion("%"); break;
|
||||
case eStyleUnit_Factor: aBuffer.AppendWithConversion("f"); break;
|
||||
case eStyleUnit_Normal: aBuffer.AppendWithConversion("Normal"); break;
|
||||
case eStyleUnit_Auto: aBuffer.AppendWithConversion("Auto"); break;
|
||||
case eStyleUnit_Inherit: aBuffer.AppendWithConversion("Inherit"); break;
|
||||
case eStyleUnit_Proportional: aBuffer.AppendWithConversion("*"); break;
|
||||
case eStyleUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break;
|
||||
case eStyleUnit_Integer: aBuffer.AppendWithConversion("int"); break;
|
||||
case eStyleUnit_Chars: aBuffer.AppendWithConversion("chars"); break;
|
||||
}
|
||||
aBuffer.AppendWithConversion(' ');
|
||||
}
|
||||
|
||||
void ToString(nsString& aBuffer) const {
|
||||
aBuffer.Truncate();
|
||||
AppendToString(aBuffer);
|
||||
}
|
||||
|
||||
public:
|
||||
nsStyleUnit mUnit;
|
||||
nsStyleUnion mValue;
|
||||
};
|
||||
|
||||
|
||||
#define COMPARE_SIDE(side) \
|
||||
if ((eStyleUnit_Percent <= m##side##Unit) && \
|
||||
(m##side##Unit < eStyleUnit_Coord)) { \
|
||||
if (m##side##Value.mFloat != aOther.m##side##Value.mFloat) \
|
||||
return PR_FALSE; \
|
||||
} \
|
||||
else { \
|
||||
if (m##side##Value.mInt != aOther.m##side##Value.mInt) \
|
||||
return PR_FALSE; \
|
||||
}
|
||||
|
||||
class nsStyleSides {
|
||||
public:
|
||||
nsStyleSides(void) {
|
||||
nsCRT::memset(this, 0x00, sizeof(nsStyleSides));
|
||||
}
|
||||
|
||||
// nsStyleSides& operator=(const nsStyleSides& aCopy); // use compiler's version
|
||||
PRBool operator==(const nsStyleSides& aOther) const {
|
||||
if ((mLeftUnit == aOther.mLeftUnit) &&
|
||||
(mTopUnit == aOther.mTopUnit) &&
|
||||
(mRightUnit == aOther.mRightUnit) &&
|
||||
(mBottomUnit == aOther.mBottomUnit)) {
|
||||
COMPARE_SIDE(Left);
|
||||
COMPARE_SIDE(Top);
|
||||
COMPARE_SIDE(Right);
|
||||
COMPARE_SIDE(Bottom);
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool operator!=(const nsStyleSides& aOther) const;
|
||||
|
||||
nsStyleUnit GetLeftUnit(void) const;
|
||||
nsStyleUnit GetTopUnit(void) const;
|
||||
nsStyleUnit GetRightUnit(void) const;
|
||||
nsStyleUnit GetBottomUnit(void) const;
|
||||
|
||||
nsStyleCoord& GetLeft(nsStyleCoord& aCoord) const;
|
||||
nsStyleCoord& GetTop(nsStyleCoord& aCoord) const;
|
||||
nsStyleCoord& GetRight(nsStyleCoord& aCoord) const;
|
||||
nsStyleCoord& GetBottom(nsStyleCoord& aCoord) const;
|
||||
|
||||
void Reset(void) {
|
||||
nsCRT::memset(this, 0x00, sizeof(nsStyleSides));
|
||||
}
|
||||
|
||||
void SetLeft(const nsStyleCoord& aCoord);
|
||||
void SetTop(const nsStyleCoord& aCoord);
|
||||
void SetRight(const nsStyleCoord& aCoord);
|
||||
void SetBottom(const nsStyleCoord& aCoord);
|
||||
|
||||
void AppendToString(nsString& aBuffer) const {
|
||||
nsStyleCoord temp;
|
||||
|
||||
GetLeft(temp);
|
||||
aBuffer.AppendWithConversion("left: ");
|
||||
temp.AppendToString(aBuffer);
|
||||
|
||||
GetTop(temp);
|
||||
aBuffer.AppendWithConversion("top: ");
|
||||
temp.AppendToString(aBuffer);
|
||||
|
||||
GetRight(temp);
|
||||
aBuffer.AppendWithConversion("right: ");
|
||||
temp.AppendToString(aBuffer);
|
||||
|
||||
GetBottom(temp);
|
||||
aBuffer.AppendWithConversion("bottom: ");
|
||||
temp.AppendToString(aBuffer);
|
||||
}
|
||||
|
||||
void ToString(nsString& aBuffer) const {
|
||||
aBuffer.Truncate();
|
||||
AppendToString(aBuffer);
|
||||
}
|
||||
|
||||
protected:
|
||||
PRUint8 mLeftUnit;
|
||||
PRUint8 mTopUnit;
|
||||
PRUint8 mRightUnit;
|
||||
PRUint8 mBottomUnit;
|
||||
nsStyleUnion mLeftValue;
|
||||
nsStyleUnion mTopValue;
|
||||
nsStyleUnion mRightValue;
|
||||
nsStyleUnion mBottomValue;
|
||||
};
|
||||
|
||||
// -------------------------
|
||||
// nsStyleCoord inlines
|
||||
//
|
||||
inline PRBool nsStyleCoord::operator!=(const nsStyleCoord& aOther) const
|
||||
{
|
||||
return PRBool(! ((*this) == aOther));
|
||||
}
|
||||
|
||||
inline PRInt32 nsStyleCoord::GetCoordValue(void) const
|
||||
{
|
||||
NS_ASSERTION((mUnit == eStyleUnit_Coord), "not a coord value");
|
||||
if (mUnit == eStyleUnit_Coord) {
|
||||
return mValue.mInt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline PRInt32 nsStyleCoord::GetIntValue(void) const
|
||||
{
|
||||
NS_ASSERTION((mUnit == eStyleUnit_Proportional) ||
|
||||
(mUnit == eStyleUnit_Enumerated) ||
|
||||
(mUnit == eStyleUnit_Chars) ||
|
||||
(mUnit == eStyleUnit_Integer), "not an int value");
|
||||
if ((mUnit == eStyleUnit_Proportional) ||
|
||||
(mUnit == eStyleUnit_Enumerated) ||
|
||||
(mUnit == eStyleUnit_Chars) ||
|
||||
(mUnit == eStyleUnit_Integer)) {
|
||||
return mValue.mInt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline float nsStyleCoord::GetPercentValue(void) const
|
||||
{
|
||||
NS_ASSERTION(mUnit == eStyleUnit_Percent, "not a percent value");
|
||||
if (mUnit == eStyleUnit_Percent) {
|
||||
return mValue.mFloat;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline float nsStyleCoord::GetFactorValue(void) const
|
||||
{
|
||||
NS_ASSERTION(mUnit == eStyleUnit_Factor, "not a factor value");
|
||||
if (mUnit == eStyleUnit_Factor) {
|
||||
return mValue.mFloat;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline void nsStyleCoord::GetUnionValue(nsStyleUnion& aValue) const
|
||||
{
|
||||
nsCRT::memcpy(&aValue, &mValue, sizeof(nsStyleUnion));
|
||||
}
|
||||
|
||||
// -------------------------
|
||||
// nsStyleSides inlines
|
||||
//
|
||||
inline PRBool nsStyleSides::operator!=(const nsStyleSides& aOther) const
|
||||
{
|
||||
return PRBool(! ((*this) == aOther));
|
||||
}
|
||||
|
||||
inline nsStyleUnit nsStyleSides::GetLeftUnit(void) const
|
||||
{
|
||||
return (nsStyleUnit)mLeftUnit;
|
||||
}
|
||||
|
||||
inline nsStyleUnit nsStyleSides::GetTopUnit(void) const
|
||||
{
|
||||
return (nsStyleUnit)mTopUnit;
|
||||
}
|
||||
|
||||
inline nsStyleUnit nsStyleSides::GetRightUnit(void) const
|
||||
{
|
||||
return (nsStyleUnit)mRightUnit;
|
||||
}
|
||||
|
||||
inline nsStyleUnit nsStyleSides::GetBottomUnit(void) const
|
||||
{
|
||||
return (nsStyleUnit)mBottomUnit;
|
||||
}
|
||||
|
||||
inline nsStyleCoord& nsStyleSides::GetLeft(nsStyleCoord& aCoord) const
|
||||
{
|
||||
aCoord.SetUnionValue(mLeftValue, (nsStyleUnit)mLeftUnit);
|
||||
return aCoord;
|
||||
}
|
||||
|
||||
inline nsStyleCoord& nsStyleSides::GetTop(nsStyleCoord& aCoord) const
|
||||
{
|
||||
aCoord.SetUnionValue(mTopValue, (nsStyleUnit)mTopUnit);
|
||||
return aCoord;
|
||||
}
|
||||
|
||||
inline nsStyleCoord& nsStyleSides::GetRight(nsStyleCoord& aCoord) const
|
||||
{
|
||||
aCoord.SetUnionValue(mRightValue, (nsStyleUnit)mRightUnit);
|
||||
return aCoord;
|
||||
}
|
||||
|
||||
inline nsStyleCoord& nsStyleSides::GetBottom(nsStyleCoord& aCoord) const
|
||||
{
|
||||
aCoord.SetUnionValue(mBottomValue, (nsStyleUnit)mBottomUnit);
|
||||
return aCoord;
|
||||
}
|
||||
|
||||
inline void nsStyleSides::SetLeft(const nsStyleCoord& aCoord)
|
||||
{
|
||||
mLeftUnit = aCoord.GetUnit();
|
||||
aCoord.GetUnionValue(mLeftValue);
|
||||
}
|
||||
|
||||
inline void nsStyleSides::SetTop(const nsStyleCoord& aCoord)
|
||||
{
|
||||
mTopUnit = aCoord.GetUnit();
|
||||
aCoord.GetUnionValue(mTopValue);
|
||||
}
|
||||
|
||||
inline void nsStyleSides::SetRight(const nsStyleCoord& aCoord)
|
||||
{
|
||||
mRightUnit = aCoord.GetUnit();
|
||||
aCoord.GetUnionValue(mRightValue);
|
||||
}
|
||||
|
||||
inline void nsStyleSides::SetBottom(const nsStyleCoord& aCoord)
|
||||
{
|
||||
mBottomUnit = aCoord.GetUnit();
|
||||
aCoord.GetUnionValue(mBottomValue);
|
||||
}
|
||||
|
||||
#endif /* nsStyleCoord_h___ */
|
||||
52
mozilla/layout/base/public/nsStyleStruct.h
Normal file
52
mozilla/layout/base/public/nsStyleStruct.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* -*- 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.org 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 nsStyleStruct_h___
|
||||
#define nsStyleStruct_h___
|
||||
|
||||
enum nsStyleStructID {
|
||||
eStyleStruct_Font = 1,
|
||||
eStyleStruct_Color = 2,
|
||||
eStyleStruct_List = 3,
|
||||
eStyleStruct_Position = 4,
|
||||
eStyleStruct_Text = 5,
|
||||
eStyleStruct_Display = 6,
|
||||
eStyleStruct_Table = 7,
|
||||
eStyleStruct_Content = 8,
|
||||
eStyleStruct_UserInterface = 9,
|
||||
eStyleStruct_Print = 10,
|
||||
eStyleStruct_Margin = 11,
|
||||
eStyleStruct_Padding = 12,
|
||||
eStyleStruct_Border = 13,
|
||||
eStyleStruct_Outline = 14,
|
||||
|
||||
eStyleStruct_Max = eStyleStruct_Outline,
|
||||
|
||||
eStyleStruct_BorderPaddingShortcut = 15 // only for use in GetStyle()
|
||||
};
|
||||
|
||||
|
||||
struct nsStyleStruct {
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsStyleStruct_h___ */
|
||||
|
||||
242
mozilla/layout/base/public/nsTextFragment.h
Normal file
242
mozilla/layout/base/public/nsTextFragment.h
Normal file
@@ -0,0 +1,242 @@
|
||||
/* -*- 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 nsTextFragment_h___
|
||||
#define nsTextFragment_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsAWritableString.h"
|
||||
class nsString;
|
||||
|
||||
// XXX should this normalize the code to keep a \u0000 at the end?
|
||||
|
||||
// XXX nsTextFragmentPool?
|
||||
|
||||
// XXX these need I18N spankage
|
||||
#define XP_IS_SPACE(_ch) \
|
||||
(((_ch) == ' ') || ((_ch) == '\t') || ((_ch) == '\n'))
|
||||
|
||||
#define XP_IS_UPPERCASE(_ch) \
|
||||
(((_ch) >= 'A') && ((_ch) <= 'Z'))
|
||||
|
||||
#define XP_IS_LOWERCASE(_ch) \
|
||||
(((_ch) >= 'a') && ((_ch) <= 'z'))
|
||||
|
||||
#define XP_TO_LOWER(_ch) ((_ch) | 32)
|
||||
|
||||
#define XP_TO_UPPER(_ch) ((_ch) & ~32)
|
||||
|
||||
#define XP_IS_SPACE_W XP_IS_SPACE
|
||||
|
||||
/**
|
||||
* A fragment of text. If mIs2b is 1 then the m2b pointer is valid
|
||||
* otherwise the m1b pointer is valid. If m1b is used then each byte
|
||||
* of data represents a single ucs2 character with the high byte being
|
||||
* zero.
|
||||
*
|
||||
* This class does not have a virtual destructor therefore it is not
|
||||
* meant to be subclassed.
|
||||
*/
|
||||
class NS_LAYOUT nsTextFragment {
|
||||
public:
|
||||
/**
|
||||
* Default constructor. Initialize the fragment to be empty.
|
||||
*/
|
||||
nsTextFragment() {
|
||||
m1b = nsnull;
|
||||
mAllBits = 0;
|
||||
}
|
||||
|
||||
~nsTextFragment();
|
||||
|
||||
/**
|
||||
* Initialize the contents of this fragment to be a copy of
|
||||
* the argument fragment.
|
||||
*/
|
||||
nsTextFragment(const nsTextFragment& aOther);
|
||||
|
||||
/**
|
||||
* Initialize the contents of this fragment to be a copy of
|
||||
* the argument 7bit ascii string.
|
||||
*/
|
||||
nsTextFragment(const char* aString);
|
||||
|
||||
/**
|
||||
* Initialize the contents of this fragment to be a copy of
|
||||
* the argument ucs2 string.
|
||||
*/
|
||||
nsTextFragment(const PRUnichar* aString);
|
||||
|
||||
/**
|
||||
* Initialize the contents of this fragment to be a copy of
|
||||
* the argument string.
|
||||
*/
|
||||
nsTextFragment(const nsString& aString);
|
||||
|
||||
/**
|
||||
* Change the contents of this fragment to be a copy of the
|
||||
* the argument fragment.
|
||||
*/
|
||||
nsTextFragment& operator=(const nsTextFragment& aOther);
|
||||
|
||||
/**
|
||||
* Change the contents of this fragment to be a copy of the
|
||||
* the argument 7bit ascii string.
|
||||
*/
|
||||
nsTextFragment& operator=(const char* aString);
|
||||
|
||||
/**
|
||||
* Change the contents of this fragment to be a copy of the
|
||||
* the argument ucs2 string.
|
||||
*/
|
||||
nsTextFragment& operator=(const PRUnichar* aString);
|
||||
|
||||
/**
|
||||
* Change the contents of this fragment to be a copy of the
|
||||
* the argument string.
|
||||
*/
|
||||
nsTextFragment& operator=(const nsAReadableString& aString);
|
||||
|
||||
/**
|
||||
* Return PR_TRUE if this fragment is represented by PRUnichar data
|
||||
*/
|
||||
PRBool Is2b() const {
|
||||
return mState.mIs2b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pointer to constant PRUnichar data.
|
||||
*/
|
||||
const PRUnichar* Get2b() const {
|
||||
NS_ASSERTION(Is2b(), "not 2b text");
|
||||
return m2b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pointer to constant char data.
|
||||
*/
|
||||
const char* Get1b() const {
|
||||
NS_ASSERTION(!Is2b(), "not 1b text");
|
||||
return (const char*) m1b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the length of the fragment. The length is the number of logical
|
||||
* characters, not the number of bytes to store the characters.
|
||||
*/
|
||||
PRInt32 GetLength() const {
|
||||
return PRInt32(mState.mLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mutable version of Get2b. Only works for a non-const object.
|
||||
* Returns a pointer to the PRUnichar data.
|
||||
*/
|
||||
PRUnichar* Get2b() {
|
||||
NS_ASSERTION(Is2b(), "not 2b text");
|
||||
return m2b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mutable version of Get1b. Only works for a non-const object.
|
||||
* Returns a pointer to the char data.
|
||||
*/
|
||||
char* Get1b() {
|
||||
NS_ASSERTION(!Is2b(), "not 1b text");
|
||||
return (char*) m1b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the contents of this fragment to be the given buffer and
|
||||
* length. The memory becomes owned by the fragment. In addition,
|
||||
* the memory for aBuffer must have been allocated using the
|
||||
* nsIMemory interface.
|
||||
*/
|
||||
void SetTo(PRUnichar* aBuffer, PRInt32 aLength, PRBool aRelease);
|
||||
|
||||
/**
|
||||
* Change the contents of this fragment to be a copy of the given
|
||||
* buffer. Like operator= except a length is specified instead of
|
||||
* assuming 0 termination.
|
||||
*/
|
||||
void SetTo(const PRUnichar* aBuffer, PRInt32 aLength);
|
||||
|
||||
/**
|
||||
* Change the contents of this fragment to be a copy of the given
|
||||
* buffer. Like operator= except a length is specified instead of
|
||||
* assuming 0 termination.
|
||||
*/
|
||||
void SetTo(const char* aBuffer, PRInt32 aLength);
|
||||
|
||||
/**
|
||||
* Append the contents of this string fragment to aString
|
||||
*/
|
||||
void AppendTo(nsString& aString) const;
|
||||
|
||||
/**
|
||||
* Make a copy of the fragments contents starting at offset for
|
||||
* count characters. The offset and count will be adjusted to
|
||||
* lie within the fragments data. The fragments data is converted if
|
||||
* necessary.
|
||||
*/
|
||||
void CopyTo(PRUnichar* aDest, PRInt32 aOffset, PRInt32 aCount);
|
||||
|
||||
/**
|
||||
* Make a copy of the fragments contents starting at offset for
|
||||
* count characters. The offset and count will be adjusted to
|
||||
* lie within the fragments data. The fragments data is converted if
|
||||
* necessary.
|
||||
*/
|
||||
void CopyTo(char* aDest, PRInt32 aOffset, PRInt32 aCount);
|
||||
|
||||
/**
|
||||
* Return the character in the text-fragment at the given
|
||||
* index. This always returns a PRUnichar.
|
||||
*/
|
||||
PRUnichar CharAt(PRInt32 aIndex) const {
|
||||
NS_ASSERTION(PRUint32(aIndex) < mState.mLength, "bad index");
|
||||
return mState.mIs2b ? m2b[aIndex] : PRUnichar(m1b[aIndex]);
|
||||
}
|
||||
|
||||
protected:
|
||||
union {
|
||||
PRUnichar* m2b;
|
||||
unsigned char* m1b;
|
||||
};
|
||||
|
||||
public:
|
||||
struct FragmentBits {
|
||||
PRUint32 mInHeap : 1;
|
||||
PRUint32 mIs2b : 1;
|
||||
PRUint32 mLength : 30;
|
||||
};
|
||||
|
||||
protected:
|
||||
union {
|
||||
PRUint32 mAllBits;
|
||||
FragmentBits mState;
|
||||
};
|
||||
|
||||
void ReleaseText();
|
||||
};
|
||||
|
||||
#endif /* nsTextFragment_h___ */
|
||||
|
||||
40
mozilla/layout/base/public/nslayout.h
Normal file
40
mozilla/layout/base/public/nslayout.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/* -*- 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.org 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 nslayout_h___
|
||||
#define nslayout_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
|
||||
// Note: For now, NS_LAYOUT and NS_HTML are joined at the hip
|
||||
#if defined(_IMPL_NS_LAYOUT) || defined(_IMPL_NS_HTML)
|
||||
#define NS_LAYOUT NS_EXPORT
|
||||
#define NS_HTML NS_EXPORT
|
||||
#else
|
||||
#define NS_LAYOUT NS_IMPORT
|
||||
#define NS_HTML NS_IMPORT
|
||||
#endif
|
||||
|
||||
#define INCLUDE_XUL 1
|
||||
|
||||
#endif /* nslayout_h___ */
|
||||
4
mozilla/layout/base/src/MANIFEST
Normal file
4
mozilla/layout/base/src/MANIFEST
Normal file
@@ -0,0 +1,4 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:layout directory
|
||||
#
|
||||
nsContentList.h
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user