[webkit-dev] bit field error on wince

ledwinka ledwinka at 126.com
Mon Jan 21 22:35:18 PST 2008


During my work on porting s60 webcore to wince, I found there is a css bug
in render_style.h file, here is the struct define

    struct NonInheritedFlags {
        bool operator==( const NonInheritedFlags &other ) const {
            return (_effectiveDisplay == other._effectiveDisplay) &&
            (_originalDisplay == other._originalDisplay) &&
            (_bg_repeat == other._bg_repeat) &&
            (_overflow == other._overflow) &&
#if NOKIA_CHANGES
            (_inputRequired == other._inputRequired) && 
#endif
            (_vertical_align == other._vertical_align) &&
            (_clear == other._clear) &&
            (_position == other._position) &&
            (_floating == other._floating) &&
            (_table_layout == other._table_layout) &&
            (_page_break_before == other._page_break_before) &&
            (_page_break_after == other._page_break_after) &&
            (_styleType == other._styleType) &&
            (_affectedByHover == other._affectedByHover) &&
            (_affectedByActive == other._affectedByActive) &&
            (_affectedByDrag == other._affectedByDrag) &&
            (_pseudoBits == other._pseudoBits) &&
            (_unicodeBidi == other._unicodeBidi);
  }

        bool operator!=( const NonInheritedFlags &other ) const {
            return !(*this == other);
        }
        
        EDisplay _effectiveDisplay : 5;
        EDisplay _originalDisplay : 5;
        EBackgroundRepeat _bg_repeat : 2;
        EOverflow _overflow : 4 ;
#if NOKIA_CHANGES
        bool _inputRequired : 1 ; 
#endif
        EVerticalAlign _vertical_align : 4;
        EClear _clear : 2;
        EPosition _position : 2;
        EFloat _floating : 2;
        ETableLayout _table_layout : 1;
        
        EPageBreak _page_break_before : 2;
        EPageBreak _page_break_after : 2;

        PseudoId _styleType : 3;
        bool _affectedByHover : 1;
        bool _affectedByActive : 1;
        bool _affectedByDrag : 1;
        int _pseudoBits : 6;
        EUnicodeBidi _unicodeBidi : 2;
    } noninherited_flags;

On wince platform , any code access to bit field in this struct , such as 

EDisplay _effectiveDisplay : 5;

will produce asm code like this

EDisplay dis = noninherited_flags. effectiveDisplay;

mov r3 lsl #27
mov r3 asr #27
str r3 [sp]  // write to stack variable

this problem is the ASR instruction. If _effectiveDisplay contain a value
big than 0x0f, such as 0x1x, the ASR instruction will cause the high bits
fill with 1 , for example, if _effectiveDisplay equal EDisplay::NONE or
EDisplay::INLINEBOX,  EDisplay dis will EQUALS -14 or -13, not a valid
value.

How to solve this problem? thanks a lot!





More information about the webkit-dev mailing list