Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1527)

Unified Diff: Source/core/rendering/RenderView.cpp

Issue 574143002: Center dialogs before computing overflow. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderView.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderView.cpp
diff --git a/Source/core/rendering/RenderView.cpp b/Source/core/rendering/RenderView.cpp
index 85159d5e061fef2481fb31d3abcf4247863441ca..7771facc8fe8ff5f6a4fac131dfa55a449e4a00c 100644
--- a/Source/core/rendering/RenderView.cpp
+++ b/Source/core/rendering/RenderView.cpp
@@ -24,7 +24,6 @@
#include "core/dom/Document.h"
#include "core/dom/Element.h"
#include "core/frame/LocalFrame.h"
-#include "core/html/HTMLDialogElement.h"
#include "core/html/HTMLFrameOwnerElement.h"
#include "core/html/HTMLIFrameElement.h"
#include "core/page/Page.h"
@@ -137,57 +136,12 @@ bool RenderView::isChildAllowed(RenderObject* child, RenderStyle*) const
return child->isBox();
}
-static bool canCenterDialog(const RenderStyle* style)
-{
- return (style->position() == AbsolutePosition || style->position() == FixedPosition) && style->hasAutoTopAndBottom();
-}
-
-void RenderView::positionDialog(RenderBox* box)
-{
- HTMLDialogElement* dialog = toHTMLDialogElement(box->node());
- if (dialog->centeringMode() == HTMLDialogElement::NotCentered)
- return;
- if (dialog->centeringMode() == HTMLDialogElement::Centered) {
- if (canCenterDialog(box->style()))
- box->setY(dialog->centeredPosition());
- return;
- }
-
- ASSERT(dialog->centeringMode() == HTMLDialogElement::NeedsCentering);
- if (!canCenterDialog(box->style())) {
- dialog->setNotCentered();
- return;
- }
- FrameView* frameView = document().view();
- LayoutUnit top = (box->style()->position() == FixedPosition) ? 0 : frameView->scrollOffset().height();
- int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height();
- if (box->height() < visibleHeight)
- top += (visibleHeight - box->height()) / 2;
- box->setY(top);
- dialog->setCentered(top);
-}
-
-void RenderView::positionDialogs()
-{
- TrackedRendererListHashSet* positionedDescendants = positionedObjects();
- if (!positionedDescendants)
- return;
- TrackedRendererListHashSet::iterator end = positionedDescendants->end();
- for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(); it != end; ++it) {
- RenderBox* box = *it;
- if (isHTMLDialogElement(box->node()))
- positionDialog(box);
- }
-}
-
void RenderView::layoutContent()
{
ASSERT(needsLayout());
RenderBlockFlow::layout();
- positionDialogs();
-
#if ENABLE(ASSERT)
checkLayoutState();
#endif
« no previous file with comments | « Source/core/rendering/RenderView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698