You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
(12) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
|
Feb
(23) |
Mar
(6) |
Apr
(6) |
May
(2) |
Jun
(41) |
Jul
(29) |
Aug
(28) |
Sep
(51) |
Oct
(19) |
Nov
(27) |
Dec
|
| 2003 |
Jan
(1) |
Feb
(11) |
Mar
(20) |
Apr
(18) |
May
(23) |
Jun
(18) |
Jul
(13) |
Aug
(49) |
Sep
(20) |
Oct
(3) |
Nov
(24) |
Dec
(1) |
| 2004 |
Jan
(12) |
Feb
(17) |
Mar
(38) |
Apr
(7) |
May
(22) |
Jun
(4) |
Jul
(26) |
Aug
(17) |
Sep
(18) |
Oct
(17) |
Nov
|
Dec
|
| 2005 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
(2) |
Oct
|
Nov
(14) |
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
| 2009 |
Jan
(5) |
Feb
(12) |
Mar
|
Apr
(10) |
May
(7) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(22) |
Dec
(6) |
| 2010 |
Jan
(14) |
Feb
(4) |
Mar
(4) |
Apr
(2) |
May
(3) |
Jun
|
Jul
|
Aug
(7) |
Sep
|
Oct
(2) |
Nov
(39) |
Dec
(3) |
| 2011 |
Jan
(28) |
Feb
(14) |
Mar
(8) |
Apr
(3) |
May
|
Jun
(14) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(3) |
Nov
(4) |
Dec
|
| 2012 |
Jan
(1) |
Feb
(12) |
Mar
(7) |
Apr
(4) |
May
(1) |
Jun
|
Jul
(1) |
Aug
(11) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2015 |
Jan
|
Feb
|
Mar
|
Apr
(13) |
May
(2) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
| 2017 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
(5) |
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: CVS C. to T. <the...@li...> - 2012-04-04 18:13:41
|
Revision: 695
http://themis.svn.sourceforge.net/themis/?rev=695&view=rev
Author: mark_hellegers
Date: 2012-04-04 18:13:35 +0000 (Wed, 04 Apr 2012)
Log Message:
-----------
Added support for HTML 3.2 style tables.
Modified Paths:
--------------
trunk/themis/modules/CSSRenderer/TableDisplayView.cpp
Modified: trunk/themis/modules/CSSRenderer/TableDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableDisplayView.cpp 2012-04-03 21:32:50 UTC (rev 694)
+++ trunk/themis/modules/CSSRenderer/TableDisplayView.cpp 2012-04-04 18:13:35 UTC (rev 695)
@@ -39,6 +39,7 @@
// CSS Renderer headers
#include "TableDisplayView.hpp"
#include "TableGroupDisplayView.hpp"
+#include "TableRowDisplayView.hpp"
TableDisplayView :: TableDisplayView(CSSRendererView * aBaseView,
TNodePtr aNode,
@@ -172,6 +173,20 @@
}
}
}
+ else {
+ TableRowDisplayView * childRowView = dynamic_cast<TableRowDisplayView *> (childView);
+ if (childRowView) {
+ unsigned int childLength = childRowView->GetLength();
+ for (unsigned int j = 0; j < childLength; j++) {
+ if (j >= widths.size()) {
+ widths.push_back(childRowView->GetChildWidth(j));
+ }
+ else if (childRowView->GetChildWidth(j) > widths[j]) {
+ widths[j] = childRowView->GetChildWidth(j);
+ }
+ }
+ }
+ }
}
for (unsigned int i = 0; i < length; i++) {
@@ -183,6 +198,15 @@
childGroupView->SetColWidth(widths[j], j);
}
}
+ else {
+ TableRowDisplayView * childRowView = dynamic_cast<TableRowDisplayView *> (childView);
+ if (childRowView) {
+ unsigned int childLength = childRowView->GetLength();
+ for (unsigned int j = 0; j < childLength; j++) {
+ childRowView->SetChildWidth(widths[j], j);
+ }
+ }
+ }
}
// Do another layout the children based on the new col widths.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-04-03 21:32:56
|
Revision: 694
http://themis.svn.sourceforge.net/themis/?rev=694&view=rev
Author: mark_hellegers
Date: 2012-04-03 21:32:50 +0000 (Tue, 03 Apr 2012)
Log Message:
-----------
Added support for scrolling with the keyboard (arrow keys and page up and down).
Modified Paths:
--------------
trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.cpp
trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.hpp
Modified: trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.cpp 2012-04-03 21:28:05 UTC (rev 693)
+++ trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.cpp 2012-04-03 21:32:50 UTC (rev 694)
@@ -131,12 +131,90 @@
}
}
+float CSSScrolledRendererView :: GetActualScrollValue(
+ orientation aDirection,
+ float aInputValue) const {
+
+ float result = 0;
+ BScrollBar * bar = mScrollView->ScrollBar(aDirection);
+ float min = 0;
+ float max = 0;
+ bar->GetRange(&min, &max);
+ float value = bar->Value();
+ if (aInputValue + value > max) {
+ // Adjust it, so it fits.
+ result = max - value;
+ }
+ else if (aInputValue + value < min) {
+ // Adjust it, so it fits.
+ result = min - value;
+ }
+ else {
+ result = aInputValue;
+ }
+
+ return result;
+
+}
+
+
+void CSSScrolledRendererView :: Scroll(
+ float aHorizontal,
+ float aVertical) {
+
+ // Before we scroll, we check if we are still within the limits.
+ float vertical = GetActualScrollValue(B_VERTICAL, aVertical);
+ float horizontal = GetActualScrollValue(B_HORIZONTAL, aHorizontal);
+
+ if (vertical != 0 || horizontal != 0) {
+ // Only scroll when it has any effect.
+ mView->ScrollBy(horizontal, vertical);
+ }
+
+}
+
void CSSScrolledRendererView :: FrameResized(float aWidth, float aHeight) {
SetScrollbars();
}
+void CSSScrolledRendererView :: KeyDown(const char * aBytes, int32 aNumBytes) {
+
+ switch (aBytes[0]) {
+ case B_PAGE_UP: {
+ BRect frame = Bounds();
+ Scroll(0, -(frame.Height() - B_H_SCROLL_BAR_HEIGHT - 5));
+ break;
+ }
+ case B_PAGE_DOWN: {
+ BRect frame = Bounds();
+ Scroll(0, frame.Height() - B_H_SCROLL_BAR_HEIGHT - 5);
+ break;
+ }
+ case B_UP_ARROW: {
+ Scroll(0, -20);
+ break;
+ }
+ case B_DOWN_ARROW: {
+ Scroll(0, 20);
+ break;
+ }
+ case B_LEFT_ARROW: {
+ Scroll(-20, 0);
+ break;
+ }
+ case B_RIGHT_ARROW: {
+ Scroll(20, 0);
+ break;
+ }
+ default: {
+ BView::KeyDown(aBytes, aNumBytes);
+ }
+ }
+
+}
+
void CSSScrolledRendererView :: MessageReceived(BMessage * aMessage) {
switch (aMessage->what) {
@@ -176,24 +254,7 @@
float wheelValue = aMessage->FindFloat( "be:wheel_delta_y");
// We multiply it by 50 to make the scrolling usable.
float scrollValue = wheelValue * 50;
- // Before we scroll, we check if we are still within the limits.
- BScrollBar * bar = mScrollView->ScrollBar(B_VERTICAL);
- float min = 0;
- float max = 0;
- bar->GetRange(&min, &max);
- float value = bar->Value();
- if (scrollValue + value > max) {
- // Adjust it, so it fits.
- scrollValue = max - value;
- }
- else if (scrollValue + value < min) {
- // Adjust it, so it fits.
- scrollValue = min - value;
- }
- if (scrollValue != 0) {
- // Only scroll when it has any effect.
- mView->ScrollBy(0, scrollValue);
- }
+ Scroll(0, scrollValue);
break;
}
default: {
Modified: trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.hpp 2012-04-03 21:28:05 UTC (rev 693)
+++ trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.hpp 2012-04-03 21:32:50 UTC (rev 694)
@@ -41,6 +41,7 @@
// BeOS headers
#include <View.h>
+#include <InterfaceDefs.h>
// DOM headers
#include "DOMSupport.h"
@@ -62,6 +63,12 @@
CSSStyleSheetPtr mStyleSheet;
TDocumentPtr mDocument;
void SetScrollbars();
+ float GetActualScrollValue(
+ orientation aDirection,
+ float aInputValue) const;
+ void Scroll(
+ float aHorizontal,
+ float aVertical);
public:
CSSScrolledRendererView(TDocumentPtr aDocument,
@@ -72,6 +79,7 @@
int32 aUrlId);
~CSSScrolledRendererView();
void FrameResized(float aWidth, float aHeight);
+ virtual void KeyDown(const char * aBytes, int32 aNumBytes);
void MessageReceived(BMessage * aMessage);
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-04-03 21:28:11
|
Revision: 693
http://themis.svn.sourceforge.net/themis/?rev=693&view=rev
Author: mark_hellegers
Date: 2012-04-03 21:28:05 +0000 (Tue, 03 Apr 2012)
Log Message:
-----------
Don't redraw the tab when a new url is loaded.
Just set the url directly in the navigation view.
Modified Paths:
--------------
trunk/themis/framework/win.cpp
Modified: trunk/themis/framework/win.cpp
===================================================================
--- trunk/themis/framework/win.cpp 2012-04-03 21:20:09 UTC (rev 692)
+++ trunk/themis/framework/win.cpp 2012-04-03 21:28:05 UTC (rev 693)
@@ -420,18 +420,9 @@
Broadcast(MS_TARGET_PROTOCOL, load);
delete load;
- /*
- * Trigger this after the UrlHandler knows about the URL.
- * Otherwise we wouldn't see any URL in UrlView during load.
- * Sad, but true.
- */
if (visible) {
- if (msg->FindBool("hidden") == true)
- tabview->DrawTabs();
- else
- tabview->Select(selection);
+ navview->SetUrl(url.String());
}
-
break;
}
case URL_TYPED: {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-04-03 21:20:15
|
Revision: 692
http://themis.svn.sourceforge.net/themis/?rev=692&view=rev
Author: mark_hellegers
Date: 2012-04-03 21:20:09 +0000 (Tue, 03 Apr 2012)
Log Message:
-----------
Set the uri properly, so clicking relative links works better.
Modified Paths:
--------------
trunk/themis/modules/FileProtocol/FileProtocol.cpp
Modified: trunk/themis/modules/FileProtocol/FileProtocol.cpp
===================================================================
--- trunk/themis/modules/FileProtocol/FileProtocol.cpp 2012-03-27 21:10:15 UTC (rev 691)
+++ trunk/themis/modules/FileProtocol/FileProtocol.cpp 2012-04-03 21:20:09 UTC (rev 692)
@@ -189,7 +189,7 @@
fileMessage->AddInt32("url_id", url_id);
fileMessage->AddInt32("command", COMMAND_INFO);
fileMessage->AddBool("request_done", true);
- fileMessage->AddString("url", fileLocation.c_str());
+ fileMessage->AddString("url", url);
fileMessage->AddInt32("cache_object_token", objectToken);
fileMessage->AddInt64("bytes_received", cache->GetObjectSize(userToken,objectToken));
fileMessage->AddString("mime-type", mimeType);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-03-27 21:10:24
|
Revision: 691
http://themis.svn.sourceforge.net/themis/?rev=691&view=rev
Author: mark_hellegers
Date: 2012-03-27 21:10:15 +0000 (Tue, 27 Mar 2012)
Log Message:
-----------
- Moved some code around to make it more manageable.
- Attached BHandlers of the CSSViews to the BLooper. Some small issues remain, but still need to look into that.
- Fixed small problem with constructing an url. Needs to be rewritten, but works for now.
- Added support for forms. You can click on buttons and enter text. Try www.google.com. :)
Modified Paths:
--------------
trunk/themis/makefile
trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp
trunk/themis/modules/CSSRenderer/BlockDisplayView.hpp
trunk/themis/modules/CSSRenderer/CSSRendererView.cpp
trunk/themis/modules/CSSRenderer/CSSView.cpp
trunk/themis/modules/CSSRenderer/CSSView.hpp
trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp
trunk/themis/modules/CSSRenderer/InlineDisplayView.hpp
trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp
trunk/themis/modules/CSSRenderer/NoneDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableCellDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableGroupDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableGroupDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableRowDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.hpp
Added Paths:
-----------
trunk/themis/modules/CSSRenderer/ButtonInputDisplayView.cpp
trunk/themis/modules/CSSRenderer/ButtonInputDisplayView.hpp
trunk/themis/modules/CSSRenderer/FormDisplayView.cpp
trunk/themis/modules/CSSRenderer/FormDisplayView.hpp
trunk/themis/modules/CSSRenderer/HiddenInputDisplayView.cpp
trunk/themis/modules/CSSRenderer/HiddenInputDisplayView.hpp
trunk/themis/modules/CSSRenderer/InputDisplayView.cpp
trunk/themis/modules/CSSRenderer/InputDisplayView.hpp
trunk/themis/modules/CSSRenderer/TextInputDisplayView.cpp
trunk/themis/modules/CSSRenderer/TextInputDisplayView.hpp
Modified: trunk/themis/makefile
===================================================================
--- trunk/themis/makefile 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/makefile 2012-03-27 21:10:15 UTC (rev 691)
@@ -243,7 +243,12 @@
CSSRenderer/TableFooterGroupDisplayView.cpp \
CSSRenderer/TableHeaderGroupDisplayView.cpp \
CSSRenderer/TableRowGroupDisplayView.cpp \
- CSSRenderer/NoneDisplayView.cpp
+ CSSRenderer/NoneDisplayView.cpp \
+ CSSRenderer/FormDisplayView.cpp \
+ CSSRenderer/InputDisplayView.cpp \
+ CSSRenderer/ButtonInputDisplayView.cpp \
+ CSSRenderer/TextInputDisplayView.cpp \
+ CSSRenderer/HiddenInputDisplayView.cpp
#make install directories as necessary
ifeq "$(shell if [ -d $(BASE_ADDON_INSTALL_DIR) ] ; then echo 1 ; else mkdir -p $(BASE_ADDON_INSTALL_DIR) ; echo 0 ; fi)" "0"
Modified: trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -48,7 +48,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace)
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
: CSSView(aBaseView,
aNode,
aStyleSheets,
@@ -58,11 +59,25 @@
aUrlId,
aColor,
aFont,
- aWhiteSpace) {
+ aWhiteSpace,
+ aForm) {
mDisplay = true;
mBlock = true;
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
}
BlockDisplayView :: ~BlockDisplayView() {
Modified: trunk/themis/modules/CSSRenderer/BlockDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/BlockDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/BlockDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -80,7 +80,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~BlockDisplayView();
virtual void Layout(BRect aRect,
BPoint aStartingPoint);
Added: trunk/themis/modules/CSSRenderer/ButtonInputDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/ButtonInputDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/ButtonInputDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -0,0 +1,144 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: March 24, 2012
+*/
+
+/* ButtonInputDisplayView implementation
+ See ButtonInputDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// BeOS headers
+#include <Button.h>
+#include <Window.h>
+
+// DOM headers
+#include "TNode.h"
+#include "TElement.h"
+
+// CSS Renderer headers
+#include "ButtonInputDisplayView.hpp"
+#include "CSSRendererView.hpp"
+#include "FormDisplayView.hpp"
+
+ButtonInputDisplayView :: ButtonInputDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
+ : CSSView(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm) {
+
+ mDisplay = true;
+ mBlock = false;
+ mButton = NULL;
+
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
+}
+
+ButtonInputDisplayView :: ~ButtonInputDisplayView() {
+
+ delete mButton;
+
+}
+
+void ButtonInputDisplayView :: Layout(
+ BRect aRect,
+ BPoint aStartingPoint) {
+
+ if (mButton) {
+ mButton->MoveTo(aStartingPoint);
+ }
+ else {
+ TElementPtr element = shared_static_cast<TElement>(mNode);
+ string buttonLabel = "";
+ if (element->hasAttribute("VALUE")) {
+ buttonLabel = element->getAttribute("VALUE");
+ }
+ string buttonName = "";
+ if (element->hasAttribute("NAME")) {
+ buttonName = element->getAttribute("NAME");
+ }
+
+ BPoint rightBottom(aStartingPoint.x, aStartingPoint.y);
+ BRect buttonRect(aStartingPoint, rightBottom);
+ BMessage * message = new BMessage(INPUT_BUTTON_CLICKED);
+ message->AddString("name", buttonName.c_str());
+ message->AddString("value", buttonLabel.c_str());
+ mButton =
+ new BButton(
+ buttonRect,
+ "ThemisButton",
+ buttonLabel.c_str(),
+ message);
+ mButton->ResizeToPreferred();
+ mRect = mButton->Frame();
+ mEndPoint = mRect.RightTop();
+ mBaseView->AddChild(mButton);
+ }
+
+}
+
+void ButtonInputDisplayView :: AttachedToWindow() {
+
+ CSSView::AttachedToWindow();
+ mButton->SetTarget(mForm);
+
+}
Added: trunk/themis/modules/CSSRenderer/ButtonInputDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/ButtonInputDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/ButtonInputDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -0,0 +1,97 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: March 24, 2012
+*/
+
+/* ButtonInputDisplayView
+ Renders button input elements
+
+ Mark Hellegers (ma...@fi...)
+ 24-03-2012
+
+*/
+
+#ifndef BUTTONINPUTDISPLAYVIEW_HPP
+#define BUTTONINPUTDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "CSSView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+class BButton;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+class ButtonInputDisplayView : public CSSView {
+
+ private:
+ BButton * mButton;
+
+ public:
+ ButtonInputDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
+ ~ButtonInputDisplayView();
+ virtual void Layout(
+ BRect aRect,
+ BPoint aStartingPoint);
+ virtual void AttachedToWindow();
+};
+
+#endif
Modified: trunk/themis/modules/CSSRenderer/CSSRendererView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSRendererView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/CSSRendererView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -188,6 +188,7 @@
Window()->SetTitle(title.c_str());
SetViewColor(B_TRANSPARENT_COLOR);
if (mView) {
+ mView->AttachedToWindow();
mView->RetrieveResources();
}
Modified: trunk/themis/modules/CSSRenderer/CSSView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -71,6 +71,10 @@
#include "TableRowDisplayView.hpp"
#include "TableCellDisplayView.hpp"
#include "NoneDisplayView.hpp"
+#include "ButtonInputDisplayView.hpp"
+#include "TextInputDisplayView.hpp"
+#include "FormDisplayView.hpp"
+#include "HiddenInputDisplayView.hpp"
// Constants used
const char cSpace = ' ';
@@ -84,7 +88,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace)
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
: BHandler("CSSView") {
mBaseView = aBaseView;
@@ -107,219 +112,24 @@
mRequestedWidth = -1;
mRequestedHeight = -1;
mWhiteSpace = aWhiteSpace;
-
- if (mNode->hasChildNodes()) {
- TNodeListPtr children = mNode->getChildNodes();
- unsigned int length = children->getLength();
- if ((mNode->getNodeType() == ELEMENT_NODE) &&
- (mNode->getNodeName() == "TITLE") &&
- (length > 0)) {
- printf("Found TITLE node\n");
- TNodePtr textChild = children->item(0);
- TDOMString titleText = textChild->getNodeValue();
- TDOMString strippedTitle = "";
- unsigned int titleLength = titleText.size();
- for (unsigned int i = 0; i < titleLength; i++) {
- if (!iscntrl(titleText[i])) {
- strippedTitle += titleText[i];
- }
+ mForm = aForm;
+
+ if (mNode->getNodeType() == ELEMENT_NODE) {
+ TElementPtr element = shared_static_cast<TElement>(mNode);
+ if (mName == "A") {
+ // Only A can have a href for a hyperlink, so it is hardcoded here.
+ if (element->hasAttribute("HREF")) {
+ mHref = element->getAttribute("HREF");
+ mClickable = true;
}
- if (strippedTitle != "") {
- printf("Setting title of window to: %s\n", strippedTitle.c_str());
- aBaseView->SetTitle(strippedTitle);
- }
}
- else if (mNode->getNodeType() == ELEMENT_NODE) {
- TElementPtr element = shared_static_cast<TElement>(mNode);
- if (mName == "A") {
- // Only A can have a href for a hyperlink, so it is hardcoded here.
- if (element->hasAttribute("HREF")) {
- mHref = element->getAttribute("HREF");
- mClickable = true;
- }
+ else if (mName == "IMG") {
+ // Images have the image source in the src attribute.
+ if (element->hasAttribute("SRC")) {
+ mHref = element->getAttribute("SRC");
}
- ApplyStyle(element, aStyle);
}
-
- for (unsigned int i = 0; i < length; i++) {
- TNodePtr child = children->item(i);
- if (child->getNodeType() == ELEMENT_NODE) {
- CSSView * childView = NULL;
- TElementPtr element = shared_static_cast<TElement>(child);
- CSSStyleDeclarationPtr style = mStyleSheets->getComputedStyle(element);
- if (style.get()) {
- CSSValuePtr value = style->getPropertyCSSValue("display");
- // Default to inline in case it doesn't exist.
- TDOMString valueString = "inline";
- if (value.get()) {
- CSSPrimitiveValuePtr primitiveValue = shared_static_cast<CSSPrimitiveValue>(value);
- valueString = primitiveValue->getStringValue();
- }
- // printf("Display property value: %s\n", valueString.c_str());
- if (valueString == "inline") {
- childView = new InlineDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else if (valueString == "block") {
- childView = new BlockDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else if (valueString == "table") {
- childView = new TableDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else if (valueString == "table-row-group") {
- childView = new TableRowGroupDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else if (valueString == "table-header-group") {
- childView = new TableHeaderGroupDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else if (valueString == "table-footer-group") {
- childView = new TableFooterGroupDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else if (valueString == "table-row") {
- childView = new TableRowDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else if (valueString == "table-cell") {
- childView = new TableCellDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else if (valueString == "none") {
- childView = new NoneDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else {
- // The default is an inline element
- printf("Currently unsupported display type: %s. Defaulting to inline...\n", valueString.c_str());
- childView = new InlineDisplayView(aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- }
- else {
- printf("No style specified for %s. Defaulting to inline...\n", element->getTagName().c_str());
- childView = new InlineDisplayView(aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- mChildren.push_back(childView);
- }
- else if (child->getNodeType() == TEXT_NODE) {
- // Quick fix. Take a look at what would be elegant.
- CSSStyleDeclarationPtr style;
- CSSView * childView = new CSSView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- mChildren.push_back(childView);
- }
- }
+ ApplyStyle(element, aStyle);
}
else if (mNode->getNodeType() == TEXT_NODE) {
if (mFont == NULL) {
@@ -335,16 +145,7 @@
mDisplay = true;
SplitText();
}
- else if (mNode->getNodeType() == ELEMENT_NODE) {
- TElementPtr element = shared_static_cast<TElement>(mNode);
- if (mName == "IMG") {
- // Images have the image source in the src attribute.
- if (element->hasAttribute("SRC")) {
- mHref = element->getAttribute("SRC");
- }
- }
- }
-
+
}
CSSView :: ~CSSView() {
@@ -364,12 +165,14 @@
void CSSView :: RetrieveLink(bool aVisible) {
+ // FIXME. Look at http://en.wikipedia.org/wiki/URI_scheme for the general syntax.
+ // This is not taken into account with the code below.
if (mHref.size() > 0) {
// Send a message to the window.
// The window will do all the actual work of requesting a new page.
string urlString = "";
unsigned int position = mHref.find("://");
- if (position == string::npos) {
+ if (position == string::npos || mHref[0] == '/') {
urlString = mBaseView->GetDocumentURI();
if (mHref[0] == '/') {
// Get past the :// in the base uri, so we can find the right /
@@ -403,6 +206,316 @@
}
+void CSSView :: CreateChildren(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL) {
+
+ if (mNode->hasChildNodes()) {
+ TNodeListPtr children = mNode->getChildNodes();
+ unsigned int length = children->getLength();
+
+ if ((mNode->getNodeType() == ELEMENT_NODE) &&
+ (mNode->getNodeName() == "TITLE") &&
+ (length > 0)) {
+ printf("Found TITLE node\n");
+ TNodePtr textChild = children->item(0);
+ TDOMString titleText = textChild->getNodeValue();
+ TDOMString strippedTitle = "";
+ unsigned int titleLength = titleText.size();
+ for (unsigned int i = 0; i < titleLength; i++) {
+ if (!iscntrl(titleText[i])) {
+ strippedTitle += titleText[i];
+ }
+ }
+ if (strippedTitle != "") {
+ printf("Setting title of window to: %s\n", strippedTitle.c_str());
+ aBaseView->SetTitle(strippedTitle);
+ }
+ }
+
+ for (unsigned int i = 0; i < length; i++) {
+ TNodePtr child = children->item(i);
+ if (child->getNodeType() == ELEMENT_NODE) {
+ CSSView * childView = NULL;
+ TElementPtr element = shared_static_cast<TElement>(child);
+ CSSStyleDeclarationPtr style = mStyleSheets->getComputedStyle(element);
+ if (child->getNodeName() == "INPUT") {
+ if (element->hasAttribute("TYPE")) {
+ string inputType = element->getAttribute("TYPE");
+ if (inputType == "text" || inputType == "") {
+ childView = new TextInputDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (inputType == "submit") {
+ childView = new ButtonInputDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (inputType == "hidden") {
+ childView = new HiddenInputDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ }
+ else {
+ // Default is text
+ childView = new TextInputDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ }
+ else if (child->getNodeName() == "FORM") {
+ childView = new FormDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ NULL);
+ }
+ if (childView == NULL) {
+ // No input element found.
+ if (style.get()) {
+ CSSValuePtr value = style->getPropertyCSSValue("display");
+ // Default to inline in case it doesn't exist.
+ TDOMString valueString = "inline";
+ if (value.get()) {
+ CSSPrimitiveValuePtr primitiveValue = shared_static_cast<CSSPrimitiveValue>(value);
+ valueString = primitiveValue->getStringValue();
+ }
+ // printf("Display property value: %s\n", valueString.c_str());
+ if (valueString == "inline") {
+ childView = new InlineDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (valueString == "block") {
+ childView = new BlockDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (valueString == "table") {
+ childView = new TableDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (valueString == "table-row-group") {
+ childView = new TableRowGroupDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (valueString == "table-header-group") {
+ childView = new TableHeaderGroupDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (valueString == "table-footer-group") {
+ childView = new TableFooterGroupDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (valueString == "table-row") {
+ childView = new TableRowDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (valueString == "table-cell") {
+ childView = new TableCellDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (valueString == "none") {
+ childView = new NoneDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else {
+ // The default is an inline element
+ printf("Currently unsupported display type: %s. Defaulting to inline...\n", valueString.c_str());
+ childView = new InlineDisplayView(aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ }
+ else {
+ printf("No style specified for %s. Defaulting to inline...\n", element->getTagName().c_str());
+ childView = new InlineDisplayView(aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ }
+ mChildren.push_back(childView);
+ }
+ else if (child->getNodeType() == TEXT_NODE) {
+ // Quick fix. Take a look at what would be elegant.
+ CSSStyleDeclarationPtr style;
+ CSSView * childView = new CSSView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ mChildren.push_back(childView);
+ }
+ }
+ }
+
+}
+
void CSSView :: ApplyStyle(const TElementPtr aElement,
const CSSStyleDeclarationPtr aStyle) {
@@ -655,8 +768,9 @@
}
-void CSSView :: Layout(BRect aRect,
- BPoint aStartingPoint) {
+void CSSView :: Layout(
+ BRect aRect,
+ BPoint aStartingPoint) {
// printf("Doing layout for %s\n", mName.c_str());
mRects.clear();
@@ -870,6 +984,21 @@
}
+void CSSView :: AttachedToWindow() {
+
+ if (!Looper()) {
+ mBaseView->Window()->LockLooper();
+ mBaseView->Window()->AddHandler(this);
+ mBaseView->Window()->UnlockLooper();
+ }
+
+ unsigned int length = mChildren.size();
+ for (unsigned int i = 0; i < length; i++) {
+ mChildren[i]->AttachedToWindow();
+ }
+
+}
+
void CSSView :: SplitText() {
TDOMString text = mNode->getNodeValue();
@@ -942,7 +1071,7 @@
}
void CSSView :: RetrieveResources() {
-
+
// printf("Retrieving resources in %s with href %s\n", mName.c_str(), mHref.c_str());
if (mHref != "" && !mClickable) {
// Some resource that must be loaded.
Modified: trunk/themis/modules/CSSRenderer/CSSView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/CSSView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -78,17 +78,12 @@
class CSSView : public BHandler {
private:
- TNodePtr mNode;
CSSStyleContainer * mStyleSheets;
- CSSRendererView * mBaseView;
vector<TextBox> mTextBoxes;
float mLineHeight;
float mBottomMargin;
float mSpaceWidth;
- BFont * mFont;
- bool mInheritedFont;
bool mClickable;
- string mHref;
string mName;
rgb_color mColor;
string mBorderStyle;
@@ -96,9 +91,11 @@
int32 mUrlId;
WhiteSpaceType mWhiteSpace;
- void RetrieveLink(bool aVisible = true);
-
protected:
+ TNodePtr mNode;
+ CSSRendererView * mBaseView;
+ BFont * mFont;
+ bool mInheritedFont;
vector<CSSView *> mChildren;
vector<BRect> mRects;
BRect mRect;
@@ -113,7 +110,22 @@
bool mBlock;
float mRequestedWidth;
float mRequestedHeight;
+ string mHref;
+ BHandler * mForm;
+ void RetrieveLink(bool aVisible = true);
+ void CreateChildren(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
void ApplyStyle(const TElementPtr aElement,
const CSSStyleDeclarationPtr aStyle);
@@ -127,7 +139,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~CSSView();
virtual void MouseDown(BPoint aPoint);
void Draw();
@@ -137,8 +150,10 @@
bool IsClickable();
BRect Bounds();
BPoint GetEndPoint();
- virtual void Layout(BRect aRect,
- BPoint aStartingPoint);
+ virtual void Layout(
+ BRect aRect,
+ BPoint aStartingPoint);
+ virtual void AttachedToWindow();
void SplitText();
void RetrieveResources();
void SetWidth(float aWidth);
Added: trunk/themis/modules/CSSRenderer/FormDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/FormDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/FormDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -0,0 +1,151 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: March 25, 2012
+*/
+
+/* FormDisplayView implementation
+ See FormDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// BeOS headers
+#include <Message.h>
+#include <String.h>
+
+// DOM headers
+#include "TNode.h"
+#include "TElement.h"
+
+// CSS Renderer headers
+#include "FormDisplayView.hpp"
+#include "CSSRendererView.hpp"
+#include "InputDisplayView.hpp"
+
+FormDisplayView :: FormDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
+ : CSSView(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ this) {
+
+ mDisplay = true;
+ mBlock = false;
+
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
+}
+
+FormDisplayView :: ~FormDisplayView() {
+
+}
+
+void FormDisplayView :: MessageReceived(BMessage * aMessage) {
+
+ switch(aMessage->what) {
+ case INPUT_BUTTON_CLICKED: {
+ aMessage->PrintToStream();
+ BString formAction = "";
+ TElementPtr element = shared_static_cast<TElement>(mNode);
+ if (element->hasAttribute("ACTION")) {
+ formAction = element->getAttribute("ACTION").c_str();
+ BString name = "";
+ BString value = "";
+ aMessage->FindString("name", &name);
+ aMessage->FindString("value", &value);
+ name.ReplaceAll(" ", "+");
+ value.ReplaceAll(" ", "+");
+ formAction += "?";
+ formAction += name;
+ formAction += "=";
+ formAction += value;
+ unsigned int length = mInputChildren.size();
+ for (unsigned int i = 0; i < length; i++) {
+ formAction += "&";
+ formAction += mInputChildren[i]->GetName().c_str();
+ formAction += "=";
+ formAction += mInputChildren[i]->GetValue().c_str();
+ }
+ printf("URL: %s\n", formAction.String());
+ mHref = formAction.String();
+ RetrieveLink();
+
+ }
+ break;
+ }
+ default: {
+ CSSView::MessageReceived(aMessage);
+ }
+ }
+
+}
+
+void FormDisplayView :: Layout(
+ BRect aRect,
+ BPoint aStartingPoint) {
+
+ CSSView::Layout(aRect, aStartingPoint);
+
+}
+
+void FormDisplayView :: AddInputChild(InputDisplayView * aView) {
+
+ mInputChildren.push_back(aView);
+
+}
Added: trunk/themis/modules/CSSRenderer/FormDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/FormDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/FormDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -0,0 +1,102 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: March 25, 2012
+*/
+
+/* ButtonDisplayView
+ Renders button elements
+
+ Mark Hellegers (ma...@fi...)
+ 25-03-2012
+
+*/
+
+#ifndef FORMDISPLAYVIEW_HPP
+#define FORMDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "CSSView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+class InputDisplayView;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+// Constants used
+#define INPUT_BUTTON_CLICKED 'ibcl'
+
+class FormDisplayView : public CSSView {
+
+ private:
+ vector<InputDisplayView *> mInputChildren;
+
+ public:
+ FormDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
+ ~FormDisplayView();
+ virtual void MessageReceived(BMessage * aMessage);
+
+ virtual void Layout(
+ BRect aRect,
+ BPoint aStartingPoint);
+ void AddInputChild(InputDisplayView * aView);
+};
+
+#endif
Added: trunk/themis/modules/CSSRenderer/HiddenInputDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/HiddenInputDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/HiddenInputDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -0,0 +1,124 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: March 27, 2012
+*/
+
+/* InputDisplayView implementation
+ See InputDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// DOM headers
+#include "TNode.h"
+#include "TElement.h"
+
+// CSS Renderer headers
+#include "HiddenInputDisplayView.hpp"
+#include "CSSRendererView.hpp"
+#include "FormDisplayView.hpp"
+
+HiddenInputDisplayView :: HiddenInputDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
+ : InputDisplayView(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm) {
+
+ mDisplay = false;
+ mBlock = false;
+
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
+ if (aForm) {
+ FormDisplayView * formView = dynamic_cast<FormDisplayView *> (aForm);
+ formView->AddInputChild(this);
+ }
+
+ TElementPtr element = shared_static_cast<TElement>(mNode);
+ if (element->hasAttribute("NAME")) {
+ mInputName = element->getAttribute("NAME");
+ }
+
+}
+
+HiddenInputDisplayView :: ~HiddenInputDisplayView() {
+
+}
+
+void HiddenInputDisplayView :: Layout(
+ BRect aRect,
+ BPoint aStartingPoint) {
+
+ CSSView::Layout(aRect, aStartingPoint);
+
+}
+
+string HiddenInputDisplayView :: GetValue() const {
+
+ string result = "";
+
+ TElementPtr element = shared_static_cast<TElement>(mNode);
+ if (element->hasAttribute("VALUE")) {
+ result = element->getAttribute("VALUE");
+ }
+
+ return result;
+
+}
Added: trunk/themis/modules/CSSRenderer/HiddenInputDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/HiddenInputDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/HiddenInputDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -0,0 +1,94 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: March 27, 2012
+*/
+
+/* HiddenInputDisplayView
+ Renders hidden input elements
+
+ Mark Hellegers (ma...@fi...)
+ 27-03-2012
+
+*/
+
+#ifndef HIDDENINPUTDISPLAYVIEW_HPP
+#define HIDDENINPUTDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "InputDisplayView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+class BTextControl;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+class HiddenInputDisplayView : public InputDisplayView {
+
+ public:
+ HiddenInputDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
+ ~HiddenInputDisplayView();
+ virtual void Layout(
+ BRect aRect,
+ BPoint aStartingPoint);
+ virtual string GetValue() const;
+};
+
+#endif
Modified: trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -48,7 +48,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace = NORMAL)
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm)
: CSSView(aBaseView,
aNode,
aStyleSheets,
@@ -58,11 +59,25 @@
aUrlId,
aColor,
aFont,
- aWhiteSpace) {
+ aWhiteSpace,
+ aForm) {
mDisplay = true;
mBlock = false;
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
}
InlineDisplayView :: ~InlineDisplayView() {
Modified: trunk/themis/modules/CSSRenderer/InlineDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/InlineDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/InlineDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -80,7 +80,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~InlineDisplayView();
virtual void Layout(BRect aRect,
BPoint aStartingPoint);
Added: trunk/themis/modules/CSSRenderer/InputDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/InputDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/InputDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -0,0 +1,97 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: March 27, 2012
+*/
+
+/* InputDisplayView implementation
+ See InputDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// DOM headers
+#include "TNode.h"
+#include "TElement.h"
+
+// CSS Renderer headers
+#include "InputDisplayView.hpp"
+#include "CSSRendererView.hpp"
+#include "FormDisplayView.hpp"
+
+InputDisplayView :: InputDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
+ : CSSView(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm) {
+
+}
+
+InputDisplayView :: ~InputDisplayView() {
+
+}
+
+void InputDisplayView :: Layout(
+ BRect aRect,
+ BPoint aStartingPoint) {
+
+ CSSView::Layout(aRect, aStartingPoint);
+
+}
+
+string InputDisplayView :: GetName() const {
+
+ return mInputName;
+
+}
+
+string InputDisplayView :: GetValue() const {
+
+ return "";
+
+}
Added: trunk/themis/modules/CSSRenderer/InputDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/InputDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/InputDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -0,0 +1,98 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: March 27, 2012
+*/
+
+/* InputDisplayView
+ Base class for input elements
+
+ Mark Hellegers (ma...@fi...)
+ 27-03-2012
+
+*/
+
+#ifndef INPUTDISPLAYVIEW_HPP
+#define INPUTDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "CSSView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+class BTextControl;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+class InputDisplayView : public CSSView {
+
+ protected:
+ string mInputName;
+
+ public:
+ InputDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
+ ~InputDisplayView();
+ virtual void Layout(
+ BRect aRect,
+ BPoint aStartingPoint);
+ string GetName() const;
+ virtual string GetValue() const;
+};
+
+#endif
Modified: trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -48,7 +48,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace)
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
: CSSView(aBaseView,
aNode,
aStyleSheets,
@@ -58,11 +59,25 @@
aUrlId,
aColor,
aFont,
- aWhiteSpace) {
+ aWhiteSpace,
+ aForm) {
mDisplay = false;
mBlock = false;
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
}
NoneDisplayView :: ~NoneDisplayView() {
Modified: trunk/themis/modules/CSSRenderer/NoneDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/NoneDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/NoneDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -80,7 +80,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~NoneDisplayView();
virtual void Layout(BRect aRect,
BPoint aStartingPoint);
Modified: trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -48,7 +48,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace)
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
: CSSView(aBaseView,
aNode,
aStyleSheets,
@@ -58,12 +59,26 @@
aUrlId,
aColor,
aFont,
- aWhiteSpace) {
+ aWhiteSpace,
+ aForm) {
mDisplay = true;
mBlock = false;
mRequestedWidth = -1;
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
}
TableCellDisplayView :: ~TableCellDisplayView() {
Modified: trunk/themis/modules/CSSRenderer/TableCellDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableCellDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableCellDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -80,7 +80,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~TableCellDisplayView();
virtual void Layout(BRect aRect,
BPoint aStartingPoint);
Modified: trunk/themis/modules/CSSRenderer/TableDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -49,7 +49,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace)
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
: CSSView(aBaseView,
aNode,
aStyleSheets,
@@ -59,11 +60,25 @@
aUrlId,
aColor,
aFont,
- aWhiteSpace) {
+ aWhiteSpace,
+ aForm) {
mDisplay = true;
mBlock = true;
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
}
TableDisplayView :: ~TableDisplayView() {
Modified: trunk/themis/modules/CSSRenderer/TableDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -85,7 +85,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~TableDisplayView();
virtual void Layout(
BRect aRect,
Modified: trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -49,7 +49,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace)
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
: TableGroupDisplayView(
aBaseView,
aNode,
@@ -60,11 +61,25 @@
aUrlId,
aColor,
aFont,
- aWhiteSpace) {
+ aWhiteSpace,
+ aForm) {
mDisplay = true;
mBlock = false;
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
}
TableFooterGroupDisplayView :: ~TableFooterGroupDisplayView() {
Modified: trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -81,7 +81,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~TableFooterGroupDisplayView();
virtual void Layout(
BRect aRect,
Modified: trunk/themis/modules/CSSRenderer/TableGroupDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableGroupDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableGroupDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -49,7 +49,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace)
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
: CSSView(
aBaseView,
aNode,
@@ -60,7 +61,8 @@
aUrlId,
aColor,
aFont,
- aWhiteSpace) {
+ aWhiteSpace,
+ aForm) {
mDisplay = true;
mBlock = false;
Modified: trunk/themis/modules/CSSRenderer/TableGroupDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableGroupDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableGroupDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -84,7 +84,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~TableGroupDisplayView();
virtual void Layout(
BRect aRect,
Modified: trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -49,7 +49,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace)
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
: TableGroupDisplayView(
aBaseView,
aNode,
@@ -60,11 +61,25 @@
aUrlId,
aColor,
aFont,
- aWhiteSpace) {
+ aWhiteSpace,
+ aForm) {
mDisplay = true;
mBlock = false;
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
}
TableHeaderGroupDisplayView :: ~TableHeaderGroupDisplayView() {
Modified: trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -81,7 +81,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~TableHeaderGroupDisplayView();
virtual void Layout(
BRect aRect,
Modified: trunk/themis/modules/CSSRenderer/Ta...
[truncated message content] |
|
From: CVS C. to T. <the...@li...> - 2012-03-24 17:44:17
|
Revision: 690
http://themis.svn.sourceforge.net/themis/?rev=690&view=rev
Author: mark_hellegers
Date: 2012-03-24 17:44:10 +0000 (Sat, 24 Mar 2012)
Log Message:
-----------
Added white-space:pre support and enabled it for PRE elements.
I've seen some small bugs with it that I still need to look into, but overall it works quite well.
Modified Paths:
--------------
trunk/themis/modules/CSSParser/html4.css
trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp
trunk/themis/modules/CSSRenderer/BlockDisplayView.hpp
trunk/themis/modules/CSSRenderer/CSSView.cpp
trunk/themis/modules/CSSRenderer/CSSView.hpp
trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp
trunk/themis/modules/CSSRenderer/InlineDisplayView.hpp
trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp
trunk/themis/modules/CSSRenderer/NoneDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableCellDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableGroupDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableGroupDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableRowDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.hpp
trunk/themis/modules/CSSRenderer/TextBox.cpp
trunk/themis/modules/CSSRenderer/TextBox.hpp
Modified: trunk/themis/modules/CSSParser/html4.css
===================================================================
--- trunk/themis/modules/CSSParser/html4.css 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSParser/html4.css 2012-03-24 17:44:10 UTC (rev 690)
@@ -26,7 +26,8 @@
TT { display: inline;
font-family: monospace}
PRE { display: inline;
- font-family: monospace}
+ font-family: monospace;
+ white-space: pre}
SCRIPT { display: none }
NOSCRIPT { display: none }
STYLE { display: none }
Modified: trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -47,7 +47,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont)
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace)
: CSSView(aBaseView,
aNode,
aStyleSheets,
@@ -56,7 +57,8 @@
aSiteId,
aUrlId,
aColor,
- aFont) {
+ aFont,
+ aWhiteSpace) {
mDisplay = true;
mBlock = true;
Modified: trunk/themis/modules/CSSRenderer/BlockDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/BlockDisplayView.hpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/BlockDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -79,7 +79,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont = NULL);
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL);
~BlockDisplayView();
virtual void Layout(BRect aRect,
BPoint aStartingPoint);
Modified: trunk/themis/modules/CSSRenderer/CSSView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -83,7 +83,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont)
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace)
: BHandler("CSSView") {
mBaseView = aBaseView;
@@ -105,6 +106,7 @@
mName = mNode->getNodeName();
mRequestedWidth = -1;
mRequestedHeight = -1;
+ mWhiteSpace = aWhiteSpace;
if (mNode->hasChildNodes()) {
TNodeListPtr children = mNode->getChildNodes();
@@ -155,15 +157,17 @@
}
// printf("Display property value: %s\n", valueString.c_str());
if (valueString == "inline") {
- childView = new InlineDisplayView(aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont);
+ childView = new InlineDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace);
}
else if (valueString == "block") {
childView = new BlockDisplayView(
@@ -175,18 +179,21 @@
mSiteId,
mUrlId,
mColor,
- mFont);
+ mFont,
+ mWhiteSpace);
}
else if (valueString == "table") {
- childView = new TableDisplayView(aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont);
+ childView = new TableDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace);
}
else if (valueString == "table-row-group") {
childView = new TableRowGroupDisplayView(
@@ -198,7 +205,8 @@
mSiteId,
mUrlId,
mColor,
- mFont);
+ mFont,
+ mWhiteSpace);
}
else if (valueString == "table-header-group") {
childView = new TableHeaderGroupDisplayView(
@@ -210,7 +218,8 @@
mSiteId,
mUrlId,
mColor,
- mFont);
+ mFont,
+ mWhiteSpace);
}
else if (valueString == "table-footer-group") {
childView = new TableFooterGroupDisplayView(
@@ -222,40 +231,47 @@
mSiteId,
mUrlId,
mColor,
- mFont);
+ mFont,
+ mWhiteSpace);
}
else if (valueString == "table-row") {
- childView = new TableRowDisplayView(aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont);
+ childView = new TableRowDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace);
}
else if (valueString == "table-cell") {
- childView = new TableCellDisplayView(aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont);
+ childView = new TableCellDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace);
}
else if (valueString == "none") {
- childView = new NoneDisplayView(aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont);
+ childView = new NoneDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace);
}
else {
// The default is an inline element
@@ -268,7 +284,8 @@
mSiteId,
mUrlId,
mColor,
- mFont);
+ mFont,
+ mWhiteSpace);
}
}
else {
@@ -281,22 +298,25 @@
mSiteId,
mUrlId,
mColor,
- mFont);
+ mFont,
+ mWhiteSpace);
}
mChildren.push_back(childView);
}
else if (child->getNodeType() == TEXT_NODE) {
// Quick fix. Take a look at what would be elegant.
CSSStyleDeclarationPtr style;
- CSSView * childView = new CSSView(aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont);
+ CSSView * childView = new CSSView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace);
mChildren.push_back(childView);
}
}
@@ -509,6 +529,15 @@
}
}
}
+ else if (propertyName == "white-space") {
+ CSSPrimitiveValuePtr primitiveValue = shared_static_cast<CSSPrimitiveValue>(value);
+ if (primitiveValue.get()) {
+ TDOMString valueString = primitiveValue->getStringValue();
+ if (valueString == "pre") {
+ mWhiteSpace = PRE;
+ }
+ }
+ }
}
}
}
@@ -552,11 +581,14 @@
unsigned int start = 0;
unsigned int end = 0;
box.getRange(start, end);
- BRect rect = box.getRect();
- //printf("Drawing string: %s for %u at %f and %f\n", (text.c_str()) + start, end - start + 1, rect.left, rect.top + mLineHeight - mBottomMargin);
- drawPoint.Set(rect.left, rect.top + mLineHeight - mBottomMargin);
- mBaseView->SetFont(mFont);
- mBaseView->DrawString((text.c_str()) + start, end - start + 1, drawPoint);
+ // Draw the string, but only when there is something to draw.
+ if (!box.emptyBox()) {
+ BRect rect = box.getRect();
+ //printf("Drawing string: %s for %u at %f and %f\n", (text.c_str()) + start, end - start + 1, rect.left, rect.top + mLineHeight - mBottomMargin);
+ drawPoint.Set(rect.left, rect.top + mLineHeight - mBottomMargin);
+ mBaseView->SetFont(mFont);
+ mBaseView->DrawString((text.c_str()) + start, end - start + 1, drawPoint);
+ }
}
}
else if (mListStyleType == "square") {
@@ -688,7 +720,7 @@
boxWidth += mSpaceWidth;
}
//printf("Linewidth: %f, boxwidth: %f, viewWidth: %f\n", lineWidth, boxWidth, viewWidth);
- if (lineWidth + boxWidth > viewWidth) {
+ if ((lineWidth + boxWidth > viewWidth) || mWhiteSpace == PRE) {
// TextBox doesn't fit on the current line.
// Store the current container rect if needed
if (containerRect.right != containerRect.left) {
@@ -840,42 +872,71 @@
void CSSView :: SplitText() {
- // Split the text into words
TDOMString text = mNode->getNodeValue();
const char * textPointer = text.c_str();
unsigned int length = text.size();
unsigned int start = 0;
unsigned int end = 0;
bool textFound = false;
- bool spaceFound = false;
char c = '\0';
float pixelWidth = 0;
- for (unsigned int i = 0; i < length; i++) {
- c = text[i];
- if ((isspace(c) || iscntrl(c))) {
- if (textFound) {
+
+ if (mWhiteSpace == PRE) {
+ // Only split the text at a linebreak
+ for (unsigned int i = 0; i < length; i++) {
+ c = text[i];
+ if (c == '\n') {
pixelWidth = mFont->StringWidth(textPointer + start, end - start + 1);
- TextBox box = TextBox(start, end, pixelWidth, spaceFound, true);
+ TextBox box = TextBox(start, end, pixelWidth, false, false, !textFound);
mTextBoxes.push_back(box);
textFound = false;
+ start = i;
}
- spaceFound = true;
- start = i;
- end = i;
+ else {
+ if (!textFound) {
+ start = i;
+ textFound = true;
+ }
+ end = i;
+ }
}
- else {
- if (!textFound) {
+
+ if (textFound) {
+ pixelWidth = mFont->StringWidth(textPointer + start, end - start + 1);
+ TextBox box = TextBox(start, end, pixelWidth, false, false);
+ mTextBoxes.push_back(box);
+ }
+ }
+ else {
+ // Split the text into words
+ bool spaceFound = false;
+ for (unsigned int i = 0; i < length; i++) {
+ c = text[i];
+ if ((isspace(c) || iscntrl(c))) {
+ if (textFound) {
+ pixelWidth = mFont->StringWidth(textPointer + start, end - start + 1);
+ TextBox box = TextBox(start, end, pixelWidth, spaceFound, true);
+ mTextBoxes.push_back(box);
+ textFound = false;
+ }
+ spaceFound = true;
start = i;
- textFound = true;
+ end = i;
}
- end = i;
+ else {
+ if (!textFound) {
+ start = i;
+ textFound = true;
+ }
+ end = i;
+ }
}
- }
- if (textFound) {
- pixelWidth = mFont->StringWidth(textPointer + start, end - start + 1);
- TextBox box = TextBox(start, end, pixelWidth, spaceFound);
- mTextBoxes.push_back(box);
+ if (textFound) {
+ pixelWidth = mFont->StringWidth(textPointer + start, end - start + 1);
+ TextBox box = TextBox(start, end, pixelWidth, spaceFound);
+ mTextBoxes.push_back(box);
+ }
}
}
Modified: trunk/themis/modules/CSSRenderer/CSSView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.hpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/CSSView.hpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -68,6 +68,13 @@
using std::vector;
using std::string;
+enum WhiteSpaceType {
+ NORMAL = 1,
+ PRE,
+ NOWRAP,
+ INHERIT
+};
+
class CSSView : public BHandler {
private:
@@ -87,6 +94,7 @@
string mBorderStyle;
int32 mSiteId;
int32 mUrlId;
+ WhiteSpaceType mWhiteSpace;
void RetrieveLink(bool aVisible = true);
@@ -118,7 +126,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont = NULL);
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL);
~CSSView();
virtual void MouseDown(BPoint aPoint);
void Draw();
Modified: trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -47,7 +47,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont)
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace = NORMAL)
: CSSView(aBaseView,
aNode,
aStyleSheets,
@@ -56,7 +57,8 @@
aSiteId,
aUrlId,
aColor,
- aFont) {
+ aFont,
+ aWhiteSpace) {
mDisplay = true;
mBlock = false;
Modified: trunk/themis/modules/CSSRenderer/InlineDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/InlineDisplayView.hpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/InlineDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -79,7 +79,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont = NULL);
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL);
~InlineDisplayView();
virtual void Layout(BRect aRect,
BPoint aStartingPoint);
Modified: trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -47,7 +47,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont)
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace)
: CSSView(aBaseView,
aNode,
aStyleSheets,
@@ -56,7 +57,8 @@
aSiteId,
aUrlId,
aColor,
- aFont) {
+ aFont,
+ aWhiteSpace) {
mDisplay = false;
mBlock = false;
Modified: trunk/themis/modules/CSSRenderer/NoneDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/NoneDisplayView.hpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/NoneDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -79,7 +79,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont = NULL);
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL);
~NoneDisplayView();
virtual void Layout(BRect aRect,
BPoint aStartingPoint);
Modified: trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -47,7 +47,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont)
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace)
: CSSView(aBaseView,
aNode,
aStyleSheets,
@@ -56,7 +57,8 @@
aSiteId,
aUrlId,
aColor,
- aFont) {
+ aFont,
+ aWhiteSpace) {
mDisplay = true;
mBlock = false;
Modified: trunk/themis/modules/CSSRenderer/TableCellDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableCellDisplayView.hpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/TableCellDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -79,7 +79,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont = NULL);
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL);
~TableCellDisplayView();
virtual void Layout(BRect aRect,
BPoint aStartingPoint);
Modified: trunk/themis/modules/CSSRenderer/TableDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableDisplayView.cpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/TableDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -48,7 +48,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont)
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace)
: CSSView(aBaseView,
aNode,
aStyleSheets,
@@ -57,7 +58,8 @@
aSiteId,
aUrlId,
aColor,
- aFont) {
+ aFont,
+ aWhiteSpace) {
mDisplay = true;
mBlock = true;
Modified: trunk/themis/modules/CSSRenderer/TableDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableDisplayView.hpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/TableDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -84,7 +84,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont = NULL);
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL);
~TableDisplayView();
virtual void Layout(
BRect aRect,
Modified: trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.cpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -48,7 +48,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont)
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace)
: TableGroupDisplayView(
aBaseView,
aNode,
@@ -58,7 +59,8 @@
aSiteId,
aUrlId,
aColor,
- aFont) {
+ aFont,
+ aWhiteSpace) {
mDisplay = true;
mBlock = false;
Modified: trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.hpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -80,7 +80,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont = NULL);
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL);
~TableFooterGroupDisplayView();
virtual void Layout(
BRect aRect,
Modified: trunk/themis/modules/CSSRenderer/TableGroupDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableGroupDisplayView.cpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/TableGroupDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -48,7 +48,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont)
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace)
: CSSView(
aBaseView,
aNode,
@@ -58,7 +59,8 @@
aSiteId,
aUrlId,
aColor,
- aFont) {
+ aFont,
+ aWhiteSpace) {
mDisplay = true;
mBlock = false;
Modified: trunk/themis/modules/CSSRenderer/TableGroupDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableGroupDisplayView.hpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/TableGroupDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -83,7 +83,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont = NULL);
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL);
~TableGroupDisplayView();
virtual void Layout(
BRect aRect,
Modified: trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.cpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -48,7 +48,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont)
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace)
: TableGroupDisplayView(
aBaseView,
aNode,
@@ -58,7 +59,8 @@
aSiteId,
aUrlId,
aColor,
- aFont) {
+ aFont,
+ aWhiteSpace) {
mDisplay = true;
mBlock = false;
Modified: trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.hpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -80,7 +80,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont = NULL);
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL);
~TableHeaderGroupDisplayView();
virtual void Layout(
BRect aRect,
Modified: trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -47,7 +47,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont)
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace = NORMAL)
: CSSView(aBaseView,
aNode,
aStyleSheets,
@@ -56,7 +57,8 @@
aSiteId,
aUrlId,
aColor,
- aFont) {
+ aFont,
+ aWhiteSpace) {
mDisplay = true;
mBlock = false;
Modified: trunk/themis/modules/CSSRenderer/TableRowDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableRowDisplayView.hpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/TableRowDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -79,7 +79,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont = NULL);
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL);
~TableRowDisplayView();
virtual void Layout(BRect aRect,
BPoint aStartingPoint);
Modified: trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.cpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -48,7 +48,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont)
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace)
: TableGroupDisplayView(
aBaseView,
aNode,
@@ -58,7 +59,8 @@
aSiteId,
aUrlId,
aColor,
- aFont) {
+ aFont,
+ aWhiteSpace) {
mDisplay = true;
mBlock = false;
Modified: trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.hpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -80,7 +80,8 @@
int32 aSiteId,
int32 aUrlId,
rgb_color aColor,
- BFont * aFont = NULL);
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL);
~TableRowGroupDisplayView();
virtual void Layout(
BRect aRect,
Modified: trunk/themis/modules/CSSRenderer/TextBox.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TextBox.cpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/TextBox.cpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -51,13 +51,15 @@
unsigned int aEnd,
float aPixelWidth,
bool aStartWithSpace,
- bool aEndWithSpace) {
+ bool aEndWithSpace,
+ bool aEmptyBox) {
mStart = aStart;
mEnd = aEnd;
mPixelWidth = aPixelWidth;
mStartWithSpace = aStartWithSpace;
mEndWithSpace = aEndWithSpace;
+ mEmptyBox = aEmptyBox;
}
@@ -101,3 +103,9 @@
return mEndWithSpace;
}
+
+bool TextBox :: emptyBox() const {
+
+ return mEmptyBox;
+
+}
Modified: trunk/themis/modules/CSSRenderer/TextBox.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TextBox.hpp 2012-03-21 21:56:56 UTC (rev 689)
+++ trunk/themis/modules/CSSRenderer/TextBox.hpp 2012-03-24 17:44:10 UTC (rev 690)
@@ -51,6 +51,7 @@
float mPixelWidth;
bool mStartWithSpace;
bool mEndWithSpace;
+ bool mEmptyBox;
public:
TextBox(unsigned int aStart, unsigned int aEnd, BRect aRect);
@@ -58,7 +59,8 @@
unsigned int aEnd,
float aPixelWidth,
bool aStartWithSpace = false,
- bool aEndWithSpace = false);
+ bool aEndWithSpace = false,
+ bool aEmptyBox = false);
~TextBox();
void getRange(unsigned int & aStart, unsigned int & aEnd);
BRect getRect() const;
@@ -66,6 +68,7 @@
float getPixelWidth() const;
bool startsWithSpace() const;
bool endsWithSpace() const;
+ bool emptyBox() const;
};
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-03-21 21:57:02
|
Revision: 689
http://themis.svn.sourceforge.net/themis/?rev=689&view=rev
Author: mark_hellegers
Date: 2012-03-21 21:56:56 +0000 (Wed, 21 Mar 2012)
Log Message:
-----------
- Added support for margin-left.
- Added blockquote styling.
Modified Paths:
--------------
trunk/themis/modules/CSSParser/html4.css
trunk/themis/modules/CSSRenderer/CSSView.cpp
trunk/themis/modules/CSSRenderer/CSSView.hpp
Modified: trunk/themis/modules/CSSParser/html4.css
===================================================================
--- trunk/themis/modules/CSSParser/html4.css 2012-03-21 21:34:13 UTC (rev 688)
+++ trunk/themis/modules/CSSParser/html4.css 2012-03-21 21:56:56 UTC (rev 689)
@@ -36,6 +36,8 @@
HEAD { display: none }
P { display: block;
margin-bottom: 5px }
+BLOCKQUOTE { display: block;
+ margin-left: 10px }
CENTER { display: block }
H1 { display: block;
font-size: 2.5em;
Modified: trunk/themis/modules/CSSRenderer/CSSView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-03-21 21:34:13 UTC (rev 688)
+++ trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-03-21 21:56:56 UTC (rev 689)
@@ -96,6 +96,7 @@
mInheritedFont = true;
mMarginBottom = 0;
mMarginRight = 0;
+ mMarginLeft = 0;
mBorderWidth = 0;
mColor = aColor;
mClickable = false;
@@ -448,6 +449,15 @@
}
}
}
+ else if (propertyName == "margin-left") {
+ CSSPrimitiveValuePtr primitiveValue = shared_static_cast<CSSPrimitiveValue>(value);
+ if (primitiveValue.get()) {
+ if (primitiveValue->getPrimitiveType() == CSSPrimitiveValue::CSS_PX) {
+ float floatValue = primitiveValue->getFloatValue(CSSPrimitiveValue::CSS_PX);
+ mMarginLeft = floatValue;
+ }
+ }
+ }
else if (propertyName == "color") {
CSSPrimitiveValuePtr primitiveValue = shared_static_cast<CSSPrimitiveValue>(value);
if (primitiveValue.get()) {
@@ -620,6 +630,7 @@
mRects.clear();
if (mDisplay) {
mRect = aRect;
+ mRect.left += mMarginLeft;
// Enforce the requested width if set
if (mRequestedWidth > -1) {
mRect.right = mRect.left + mRequestedWidth;
Modified: trunk/themis/modules/CSSRenderer/CSSView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.hpp 2012-03-21 21:34:13 UTC (rev 688)
+++ trunk/themis/modules/CSSRenderer/CSSView.hpp 2012-03-21 21:56:56 UTC (rev 689)
@@ -98,6 +98,7 @@
float mBorderWidth;
float mMarginBottom;
float mMarginRight;
+ float mMarginLeft;
BRect mListStyleRect;
string mListStyleType;
bool mDisplay;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-03-21 21:34:19
|
Revision: 688
http://themis.svn.sourceforge.net/themis/?rev=688&view=rev
Author: mark_hellegers
Date: 2012-03-21 21:34:13 +0000 (Wed, 21 Mar 2012)
Log Message:
-----------
Added support for font-family: monospace (for TT and PRE elements at the moment).
Modified Paths:
--------------
trunk/themis/modules/CSSParser/html4.css
trunk/themis/modules/CSSRenderer/CSSView.cpp
Modified: trunk/themis/modules/CSSParser/html4.css
===================================================================
--- trunk/themis/modules/CSSParser/html4.css 2012-03-17 19:38:23 UTC (rev 687)
+++ trunk/themis/modules/CSSParser/html4.css 2012-03-21 21:34:13 UTC (rev 688)
@@ -20,7 +20,13 @@
SPAN { display: inline }
STRONG { display: inline;
font-weight: bold }
+STRIKE { display: inline}
+S { display: inline}
CODE { display: inline }
+TT { display: inline;
+ font-family: monospace}
+PRE { display: inline;
+ font-family: monospace}
SCRIPT { display: none }
NOSCRIPT { display: none }
STYLE { display: none }
Modified: trunk/themis/modules/CSSRenderer/CSSView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-03-17 19:38:23 UTC (rev 687)
+++ trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-03-21 21:34:13 UTC (rev 688)
@@ -487,6 +487,18 @@
}
}
}
+ else if (propertyName == "font-family") {
+ CSSPrimitiveValuePtr primitiveValue = shared_static_cast<CSSPrimitiveValue>(value);
+ if (primitiveValue.get()) {
+ TDOMString valueString = primitiveValue->getStringValue();
+ if (valueString == "monospace") {
+ if (mFont == NULL) {
+ mFont = new BFont(be_fixed_font);
+ mInheritedFont = false;
+ }
+ }
+ }
+ }
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-03-17 19:38:29
|
Revision: 687
http://themis.svn.sourceforge.net/themis/?rev=687&view=rev
Author: mark_hellegers
Date: 2012-03-17 19:38:23 +0000 (Sat, 17 Mar 2012)
Log Message:
-----------
Set the STRONG element to display in bold.
Modified Paths:
--------------
trunk/themis/modules/CSSParser/html4.css
Modified: trunk/themis/modules/CSSParser/html4.css
===================================================================
--- trunk/themis/modules/CSSParser/html4.css 2012-03-17 18:26:40 UTC (rev 686)
+++ trunk/themis/modules/CSSParser/html4.css 2012-03-17 19:38:23 UTC (rev 687)
@@ -18,7 +18,8 @@
IMG { display: inline }
FONT { display: inline }
SPAN { display: inline }
-STRONG { display: inline }
+STRONG { display: inline;
+ font-weight: bold }
CODE { display: inline }
SCRIPT { display: none }
NOSCRIPT { display: none }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-03-17 18:26:46
|
Revision: 686
http://themis.svn.sourceforge.net/themis/?rev=686&view=rev
Author: mark_hellegers
Date: 2012-03-17 18:26:40 +0000 (Sat, 17 Mar 2012)
Log Message:
-----------
Added timing information to the console output.
Modified Paths:
--------------
trunk/themis/modules/CSSRenderer/CSSRendererView.cpp
Modified: trunk/themis/modules/CSSRenderer/CSSRendererView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSRendererView.cpp 2012-03-17 18:26:00 UTC (rev 685)
+++ trunk/themis/modules/CSSRenderer/CSSRendererView.cpp 2012-03-17 18:26:40 UTC (rev 686)
@@ -64,6 +64,8 @@
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE) {
printf("Creating CSSRendererView\n");
+
+ clock_t start = clock();
mStyleSheets = new CSSStyleContainer();
mStyleSheets->addStyleSheet(aStyleSheet);
mDocument = aDocument;
@@ -142,6 +144,8 @@
else {
mView = NULL;
}
+ clock_t end = clock();
+ printf("Time taken for creating the CSS view: %f\n", (double)(end - start)/CLOCKS_PER_SEC);
}
CSSRendererView :: ~CSSRendererView() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-03-17 18:26:07
|
Revision: 685
http://themis.svn.sourceforge.net/themis/?rev=685&view=rev
Author: mark_hellegers
Date: 2012-03-17 18:26:00 +0000 (Sat, 17 Mar 2012)
Log Message:
-----------
Added some more elements.
Modified Paths:
--------------
trunk/themis/modules/CSSParser/html4.css
Modified: trunk/themis/modules/CSSParser/html4.css
===================================================================
--- trunk/themis/modules/CSSParser/html4.css 2012-02-29 21:28:29 UTC (rev 684)
+++ trunk/themis/modules/CSSParser/html4.css 2012-03-17 18:26:00 UTC (rev 685)
@@ -14,11 +14,14 @@
U { display: inline }
EM { display: inline;
font-style: italic }
+BR { display: inline }
+IMG { display: inline }
FONT { display: inline }
SPAN { display: inline }
STRONG { display: inline }
CODE { display: inline }
SCRIPT { display: none }
+NOSCRIPT { display: none }
STYLE { display: none }
META { display: none }
LINK { display: none }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-02-29 21:28:38
|
Revision: 684
http://themis.svn.sourceforge.net/themis/?rev=684&view=rev
Author: mark_hellegers
Date: 2012-02-29 21:28:29 +0000 (Wed, 29 Feb 2012)
Log Message:
-----------
Made the mimetype comparison case insensitive.
Modified Paths:
--------------
trunk/themis/framework/ThemisTabView.cpp
Modified: trunk/themis/framework/ThemisTabView.cpp
===================================================================
--- trunk/themis/framework/ThemisTabView.cpp 2012-02-29 21:27:56 UTC (rev 683)
+++ trunk/themis/framework/ThemisTabView.cpp 2012-02-29 21:28:29 UTC (rev 684)
@@ -849,7 +849,7 @@
messenger.SendMessage(&message);
}
}
- else if (mimeString == "text/html") {
+ else if (mimeString.ToLower() == "text/html") {
BString filePath = "file://";
filePath += path.Path();
BMessage message(URL_OPEN);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-02-29 21:28:05
|
Revision: 683
http://themis.svn.sourceforge.net/themis/?rev=683&view=rev
Author: mark_hellegers
Date: 2012-02-29 21:27:56 +0000 (Wed, 29 Feb 2012)
Log Message:
-----------
Made the mimetype comparison case insensitive.
Modified Paths:
--------------
trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.cpp
trunk/themis/modules/HTMLParser/HTMLParser.cpp
Modified: trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.cpp 2012-02-28 22:12:26 UTC (rev 682)
+++ trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.cpp 2012-02-29 21:27:56 UTC (rev 683)
@@ -161,7 +161,7 @@
messenger.SendMessage(&message);
}
}
- else if (mimeString == "text/html") {
+ else if (mimeString.ToLower() == "text/html") {
BString filePath = "file://";
filePath += path.Path();
BMessage message(URL_OPEN);
Modified: trunk/themis/modules/HTMLParser/HTMLParser.cpp
===================================================================
--- trunk/themis/modules/HTMLParser/HTMLParser.cpp 2012-02-28 22:12:26 UTC (rev 682)
+++ trunk/themis/modules/HTMLParser/HTMLParser.cpp 2012-02-29 21:27:56 UTC (rev 683)
@@ -4,6 +4,7 @@
// Standard C headers
#include <stdio.h>
+#include <ctype.h>
// Standard C++ headers
#include <fstream>
@@ -192,7 +193,7 @@
mimeTypeFound = false;
}
else {
- mimeTypeString += mimeType[i];
+ mimeTypeString += tolower(mimeType[i]);
}
i++;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-02-28 22:12:32
|
Revision: 682
http://themis.svn.sourceforge.net/themis/?rev=682&view=rev
Author: mark_hellegers
Date: 2012-02-28 22:12:26 +0000 (Tue, 28 Feb 2012)
Log Message:
-----------
Fixed the vertical sizing of table cells relative to each other in a row.
Modified Paths:
--------------
trunk/themis/modules/CSSRenderer/CSSView.cpp
trunk/themis/modules/CSSRenderer/CSSView.hpp
trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp
Modified: trunk/themis/modules/CSSRenderer/CSSView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-02-28 20:12:04 UTC (rev 681)
+++ trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-02-28 22:12:26 UTC (rev 682)
@@ -103,6 +103,7 @@
mListStyleType = "none";
mName = mNode->getNodeName();
mRequestedWidth = -1;
+ mRequestedHeight = -1;
if (mNode->hasChildNodes()) {
TNodeListPtr children = mNode->getChildNodes();
@@ -791,6 +792,11 @@
mRects.push_back(mRect);
// mRect.PrintToStream();
}
+
+ // Enforce the requested height if set
+ if (mRequestedHeight > -1) {
+ mRect.bottom = mRect.top + mRequestedHeight;
+ }
// Add any margins
mEndPoint.Set(mEndPoint.x + mMarginRight, mEndPoint.y + mMarginBottom);
@@ -874,6 +880,12 @@
}
+void CSSView :: SetHeight(float aHeight) {
+
+ mRequestedHeight = aHeight;
+
+}
+
float CSSView :: GetChildWidth(unsigned int aIndex) {
float result = 0;
Modified: trunk/themis/modules/CSSRenderer/CSSView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.hpp 2012-02-28 20:12:04 UTC (rev 681)
+++ trunk/themis/modules/CSSRenderer/CSSView.hpp 2012-02-28 22:12:26 UTC (rev 682)
@@ -103,6 +103,7 @@
bool mDisplay;
bool mBlock;
float mRequestedWidth;
+ float mRequestedHeight;
void ApplyStyle(const TElementPtr aElement,
const CSSStyleDeclarationPtr aStyle);
@@ -130,7 +131,8 @@
BPoint aStartingPoint);
void SplitText();
void RetrieveResources();
- void SetWidth(float aRequestedWidth);
+ void SetWidth(float aWidth);
+ void SetHeight(float aHeight);
float GetChildWidth(unsigned int aIndex);
void SetChildWidth(float aWidth, unsigned int aIndex);
unsigned int GetLength() const;
Modified: trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp 2012-02-28 20:12:04 UTC (rev 681)
+++ trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp 2012-02-28 22:12:26 UTC (rev 682)
@@ -141,8 +141,26 @@
mRect.bottom = restRect.top;
// mRect.PrintToStream();
+ // Calculating the cell heights.
+ float maxHeight = 0;
+ float childHeight = 0;
+ for (unsigned int i = 0; i < length; i++) {
+ CSSView * childView = mChildren[i];
+ BRect childRect = childView->Bounds();
+ childHeight = childRect.Height();
+ if (maxHeight < childHeight) {
+ maxHeight = childHeight;
+ }
+ }
+
+ // Only setting them to the max height.
+ // Counting on the row group parent to force a recalculation of the layout for now.
+ for (unsigned int i = 0; i < length; i++) {
+ CSSView * childView = mChildren[i];
+ childView->SetHeight(maxHeight);
+ }
+
// Add any margins
-
mRect.bottom += mMarginBottom;
mRect.right += mMarginRight;
mEndPoint.Set(mRect.right, mRect.bottom);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-02-28 20:12:15
|
Revision: 681
http://themis.svn.sourceforge.net/themis/?rev=681&view=rev
Author: mark_hellegers
Date: 2012-02-28 20:12:04 +0000 (Tue, 28 Feb 2012)
Log Message:
-----------
- Fixed the rendering when encountering views that have less height than one of the previous siblings.
Modified Paths:
--------------
trunk/themis/modules/CSSRenderer/CSSView.cpp
Modified: trunk/themis/modules/CSSRenderer/CSSView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-02-26 22:33:52 UTC (rev 680)
+++ trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-02-28 20:12:04 UTC (rev 681)
@@ -751,7 +751,9 @@
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 (restRect.top < rect2.bottom) {
+ 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.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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.
|
|
From: CVS C. to T. <the...@li...> - 2012-02-26 17:54:13
|
Revision: 679
http://themis.svn.sourceforge.net/themis/?rev=679&view=rev
Author: mark_hellegers
Date: 2012-02-26 17:54:06 +0000 (Sun, 26 Feb 2012)
Log Message:
-----------
Stopped the "bouncing" when using the scrollwheel at the edge of the view.
Modified Paths:
--------------
trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.cpp
Modified: trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.cpp 2012-02-26 16:55:43 UTC (rev 678)
+++ trunk/themis/modules/CSSRenderer/CSSScrolledRendererView.cpp 2012-02-26 17:54:06 UTC (rev 679)
@@ -173,8 +173,27 @@
break;
}
case B_MOUSE_WHEEL_CHANGED: {
- float value = aMessage->FindFloat( "be:wheel_delta_y");
- mView->ScrollBy(0, value * 50);
+ float wheelValue = aMessage->FindFloat( "be:wheel_delta_y");
+ // We multiply it by 50 to make the scrolling usable.
+ float scrollValue = wheelValue * 50;
+ // Before we scroll, we check if we are still within the limits.
+ BScrollBar * bar = mScrollView->ScrollBar(B_VERTICAL);
+ float min = 0;
+ float max = 0;
+ bar->GetRange(&min, &max);
+ float value = bar->Value();
+ if (scrollValue + value > max) {
+ // Adjust it, so it fits.
+ scrollValue = max - value;
+ }
+ else if (scrollValue + value < min) {
+ // Adjust it, so it fits.
+ scrollValue = min - value;
+ }
+ if (scrollValue != 0) {
+ // Only scroll when it has any effect.
+ mView->ScrollBy(0, scrollValue);
+ }
break;
}
default: {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-02-26 16:55:49
|
Revision: 678
http://themis.svn.sourceforge.net/themis/?rev=678&view=rev
Author: mark_hellegers
Date: 2012-02-26 16:55:43 +0000 (Sun, 26 Feb 2012)
Log Message:
-----------
Missed a few block elements.
Modified Paths:
--------------
trunk/themis/modules/CSSParser/html4.css
Modified: trunk/themis/modules/CSSParser/html4.css
===================================================================
--- trunk/themis/modules/CSSParser/html4.css 2012-02-26 16:32:55 UTC (rev 677)
+++ trunk/themis/modules/CSSParser/html4.css 2012-02-26 16:55:43 UTC (rev 678)
@@ -24,15 +24,20 @@
LINK { display: none }
TITLE { display: none }
HEAD { display: none }
-P { margin-bottom: 5px }
+P { display: block;
+ margin-bottom: 5px }
CENTER { display: block }
-H1 { font-size: 2.5em;
+H1 { display: block;
+ font-size: 2.5em;
margin-bottom: 5px}
-H2 { font-size: 2em;
+H2 { display: block;
+ font-size: 2em;
margin-bottom: 5px}
-H3 { font-size: 1.5em;
+H3 { display: block;
+ font-size: 1.5em;
margin-bottom: 5px}
-H4 { font-size: 1.1em;
+H4 { display: block;
+ font-size: 1.1em;
margin-bottom: 5px}
UL { display: block }
OL { display: block }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-02-26 16:33:03
|
Revision: 677
http://themis.svn.sourceforge.net/themis/?rev=677&view=rev
Author: mark_hellegers
Date: 2012-02-26 16:32:55 +0000 (Sun, 26 Feb 2012)
Log Message:
-----------
- Improved table support. The columns should now be equal in size when no attribute like colspan has been set.
- Switched the default display type to inline. Added debugging output, so we know when we fall back to the default.
- Added a few more styles, so block elements still display correctly.
Modified Paths:
--------------
trunk/themis/makefile
trunk/themis/modules/CSSParser/html4.css
trunk/themis/modules/CSSRenderer/CSSView.cpp
trunk/themis/modules/CSSRenderer/CSSView.hpp
trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableDisplayView.hpp
Added Paths:
-----------
trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableGroupDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableGroupDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.hpp
Modified: trunk/themis/makefile
===================================================================
--- trunk/themis/makefile 2012-02-25 10:58:44 UTC (rev 676)
+++ trunk/themis/makefile 2012-02-26 16:32:55 UTC (rev 677)
@@ -239,6 +239,10 @@
CSSRenderer/TableDisplayView.cpp \
CSSRenderer/TableRowDisplayView.cpp \
CSSRenderer/TableCellDisplayView.cpp \
+ CSSRenderer/TableGroupDisplayView.cpp \
+ CSSRenderer/TableFooterGroupDisplayView.cpp \
+ CSSRenderer/TableHeaderGroupDisplayView.cpp \
+ CSSRenderer/TableRowGroupDisplayView.cpp \
CSSRenderer/NoneDisplayView.cpp
#make install directories as necessary
Modified: trunk/themis/modules/CSSParser/html4.css
===================================================================
--- trunk/themis/modules/CSSParser/html4.css 2012-02-25 10:58:44 UTC (rev 676)
+++ trunk/themis/modules/CSSParser/html4.css 2012-02-26 16:32:55 UTC (rev 677)
@@ -20,28 +20,35 @@
CODE { display: inline }
SCRIPT { display: none }
STYLE { display: none }
+META { display: none }
+LINK { display: none }
+TITLE { display: none }
HEAD { display: none }
P { margin-bottom: 5px }
-H1 { font-size: 2em;
+CENTER { display: block }
+H1 { font-size: 2.5em;
margin-bottom: 5px}
-H2 { font-size: 1.5em;
+H2 { font-size: 2em;
margin-bottom: 5px}
-H3 { font-size: 1.1em;
+H3 { font-size: 1.5em;
margin-bottom: 5px}
+H4 { font-size: 1.1em;
+ margin-bottom: 5px}
+UL { display: block }
+OL { display: block }
LI { display: block;
list-style-type: square}
-TABLE { display: table;
- border-style: solid;
- border-width: 1px; }
-TBODY { display: table-row-group;
- border-style: solid;
- border-width: 1px; }
-THEAD { display: table-row-group;
- border-style: solid;
- border-width: 1px; }
-TR { display: table-row;
- border-style: solid;
- border-width: 1px }
+HR { display: block }
+DL { display: block }
+DT { display: block }
+DD { display: block }
+SELECT { display: block }
+OPTION { display: block }
+TABLE { display: table;}
+TBODY { display: table-row-group;}
+THEAD { display: table-header-group;}
+TFOOT { display: table-footer-group;}
+TR { display: table-row;}
TD { display: table-cell;
border-style: solid;
border-width: 1px;
Modified: trunk/themis/modules/CSSRenderer/CSSView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-02-25 10:58:44 UTC (rev 676)
+++ trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-02-26 16:32:55 UTC (rev 677)
@@ -65,6 +65,9 @@
#include "InlineDisplayView.hpp"
#include "BlockDisplayView.hpp"
#include "TableDisplayView.hpp"
+#include "TableRowGroupDisplayView.hpp"
+#include "TableHeaderGroupDisplayView.hpp"
+#include "TableFooterGroupDisplayView.hpp"
#include "TableRowDisplayView.hpp"
#include "TableCellDisplayView.hpp"
#include "NoneDisplayView.hpp"
@@ -136,18 +139,18 @@
for (unsigned int i = 0; i < length; i++) {
TNodePtr child = children->item(i);
if (child->getNodeType() == ELEMENT_NODE) {
+ CSSView * childView = NULL;
TElementPtr element = shared_static_cast<TElement>(child);
CSSStyleDeclarationPtr style = mStyleSheets->getComputedStyle(element);
if (style.get()) {
CSSValuePtr value = style->getPropertyCSSValue("display");
- // Default to block in case it doesn't exist.
- TDOMString valueString = "block";
+ // Default to inline in case it doesn't exist.
+ TDOMString valueString = "inline";
if (value.get()) {
CSSPrimitiveValuePtr primitiveValue = shared_static_cast<CSSPrimitiveValue>(value);
valueString = primitiveValue->getStringValue();
}
// printf("Display property value: %s\n", valueString.c_str());
- CSSView * childView = NULL;
if (valueString == "inline") {
childView = new InlineDisplayView(aBaseView,
child,
@@ -159,7 +162,19 @@
mColor,
mFont);
}
- else if ((valueString == "table") || (valueString == "table-row-group")) {
+ else if (valueString == "block") {
+ childView = new BlockDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont);
+ }
+ else if (valueString == "table") {
childView = new TableDisplayView(aBaseView,
child,
mStyleSheets,
@@ -170,6 +185,42 @@
mColor,
mFont);
}
+ else if (valueString == "table-row-group") {
+ childView = new TableRowGroupDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont);
+ }
+ else if (valueString == "table-header-group") {
+ childView = new TableHeaderGroupDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont);
+ }
+ else if (valueString == "table-footer-group") {
+ childView = new TableFooterGroupDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont);
+ }
else if (valueString == "table-row") {
childView = new TableRowDisplayView(aBaseView,
child,
@@ -204,19 +255,32 @@
mFont);
}
else {
- // The default is a block element
- childView = new BlockDisplayView(aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont);
+ // The default is an inline element
+ printf("Currently unsupported display type: %s. Defaulting to inline...\n", valueString.c_str());
+ childView = new InlineDisplayView(aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont);
}
- mChildren.push_back(childView);
}
+ else {
+ printf("No style specified for %s. Defaulting to inline...\n", element->getTagName().c_str());
+ childView = new InlineDisplayView(aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont);
+ }
+ mChildren.push_back(childView);
}
else if (child->getNodeType() == TEXT_NODE) {
// Quick fix. Take a look at what would be elegant.
@@ -793,3 +857,37 @@
}
}
+
+void CSSView :: SetWidth(float aWidth) {
+
+ mRequestedWidth = aWidth;
+
+}
+
+float CSSView :: GetChildWidth(unsigned int aIndex) {
+
+ float result = 0;
+
+ if (aIndex < mChildren.size()) {
+ CSSView * childView = mChildren[aIndex];
+ result = childView->Bounds().Width();
+ }
+
+ return result;
+
+}
+
+void CSSView :: SetChildWidth(float aWidth, unsigned int aIndex) {
+
+ if (aIndex < mChildren.size()) {
+ CSSView * childView = mChildren[aIndex];
+ childView->SetWidth(aWidth);
+ }
+
+}
+
+unsigned int CSSView :: GetLength() const {
+
+ return mChildren.size();
+
+}
Modified: trunk/themis/modules/CSSRenderer/CSSView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.hpp 2012-02-25 10:58:44 UTC (rev 676)
+++ trunk/themis/modules/CSSRenderer/CSSView.hpp 2012-02-26 16:32:55 UTC (rev 677)
@@ -102,6 +102,7 @@
string mListStyleType;
bool mDisplay;
bool mBlock;
+ float mRequestedWidth;
void ApplyStyle(const TElementPtr aElement,
const CSSStyleDeclarationPtr aStyle);
@@ -129,6 +130,10 @@
BPoint aStartingPoint);
void SplitText();
void RetrieveResources();
+ void SetWidth(float aRequestedWidth);
+ float GetChildWidth(unsigned int aIndex);
+ void SetChildWidth(float aWidth, unsigned int aIndex);
+ unsigned int GetLength() const;
};
#endif
Modified: trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp 2012-02-25 10:58:44 UTC (rev 676)
+++ trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp 2012-02-26 16:32:55 UTC (rev 677)
@@ -60,6 +60,7 @@
mDisplay = true;
mBlock = false;
+ mRequestedWidth = -1;
}
@@ -72,4 +73,9 @@
CSSView::Layout(aRect, aStartingPoint);
+ if (mRequestedWidth > -1) {
+ mRect.right = mRect.left + mRequestedWidth;
+ mEndPoint.x = mRect.right;
+ }
+
}
Modified: trunk/themis/modules/CSSRenderer/TableDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableDisplayView.cpp 2012-02-25 10:58:44 UTC (rev 676)
+++ trunk/themis/modules/CSSRenderer/TableDisplayView.cpp 2012-02-26 16:32:55 UTC (rev 677)
@@ -38,6 +38,7 @@
// CSS Renderer headers
#include "TableDisplayView.hpp"
+#include "TableGroupDisplayView.hpp"
TableDisplayView :: TableDisplayView(CSSRendererView * aBaseView,
TNodePtr aNode,
@@ -67,9 +68,115 @@
}
+void TableDisplayView :: LayoutChildren(
+ BRect aRect,
+ BPoint aStartingPoint) {
+
+ unsigned int length = mChildren.size();
+ BPoint startingPoint = aStartingPoint;
+ BRect restRect = aRect;
+ float maxRight = 0;
+
+ for (unsigned int i = 0; i < length; i++) {
+ CSSView * childView = mChildren[i];
+ // Only layout those children that are actually displayed.
+ if (childView->IsDisplayed()) {
+ // Don't care if the child is a block or not, children will be positioned below to each other.
+ startingPoint = BPoint(restRect.left, restRect.top);
+ // Do the layout for the child.
+ childView->Layout(restRect, startingPoint);
+ BRect rect2 = childView->Bounds();
+ // 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.
+ restRect.right = rect2.right;
+ mRect.right = rect2.right;
+ }
+ // What is the maximum horizontal space being taken up by one of the children?
+ if (rect2.right > maxRight) {
+ maxRight = rect2.right;
+ }
+ }
+ }
+
+ if (maxRight > 0) {
+ // Only set it in case we found something.
+ mRect.right = maxRight;
+ }
+ else {
+ mRect.right = mRect.left;
+ }
+ mRect.bottom = restRect.top;
+
+}
+
void TableDisplayView :: Layout(BRect aRect,
BPoint aStartingPoint) {
- CSSView::Layout(aRect, 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;
+ BRect restRect = mRect;
+ // If we are drawing a border around this element, make sure there is less space for the content.
+ restRect.InsetBy(mBorderWidth, mBorderWidth);
+ // Set the endpoint to the starting point, as that is the minimum endpoint
+ mEndPoint = aStartingPoint;
+ // Assume we don't need any horizontal space. The children will determine the space needed.
+// mRect.right = mRect.left;
+ // In case we need to draw something before drawing any children, move the children.
+ if (mListStyleType == "square") {
+ mListStyleRect.left = restRect.left + 2;
+ mListStyleRect.right = restRect.left + 7;
+ mListStyleRect.top = restRect.top + 2;
+ mListStyleRect.bottom = restRect.top + 7;
+ restRect.left += 12;
+ mEndPoint.x += 12;
+ }
+ // Layout the children.
+ LayoutChildren(restRect, mEndPoint);
+ unsigned int length = mChildren.size();
+ vector<float> widths;
+ for (unsigned int i = 0; i < length; i++) {
+ CSSView * childView = mChildren[i];
+ TableGroupDisplayView * childGroupView = dynamic_cast<TableGroupDisplayView *> (childView);
+ if (childGroupView) {
+ unsigned int childLength = childGroupView->GetColLength();
+ for (unsigned int j = 0; j < childLength; j++) {
+ if (j >= widths.size()) {
+ widths.push_back(childGroupView->GetColWidth(j));
+ }
+ else if (childGroupView->GetColWidth(j) > widths[j]) {
+ widths[j] = childGroupView->GetColWidth(j);
+ }
+ }
+ }
+ }
+
+ for (unsigned int i = 0; i < length; i++) {
+ CSSView * childView = mChildren[i];
+ TableGroupDisplayView * childGroupView = dynamic_cast<TableGroupDisplayView *> (childView);
+ if (childGroupView) {
+ unsigned int childLength = childGroupView->GetColLength();
+ for (unsigned int j = 0; j < childLength; j++) {
+ childGroupView->SetColWidth(widths[j], j);
+ }
+ }
+ }
+
+ // Do another layout the children based on the new col widths.
+ LayoutChildren(restRect, mEndPoint);
+
+ // Add any margins
+ mRect.bottom += mMarginBottom;
+ mRect.right += mMarginRight;
+ mEndPoint.Set(mRect.right, mRect.bottom);
+ mRects.push_back(mRect);
+ //mRect.right = restRect.right;
+
}
+
Modified: trunk/themis/modules/CSSRenderer/TableDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableDisplayView.hpp 2012-02-25 10:58:44 UTC (rev 676)
+++ trunk/themis/modules/CSSRenderer/TableDisplayView.hpp 2012-02-26 16:32:55 UTC (rev 677)
@@ -70,6 +70,11 @@
class TableDisplayView : public CSSView {
+ private:
+ void LayoutChildren(
+ BRect aRect,
+ BPoint aStartingPoint);
+
public:
TableDisplayView(CSSRendererView * aBaseView,
TNodePtr aNode,
@@ -81,8 +86,9 @@
rgb_color aColor,
BFont * aFont = NULL);
~TableDisplayView();
- virtual void Layout(BRect aRect,
- BPoint aStartingPoint);
+ virtual void Layout(
+ BRect aRect,
+ BPoint aStartingPoint);
};
#endif
Added: trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.cpp 2012-02-26 16:32:55 UTC (rev 677)
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: Februari 25, 2012
+*/
+
+/* TableFooterGroupDisplayView implementation
+ See TableFooterGroupDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// CSS Renderer headers
+#include "TableFooterGroupDisplayView.hpp"
+
+TableFooterGroupDisplayView :: TableFooterGroupDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont)
+ : TableGroupDisplayView(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont) {
+
+ mDisplay = true;
+ mBlock = false;
+
+}
+
+TableFooterGroupDisplayView :: ~TableFooterGroupDisplayView() {
+
+}
+
+void TableFooterGroupDisplayView :: Layout(
+ BRect aRect,
+ BPoint aStartingPoint) {
+
+ TableGroupDisplayView::Layout(aRect, aStartingPoint);
+
+}
Added: trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.hpp 2012-02-26 16:32:55 UTC (rev 677)
@@ -0,0 +1,90 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: Februari 25, 2012
+*/
+
+/* TableFooterroupDisplayView
+ Renders css table-footer-group display elements
+
+ Mark Hellegers (ma...@fi...)
+ 25-02-2012
+
+*/
+
+#ifndef TABLEFOOTERGROUPDISPLAYVIEW_HPP
+#define TABLEFOOTERGROUPDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "TableGroupDisplayView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+class TableFooterGroupDisplayView : public TableGroupDisplayView {
+
+ public:
+ TableFooterGroupDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL);
+ ~TableFooterGroupDisplayView();
+ virtual void Layout(
+ BRect aRect,
+ BPoint aStartingPoint);
+};
+
+#endif
Added: trunk/themis/modules/CSSRenderer/TableGroupDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableGroupDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/TableGroupDisplayView.cpp 2012-02-26 16:32:55 UTC (rev 677)
@@ -0,0 +1,191 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: Februari 26, 2012
+*/
+
+/* TableGroupDisplayView implementation
+ See TableGroupDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// CSS Renderer headers
+#include "TableGroupDisplayView.hpp"
+
+TableGroupDisplayView :: TableGroupDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont)
+ : CSSView(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont) {
+
+ mDisplay = true;
+ mBlock = false;
+
+}
+
+TableGroupDisplayView :: ~TableGroupDisplayView() {
+
+}
+
+void TableGroupDisplayView :: 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;
+ BRect restRect = mRect;
+ // If we are drawing a border around this element, make sure there is less space for the content.
+ restRect.InsetBy(mBorderWidth, mBorderWidth);
+ // Set the endpoint to the starting point, as that is the minimum endpoint
+ mEndPoint = aStartingPoint;
+ // Assume we don't need any horizontal space. The children will determine the space needed.
+// mRect.right = mRect.left;
+ // In case we need to draw something before drawing any children, move the children.
+ if (mListStyleType == "square") {
+ mListStyleRect.left = restRect.left + 2;
+ mListStyleRect.right = restRect.left + 7;
+ mListStyleRect.top = restRect.top + 2;
+ mListStyleRect.bottom = restRect.top + 7;
+ restRect.left += 12;
+ mEndPoint.x += 12;
+ }
+ // Layout the children.
+ unsigned int length = mChildren.size();
+ BPoint startingPoint = mEndPoint;
+ float maxRight = 0;
+
+ for (unsigned int i = 0; i < length; i++) {
+ CSSView * childView = mChildren[i];
+ // Only layout those children that are actually displayed.
+ if (childView->IsDisplayed()) {
+ // Don't care if the child is a block or not, children will be positioned below to each other.
+ startingPoint = BPoint(restRect.left, restRect.top);
+ // Do the layout for the child.
+ childView->Layout(restRect, 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.
+ restRect.right = rect2.right;
+ mRect.right = rect2.right;
+ }
+ // What is the maximum horizontal space being taken up by one of the children?
+ if (rect2.right > maxRight) {
+ maxRight = rect2.right;
+ }
+ // The next child will have to start at the left of the parent rect and just below this block.
+ startingPoint = BPoint(restRect.left, restRect.top);
+ }
+ }
+ if (maxRight > 0) {
+ // Only set it in case we found something.
+ mRect.right = maxRight;
+ }
+ else {
+ mRect.right = mRect.left;
+ }
+ mRect.bottom = restRect.top;
+// mRect.PrintToStream();
+
+ // Add any margins
+
+ mRect.bottom += mMarginBottom;
+ mRect.right += mMarginRight;
+ mEndPoint.Set(mRect.right, mRect.bottom);
+ mRects.push_back(mRect);
+
+ // Check the widths of the table cells of the rows.
+ mColWidths.clear();
+ for (unsigned int i = 0; i < length; i++) {
+ CSSView * childView = mChildren[i];
+ unsigned int childLength = childView->GetLength();
+ for (unsigned int j = 0; j < childLength; j++) {
+ if (j >= mColWidths.size()) {
+ mColWidths.push_back(childView->GetChildWidth(j));
+ }
+ else if (childView->GetChildWidth(j) > mColWidths[j]) {
+ mColWidths[j] = childView->GetChildWidth(j);
+ }
+ }
+ }
+
+}
+
+float TableGroupDisplayView :: GetColWidth(unsigned int aIndex) {
+
+ float result = -1;
+
+ if (aIndex < mColWidths.size()) {
+ result = mColWidths[aIndex];
+ }
+
+ return result;
+
+}
+
+void TableGroupDisplayView :: SetColWidth(float aWidth, unsigned int aIndex) {
+
+ unsigned int length = mChildren.size();
+ for (unsigned int i = 0; i < length; i++) {
+ CSSView * childView = mChildren[i];
+ unsigned int childLength = childView->GetLength();
+ if (aIndex < childLength) {
+ childView->SetChildWidth(aWidth, aIndex);
+ }
+ }
+
+}
+
+unsigned int TableGroupDisplayView :: GetColLength() const {
+
+ return mColWidths.size();
+
+}
Added: trunk/themis/modules/CSSRenderer/TableGroupDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableGroupDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/TableGroupDisplayView.hpp 2012-02-26 16:32:55 UTC (rev 677)
@@ -0,0 +1,96 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: Februari 26, 2012
+*/
+
+/* TableGroupDisplayView
+ Base class for the *-row-group display elements
+
+ Mark Hellegers (ma...@fi...)
+ 26-02-2012
+
+*/
+
+#ifndef TABLEGROUPDISPLAYVIEW_HPP
+#define TABLEGROUPDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "CSSView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+class TableGroupDisplayView : public CSSView {
+
+ private:
+ vector<float> mColWidths;
+
+ public:
+ TableGroupDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL);
+ ~TableGroupDisplayView();
+ virtual void Layout(
+ BRect aRect,
+ BPoint aStartingPoint);
+ float GetColWidth(unsigned int aIndex);
+ void SetColWidth(float aWidth, unsigned int aIndex);
+ unsigned int GetColLength() const;
+};
+
+#endif
Added: trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.cpp 2012-02-26 16:32:55 UTC (rev 677)
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: Februari 25, 2012
+*/
+
+/* TableHeaderGroupDisplayView implementation
+ See TableHeaderGroupDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// CSS Renderer headers
+#include "TableHeaderGroupDisplayView.hpp"
+
+TableHeaderGroupDisplayView :: TableHeaderGroupDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont)
+ : TableGroupDisplayView(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont) {
+
+ mDisplay = true;
+ mBlock = false;
+
+}
+
+TableHeaderGroupDisplayView :: ~TableHeaderGroupDisplayView() {
+
+}
+
+void TableHeaderGroupDisplayView :: Layout(
+ BRect aRect,
+ BPoint aStartingPoint) {
+
+ TableGroupDisplayView::Layout(aRect, aStartingPoint);
+
+}
Added: trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.hpp 2012-02-26 16:32:55 UTC (rev 677)
@@ -0,0 +1,90 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: Februari 25, 2012
+*/
+
+/* TableHeaderGroupDisplayView
+ Renders css table-header-group display elements
+
+ Mark Hellegers (ma...@fi...)
+ 25-02-2012
+
+*/
+
+#ifndef TABLEHEADERGROUPDISPLAYVIEW_HPP
+#define TABLEHEADERGROUPDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "TableGroupDisplayView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+class TableHeaderGroupDisplayView : public TableGroupDisplayView {
+
+ public:
+ TableHeaderGroupDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL);
+ ~TableHeaderGroupDisplayView();
+ virtual void Layout(
+ BRect aRect,
+ BPoint aStartingPoint);
+};
+
+#endif
Added: trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.cpp 2012-02-26 16:32:55 UTC (rev 677)
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: Februari 25, 2012
+*/
+
+/* TableRowGroupDisplayView implementation
+ See TableRowGroupDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// CSS Renderer headers
+#include "TableRowGroupDisplayView.hpp"
+
+TableRowGroupDisplayView :: TableRowGroupDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont)
+ : TableGroupDisplayView(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont) {
+
+ mDisplay = true;
+ mBlock = false;
+
+}
+
+TableRowGroupDisplayView :: ~TableRowGroupDisplayView() {
+
+}
+
+void TableRowGroupDisplayView :: Layout(
+ BRect aRect,
+ BPoint aStartingPoint) {
+
+ TableGroupDisplayView::Layout(aRect, aStartingPoint);
+
+}
Added: trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.hpp 2012-02-26 16:32:55 UTC (rev 677)
@@ -0,0 +1,90 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: Februari 25, 2012
+*/
+
+/* TableRowGroupDisplayView
+ Renders css table-row-group display elements
+
+ Mark Hellegers (ma...@fi...)
+ 25-02-2012
+
+*/
+
+#ifndef TABLEROWGROUPDISPLAYVIEW_HPP
+#define TABLEROWGROUPDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "TableGroupDisplayView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+class TableRowGroupDisplayView : public TableGroupDisplayView {
+
+ public:
+ TableRowGroupDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL);
+ ~TableRowGroupDisplayView();
+ virtual void Layout(
+ BRect aRect,
+ BPoint aStartingPoint);
+};
+
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-02-25 10:58:50
|
Revision: 676
http://themis.svn.sourceforge.net/themis/?rev=676&view=rev
Author: mark_hellegers
Date: 2012-02-25 10:58:44 +0000 (Sat, 25 Feb 2012)
Log Message:
-----------
Display table headers the same way as the table body for now.
Modified Paths:
--------------
trunk/themis/modules/CSSParser/html4.css
Modified: trunk/themis/modules/CSSParser/html4.css
===================================================================
--- trunk/themis/modules/CSSParser/html4.css 2012-02-25 10:15:14 UTC (rev 675)
+++ trunk/themis/modules/CSSParser/html4.css 2012-02-25 10:58:44 UTC (rev 676)
@@ -36,6 +36,9 @@
TBODY { display: table-row-group;
border-style: solid;
border-width: 1px; }
+THEAD { display: table-row-group;
+ border-style: solid;
+ border-width: 1px; }
TR { display: table-row;
border-style: solid;
border-width: 1px }
@@ -43,3 +46,7 @@
border-style: solid;
border-width: 1px;
margin-right: 2px }
+TH { display: table-cell;
+ border-style: solid;
+ border-width: 1px;
+ margin-right: 2px }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-02-25 10:15:20
|
Revision: 675
http://themis.svn.sourceforge.net/themis/?rev=675&view=rev
Author: mark_hellegers
Date: 2012-02-25 10:15:14 +0000 (Sat, 25 Feb 2012)
Log Message:
-----------
Fixed the layout of table rows, so they are displyed below each other again.
Modified Paths:
--------------
trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp
Modified: trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp 2012-02-23 22:39:42 UTC (rev 674)
+++ trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp 2012-02-25 10:15:14 UTC (rev 675)
@@ -145,10 +145,10 @@
// mRect.PrintToStream();
// Add any margins
- mEndPoint.Set(mEndPoint.x + mMarginRight, mEndPoint.y + mMarginBottom);
mRect.bottom = restRect.top + mMarginBottom;
mRect.right += mMarginRight;
+ mEndPoint.Set(mRect.right, mRect.bottom);
//mRect.right = restRect.right;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-02-23 22:39:48
|
Revision: 674
http://themis.svn.sourceforge.net/themis/?rev=674&view=rev
Author: mark_hellegers
Date: 2012-02-23 22:39:42 +0000 (Thu, 23 Feb 2012)
Log Message:
-----------
Moved rendering of the table row to its own Layout function.
Removed no longer needed variables.
Modified Paths:
--------------
trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp
trunk/themis/modules/CSSRenderer/CSSView.cpp
trunk/themis/modules/CSSRenderer/CSSView.hpp
trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp
trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp
Modified: trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp 2012-02-22 23:40:32 UTC (rev 673)
+++ trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp 2012-02-23 22:39:42 UTC (rev 674)
@@ -60,9 +60,6 @@
mDisplay = true;
mBlock = true;
- mTable = false;
- mTableRow = false;
- mTableCell = false;
}
Modified: trunk/themis/modules/CSSRenderer/CSSView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-02-22 23:40:32 UTC (rev 673)
+++ trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-02-23 22:39:42 UTC (rev 674)
@@ -663,90 +663,48 @@
unsigned int length = mChildren.size();
BPoint startingPoint = mEndPoint;
float maxRight = 0;
- if (!mTableRow) {
- for (unsigned int i = 0; i < length; i++) {
- CSSView * childView = mChildren[i];
- // Only layout those children that are actually displayed.
- if (childView->IsDisplayed()) {
- if (childView->IsBlock()) {
- // Blocks have their own rect, so start at the left of the parent rect and just below the previous block.
- startingPoint = BPoint(restRect.left, restRect.top);
- // previousChildIsBlock = true;
- // startingPoint.PrintToStream();
- }
- // Do the layout for the child.
- childView->Layout(restRect, 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.
- restRect.right = rect2.right;
- mRect.right = rect2.right;
- }
- // What is the maximum horizontal space being taken up by one of the children?
- if (rect2.right > maxRight) {
- maxRight = rect2.right;
- }
-
- if (childView->IsBlock()) {
- // The next child will have to start at the left of the parent rect and just below this block.
- startingPoint = BPoint(restRect.left, restRect.top);
- // previousChildIsBlock = true;
- // startingPoint.PrintToStream();
- }
- else {
- // We can start where we left off.
- startingPoint = mEndPoint;
- // previousChildIsBlock = false;
- // printf("Starting at: ");
- // mEndPoint.PrintToStream();
- }
+ for (unsigned int i = 0; i < length; i++) {
+ CSSView * childView = mChildren[i];
+ // Only layout those children that are actually displayed.
+ if (childView->IsDisplayed()) {
+ if (childView->IsBlock()) {
+ // Blocks have their own rect, so start at the left of the parent rect and just below the previous block.
+ startingPoint = BPoint(restRect.left, restRect.top);
+ // previousChildIsBlock = true;
+ // startingPoint.PrintToStream();
}
- }
- }
- else {
- BRect restRowRect = restRect;
- float maxBottom = restRowRect.top;
- for (unsigned int i = 0; i < length; i++) {
- CSSView * childView = mChildren[i];
- // Only layout those children that are actually displayed.
- if (childView->IsDisplayed()) {
- // Don't care if the child is a block or not, children will be positioned next to each other.
- startingPoint = BPoint(restRowRect.left, restRowRect.top);
- // Do the layout for the child.
- 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.
- restRect.right = rect2.right;
- mRect.right = rect2.right;
- restRowRect.right = rect2.right;
- }
- // What is the maximum horizontal space being taken up by one of the children?
- if (rect2.right > maxRight) {
- maxRight = rect2.right;
- }
- // What is the maximum vertical space being taken up by one of the children?
- if (rect2.bottom > maxBottom) {
- maxBottom = rect2.bottom;
- }
- // Make sure the next child starts to the right of this one.
- restRowRect.left = rect2.right;
+ // Do the layout for the child.
+ childView->Layout(restRect, 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.
+ restRect.right = rect2.right;
+ mRect.right = rect2.right;
}
+ // What is the maximum horizontal space being taken up by one of the children?
+ if (rect2.right > maxRight) {
+ maxRight = rect2.right;
+ }
+
+ if (childView->IsBlock()) {
+ // The next child will have to start at the left of the parent rect and just below this block.
+ startingPoint = BPoint(restRect.left, restRect.top);
+ // previousChildIsBlock = true;
+ // startingPoint.PrintToStream();
+ }
+ else {
+ // We can start where we left off.
+ startingPoint = mEndPoint;
+ // previousChildIsBlock = false;
+// printf("Starting at: ");
+// mEndPoint.PrintToStream();
+ }
}
- if (maxBottom > 0) {
- // Only set it in case we found something.
- restRect.top = maxBottom;
- }
}
if (maxRight > 0) {
// Only set it in case we found something.
Modified: trunk/themis/modules/CSSRenderer/CSSView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.hpp 2012-02-22 23:40:32 UTC (rev 673)
+++ trunk/themis/modules/CSSRenderer/CSSView.hpp 2012-02-23 22:39:42 UTC (rev 674)
@@ -71,40 +71,37 @@
class CSSView : public BHandler {
private:
- vector<CSSView *> mChildren;
TNodePtr mNode;
CSSStyleContainer * mStyleSheets;
CSSRendererView * mBaseView;
- vector<BRect> mRects;
- BRect mRect;
- BPoint mEndPoint;
vector<TextBox> mTextBoxes;
float mLineHeight;
float mBottomMargin;
float mSpaceWidth;
BFont * mFont;
bool mInheritedFont;
- float mMarginBottom;
- float mMarginRight;
bool mClickable;
string mHref;
string mName;
rgb_color mColor;
- string mListStyleType;
string mBorderStyle;
- float mBorderWidth;
- BRect mListStyleRect;
int32 mSiteId;
int32 mUrlId;
void RetrieveLink(bool aVisible = true);
protected:
+ vector<CSSView *> mChildren;
+ vector<BRect> mRects;
+ BRect mRect;
+ BPoint mEndPoint;
+ float mBorderWidth;
+ float mMarginBottom;
+ float mMarginRight;
+ BRect mListStyleRect;
+ string mListStyleType;
bool mDisplay;
bool mBlock;
- bool mTable;
- bool mTableRow;
- bool mTableCell;
void ApplyStyle(const TElementPtr aElement,
const CSSStyleDeclarationPtr aStyle);
Modified: trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp 2012-02-22 23:40:32 UTC (rev 673)
+++ trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp 2012-02-23 22:39:42 UTC (rev 674)
@@ -60,9 +60,6 @@
mDisplay = true;
mBlock = false;
- mTable = false;
- mTableRow = false;
- mTableCell = false;
}
Modified: trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp 2012-02-22 23:40:32 UTC (rev 673)
+++ trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp 2012-02-23 22:39:42 UTC (rev 674)
@@ -60,9 +60,6 @@
mDisplay = false;
mBlock = false;
- mTable = false;
- mTableRow = false;
- mTableCell = false;
}
Modified: trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp 2012-02-22 23:40:32 UTC (rev 673)
+++ trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp 2012-02-23 22:39:42 UTC (rev 674)
@@ -60,9 +60,6 @@
mDisplay = true;
mBlock = false;
- mTable = false;
- mTableRow = false;
- mTableCell = true;
}
Modified: trunk/themis/modules/CSSRenderer/TableDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableDisplayView.cpp 2012-02-22 23:40:32 UTC (rev 673)
+++ trunk/themis/modules/CSSRenderer/TableDisplayView.cpp 2012-02-23 22:39:42 UTC (rev 674)
@@ -59,10 +59,7 @@
aFont) {
mDisplay = true;
- mBlock = false;
- mTable = true;
- mTableRow = false;
- mTableCell = false;
+ mBlock = true;
}
Modified: trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp 2012-02-22 23:40:32 UTC (rev 673)
+++ trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp 2012-02-23 22:39:42 UTC (rev 674)
@@ -60,9 +60,6 @@
mDisplay = true;
mBlock = false;
- mTable = false;
- mTableRow = true;
- mTableCell = false;
}
@@ -73,6 +70,85 @@
void TableRowDisplayView :: Layout(BRect aRect,
BPoint aStartingPoint) {
- CSSView::Layout(aRect, aStartingPoint);
+ 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;
+ BRect restRect = mRect;
+ // If we are drawing a border around this element, make sure there is less space for the content.
+ restRect.InsetBy(mBorderWidth, mBorderWidth);
+ // Set the endpoint to the starting point, as that is the minimum endpoint
+ mEndPoint = aStartingPoint;
+ // Assume we don't need any horizontal space. The children will determine the space needed.
+// mRect.right = mRect.left;
+ // In case we need to draw something before drawing any children, move the children.
+ if (mListStyleType == "square") {
+ mListStyleRect.left = restRect.left + 2;
+ mListStyleRect.right = restRect.left + 7;
+ mListStyleRect.top = restRect.top + 2;
+ mListStyleRect.bottom = restRect.top + 7;
+ restRect.left += 12;
+ mEndPoint.x += 12;
+ }
+ // Layout the children.
+ unsigned int length = mChildren.size();
+ BPoint startingPoint = mEndPoint;
+ float maxRight = 0;
+ BRect restRowRect = restRect;
+ float maxBottom = restRowRect.top;
+ for (unsigned int i = 0; i < length; i++) {
+ CSSView * childView = mChildren[i];
+ // Only layout those children that are actually displayed.
+ if (childView->IsDisplayed()) {
+ // Don't care if the child is a block or not, children will be positioned next to each other.
+ startingPoint = BPoint(restRowRect.left, restRowRect.top);
+ // Do the layout for the child.
+ 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.
+ restRect.right = rect2.right;
+ mRect.right = rect2.right;
+ restRowRect.right = rect2.right;
+ }
+ // What is the maximum horizontal space being taken up by one of the children?
+ if (rect2.right > maxRight) {
+ maxRight = rect2.right;
+ }
+ // What is the maximum vertical space being taken up by one of the children?
+ if (rect2.bottom > maxBottom) {
+ maxBottom = rect2.bottom;
+ }
+ // Make sure the next child starts to the right of this one.
+ restRowRect.left = rect2.right;
+ }
+ }
+ if (maxBottom > 0) {
+ // Only set it in case we found something.
+ restRect.top = maxBottom;
+ }
+
+ if (maxRight > 0) {
+ // Only set it in case we found something.
+ mRect.right = maxRight;
+ }
+ else {
+ mRect.right = mRect.left;
+ }
+ mRect.bottom = restRect.top;
+ mRects.push_back(mRect);
+// mRect.PrintToStream();
+
+ // Add any margins
+ mEndPoint.Set(mEndPoint.x + mMarginRight, mEndPoint.y + mMarginBottom);
+
+ mRect.bottom = restRect.top + mMarginBottom;
+ mRect.right += mMarginRight;
+ //mRect.right = restRect.right;
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-02-22 23:40:40
|
Revision: 673
http://themis.svn.sourceforge.net/themis/?rev=673&view=rev
Author: mark_hellegers
Date: 2012-02-22 23:40:32 +0000 (Wed, 22 Feb 2012)
Log Message:
-----------
Changed CSS Renderer to use separate classes for display types.
Shouldn't change anything yet, but will allow for moving specific functionality to the right class.
Also makes it easier to create display specific layouts.
Modified Paths:
--------------
trunk/themis/makefile
trunk/themis/modules/CSSParser/html4.css
trunk/themis/modules/CSSRenderer/CSSRendererView.cpp
trunk/themis/modules/CSSRenderer/CSSView.cpp
trunk/themis/modules/CSSRenderer/CSSView.hpp
Added Paths:
-----------
trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp
trunk/themis/modules/CSSRenderer/BlockDisplayView.hpp
trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp
trunk/themis/modules/CSSRenderer/InlineDisplayView.hpp
trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp
trunk/themis/modules/CSSRenderer/NoneDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableCellDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableRowDisplayView.hpp
Modified: trunk/themis/makefile
===================================================================
--- trunk/themis/makefile 2012-01-03 19:55:48 UTC (rev 672)
+++ trunk/themis/makefile 2012-02-22 23:40:32 UTC (rev 673)
@@ -233,7 +233,13 @@
CSSRenderer/CSSScrolledRendererView.cpp \
CSSRenderer/CSSView.cpp \
CSSRenderer/TextBox.cpp \
- CSSRenderer/CSSStyleContainer.cpp
+ CSSRenderer/CSSStyleContainer.cpp \
+ CSSRenderer/InlineDisplayView.cpp \
+ CSSRenderer/BlockDisplayView.cpp \
+ CSSRenderer/TableDisplayView.cpp \
+ CSSRenderer/TableRowDisplayView.cpp \
+ CSSRenderer/TableCellDisplayView.cpp \
+ CSSRenderer/NoneDisplayView.cpp
#make install directories as necessary
ifeq "$(shell if [ -d $(BASE_ADDON_INSTALL_DIR) ] ; then echo 1 ; else mkdir -p $(BASE_ADDON_INSTALL_DIR) ; echo 0 ; fi)" "0"
Modified: trunk/themis/modules/CSSParser/html4.css
===================================================================
--- trunk/themis/modules/CSSParser/html4.css 2012-01-03 19:55:48 UTC (rev 672)
+++ trunk/themis/modules/CSSParser/html4.css 2012-02-22 23:40:32 UTC (rev 673)
@@ -2,6 +2,9 @@
Simple CSS stylesheet used to display html.
*/
+HTML { display: block }
+BODY { display: block }
+DIV { display: block }
B { display: inline;
font-weight: bold }
A { display: inline;
Added: trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp 2012-02-22 23:40:32 UTC (rev 673)
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2011 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: April 15, 2011
+*/
+
+/* BlockDisplayView implementation
+ See BlockDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// CSS Renderer headers
+#include "BlockDisplayView.hpp"
+
+BlockDisplayView :: BlockDisplayView(CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont)
+ : CSSView(aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont) {
+
+ mDisplay = true;
+ mBlock = true;
+ mTable = false;
+ mTableRow = false;
+ mTableCell = false;
+
+}
+
+BlockDisplayView :: ~BlockDisplayView() {
+
+}
+
+void BlockDisplayView :: Layout(BRect aRect,
+ BPoint aStartingPoint) {
+
+ CSSView::Layout(aRect, aStartingPoint);
+
+}
Added: trunk/themis/modules/CSSRenderer/BlockDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/BlockDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/BlockDisplayView.hpp 2012-02-22 23:40:32 UTC (rev 673)
@@ -0,0 +1,88 @@
+/*
+ Copyright (c) 2011 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: April 15, 2011
+*/
+
+/* BlockDisplayView
+ Renders css block display elements
+
+ Mark Hellegers (ma...@fi...)
+ 15-04-2011
+
+*/
+
+#ifndef BLOCKDISPLAYVIEW_HPP
+#define BLOCKDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "CSSView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+class BlockDisplayView : public CSSView {
+
+ public:
+ BlockDisplayView(CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL);
+ ~BlockDisplayView();
+ virtual void Layout(BRect aRect,
+ BPoint aStartingPoint);
+};
+
+#endif
Modified: trunk/themis/modules/CSSRenderer/CSSRendererView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSRendererView.cpp 2012-01-03 19:55:48 UTC (rev 672)
+++ trunk/themis/modules/CSSRenderer/CSSRendererView.cpp 2012-02-22 23:40:32 UTC (rev 673)
@@ -47,7 +47,12 @@
#include "CSSRendererView.hpp"
#include "CSSView.hpp"
#include "CSSStyleContainer.hpp"
+#include "InlineDisplayView.hpp"
+#include "BlockDisplayView.hpp"
+// DOM Style headers
+#include "CSSPrimitiveValue.hpp"
+
CSSRendererView :: CSSRendererView(BRect aFrame,
TDocumentPtr aDocument,
CSSStyleSheetPtr aStyleSheet,
@@ -63,6 +68,7 @@
mStyleSheets->addStyleSheet(aStyleSheet);
mDocument = aDocument;
BRect rect = Bounds();
+
if (mDocument->hasChildNodes()) {
rgb_color defaultColor;
defaultColor.red = 0;
@@ -71,14 +77,62 @@
TNodePtr root = mDocument->getFirstChild();
+ TElementPtr element = shared_static_cast<TElement>(root);
- mView = new CSSView(this,
- root,
- mStyleSheets,
- rect,
- aSiteId,
- aUrlId,
- defaultColor);
+ printf("Getting style of %s\n", element->getTagName().c_str());
+ CSSStyleDeclarationPtr style = mStyleSheets->getComputedStyle(element);
+ if (style.get() == NULL) {
+ // No style defined. Assume it is a block.
+ printf("Defaulting to block!!!\n");
+ mView = new BlockDisplayView(this,
+ root,
+ mStyleSheets,
+ style,
+ rect,
+ aSiteId,
+ aUrlId,
+ defaultColor);
+ }
+ else {
+ CSSValuePtr value = style->getPropertyCSSValue("display");
+ CSSPrimitiveValuePtr primitiveValue = shared_static_cast<CSSPrimitiveValue>(value);
+ TDOMString valueString = primitiveValue->getStringValue();
+ // printf("Display property value: %s\n", valueString.c_str());
+ if (valueString == "inline") {
+ printf("Inline!!!\n");
+ mView = new InlineDisplayView(this,
+ root,
+ mStyleSheets,
+ style,
+ rect,
+ aSiteId,
+ aUrlId,
+ defaultColor);
+ }
+ else if ((valueString == "table") || (valueString == "table-row-group")) {
+ // Nothing yet
+ }
+ else if (valueString == "table-row") {
+ // Nothing yet
+
+ }
+ else if (valueString == "table-cell") {
+ // Nothing yet
+ }
+ else {
+ // The default is a block element
+ printf("Defaulting to block!!!\n");
+ mView = new BlockDisplayView(this,
+ root,
+ mStyleSheets,
+ style,
+ rect,
+ aSiteId,
+ aUrlId,
+ defaultColor);
+ }
+ }
+
printf("Doing layout\n");
mView->Layout(rect, BPoint(rect.left, rect.top));
printf("Layout done\n");
@@ -129,7 +183,9 @@
}
Window()->SetTitle(title.c_str());
SetViewColor(B_TRANSPARENT_COLOR);
- mView->RetrieveResources();
+ if (mView) {
+ mView->RetrieveResources();
+ }
}
Modified: trunk/themis/modules/CSSRenderer/CSSView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-01-03 19:55:48 UTC (rev 672)
+++ trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-02-22 23:40:32 UTC (rev 673)
@@ -62,6 +62,12 @@
#include "CSSView.hpp"
#include "CSSRendererView.hpp"
#include "CSSStyleContainer.hpp"
+#include "InlineDisplayView.hpp"
+#include "BlockDisplayView.hpp"
+#include "TableDisplayView.hpp"
+#include "TableRowDisplayView.hpp"
+#include "TableCellDisplayView.hpp"
+#include "NoneDisplayView.hpp"
// Constants used
const char cSpace = ' ';
@@ -69,6 +75,7 @@
CSSView :: CSSView(CSSRendererView * aBaseView,
TNodePtr aNode,
CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
BRect aRect,
int32 aSiteId,
int32 aUrlId,
@@ -82,11 +89,6 @@
mRect = aRect;
mSiteId = aSiteId;
mUrlId = aUrlId;
- mDisplay = true;
- mBlock = true;
- mTable = false;
- mTableRow = false;
- mTableCell = false;
mFont = aFont;
mInheritedFont = true;
mMarginBottom = 0;
@@ -102,8 +104,8 @@
TNodeListPtr children = mNode->getChildNodes();
unsigned int length = children->getLength();
if ((mNode->getNodeType() == ELEMENT_NODE) &&
- (mNode->getNodeName() == "TITLE") &&
- (length > 0)) {
+ (mNode->getNodeName() == "TITLE") &&
+ (length > 0)) {
printf("Found TITLE node\n");
TNodePtr textChild = children->item(0);
TDOMString titleText = textChild->getNodeValue();
@@ -128,20 +130,108 @@
mClickable = true;
}
}
- ApplyStyle(element);
+ ApplyStyle(element, aStyle);
}
for (unsigned int i = 0; i < length; i++) {
TNodePtr child = children->item(i);
- CSSView * childView = new CSSView(aBaseView,
- child,
- mStyleSheets,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont);
- mChildren.push_back(childView);
+ if (child->getNodeType() == ELEMENT_NODE) {
+ TElementPtr element = shared_static_cast<TElement>(child);
+ CSSStyleDeclarationPtr style = mStyleSheets->getComputedStyle(element);
+ if (style.get()) {
+ CSSValuePtr value = style->getPropertyCSSValue("display");
+ // Default to block in case it doesn't exist.
+ TDOMString valueString = "block";
+ if (value.get()) {
+ CSSPrimitiveValuePtr primitiveValue = shared_static_cast<CSSPrimitiveValue>(value);
+ valueString = primitiveValue->getStringValue();
+ }
+ // printf("Display property value: %s\n", valueString.c_str());
+ CSSView * childView = NULL;
+ if (valueString == "inline") {
+ childView = new InlineDisplayView(aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont);
+ }
+ else if ((valueString == "table") || (valueString == "table-row-group")) {
+ childView = new TableDisplayView(aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont);
+ }
+ else if (valueString == "table-row") {
+ childView = new TableRowDisplayView(aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont);
+ }
+ else if (valueString == "table-cell") {
+ childView = new TableCellDisplayView(aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont);
+ }
+ else if (valueString == "none") {
+ childView = new NoneDisplayView(aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont);
+ }
+ else {
+ // The default is a block element
+ childView = new BlockDisplayView(aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont);
+ }
+ mChildren.push_back(childView);
+ }
+ }
+ else if (child->getNodeType() == TEXT_NODE) {
+ // Quick fix. Take a look at what would be elegant.
+ CSSStyleDeclarationPtr style;
+ CSSView * childView = new CSSView(aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont);
+ mChildren.push_back(childView);
+ }
}
}
else if (mNode->getNodeType() == TEXT_NODE) {
@@ -155,7 +245,7 @@
mBottomMargin = height.descent;
mSpaceWidth = mFont->StringWidth(&cSpace, 1);
mBlock = false;
-
+ mDisplay = true;
SplitText();
}
else if (mNode->getNodeType() == ELEMENT_NODE) {
@@ -226,38 +316,17 @@
}
-void CSSView :: ApplyStyle(const TElementPtr aElement) {
+void CSSView :: ApplyStyle(const TElementPtr aElement,
+ const CSSStyleDeclarationPtr aStyle) {
- CSSStyleDeclarationPtr style = mStyleSheets->getComputedStyle(aElement);
- if (style.get()) {
- unsigned long length = style->getLength();
+ if (aStyle.get()) {
+ unsigned long length = aStyle->getLength();
for (unsigned long i = 0; i < length; i++) {
- TDOMString propertyName = style->item(i);
- CSSValuePtr value = style->getPropertyCSSValue(propertyName);
+ TDOMString propertyName = aStyle->item(i);
+ CSSValuePtr value = aStyle->getPropertyCSSValue(propertyName);
if (value.get()) {
- if (propertyName == "display") {
+ if (propertyName == "font-size") {
CSSPrimitiveValuePtr primitiveValue = shared_static_cast<CSSPrimitiveValue>(value);
- TDOMString valueString = primitiveValue->getStringValue();
-// printf("Display property value: %s\n", valueString.c_str());
- if (valueString == "none") {
- mDisplay = false;
- mRect = BRect(0, 0, 0, 0);
- }
- else if (valueString == "inline") {
- mBlock = false;
- }
- else if ((valueString == "table") || (valueString == "table-row-group")) {
- mTable = true;
- }
- else if (valueString == "table-row") {
- mTableRow = true;
- }
- else if (valueString == "table-cell") {
- mTableCell = true;
- }
- }
- else if (propertyName == "font-size") {
- CSSPrimitiveValuePtr primitiveValue = shared_static_cast<CSSPrimitiveValue>(value);
if (primitiveValue.get()) {
if (primitiveValue->getPrimitiveType() == CSSPrimitiveValue::CSS_EMS) {
float floatValue = primitiveValue->getFloatValue(CSSPrimitiveValue::CSS_EMS);
@@ -396,7 +465,7 @@
unsigned int end = 0;
box.getRange(start, end);
BRect rect = box.getRect();
- // printf("Drawing string: %s for %u at %f and %f\n", (text.c_str()) + start, end - start, rect.left, rect.top);
+ //printf("Drawing string: %s for %u at %f and %f\n", (text.c_str()) + start, end - start + 1, rect.left, rect.top + mLineHeight - mBottomMargin);
drawPoint.Set(rect.left, rect.top + mLineHeight - mBottomMargin);
mBaseView->SetFont(mFont);
mBaseView->DrawString((text.c_str()) + start, end - start + 1, drawPoint);
@@ -414,13 +483,11 @@
mBaseView->StrokeRect(mRect);
mBaseView->SetPenSize(savedPenSize);
}
-
unsigned int length = mChildren.size();
for (unsigned int i = 0; i < length; i++) {
mChildren[i]->Draw();
}
}
-
}
bool CSSView :: Contains(BPoint aPoint) {
Modified: trunk/themis/modules/CSSRenderer/CSSView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.hpp 2012-01-03 19:55:48 UTC (rev 672)
+++ trunk/themis/modules/CSSRenderer/CSSView.hpp 2012-02-22 23:40:32 UTC (rev 673)
@@ -84,11 +84,6 @@
float mSpaceWidth;
BFont * mFont;
bool mInheritedFont;
- bool mDisplay;
- bool mBlock;
- bool mTable;
- bool mTableRow;
- bool mTableCell;
float mMarginBottom;
float mMarginRight;
bool mClickable;
@@ -105,12 +100,20 @@
void RetrieveLink(bool aVisible = true);
protected:
- void ApplyStyle(const TElementPtr aElement);
+ bool mDisplay;
+ bool mBlock;
+ bool mTable;
+ bool mTableRow;
+ bool mTableCell;
+
+ void ApplyStyle(const TElementPtr aElement,
+ const CSSStyleDeclarationPtr aStyle);
public:
CSSView(CSSRendererView * aBaseView,
TNodePtr aNode,
CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
BRect aRect,
int32 aSiteId,
int32 aUrlId,
Added: trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp 2012-02-22 23:40:32 UTC (rev 673)
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2011 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: November 28, 2011
+*/
+
+/* InlineDisplayView implementation
+ See InlineDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// CSS Renderer headers
+#include "InlineDisplayView.hpp"
+
+InlineDisplayView :: InlineDisplayView(CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont)
+ : CSSView(aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont) {
+
+ mDisplay = true;
+ mBlock = false;
+ mTable = false;
+ mTableRow = false;
+ mTableCell = false;
+
+}
+
+InlineDisplayView :: ~InlineDisplayView() {
+
+}
+
+void InlineDisplayView :: Layout(BRect aRect,
+ BPoint aStartingPoint) {
+
+ CSSView::Layout(aRect, aStartingPoint);
+
+}
Added: trunk/themis/modules/CSSRenderer/InlineDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/InlineDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/InlineDisplayView.hpp 2012-02-22 23:40:32 UTC (rev 673)
@@ -0,0 +1,88 @@
+/*
+ Copyright (c) 2011 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: November 28, 2011
+*/
+
+/* InlineDisplayView
+ Renders css inline display elements
+
+ Mark Hellegers (ma...@fi...)
+ 28-11-2011
+
+*/
+
+#ifndef INLINEDISPLAYVIEW_HPP
+#define INLINEDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "CSSView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+class InlineDisplayView : public CSSView {
+
+ public:
+ InlineDisplayView(CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL);
+ ~InlineDisplayView();
+ virtual void Layout(BRect aRect,
+ BPoint aStartingPoint);
+};
+
+#endif
Added: trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp 2012-02-22 23:40:32 UTC (rev 673)
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: Februari 12, 2012
+*/
+
+/* NoneDisplayView implementation
+ See NoneDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// CSS Renderer headers
+#include "NoneDisplayView.hpp"
+
+NoneDisplayView :: NoneDisplayView(CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont)
+ : CSSView(aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont) {
+
+ mDisplay = false;
+ mBlock = false;
+ mTable = false;
+ mTableRow = false;
+ mTableCell = false;
+
+}
+
+NoneDisplayView :: ~NoneDisplayView() {
+
+}
+
+void NoneDisplayView :: Layout(BRect aRect,
+ BPoint aStartingPoint) {
+
+ CSSView::Layout(aRect, aStartingPoint);
+
+}
Added: trunk/themis/modules/CSSRenderer/NoneDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/NoneDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/NoneDisplayView.hpp 2012-02-22 23:40:32 UTC (rev 673)
@@ -0,0 +1,88 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: Februari 12, 2012
+*/
+
+/* NoneDisplayView
+ "Renders" css display elements that are set to none
+
+ Mark Hellegers (ma...@fi...)
+ 12-02-2012
+
+*/
+
+#ifndef NONEDISPLAYVIEW_HPP
+#define NONEDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "CSSView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+class NoneDisplayView : public CSSView {
+
+ public:
+ NoneDisplayView(CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL);
+ ~NoneDisplayView();
+ virtual void Layout(BRect aRect,
+ BPoint aStartingPoint);
+};
+
+#endif
Added: trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp 2012-02-22 23:40:32 UTC (rev 673)
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: Februari 23, 2012
+*/
+
+/* TableCellDisplayView implementation
+ See TableCellDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// CSS Renderer headers
+#include "TableCellDisplayView.hpp"
+
+TableCellDisplayView :: TableCellDisplayView(CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont)
+ : CSSView(aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont) {
+
+ mDisplay = true;
+ mBlock = false;
+ mTable = false;
+ mTableRow = false;
+ mTableCell = true;
+
+}
+
+TableCellDisplayView :: ~TableCellDisplayView() {
+
+}
+
+void TableCellDisplayView :: Layout(BRect aRect,
+ BPoint aStartingPoint) {
+
+ CSSView::Layout(aRect, aStartingPoint);
+
+}
Added: trunk/themis/modules/CSSRenderer/TableCellDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableCellDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/TableCellDisplayView.hpp 2012-02-22 23:40:32 UTC (rev 673)
@@ -0,0 +1,88 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: Februari 23, 2012
+*/
+
+/* TableCellDisplayView
+ Renders css table-cell display elements
+
+ Mark Hellegers (ma...@fi...)
+ 23-02-2012
+
+*/
+
+#ifndef TABLECELLDISPLAYVIEW_HPP
+#define TABLECELLDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "CSSView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+class TableCellDisplayView : public CSSView {
+
+ public:
+ TableCellDisplayView(CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL);
+ ~TableCellDisplayView();
+ virtual void Layout(BRect aRect,
+ BPoint aStartingPoint);
+};
+
+#endif
Added: trunk/themis/modules/CSSRenderer/TableDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/TableDisplayView.cpp 2012-02-22 23:40:32 UTC (rev 673)
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: Februari 23, 2012
+*/
+
+/* TableDisplayView implementation
+ See TableDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// CSS Renderer headers
+#include "TableDisplayView.hpp"
+
+TableDisplayView :: TableDisplayView(CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont)
+ : CSSView(aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont) {
+
+ mDisplay = true;
+ mBlock = false;
+ mTable = true;
+ mTableRow = false;
+ mTableCell = false;
+
+}
+
+TableDisplayView :: ~TableDisplayView() {
+
+}
+
+void TableDisplayView :: Layout(BRect aRect,
+ BPoint aStartingPoint) {
+
+ CSSView::Layout(aRect, aStartingPoint);
+
+}
Added: trunk/themis/modules/CSSRenderer/TableDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/TableDisplayView.hpp 2012-02-22 23:40:32 UTC (rev 673)
@@ -0,0 +1,88 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: Februari 23, 2012
+*/
+
+/* TableDisplayView
+ Renders css table display elements
+
+ Mark Hellegers (ma...@fi...)
+ 23-02-2012
+
+*/
+
+#ifndef TABLEDISPLAYVIEW_HPP
+#define TABLEDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "CSSView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+class TableDisplayView : public CSSView {
+
+ public:
+ TableDisplayView(CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL);
+ ~TableDisplayView();
+ virtual void Layout(BRect aRect,
+ BPoint aStartingPoint);
+};
+
+#endif
Added: trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp 2012-02-22 23:40:32 UTC (rev 673)
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: Februari 23, 2012
+*/
+
+/* TableRowDisplayView implementation
+ See TableRowDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// CSS Renderer headers
+#include "TableRowDisplayView.hpp"
+
+TableRowDisplayView :: TableRowDisplayView(CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont)
+ : CSSView(aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont) {
+
+ mDisplay = true;
+ mBlock = false;
+ mTable = false;
+ mTableRow = true;
+ mTableCell = false;
+
+}
+
+TableRowDisplayView :: ~TableRowDisplayView() {
+
+}
+
+void TableRowDisplayView :: Layout(BRect aRect,
+ BPoint aStartingPoint) {
+
+ CSSView::Layout(aRect, aStartingPoint);
+
+}
Added: trunk/themis/modules/CSSRenderer/TableRowDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableRowDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/TableRowDisplayView.hpp 2012-02-22 23:40:32 UTC (rev 673)
@@ -0,0 +1,88 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: Februari 23, 2012
+*/
+
+/* TableRowDisplayView
+ Renders css table-row display elements
+
+ Mark Hellegers (ma...@fi...)
+ 23-02-2012
+
+*/
+
+#ifndef TABLEROWDISPLAYVIEW_HPP
+#define TABLEROWDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "CSSView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+class TableRowDisplayView : public CSSView {
+
+ public:
+ TableRowDisplayView(CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL);
+ ~TableRowDisplayView();
+ virtual void Layout(BRect aRect,
+ BPoint aStartingPoint);
+};
+
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2012-01-03 19:55:54
|
Revision: 672
http://themis.svn.sourceforge.net/themis/?rev=672&view=rev
Author: mark_hellegers
Date: 2012-01-03 19:55:48 +0000 (Tue, 03 Jan 2012)
Log Message:
-----------
Fixed TD style.
Modified Paths:
--------------
trunk/themis/modules/CSSParser/html4.css
Modified: trunk/themis/modules/CSSParser/html4.css
===================================================================
--- trunk/themis/modules/CSSParser/html4.css 2011-11-25 19:12:15 UTC (rev 671)
+++ trunk/themis/modules/CSSParser/html4.css 2012-01-03 19:55:48 UTC (rev 672)
@@ -38,5 +38,5 @@
border-width: 1px }
TD { display: table-cell;
border-style: solid;
- border-width: 1px
+ border-width: 1px;
margin-right: 2px }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: CVS C. to T. <the...@li...> - 2011-11-25 19:12:22
|
Revision: 671
http://themis.svn.sourceforge.net/themis/?rev=671&view=rev
Author: z3r0_one
Date: 2011-11-25 19:12:15 +0000 (Fri, 25 Nov 2011)
Log Message:
-----------
Added #ifndef/#else/#endif checks for HAIKU to get the CSS viewer compiling and running on Haiku, and removed the BExperimental namespace from calls to make_color()
Modified Paths:
--------------
trunk/themis/modules/CSSViewer/ColumnListView.cpp
Modified: trunk/themis/modules/CSSViewer/ColumnListView.cpp
===================================================================
--- trunk/themis/modules/CSSViewer/ColumnListView.cpp 2011-11-12 15:31:17 UTC (rev 670)
+++ trunk/themis/modules/CSSViewer/ColumnListView.cpp 2011-11-25 19:12:15 UTC (rev 671)
@@ -1931,7 +1931,11 @@
void TitleView::DrawTitle(BView *view, BRect rect, BColumn *column, bool depressed)
{
BRect drawRect;
+#ifndef HAIKU
rgb_color borderColor = mix_color(fMasterView->Color(B_COLOR_HEADER_BACKGROUND), BExperimental::make_color(0, 0, 0), 128);
+#else
+ rgb_color borderColor = mix_color(fMasterView->Color(B_COLOR_HEADER_BACKGROUND), make_color(0, 0, 0), 128);
+#endif
rgb_color backgroundColor;
rgb_color bevelHigh;
@@ -1941,15 +1945,26 @@
drawRect = rect;
drawRect.InsetBy(2, 2);
if (depressed) {
+#ifndef HAIKU
backgroundColor = mix_color(fMasterView->Color(B_COLOR_HEADER_BACKGROUND), BExperimental::make_color(0, 0, 0), 64);
bevelHigh = mix_color(backgroundColor, BExperimental::make_color(0, 0, 0), 64);
bevelLow = mix_color(backgroundColor, BExperimental::make_color(255, 255, 255), 128);
+#else
+ backgroundColor = mix_color(fMasterView->Color(B_COLOR_HEADER_BACKGROUND), make_color(0, 0, 0), 64);
+ bevelHigh = mix_color(backgroundColor, make_color(0, 0, 0), 64);
+ bevelLow = mix_color(backgroundColor, make_color(255, 255, 255), 128);
+#endif
drawRect.left++;
drawRect.top++;
} else {
backgroundColor = fMasterView->Color(B_COLOR_HEADER_BACKGROUND);
+#ifndef HAIKU
bevelHigh = mix_color(backgroundColor, BExperimental::make_color(255, 255, 255), 192);
bevelLow = mix_color(backgroundColor, BExperimental::make_color(0, 0, 0), 64);
+#else
+ bevelHigh = mix_color(backgroundColor, make_color(255, 255, 255), 192);
+ bevelLow = mix_color(backgroundColor, make_color(0, 0, 0), 64);
+#endif
drawRect.bottom--;
drawRect.right--;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|