Title: [230140] trunk/Tools
- Revision
- 230140
- Author
- [email protected]
- Date
- 2018-03-31 20:07:26 -0700 (Sat, 31 Mar 2018)
Log Message
[LayoutReloaded] InlineFormattingState should inherit the floating state from its parent formatting state
https://bugs.webkit.org/show_bug.cgi?id=184220
Reviewed by Antti Koivisto.
If the block container box that initiates an inline formatting context also establishes a block context,
create a new float state, otherwise use the existing one.
* LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js:
(BlockFormattingContext.prototype._contentHeight):
* LayoutReloaded/FormattingState/InlineFormattingState.js:
(InlineFormattingState):
* LayoutReloaded/LayoutState.js:
(LayoutState.prototype.establishedFormattingState):
(LayoutState.prototype.formattingStateForBox):
(LayoutState.prototype.formattingState): Deleted.
* LayoutReloaded/Utils.js:
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (230139 => 230140)
--- trunk/Tools/ChangeLog 2018-04-01 02:44:49 UTC (rev 230139)
+++ trunk/Tools/ChangeLog 2018-04-01 03:07:26 UTC (rev 230140)
@@ -1,5 +1,25 @@
2018-03-31 Zalan Bujtas <[email protected]>
+ [LayoutReloaded] InlineFormattingState should inherit the floating state from its parent formatting state
+ https://bugs.webkit.org/show_bug.cgi?id=184220
+
+ Reviewed by Antti Koivisto.
+
+ If the block container box that initiates an inline formatting context also establishes a block context,
+ create a new float state, otherwise use the existing one.
+
+ * LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js:
+ (BlockFormattingContext.prototype._contentHeight):
+ * LayoutReloaded/FormattingState/InlineFormattingState.js:
+ (InlineFormattingState):
+ * LayoutReloaded/LayoutState.js:
+ (LayoutState.prototype.establishedFormattingState):
+ (LayoutState.prototype.formattingStateForBox):
+ (LayoutState.prototype.formattingState): Deleted.
+ * LayoutReloaded/Utils.js:
+
+2018-03-31 Zalan Bujtas <[email protected]>
+
[LayoutReloaded] FloatingContext does not need a parent formatting context.
https://bugs.webkit.org/show_bug.cgi?id=184219
Modified: trunk/Tools/LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js (230139 => 230140)
--- trunk/Tools/LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js 2018-04-01 02:44:49 UTC (rev 230139)
+++ trunk/Tools/LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js 2018-04-01 03:07:26 UTC (rev 230140)
@@ -261,7 +261,7 @@
if (!layoutBox.isContainer() || !layoutBox.hasInFlowChild())
return 0;
if (layoutBox.establishesInlineFormattingContext()) {
- let lines = this.layoutState().formattingState(layoutBox).lines();
+ let lines = this.layoutState().establishedFormattingState(layoutBox).lines();
if (!lines.length)
return 0;
let lastLine = lines[lines.length - 1];
Modified: trunk/Tools/LayoutReloaded/FormattingState/InlineFormattingState.js (230139 => 230140)
--- trunk/Tools/LayoutReloaded/FormattingState/InlineFormattingState.js 2018-04-01 02:44:49 UTC (rev 230139)
+++ trunk/Tools/LayoutReloaded/FormattingState/InlineFormattingState.js 2018-04-01 03:07:26 UTC (rev 230140)
@@ -26,11 +26,13 @@
class InlineFormattingState extends FormattingState {
constructor(formattingRoot, layoutState) {
super(layoutState, formattingRoot);
- // If the block container box that initiates this inline formatting contex also establishes a block context, create a new float for us.
+ // If the block container box that initiates this inline formatting context also establishes a block context, create a new float for us.
if (this.formattingRoot().establishesBlockFormattingContext())
this.m_floatingState = new FloatingState(this);
else {
- // TODO: use parent formatting context's floating state.
+ // Find the formatting state in which this formatting root lives, not the one it creates (this).
+ let parentFormattingState = layoutState.formattingStateForBox(formattingRoot);
+ this.m_floatingState = parentFormattingState.floatingState();
}
this.m_lines = new Array();
}
Modified: trunk/Tools/LayoutReloaded/LayoutState.js (230139 => 230140)
--- trunk/Tools/LayoutReloaded/LayoutState.js 2018-04-01 02:44:49 UTC (rev 230139)
+++ trunk/Tools/LayoutReloaded/LayoutState.js 2018-04-01 03:07:26 UTC (rev 230140)
@@ -58,10 +58,22 @@
return this.m_formattingStates;
}
- formattingState(formattingRoot) {
+ establishedFormattingState(formattingRoot) {
+ ASSERT(formattingRoot.establishesFormattingContext());
return this.m_formattingStates.get(formattingRoot);
}
+ formattingStateForBox(layoutBox) {
+ // FIXME: We should probably cache this somewhere
+ let formattingState = null;
+ let ancestor = layoutBox.containingBlock();
+ do {
+ formattingState = this.m_formattingStates.get(ancestor);
+ ancestor = ancestor.containingBlock();
+ } while (!formattingState);
+ return formattingState;
+ }
+
initialDisplayBox() {
return this.m_initialDisplayBox;
}
Modified: trunk/Tools/LayoutReloaded/Utils.js (230139 => 230140)
--- trunk/Tools/LayoutReloaded/Utils.js 2018-04-01 02:44:49 UTC (rev 230139)
+++ trunk/Tools/LayoutReloaded/Utils.js 2018-04-01 03:07:26 UTC (rev 230140)
@@ -561,7 +561,7 @@
static _dumpLines(layoutState, root, level) {
ASSERT(root.establishesInlineFormattingContext());
- let inlineFormattingState = layoutState.formattingState(root);
+ let inlineFormattingState = layoutState.establishedFormattingState(root);
let lines = inlineFormattingState.lines();
let content = "";
let indentation = " ".repeat(level);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes