Title: [227856] trunk/Source/WebCore
Revision
227856
Author
[email protected]
Date
2018-01-30 14:40:57 -0800 (Tue, 30 Jan 2018)

Log Message

[RenderTreeBuilder] Move RenderRubyRun::rubyBaseSafe to RenderTreeBuilder::Ruby
https://bugs.webkit.org/show_bug.cgi?id=182306
<rdar://problem/37041440>

Reviewed by Antti Koivisto.

With all the ruby mutation code moving, only RenderTreeBuilder calls RenderRubyRun::rubyBaseSafe.

No change in functionality.

* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::rubyText const):
(WebCore::RenderRubyRun::rubyBase const):
(WebCore::RenderRubyRun::firstLineBlock const):
(WebCore::RenderRubyRun::takeChild):
(WebCore::RenderRubyRun::rubyBaseSafe): Deleted.
* rendering/RenderRubyRun.h:
* rendering/updating/RenderTreeBuilderRuby.cpp:
(WebCore::RenderTreeBuilder::Ruby::insertChild):
(WebCore::RenderTreeBuilder::Ruby::rubyBaseSafe):
* rendering/updating/RenderTreeBuilderRuby.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (227855 => 227856)


--- trunk/Source/WebCore/ChangeLog	2018-01-30 22:16:08 UTC (rev 227855)
+++ trunk/Source/WebCore/ChangeLog	2018-01-30 22:40:57 UTC (rev 227856)
@@ -1,3 +1,27 @@
+2018-01-30  Zalan Bujtas  <[email protected]>
+
+        [RenderTreeBuilder] Move RenderRubyRun::rubyBaseSafe to RenderTreeBuilder::Ruby
+        https://bugs.webkit.org/show_bug.cgi?id=182306
+        <rdar://problem/37041440>
+
+        Reviewed by Antti Koivisto.
+
+        With all the ruby mutation code moving, only RenderTreeBuilder calls RenderRubyRun::rubyBaseSafe.
+
+        No change in functionality.
+
+        * rendering/RenderRubyRun.cpp:
+        (WebCore::RenderRubyRun::rubyText const):
+        (WebCore::RenderRubyRun::rubyBase const):
+        (WebCore::RenderRubyRun::firstLineBlock const):
+        (WebCore::RenderRubyRun::takeChild):
+        (WebCore::RenderRubyRun::rubyBaseSafe): Deleted.
+        * rendering/RenderRubyRun.h:
+        * rendering/updating/RenderTreeBuilderRuby.cpp:
+        (WebCore::RenderTreeBuilder::Ruby::insertChild):
+        (WebCore::RenderTreeBuilder::Ruby::rubyBaseSafe):
+        * rendering/updating/RenderTreeBuilderRuby.h:
+
 2018-01-30  Fujii Hironori  <[email protected]>
 
         Unified sources for FEMorphology.cpp seems to break the windows build.

Modified: trunk/Source/WebCore/rendering/RenderRubyRun.cpp (227855 => 227856)


--- trunk/Source/WebCore/rendering/RenderRubyRun.cpp	2018-01-30 22:16:08 UTC (rev 227855)
+++ trunk/Source/WebCore/rendering/RenderRubyRun.cpp	2018-01-30 22:40:57 UTC (rev 227856)
@@ -78,29 +78,18 @@
     // If in future it becomes necessary to support floating or positioned ruby text,
     // layout will have to be changed to handle them properly.
     ASSERT(!child || !child->isRubyText() || !child->isFloatingOrOutOfFlowPositioned());
-    return child && child->isRubyText() ? static_cast<RenderRubyText*>(child) : 0;
+    return child && child->isRubyText() ? static_cast<RenderRubyText*>(child) : nullptr;
 }
 
 RenderRubyBase* RenderRubyRun::rubyBase() const
 {
     RenderObject* child = lastChild();
-    return child && child->isRubyBase() ? static_cast<RenderRubyBase*>(child) : 0;
+    return child && child->isRubyBase() ? static_cast<RenderRubyBase*>(child) : nullptr;
 }
 
-RenderRubyBase* RenderRubyRun::rubyBaseSafe()
-{
-    RenderRubyBase* base = rubyBase();
-    if (!base) {
-        auto newBase = createRubyBase();
-        base = newBase.get();
-        RenderTreeBuilder::current()->insertChildToRenderBlockFlow(*this, WTFMove(newBase));
-    }
-    return base;
-}
-
 RenderBlock* RenderRubyRun::firstLineBlock() const
 {
-    return 0;
+    return nullptr;
 }
 
 bool RenderRubyRun::isChildAllowed(const RenderObject& child, const RenderStyle&) const
@@ -119,7 +108,7 @@
             // Ruby run without a base can happen only at the first run.
             RenderRubyRun& rightRun = downcast<RenderRubyRun>(*rightNeighbour);
             if (rightRun.hasRubyBase()) {
-                RenderRubyBase* rightBase = rightRun.rubyBaseSafe();
+                RenderRubyBase* rightBase = rightRun.rubyBase();
                 // Collect all children in a single base, then swap the bases.
                 RenderTreeBuilder::current()->moveRubyChildren(*rightBase, *base);
                 moveChildTo(&rightRun, base, RenderBoxModelObject::NormalizeAfterInsertion::No);

Modified: trunk/Source/WebCore/rendering/RenderRubyRun.h (227855 => 227856)


--- trunk/Source/WebCore/rendering/RenderRubyRun.h	2018-01-30 22:16:08 UTC (rev 227855)
+++ trunk/Source/WebCore/rendering/RenderRubyRun.h	2018-01-30 22:40:57 UTC (rev 227856)
@@ -50,7 +50,6 @@
     bool hasRubyBase() const;
     RenderRubyText* rubyText() const;
     RenderRubyBase* rubyBase() const;
-    RenderRubyBase* rubyBaseSafe(); // creates the base if it doesn't already exist
 
     void layoutExcludedChildren(bool relayoutChildren) override;
     void layout() override;
@@ -73,7 +72,6 @@
     }
     bool canBreakBefore(const LazyLineBreakIterator&) const;
     
-protected:
     RenderPtr<RenderRubyBase> createRubyBase() const;
 
 private:

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp (227855 => 227856)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp	2018-01-30 22:16:08 UTC (rev 227855)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp	2018-01-30 22:40:57 UTC (rev 227856)
@@ -221,7 +221,7 @@
             auto& run = *newRun;
             m_builder.insertChild(*ruby, WTFMove(newRun), &parent);
             m_builder.insertChild(run, WTFMove(child));
-            moveChildrenInternal(*parent.rubyBaseSafe(), *run.rubyBaseSafe(), beforeChild);
+            moveChildrenInternal(*rubyBaseSafe(parent), *rubyBaseSafe(run), beforeChild);
         }
         return;
     }
@@ -229,7 +229,7 @@
     // (append it instead if beforeChild is the ruby text)
     if (beforeChild && beforeChild->isRubyText())
         beforeChild = nullptr;
-    m_builder.insertChild(*parent.rubyBaseSafe(), WTFMove(child), beforeChild);
+    m_builder.insertChild(*rubyBaseSafe(parent), WTFMove(child), beforeChild);
 }
 
 RenderElement& RenderTreeBuilder::Ruby::findOrCreateParentForChild(RenderRubyAsBlock& parent, const RenderObject& child, RenderObject*& beforeChild)
@@ -356,4 +356,15 @@
     return *lastRun;
 }
 
+RenderRubyBase* RenderTreeBuilder::Ruby::rubyBaseSafe(RenderRubyRun& rubyRun)
+{
+    auto* base = rubyRun.rubyBase();
+    if (!base) {
+        auto newBase = rubyRun.createRubyBase();
+        base = newBase.get();
+        m_builder.insertChildToRenderBlockFlow(rubyRun, WTFMove(newBase));
+    }
+    return base;
 }
+
+}

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.h (227855 => 227856)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.h	2018-01-30 22:16:08 UTC (rev 227855)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.h	2018-01-30 22:40:57 UTC (rev 227856)
@@ -33,6 +33,7 @@
 class RenderObject;
 class RenderRubyAsBlock;
 class RenderRubyAsInline;
+class RenderRubyBase;
 class RenderRubyRun;
 class RenderTreeBuilder;
 
@@ -50,6 +51,7 @@
     void moveInlineChildren(RenderRubyBase& from, RenderRubyBase& to, RenderObject* beforeChild);
     void moveBlockChildren(RenderRubyBase& from, RenderRubyBase& to, RenderObject* beforeChild);
     void moveChildrenInternal(RenderRubyBase& from, RenderRubyBase& to, RenderObject* beforeChild = nullptr);
+    RenderRubyBase* rubyBaseSafe(RenderRubyRun&);
 
     RenderTreeBuilder& m_builder;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to