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

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

Issue 342943002: Center fixpos <dialog> (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rm non-anchored-dialog-positioning-expected.txt Created 6 years, 6 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
Index: Source/core/rendering/RenderView.cpp
diff --git a/Source/core/rendering/RenderView.cpp b/Source/core/rendering/RenderView.cpp
index ce1337f524085b151bc79e5ad652c10ea8e81b9f..3ceb2faf9bbf3bfb16a088df82e005f10d5c1bb2 100644
--- a/Source/core/rendering/RenderView.cpp
+++ b/Source/core/rendering/RenderView.cpp
@@ -119,8 +119,7 @@ bool RenderView::isChildAllowed(RenderObject* child, RenderStyle*) const
static bool canCenterDialog(const RenderStyle* style)
{
- // FIXME: We must center for FixedPosition as well.
- return style->position() == AbsolutePosition && style->hasAutoTopAndBottom();
+ return (style->position() == AbsolutePosition || style->position() == FixedPosition) && style->hasAutoTopAndBottom();
}
void RenderView::positionDialog(RenderBox* box)
@@ -140,9 +139,8 @@ void RenderView::positionDialog(RenderBox* box)
return;
}
FrameView* frameView = document().view();
- int scrollTop = frameView->scrollOffset().height();
+ LayoutUnit top = (box->style()->position() == FixedPosition) ? 0 : frameView->scrollOffset().height();
int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height();
- LayoutUnit top = scrollTop;
if (box->height() < visibleHeight)
top += (visibleHeight - box->height()) / 2;
box->setY(top);

Powered by Google App Engine
This is Rietveld 408576698