Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.h

Issue 2695963005: WIP: redirect some LayoutBox methods to ng fragments
Patch Set: tot Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.h
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.h b/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.h
index 4b03b6927c52e7f0d02e1605b35c53b8feb3d807..d21c567fb5bea4930a6a22aeb232b1c1f1b6294f 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.h
@@ -8,6 +8,8 @@
#include "core/CoreExport.h"
#include "core/layout/ng/ng_physical_fragment.h"
#include "core/layout/ng/ng_units.h"
+#include "platform/geometry/LayoutPoint.h"
+#include "platform/geometry/LayoutRect.h"
#include "platform/heap/Handle.h"
#include "wtf/Optional.h"
@@ -27,6 +29,8 @@ class CORE_EXPORT NGPhysicalBoxFragment final : public NGPhysicalFragment {
const NGMarginStrut& end_margin_strut,
RefPtr<NGBreakToken> break_token = nullptr);
+ NGPhysicalBoxFragment();
+
const Vector<RefPtr<NGPhysicalFragment>>& Children() const {
return children_;
}
@@ -44,6 +48,40 @@ class CORE_EXPORT NGPhysicalBoxFragment final : public NGPhysicalFragment {
const NGMarginStrut& EndMarginStrut() const { return end_margin_strut_; }
+ LayoutPoint Location() const {
+ return LayoutPoint(offset_.left, offset_.top);
+ }
+ void setLocation(const LayoutPoint& location) {
+ offset_.top = location.y();
+ offset_.left = location.x();
+ }
+ LayoutSize LegacySize() const {
+ return LayoutSize(size_.width, size_.height);
+ }
+ void setSize(const LayoutSize& size) {
+ size_.height = size.height();
+ size_.width = size.width();
+ }
+ IntSize pixelSnappedSize() const {
+ return IntSize(snapSizeToPixel(size_.width, offset_.left),
+ snapSizeToPixel(size_.height, offset_.top));
+ }
+ int pixelSnappedWidth() const { return snapSizeToPixel(size_.width, x()); }
+ int pixelSnappedHeight() const { return snapSizeToPixel(size_.height, y()); }
+ LayoutUnit x() const { return offset_.left; }
+ LayoutUnit y() const { return offset_.top; }
+ void setX(LayoutUnit x) { offset_.left = x; }
+ void setY(LayoutUnit y) { offset_.top = y; }
+ void setWidth(LayoutUnit width) { size_.width = width; }
+ void setHeight(LayoutUnit height) { size_.height = height; }
+ void move(LayoutUnit dx, LayoutUnit dy) {
+ offset_.top += dy;
+ offset_.left += dx;
+ }
+ LayoutRect getLayoutRect() const {
+ return LayoutRect(x(), y(), Width(), Height());
+ }
+
private:
Vector<RefPtr<NGPhysicalFragment>> children_;
Vector<Persistent<NGFloatingObject>> positioned_floats_;

Powered by Google App Engine
This is Rietveld 408576698