WebKit Bugzilla
Attachment 339648 Details for
Bug 185352
: [LFC] Add BlockFormattingContext::computeStaticPosition
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185352-20180505084740.patch (text/plain), 3.43 KB, created by
zalan
on 2018-05-05 08:47:41 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-05-05 08:47:41 PDT
Size:
3.43 KB
patch
obsolete
>Subversion Revision: 231395 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 293ccf0b6b21fd8c6f1c02b808d9f81094b47a9a..055ca810241b926a538f95e3caf9d3ba20f9dde5 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,16 @@ >+2018-05-05 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Add BlockFormattingContext::computeStaticPosition >+ https://bugs.webkit.org/show_bug.cgi?id=185352 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This is the core logic for positioning inflow boxes in a block formatting context (very naive though). >+ >+ * layout/blockformatting/BlockFormattingContext.cpp: >+ (WebCore::Layout::BlockFormattingContext::computeStaticPosition const): >+ * layout/displaytree/DisplayBox.h: >+ > 2018-05-02 Dean Jackson <dino@apple.com> > > Use IOSurfaces for CoreImage operations where possible >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >index 237b7320b5f0a7d9bed5395dcaa2a28db7f39f65..464c0b0e05b9aaa740a16cac215491ab0cf67d27 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >@@ -124,8 +124,22 @@ Ref<FloatingState> BlockFormattingContext::createOrFindFloatingState() const > return FloatingState::create(); > } > >-void BlockFormattingContext::computeStaticPosition(const Box&, Display::Box&) const >+void BlockFormattingContext::computeStaticPosition(const Box& layoutBox, Display::Box& displayBox) const > { >+ // https://www.w3.org/TR/CSS22/visuren.html#block-formatting >+ // In a block formatting context, boxes are laid out one after the other, vertically, beginning at the top of a containing block. >+ // The vertical distance between two sibling boxes is determined by the 'margin' properties. >+ // Vertical margins between adjacent block-level boxes in a block formatting context collapse. >+ // In a block formatting context, each box's left outer edge touches the left edge of the containing block (for right-to-left formatting, right edges touch). >+ auto containingBlockContentBox = layoutContext().displayBoxForLayoutBox(*layoutBox.containingBlock())->contentBox(); >+ // Start from the top of the container's content box. >+ auto top = containingBlockContentBox.y(); >+ auto left = containingBlockContentBox.x(); >+ if (auto* previousInFlowSibling = layoutBox.previousInFlowSibling()) >+ top = layoutContext().displayBoxForLayoutBox(*previousInFlowSibling)->bottom() + marginBottom(*previousInFlowSibling); >+ LayoutPoint topLeft = { top, left }; >+ topLeft.moveBy({ marginLeft(layoutBox), marginTop(layoutBox) }); >+ displayBox.setTopLeft(topLeft); > } > > void BlockFormattingContext::computeInFlowWidth(const Box&, Display::Box&) const >diff --git a/Source/WebCore/layout/displaytree/DisplayBox.h b/Source/WebCore/layout/displaytree/DisplayBox.h >index 73ea630599be9073d126e3c2f995726ad6928861..1b24e8426e9c58298b5b63d538fa4bf23ba8e272 100644 >--- a/Source/WebCore/layout/displaytree/DisplayBox.h >+++ b/Source/WebCore/layout/displaytree/DisplayBox.h >@@ -36,6 +36,7 @@ namespace WebCore { > > namespace Layout { > class LayoutContext; >+class BlockFormattingContext; > } > > namespace Display { >@@ -44,6 +45,7 @@ class Box { > WTF_MAKE_ISO_ALLOCATED(Box); > public: > friend class Layout::LayoutContext; >+ friend class Layout::BlockFormattingContext; > > ~Box(); >
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 185352
: 339648