Dear NetSurf Developers,

Please find attached a small diff file showing alterations to
<render/layout.c> to work around a problem with
<http://www.v3.co.uk/vnunet/news/2228123/ai-gets-step-closer> that
causes NetSurf to crash. The alteration causes NetSurf to default to
behaviour consistent with CSS_DIRECTION_LTR in all cases in which
CSS_DIRECTION_RTL has not been specified. This avoids an assert-caused
crash when box->parent->style->direction is not specified or is some
value other than one of {CSS_DIRECTION_LTR, CSS_DIRECTION_RTL}.
-- 
Regards, Christopher Martin.
Index: render/layout.c
===================================================================
--- render/layout.c     (revision 8638)
+++ render/layout.c     (working copy)
@@ -3493,18 +3493,13 @@
        else {
                /* over constrained => examine direction property
                 * of containing block */
-               if (containing_block->style) {
-                       if (box->parent->style->direction ==
-                                       CSS_DIRECTION_LTR)
-                               /* left wins */
-                               right = -left;
-                       else if (box->parent->style->direction ==
-                                       CSS_DIRECTION_RTL)
+               if (containing_block->style && (box->parent->style->direction ==
+                                       CSS_DIRECTION_RTL)) {
                                /* right wins */
                                left = -right;
                }
                else {
-                       /* no parent style, so assume LTR */
+                       /* assume LTR in all other cases */
                        right = -left;
                }
        }

Reply via email to