r= pierre@netscape.com
BiDi - ability to change the default direction of the browser
This commit is contained in:
mkaply%us.ibm.com 2000-03-21 15:51:59 +00:00
Родитель 1969fe9265
Коммит 95df8f9115
9 изменённых файлов: 171 добавлений и 3 удалений

Просмотреть файл

@ -19,6 +19,19 @@
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.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
* 03/20/2000 IBM Corp. BiDi - ability to change the default direction of the browser
*
*/
#include "nsIStyleContext.h"
#include "nsIMutableStyleContext.h"
@ -1000,7 +1013,7 @@ void StyleDisplayImpl::ResetFrom(const nsStyleDisplay* aParent, nsIPresContext*
mVisible = aParent->mVisible;
}
else {
mDirection = NS_STYLE_DIRECTION_LTR;
aPresContext->GetDefaultDirection(&mDirection);
mVisible = NS_STYLE_VISIBILITY_VISIBLE;
}
mDisplay = NS_STYLE_DISPLAY_INLINE;

Просмотреть файл

@ -18,6 +18,19 @@
* 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
*
*/
#include "nsCOMPtr.h"
#include "nsPresContext.h"
@ -93,6 +106,7 @@ nsPresContext::nsPresContext()
mDefaultBackgroundImageAttachment = NS_STYLE_BG_ATTACHMENT_SCROLL;
mDefaultBackgroundImageRepeat = NS_STYLE_BG_REPEAT_XY;
mDefaultBackgroundImageOffsetX = mDefaultBackgroundImageOffsetY = 0;
mDefaultDirection = NS_STYLE_DIRECTION_LTR;
}
nsPresContext::~nsPresContext()
@ -122,6 +136,7 @@ nsPresContext::~nsPresContext()
mPrefs->UnregisterCallback("browser.base_font_scaler", PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("browser.wfe.use_windows_colors", PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("font.", PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("browser.display.direction", PrefChangedCallback, (void*)this);
}
}
@ -233,6 +248,9 @@ nsPresContext::GetUserPreferences()
mDefaultBackgroundColor = (nscolor)colorPref;
}
}
if (NS_OK == mPrefs->GetIntPref("browser.display.direction", &prefInt)) {
mDefaultDirection = prefInt;
}
GetFontPreferences();
}
@ -286,6 +304,7 @@ nsPresContext::Init(nsIDeviceContext* aDeviceContext)
mPrefs->RegisterCallback("browser.base_font_scaler", PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("browser.wfe.use_windows_colors", PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("font.", PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("browser.display.direction", PrefChangedCallback, (void*)this);
// Initialize our state from the user preferences
GetUserPreferences();
@ -1017,3 +1036,18 @@ nsPresContext::GetEventStateManager(nsIEventStateManager** aManager)
NS_IF_ADDREF(*aManager);
return NS_OK;
}
NS_IMETHODIMP
nsPresContext::GetDefaultDirection(PRUint8* aDirection)
{
*aDirection = mDefaultDirection;
return NS_OK;
}
NS_IMETHODIMP
nsPresContext::SetDefaultDirection(PRUint8 aDirection)
{
mDefaultDirection = aDirection;
return NS_OK;
}

Просмотреть файл

@ -18,6 +18,19 @@
* 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___
@ -292,6 +305,8 @@ public:
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;
};
// Bit values for StartLoadImage's aImageStatus

Просмотреть файл

@ -18,6 +18,19 @@
* 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___
@ -292,6 +305,8 @@ public:
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;
};
// Bit values for StartLoadImage's aImageStatus

Просмотреть файл

@ -18,6 +18,19 @@
* 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___
@ -292,6 +305,8 @@ public:
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;
};
// Bit values for StartLoadImage's aImageStatus

Просмотреть файл

@ -18,6 +18,19 @@
* 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
*
*/
#include "nsCOMPtr.h"
#include "nsPresContext.h"
@ -93,6 +106,7 @@ nsPresContext::nsPresContext()
mDefaultBackgroundImageAttachment = NS_STYLE_BG_ATTACHMENT_SCROLL;
mDefaultBackgroundImageRepeat = NS_STYLE_BG_REPEAT_XY;
mDefaultBackgroundImageOffsetX = mDefaultBackgroundImageOffsetY = 0;
mDefaultDirection = NS_STYLE_DIRECTION_LTR;
}
nsPresContext::~nsPresContext()
@ -122,6 +136,7 @@ nsPresContext::~nsPresContext()
mPrefs->UnregisterCallback("browser.base_font_scaler", PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("browser.wfe.use_windows_colors", PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("font.", PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("browser.display.direction", PrefChangedCallback, (void*)this);
}
}
@ -233,6 +248,9 @@ nsPresContext::GetUserPreferences()
mDefaultBackgroundColor = (nscolor)colorPref;
}
}
if (NS_OK == mPrefs->GetIntPref("browser.display.direction", &prefInt)) {
mDefaultDirection = prefInt;
}
GetFontPreferences();
}
@ -286,6 +304,7 @@ nsPresContext::Init(nsIDeviceContext* aDeviceContext)
mPrefs->RegisterCallback("browser.base_font_scaler", PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("browser.wfe.use_windows_colors", PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("font.", PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("browser.display.direction", PrefChangedCallback, (void*)this);
// Initialize our state from the user preferences
GetUserPreferences();
@ -1017,3 +1036,18 @@ nsPresContext::GetEventStateManager(nsIEventStateManager** aManager)
NS_IF_ADDREF(*aManager);
return NS_OK;
}
NS_IMETHODIMP
nsPresContext::GetDefaultDirection(PRUint8* aDirection)
{
*aDirection = mDefaultDirection;
return NS_OK;
}
NS_IMETHODIMP
nsPresContext::SetDefaultDirection(PRUint8 aDirection)
{
mDefaultDirection = aDirection;
return NS_OK;
}

Просмотреть файл

@ -18,6 +18,19 @@
* 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 nsPresContext_h___
#define nsPresContext_h___
@ -116,6 +129,8 @@ public:
NS_IMETHOD GetScaledPixelsToTwips(float* aScale) const;
NS_IMETHOD GetDeviceContext(nsIDeviceContext** aResult) const;
NS_IMETHOD GetEventStateManager(nsIEventStateManager** aManager);
NS_IMETHOD GetDefaultDirection(PRUint8* aDirection);
NS_IMETHOD SetDefaultDirection(PRUint8 aDirection);
protected:
nsPresContext();
@ -153,6 +168,7 @@ protected:
nsWidgetRendering mWidgetRenderingMode;
nsCOMPtr<nsIURI> mBaseURL;
PRBool mStopped;
PRUint8 mDefaultDirection;
#ifdef DEBUG
PRBool mInitialized;

Просмотреть файл

@ -19,6 +19,19 @@
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.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
* 03/20/2000 IBM Corp. BiDi - ability to change the default direction of the browser
*
*/
#include "nsIStyleContext.h"
#include "nsIMutableStyleContext.h"
@ -1000,7 +1013,7 @@ void StyleDisplayImpl::ResetFrom(const nsStyleDisplay* aParent, nsIPresContext*
mVisible = aParent->mVisible;
}
else {
mDirection = NS_STYLE_DIRECTION_LTR;
aPresContext->GetDefaultDirection(&mDirection);
mVisible = NS_STYLE_VISIBILITY_VISIBLE;
}
mDisplay = NS_STYLE_DISPLAY_INLINE;

Просмотреть файл

@ -19,6 +19,19 @@
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.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
* 03/20/2000 IBM Corp. BiDi - ability to change the default direction of the browser
*
*/
#include "nsIStyleContext.h"
#include "nsIMutableStyleContext.h"
@ -1000,7 +1013,7 @@ void StyleDisplayImpl::ResetFrom(const nsStyleDisplay* aParent, nsIPresContext*
mVisible = aParent->mVisible;
}
else {
mDirection = NS_STYLE_DIRECTION_LTR;
aPresContext->GetDefaultDirection(&mDirection);
mVisible = NS_STYLE_VISIBILITY_VISIBLE;
}
mDisplay = NS_STYLE_DISPLAY_INLINE;