зеркало из https://github.com/mozilla/gecko-dev.git
#3371. Implemented css2/css3 system fonts. GFX on Windows and GTK needs to be completed.
This commit is contained in:
Родитель
e013a6492a
Коммит
924dd819c1
|
@ -69,6 +69,7 @@ CSS_KEY(bolder)
|
|||
CSS_KEY(border_box)
|
||||
CSS_KEY(both)
|
||||
CSS_KEY(bottom)
|
||||
CSS_KEY(button)
|
||||
CSS_KEY(buttonface)
|
||||
CSS_KEY(buttonhighlight)
|
||||
CSS_KEY(buttonshadow)
|
||||
|
@ -98,9 +99,12 @@ CSS_KEY(decimal)
|
|||
CSS_KEY(decimal_leading_zero)
|
||||
CSS_KEY(default)
|
||||
CSS_KEY(deg)
|
||||
CSS_KEY(desktop)
|
||||
CSS_KEY(dialog)
|
||||
CSS_KEY(digits)
|
||||
CSS_KEY(disabled)
|
||||
CSS_KEY(disc)
|
||||
CSS_KEY(document)
|
||||
CSS_KEY(dotted)
|
||||
CSS_KEY(double)
|
||||
CSS_KEY(e_resize)
|
||||
|
@ -117,6 +121,7 @@ CSS_KEY(far_left)
|
|||
CSS_KEY(far_right)
|
||||
CSS_KEY(fast)
|
||||
CSS_KEY(faster)
|
||||
CSS_KEY(field)
|
||||
CSS_KEY(fixed)
|
||||
CSS_KEY(georgian)
|
||||
CSS_KEY(grad)
|
||||
|
@ -140,6 +145,7 @@ CSS_KEY(in)
|
|||
CSS_KEY(inactiveborder)
|
||||
CSS_KEY(inactivecaption)
|
||||
CSS_KEY(inactivecaptiontext)
|
||||
CSS_KEY(info)
|
||||
CSS_KEY(infobackground)
|
||||
CSS_KEY(infotext)
|
||||
CSS_KEY(inherit)
|
||||
|
@ -163,6 +169,7 @@ CSS_KEY(leftwards)
|
|||
CSS_KEY(level)
|
||||
CSS_KEY(lighter)
|
||||
CSS_KEY(line_through)
|
||||
CSS_KEY(list)
|
||||
CSS_KEY(list_item)
|
||||
CSS_KEY(loud)
|
||||
CSS_KEY(low)
|
||||
|
@ -208,6 +215,7 @@ CSS_KEY(pointer)
|
|||
CSS_KEY(portrait)
|
||||
CSS_KEY(pre)
|
||||
CSS_KEY(pt)
|
||||
CSS_KEY(pull_down_menu)
|
||||
CSS_KEY(px)
|
||||
CSS_KEY(rad)
|
||||
CSS_KEY(read_only)
|
||||
|
@ -290,6 +298,7 @@ CSS_KEY(wider)
|
|||
CSS_KEY(window)
|
||||
CSS_KEY(windowframe)
|
||||
CSS_KEY(windowtext)
|
||||
CSS_KEY(workspace)
|
||||
CSS_KEY(write_only)
|
||||
CSS_KEY(x_fast)
|
||||
CSS_KEY(x_high)
|
||||
|
|
|
@ -1307,7 +1307,37 @@ MapDeclarationFontInto(nsICSSDeclaration* aDeclaration,
|
|||
}
|
||||
}
|
||||
else if (eCSSUnit_Enumerated == ourFont->mFamily.GetUnit()) {
|
||||
NS_NOTYETIMPLEMENTED("system font");
|
||||
nsSystemAttrID sysID;
|
||||
switch (ourFont->mFamily.GetIntValue()) {
|
||||
case NS_STYLE_FONT_CAPTION: sysID = eSystemAttr_Font_Caption; break; // css2
|
||||
case NS_STYLE_FONT_ICON: sysID = eSystemAttr_Font_Icon; break;
|
||||
case NS_STYLE_FONT_MENU: sysID = eSystemAttr_Font_Menu; break;
|
||||
case NS_STYLE_FONT_MESSAGE_BOX: sysID = eSystemAttr_Font_MessageBox; break;
|
||||
case NS_STYLE_FONT_SMALL_CAPTION: sysID = eSystemAttr_Font_SmallCaption; break;
|
||||
case NS_STYLE_FONT_STATUS_BAR: sysID = eSystemAttr_Font_StatusBar; break;
|
||||
case NS_STYLE_FONT_WINDOW: sysID = eSystemAttr_Font_Window; break; // css3
|
||||
case NS_STYLE_FONT_DOCUMENT: sysID = eSystemAttr_Font_Document; break;
|
||||
case NS_STYLE_FONT_WORKSPACE: sysID = eSystemAttr_Font_Workspace; break;
|
||||
case NS_STYLE_FONT_DESKTOP: sysID = eSystemAttr_Font_Desktop; break;
|
||||
case NS_STYLE_FONT_INFO: sysID = eSystemAttr_Font_Info; break;
|
||||
case NS_STYLE_FONT_DIALOG: sysID = eSystemAttr_Font_Dialog; break;
|
||||
case NS_STYLE_FONT_BUTTON: sysID = eSystemAttr_Font_Button; break;
|
||||
case NS_STYLE_FONT_PULL_DOWN_MENU:sysID = eSystemAttr_Font_PullDownMenu; break;
|
||||
case NS_STYLE_FONT_LIST: sysID = eSystemAttr_Font_List; break;
|
||||
case NS_STYLE_FONT_FIELD: sysID = eSystemAttr_Font_Field; break;
|
||||
}
|
||||
nsCOMPtr<nsIDeviceContext> dc;
|
||||
aPresContext->GetDeviceContext(getter_AddRefs(dc));
|
||||
if (dc) {
|
||||
SystemAttrStruct sysInfo;
|
||||
sysInfo.mFont = &font->mFont;
|
||||
if (NS_FAILED(dc->GetSystemAttribute(sysID, &sysInfo))) {
|
||||
font->mFont.name = defaultFont.name;
|
||||
font->mFixedFont.name = defaultFixedFont.name;
|
||||
}
|
||||
font->mFlags |= NS_STYLE_FONT_FACE_EXPLICIT;
|
||||
}
|
||||
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourFont->mFamily.GetUnit()) {
|
||||
font->mFont.name = parentFont->mFont.name;
|
||||
|
|
|
@ -69,6 +69,7 @@ CSS_KEY(bolder)
|
|||
CSS_KEY(border_box)
|
||||
CSS_KEY(both)
|
||||
CSS_KEY(bottom)
|
||||
CSS_KEY(button)
|
||||
CSS_KEY(buttonface)
|
||||
CSS_KEY(buttonhighlight)
|
||||
CSS_KEY(buttonshadow)
|
||||
|
@ -98,9 +99,12 @@ CSS_KEY(decimal)
|
|||
CSS_KEY(decimal_leading_zero)
|
||||
CSS_KEY(default)
|
||||
CSS_KEY(deg)
|
||||
CSS_KEY(desktop)
|
||||
CSS_KEY(dialog)
|
||||
CSS_KEY(digits)
|
||||
CSS_KEY(disabled)
|
||||
CSS_KEY(disc)
|
||||
CSS_KEY(document)
|
||||
CSS_KEY(dotted)
|
||||
CSS_KEY(double)
|
||||
CSS_KEY(e_resize)
|
||||
|
@ -117,6 +121,7 @@ CSS_KEY(far_left)
|
|||
CSS_KEY(far_right)
|
||||
CSS_KEY(fast)
|
||||
CSS_KEY(faster)
|
||||
CSS_KEY(field)
|
||||
CSS_KEY(fixed)
|
||||
CSS_KEY(georgian)
|
||||
CSS_KEY(grad)
|
||||
|
@ -140,6 +145,7 @@ CSS_KEY(in)
|
|||
CSS_KEY(inactiveborder)
|
||||
CSS_KEY(inactivecaption)
|
||||
CSS_KEY(inactivecaptiontext)
|
||||
CSS_KEY(info)
|
||||
CSS_KEY(infobackground)
|
||||
CSS_KEY(infotext)
|
||||
CSS_KEY(inherit)
|
||||
|
@ -163,6 +169,7 @@ CSS_KEY(leftwards)
|
|||
CSS_KEY(level)
|
||||
CSS_KEY(lighter)
|
||||
CSS_KEY(line_through)
|
||||
CSS_KEY(list)
|
||||
CSS_KEY(list_item)
|
||||
CSS_KEY(loud)
|
||||
CSS_KEY(low)
|
||||
|
@ -208,6 +215,7 @@ CSS_KEY(pointer)
|
|||
CSS_KEY(portrait)
|
||||
CSS_KEY(pre)
|
||||
CSS_KEY(pt)
|
||||
CSS_KEY(pull_down_menu)
|
||||
CSS_KEY(px)
|
||||
CSS_KEY(rad)
|
||||
CSS_KEY(read_only)
|
||||
|
@ -290,6 +298,7 @@ CSS_KEY(wider)
|
|||
CSS_KEY(window)
|
||||
CSS_KEY(windowframe)
|
||||
CSS_KEY(windowtext)
|
||||
CSS_KEY(workspace)
|
||||
CSS_KEY(write_only)
|
||||
CSS_KEY(x_fast)
|
||||
CSS_KEY(x_high)
|
||||
|
|
|
@ -364,12 +364,22 @@ const PRInt32 nsCSSProps::kFloatEdgeKTable[] = {
|
|||
};
|
||||
|
||||
const PRInt32 nsCSSProps::kFontKTable[] = {
|
||||
eCSSKeyword_caption, NS_STYLE_FONT_CAPTION,
|
||||
eCSSKeyword_caption, NS_STYLE_FONT_CAPTION, // css2
|
||||
eCSSKeyword_icon, NS_STYLE_FONT_ICON,
|
||||
eCSSKeyword_menu, NS_STYLE_FONT_MENU,
|
||||
eCSSKeyword_message_box, NS_STYLE_FONT_MESSAGE_BOX,
|
||||
eCSSKeyword_small_caption, NS_STYLE_FONT_SMALL_CAPTION,
|
||||
eCSSKeyword_status_bar, NS_STYLE_FONT_STATUS_BAR,
|
||||
eCSSKeyword_window, NS_STYLE_FONT_WINDOW, // css3
|
||||
eCSSKeyword_document, NS_STYLE_FONT_DOCUMENT,
|
||||
eCSSKeyword_workspace, NS_STYLE_FONT_WORKSPACE,
|
||||
eCSSKeyword_desktop, NS_STYLE_FONT_DESKTOP,
|
||||
eCSSKeyword_info, NS_STYLE_FONT_INFO,
|
||||
eCSSKeyword_dialog, NS_STYLE_FONT_DIALOG,
|
||||
eCSSKeyword_button, NS_STYLE_FONT_BUTTON,
|
||||
eCSSKeyword_pull_down_menu, NS_STYLE_FONT_PULL_DOWN_MENU,
|
||||
eCSSKeyword_list, NS_STYLE_FONT_LIST,
|
||||
eCSSKeyword_field, NS_STYLE_FONT_FIELD,
|
||||
-1,-1
|
||||
};
|
||||
|
||||
|
|
|
@ -82,13 +82,25 @@ struct nsPaletteInfo {
|
|||
eSystemAttr_Size_ScrollbarHeight,
|
||||
eSystemAttr_Size_ScrollbarWidth,
|
||||
// Fonts
|
||||
eSystemAttr_Font_Caption,
|
||||
eSystemAttr_Font_Caption, // css2
|
||||
eSystemAttr_Font_Icon,
|
||||
eSystemAttr_Font_Menu,
|
||||
eSystemAttr_Font_MessageBox,
|
||||
eSystemAttr_Font_SmallCaption,
|
||||
eSystemAttr_Font_StatusBar,
|
||||
eSystemAttr_Font_Tooltips,
|
||||
|
||||
eSystemAttr_Font_Window, // css3
|
||||
eSystemAttr_Font_Document,
|
||||
eSystemAttr_Font_Workspace,
|
||||
eSystemAttr_Font_Desktop,
|
||||
eSystemAttr_Font_Info,
|
||||
eSystemAttr_Font_Dialog,
|
||||
eSystemAttr_Font_Button,
|
||||
eSystemAttr_Font_PullDownMenu,
|
||||
eSystemAttr_Font_List,
|
||||
eSystemAttr_Font_Field,
|
||||
|
||||
eSystemAttr_Font_Tooltips, // moz
|
||||
eSystemAttr_Font_Widget
|
||||
} nsSystemAttrID;
|
||||
|
||||
|
|
|
@ -325,21 +325,31 @@ NS_IMETHODIMP nsDeviceContextGTK::GetSystemAttribute(nsSystemAttrID anID, System
|
|||
//---------
|
||||
// Fonts
|
||||
//---------
|
||||
case eSystemAttr_Font_Caption:
|
||||
case eSystemAttr_Font_Icon:
|
||||
case eSystemAttr_Font_Menu:
|
||||
case eSystemAttr_Font_MessageBox:
|
||||
case eSystemAttr_Font_SmallCaption:
|
||||
case eSystemAttr_Font_StatusBar:
|
||||
case eSystemAttr_Font_Tooltips:
|
||||
case eSystemAttr_Font_Widget:
|
||||
case eSystemAttr_Font_Caption: // css2
|
||||
case eSystemAttr_Font_Icon:
|
||||
case eSystemAttr_Font_Menu:
|
||||
case eSystemAttr_Font_MessageBox:
|
||||
case eSystemAttr_Font_SmallCaption:
|
||||
case eSystemAttr_Font_StatusBar:
|
||||
case eSystemAttr_Font_Window: // css3
|
||||
case eSystemAttr_Font_Document:
|
||||
case eSystemAttr_Font_Workspace:
|
||||
case eSystemAttr_Font_Desktop:
|
||||
case eSystemAttr_Font_Info:
|
||||
case eSystemAttr_Font_Dialog:
|
||||
case eSystemAttr_Font_Button:
|
||||
case eSystemAttr_Font_PullDownMenu:
|
||||
case eSystemAttr_Font_List:
|
||||
case eSystemAttr_Font_Field:
|
||||
case eSystemAttr_Font_Tooltips: // moz
|
||||
case eSystemAttr_Font_Widget:
|
||||
status = NS_ERROR_FAILURE;
|
||||
break;
|
||||
} // switch
|
||||
|
||||
gtk_style_unref(style);
|
||||
|
||||
return NS_OK;
|
||||
return status;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDeviceContextGTK::GetDrawingSurface(nsIRenderingContext &aContext,
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "nsDeviceContextSpecMac.h"
|
||||
#include "nsString.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsFont.h"
|
||||
#include <TextEncodingConverter.h>
|
||||
#include <TextCommon.h>
|
||||
#include <StringCompare.h>
|
||||
|
@ -246,19 +247,38 @@ NS_IMETHODIMP nsDeviceContextMac :: GetSystemAttribute(nsSystemAttrID anID, Syst
|
|||
//---------
|
||||
// Fonts
|
||||
//---------
|
||||
case eSystemAttr_Font_Caption :
|
||||
case eSystemAttr_Font_Icon :
|
||||
case eSystemAttr_Font_Menu :
|
||||
case eSystemAttr_Font_MessageBox :
|
||||
case eSystemAttr_Font_SmallCaption :
|
||||
case eSystemAttr_Font_StatusBar :
|
||||
case eSystemAttr_Font_Tooltips :
|
||||
status = NS_ERROR_FAILURE;
|
||||
case eSystemAttr_Font_Caption: // css2
|
||||
case eSystemAttr_Font_Icon:
|
||||
case eSystemAttr_Font_Menu:
|
||||
case eSystemAttr_Font_MessageBox:
|
||||
case eSystemAttr_Font_SmallCaption:
|
||||
case eSystemAttr_Font_StatusBar:
|
||||
case eSystemAttr_Font_Window: // css3
|
||||
case eSystemAttr_Font_Document:
|
||||
case eSystemAttr_Font_Workspace:
|
||||
case eSystemAttr_Font_Desktop:
|
||||
case eSystemAttr_Font_Info:
|
||||
case eSystemAttr_Font_Dialog:
|
||||
case eSystemAttr_Font_Button:
|
||||
case eSystemAttr_Font_PullDownMenu:
|
||||
case eSystemAttr_Font_List:
|
||||
case eSystemAttr_Font_Field:
|
||||
case eSystemAttr_Font_Tooltips: // moz
|
||||
case eSystemAttr_Font_Widget:
|
||||
//¥TODO: we should get these from the Appearance Manager
|
||||
aInfo->mFont->name = "geneva";
|
||||
aInfo->mFont->size = 9;
|
||||
float dev2app;
|
||||
GetDevUnitsToAppUnits(dev2app);
|
||||
aInfo->mFont->size = NSToCoordRound(float(aInfo->mFont->size) * dev2app);
|
||||
aInfo->mFont->style = NS_FONT_STYLE_NORMAL;
|
||||
aInfo->mFont->weight = NS_FONT_WEIGHT_NORMAL;
|
||||
aInfo->mFont->decorations = NS_FONT_DECORATION_NONE;
|
||||
break;
|
||||
|
||||
} // switch
|
||||
|
||||
return NS_OK;
|
||||
return status;
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------
|
||||
|
|
|
@ -367,6 +367,18 @@ nsresult GetSysFontInfo(HDC aHDC, nsSystemAttrID anID, nsFont * aFont)
|
|||
|
||||
case eSystemAttr_Font_Widget:
|
||||
break;
|
||||
|
||||
case eSystemAttr_Font_Window: // css3
|
||||
case eSystemAttr_Font_Document:
|
||||
case eSystemAttr_Font_Workspace:
|
||||
case eSystemAttr_Font_Desktop:
|
||||
case eSystemAttr_Font_Info:
|
||||
case eSystemAttr_Font_Dialog:
|
||||
case eSystemAttr_Font_Button:
|
||||
case eSystemAttr_Font_PullDownMenu:
|
||||
case eSystemAttr_Font_List:
|
||||
case eSystemAttr_Font_Field:
|
||||
break;
|
||||
} // switch
|
||||
|
||||
if (nsnull == logFont) {
|
||||
|
|
|
@ -326,12 +326,22 @@
|
|||
#define NS_STYLE_FONT_USE_FIXED 0x04
|
||||
|
||||
// See nsStyleFont - system fonts
|
||||
#define NS_STYLE_FONT_CAPTION 1
|
||||
#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
|
||||
|
|
|
@ -326,12 +326,22 @@
|
|||
#define NS_STYLE_FONT_USE_FIXED 0x04
|
||||
|
||||
// See nsStyleFont - system fonts
|
||||
#define NS_STYLE_FONT_CAPTION 1
|
||||
#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
|
||||
|
|
|
@ -69,6 +69,7 @@ CSS_KEY(bolder)
|
|||
CSS_KEY(border_box)
|
||||
CSS_KEY(both)
|
||||
CSS_KEY(bottom)
|
||||
CSS_KEY(button)
|
||||
CSS_KEY(buttonface)
|
||||
CSS_KEY(buttonhighlight)
|
||||
CSS_KEY(buttonshadow)
|
||||
|
@ -98,9 +99,12 @@ CSS_KEY(decimal)
|
|||
CSS_KEY(decimal_leading_zero)
|
||||
CSS_KEY(default)
|
||||
CSS_KEY(deg)
|
||||
CSS_KEY(desktop)
|
||||
CSS_KEY(dialog)
|
||||
CSS_KEY(digits)
|
||||
CSS_KEY(disabled)
|
||||
CSS_KEY(disc)
|
||||
CSS_KEY(document)
|
||||
CSS_KEY(dotted)
|
||||
CSS_KEY(double)
|
||||
CSS_KEY(e_resize)
|
||||
|
@ -117,6 +121,7 @@ CSS_KEY(far_left)
|
|||
CSS_KEY(far_right)
|
||||
CSS_KEY(fast)
|
||||
CSS_KEY(faster)
|
||||
CSS_KEY(field)
|
||||
CSS_KEY(fixed)
|
||||
CSS_KEY(georgian)
|
||||
CSS_KEY(grad)
|
||||
|
@ -140,6 +145,7 @@ CSS_KEY(in)
|
|||
CSS_KEY(inactiveborder)
|
||||
CSS_KEY(inactivecaption)
|
||||
CSS_KEY(inactivecaptiontext)
|
||||
CSS_KEY(info)
|
||||
CSS_KEY(infobackground)
|
||||
CSS_KEY(infotext)
|
||||
CSS_KEY(inherit)
|
||||
|
@ -163,6 +169,7 @@ CSS_KEY(leftwards)
|
|||
CSS_KEY(level)
|
||||
CSS_KEY(lighter)
|
||||
CSS_KEY(line_through)
|
||||
CSS_KEY(list)
|
||||
CSS_KEY(list_item)
|
||||
CSS_KEY(loud)
|
||||
CSS_KEY(low)
|
||||
|
@ -208,6 +215,7 @@ CSS_KEY(pointer)
|
|||
CSS_KEY(portrait)
|
||||
CSS_KEY(pre)
|
||||
CSS_KEY(pt)
|
||||
CSS_KEY(pull_down_menu)
|
||||
CSS_KEY(px)
|
||||
CSS_KEY(rad)
|
||||
CSS_KEY(read_only)
|
||||
|
@ -290,6 +298,7 @@ CSS_KEY(wider)
|
|||
CSS_KEY(window)
|
||||
CSS_KEY(windowframe)
|
||||
CSS_KEY(windowtext)
|
||||
CSS_KEY(workspace)
|
||||
CSS_KEY(write_only)
|
||||
CSS_KEY(x_fast)
|
||||
CSS_KEY(x_high)
|
||||
|
|
|
@ -364,12 +364,22 @@ const PRInt32 nsCSSProps::kFloatEdgeKTable[] = {
|
|||
};
|
||||
|
||||
const PRInt32 nsCSSProps::kFontKTable[] = {
|
||||
eCSSKeyword_caption, NS_STYLE_FONT_CAPTION,
|
||||
eCSSKeyword_caption, NS_STYLE_FONT_CAPTION, // css2
|
||||
eCSSKeyword_icon, NS_STYLE_FONT_ICON,
|
||||
eCSSKeyword_menu, NS_STYLE_FONT_MENU,
|
||||
eCSSKeyword_message_box, NS_STYLE_FONT_MESSAGE_BOX,
|
||||
eCSSKeyword_small_caption, NS_STYLE_FONT_SMALL_CAPTION,
|
||||
eCSSKeyword_status_bar, NS_STYLE_FONT_STATUS_BAR,
|
||||
eCSSKeyword_window, NS_STYLE_FONT_WINDOW, // css3
|
||||
eCSSKeyword_document, NS_STYLE_FONT_DOCUMENT,
|
||||
eCSSKeyword_workspace, NS_STYLE_FONT_WORKSPACE,
|
||||
eCSSKeyword_desktop, NS_STYLE_FONT_DESKTOP,
|
||||
eCSSKeyword_info, NS_STYLE_FONT_INFO,
|
||||
eCSSKeyword_dialog, NS_STYLE_FONT_DIALOG,
|
||||
eCSSKeyword_button, NS_STYLE_FONT_BUTTON,
|
||||
eCSSKeyword_pull_down_menu, NS_STYLE_FONT_PULL_DOWN_MENU,
|
||||
eCSSKeyword_list, NS_STYLE_FONT_LIST,
|
||||
eCSSKeyword_field, NS_STYLE_FONT_FIELD,
|
||||
-1,-1
|
||||
};
|
||||
|
||||
|
|
|
@ -1307,7 +1307,37 @@ MapDeclarationFontInto(nsICSSDeclaration* aDeclaration,
|
|||
}
|
||||
}
|
||||
else if (eCSSUnit_Enumerated == ourFont->mFamily.GetUnit()) {
|
||||
NS_NOTYETIMPLEMENTED("system font");
|
||||
nsSystemAttrID sysID;
|
||||
switch (ourFont->mFamily.GetIntValue()) {
|
||||
case NS_STYLE_FONT_CAPTION: sysID = eSystemAttr_Font_Caption; break; // css2
|
||||
case NS_STYLE_FONT_ICON: sysID = eSystemAttr_Font_Icon; break;
|
||||
case NS_STYLE_FONT_MENU: sysID = eSystemAttr_Font_Menu; break;
|
||||
case NS_STYLE_FONT_MESSAGE_BOX: sysID = eSystemAttr_Font_MessageBox; break;
|
||||
case NS_STYLE_FONT_SMALL_CAPTION: sysID = eSystemAttr_Font_SmallCaption; break;
|
||||
case NS_STYLE_FONT_STATUS_BAR: sysID = eSystemAttr_Font_StatusBar; break;
|
||||
case NS_STYLE_FONT_WINDOW: sysID = eSystemAttr_Font_Window; break; // css3
|
||||
case NS_STYLE_FONT_DOCUMENT: sysID = eSystemAttr_Font_Document; break;
|
||||
case NS_STYLE_FONT_WORKSPACE: sysID = eSystemAttr_Font_Workspace; break;
|
||||
case NS_STYLE_FONT_DESKTOP: sysID = eSystemAttr_Font_Desktop; break;
|
||||
case NS_STYLE_FONT_INFO: sysID = eSystemAttr_Font_Info; break;
|
||||
case NS_STYLE_FONT_DIALOG: sysID = eSystemAttr_Font_Dialog; break;
|
||||
case NS_STYLE_FONT_BUTTON: sysID = eSystemAttr_Font_Button; break;
|
||||
case NS_STYLE_FONT_PULL_DOWN_MENU:sysID = eSystemAttr_Font_PullDownMenu; break;
|
||||
case NS_STYLE_FONT_LIST: sysID = eSystemAttr_Font_List; break;
|
||||
case NS_STYLE_FONT_FIELD: sysID = eSystemAttr_Font_Field; break;
|
||||
}
|
||||
nsCOMPtr<nsIDeviceContext> dc;
|
||||
aPresContext->GetDeviceContext(getter_AddRefs(dc));
|
||||
if (dc) {
|
||||
SystemAttrStruct sysInfo;
|
||||
sysInfo.mFont = &font->mFont;
|
||||
if (NS_FAILED(dc->GetSystemAttribute(sysID, &sysInfo))) {
|
||||
font->mFont.name = defaultFont.name;
|
||||
font->mFixedFont.name = defaultFixedFont.name;
|
||||
}
|
||||
font->mFlags |= NS_STYLE_FONT_FACE_EXPLICIT;
|
||||
}
|
||||
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourFont->mFamily.GetUnit()) {
|
||||
font->mFont.name = parentFont->mFont.name;
|
||||
|
|
|
@ -69,6 +69,7 @@ CSS_KEY(bolder)
|
|||
CSS_KEY(border_box)
|
||||
CSS_KEY(both)
|
||||
CSS_KEY(bottom)
|
||||
CSS_KEY(button)
|
||||
CSS_KEY(buttonface)
|
||||
CSS_KEY(buttonhighlight)
|
||||
CSS_KEY(buttonshadow)
|
||||
|
@ -98,9 +99,12 @@ CSS_KEY(decimal)
|
|||
CSS_KEY(decimal_leading_zero)
|
||||
CSS_KEY(default)
|
||||
CSS_KEY(deg)
|
||||
CSS_KEY(desktop)
|
||||
CSS_KEY(dialog)
|
||||
CSS_KEY(digits)
|
||||
CSS_KEY(disabled)
|
||||
CSS_KEY(disc)
|
||||
CSS_KEY(document)
|
||||
CSS_KEY(dotted)
|
||||
CSS_KEY(double)
|
||||
CSS_KEY(e_resize)
|
||||
|
@ -117,6 +121,7 @@ CSS_KEY(far_left)
|
|||
CSS_KEY(far_right)
|
||||
CSS_KEY(fast)
|
||||
CSS_KEY(faster)
|
||||
CSS_KEY(field)
|
||||
CSS_KEY(fixed)
|
||||
CSS_KEY(georgian)
|
||||
CSS_KEY(grad)
|
||||
|
@ -140,6 +145,7 @@ CSS_KEY(in)
|
|||
CSS_KEY(inactiveborder)
|
||||
CSS_KEY(inactivecaption)
|
||||
CSS_KEY(inactivecaptiontext)
|
||||
CSS_KEY(info)
|
||||
CSS_KEY(infobackground)
|
||||
CSS_KEY(infotext)
|
||||
CSS_KEY(inherit)
|
||||
|
@ -163,6 +169,7 @@ CSS_KEY(leftwards)
|
|||
CSS_KEY(level)
|
||||
CSS_KEY(lighter)
|
||||
CSS_KEY(line_through)
|
||||
CSS_KEY(list)
|
||||
CSS_KEY(list_item)
|
||||
CSS_KEY(loud)
|
||||
CSS_KEY(low)
|
||||
|
@ -208,6 +215,7 @@ CSS_KEY(pointer)
|
|||
CSS_KEY(portrait)
|
||||
CSS_KEY(pre)
|
||||
CSS_KEY(pt)
|
||||
CSS_KEY(pull_down_menu)
|
||||
CSS_KEY(px)
|
||||
CSS_KEY(rad)
|
||||
CSS_KEY(read_only)
|
||||
|
@ -290,6 +298,7 @@ CSS_KEY(wider)
|
|||
CSS_KEY(window)
|
||||
CSS_KEY(windowframe)
|
||||
CSS_KEY(windowtext)
|
||||
CSS_KEY(workspace)
|
||||
CSS_KEY(write_only)
|
||||
CSS_KEY(x_fast)
|
||||
CSS_KEY(x_high)
|
||||
|
|
|
@ -364,12 +364,22 @@ const PRInt32 nsCSSProps::kFloatEdgeKTable[] = {
|
|||
};
|
||||
|
||||
const PRInt32 nsCSSProps::kFontKTable[] = {
|
||||
eCSSKeyword_caption, NS_STYLE_FONT_CAPTION,
|
||||
eCSSKeyword_caption, NS_STYLE_FONT_CAPTION, // css2
|
||||
eCSSKeyword_icon, NS_STYLE_FONT_ICON,
|
||||
eCSSKeyword_menu, NS_STYLE_FONT_MENU,
|
||||
eCSSKeyword_message_box, NS_STYLE_FONT_MESSAGE_BOX,
|
||||
eCSSKeyword_small_caption, NS_STYLE_FONT_SMALL_CAPTION,
|
||||
eCSSKeyword_status_bar, NS_STYLE_FONT_STATUS_BAR,
|
||||
eCSSKeyword_window, NS_STYLE_FONT_WINDOW, // css3
|
||||
eCSSKeyword_document, NS_STYLE_FONT_DOCUMENT,
|
||||
eCSSKeyword_workspace, NS_STYLE_FONT_WORKSPACE,
|
||||
eCSSKeyword_desktop, NS_STYLE_FONT_DESKTOP,
|
||||
eCSSKeyword_info, NS_STYLE_FONT_INFO,
|
||||
eCSSKeyword_dialog, NS_STYLE_FONT_DIALOG,
|
||||
eCSSKeyword_button, NS_STYLE_FONT_BUTTON,
|
||||
eCSSKeyword_pull_down_menu, NS_STYLE_FONT_PULL_DOWN_MENU,
|
||||
eCSSKeyword_list, NS_STYLE_FONT_LIST,
|
||||
eCSSKeyword_field, NS_STYLE_FONT_FIELD,
|
||||
-1,-1
|
||||
};
|
||||
|
||||
|
|
|
@ -1307,7 +1307,37 @@ MapDeclarationFontInto(nsICSSDeclaration* aDeclaration,
|
|||
}
|
||||
}
|
||||
else if (eCSSUnit_Enumerated == ourFont->mFamily.GetUnit()) {
|
||||
NS_NOTYETIMPLEMENTED("system font");
|
||||
nsSystemAttrID sysID;
|
||||
switch (ourFont->mFamily.GetIntValue()) {
|
||||
case NS_STYLE_FONT_CAPTION: sysID = eSystemAttr_Font_Caption; break; // css2
|
||||
case NS_STYLE_FONT_ICON: sysID = eSystemAttr_Font_Icon; break;
|
||||
case NS_STYLE_FONT_MENU: sysID = eSystemAttr_Font_Menu; break;
|
||||
case NS_STYLE_FONT_MESSAGE_BOX: sysID = eSystemAttr_Font_MessageBox; break;
|
||||
case NS_STYLE_FONT_SMALL_CAPTION: sysID = eSystemAttr_Font_SmallCaption; break;
|
||||
case NS_STYLE_FONT_STATUS_BAR: sysID = eSystemAttr_Font_StatusBar; break;
|
||||
case NS_STYLE_FONT_WINDOW: sysID = eSystemAttr_Font_Window; break; // css3
|
||||
case NS_STYLE_FONT_DOCUMENT: sysID = eSystemAttr_Font_Document; break;
|
||||
case NS_STYLE_FONT_WORKSPACE: sysID = eSystemAttr_Font_Workspace; break;
|
||||
case NS_STYLE_FONT_DESKTOP: sysID = eSystemAttr_Font_Desktop; break;
|
||||
case NS_STYLE_FONT_INFO: sysID = eSystemAttr_Font_Info; break;
|
||||
case NS_STYLE_FONT_DIALOG: sysID = eSystemAttr_Font_Dialog; break;
|
||||
case NS_STYLE_FONT_BUTTON: sysID = eSystemAttr_Font_Button; break;
|
||||
case NS_STYLE_FONT_PULL_DOWN_MENU:sysID = eSystemAttr_Font_PullDownMenu; break;
|
||||
case NS_STYLE_FONT_LIST: sysID = eSystemAttr_Font_List; break;
|
||||
case NS_STYLE_FONT_FIELD: sysID = eSystemAttr_Font_Field; break;
|
||||
}
|
||||
nsCOMPtr<nsIDeviceContext> dc;
|
||||
aPresContext->GetDeviceContext(getter_AddRefs(dc));
|
||||
if (dc) {
|
||||
SystemAttrStruct sysInfo;
|
||||
sysInfo.mFont = &font->mFont;
|
||||
if (NS_FAILED(dc->GetSystemAttribute(sysID, &sysInfo))) {
|
||||
font->mFont.name = defaultFont.name;
|
||||
font->mFixedFont.name = defaultFixedFont.name;
|
||||
}
|
||||
font->mFlags |= NS_STYLE_FONT_FACE_EXPLICIT;
|
||||
}
|
||||
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourFont->mFamily.GetUnit()) {
|
||||
font->mFont.name = parentFont->mFont.name;
|
||||
|
|
Загрузка…
Ссылка в новой задаче