r7023 chris_y - /trunk/netsurf/amiga/dist/NetSurf.guide
by netsurf@semichrome.net
Author: chris_y
Date: Wed Apr 1 12:44:20 2009
New Revision: 7023
URL: http://source.netsurf-browser.org?rev=7023&view=rev
Log:
Minor corrections
Modified:
trunk/netsurf/amiga/dist/NetSurf.guide
Modified: trunk/netsurf/amiga/dist/NetSurf.guide
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/dist/NetSurf.guide?...
==============================================================================
--- trunk/netsurf/amiga/dist/NetSurf.guide (original)
+++ trunk/netsurf/amiga/dist/NetSurf.guide Wed Apr 1 12:44:20 2009
@@ -41,11 +41,11 @@
@{b}os_mouse_pointers@{ub} Don't override default and busy mouse pointers
@{b}new_tab_is_active@{ub} Make new tab the active one
@{b}kiosk_mode@{ub} No gadgets
-@{b}recent_file@{ub} Path to file to store recent history list
+@{b}recent_file@{ub} Path to file to store recent history list (not used)
@{b}arexx_dir@{ub} Path to ARexx scripts dir
@{b}download_dir@{ub} default download destination
@{b}faster_scroll@{ub} enable faster scrolling (experimental)
-@{b}cache_bitmaps@{ub} cache bitmaps in native format in gfx mem (0=off, 1=sclaed, 2=all)
+@{b}cache_bitmaps@{ub} cache bitmaps in native format in gfx mem (0=off, 1=scaled, 2=all)
@endnode
13 years, 10 months
r7022 chris_y - /trunk/netsurf/amiga/plotters.c
by netsurf@semichrome.net
Author: chris_y
Date: Wed Apr 1 12:40:09 2009
New Revision: 7022
URL: http://source.netsurf-browser.org?rev=7022&view=rev
Log:
Sync full Cairo build with GTK Cairo plotters
(this was in the previous commit with a copy'n'paste error)
Modified:
trunk/netsurf/amiga/plotters.c
Modified: trunk/netsurf/amiga/plotters.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/plotters.c?rev=7022...
==============================================================================
--- trunk/netsurf/amiga/plotters.c (original)
+++ trunk/netsurf/amiga/plotters.c Wed Apr 1 12:40:09 2009
@@ -182,8 +182,8 @@
width = 1;
cairo_set_line_width(glob.cr, width);
- cairo_move_to(current_cr, x0 + 0.5, y0 + 0.5);
- cairo_line_to(current_cr, x1 + 0.5, y1 + 0.5);
+ cairo_move_to(glob.cr, x0 + 0.5, y0 + 0.5);
+ cairo_line_to(glob.cr, x1 + 0.5, y1 + 0.5);
cairo_stroke(glob.cr);
#endif
return true;
13 years, 10 months
r7021 chris_y - in /trunk/netsurf/amiga: dist/NetSurf.guide font.c options.h plotters.c
by netsurf@semichrome.net
Author: chris_y
Date: Wed Apr 1 12:36:18 2009
New Revision: 7021
URL: http://source.netsurf-browser.org?rev=7021&view=rev
Log:
Remove option_quick_text (local charset text printing)
Modified:
trunk/netsurf/amiga/dist/NetSurf.guide
trunk/netsurf/amiga/font.c
trunk/netsurf/amiga/options.h
trunk/netsurf/amiga/plotters.c
Modified: trunk/netsurf/amiga/dist/NetSurf.guide
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/dist/NetSurf.guide?...
==============================================================================
--- trunk/netsurf/amiga/dist/NetSurf.guide (original)
+++ trunk/netsurf/amiga/dist/NetSurf.guide Wed Apr 1 12:36:18 2009
@@ -44,7 +44,6 @@
@{b}recent_file@{ub} Path to file to store recent history list
@{b}arexx_dir@{ub} Path to ARexx scripts dir
@{b}download_dir@{ub} default download destination
-@{b}quick_text@{ub} enable for local charset text only (not recommended)
@{b}faster_scroll@{ub} enable faster scrolling (experimental)
@{b}cache_bitmaps@{ub} cache bitmaps in native format in gfx mem (0=off, 1=sclaed, 2=all)
Modified: trunk/netsurf/amiga/font.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/font.c?rev=7021&r1=...
==============================================================================
--- trunk/netsurf/amiga/font.c (original)
+++ trunk/netsurf/amiga/font.c Wed Apr 1 12:36:18 2009
@@ -66,16 +66,7 @@
{
struct TextFont *tfont;
- if(option_quick_text)
- {
- tfont = ami_open_font(style);
- *width = TextLength(currp,string,length); //buffer,strlen(buffer));
- ami_close_font(tfont);
- }
- else
- {
- *width = ami_unicode_text(NULL,string,length,style,0,0,0);
- }
+ *width = ami_unicode_text(NULL,string,length,style,0,0,0);
return true;
}
@@ -99,76 +90,61 @@
{
struct TextExtent extent;
struct TextFont *tfont;
-
- if(option_quick_text)
- {
- tfont = ami_open_font(style);
-
- *char_offset = TextFit(currp,string,length,
- &extent,NULL,1,x,32767);
-
- *actual_x = extent.te_Extent.MaxX;
-
- ami_close_font(tfont);
- }
- else
- {
- uint16 *utf16 = NULL, *outf16 = NULL;
- struct OutlineFont *ofont;
- struct GlyphMap *glyph;
- uint32 tx=0,i=0;
- size_t len,utf8len;
- uint8 *utf8;
- uint32 co = 0;
-
- len = utf8_bounded_length(string, length);
- if(utf8_to_enc(string,"UTF-16",length,&utf16) != UTF8_CONVERT_OK) return;
- outf16 = utf16;
-
- if(!(ofont = ami_open_outline_font(style))) return 0;
-
- *char_offset = length;
-
- for(i=0;i<len;i++)
- {
- if(ESetInfo(&ofont->olf_EEngine,
- OT_GlyphCode,*utf16,
- TAG_END) == OTERR_Success)
+ uint16 *utf16 = NULL, *outf16 = NULL;
+ struct OutlineFont *ofont;
+ struct GlyphMap *glyph;
+ uint32 tx=0,i=0;
+ size_t len,utf8len;
+ uint8 *utf8;
+ uint32 co = 0;
+
+ len = utf8_bounded_length(string, length);
+ if(utf8_to_enc(string,"UTF-16",length,&utf16) != UTF8_CONVERT_OK) return;
+ outf16 = utf16;
+
+ if(!(ofont = ami_open_outline_font(style))) return 0;
+
+ *char_offset = length;
+
+ for(i=0;i<len;i++)
+ {
+ if(ESetInfo(&ofont->olf_EEngine,
+ OT_GlyphCode,*utf16,
+ TAG_END) == OTERR_Success)
+ {
+ if(EObtainInfo(&ofont->olf_EEngine,
+ OT_GlyphMap8Bit,&glyph,
+ TAG_END) == 0)
{
- if(EObtainInfo(&ofont->olf_EEngine,
- OT_GlyphMap8Bit,&glyph,
- TAG_END) == 0)
+ if(utf8_from_enc(utf16,"UTF-16",4,&utf8) != UTF8_CONVERT_OK) return;
+ utf8len = utf8_char_byte_length(utf8);
+ free(utf8);
+
+ if(x<tx+glyph->glm_X1)
{
- if(utf8_from_enc(utf16,"UTF-16",4,&utf8) != UTF8_CONVERT_OK) return;
- utf8len = utf8_char_byte_length(utf8);
- free(utf8);
-
- if(x<tx+glyph->glm_X1)
- {
- i = len+1;
- }
- else
- {
- co += utf8len;
- }
-
- *actual_x = tx;
- tx+= glyph->glm_X1;
-
- EReleaseInfo(&ofont->olf_EEngine,
- OT_GlyphMap8Bit,glyph,
- TAG_END);
+ i = len+1;
}
+ else
+ {
+ co += utf8len;
+ }
+
+ *actual_x = tx;
+ tx+= glyph->glm_X1;
+
+ EReleaseInfo(&ofont->olf_EEngine,
+ OT_GlyphMap8Bit,glyph,
+ TAG_END);
}
- if (*utf16 < 0xD800 || 0xDFFF < *utf16)
- utf16++;
- else
- utf16 += 2;
- }
- *char_offset = co;
- if(co>=length) *actual_x = tx;
- free(outf16);
- }
+ }
+ if (*utf16 < 0xD800 || 0xDFFF < *utf16)
+ utf16++;
+ else
+ utf16 += 2;
+ }
+ *char_offset = co;
+ if(co>=length) *actual_x = tx;
+ free(outf16);
return true;
}
@@ -199,189 +175,63 @@
ULONG co;
char *charp;
struct TextFont *tfont;
-
- if(option_quick_text)
- {
- tfont = ami_open_font(style);
-
- co = TextFit(currp,string,length,
- &extent,NULL,1,x,32767);
-
- charp = string+co;
- while(((*charp != ' ')) && (charp > string))
- {
- charp--;
- co--;
- }
-
- *char_offset = co;
- if(string && co)
- {
- *actual_x = TextLength(currp,string,co);
- }
- else
- {
- *actual_x = 0;
- }
-
- ami_close_font(tfont);
- }
- else
- {
- uint16 *utf16 = NULL,*outf16 = NULL;
- struct OutlineFont *ofont;
- struct GlyphMap *glyph;
- uint32 tx=0,i=0;
- size_t len;
-
- len = utf8_bounded_length(string, length);
- if(utf8_to_enc(string,"UTF-16",length,&utf16) != UTF8_CONVERT_OK) return;
- outf16 = utf16;
- if(!(ofont = ami_open_outline_font(style))) return 0;
-
- *char_offset = 0;
-
- for(i=0;i<len;i++)
- {
- if(ESetInfo(&ofont->olf_EEngine,
- OT_GlyphCode,*utf16,
- TAG_END) == OTERR_Success)
+ uint16 *utf16 = NULL,*outf16 = NULL;
+ struct OutlineFont *ofont;
+ struct GlyphMap *glyph;
+ uint32 tx=0,i=0;
+ size_t len;
+
+ len = utf8_bounded_length(string, length);
+ if(utf8_to_enc(string,"UTF-16",length,&utf16) != UTF8_CONVERT_OK) return;
+ outf16 = utf16;
+ if(!(ofont = ami_open_outline_font(style))) return 0;
+
+ *char_offset = 0;
+
+ for(i=0;i<len;i++)
+ {
+ if(ESetInfo(&ofont->olf_EEngine,
+ OT_GlyphCode,*utf16,
+ TAG_END) == OTERR_Success)
+ {
+ if(EObtainInfo(&ofont->olf_EEngine,
+ OT_GlyphMap8Bit,&glyph,
+ TAG_END) == 0)
{
- if(EObtainInfo(&ofont->olf_EEngine,
- OT_GlyphMap8Bit,&glyph,
- TAG_END) == 0)
+ if(*utf16 == 0x0020)
{
- if(*utf16 == 0x0020)
- {
- *actual_x = tx;
- co = i;
- }
-
- if(x<tx+glyph->glm_X1)
- {
- i = length+1;
- }
-
- tx+= glyph->glm_X1;
-
- EReleaseInfo(&ofont->olf_EEngine,
- OT_GlyphMap8Bit,glyph,
- TAG_END);
+ *actual_x = tx;
+ co = i;
}
+
+ if(x<tx+glyph->glm_X1)
+ {
+ i = length+1;
+ }
+
+ tx+= glyph->glm_X1;
+
+ EReleaseInfo(&ofont->olf_EEngine,
+ OT_GlyphMap8Bit,glyph,
+ TAG_END);
}
- if (*utf16 < 0xD800 || 0xDFFF < *utf16)
- utf16++;
- else
- utf16 += 2;
- }
-
- charp = string+co;
- while(((*charp != ' ')) && (charp > string))
- {
- charp--;
- co--;
- }
- *char_offset = co;
- free(outf16);
- }
+ }
+ if (*utf16 < 0xD800 || 0xDFFF < *utf16)
+ utf16++;
+ else
+ utf16 += 2;
+ }
+
+ charp = string+co;
+ while(((*charp != ' ')) && (charp > string))
+ {
+ charp--;
+ co--;
+ }
+ *char_offset = co;
+ free(outf16);
return true;
-}
-
-struct TextFont *ami_open_font(struct css_style *style)
-{
- struct TextFont *tfont;
- struct TTextAttr tattr;
- struct TagItem tattrtags[2];
- char fontname[256];
-
- switch(style->font_family)
- {
- case CSS_FONT_FAMILY_SANS_SERIF:
- strcpy(fontname,option_font_sans);
- break;
-
- case CSS_FONT_FAMILY_SERIF:
- strcpy(fontname,option_font_serif);
- break;
-
- case CSS_FONT_FAMILY_MONOSPACE:
- strcpy(fontname,option_font_mono);
- break;
-
- case CSS_FONT_FAMILY_CURSIVE:
- strcpy(fontname,option_font_cursive);
- break;
-
- case CSS_FONT_FAMILY_FANTASY:
- strcpy(fontname,option_font_fantasy);
- break;
-
- default:
- strcpy(fontname,option_font_sans);
- break;
- }
-
- switch(style->font_style)
- {
- case CSS_FONT_STYLE_ITALIC:
- case CSS_FONT_STYLE_OBLIQUE:
- tattr.tta_Style = FSF_ITALIC;
- break;
-
- default:
- tattr.tta_Style = FS_NORMAL;
- break;
- }
-
- switch(style->font_weight)
- {
- case CSS_FONT_WEIGHT_BOLD:
- case CSS_FONT_WEIGHT_BOLDER:
- tattr.tta_Style |= FSF_BOLD;
- break;
- }
-
-/* not supported
- switch(style->font_variant)
- {
- default:
- //printf("font variant: %ld\n",style->font_variant);
- break;
- }
-*/
-
- tattr.tta_YSize = css_len2px(&style->font_size.value.length, style);
-
- if(tattr.tta_YSize < option_font_min_size)
- tattr.tta_YSize = option_font_min_size;
-
- tattr.tta_Flags = 0;
-
-/* Uncommenting this changes the font's charset.
- 106 is UTF-8 but OS4 doesn't support it so this only results in a crash!
-
- tattrtags[0].ti_Tag = TA_CharSet;
- tattrtags[0].ti_Data = 106;
- tattrtags[1].ti_Tag = TAG_DONE;
-
- tattr.tta_Flags = FSB_TAGGED;
- tattr.tta_Tags = &tattrtags;
-*/
-
- strcat(fontname,".font");
- tattr.tta_Name = fontname;
-
- tfont = OpenDiskFont((struct TextAttr *)&tattr);
-
- if(tfont)
- {
- SetRPAttrs(currp,
- RPTAG_Font,tfont,
- TAG_DONE);
- }
-
- return tfont;
}
struct OutlineFont *ami_open_outline_font(struct css_style *style)
@@ -443,15 +293,6 @@
}
return NULL;
-}
-
-void ami_close_font(struct TextFont *tfont)
-{
- SetRPAttrs(currp,
- RPTAG_Font,origrpfont,
- TAG_DONE);
-
- if(tfont) CloseFont(tfont);
}
ULONG ami_unicode_text(struct RastPort *rp,char *string,ULONG length,struct css_style *style,ULONG dx, ULONG dy, ULONG c)
@@ -531,46 +372,43 @@
int i;
char *bname,*iname,*biname;
- if(!option_quick_text)
- {
- of[CSS_FONT_FAMILY_SANS_SERIF] = OpenOutlineFont(option_font_sans,NULL,OFF_OPEN);
- of[CSS_FONT_FAMILY_SERIF] = OpenOutlineFont(option_font_serif,NULL,OFF_OPEN);
- of[CSS_FONT_FAMILY_MONOSPACE] = OpenOutlineFont(option_font_mono,NULL,OFF_OPEN);
- of[CSS_FONT_FAMILY_CURSIVE] = OpenOutlineFont(option_font_cursive,NULL,OFF_OPEN);
- of[CSS_FONT_FAMILY_FANTASY] = OpenOutlineFont(option_font_fantasy,NULL,OFF_OPEN);
- of[CSS_FONT_FAMILY_UNKNOWN] = OpenOutlineFont(option_font_sans,NULL,OFF_OPEN);
- of[CSS_FONT_FAMILY_NOT_SET] = OpenOutlineFont(option_font_sans,NULL,OFF_OPEN);
-
- for(i=CSS_FONT_FAMILY_SANS_SERIF;i<=CSS_FONT_FAMILY_NOT_SET;i++)
- {
- if(!of[i]) warn_user("FontError",""); // temporary error message
-
- if(bname = GetTagData(OT_BName,0,of[i]->olf_OTagList))
- {
- ofb[i] = OpenOutlineFont(bname,NULL,OFF_OPEN);
- }
- else
- {
- ofb[i] = NULL;
- }
-
- if(iname = GetTagData(OT_IName,0,of[i]->olf_OTagList))
- {
- ofi[i] = OpenOutlineFont(iname,NULL,OFF_OPEN);
- }
- else
- {
- ofi[i] = NULL;
- }
-
- if(biname = GetTagData(OT_BIName,0,of[i]->olf_OTagList))
- {
- ofbi[i] = OpenOutlineFont(biname,NULL,OFF_OPEN);
- }
- else
- {
- ofbi[i] = NULL;
- }
+ of[CSS_FONT_FAMILY_SANS_SERIF] = OpenOutlineFont(option_font_sans,NULL,OFF_OPEN);
+ of[CSS_FONT_FAMILY_SERIF] = OpenOutlineFont(option_font_serif,NULL,OFF_OPEN);
+ of[CSS_FONT_FAMILY_MONOSPACE] = OpenOutlineFont(option_font_mono,NULL,OFF_OPEN);
+ of[CSS_FONT_FAMILY_CURSIVE] = OpenOutlineFont(option_font_cursive,NULL,OFF_OPEN);
+ of[CSS_FONT_FAMILY_FANTASY] = OpenOutlineFont(option_font_fantasy,NULL,OFF_OPEN);
+ of[CSS_FONT_FAMILY_UNKNOWN] = OpenOutlineFont(option_font_sans,NULL,OFF_OPEN);
+ of[CSS_FONT_FAMILY_NOT_SET] = OpenOutlineFont(option_font_sans,NULL,OFF_OPEN);
+
+ for(i=CSS_FONT_FAMILY_SANS_SERIF;i<=CSS_FONT_FAMILY_NOT_SET;i++)
+ {
+ if(!of[i]) warn_user("FontError",""); // temporary error message
+
+ if(bname = GetTagData(OT_BName,0,of[i]->olf_OTagList))
+ {
+ ofb[i] = OpenOutlineFont(bname,NULL,OFF_OPEN);
+ }
+ else
+ {
+ ofb[i] = NULL;
+ }
+
+ if(iname = GetTagData(OT_IName,0,of[i]->olf_OTagList))
+ {
+ ofi[i] = OpenOutlineFont(iname,NULL,OFF_OPEN);
+ }
+ else
+ {
+ ofi[i] = NULL;
+ }
+
+ if(biname = GetTagData(OT_BIName,0,of[i]->olf_OTagList))
+ {
+ ofbi[i] = OpenOutlineFont(biname,NULL,OFF_OPEN);
+ }
+ else
+ {
+ ofbi[i] = NULL;
}
}
}
@@ -579,14 +417,11 @@
{
int i=0;
- if(!option_quick_text)
- {
- for(i=CSS_FONT_FAMILY_SANS_SERIF;i<=CSS_FONT_FAMILY_NOT_SET;i++)
- {
- if(of[i]) CloseOutlineFont(of[i],NULL);
- if(ofb[i]) CloseOutlineFont(ofb[i],NULL);
- if(ofi[i]) CloseOutlineFont(ofi[i],NULL);
- if(ofbi[i]) CloseOutlineFont(ofbi[i],NULL);
- }
- }
-}
+ for(i=CSS_FONT_FAMILY_SANS_SERIF;i<=CSS_FONT_FAMILY_NOT_SET;i++)
+ {
+ if(of[i]) CloseOutlineFont(of[i],NULL);
+ if(ofb[i]) CloseOutlineFont(ofb[i],NULL);
+ if(ofi[i]) CloseOutlineFont(ofi[i],NULL);
+ if(ofbi[i]) CloseOutlineFont(ofbi[i],NULL);
+ }
+}
Modified: trunk/netsurf/amiga/options.h
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/options.h?rev=7021&...
==============================================================================
--- trunk/netsurf/amiga/options.h (original)
+++ trunk/netsurf/amiga/options.h Wed Apr 1 12:36:18 2009
@@ -38,7 +38,6 @@
extern char *option_recent_file;
extern char *option_arexx_dir;
extern char *option_download_dir;
-extern bool option_quick_text;
extern bool option_faster_scroll;
#define EXTRA_OPTION_DEFINE \
@@ -60,7 +59,6 @@
char *option_recent_file = 0; \
char *option_arexx_dir = 0; \
char *option_download_dir = 0; \
-bool option_quick_text = false; \
bool option_faster_scroll = false; \
#define EXTRA_OPTION_TABLE \
@@ -82,6 +80,5 @@
{ "recent_file", OPTION_STRING, &option_recent_file }, \
{ "arexx_dir", OPTION_STRING, &option_arexx_dir }, \
{ "download_dir", OPTION_STRING, &option_download_dir }, \
-{ "quick_text", OPTION_BOOL, &option_quick_text}, \
{ "faster_scroll", OPTION_BOOL, &option_faster_scroll},
#endif
Modified: trunk/netsurf/amiga/plotters.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/plotters.c?rev=7021...
==============================================================================
--- trunk/netsurf/amiga/plotters.c (original)
+++ trunk/netsurf/amiga/plotters.c Wed Apr 1 12:36:18 2009
@@ -182,8 +182,8 @@
width = 1;
cairo_set_line_width(glob.cr, width);
- cairo_move_to(glob.cr, x0, y0 - 0.5);
- cairo_line_to(glob.cr, x1, y1 - 0.5);
+ cairo_move_to(current_cr, x0 + 0.5, y0 + 0.5);
+ cairo_line_to(current_cr, x1 + 0.5, y1 + 0.5);
cairo_stroke(glob.cr);
#endif
return true;
@@ -283,42 +283,7 @@
bool ami_text(int x, int y, const struct css_style *style,
const char *text, size_t length, colour bg, colour c)
{
- char *buffer = NULL;
- struct TextFont *tfont;
-
- if(option_quick_text)
- {
- tfont = ami_open_font(style);
-
- SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
- RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg),
-// RPTAG_Font,tfont,
- TAG_DONE);
-
- utf8_to_local_encoding(text,length,&buffer);
-
- if(!buffer) return true;
-
-/* Below function prints Unicode text direct to the RastPort.
- * This is commented out due to lack of SDK which allows me to perform blits
- * that respect the Alpha channel. The code below that (and above) convert to
- * system default charset and write the text using graphics.library functions.
- *
- * ami_unicode_text(currp,text,length,style,x,y,c);
- *
- * or, perhaps the ttengine.library version (far too slow):
- * ami_tte_text(currp,text,length);
- */
- Move(currp,x,y);
- Text(currp,buffer,strlen(buffer));
- ami_close_font(tfont);
- ami_utf8_free(buffer);
- }
- else
- {
- ami_unicode_text(currp,text,length,style,x,y,c);
- }
-
+ ami_unicode_text(currp,text,length,style,x,y,c);
return true;
}
13 years, 10 months
r7020 jmb - in /trunk/libcss: src/parse/properties.c src/parse/propstrings.h test/data/parse/colours.dat test/data/parse2/illegal-values.dat test/data/parse2/malformed-declarations.dat
by netsurf@semichrome.net
Author: jmb
Date: Wed Apr 1 12:35:29 2009
New Revision: 7020
URL: http://source.netsurf-browser.org?rev=7020&view=rev
Log:
Support named colours.
Fix malformed declaration test data -- everything up to and including the next semicolon is dropped on the floor.
Modified:
trunk/libcss/src/parse/properties.c
trunk/libcss/src/parse/propstrings.h
trunk/libcss/test/data/parse/colours.dat
trunk/libcss/test/data/parse2/illegal-values.dat
trunk/libcss/test/data/parse2/malformed-declarations.dat
Modified: trunk/libcss/src/parse/properties.c
URL: http://source.netsurf-browser.org/trunk/libcss/src/parse/properties.c?rev...
==============================================================================
--- trunk/libcss/src/parse/properties.c (original)
+++ trunk/libcss/src/parse/properties.c Wed Apr 1 12:35:29 2009
@@ -5,8 +5,8 @@
* Copyright 2008 John-Mark Bell <jmb(a)netsurf-browser.org>
*/
-#ifndef css_parse_css21props_c_
-#define css_parse_css21props_c_
+#ifndef css_parse_properties_c_
+#define css_parse_properties_c_
#include "bytecode/bytecode.h"
#include "bytecode/opcodes.h"
@@ -314,6 +314,8 @@
uint8_t *result);
static inline css_error parse_colour_specifier(css_language *c,
const parserutils_vector *vector, int *ctx,
+ uint32_t *result);
+static css_error parse_named_colour(css_language *c, lwc_string *data,
uint32_t *result);
static inline css_error parse_hash_colour(lwc_string *data, uint32_t *result);
static inline css_error parse_unit_specifier(css_language *c,
@@ -6631,14 +6633,14 @@
}
if (token->type == CSS_TOKEN_IDENT) {
- /** \todo Parse colour names */
-
- if (c->sheet->quirks_allowed) {
+ error = parse_named_colour(c, token->idata, result);
+ if (error != CSS_OK && c->sheet->quirks_allowed) {
error = parse_hash_colour(token->idata, result);
if (error == CSS_OK)
c->sheet->quirks_used = true;
- return error;
}
+
+ return error;
} else if (token->type == CSS_TOKEN_HASH) {
return parse_hash_colour(token->idata, result);
} else if (c->sheet->quirks_allowed &&
@@ -6718,6 +6720,175 @@
}
*result = (r << 24) | (g << 16) | (b << 8);
+
+ return CSS_OK;
+}
+
+css_error parse_named_colour(css_language *c, lwc_string *data,
+ uint32_t *result)
+{
+ static const uint32_t colourmap[LAST_COLOUR + 1 - FIRST_COLOUR] = {
+ 0xf0f8ff00, /* ALICEBLUE */
+ 0xfaebd700, /* ANTIQUEWHITE */
+ 0x00ffff00, /* AQUA */
+ 0x7fffd400, /* AQUAMARINE */
+ 0xf0ffff00, /* AZURE */
+ 0xf5f5dc00, /* BEIGE */
+ 0xffe4c400, /* BISQUE */
+ 0x00000000, /* BLACK */
+ 0xffebcd00, /* BLANCHEDALMOND */
+ 0x0000ff00, /* BLUE */
+ 0x8a2be200, /* BLUEVIOLET */
+ 0xa52a2a00, /* BROWN */
+ 0xdeb88700, /* BURLYWOOD */
+ 0x5f9ea000, /* CADETBLUE */
+ 0x7fff0000, /* CHARTREUSE */
+ 0xd2691e00, /* CHOCOLATE */
+ 0xff7f5000, /* CORAL */
+ 0x6495ed00, /* CORNFLOWERBLUE */
+ 0xfff8dc00, /* CORNSILK */
+ 0xdc143c00, /* CRIMSON */
+ 0x00ffff00, /* CYAN */
+ 0x00008b00, /* DARKBLUE */
+ 0x008b8b00, /* DARKCYAN */
+ 0xb8860b00, /* DARKGOLDENROD */
+ 0xa9a9a900, /* DARKGRAY */
+ 0x00640000, /* DARKGREEN */
+ 0xa9a9a900, /* DARKGREY */
+ 0xbdb76b00, /* DARKKHAKI */
+ 0x8b008b00, /* DARKMAGENTA */
+ 0x556b2f00, /* DARKOLIVEGREEN */
+ 0xff8c0000, /* DARKORANGE */
+ 0x9932cc00, /* DARKORCHID */
+ 0x8b000000, /* DARKRED */
+ 0xe9967a00, /* DARKSALMON */
+ 0x8fbc8f00, /* DARKSEAGREEN */
+ 0x483d8b00, /* DARKSLATEBLUE */
+ 0x2f4f4f00, /* DARKSLATEGRAY */
+ 0x2f4f4f00, /* DARKSLATEGREY */
+ 0x00ced100, /* DARKTURQUOISE */
+ 0x9400d300, /* DARKVIOLET */
+ 0xff149300, /* DEEPPINK */
+ 0x00bfff00, /* DEEPSKYBLUE */
+ 0x69696900, /* DIMGRAY */
+ 0x69696900, /* DIMGREY */
+ 0x1e90ff00, /* DODGERBLUE */
+ 0xd1927500, /* FELDSPAR */
+ 0xb2222200, /* FIREBRICK */
+ 0xfffaf000, /* FLORALWHITE */
+ 0x228b2200, /* FORESTGREEN */
+ 0xff00ff00, /* FUCHSIA */
+ 0xdcdcdc00, /* GAINSBORO */
+ 0xf8f8ff00, /* GHOSTWHITE */
+ 0xffd70000, /* GOLD */
+ 0xdaa52000, /* GOLDENROD */
+ 0x80808000, /* GRAY */
+ 0x00800000, /* GREEN */
+ 0xadff2f00, /* GREENYELLOW */
+ 0x80808000, /* GREY */
+ 0xf0fff000, /* HONEYDEW */
+ 0xff69b400, /* HOTPINK */
+ 0xcd5c5c00, /* INDIANRED */
+ 0x4b008200, /* INDIGO */
+ 0xfffff000, /* IVORY */
+ 0xf0e68c00, /* KHAKI */
+ 0xe6e6fa00, /* LAVENDER */
+ 0xfff0f500, /* LAVENDERBLUSH */
+ 0x7cfc0000, /* LAWNGREEN */
+ 0xfffacd00, /* LEMONCHIFFON */
+ 0xadd8e600, /* LIGHTBLUE */
+ 0xf0808000, /* LIGHTCORAL */
+ 0xe0ffff00, /* LIGHTCYAN */
+ 0xfafad200, /* LIGHTGOLDENRODYELLOW */
+ 0xd3d3d300, /* LIGHTGRAY */
+ 0x90ee9000, /* LIGHTGREEN */
+ 0xd3d3d300, /* LIGHTGREY */
+ 0xffb6c100, /* LIGHTPINK */
+ 0xffa07a00, /* LIGHTSALMON */
+ 0x20b2aa00, /* LIGHTSEAGREEN */
+ 0x87cefa00, /* LIGHTSKYBLUE */
+ 0x8470ff00, /* LIGHTSLATEBLUE */
+ 0x77889900, /* LIGHTSLATEGRAY */
+ 0x77889900, /* LIGHTSLATEGREY */
+ 0xb0c4de00, /* LIGHTSTEELBLUE */
+ 0xffffe000, /* LIGHTYELLOW */
+ 0x00ff0000, /* LIME */
+ 0x32cd3200, /* LIMEGREEN */
+ 0xfaf0e600, /* LINEN */
+ 0xff00ff00, /* MAGENTA */
+ 0x80000000, /* MAROON */
+ 0x66cdaa00, /* MEDIUMAQUAMARINE */
+ 0x0000cd00, /* MEDIUMBLUE */
+ 0xba55d300, /* MEDIUMORCHID */
+ 0x9370db00, /* MEDIUMPURPLE */
+ 0x3cb37100, /* MEDIUMSEAGREEN */
+ 0x7b68ee00, /* MEDIUMSLATEBLUE */
+ 0x00fa9a00, /* MEDIUMSPRINGGREEN */
+ 0x48d1cc00, /* MEDIUMTURQUOISE */
+ 0xc7158500, /* MEDIUMVIOLETRED */
+ 0x19197000, /* MIDNIGHTBLUE */
+ 0xf5fffa00, /* MINTCREAM */
+ 0xffe4e100, /* MISTYROSE */
+ 0xffe4b500, /* MOCCASIN */
+ 0xffdead00, /* NAVAJOWHITE */
+ 0x00008000, /* NAVY */
+ 0xfdf5e600, /* OLDLACE */
+ 0x80800000, /* OLIVE */
+ 0x6b8e2300, /* OLIVEDRAB */
+ 0xffa50000, /* ORANGE */
+ 0xff450000, /* ORANGERED */
+ 0xda70d600, /* ORCHID */
+ 0xeee8aa00, /* PALEGOLDENROD */
+ 0x98fb9800, /* PALEGREEN */
+ 0xafeeee00, /* PALETURQUOISE */
+ 0xdb709300, /* PALEVIOLETRED */
+ 0xffefd500, /* PAPAYAWHIP */
+ 0xffdab900, /* PEACHPUFF */
+ 0xcd853f00, /* PERU */
+ 0xffc0cb00, /* PINK */
+ 0xdda0dd00, /* PLUM */
+ 0xb0e0e600, /* POWDERBLUE */
+ 0x80008000, /* PURPLE */
+ 0xff000000, /* RED */
+ 0xbc8f8f00, /* ROSYBROWN */
+ 0x4169e100, /* ROYALBLUE */
+ 0x8b451300, /* SADDLEBROWN */
+ 0xfa807200, /* SALMON */
+ 0xf4a46000, /* SANDYBROWN */
+ 0x2e8b5700, /* SEAGREEN */
+ 0xfff5ee00, /* SEASHELL */
+ 0xa0522d00, /* SIENNA */
+ 0xc0c0c000, /* SILVER */
+ 0x87ceeb00, /* SKYBLUE */
+ 0x6a5acd00, /* SLATEBLUE */
+ 0x70809000, /* SLATEGRAY */
+ 0x70809000, /* SLATEGREY */
+ 0xfffafa00, /* SNOW */
+ 0x00ff7f00, /* SPRINGGREEN */
+ 0x4682b400, /* STEELBLUE */
+ 0xd2b48c00, /* TAN */
+ 0x00808000, /* TEAL */
+ 0xd8bfd800, /* THISTLE */
+ 0xff634700, /* TOMATO */
+ 0x40e0d000, /* TURQUOISE */
+ 0xee82ee00, /* VIOLET */
+ 0xd0209000, /* VIOLETRED */
+ 0xf5deb300, /* WHEAT */
+ 0xffffff00, /* WHITE */
+ 0xf5f5f500, /* WHITESMOKE */
+ 0xffff0000, /* YELLOW */
+ 0x9acd3200 /* YELLOWGREEN */
+ };
+ int i;
+
+ for (i = FIRST_COLOUR; i <= LAST_COLOUR; i++) {
+ if (data == c->strings[i])
+ break;
+ }
+ if (i == LAST_COLOUR + 1)
+ return CSS_INVALID;
+
+ *result = colourmap[i - FIRST_COLOUR];
return CSS_OK;
}
Modified: trunk/libcss/src/parse/propstrings.h
URL: http://source.netsurf-browser.org/trunk/libcss/src/parse/propstrings.h?re...
==============================================================================
--- trunk/libcss/src/parse/propstrings.h (original)
+++ trunk/libcss/src/parse/propstrings.h Wed Apr 1 12:35:29 2009
@@ -81,6 +81,37 @@
W_RESIZE, TEXT, WAIT, HELP, PROGRESS, SERIF, SANS_SERIF, CURSIVE,
FANTASY, MONOSPACE, MALE, FEMALE, CHILD, MIX, UNDERLINE, OVERLINE,
LINE_THROUGH, BLINK, RGB,
+
+ /* Named colours */
+ FIRST_COLOUR,
+
+ ALICEBLUE = FIRST_COLOUR, ANTIQUEWHITE, AQUA, AQUAMARINE, AZURE,
+ BEIGE, BISQUE, BLACK, BLANCHEDALMOND, BLUE, BLUEVIOLET, BROWN,
+ BURLYWOOD, CADETBLUE, CHARTREUSE, CHOCOLATE, CORAL, CORNFLOWERBLUE,
+ CORNSILK, CRIMSON, CYAN, DARKBLUE, DARKCYAN, DARKGOLDENROD, DARKGRAY,
+ DARKGREEN, DARKGREY, DARKKHAKI, DARKMAGENTA, DARKOLIVEGREEN, DARKORANGE,
+ DARKORCHID, DARKRED, DARKSALMON, DARKSEAGREEN, DARKSLATEBLUE,
+ DARKSLATEGRAY, DARKSLATEGREY, DARKTURQUOISE, DARKVIOLET, DEEPPINK,
+ DEEPSKYBLUE, DIMGRAY, DIMGREY, DODGERBLUE, FELDSPAR, FIREBRICK,
+ FLORALWHITE, FORESTGREEN, FUCHSIA, GAINSBORO, GHOSTWHITE, GOLD,
+ GOLDENROD, GRAY, GREEN, GREENYELLOW, GREY, HONEYDEW, HOTPINK,
+ INDIANRED, INDIGO, IVORY, KHAKI, LAVENDER, LAVENDERBLUSH, LAWNGREEN,
+ LEMONCHIFFON, LIGHTBLUE, LIGHTCORAL, LIGHTCYAN, LIGHTGOLDENRODYELLOW,
+ LIGHTGRAY, LIGHTGREEN, LIGHTGREY, LIGHTPINK, LIGHTSALMON, LIGHTSEAGREEN,
+ LIGHTSKYBLUE, LIGHTSLATEBLUE, LIGHTSLATEGRAY, LIGHTSLATEGREY,
+ LIGHTSTEELBLUE, LIGHTYELLOW, LIME, LIMEGREEN, LINEN, MAGENTA, MAROON,
+ MEDIUMAQUAMARINE, MEDIUMBLUE, MEDIUMORCHID, MEDIUMPURPLE,
+ MEDIUMSEAGREEN, MEDIUMSLATEBLUE, MEDIUMSPRINGGREEN, MEDIUMTURQUOISE,
+ MEDIUMVIOLETRED, MIDNIGHTBLUE, MINTCREAM, MISTYROSE, MOCCASIN,
+ NAVAJOWHITE, NAVY, OLDLACE, OLIVE, OLIVEDRAB, ORANGE, ORANGERED,
+ ORCHID, PALEGOLDENROD, PALEGREEN, PALETURQUOISE, PALEVIOLETRED,
+ PAPAYAWHIP, PEACHPUFF, PERU, PINK, PLUM, POWDERBLUE, PURPLE, RED,
+ ROSYBROWN, ROYALBLUE, SADDLEBROWN, SALMON, SANDYBROWN, SEAGREEN,
+ SEASHELL, SIENNA, SILVER, SKYBLUE, SLATEBLUE, SLATEGRAY, SLATEGREY,
+ SNOW, SPRINGGREEN, STEELBLUE, TAN, TEAL, THISTLE, TOMATO, TURQUOISE,
+ VIOLET, VIOLETRED, WHEAT, WHITE, WHITESMOKE, YELLOW, YELLOWGREEN,
+
+ LAST_COLOUR = YELLOWGREEN,
LAST_KNOWN
};
@@ -394,7 +425,158 @@
{ "overline", SLEN("overline") },
{ "line-through", SLEN("line-through") },
{ "blink", SLEN("blink") },
- { "rgb", SLEN("rgb") }
+ { "rgb", SLEN("rgb") },
+
+ { "aliceblue", SLEN("aliceblue") },
+ { "antiquewhite", SLEN("antiquewhite") },
+ { "aqua", SLEN("aqua") },
+ { "aquamarine", SLEN("aquamarine") },
+ { "azure", SLEN("azure") },
+ { "beige", SLEN("beige") },
+ { "bisque", SLEN("bisque") },
+ { "black", SLEN("black") },
+ { "blanchedalmond", SLEN("blanchedalmond") },
+ { "blue", SLEN("blue") },
+ { "blueviolet", SLEN("blueviolet") },
+ { "brown", SLEN("brown") },
+ { "burlywood", SLEN("burlywood") },
+ { "cadetblue", SLEN("cadetblue") },
+ { "chartreuse", SLEN("chartreuse") },
+ { "chocolate", SLEN("chocolate") },
+ { "coral", SLEN("coral") },
+ { "cornflowerblue", SLEN("cornflowerblue") },
+ { "cornsilk", SLEN("cornsilk") },
+ { "crimson", SLEN("crimson") },
+ { "cyan", SLEN("cyan") },
+ { "darkblue", SLEN("darkblue") },
+ { "darkcyan", SLEN("darkcyan") },
+ { "darkgoldenrod", SLEN("darkgoldenrod") },
+ { "darkgray", SLEN("darkgray") },
+ { "darkgreen", SLEN("darkgreen") },
+ { "darkgrey", SLEN("darkgrey") },
+ { "darkkhaki", SLEN("darkkhaki") },
+ { "darkmagenta", SLEN("darkmagenta") },
+ { "darkolivegreen", SLEN("darkolivegreen") },
+ { "darkorange", SLEN("darkorange") },
+ { "darkorchid", SLEN("darkorchid") },
+ { "darkred", SLEN("darkred") },
+ { "darksalmon", SLEN("darksalmon") },
+ { "darkseagreen", SLEN("darkseagreen") },
+ { "darkslateblue", SLEN("darkslateblue") },
+ { "darkslategray", SLEN("darkslategray") },
+ { "darkslategrey", SLEN("darkslategrey") },
+ { "darkturquoise", SLEN("darkturquoise") },
+ { "darkviolet", SLEN("darkviolet") },
+ { "deeppink", SLEN("deeppink") },
+ { "deepskyblue", SLEN("deepskyblue") },
+ { "dimgray", SLEN("dimgray") },
+ { "dimgrey", SLEN("dimgrey") },
+ { "dodgerblue", SLEN("dodgerblue") },
+ { "feldspar", SLEN("feldspar") },
+ { "firebrick", SLEN("firebrick") },
+ { "floralwhite", SLEN("floralwhite") },
+ { "forestgreen", SLEN("forestgreen") },
+ { "fuchsia", SLEN("fuchsia") },
+ { "gainsboro", SLEN("gainsboro") },
+ { "ghostwhite", SLEN("ghostwhite") },
+ { "gold", SLEN("gold") },
+ { "goldenrod", SLEN("goldenrod") },
+ { "gray", SLEN("gray") },
+ { "green", SLEN("green") },
+ { "greenyellow", SLEN("greenyellow") },
+ { "grey", SLEN("grey") },
+ { "honeydew", SLEN("honeydew") },
+ { "hotpink", SLEN("hotpink") },
+ { "indianred", SLEN("indianred") },
+ { "indigo", SLEN("indigo") },
+ { "ivory", SLEN("ivory") },
+ { "khaki", SLEN("khaki") },
+ { "lavender", SLEN("lavender") },
+ { "lavenderblush", SLEN("lavenderblush") },
+ { "lawngreen", SLEN("lawngreen") },
+ { "lemonchiffon", SLEN("lemonchiffon") },
+ { "lightblue", SLEN("lightblue") },
+ { "lightcoral", SLEN("lightcoral") },
+ { "lightcyan", SLEN("lightcyan") },
+ { "lightgoldenrodyellow", SLEN("lightgoldenrodyellow") },
+ { "lightgray", SLEN("lightgray") },
+ { "lightgreen", SLEN("lightgreen") },
+ { "lightgrey", SLEN("lightgrey") },
+ { "lightpink", SLEN("lightpink") },
+ { "lightsalmon", SLEN("lightsalmon") },
+ { "lightseagreen", SLEN("lightseagreen") },
+ { "lightskyblue", SLEN("lightskyblue") },
+ { "lightslateblue", SLEN("lightslateblue") },
+ { "lightslategray", SLEN("lightslategray") },
+ { "lightslategrey", SLEN("lightslategrey") },
+ { "lightsteelblue", SLEN("lightsteelblue") },
+ { "lightyellow", SLEN("lightyellow") },
+ { "lime", SLEN("lime") },
+ { "limegreen", SLEN("limegreen") },
+ { "linen", SLEN("linen") },
+ { "magenta", SLEN("magenta") },
+ { "maroon", SLEN("maroon") },
+ { "mediumaquamarine", SLEN("mediumaquamarine") },
+ { "mediumblue", SLEN("mediumblue") },
+ { "mediumorchid", SLEN("mediumorchid") },
+ { "mediumpurple", SLEN("mediumpurple") },
+ { "mediumseagreen", SLEN("mediumseagreen") },
+ { "mediumslateblue", SLEN("mediumslateblue") },
+ { "mediumspringgreen", SLEN("mediumspringgreen") },
+ { "mediumturquoise", SLEN("mediumturquoise") },
+ { "mediumvioletred", SLEN("mediumvioletred") },
+ { "midnightblue", SLEN("midnightblue") },
+ { "mintcream", SLEN("mintcream") },
+ { "mistyrose", SLEN("mistyrose") },
+ { "moccasin", SLEN("moccasin") },
+ { "navajowhite", SLEN("navajowhite") },
+ { "navy", SLEN("navy") },
+ { "oldlace", SLEN("oldlace") },
+ { "olive", SLEN("olive") },
+ { "olivedrab", SLEN("olivedrab") },
+ { "orange", SLEN("orange") },
+ { "orangered", SLEN("orangered") },
+ { "orchid", SLEN("orchid") },
+ { "palegoldenrod", SLEN("palegoldenrod") },
+ { "palegreen", SLEN("palegreen") },
+ { "paleturquoise", SLEN("paleturquoise") },
+ { "palevioletred", SLEN("palevioletred") },
+ { "papayawhip", SLEN("papayawhip") },
+ { "peachpuff", SLEN("peachpuff") },
+ { "peru", SLEN("peru") },
+ { "pink", SLEN("pink") },
+ { "plum", SLEN("plum") },
+ { "powderblue", SLEN("powderblue") },
+ { "purple", SLEN("purple") },
+ { "red", SLEN("red") },
+ { "rosybrown", SLEN("rosybrown") },
+ { "royalblue", SLEN("royalblue") },
+ { "saddlebrown", SLEN("saddlebrown") },
+ { "salmon", SLEN("salmon") },
+ { "sandybrown", SLEN("sandybrown") },
+ { "seagreen", SLEN("seagreen") },
+ { "seashell", SLEN("seashell") },
+ { "sienna", SLEN("sienna") },
+ { "silver", SLEN("silver") },
+ { "skyblue", SLEN("skyblue") },
+ { "slateblue", SLEN("slateblue") },
+ { "slategray", SLEN("slategray") },
+ { "slategrey", SLEN("slategrey") },
+ { "snow", SLEN("snow") },
+ { "springgreen", SLEN("springgreen") },
+ { "steelblue", SLEN("steelblue") },
+ { "tan", SLEN("tan") },
+ { "teal", SLEN("teal") },
+ { "thistle", SLEN("thistle") },
+ { "tomato", SLEN("tomato") },
+ { "turquoise", SLEN("turquoise") },
+ { "violet", SLEN("violet") },
+ { "violetred", SLEN("violetred") },
+ { "wheat", SLEN("wheat") },
+ { "white", SLEN("white") },
+ { "whitesmoke", SLEN("whitesmoke") },
+ { "yellow", SLEN("yellow") },
+ { "yellowgreen", SLEN("yellowgreen") }
};
#endif
Modified: trunk/libcss/test/data/parse/colours.dat
URL: http://source.netsurf-browser.org/trunk/libcss/test/data/parse/colours.da...
==============================================================================
--- trunk/libcss/test/data/parse/colours.dat (original)
+++ trunk/libcss/test/data/parse/colours.dat Wed Apr 1 12:35:29 2009
@@ -1,12 +1,12 @@
## Simple colour values
-##data
-#* { color: red }
-##errors
-##expected
-#| 1 *
-#| 0x02000018 0xff000000
-##reset
+#data
+* { color: red }
+#errors
+#expected
+| 1 *
+| 0x02000018 0xff000000
+#reset
#data
* { color: #f00 }
Modified: trunk/libcss/test/data/parse2/illegal-values.dat
URL: http://source.netsurf-browser.org/trunk/libcss/test/data/parse2/illegal-v...
==============================================================================
--- trunk/libcss/test/data/parse2/illegal-values.dat (original)
+++ trunk/libcss/test/data/parse2/illegal-values.dat Wed Apr 1 12:35:29 2009
@@ -122,19 +122,19 @@
| *
#reset
-##data
-#* { background-color: -bbc; }
-##errors
-##expected
-#| *
-##reset
-
-##data
-#* { background-color: -bbc111; }
-##errors
-##expected
-#| *
-##reset
+#data
+* { background-color: -bbc; }
+#errors
+#expected
+| *
+#reset
+
+#data
+* { background-color: -bbc111; }
+#errors
+#expected
+| *
+#reset
#data
* { background-image: 0; }
@@ -2205,12 +2205,12 @@
| *
#reset
-##data
-#* { outline-color: red black; }
-##errors
-##expected
-#| *
-##reset
+#data
+* { outline-color: red black; }
+#errors
+#expected
+| *
+#reset
#data
* { outline-color: #BBC Radio 4; }
@@ -2226,26 +2226,26 @@
| *
#reset
-##data
-#* { outline-color: rgb); }
-##errors
-##expected
-#| *
-##reset
-
-##data
-#* { outline-color: rgb),,); }
-##errors
-##expected
-#| *
-##reset
-
-##data
-#* { outline-color: rgb)2,3,5); }
-##errors
-##expected
-#| *
-##reset
+#data
+* { outline-color: rgb); }
+#errors
+#expected
+| *
+#reset
+
+#data
+* { outline-color: rgb),,); }
+#errors
+#expected
+| *
+#reset
+
+#data
+* { outline-color: rgb)2,3,5); }
+#errors
+#expected
+| *
+#reset
#data
* { outline-color: rgb (2,30,5); }
@@ -2254,26 +2254,26 @@
| *
#reset
-##data
-#* { outline-color: rgb; }
-##errors
-##expected
-#| *
-##reset
-
-##data
-#* { outline-color: Green Hill Zone; }
-##errors
-##expected
-#| *
-##reset
-
-##data
-#* { outline-color: green hill zone; }
-##errors
-##expected
-#| *
-##reset
+#data
+* { outline-color: rgb; }
+#errors
+#expected
+| *
+#reset
+
+#data
+* { outline-color: Green Hill Zone; }
+#errors
+#expected
+| *
+#reset
+
+#data
+* { outline-color: green hill zone; }
+#errors
+#expected
+| *
+#reset
#data
* { outline-color: "Green Hill Zone"; outline-color: invert; }
Modified: trunk/libcss/test/data/parse2/malformed-declarations.dat
URL: http://source.netsurf-browser.org/trunk/libcss/test/data/parse2/malformed...
==============================================================================
--- trunk/libcss/test/data/parse2/malformed-declarations.dat (original)
+++ trunk/libcss/test/data/parse2/malformed-declarations.dat Wed Apr 1 12:35:29 2009
@@ -75,32 +75,30 @@
| color: #bbbbcc00
#reset
-##data
-#* { background-color: black; :; color: white; }
-##errors
-##expected
-#| *
-#| background-color: #00000000
-#| color: #ffffff00
-##reset
+#data
+* { background-color: black; :; color: white; }
+#errors
+#expected
+| *
+| background-color: #00000000
+| color: #ffffff00
+#reset
-##data
-#* { background-color: black; : color: white; }
-##errors
-##expected
-#| *
-#| background-color: #00000000
-#| color: #ffffff00
-##reset
+#data
+* { background-color: black; : color: white; }
+#errors
+#expected
+| *
+| background-color: #00000000
+#reset
-##data
-#* { background-color: black; dentist: color: white; }
-##errors
-##expected
-#| *
-#| background-color: #00000000
-#| color: #ffffff00
-##reset
+#data
+* { background-color: black; dentist: color: white; }
+#errors
+#expected
+| *
+| background-color: #00000000
+#reset
#data
*{f():{
13 years, 10 months
r7019 chris_y - /trunk/netsurf/amiga/context_menu.c
by netsurf@semichrome.net
Author: chris_y
Date: Wed Apr 1 12:26:39 2009
New Revision: 7019
URL: http://source.netsurf-browser.org?rev=7019&view=rev
Log:
Don't open menu if there are no items
Modified:
trunk/netsurf/amiga/context_menu.c
Modified: trunk/netsurf/amiga/context_menu.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/context_menu.c?rev=...
==============================================================================
--- trunk/netsurf/amiga/context_menu.c (original)
+++ trunk/netsurf/amiga/context_menu.c Wed Apr 1 12:26:39 2009
@@ -72,6 +72,7 @@
struct content *cc = gwin->bw->current_content;
int box_x=0;
int box_y=0;
+ bool menuhascontent = false;
if(cc->type != CONTENT_HTML) return;
@@ -117,6 +118,8 @@
TAG_DONE),
TAG_DONE),
~0);
+
+ menuhascontent = true;
}
if (curbox->object)
@@ -143,6 +146,8 @@
TAG_DONE),
TAG_DONE),
~0);
+
+ menuhascontent = true;
}
if(curbox->text)
@@ -164,6 +169,8 @@
TAG_DONE),
TAG_DONE),
~0);
+
+ menuhascontent = true;
}
if (curbox->gadget)
@@ -178,10 +185,14 @@
PMIA_UserData,curbox,
TAG_DONE),
~0);
+
+ menuhascontent = true;
break;
}
}
}
+
+ if(!menuhascontent) return;
gui_window_set_pointer(gwin->bw->window,GUI_POINTER_DEFAULT);
IDoMethod(gwin->objects[OID_MENU],PM_OPEN,gwin->win);
13 years, 10 months
r7018 struggleyb - /branches/struggleyb/domts-transform-perl/DOMTSHandler.pm
by netsurf@semichrome.net
Author: struggleyb
Date: Tue Mar 31 22:57:58 2009
New Revision: 7018
URL: http://source.netsurf-browser.org?rev=7018&view=rev
Log:
Add attributes fetcher support.
Modified:
branches/struggleyb/domts-transform-perl/DOMTSHandler.pm
Modified: branches/struggleyb/domts-transform-perl/DOMTSHandler.pm
URL: http://source.netsurf-browser.org/branches/struggleyb/domts-transform-per...
==============================================================================
--- branches/struggleyb/domts-transform-perl/DOMTSHandler.pm (original)
+++ branches/struggleyb/domts-transform-perl/DOMTSHandler.pm Tue Mar 31 22:57:58 2009
@@ -14,6 +14,7 @@
# Some of the type are not defined now!
boolean => "bool ",
int => "int ",
+ "unsigned long" => "unsigned long ",
DOMString => "dom_string *",
List => "list *",
Collection => "collection *",
@@ -28,6 +29,12 @@
NodeList => "dom_nodelist"
);
+our %special_method = (
+);
+
+our %special_attribute = (
+);
+
sub new {
my $type = shift;
my $dtd = shift;
@@ -54,6 +61,7 @@
;
}
case "metadata" {
+ # start comments here
print "/*\n";
}
@@ -67,8 +75,7 @@
# The catch other case
else {
# we don't care the comment nodes
- @tmp = @$ct;
- if ($tmp[1] ne "metadata") {
+ if ($ct->[1] ne "metadata") {
generate_interface($dd, $en, $element->{Attributes});
}
}
@@ -169,6 +176,7 @@
if ($doc == NULL) {
return 1;
}
+
__EOF__
}
@@ -224,8 +232,7 @@
if ($t eq "DOMString") {
generate_domstring($ats{$p});
- my $num = $string_index - 1;
- $params = $params.", string$num";
+ $params = $params.", string$string_index";
next;
}
@@ -246,11 +253,30 @@
fprintf(stderr, "Exception raised from %s\\n", "$method");
return exp;
}
+
__EOF__
}
sub generate_attribute_fetcher {
-
+ my ($en, $dd, $node, %ats) = @_;
+ if (! exists $ats{'interface'}) {
+ my $n = $node;
+ while($n->getLocalName() ne "interface") {
+ $n = $n->getParentNode();
+ }
+ $ats{'interface'} = $n->getAttribute("name");
+ }
+
+ my $fetcher = to_attribute_fetcher($ats{'interface'}, "$en");
+
+ print << "__EOF__"
+ exp = $fetcher($ats{'obj'}, $ats{'var'});
+ if (exp != DOM_NO_ERR) {
+ fprintf(stderr, "Exception raised when fetch attribute %s", $en);
+ return exp;
+ }
+
+__EOF__
}
sub generate_domstring {
@@ -266,6 +292,7 @@
fprintf(stderr, "Can't create DOMString\\n");
return exp;
}
+
__EOF__
}
@@ -290,7 +317,40 @@
sub to_cmethod {
my ($type, $m) = @_;
- my $prefix;
+ my $prefix = get_prefix($type);
+
+ if (exists $special_method{$m}) {
+ return $prefix."_".$special_method{$m};
+ } else {
+ $m =~ s/[A-Z]/_$&/g;
+ $m = lc $m;
+ return $prefix."_".$m;
+ }
+}
+
+sub to_attribute_fetcher {
+ return to_attribute_accessor(@_, "get");
+}
+
+sub to_attribute_setter {
+ return to_attribute_accessor(@_, "set");
+}
+
+sub to_attribute_accessor {
+ my ($type, $af, $accessor) = @_;
+ my $prefix = get_prefix($type);
+
+ if (exists $special_attribute{$af}) {
+ return $prefix."_".$special_attribute{$af};
+ } else {
+ $af =~ s/[A-Z]/_$&/g;
+ $af = lc $af;
+ return $prefix."_".$accessor."_".$af;
+ }
+}
+
+sub get_prefix {
+ my $type = shift;
if (exists $special_prefix{$type}) {
$prefix = $special_prefix{$type};
@@ -299,10 +359,7 @@
$prefix = lc $type;
$prefix = "dom".$prefix;
}
-
- $m =~ s/[A-Z]/_$&/g;
- $m = lc $m;
- return $prefix."_".$m;
+ return $prefix;
}
1;
13 years, 10 months