Title: [91702] trunk/Source/WebCore
Revision
91702
Author
[email protected]
Date
2011-07-25 13:08:47 -0700 (Mon, 25 Jul 2011)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=65125
        
(1) Add the new CSS3 positioned value for floats.
(2) Rename FLEFT, FRIGHT and FNONE to our more modern convention: NoFloat, LeftFloat, RightFloat.
(3) Replace uses of == FNONE and != FNONE with isFloating and !isFloating.

Reviewed by Dan Bernstein.

* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator EFloat):
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::adjustRenderStyle):
* css/CSSValueKeywords.in:
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::insertFloatingObject):
(WebCore::RenderBlock::positionNewFloats):
(WebCore::RenderBlock::computeInlinePreferredLogicalWidths):
(WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
* rendering/RenderObjectChildList.cpp:
(WebCore::RenderObjectChildList::updateBeforeAfterContent):
* rendering/style/RenderStyle.h:
(WebCore::InheritedFlags::isFloating):
(WebCore::InheritedFlags::initialFloating):
* rendering/style/RenderStyleConstants.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (91701 => 91702)


--- trunk/Source/WebCore/ChangeLog	2011-07-25 20:08:33 UTC (rev 91701)
+++ trunk/Source/WebCore/ChangeLog	2011-07-25 20:08:47 UTC (rev 91702)
@@ -1,3 +1,35 @@
+2011-07-25  David Hyatt  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=65125
+        
+        (1) Add the new CSS3 positioned value for floats.
+        (2) Rename FLEFT, FRIGHT and FNONE to our more modern convention: NoFloat, LeftFloat, RightFloat.
+        (3) Replace uses of == FNONE and != FNONE with isFloating and !isFloating.
+
+        Reviewed by Dan Bernstein.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator EFloat):
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::adjustRenderStyle):
+        * css/CSSValueKeywords.in:
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::insertFloatingObject):
+        (WebCore::RenderBlock::positionNewFloats):
+        (WebCore::RenderBlock::computeInlinePreferredLogicalWidths):
+        (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
+        * rendering/RenderObjectChildList.cpp:
+        (WebCore::RenderObjectChildList::updateBeforeAfterContent):
+        * rendering/style/RenderStyle.h:
+        (WebCore::InheritedFlags::isFloating):
+        (WebCore::InheritedFlags::initialFloating):
+        * rendering/style/RenderStyleConstants.h:
+
 2011-07-25  Dan Bernstein  <[email protected]>
 
         <rdar://problem/9835028> Font loading during layout can cause layout code to be re-entered via resource load delegate

Modified: trunk/Source/WebCore/css/CSSParser.cpp (91701 => 91702)


--- trunk/Source/WebCore/css/CSSParser.cpp	2011-07-25 20:08:33 UTC (rev 91701)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2011-07-25 20:08:47 UTC (rev 91702)
@@ -994,9 +994,9 @@
             validPrimitive = true;
         break;
 
-    case CSSPropertyFloat:                // left | right | none | inherit + center for buggy CSS
-        if (id == CSSValueLeft || id == CSSValueRight ||
-             id == CSSValueNone || id == CSSValueCenter)
+    case CSSPropertyFloat:                // left | right | none | positioned | center (for buggy CSS, maps to none)
+        if (id == CSSValueLeft || id == CSSValueRight
+            || id == CSSValueNone || id == CSSValueCenter || id == CSSValueWebkitPositioned)
             validPrimitive = true;
         break;
 

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (91701 => 91702)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2011-07-25 20:08:33 UTC (rev 91701)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2011-07-25 20:08:47 UTC (rev 91702)
@@ -934,15 +934,18 @@
     , m_hasCachedCSSText(false)
 {
     switch (e) {
-        case FNONE:
+        case NoFloat:
             m_value.ident = CSSValueNone;
             break;
-        case FLEFT:
+        case LeftFloat:
             m_value.ident = CSSValueLeft;
             break;
-        case FRIGHT:
+        case RightFloat:
             m_value.ident = CSSValueRight;
             break;
+        case PositionedFloat:
+            m_value.ident = CSSValueWebkitPositioned;
+            break;
     }
 }
 
@@ -950,15 +953,17 @@
 {
     switch (m_value.ident) {
         case CSSValueLeft:
-            return FLEFT;
+            return LeftFloat;
         case CSSValueRight:
-            return FRIGHT;
+            return RightFloat;
         case CSSValueNone:
         case CSSValueCenter:  // Non-standard CSS value
-            return FNONE;
+            return NoFloat;
+        case CSSValueWebkitPositioned:
+            return PositionedFloat;
         default:
             ASSERT_NOT_REACHED();
-            return FNONE;
+            return NoFloat;
     }
 }
 

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (91701 => 91702)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-07-25 20:08:33 UTC (rev 91701)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-07-25 20:08:47 UTC (rev 91702)
@@ -1818,7 +1818,7 @@
         if (!m_checker.m_strictParsing && e) {
             if (e->hasTagName(tdTag)) {
                 style->setDisplay(TABLE_CELL);
-                style->setFloating(FNONE);
+                style->setFloating(NoFloat);
             }
             else if (e->hasTagName(tableTag))
                 style->setDisplay(style->isDisplayInlineType() ? INLINE_TABLE : TABLE);
@@ -1859,7 +1859,7 @@
         // 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() == AbsolutePosition || style->position() == FixedPosition || style->floating() != FNONE ||
+            (style->position() == AbsolutePosition || style->position() == FixedPosition || style->isFloating() ||
              (e && e->document()->documentElement() == e))) {
             if (style->display() == INLINE_TABLE)
                 style->setDisplay(TABLE);
@@ -1868,7 +1868,7 @@
             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 (!m_checker.m_strictParsing && style->floating() != FNONE)
+                if (!m_checker.m_strictParsing && style->isFloating())
                     style->setDisplay(BLOCK);
             }
             else

Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (91701 => 91702)


--- trunk/Source/WebCore/css/CSSValueKeywords.in	2011-07-25 20:08:33 UTC (rev 91701)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in	2011-07-25 20:08:47 UTC (rev 91702)
@@ -811,6 +811,9 @@
 optimizeQuality
 -webkit-optimize-contrast
 
+// Positioned Floats
+-webkit-positioned
+
 #if defined(ENABLE_CSS_EXCLUSIONS) && ENABLE_CSS_EXCLUSIONS
 // -webkit-wrap-shape
 nonzero

Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (91701 => 91702)


--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp	2011-07-25 20:08:33 UTC (rev 91701)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp	2011-07-25 20:08:47 UTC (rev 91702)
@@ -490,7 +490,7 @@
             // in quirks mode (which Mail.app is always in). We should look for an alternative.
             if (isBlock(e))
                 e->getInlineStyleDecl()->setProperty(CSSPropertyDisplay, CSSValueInline);
-            if (e->renderer() && e->renderer()->style()->floating() != FNONE)
+            if (e->renderer() && e->renderer()->style()->isFloating())
                 e->getInlineStyleDecl()->setProperty(CSSPropertyFloat, CSSValueNone);
         } else if (node->isStyledElement()) {
             StyledElement* element = static_cast<StyledElement*>(node.get());

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (91701 => 91702)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-07-25 20:08:33 UTC (rev 91701)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-07-25 20:08:47 UTC (rev 91702)
@@ -3156,7 +3156,7 @@
 
     // Create the special object entry & append it to the list
 
-    FloatingObject* newObj = new FloatingObject(o->style()->floating() == FLEFT ? FloatingObject::FloatLeft : FloatingObject::FloatRight);
+    FloatingObject* newObj = new FloatingObject(o->style()->floating() == LeftFloat ? FloatingObject::FloatLeft : FloatingObject::FloatRight);
     
     // Our location is irrelevant if we're unsplittable or no pagination is in effect.
     // Just go ahead and lay out the float.
@@ -3297,7 +3297,7 @@
             logicalTop = max(lowestFloatLogicalBottom(FloatingObject::FloatRight), logicalTop);
 
         int floatLogicalLeft;
-        if (childBox->style()->floating() == FLEFT) {
+        if (childBox->style()->floating() == LeftFloat) {
             int heightRemainingLeft = 1;
             int heightRemainingRight = 1;
             floatLogicalLeft = logicalLeftOffsetForLine(logicalTop, leftOffset, false, &heightRemainingLeft);
@@ -4869,8 +4869,8 @@
                 bool clearPreviousFloat;
                 if (child->isFloating()) {
                     clearPreviousFloat = (prevFloat
-                        && ((prevFloat->style()->floating() == FLEFT && (child->style()->clear() & CLEFT))
-                            || (prevFloat->style()->floating() == FRIGHT && (child->style()->clear() & CRIGHT))));
+                        && ((prevFloat->style()->floating() == LeftFloat && (child->style()->clear() & CLEFT))
+                            || (prevFloat->style()->floating() == RightFloat && (child->style()->clear() & CRIGHT))));
                     prevFloat = child;
                 } else
                     clearPreviousFloat = false;
@@ -5097,7 +5097,7 @@
         }
         
         if (child->isFloating()) {
-            if (style()->floating() == FLEFT)
+            if (style()->floating() == LeftFloat)
                 floatLeftWidth += w;
             else
                 floatRightWidth += w;

Modified: trunk/Source/WebCore/rendering/RenderObjectChildList.cpp (91701 => 91702)


--- trunk/Source/WebCore/rendering/RenderObjectChildList.cpp	2011-07-25 20:08:33 UTC (rev 91701)
+++ trunk/Source/WebCore/rendering/RenderObjectChildList.cpp	2011-07-25 20:08:47 UTC (rev 91702)
@@ -369,7 +369,7 @@
     if (!newContentWanted)
         return;
 
-    if (owner->isRenderInline() && !pseudoElementStyle->isDisplayInlineType() && pseudoElementStyle->floating() == FNONE &&
+    if (owner->isRenderInline() && !pseudoElementStyle->isDisplayInlineType() && !pseudoElementStyle->isFloating() &&
         !(pseudoElementStyle->position() == AbsolutePosition || pseudoElementStyle->position() == FixedPosition))
         // According to the CSS2 spec (the end of section 12.1), the only allowed
         // display values for the pseudo style are NONE and INLINE for inline flows.

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (91701 => 91702)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-07-25 20:08:33 UTC (rev 91701)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-07-25 20:08:47 UTC (rev 91702)
@@ -341,7 +341,7 @@
 
     bool operator==(const RenderStyle& other) const;
     bool operator!=(const RenderStyle& other) const { return !(*this == other); }
-    bool isFloating() const { return !(noninherited_flags._floating == FNONE); }
+    bool isFloating() const { return noninherited_flags._floating != NoFloat; }
     bool hasMargin() const { return surround->margin.nonZero(); }
     bool hasBorder() const { return surround->border.hasBorder(); }
     bool hasPadding() const { return surround->padding.nonZero(); }
@@ -1264,7 +1264,7 @@
     static TextOrientation initialTextOrientation() { return TextOrientationVerticalRight; }
     static EDisplay initialDisplay() { return INLINE; }
     static EEmptyCell initialEmptyCells() { return SHOW; }
-    static EFloat initialFloating() { return FNONE; }
+    static EFloat initialFloating() { return NoFloat; }
     static EListStylePosition initialListStylePosition() { return OUTSIDE; }
     static EListStyleType initialListStyleType() { return Disc; }
     static EOverflow initialOverflowX() { return OVISIBLE; }

Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (91701 => 91702)


--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2011-07-25 20:08:33 UTC (rev 91701)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2011-07-25 20:08:47 UTC (rev 91702)
@@ -98,7 +98,7 @@
 };
 
 enum EFloat {
-    FNONE = 0, FLEFT, FRIGHT
+    NoFloat, LeftFloat, RightFloat, PositionedFloat
 };
 
 enum EMarginCollapse { MCOLLAPSE, MSEPARATE, MDISCARD };
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to