| Summary: | [test case] margin: auto and display: table on root element incorrectly generate horizontal scrollbar | ||
|---|---|---|---|
| Product: | [Applications] konqueror | Reporter: | khtmltest <annavoy> |
| Component: | khtml renderer | Assignee: | Konqueror Bugs <konqueror-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | FreeBSD Ports | ||
| OS: | FreeBSD | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: | testcase | ||
Created attachment 17884 [details]
testcase
Confirmed, svn r587111 SVN commit 588278 by carewolf:
Don't mix canvas width and root margins.
BUG: 134304
BUG: 134051
M +1 -1 render_box.cpp
M +2 -4 render_canvas.cpp
--- branches/KDE/3.5/kdelibs/khtml/rendering/render_box.cpp #588277:588278
@@ -696,7 +696,7 @@
short RenderBox::containingBlockWidth() const
{
- if ((isCanvas()||isRoot()) && canvas()->view())
+ if (isCanvas() && canvas()->view())
{
if (canvas()->pagedMode())
return canvas()->width();
--- branches/KDE/3.5/kdelibs/khtml/rendering/render_canvas.cpp #588277:588278
@@ -109,9 +109,7 @@
return;
}
- m_width = m_view ?
- m_view->frameWidth() + paddingLeft() + paddingRight() + borderLeft() + borderRight()
- : m_minWidth;
+ m_width = m_view ? m_view->frameWidth() : m_minWidth;
if (style()->marginLeft().isFixed())
m_marginLeft = style()->marginLeft().value();
@@ -720,7 +718,7 @@
RenderObject *fc = firstChild();
if(fc) {
// ow: like effectiveWidth() but without the negative
- const int ow = hasOverflowClip() ? width() : overflowWidth();
+ const int ow = fc->hasOverflowClip() ? fc->width() : fc->overflowWidth();
int dw = ow + fc->marginLeft() + fc->marginRight();
int rightmostPos = fc->rightmostPosition(false);
// kdDebug(6040) << "w " << w << " rightmostPos " << rightmostPos << " dw " << dw << " fc->rw " << fc->effectiveWidth() << " fc->width() " << fc->width() << endl;
|
Version: (using KDE KDE 3.5.4) Installed from: FreeBSD Ports Compiler: gcc 3.4.6 OS: FreeBSD If the root element has display: table; and margin: auto; specified, Konqueror 3.5.4 will generate a bogus horizontal scrollbar. testcase: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title>margin: auto and display: table on root</title> <style type="text/css"> html { margin: auto; display: table; } </style> </head> <body> <div>there should be no scrollbar</div> </body> </html> According to CSS 2.1 anonymous table model, the table computed width is shrink-to-fit in this case, with table-row-group, table-row, and table-cell anonymous elements autogenerated around the body descendant of root element with display: table; If the viewport width for a given font size is wider than the text in the body, the text should be centered on page. There should be no scrollbar. The problem occurs if the following display types are assigned to the root element: display: table; display: table-header-group; display: table-footer-group; display: table-row-group; display: table-row; display: table-cell; This is a spec violation in KHTML 3.5.4.