| Index: third_party/WebKit/Source/core/layout/LayoutBox.h
|
| diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.h b/third_party/WebKit/Source/core/layout/LayoutBox.h
|
| index eda48c9efd564a5af8f583f2a8dbc59ba04660f5..5372fc00e5d0a8f3b09f505e91b5f8b43a036f0f 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutBox.h
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutBox.h
|
| @@ -24,6 +24,7 @@
|
| #define LayoutBox_h
|
|
|
| #include "core/CoreExport.h"
|
| +#include "core/layout/ng/ng_physical_box_fragment.h"
|
| #include "core/layout/LayoutBoxModelObject.h"
|
| #include "core/layout/OverflowModel.h"
|
| #include "platform/scroll/ScrollTypes.h"
|
| @@ -214,51 +215,57 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {
|
| LayoutBox* firstInFlowChildBox() const;
|
| LayoutBox* lastChildBox() const;
|
|
|
| - int pixelSnappedWidth() const { return m_frameRect.pixelSnappedWidth(); }
|
| - int pixelSnappedHeight() const { return m_frameRect.pixelSnappedHeight(); }
|
| + int pixelSnappedWidth() const {
|
| + return m_ngPhysicalBoxFragment->pixelSnappedWidth();
|
| + }
|
| + int pixelSnappedHeight() const {
|
| + return m_ngPhysicalBoxFragment->pixelSnappedHeight();
|
| + }
|
|
|
| void setX(LayoutUnit x) {
|
| - if (x == m_frameRect.x())
|
| + if (x == m_ngPhysicalBoxFragment->x())
|
| return;
|
| - m_frameRect.setX(x);
|
| + m_ngPhysicalBoxFragment->setX(x);
|
| locationChanged();
|
| }
|
| void setY(LayoutUnit y) {
|
| - if (y == m_frameRect.y())
|
| + if (y == m_ngPhysicalBoxFragment->y())
|
| return;
|
| - m_frameRect.setY(y);
|
| + m_ngPhysicalBoxFragment->setY(y);
|
| locationChanged();
|
| }
|
| void setWidth(LayoutUnit width) {
|
| - if (width == m_frameRect.width())
|
| + if (width == m_ngPhysicalBoxFragment->Width())
|
| return;
|
| - m_frameRect.setWidth(width);
|
| + m_ngPhysicalBoxFragment->setWidth(width);
|
| sizeChanged();
|
| }
|
| void setHeight(LayoutUnit height) {
|
| - if (height == m_frameRect.height())
|
| + if (height == m_ngPhysicalBoxFragment->Height())
|
| return;
|
| - m_frameRect.setHeight(height);
|
| + m_ngPhysicalBoxFragment->setHeight(height);
|
| sizeChanged();
|
| }
|
|
|
| LayoutUnit logicalLeft() const {
|
| - return style()->isHorizontalWritingMode() ? m_frameRect.x()
|
| - : m_frameRect.y();
|
| + return style()->isHorizontalWritingMode() ? m_ngPhysicalBoxFragment->x()
|
| + : m_ngPhysicalBoxFragment->y();
|
| }
|
| LayoutUnit logicalRight() const { return logicalLeft() + logicalWidth(); }
|
| LayoutUnit logicalTop() const {
|
| - return style()->isHorizontalWritingMode() ? m_frameRect.y()
|
| - : m_frameRect.x();
|
| + return style()->isHorizontalWritingMode() ? m_ngPhysicalBoxFragment->y()
|
| + : m_ngPhysicalBoxFragment->x();
|
| }
|
| LayoutUnit logicalBottom() const { return logicalTop() + logicalHeight(); }
|
| LayoutUnit logicalWidth() const {
|
| - return style()->isHorizontalWritingMode() ? m_frameRect.width()
|
| - : m_frameRect.height();
|
| + return style()->isHorizontalWritingMode()
|
| + ? m_ngPhysicalBoxFragment->Width()
|
| + : m_ngPhysicalBoxFragment->Height();
|
| }
|
| LayoutUnit logicalHeight() const {
|
| - return style()->isHorizontalWritingMode() ? m_frameRect.height()
|
| - : m_frameRect.width();
|
| + return style()->isHorizontalWritingMode()
|
| + ? m_ngPhysicalBoxFragment->Height()
|
| + : m_ngPhysicalBoxFragment->Width();
|
| }
|
|
|
| // Logical height of the object, including content overflowing the
|
| @@ -322,17 +329,25 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {
|
| setWidth(size);
|
| }
|
|
|
| - LayoutPoint location() const { return m_frameRect.location(); }
|
| + LayoutPoint location() const {
|
| + return m_ngPhysicalBoxFragment->Location();
|
| + }
|
| +
|
| LayoutSize locationOffset() const {
|
| - return LayoutSize(m_frameRect.x(), m_frameRect.y());
|
| + return LayoutSize(m_ngPhysicalBoxFragment->x(),
|
| + m_ngPhysicalBoxFragment->y());
|
| + }
|
| + LayoutSize size() const {
|
| + return m_ngPhysicalBoxFragment->LegacySize();
|
| + }
|
| + IntSize pixelSnappedSize() const {
|
| + return m_ngPhysicalBoxFragment->pixelSnappedSize();
|
| }
|
| - LayoutSize size() const { return m_frameRect.size(); }
|
| - IntSize pixelSnappedSize() const { return m_frameRect.pixelSnappedSize(); }
|
|
|
| void setLocation(const LayoutPoint& location) {
|
| - if (location == m_frameRect.location())
|
| + if (location == m_ngPhysicalBoxFragment->Location())
|
| return;
|
| - m_frameRect.setLocation(location);
|
| + m_ngPhysicalBoxFragment->setLocation(location);
|
| locationChanged();
|
| }
|
|
|
| @@ -348,22 +363,24 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {
|
| void setLocationAndUpdateOverflowControlsIfNeeded(const LayoutPoint&);
|
|
|
| void setSize(const LayoutSize& size) {
|
| - if (size == m_frameRect.size())
|
| + if (size == m_ngPhysicalBoxFragment->LegacySize())
|
| return;
|
| - m_frameRect.setSize(size);
|
| + m_ngPhysicalBoxFragment->setSize(size);
|
| sizeChanged();
|
| }
|
| void move(LayoutUnit dx, LayoutUnit dy) {
|
| if (!dx && !dy)
|
| return;
|
| - m_frameRect.move(dx, dy);
|
| + m_ngPhysicalBoxFragment->move(dx, dy);
|
| locationChanged();
|
| }
|
|
|
| // This function is in the container's coordinate system, meaning
|
| // that it includes the logical top/left offset and the
|
| // inline-start/block-start margins.
|
| - LayoutRect frameRect() const { return m_frameRect; }
|
| + LayoutRect frameRect() const {
|
| + return m_ngPhysicalBoxFragment->getLayoutRect();
|
| + }
|
| void setFrameRect(const LayoutRect& rect) {
|
| setLocation(rect.location());
|
| setSize(rect.size());
|
| @@ -376,7 +393,7 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {
|
| return LayoutRect(borderLeft(), borderTop(), clientWidth(), clientHeight());
|
| }
|
| IntRect pixelSnappedBorderBoxRect() const {
|
| - return IntRect(IntPoint(), m_frameRect.pixelSnappedSize());
|
| + return IntRect(IntPoint(), m_ngPhysicalBoxFragment->pixelSnappedSize());
|
| }
|
| IntRect borderBoundingBox() const final {
|
| return pixelSnappedBorderBoxRect();
|
| @@ -533,8 +550,12 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {
|
| // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines
|
| // (LayoutFlow) to return the remaining width on a given line (and the height
|
| // of a single line).
|
| - LayoutUnit offsetWidth() const override { return m_frameRect.width(); }
|
| - LayoutUnit offsetHeight() const override { return m_frameRect.height(); }
|
| + LayoutUnit offsetWidth() const override {
|
| + return m_ngPhysicalBoxFragment->Width();
|
| + }
|
| + LayoutUnit offsetHeight() const override {
|
| + return m_ngPhysicalBoxFragment->Height();
|
| + }
|
|
|
| int pixelSnappedOffsetWidth(const Element*) const final;
|
| int pixelSnappedOffsetHeight(const Element*) const final;
|
| @@ -1179,30 +1200,34 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {
|
| if (!UNLIKELY(hasFlippedBlocksWritingMode()))
|
| return position;
|
| return isHorizontalWritingMode()
|
| - ? LayoutPoint(position.x(), m_frameRect.height() - position.y())
|
| - : LayoutPoint(m_frameRect.width() - position.x(), position.y());
|
| + ? LayoutPoint(position.x(),
|
| + m_ngPhysicalBoxFragment->Height() - position.y())
|
| + : LayoutPoint(m_ngPhysicalBoxFragment->Width() - position.x(),
|
| + position.y());
|
| }
|
| WARN_UNUSED_RESULT LayoutSize
|
| flipForWritingMode(const LayoutSize& offset) const {
|
| if (!UNLIKELY(hasFlippedBlocksWritingMode()))
|
| return offset;
|
| - return LayoutSize(m_frameRect.width() - offset.width(), offset.height());
|
| + return LayoutSize(m_ngPhysicalBoxFragment->Width() - offset.width(),
|
| + offset.height());
|
| }
|
| void flipForWritingMode(LayoutRect& rect) const {
|
| if (!UNLIKELY(hasFlippedBlocksWritingMode()))
|
| return;
|
| - rect.setX(m_frameRect.width() - rect.maxX());
|
| + rect.setX(m_ngPhysicalBoxFragment->Width() - rect.maxX());
|
| }
|
| WARN_UNUSED_RESULT FloatPoint
|
| flipForWritingMode(const FloatPoint& position) const {
|
| if (!UNLIKELY(hasFlippedBlocksWritingMode()))
|
| return position;
|
| - return FloatPoint(m_frameRect.width() - position.x(), position.y());
|
| + return FloatPoint(m_ngPhysicalBoxFragment->Width() - position.x(),
|
| + position.y());
|
| }
|
| void flipForWritingMode(FloatRect& rect) const {
|
| if (!UNLIKELY(hasFlippedBlocksWritingMode()))
|
| return;
|
| - rect.setX(m_frameRect.width() - rect.maxX());
|
| + rect.setX(m_ngPhysicalBoxFragment->Width() - rect.maxX());
|
| }
|
|
|
| // Passing |container| causes flipped-block flipping w.r.t. that container,
|
| @@ -1589,7 +1614,7 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {
|
| // object's border edge to the container's border edge (which is not
|
| // always the parent). Thus it includes any logical top/left along
|
| // with this box's margins.
|
| - LayoutRect m_frameRect;
|
| + RefPtr<NGPhysicalBoxFragment> m_ngPhysicalBoxFragment;
|
|
|
| // Previous size of m_frameRect, updated after paint invalidation.
|
| LayoutSize m_previousSize;
|
|
|