WebKit Bugzilla
Attachment 339086 Details for
Bug 185116
: [LFC] Implement Display::Box functions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185116-20180428191703.patch (text/plain), 9.91 KB, created by
zalan
on 2018-04-28 19:17:04 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-04-28 19:17:04 PDT
Size:
9.91 KB
patch
obsolete
>Subversion Revision: 231142 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index a9717c7e5088cd9207ceb416b4e236a9bdfeb962..7c409fe046f788e33943afe7671fb83d0c097e97 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,62 @@ >+2018-04-28 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Implement Display::Box functions >+ https://bugs.webkit.org/show_bug.cgi?id=185116 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * layout/displaytree/DisplayBox.cpp: >+ (WebCore::Display::Box::Box): >+ (WebCore::Display::Box::~Box): >+ (WebCore::Display::Box::marginBox const): >+ (WebCore::Display::Box::borderBox const): >+ (WebCore::Display::Box::paddingBox const): >+ (WebCore::Display::Box::contentBox const): >+ * layout/displaytree/DisplayBox.h: >+ (WebCore::Display::Box::rect const): >+ (WebCore::Display::Box::top const): >+ (WebCore::Display::Box::left const): >+ (WebCore::Display::Box::bottom const): >+ (WebCore::Display::Box::right const): >+ (WebCore::Display::Box::topLeft const): >+ (WebCore::Display::Box::bottomRight const): >+ (WebCore::Display::Box::size const): >+ (WebCore::Display::Box::width const): >+ (WebCore::Display::Box::height const): >+ (WebCore::Display::Box::marginTop const): >+ (WebCore::Display::Box::marginLeft const): >+ (WebCore::Display::Box::marginBottom const): >+ (WebCore::Display::Box::marginRight const): >+ (WebCore::Display::Box::parent const): >+ (WebCore::Display::Box::nextSibling const): >+ (WebCore::Display::Box::previousSibling const): >+ (WebCore::Display::Box::firstChild const): >+ (WebCore::Display::Box::lastChild const): >+ (WebCore::Display::Box::setRect): >+ (WebCore::Display::Box::setTopLeft): >+ (WebCore::Display::Box::setTop): >+ (WebCore::Display::Box::setLeft): >+ (WebCore::Display::Box::setSize): >+ (WebCore::Display::Box::setWidth): >+ (WebCore::Display::Box::setHeight): >+ (WebCore::Display::Box::setMarginTop): >+ (WebCore::Display::Box::setMarginLeft): >+ (WebCore::Display::Box::setMarginBottom): >+ (WebCore::Display::Box::setMarginRight): >+ (WebCore::Display::Box::setBorderTop): >+ (WebCore::Display::Box::setBorderLeft): >+ (WebCore::Display::Box::setBorderBottom): >+ (WebCore::Display::Box::setBorderRight): >+ (WebCore::Display::Box::setPaddingTop): >+ (WebCore::Display::Box::setPaddingLeft): >+ (WebCore::Display::Box::setPaddingBottom): >+ (WebCore::Display::Box::setPaddingRight): >+ (WebCore::Display::Box::setParent): >+ (WebCore::Display::Box::setNextSibling): >+ (WebCore::Display::Box::setPreviousSibling): >+ (WebCore::Display::Box::setFirstChild): >+ (WebCore::Display::Box::setLastChild): >+ > 2018-04-28 Zalan Bujtas <zalan@apple.com> > > [LFC] Add LayoutTreeBuilder class to generate the layout tree >diff --git a/Source/WebCore/layout/displaytree/DisplayBox.cpp b/Source/WebCore/layout/displaytree/DisplayBox.cpp >index c4e1c1649fcc9f0cc373ec8a3e9bd51b362abfcb..eac3baf183ef49ae2bf5100afb593606d0fe061b 100644 >--- a/Source/WebCore/layout/displaytree/DisplayBox.cpp >+++ b/Source/WebCore/layout/displaytree/DisplayBox.cpp >@@ -25,3 +25,63 @@ > > #include "config.h" > #include "DisplayBox.h" >+ >+#if ENABLE(LAYOUT_FORMATTING_CONTEXT) >+ >+#include <wtf/IsoMallocInlines.h> >+ >+namespace WebCore { >+namespace Display { >+ >+WTF_MAKE_ISO_ALLOCATED_IMPL(Box); >+ >+Box::Box() >+{ >+} >+ >+Box::~Box() >+{ >+} >+ >+LayoutRect Box::marginBox() const >+{ >+ auto marginBox = rect(); >+ auto topLeftMargin = LayoutSize(m_marginLeft, m_marginTop); >+ marginBox.inflate(topLeftMargin); >+ >+ auto bottomRightMargin = LayoutSize(m_marginRight, m_marginBottom); >+ marginBox.expand(bottomRightMargin); >+ return marginBox; >+} >+ >+LayoutRect Box::borderBox() const >+{ >+ return LayoutRect(LayoutPoint(0, 0), size()); >+} >+ >+LayoutRect Box::paddingBox() const >+{ >+ auto paddingBox = borderBox(); >+ auto topLeftBorder = LayoutSize(m_borderLeft, m_borderTop); >+ paddingBox.inflate(-topLeftBorder); >+ >+ auto bottomRightBorder = LayoutSize(m_borderRight, m_borderBottom); >+ paddingBox.expand(-bottomRightBorder); >+ return paddingBox; >+} >+ >+LayoutRect Box::contentBox() const >+{ >+ auto contentBox = paddingBox(); >+ auto topLeftPadding = LayoutSize(m_paddingLeft, m_paddingTop); >+ contentBox.inflate(-topLeftPadding); >+ >+ auto bottomRightPadding = LayoutSize(m_paddingRight, m_paddingBottom); >+ contentBox.expand(-bottomRightPadding); >+ return contentBox; >+} >+ >+} >+} >+ >+#endif >diff --git a/Source/WebCore/layout/displaytree/DisplayBox.h b/Source/WebCore/layout/displaytree/DisplayBox.h >index 39df2f158ba5ea58ace19d7c13769bdd35ca0465..e9d429f8ac99444898e4128ad56ad1dfe00b0c69 100644 >--- a/Source/WebCore/layout/displaytree/DisplayBox.h >+++ b/Source/WebCore/layout/displaytree/DisplayBox.h >@@ -33,60 +33,99 @@ > #include <wtf/IsoMalloc.h> > > namespace WebCore { >- > namespace Display { > > class Box { > WTF_MAKE_ISO_ALLOCATED(Box); > public: >- void setRect(const LayoutRect&); >- void setTopLeft(const LayoutPoint&); >- void setTop(LayoutUnit); >- void setLeft(LayoutUnit); >- void setSize(const LayoutSize&); >- void setWidth(LayoutUnit); >- void setHeight(LayoutUnit); >- >- LayoutRect rect() const; >- >- LayoutUnit top() const; >- LayoutUnit left() const; >- LayoutUnit bottom() const; >- LayoutUnit right() const; >- >- LayoutPoint topLeft() const; >- LayoutPoint bottomRight() const; >- >- LayoutSize size() const; >- LayoutUnit width() const; >- LayoutUnit height() const; >- >- void setMarginTop(LayoutUnit); >- void setMarginLeft(LayoutUnit); >- void setMarginBottom(LayoutUnit); >- void setMarginRight(LayoutUnit); >- >- LayoutUnit marginTop() const; >- LayoutUnit marginLeft() const; >- LayoutUnit marginBottom() const; >- LayoutUnit marginRight() const; >+ friend class FormattingContext; >+ >+ ~Box(); >+ >+ LayoutRect rect() const { return m_rect; } >+ >+ LayoutUnit top() const { return m_rect.y(); } >+ LayoutUnit left() const { return m_rect.x(); } >+ LayoutUnit bottom() const { return m_rect.maxY(); } >+ LayoutUnit right() const { return m_rect.maxX(); } >+ >+ LayoutPoint topLeft() const { return m_rect.location(); } >+ LayoutPoint bottomRight() const { return m_rect.location(); } >+ >+ LayoutSize size() const { return m_rect.size(); } >+ LayoutUnit width() const { return m_rect.width(); } >+ LayoutUnit height() const { return m_rect.height(); } >+ >+ LayoutUnit marginTop() const { return m_marginTop; } >+ LayoutUnit marginLeft() const { return m_marginLeft; } >+ LayoutUnit marginBottom() const { return m_marginBottom; } >+ LayoutUnit marginRight() const { return m_marginRight; } > > LayoutRect marginBox() const; > LayoutRect borderBox() const; > LayoutRect paddingBox() const; > LayoutRect contentBox() const; > >- void setParent(Box&); >- void setNextSibling(Box&); >- void setPreviousSibling(Box&); >- void setFirstChild(Box&); >- void setLastChild(Box&); >- >- Box* parent() const; >- Box* nextSibling() const; >- Box* previousSibling() const; >- Box* firstChild() const; >- Box* lastChild() const; >+ const Box* parent() const { return m_parent; } >+ const Box* nextSibling() const { return m_parent; } >+ const Box* previousSibling() const { return m_parent; } >+ const Box* firstChild() const { return m_firstChild; } >+ const Box* lastChild() const { return m_lastChild; } >+ >+private: >+ Box(); >+ >+ void setRect(const LayoutRect& rect) { m_rect = rect; } >+ void setTopLeft(const LayoutPoint& topLeft) { m_rect.setLocation(topLeft); } >+ void setTop(LayoutUnit top) { m_rect.setY(top); } >+ void setLeft(LayoutUnit left) { m_rect.setX(left); } >+ void setSize(const LayoutSize& size) { m_rect.setSize(size); } >+ void setWidth(LayoutUnit width) { m_rect.setWidth(width); } >+ void setHeight(LayoutUnit height) { m_rect.setHeight(height); } >+ >+ void setMarginTop(LayoutUnit marginTop) { m_marginTop = marginTop; } >+ void setMarginLeft(LayoutUnit marginLeft) { m_marginLeft = marginLeft; } >+ void setMarginBottom(LayoutUnit marginBottom) { m_marginBottom = marginBottom; } >+ void setMarginRight(LayoutUnit marginRight) { m_marginRight = marginRight; } >+ >+ void setBorderTop(LayoutUnit borderTop) { m_borderTop = borderTop; } >+ void setBorderLeft(LayoutUnit borderLeft) { m_borderLeft = borderLeft; } >+ void setBorderBottom(LayoutUnit borderBottom) { m_borderBottom = borderBottom; } >+ void setBorderRight(LayoutUnit borderRight) { m_borderRight = borderRight; } >+ >+ void setPaddingTop(LayoutUnit paddingTop) { m_paddingTop = paddingTop; } >+ void setPaddingLeft(LayoutUnit paddingLeft) { m_paddingLeft = paddingLeft; } >+ void setPaddingBottom(LayoutUnit paddingBottom) { m_paddingBottom = paddingBottom; } >+ void setPaddingRight(LayoutUnit paddingRight) { m_paddingRight = paddingRight; } >+ >+ void setParent(Box& parent) { m_parent = &parent; } >+ void setNextSibling(Box& nextSibling) { m_nextSibling = &nextSibling; } >+ void setPreviousSibling(Box& previousSibling) { m_previousSibling = &previousSibling; } >+ void setFirstChild(Box& firstChild) { m_firstChild = &firstChild; } >+ void setLastChild(Box& lastChild) { m_lastChild = &lastChild; } >+ >+ LayoutRect m_rect; >+ LayoutUnit m_marginTop; >+ LayoutUnit m_marginLeft; >+ LayoutUnit m_marginBottom; >+ LayoutUnit m_marginRight; >+ >+ LayoutUnit m_borderTop; >+ LayoutUnit m_borderLeft; >+ LayoutUnit m_borderBottom; >+ LayoutUnit m_borderRight; >+ >+ LayoutUnit m_paddingTop; >+ LayoutUnit m_paddingLeft; >+ LayoutUnit m_paddingBottom; >+ LayoutUnit m_paddingRight; >+ >+ const Box* m_parent { nullptr }; >+ const Box* m_nextSibling { nullptr }; >+ const Box* m_previousSibling { nullptr }; >+ const Box* m_firstChild { nullptr }; >+ const Box* m_lastChild { nullptr }; >+ > }; > > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185116
: 339086