Author: jmb
Date: Fri Jan 23 17:37:03 2009
New Revision: 6206

URL: http://source.netsurf-browser.org?rev=6206&view=rev
Log:
Range check elevation angle.
Add some more constants.

Modified:
    trunk/libcss/src/parse/properties.c
    trunk/libcss/src/utils/fpconstants.h

Modified: trunk/libcss/src/parse/properties.c
URL: 
http://source.netsurf-browser.org/trunk/libcss/src/parse/properties.c?rev=6206&r1=6205&r2=6206&view=diff
==============================================================================
--- trunk/libcss/src/parse/properties.c (original)
+++ trunk/libcss/src/parse/properties.c Fri Jan 23 17:37:03 2009
@@ -2485,6 +2485,18 @@
                if ((unit & UNIT_ANGLE) == false)
                        return CSS_INVALID;
 
+               /* Valid angles lie between -90 and 90 degrees */
+               if (unit == UNIT_DEG) {
+                       if (length < FMULI(F_90, -1) || length > F_90)
+                               return CSS_INVALID;
+               } else if (unit == UNIT_GRAD) {
+                       if (length < FMULI(F_100, -1) || length > F_100)
+                               return CSS_INVALID;
+               } else if (unit == UNIT_RAD) {
+                       if (length < FMULI(F_PI_2, -1) || length > F_PI_2)
+                               return CSS_INVALID;
+               }
+
                value = ELEVATION_ANGLE;
        }
 

Modified: trunk/libcss/src/utils/fpconstants.h
URL: 
http://source.netsurf-browser.org/trunk/libcss/src/utils/fpconstants.h?rev=6206&r1=6205&r2=6206&view=diff
==============================================================================
--- trunk/libcss/src/utils/fpconstants.h (original)
+++ trunk/libcss/src/utils/fpconstants.h Fri Jan 23 17:37:03 2009
@@ -9,12 +9,20 @@
 #define css_utils_fpconstants_h_
 
 /* Useful angles */
+#define F_PI_2 0x00000648      /* 1.5708 (PI/2) */
 #define F_PI   0x00000c91      /* 3.1415 (PI) */
-#define F_2PI  0x00001922      /* 2 PI */
+#define F_3PI_2        0x000012d9      /* 4.7124 (3PI/2) */
+#define F_2PI  0x00001922      /* 6.2831 (2 PI) */
 
+#define F_90   0x00016800      /*  90 */
+#define F_180  0x0002d000      /* 180 */
+#define F_270  0x00043800      /* 270 */
 #define F_360  0x0005a000      /* 360 */
 
-#define F_400  0x00064000      /* 100 */
+#define F_100  0x00019000      /* 100 */
+#define F_200  0x00032000      /* 200 */
+#define F_300  0x0004b000      /* 300 */
+#define F_400  0x00064000      /* 400 */
 
 #endif
 


_______________________________________________
netsurf-commits mailing list
[email protected]
http://vlists.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to