WebKit Bugzilla
Attachment 340414 Details for
Bug 185649
: [LFC] Make Display::Box box sizing aware
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185649-20180515090308.patch (text/plain), 5.73 KB, created by
zalan
on 2018-05-15 09:03:09 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-05-15 09:03:09 PDT
Size:
5.73 KB
patch
obsolete
>Subversion Revision: 231799 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 6d21088ad2451132a141aad6aca8177ecd0a92c3..ea25d1dbecd20dee1097868e94fd72e23ea1248f 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2018-05-15 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Make Display::Box box sizing aware >+ https://bugs.webkit.org/show_bug.cgi?id=185649 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Display::Box::width() == Display::Box::contentBox().width() <= box-sizing: content-box; (initial and default value) >+ Display::Box::width() == Display::Box::borderBox().width() <= box-sizing: border-box; >+ >+ * layout/LayoutContext.cpp: >+ (WebCore::Layout::LayoutContext::createDisplayBox): >+ * layout/displaytree/DisplayBox.cpp: >+ (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: >+ > 2018-05-15 Dirk Schulze <krit@webkit.org> > > Add new SVGDOM SVGFEBLEND constants >diff --git a/Source/WebCore/layout/LayoutContext.cpp b/Source/WebCore/layout/LayoutContext.cpp >index 658f8cbc56e4b8a446285709f41794952f2b3d29..7718786bfdcfaff0926b60ac879754246a466513 100644 >--- a/Source/WebCore/layout/LayoutContext.cpp >+++ b/Source/WebCore/layout/LayoutContext.cpp >@@ -64,7 +64,7 @@ void LayoutContext::updateLayout() > > Display::Box& LayoutContext::createDisplayBox(const Box& layoutBox) > { >- std::unique_ptr<Display::Box> displayBox(new Display::Box()); >+ std::unique_ptr<Display::Box> displayBox(new Display::Box(layoutBox.style().boxSizing())); > auto* displayBoxPtr = displayBox.get(); > m_layoutToDisplayBox.add(&layoutBox, WTFMove(displayBox)); > return *displayBoxPtr; >diff --git a/Source/WebCore/layout/displaytree/DisplayBox.cpp b/Source/WebCore/layout/displaytree/DisplayBox.cpp >index ccdf6483cd12ecd0cc538449f1f52f458e396e68..547ff7808d7a7b57afdf0afb60eb1f9281bfc568 100644 >--- a/Source/WebCore/layout/displaytree/DisplayBox.cpp >+++ b/Source/WebCore/layout/displaytree/DisplayBox.cpp >@@ -35,7 +35,8 @@ namespace Display { > > WTF_MAKE_ISO_ALLOCATED_IMPL(Box); > >-Box::Box() >+Box::Box(EBoxSizing boxSizing) >+ : m_boxSizing(boxSizing) > { > } > >@@ -46,41 +47,56 @@ Box::~Box() > LayoutRect Box::marginBox() const > { > ASSERT(m_hasValidMargin); >- auto marginBox = rect(); >- auto topLeftMargin = LayoutSize(m_marginLeft, m_marginTop); >- marginBox.inflate(topLeftMargin); >+ auto marginBox = borderBox(); >+ >+ marginBox.shiftXEdgeTo(marginBox.x() + m_marginLeft); >+ marginBox.shiftYEdgeTo(marginBox.y() + m_marginTop); >+ marginBox.shiftMaxXEdgeTo(marginBox.maxX() - m_marginRight); >+ marginBox.shiftMaxYEdgeTo(marginBox.maxY() - m_marginBottom); > >- auto bottomRightMargin = LayoutSize(m_marginRight, m_marginBottom); >- marginBox.expand(bottomRightMargin); > return marginBox; > } > > LayoutRect Box::borderBox() const > { >- return LayoutRect(LayoutPoint(0, 0), size()); >+ if (m_boxSizing == BORDER_BOX) >+ return LayoutRect( { }, size()); >+ >+ // Width is content box. >+ ASSERT(m_hasValidBorder); >+ ASSERT(m_hasValidPadding); >+ auto borderBoxSize = size(); >+ borderBoxSize.expand(borderLeft() + paddingLeft() + paddingRight() + borderRight() , borderTop() + paddingTop() + paddingBottom() + borderBottom()); >+ return LayoutRect( { }, borderBoxSize); > } > > LayoutRect Box::paddingBox() const > { > ASSERT(m_hasValidBorder); > auto paddingBox = borderBox(); >- auto topLeftBorder = LayoutSize(m_borderLeft, m_borderTop); >- paddingBox.inflate(-topLeftBorder); > >- auto bottomRightBorder = LayoutSize(m_borderRight, m_borderBottom); >- paddingBox.expand(-bottomRightBorder); >+ paddingBox.shiftXEdgeTo(paddingBox.x() + m_borderLeft); >+ paddingBox.shiftYEdgeTo(paddingBox.y() + m_borderTop); >+ paddingBox.shiftMaxXEdgeTo(paddingBox.maxX() - m_borderRight); >+ paddingBox.shiftMaxYEdgeTo(paddingBox.maxY() - m_borderBottom); >+ > return paddingBox; > } > > LayoutRect Box::contentBox() const > { >+ if (m_boxSizing == CONTENT_BOX) >+ return LayoutRect(LayoutPoint(0, 0), size()); >+ >+ // Width is border box. > ASSERT(m_hasValidPadding); > auto contentBox = paddingBox(); >- auto topLeftPadding = LayoutSize(m_paddingLeft, m_paddingTop); >- contentBox.inflate(-topLeftPadding); >- >- auto bottomRightPadding = LayoutSize(m_paddingRight, m_paddingBottom); >- contentBox.expand(-bottomRightPadding); >+ >+ contentBox.shiftXEdgeTo(contentBox.x() + m_paddingLeft); >+ contentBox.shiftYEdgeTo(contentBox.y() + m_paddingTop); >+ contentBox.shiftMaxXEdgeTo(contentBox.maxX() - m_paddingRight); >+ contentBox.shiftMaxYEdgeTo(contentBox.maxY() - m_paddingBottom); >+ > return contentBox; > } > >diff --git a/Source/WebCore/layout/displaytree/DisplayBox.h b/Source/WebCore/layout/displaytree/DisplayBox.h >index 368fdaf0eb85b4d2acaf684f24128ed2068b5e8d..1eb11366c081503b8f4d6dc77fc5682157265af0 100644 >--- a/Source/WebCore/layout/displaytree/DisplayBox.h >+++ b/Source/WebCore/layout/displaytree/DisplayBox.h >@@ -30,6 +30,7 @@ > #include "LayoutPoint.h" > #include "LayoutRect.h" > #include "LayoutUnit.h" >+#include "RenderStyleConstants.h" > #include <wtf/IsoMalloc.h> > > namespace WebCore { >@@ -86,7 +87,7 @@ public: > LayoutRect contentBox() const; > > private: >- Box(); >+ Box(EBoxSizing); > > void setRect(const LayoutRect&); > void setTopLeft(const LayoutPoint&); >@@ -141,6 +142,8 @@ private: > LayoutUnit m_paddingBottom; > LayoutUnit m_paddingRight; > >+ EBoxSizing m_boxSizing { CONTENT_BOX }; >+ > #if !ASSERT_DISABLED > bool m_hasValidTop { false }; > bool m_hasValidLeft { false };
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 185649
: 340414