Title: [230136] trunk/Tools
- Revision
- 230136
- Author
- [email protected]
- Date
- 2018-03-31 18:12:13 -0700 (Sat, 31 Mar 2018)
Log Message
[LayoutReloaded] Remove FormattingContext::absoluteMarginBox
https://bugs.webkit.org/show_bug.cgi?id=184213
Reviewed by Antti Koivisto.
Display.Box already has the margin values.
* LayoutReloaded/FormattingContext/FloatingContext.js:
(FloatingContext.prototype._positionForFloating):
(FloatingContext.prototype._addFloatingBox):
(FloatingContext.prototype._mapMarginBoxToFormattingRoot):
(FloatingContext.prototype._formattingRoot):
* LayoutReloaded/FormattingContext/FormattingContext.js:
(FormattingContext.prototype.absoluteMarginBox): Deleted.
* LayoutReloaded/Utils.js:
(Utils.marginBox):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (230135 => 230136)
--- trunk/Tools/ChangeLog 2018-04-01 00:50:13 UTC (rev 230135)
+++ trunk/Tools/ChangeLog 2018-04-01 01:12:13 UTC (rev 230136)
@@ -1,5 +1,24 @@
2018-03-31 Zalan Bujtas <[email protected]>
+ [LayoutReloaded] Remove FormattingContext::absoluteMarginBox
+ https://bugs.webkit.org/show_bug.cgi?id=184213
+
+ Reviewed by Antti Koivisto.
+
+ Display.Box already has the margin values.
+
+ * LayoutReloaded/FormattingContext/FloatingContext.js:
+ (FloatingContext.prototype._positionForFloating):
+ (FloatingContext.prototype._addFloatingBox):
+ (FloatingContext.prototype._mapMarginBoxToFormattingRoot):
+ (FloatingContext.prototype._formattingRoot):
+ * LayoutReloaded/FormattingContext/FormattingContext.js:
+ (FormattingContext.prototype.absoluteMarginBox): Deleted.
+ * LayoutReloaded/Utils.js:
+ (Utils.marginBox):
+
+2018-03-31 Zalan Bujtas <[email protected]>
+
[layoutReloaded] Introduce margin to Display.Box
https://bugs.webkit.org/show_bug.cgi?id=184212
Modified: trunk/Tools/LayoutReloaded/FormattingContext/FloatingContext.js (230135 => 230136)
--- trunk/Tools/LayoutReloaded/FormattingContext/FloatingContext.js 2018-04-01 00:50:13 UTC (rev 230135)
+++ trunk/Tools/LayoutReloaded/FormattingContext/FloatingContext.js 2018-04-01 01:12:13 UTC (rev 230136)
@@ -58,7 +58,7 @@
}
_positionForFloating(floatingBox) {
- let absoluteFloatingBox = this._formattingContext().absoluteMarginBox(floatingBox);
+ let absoluteFloatingBox = this._mapMarginBoxToFormattingRoot(floatingBox);
if (this._isEmpty())
return this._adjustedFloatingPosition(floatingBox, absoluteFloatingBox.top());
let verticalPosition = Math.max(absoluteFloatingBox.top(), this._lastFloating().top());
@@ -188,10 +188,16 @@
_addFloatingBox(layoutBox) {
// Convert floating box to absolute.
let clonedDisplayBox = this._formattingContext().displayBox(layoutBox).clone();
- clonedDisplayBox.setRect(this._formattingContext().absoluteMarginBox(layoutBox));
+ clonedDisplayBox.setRect(this._mapMarginBoxToFormattingRoot(layoutBox));
this._floatingState().addFloating(layoutBox, clonedDisplayBox);
}
+ _mapMarginBoxToFormattingRoot(layoutBox) {
+ let displayBox = this._formattingState().displayBox(layoutBox);
+ let rootDisplayBox = this._formattingState().displayBox(this._formattingRoot());
+ return Utils.marginBox(displayBox, rootDisplayBox);
+ }
+
_floatingState() {
return this.m_floatingState;
}
@@ -200,6 +206,10 @@
return this.m_parentFormattingContext;
}
+ _formattingRoot() {
+ return this._formattingState().formattingRoot();
+ }
+
_formattingState() {
return this._floatingState().formattingState();
}
Modified: trunk/Tools/LayoutReloaded/FormattingContext/FormattingContext.js (230135 => 230136)
--- trunk/Tools/LayoutReloaded/FormattingContext/FormattingContext.js 2018-04-01 00:50:13 UTC (rev 230135)
+++ trunk/Tools/LayoutReloaded/FormattingContext/FormattingContext.js 2018-04-01 01:12:13 UTC (rev 230136)
@@ -72,14 +72,6 @@
return Utils.computedMarginRight(layoutBox.node());
}
- absoluteMarginBox(layoutBox) {
- let displayBox = this.displayBox(layoutBox);
- let absoluteRect = new LayoutRect(this._toRootAbsolutePosition(layoutBox), displayBox.borderBox().size());
- absoluteRect.moveBy(new LayoutSize(-displayBox.marginLeft(), -displayBox.marginTop()));
- absoluteRect.growBy(new LayoutSize(displayBox.marginLeft() + displayBox.marginRight(), displayBox.marginTop() + displayBox.marginBottom()));
- return absoluteRect;
- }
-
absoluteBorderBox(layoutBox) {
let borderBox = this.displayBox(layoutBox).borderBox();
let absoluteRect = new LayoutRect(this._toRootAbsolutePosition(layoutBox), borderBox.size());
Modified: trunk/Tools/LayoutReloaded/Utils.js (230135 => 230136)
--- trunk/Tools/LayoutReloaded/Utils.js 2018-04-01 00:50:13 UTC (rev 230135)
+++ trunk/Tools/LayoutReloaded/Utils.js 2018-04-01 01:12:13 UTC (rev 230136)
@@ -475,6 +475,19 @@
return window.getComputedStyle(node).float == "left";
}
+ static marginBox(box, container) {
+ ASSERT(box instanceof Display.Box);
+ ASSERT(container instanceof Display.Box);
+
+ let marginBox = box.marginBox();
+ if (box == container)
+ return marginBox;
+ for (let ascendant = box.parent(); ascendant && ascendant != container; ascendant = ascendant.parent())
+ marginBox.moveBy(ascendant.topLeft());
+ return marginBox;
+ }
+
+
static textRuns(text, container) {
return window.collectTextRuns(text, container.node());
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes