Title: [231094] trunk/Source/WebCore
Revision
231094
Author
[email protected]
Date
2018-04-27 07:40:24 -0700 (Fri, 27 Apr 2018)

Log Message

[LFC] Formatting contexts should take const Box&
https://bugs.webkit.org/show_bug.cgi?id=185031

Reviewed by Sam Weinig.

The formatting root boxes are supposed to be all const. The only reason why
they are not is because WeakPtr<> does not support const objects yet.
Use const_cast instead (remove it when WeakPtr<> gains const support).

* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::FormattingContext):
* layout/FormattingContext.h:
* layout/LayoutContext.cpp:
(WebCore::Layout::LayoutContext::LayoutContext):
(WebCore::Layout::LayoutContext::formattingContext):
* layout/LayoutContext.h:
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
* layout/blockformatting/BlockFormattingContext.h:
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
* layout/inlineformatting/InlineFormattingContext.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (231093 => 231094)


--- trunk/Source/WebCore/ChangeLog	2018-04-27 14:34:47 UTC (rev 231093)
+++ trunk/Source/WebCore/ChangeLog	2018-04-27 14:40:24 UTC (rev 231094)
@@ -1,5 +1,30 @@
 2018-04-27  Zalan Bujtas  <[email protected]>
 
+        [LFC] Formatting contexts should take const Box&
+        https://bugs.webkit.org/show_bug.cgi?id=185031
+
+        Reviewed by Sam Weinig.
+
+        The formatting root boxes are supposed to be all const. The only reason why
+        they are not is because WeakPtr<> does not support const objects yet.
+        Use const_cast instead (remove it when WeakPtr<> gains const support).
+
+        * layout/FormattingContext.cpp:
+        (WebCore::Layout::FormattingContext::FormattingContext):
+        * layout/FormattingContext.h:
+        * layout/LayoutContext.cpp:
+        (WebCore::Layout::LayoutContext::LayoutContext):
+        (WebCore::Layout::LayoutContext::formattingContext):
+        * layout/LayoutContext.h:
+        * layout/blockformatting/BlockFormattingContext.cpp:
+        (WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
+        * layout/blockformatting/BlockFormattingContext.h:
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
+        * layout/inlineformatting/InlineFormattingContext.h:
+
+2018-04-27  Zalan Bujtas  <[email protected]>
+
         [LFC] Add layout tree iterators.
         https://bugs.webkit.org/show_bug.cgi?id=185058
 

Modified: trunk/Source/WebCore/layout/FormattingContext.cpp (231093 => 231094)


--- trunk/Source/WebCore/layout/FormattingContext.cpp	2018-04-27 14:34:47 UTC (rev 231093)
+++ trunk/Source/WebCore/layout/FormattingContext.cpp	2018-04-27 14:40:24 UTC (rev 231094)
@@ -35,8 +35,8 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(FormattingContext);
 
-FormattingContext::FormattingContext(Box& formattingContextRoot)
-    : m_root(makeWeakPtr(formattingContextRoot))
+FormattingContext::FormattingContext(const Box& formattingContextRoot)
+    : m_root(makeWeakPtr(const_cast<Box&>(formattingContextRoot)))
 {
 }
 

Modified: trunk/Source/WebCore/layout/FormattingContext.h (231093 => 231094)


--- trunk/Source/WebCore/layout/FormattingContext.h	2018-04-27 14:34:47 UTC (rev 231093)
+++ trunk/Source/WebCore/layout/FormattingContext.h	2018-04-27 14:40:24 UTC (rev 231094)
@@ -41,7 +41,7 @@
 class FormattingContext {
     WTF_MAKE_ISO_ALLOCATED(FormattingContext);
 public:
-    FormattingContext(Box& formattingContextRoot);
+    FormattingContext(const Box& formattingContextRoot);
     virtual ~FormattingContext();
 
     virtual void layout(FormattingState&) = 0;

Modified: trunk/Source/WebCore/layout/LayoutContext.cpp (231093 => 231094)


--- trunk/Source/WebCore/layout/LayoutContext.cpp	2018-04-27 14:34:47 UTC (rev 231093)
+++ trunk/Source/WebCore/layout/LayoutContext.cpp	2018-04-27 14:40:24 UTC (rev 231094)
@@ -40,8 +40,8 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(LayoutContext);
 
-LayoutContext::LayoutContext(Box& root)
-    : m_root(makeWeakPtr(root))
+LayoutContext::LayoutContext(const Box& root)
+    : m_root(makeWeakPtr(const_cast<Box&>(root)))
 {
 }
 
@@ -59,7 +59,7 @@
     }).iterator->value;
 }
 
-std::unique_ptr<FormattingContext> LayoutContext::formattingContext(Box& formattingContextRoot)
+std::unique_ptr<FormattingContext> LayoutContext::formattingContext(const Box& formattingContextRoot)
 {
     if (formattingContextRoot.establishesBlockFormattingContext())
         return std::make_unique<BlockFormattingContext>(formattingContextRoot);

Modified: trunk/Source/WebCore/layout/LayoutContext.h (231093 => 231094)


--- trunk/Source/WebCore/layout/LayoutContext.h	2018-04-27 14:34:47 UTC (rev 231093)
+++ trunk/Source/WebCore/layout/LayoutContext.h	2018-04-27 14:40:24 UTC (rev 231094)
@@ -50,7 +50,7 @@
 class LayoutContext {
     WTF_MAKE_ISO_ALLOCATED(LayoutContext);
 public:
-    LayoutContext(Box& root);
+    LayoutContext(const Box& root);
 
     void updateLayout();
 
@@ -62,7 +62,7 @@
 
 private:
     FormattingState& formattingState(const FormattingContext&);
-    std::unique_ptr<FormattingContext> formattingContext(Box& formattingContextRoot);
+    std::unique_ptr<FormattingContext> formattingContext(const Box& formattingContextRoot);
 
     WeakPtr<Box> m_root;
     HashMap<const Box*, std::unique_ptr<FormattingState>> m_formattingStates;

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (231093 => 231094)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2018-04-27 14:34:47 UTC (rev 231093)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2018-04-27 14:40:24 UTC (rev 231094)
@@ -36,7 +36,7 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(BlockFormattingContext);
 
-BlockFormattingContext::BlockFormattingContext(Box& formattingContextRoot)
+BlockFormattingContext::BlockFormattingContext(const Box& formattingContextRoot)
     : FormattingContext(formattingContextRoot)
 {
 }

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h (231093 => 231094)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h	2018-04-27 14:34:47 UTC (rev 231093)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h	2018-04-27 14:40:24 UTC (rev 231094)
@@ -43,7 +43,7 @@
 class BlockFormattingContext : public FormattingContext {
     WTF_MAKE_ISO_ALLOCATED(BlockFormattingContext);
 public:
-    BlockFormattingContext(Box& formattingContextRoot);
+    BlockFormattingContext(const Box& formattingContextRoot);
 
     void layout(FormattingState&) override;
     std::unique_ptr<FormattingState> formattingState() const override;

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (231093 => 231094)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2018-04-27 14:34:47 UTC (rev 231093)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2018-04-27 14:40:24 UTC (rev 231094)
@@ -36,7 +36,7 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(InlineFormattingContext);
 
-InlineFormattingContext::InlineFormattingContext(Box& formattingContextRoot)
+InlineFormattingContext::InlineFormattingContext(const Box& formattingContextRoot)
     : FormattingContext(formattingContextRoot)
 {
 }

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h (231093 => 231094)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h	2018-04-27 14:34:47 UTC (rev 231093)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h	2018-04-27 14:40:24 UTC (rev 231094)
@@ -41,7 +41,7 @@
 class InlineFormattingContext : public FormattingContext {
     WTF_MAKE_ISO_ALLOCATED(InlineFormattingContext);
 public:
-    InlineFormattingContext(Box& formattingContextRoot);
+    InlineFormattingContext(const Box& formattingContextRoot);
 
     void layout(FormattingState&) override;
     std::unique_ptr<FormattingState> formattingState() const override;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to