| Index: Source/core/rendering/RenderBlockFlow.cpp
|
| diff --git a/Source/core/rendering/RenderBlockFlow.cpp b/Source/core/rendering/RenderBlockFlow.cpp
|
| index 1a527c12c44c5cbc869da4a8407ae15c4f6d52cd..068627320dad05554a93bd69b39d3ba7dbdbe420 100644
|
| --- a/Source/core/rendering/RenderBlockFlow.cpp
|
| +++ b/Source/core/rendering/RenderBlockFlow.cpp
|
| @@ -35,6 +35,7 @@
|
| #include "core/frame/FrameView.h"
|
| #include "core/frame/LocalFrame.h"
|
| #include "core/frame/Settings.h"
|
| +#include "core/html/HTMLDialogElement.h"
|
| #include "core/rendering/HitTestLocation.h"
|
| #include "core/rendering/RenderFlowThread.h"
|
| #include "core/rendering/RenderLayer.h"
|
| @@ -382,6 +383,9 @@ void RenderBlockFlow::layoutBlock(bool relayoutChildren)
|
| setShouldInvalidateOverflowForPaint(true);
|
| }
|
|
|
| + if (isHTMLDialogElement(node()) && isOutOfFlowPositioned())
|
| + positionDialog();
|
| +
|
| clearNeedsLayout();
|
| }
|
|
|
| @@ -2911,4 +2915,34 @@ RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData()
|
| return *m_rareData;
|
| }
|
|
|
| +void RenderBlockFlow::positionDialog()
|
| +{
|
| + HTMLDialogElement* dialog = toHTMLDialogElement(node());
|
| + if (dialog->centeringMode() == HTMLDialogElement::NotCentered)
|
| + return;
|
| +
|
| + bool canCenterDialog = (style()->position() == AbsolutePosition || style()->position() == FixedPosition)
|
| + && style()->hasAutoTopAndBottom();
|
| +
|
| + if (dialog->centeringMode() == HTMLDialogElement::Centered) {
|
| + if (canCenterDialog)
|
| + setY(dialog->centeredPosition());
|
| + return;
|
| + }
|
| +
|
| + ASSERT(dialog->centeringMode() == HTMLDialogElement::NeedsCentering);
|
| + if (!canCenterDialog) {
|
| + dialog->setNotCentered();
|
| + return;
|
| + }
|
| +
|
| + FrameView* frameView = document().view();
|
| + LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scrollOffset().height();
|
| + int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height();
|
| + if (height() < visibleHeight)
|
| + top += (visibleHeight - height()) / 2;
|
| + setY(top);
|
| + dialog->setCentered(top);
|
| +}
|
| +
|
| } // namespace blink
|
|
|