|
From: CVS C. to T. <the...@li...> - 2012-02-26 22:33:58
|
Revision: 680
http://themis.svn.sourceforge.net/themis/?rev=680&view=rev
Author: mark_hellegers
Date: 2012-02-26 22:33:52 +0000 (Sun, 26 Feb 2012)
Log Message:
-----------
Fixed some table rendering bugs and simplified some code.
Modified Paths:
--------------
trunk/themis/modules/CSSRenderer/CSSView.cpp
trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp
Modified: trunk/themis/modules/CSSRenderer/CSSView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-02-26 17:54:06 UTC (rev 679)
+++ trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-02-26 22:33:52 UTC (rev 680)
@@ -102,6 +102,7 @@
mLineHeight = 0;
mListStyleType = "none";
mName = mNode->getNodeName();
+ mRequestedWidth = -1;
if (mNode->hasChildNodes()) {
TNodeListPtr children = mNode->getChildNodes();
@@ -603,8 +604,13 @@
BPoint aStartingPoint) {
// printf("Doing layout for %s\n", mName.c_str());
+ mRects.clear();
if (mDisplay) {
mRect = aRect;
+ // Enforce the requested width if set
+ if (mRequestedWidth > -1) {
+ mRect.right = mRect.left + mRequestedWidth;
+ }
// Always set the top of the rect to the one from the starting point as that is definitely correct.
mRect.top = aStartingPoint.y;
BRect restRect = mRect;
@@ -657,6 +663,7 @@
if (box.startsWithSpace()) {
boxWidth += mSpaceWidth;
}
+ //printf("Linewidth: %f, boxwidth: %f, viewWidth: %f\n", lineWidth, boxWidth, viewWidth);
if (lineWidth + boxWidth > viewWidth) {
// TextBox doesn't fit on the current line.
// Store the current container rect if needed
@@ -705,6 +712,7 @@
}
// Mark the endpoint of the text in the rect.
mEndPoint.Set(rect.right, rect.top);
+ mRect.bottom = rect.top + mLineHeight;
// printf("Set endpoint for text node to: ");
// mEndPoint.PrintToStream();
}
@@ -785,7 +793,7 @@
// Add any margins
mEndPoint.Set(mEndPoint.x + mMarginRight, mEndPoint.y + mMarginBottom);
- mRect.bottom = restRect.top + mMarginBottom;
+ mRect.bottom += mMarginBottom;
mRect.right += mMarginRight;
//mRect.right = restRect.right;
}
Modified: trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp 2012-02-26 17:54:06 UTC (rev 679)
+++ trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp 2012-02-26 22:33:52 UTC (rev 680)
@@ -70,6 +70,7 @@
void TableRowDisplayView :: Layout(BRect aRect,
BPoint aStartingPoint) {
+ mRects.clear();
mRect = aRect;
// Always set the top of the rect to the one from the starting point as that is definitely correct.
mRect.top = aStartingPoint.y;
@@ -106,9 +107,6 @@
childView->Layout(restRowRect, startingPoint);
BRect rect2 = childView->Bounds();
mEndPoint = childView->GetEndPoint();
- // Set the top of the remaining rect to the bottom of the child,
- // because the space above is already taken by the child.
- restRect.top = rect2.bottom;
if (rect2.right > restRect.right) {
// The child used more space than was available. We can use that space now as well
// for any remaining children.
@@ -141,14 +139,14 @@
mRect.right = mRect.left;
}
mRect.bottom = restRect.top;
- mRects.push_back(mRect);
// mRect.PrintToStream();
// Add any margins
- mRect.bottom = restRect.top + mMarginBottom;
+ mRect.bottom += mMarginBottom;
mRect.right += mMarginRight;
mEndPoint.Set(mRect.right, mRect.bottom);
//mRect.right = restRect.right;
+ mRects.push_back(mRect);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|