Title: [88526] trunk/Source/WebCore
Revision
88526
Author
[email protected]
Date
2011-06-09 23:20:58 -0700 (Thu, 09 Jun 2011)

Log Message

2011-06-09  Luke Macpherson   <[email protected]>

        Reviewed by Eric Seidel.

        Rename RenderStyle visuallyOrdered property and use an enum instead of a bool.
        https://bugs.webkit.org/show_bug.cgi?id=61495

        No new tests required as no functionality changed.

        * css/CSSPrimitiveValueMappings.h:
        Support cast to/from Order
        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::styleForDocument):
        Convert from bool to enum type.
        (WebCore::CSSStyleSelector::applyProperty):
        Convert to macro that uses the cast defined in CSSPrimitiveValueMappings.
        * dom/Document.cpp:
        (WebCore::Document::setVisuallyOrdered):
        Change call to RenderStyle::setRTLOrdering using enum parameter.
        * rendering/style/RenderStyle.h:
        rename visuallyOrdered proerties rtlOrdering and use appropriate enum types.
        * rendering/style/RenderStyleConstants.h:
        Define enum type.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (88525 => 88526)


--- trunk/Source/WebCore/ChangeLog	2011-06-10 06:19:22 UTC (rev 88525)
+++ trunk/Source/WebCore/ChangeLog	2011-06-10 06:20:58 UTC (rev 88526)
@@ -2,6 +2,30 @@
 
         Reviewed by Eric Seidel.
 
+        Rename RenderStyle visuallyOrdered property and use an enum instead of a bool.
+        https://bugs.webkit.org/show_bug.cgi?id=61495
+
+        No new tests required as no functionality changed.
+
+        * css/CSSPrimitiveValueMappings.h:
+        Support cast to/from Order
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::styleForDocument):
+        Convert from bool to enum type.
+        (WebCore::CSSStyleSelector::applyProperty):
+        Convert to macro that uses the cast defined in CSSPrimitiveValueMappings.
+        * dom/Document.cpp:
+        (WebCore::Document::setVisuallyOrdered):
+        Change call to RenderStyle::setRTLOrdering using enum parameter.
+        * rendering/style/RenderStyle.h:
+        rename visuallyOrdered proerties rtlOrdering and use appropriate enum types.
+        * rendering/style/RenderStyleConstants.h:
+        Define enum type.
+
+2011-06-09  Luke Macpherson   <[email protected]>
+
+        Reviewed by Eric Seidel.
+
         Implement CSSPropertyOutlineStyle handler in CSSStyleApplyProperty
         https://bugs.webkit.org/show_bug.cgi?id=61601
 

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (88525 => 88526)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-06-10 06:19:22 UTC (rev 88525)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-06-10 06:20:58 UTC (rev 88526)
@@ -1568,9 +1568,7 @@
             return list.release();
         }
         case CSSPropertyWebkitRtlOrdering:
-            if (style->visuallyOrdered())
-                return primitiveValueCache->createIdentifierValue(CSSValueVisual);
-            return primitiveValueCache->createIdentifierValue(CSSValueLogical);
+            return primitiveValueCache->createIdentifierValue(style->rtlOrdering() ? CSSValueVisual : CSSValueLogical);
         case CSSPropertyWebkitUserDrag:
             return primitiveValueCache->createValue(style->userDrag());
         case CSSPropertyWebkitUserSelect:

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (88525 => 88526)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2011-06-10 06:19:22 UTC (rev 88525)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2011-06-10 06:20:58 UTC (rev 88526)
@@ -2645,6 +2645,33 @@
     }
 }
     
+template<> inline CSSPrimitiveValue::operator Order() const
+{
+    switch (m_value.ident) {
+    case CSSValueLogical:
+        return LogicalOrder;
+    case CSSValueVisual:
+        return VisualOrder;
+    default:
+        ASSERT_NOT_REACHED();
+        return LogicalOrder;
+    }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Order e)
+    : m_type(CSS_IDENT)
+    , m_hasCachedCSSText(false)
+{
+    switch (e) {
+    case LogicalOrder:
+        m_value.ident = CSSValueLogical;
+        break;
+    case VisualOrder:
+        m_value.ident = CSSValueVisual;
+        break;
+    }
+}
+
 template<> inline CSSPrimitiveValue::operator ESpeak() const
 {
     switch (m_value.ident) {

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (88525 => 88526)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-06-10 06:19:22 UTC (rev 88525)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-06-10 06:20:58 UTC (rev 88526)
@@ -1223,7 +1223,7 @@
 
     RefPtr<RenderStyle> documentStyle = RenderStyle::create();
     documentStyle->setDisplay(BLOCK);
-    documentStyle->setVisuallyOrdered(document->visuallyOrdered());
+    documentStyle->setRTLOrdering(document->visuallyOrdered() ? VisualOrder : LogicalOrder);
     documentStyle->setZoom(frame ? frame->pageZoomFactor() : 1);
     documentStyle->setPageScaleTransform(frame ? frame->pageScaleFactor() : 1);
     documentStyle->setUserModify(document->inDesignMode() ? READ_WRITE : READ_ONLY);
@@ -5042,10 +5042,7 @@
     }
 #endif        
     case CSSPropertyWebkitRtlOrdering:
-        HANDLE_INHERIT_AND_INITIAL(visuallyOrdered, VisuallyOrdered)
-        if (!primitiveValue || !primitiveValue->getIdent())
-            return;
-        m_style->setVisuallyOrdered(primitiveValue->getIdent() == CSSValueVisual);
+        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(rtlOrdering, RTLOrdering)
         return;
     case CSSPropertyWebkitTextStrokeWidth: {
         HANDLE_INHERIT_AND_INITIAL(textStrokeWidth, TextStrokeWidth)

Modified: trunk/Source/WebCore/dom/Document.cpp (88525 => 88526)


--- trunk/Source/WebCore/dom/Document.cpp	2011-06-10 06:19:22 UTC (rev 88525)
+++ trunk/Source/WebCore/dom/Document.cpp	2011-06-10 06:20:58 UTC (rev 88526)
@@ -1912,7 +1912,7 @@
 {
     m_visuallyOrdered = true;
     if (renderer())
-        renderer()->style()->setVisuallyOrdered(true);
+        renderer()->style()->setRTLOrdering(VisualOrder);
 }
 
 PassRefPtr<DocumentParser> Document::createParser()

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (88525 => 88526)


--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2011-06-10 06:19:22 UTC (rev 88525)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2011-06-10 06:20:58 UTC (rev 88526)
@@ -1387,7 +1387,7 @@
         leafBoxesInLogicalOrder.append(leaf);
     }
 
-    if (renderer()->style()->visuallyOrdered())
+    if (renderer()->style()->rtlOrdering() == VisualOrder)
         return;
 
     // Reverse of reordering of the line (L2 according to Bidi spec):

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (88525 => 88526)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2011-06-10 06:19:22 UTC (rev 88525)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2011-06-10 06:20:58 UTC (rev 88526)
@@ -1314,7 +1314,7 @@
     if (charactersWithHyphen)
         adjustCharactersAndLengthForHyphen(*charactersWithHyphen, style, characters, length);
 
-    TextRun run(characters, length, textRenderer->allowTabs(), textPos(), expansion(), expansionBehavior(), direction(), m_dirOverride || style->visuallyOrdered());
+    TextRun run(characters, length, textRenderer->allowTabs(), textPos(), expansion(), expansionBehavior(), direction(), m_dirOverride || style->rtlOrdering() == VisualOrder);
     if (textRunNeedsRenderingContext(font))
         run.setRenderingContext(SVGTextRunRenderingContext::create(textRenderer));
 

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (88525 => 88526)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-06-10 06:19:22 UTC (rev 88525)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-06-10 06:20:58 UTC (rev 88526)
@@ -6308,7 +6308,7 @@
     ASSERT(style);
 
     TextDirection textDirection = LTR;
-    bool directionalOverride = style->visuallyOrdered();
+    bool directionalOverride = style->rtlOrdering() == VisualOrder;
     if (flags != DefaultTextRunFlags) {
         if (flags & RespectDirection)
             textDirection = style->direction();

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (88525 => 88526)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2011-06-10 06:19:22 UTC (rev 88525)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2011-06-10 06:20:58 UTC (rev 88526)
@@ -345,7 +345,7 @@
             parentBox->addToLine(box);
         }
 
-        bool visuallyOrdered = r->m_object->style()->visuallyOrdered();
+        bool visuallyOrdered = r->m_object->style()->rtlOrdering() == VisualOrder;
         box->setBidiLevel(r->level());
 
         if (box->isInlineTextBox()) {
@@ -961,7 +961,7 @@
             if (lastRootBox())
                 lastRootBox()->setLineBreakInfo(end.m_obj, end.m_pos, resolver.status());
         } else {
-            VisualDirectionOverride override = (style()->visuallyOrdered() ? (style()->direction() == LTR ? VisualLeftToRightOverride : VisualRightToLeftOverride) : NoVisualOverride);
+            VisualDirectionOverride override = (style()->rtlOrdering() == VisualOrder ? (style()->direction() == LTR ? VisualLeftToRightOverride : VisualRightToLeftOverride) : NoVisualOverride);
             // FIXME: This ownership is reversed. We should own the BidiRunList and pass it to createBidiRunsForLine.
             BidiRunList<BidiRun>& bidiRuns = resolver.runs();
             resolver.createBidiRunsForLine(end, override, lineInfo.previousLineBrokeCleanly());

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (88525 => 88526)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2011-06-10 06:19:22 UTC (rev 88525)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2011-06-10 06:20:58 UTC (rev 88526)
@@ -421,7 +421,7 @@
         || inherited->horizontal_border_spacing != other->inherited->horizontal_border_spacing
         || inherited->vertical_border_spacing != other->inherited->vertical_border_spacing
         || inherited_flags._box_direction != other->inherited_flags._box_direction
-        || inherited_flags._visuallyOrdered != other->inherited_flags._visuallyOrdered
+        || inherited_flags.m_rtlOrdering != other->inherited_flags.m_rtlOrdering
         || noninherited_flags._position != other->noninherited_flags._position
         || noninherited_flags._floating != other->noninherited_flags._floating
         || noninherited_flags._originalDisplay != other->noninherited_flags._originalDisplay)

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (88525 => 88526)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-06-10 06:19:22 UTC (rev 88525)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-06-10 06:20:58 UTC (rev 88526)
@@ -174,7 +174,7 @@
                 && (_border_collapse == other._border_collapse)
                 && (_white_space == other._white_space)
                 && (_box_direction == other._box_direction)
-                && (_visuallyOrdered == other._visuallyOrdered)
+                && (m_rtlOrdering == other.m_rtlOrdering)
                 && (_force_backgrounds_to_white == other._force_backgrounds_to_white)
                 && (_pointerEvents == other._pointerEvents)
                 && (_insideLink == other._insideLink)
@@ -199,7 +199,7 @@
         // 34 bits
         
         // non CSS2 inherited
-        bool _visuallyOrdered : 1;
+        unsigned m_rtlOrdering : 1; // Order
         bool _force_backgrounds_to_white : 1;
         unsigned _pointerEvents : 4; // EPointerEvents
         unsigned _insideLink : 2; // EInsideLink
@@ -278,7 +278,7 @@
         inherited_flags._direction = initialDirection();
         inherited_flags._border_collapse = initialBorderCollapse();
         inherited_flags._white_space = initialWhiteSpace();
-        inherited_flags._visuallyOrdered = initialVisuallyOrdered();
+        inherited_flags.m_rtlOrdering = initialRTLOrdering();
         inherited_flags._box_direction = initialBoxDirection();
         inherited_flags._force_backgrounds_to_white = false;
         inherited_flags._pointerEvents = initialPointerEvents();
@@ -358,8 +358,8 @@
         return hasBackgroundImage();
     }
 
-    bool visuallyOrdered() const { return inherited_flags._visuallyOrdered; }
-    void setVisuallyOrdered(bool b) { inherited_flags._visuallyOrdered = b; }
+    Order rtlOrdering() const { return static_cast<Order>(inherited_flags.m_rtlOrdering); }
+    void setRTLOrdering(Order o) { inherited_flags.m_rtlOrdering = o; }
 
     bool isStyleAvailable() const;
 
@@ -1297,7 +1297,7 @@
     static EBorderFit initialBorderFit() { return BorderFitBorder; }
     static EResize initialResize() { return RESIZE_NONE; }
     static ControlPart initialAppearance() { return NoControlPart; }
-    static bool initialVisuallyOrdered() { return false; }
+    static Order initialRTLOrdering() { return LogicalOrder; }
     static float initialTextStrokeWidth() { return 0; }
     static unsigned short initialColumnCount() { return 1; }
     static bool initialColumnSpan() { return false; }

Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (88525 => 88526)


--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2011-06-10 06:19:22 UTC (rev 88525)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2011-06-10 06:20:58 UTC (rev 88526)
@@ -433,7 +433,9 @@
 enum TextEmphasisPosition { TextEmphasisPositionOver, TextEmphasisPositionUnder };
 
 enum EImageRendering { ImageRenderingAuto, ImageRenderingOptimizeSpeed, ImageRenderingOptimizeQuality, ImageRenderingOptimizeContrast };
-    
+
+enum Order { LogicalOrder = 0, VisualOrder };
+
 } // namespace WebCore
 
 #endif // RenderStyleConstants_h

Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (88525 => 88526)


--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2011-06-10 06:19:22 UTC (rev 88525)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2011-06-10 06:20:58 UTC (rev 88526)
@@ -423,7 +423,7 @@
                 , 0 /* padding, only relevant for justified text, not relevant for SVG */
                 , TextRun::AllowTrailingExpansion
                 , direction()
-                , m_dirOverride || style->visuallyOrdered() /* directionalOverride */);
+                , m_dirOverride || style->rtlOrdering() == VisualOrder /* directionalOverride */);
 
     if (textRunNeedsRenderingContext(style->font()))
         run.setRenderingContext(SVGTextRunRenderingContext::create(text));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to