Title: [231117] trunk/Source/WebCore
- Revision
- 231117
- Author
- [email protected]
- Date
- 2018-04-27 16:46:31 -0700 (Fri, 27 Apr 2018)
Log Message
[LFC] Add FormattingContext::computeWidth/computeHeight logic.
https://bugs.webkit.org/show_bug.cgi?id=185091
Reviewed by Antti Koivisto.
Inflow width and height can't really be computed without knowing the exact context.
* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::computeWidth const):
(WebCore::Layout::FormattingContext::computeHeight const):
(WebCore::Layout::FormattingContext::computeOutOfFlowWidth const):
(WebCore::Layout::FormattingContext::computeFloatingWidth const):
(WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
(WebCore::Layout::FormattingContext::computeFloatingHeight const):
* layout/FormattingContext.h:
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::computeInFlowWidth const):
(WebCore::Layout::BlockFormattingContext::computeInFlowHeight const):
(WebCore::Layout::BlockFormattingContext::computeWidth const): Deleted.
(WebCore::Layout::BlockFormattingContext::computeHeight const): Deleted.
* layout/blockformatting/BlockFormattingContext.h:
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::computeInFlowWidth const):
(WebCore::Layout::InlineFormattingContext::computeInFlowHeight const):
* layout/inlineformatting/InlineFormattingContext.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (231116 => 231117)
--- trunk/Source/WebCore/ChangeLog 2018-04-27 23:43:30 UTC (rev 231116)
+++ trunk/Source/WebCore/ChangeLog 2018-04-27 23:46:31 UTC (rev 231117)
@@ -1,3 +1,31 @@
+2018-04-27 Zalan Bujtas <[email protected]>
+
+ [LFC] Add FormattingContext::computeWidth/computeHeight logic.
+ https://bugs.webkit.org/show_bug.cgi?id=185091
+
+ Reviewed by Antti Koivisto.
+
+ Inflow width and height can't really be computed without knowing the exact context.
+
+ * layout/FormattingContext.cpp:
+ (WebCore::Layout::FormattingContext::computeWidth const):
+ (WebCore::Layout::FormattingContext::computeHeight const):
+ (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const):
+ (WebCore::Layout::FormattingContext::computeFloatingWidth const):
+ (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
+ (WebCore::Layout::FormattingContext::computeFloatingHeight const):
+ * layout/FormattingContext.h:
+ * layout/blockformatting/BlockFormattingContext.cpp:
+ (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const):
+ (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const):
+ (WebCore::Layout::BlockFormattingContext::computeWidth const): Deleted.
+ (WebCore::Layout::BlockFormattingContext::computeHeight const): Deleted.
+ * layout/blockformatting/BlockFormattingContext.h:
+ * layout/inlineformatting/InlineFormattingContext.cpp:
+ (WebCore::Layout::InlineFormattingContext::computeInFlowWidth const):
+ (WebCore::Layout::InlineFormattingContext::computeInFlowHeight const):
+ * layout/inlineformatting/InlineFormattingContext.h:
+
2018-04-27 Chris Dumez <[email protected]>
Use WindowProxy instead of DOMWindow in our IDL
Modified: trunk/Source/WebCore/layout/FormattingContext.cpp (231116 => 231117)
--- trunk/Source/WebCore/layout/FormattingContext.cpp 2018-04-27 23:43:30 UTC (rev 231116)
+++ trunk/Source/WebCore/layout/FormattingContext.cpp 2018-04-27 23:46:31 UTC (rev 231117)
@@ -28,6 +28,7 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+#include "LayoutBox.h"
#include <wtf/IsoMallocInlines.h>
namespace WebCore {
@@ -57,14 +58,40 @@
{
}
-void FormattingContext::computeWidth(const Box&) const
+void FormattingContext::computeWidth(const Box& layoutBox) const
{
+ if (layoutBox.isOutOfFlowPositioned())
+ return computeOutOfFlowWidth(layoutBox);
+ if (layoutBox.isFloatingPositioned())
+ return computeFloatingWidth(layoutBox);
+ return computeInFlowWidth(layoutBox);
}
-void FormattingContext::computeHeight(const Box&) const
+void FormattingContext::computeHeight(const Box& layoutBox) const
{
+ if (layoutBox.isOutOfFlowPositioned())
+ return computeOutOfFlowHeight(layoutBox);
+ if (layoutBox.isFloatingPositioned())
+ return computeFloatingHeight(layoutBox);
+ return computeInFlowHeight(layoutBox);
}
+void FormattingContext::computeOutOfFlowWidth(const Box&) const
+{
+}
+
+void FormattingContext::computeFloatingWidth(const Box&) const
+{
+}
+
+void FormattingContext::computeOutOfFlowHeight(const Box&) const
+{
+}
+
+void FormattingContext::computeFloatingHeight(const Box&) const
+{
+}
+
LayoutUnit FormattingContext::marginTop(const Box&) const
{
return 0;
Modified: trunk/Source/WebCore/layout/FormattingContext.h (231116 => 231117)
--- trunk/Source/WebCore/layout/FormattingContext.h 2018-04-27 23:43:30 UTC (rev 231116)
+++ trunk/Source/WebCore/layout/FormattingContext.h 2018-04-27 23:46:31 UTC (rev 231117)
@@ -62,6 +62,14 @@
virtual void computeWidth(const Box&) const;
virtual void computeHeight(const Box&) const;
+ virtual void computeOutOfFlowWidth(const Box&) const;
+ virtual void computeFloatingWidth(const Box&) const;
+ virtual void computeInFlowWidth(const Box&) const = 0;
+
+ virtual void computeOutOfFlowHeight(const Box&) const;
+ virtual void computeFloatingHeight(const Box&) const;
+ virtual void computeInFlowHeight(const Box&) const = 0;
+
virtual LayoutUnit marginTop(const Box&) const;
virtual LayoutUnit marginLeft(const Box&) const;
virtual LayoutUnit marginBottom(const Box&) const;
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (231116 => 231117)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2018-04-27 23:43:30 UTC (rev 231116)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2018-04-27 23:46:31 UTC (rev 231117)
@@ -120,11 +120,11 @@
{
}
-void BlockFormattingContext::computeWidth(const Box&) const
+void BlockFormattingContext::computeInFlowWidth(const Box&) const
{
}
-void BlockFormattingContext::computeHeight(const Box&) const
+void BlockFormattingContext::computeInFlowHeight(const Box&) const
{
}
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h (231116 => 231117)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h 2018-04-27 23:43:30 UTC (rev 231116)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h 2018-04-27 23:46:31 UTC (rev 231117)
@@ -51,10 +51,9 @@
protected:
void computeStaticPosition(const Box&) const override;
+ void computeInFlowWidth(const Box&) const override;
+ void computeInFlowHeight(const Box&) const override;
- void computeWidth(const Box&) const override;
- void computeHeight(const Box&) const override;
-
LayoutUnit marginTop(const Box&) const override;
LayoutUnit marginBottom(const Box&) const override;
};
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (231116 => 231117)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2018-04-27 23:43:30 UTC (rev 231116)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2018-04-27 23:46:31 UTC (rev 231117)
@@ -66,7 +66,15 @@
return formattingState.floatingState();
}
+void InlineFormattingContext::computeInFlowWidth(const Box&) const
+{
}
+
+void InlineFormattingContext::computeInFlowHeight(const Box&) const
+{
}
+}
+}
+
#endif
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h (231116 => 231117)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h 2018-04-27 23:43:30 UTC (rev 231116)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h 2018-04-27 23:46:31 UTC (rev 231117)
@@ -46,6 +46,11 @@
void layout(LayoutContext&, FormattingState&) const override;
std::unique_ptr<FormattingState> createFormattingState(Ref<FloatingState>&&) const override;
Ref<FloatingState> createOrFindFloatingState() const override;
+
+private:
+ void computeInFlowWidth(const Box&) const override;
+ void computeInFlowHeight(const Box&) const override;
+
};
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes