Title: [159044] trunk/Source/WebCore
Revision
159044
Author
[email protected]
Date
2013-11-11 01:38:53 -0800 (Mon, 11 Nov 2013)

Log Message

Bring the LineFragmentationData back to RootInlineBox.
<https://webkit.org/b/124136>

Now that we have the simple line layout path, almost all the root
line boxes end up with some kind of fragmentation data, so we might
as well put the members back on RootInlineBox and avoid the extra
allocation (and indirection.)

1.74 MB progression on HTML5 spec at <http://whatwg.org/c>

Reviewed by Antti Koivisto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (159043 => 159044)


--- trunk/Source/WebCore/ChangeLog	2013-11-11 09:22:25 UTC (rev 159043)
+++ trunk/Source/WebCore/ChangeLog	2013-11-11 09:38:53 UTC (rev 159044)
@@ -1,3 +1,17 @@
+2013-11-11  Andreas Kling  <[email protected]>
+
+        Bring the LineFragmentationData back to RootInlineBox.
+        <https://webkit.org/b/124136>
+
+        Now that we have the simple line layout path, almost all the root
+        line boxes end up with some kind of fragmentation data, so we might
+        as well put the members back on RootInlineBox and avoid the extra
+        allocation (and indirection.)
+
+        1.74 MB progression on HTML5 spec at <http://whatwg.org/c>
+
+        Reviewed by Antti Koivisto.
+
 2013-11-10  Andreas Kling  <[email protected]>
 
         Shrink RenderInline.

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.h (159043 => 159044)


--- trunk/Source/WebCore/rendering/InlineFlowBox.h	2013-11-11 09:22:25 UTC (rev 159043)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.h	2013-11-11 09:38:53 UTC (rev 159044)
@@ -52,6 +52,7 @@
         , m_baselineType(AlphabeticBaseline)
         , m_hasAnnotationsBefore(false)
         , m_hasAnnotationsAfter(false)
+        , m_isFirstAfterPageBreak(false)
 #ifndef NDEBUG
         , m_hasBadChildList(false)
 #endif
@@ -337,6 +338,8 @@
     unsigned m_lineBreakBidiStatusLastStrong : 5; // UCharDirection
     unsigned m_lineBreakBidiStatusLast : 5; // UCharDirection
 
+    unsigned m_isFirstAfterPageBreak : 1;
+
     // End of RootInlineBox-specific members.
 
 #ifndef NDEBUG

Modified: trunk/Source/WebCore/rendering/RootInlineBox.cpp (159043 => 159044)


--- trunk/Source/WebCore/rendering/RootInlineBox.cpp	2013-11-11 09:22:25 UTC (rev 159043)
+++ trunk/Source/WebCore/rendering/RootInlineBox.cpp	2013-11-11 09:38:53 UTC (rev 159044)
@@ -40,7 +40,7 @@
 namespace WebCore {
     
 struct SameSizeAsRootInlineBox : public InlineFlowBox {
-    unsigned variables[5];
+    unsigned variables[7];
     void* pointers[4];
 };
 
@@ -52,16 +52,12 @@
 RootInlineBox::RootInlineBox(RenderBlockFlow& block)
     : InlineFlowBox(block)
     , m_lineBreakPos(0)
-    , m_lineBreakObj(0)
-    , m_lineTop(0)
-    , m_lineBottom(0)
-    , m_lineTopWithLeading(0)
-    , m_lineBottomWithLeading(0)
+    , m_lineBreakObj(nullptr)
+    , m_containingRegion(nullptr)
 {
     setIsHorizontal(block.isHorizontalWritingMode());
 }
 
-
 RootInlineBox::~RootInlineBox()
 {
     detachEllipsisBox();
@@ -247,25 +243,22 @@
 
 RenderRegion* RootInlineBox::containingRegion() const
 {
-    RenderRegion* region = m_fragmentationData ? m_fragmentationData->m_containingRegion : 0;
-
 #ifndef NDEBUG
-    if (region) {
+    if (m_containingRegion) {
         RenderFlowThread* flowThread = blockFlow().flowThreadContainingBlock();
         const RenderRegionList& regionList = flowThread->renderRegionList();
-        ASSERT(regionList.contains(region));
+        ASSERT(regionList.contains(m_containingRegion));
     }
 #endif
 
-    return region;
+    return m_containingRegion;
 }
 
 void RootInlineBox::setContainingRegion(RenderRegion* region)
 {
     ASSERT(!isDirty());
     ASSERT(blockFlow().flowThreadContainingBlock());
-    LineFragmentationData* fragmentationData  = ensureLineFragmentationData();
-    fragmentationData->m_containingRegion = region;
+    m_containingRegion = region;
 }
 
 LayoutUnit RootInlineBox::alignBoxesInBlockDirection(LayoutUnit heightOfBlock, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache)

Modified: trunk/Source/WebCore/rendering/RootInlineBox.h (159043 => 159044)


--- trunk/Source/WebCore/rendering/RootInlineBox.h	2013-11-11 09:22:25 UTC (rev 159043)
+++ trunk/Source/WebCore/rendering/RootInlineBox.h	2013-11-11 09:38:53 UTC (rev 159044)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2006, 2007, 2008, 2013 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -55,14 +55,14 @@
     LayoutUnit lineTopWithLeading() const { return m_lineTopWithLeading; }
     LayoutUnit lineBottomWithLeading() const { return m_lineBottomWithLeading; }
     
-    LayoutUnit paginationStrut() const { return m_fragmentationData ? m_fragmentationData->m_paginationStrut : LayoutUnit(0); }
-    void setPaginationStrut(LayoutUnit strut) { ensureLineFragmentationData()->m_paginationStrut = strut; }
+    LayoutUnit paginationStrut() const { return m_paginationStrut; }
+    void setPaginationStrut(LayoutUnit strut) { m_paginationStrut = strut; }
 
-    bool isFirstAfterPageBreak() const { return m_fragmentationData ? m_fragmentationData->m_isFirstAfterPageBreak : false; }
-    void setIsFirstAfterPageBreak(bool isFirstAfterPageBreak) { ensureLineFragmentationData()->m_isFirstAfterPageBreak = isFirstAfterPageBreak; }
+    bool isFirstAfterPageBreak() const { return m_isFirstAfterPageBreak; }
+    void setIsFirstAfterPageBreak(bool isFirstAfterPageBreak) { m_isFirstAfterPageBreak = isFirstAfterPageBreak; }
 
-    LayoutUnit paginatedLineWidth() const { return m_fragmentationData ? m_fragmentationData->m_paginatedLineWidth : LayoutUnit(0); }
-    void setPaginatedLineWidth(LayoutUnit width) { ensureLineFragmentationData()->m_paginatedLineWidth = width; }
+    LayoutUnit paginatedLineWidth() const { return m_paginatedLineWidth; }
+    void setPaginatedLineWidth(LayoutUnit width) { m_paginatedLineWidth = width; }
 
     RenderRegion* containingRegion() const;
     void setContainingRegion(RenderRegion*);
@@ -206,15 +206,6 @@
 
     LayoutUnit beforeAnnotationsAdjustment() const;
 
-    struct LineFragmentationData;
-    LineFragmentationData* ensureLineFragmentationData()
-    {
-        if (!m_fragmentationData)
-            m_fragmentationData = adoptPtr(new LineFragmentationData());
-
-        return m_fragmentationData.get();
-    }
-
     // This folds into the padding at the end of InlineFlowBox on 64-bit.
     unsigned m_lineBreakPos;
 
@@ -229,28 +220,13 @@
     LayoutUnit m_lineTopWithLeading;
     LayoutUnit m_lineBottomWithLeading;
 
-    struct LineFragmentationData {
-        WTF_MAKE_NONCOPYABLE(LineFragmentationData); WTF_MAKE_FAST_ALLOCATED;
-    public:
-        LineFragmentationData()
-            : m_containingRegion(0)
-            , m_paginationStrut(0)
-            , m_paginatedLineWidth(0)
-            , m_isFirstAfterPageBreak(false)
-        {
+    // It should not be assumed the |containingRegion| is always valid.
+    // It can also be nullptr if the flow has no region chain.
+    RenderRegion* m_containingRegion;
 
-        }
+    LayoutUnit m_paginationStrut;
+    LayoutUnit m_paginatedLineWidth;
 
-        // It should not be assumed the |containingRegion| is always valid.
-        // It can also be 0 if the flow has no region chain.
-        RenderRegion* m_containingRegion;
-        LayoutUnit m_paginationStrut;
-        LayoutUnit m_paginatedLineWidth;
-        bool m_isFirstAfterPageBreak;
-    };
-
-    OwnPtr<LineFragmentationData> m_fragmentationData;
-
     // Floats hanging off the line are pushed into this vector during layout. It is only
     // good for as long as the line has not been marked dirty.
     OwnPtr<Vector<RenderBox*>> m_floats;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to