removal of display-sanity checking

David Hyatt hyatt at apple.com
Sat Oct 25 15:19:57 CEST 2003


The root fixup is now done in cssstyleselector.cpp in 
adjustRenderStyle.  Since the fixup for the root element as specified 
in CSS2.1 is identical to the fixup done for floating/positioned 
elements, I consolidated all of that code in one place.

void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, 
DOM::ElementImpl *e)
{
     // Cache our original display.
     style->setOriginalDisplay(style->display());

     if (style->display() != NONE) {
         // If we have a <td> that specifies a float property, in quirks 
mode we just drop the float
         // property.
         // Sites also commonly use display:inline/block on <td>s and 
<table>s.  In quirks mode we force
         // these tags to retain their display types.
         if (!strictParsing && e) {
             if (e->id() == ID_TD) {
                 style->setDisplay(TABLE_CELL);
                 style->setFloating(FNONE);
             }
             else if (e->id() == ID_TABLE)
                 style->setDisplay(style->isDisplayInlineType() ? 
INLINE_TABLE : TABLE);
         }

         // Mutate the display to BLOCK or TABLE for certain cases, 
e.g., if someone attempts to
         // position or float an inline, compact, or run-in.  Cache the 
original display, since it
         // may be needed for positioned elements that have to compute 
their static normal flow
         // positions.  We also force inline-level roots to be 
block-level.
         if (style->display() != BLOCK && style->display() != TABLE && 
style->display() != BOX &&
             (style->position() == ABSOLUTE || style->position() == 
FIXED || style->floating() != FNONE ||
              (e && e->getDocument()->documentElement() == e))) {
             if (style->display() == INLINE_TABLE)
                 style->setDisplay(TABLE);
             else if (style->display() == INLINE_BOX)
                 style->setDisplay(BOX);
             else if (style->display() == LIST_ITEM) {
                 // It is a WinIE bug that floated list items lose their 
bullets, so we'll emulate the quirk,
                 // but only in quirks mode.
                 if (!strictParsing && style->floating() != FNONE)
                     style->setDisplay(BLOCK);
             }
             else
                 style->setDisplay(BLOCK);
         }
     }

     // Make sure our z-index value is only applied if the object is 
positioned,
     // relatively positioned, or transparent.
     if (style->position() == STATIC && style->opacity() == 1.0f) {
         if (e && e->getDocument()->documentElement() == e)
             style->setZIndex(0); // The root has a z-index of 0 if not 
positioned or transparent.
         else
             style->setHasAutoZIndex(); // Everyone else gets an auto 
z-index.
     }

     // Auto z-index becomes 0 for transparent objects.  This prevents 
cases where
     // objects that should be blended as a single unit end up with a 
non-transparent object
     // wedged in between them.
     if (style->opacity() < 1.0f && style->hasAutoZIndex())
         style->setZIndex(0);

     // Finally update our text decorations in effect, but don't allow 
text-decoration to percolate through
     // tables, inline blocks, inline tables, or run-ins.
     if (style->display() == TABLE || style->display() == INLINE_TABLE 
|| style->display() == RUN_IN
         || style->display() == INLINE_BLOCK || style->display() == 
INLINE_BOX)
         style->setTextDecorationsInEffect(style->textDecoration());
     else
         style->addToTextDecorationsInEffect(style->textDecoration());
}

On Oct 25, 2003, at 9:07 AM, Dirk Mueller wrote:

>
> Hi,
>
> --- WebCore-old/khtml/rendering/render_box.cpp  2003-10-22 
> 03:59:54.000000000
> +0200
> +++ WebCore/khtml/rendering/render_box.cpp      2003-10-08 
> 23:43:42.000000000
> +0200
> @@ -66,23 +66,13 @@
>
>  void RenderBox::setStyle(RenderStyle *_style)
>  {
> -    // Make sure the root element retains its display:block type even 
> across
> style
> -    // changes.
> -    if (isRoot() && _style->display() != NONE)
> -        _style->setDisplay(BLOCK);
> -
>      RenderObject::setStyle(_style);
>
>
> any reason why this was removed? (besides that it should be isCanvas() 
> now
> anyway).
>
>
>
> -- 
>> Looking for a KDE-related EMail-Alias ? Get one at kdemail.net for 
>> FREE! <
> _______________________________________________
> Khtml-devel at mail.kde.org
> http://mail.kde.org/mailman/listinfo/khtml-devel



More information about the Khtml-devel mailing list