Skip to content

Commit f4a234e

Browse files
committed
1 parent c04df57 commit f4a234e

File tree

8 files changed

+32
-11
lines changed

8 files changed

+32
-11
lines changed

litehtml/document.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "el_break.h"
1515
#include "el_div.h"
1616
#include "el_font.h"
17+
#include "el_tr.h"
1718
#include <math.h>
1819

1920
const wchar_t* g_empty_tags[] =
@@ -435,7 +436,7 @@ litehtml::element::ptr litehtml::document::create_element( const wchar_t* tag_na
435436
newTag = new litehtml::el_anchor(this);
436437
} else if(!_wcsicmp(tag_name, L"tr"))
437438
{
438-
newTag = new litehtml::element(this);
439+
newTag = new litehtml::el_tr(this);
439440
} else if(!_wcsicmp(tag_name, L"style"))
440441
{
441442
newTag = new litehtml::el_style(this);

litehtml/el_table.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ void litehtml::el_table::init()
383383
element* row = row_iter.next(false);
384384
while(row)
385385
{
386-
m_grid.begin_row();
386+
m_grid.begin_row(row);
387387

388388
elements_iterator cell_iter(row, &go_inside_table(), &table_cells_selector());
389389
element* cell = cell_iter.next();
@@ -409,6 +409,7 @@ void litehtml::el_table::draw( uint_ptr hdc, int x, int y, const position* clip
409409

410410
for(int row = 0; row < m_grid.rows_count(); row++)
411411
{
412+
m_grid.row(row).el_row->draw_background(hdc, pos.left(), pos.top(), clip);
412413
for(int col = 0; col < m_grid.cols_count(); col++)
413414
{
414415
table_cell* cell = m_grid.cell(col, row);

litehtml/el_td.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ void litehtml::el_td::parse_styles(bool is_reparse)
4545
const wchar_t* litehtml::el_td::get_style_property( const wchar_t* name, bool inherited, const wchar_t* def /*= 0*/ )
4646
{
4747
const wchar_t* ret = element::get_style_property(name, inherited, def);
48+
/*
4849
if(!ret)
4950
{
5051
if(m_parent && wcsstr(name, L"background"))
5152
{
5253
return m_parent->get_style_property(name, inherited, def);
5354
}
5455
}
56+
*/
5557
return ret;
5658
}

litehtml/element.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ void litehtml::element::parse_styles(bool is_reparse)
410410
m_lh_predefined = false;
411411
} else
412412
{
413-
m_line_height = m_doc->cvt_units(line_height, m_font_size);
413+
m_line_height = m_doc->cvt_units(line_height, m_font_size, m_font_size);
414414
m_lh_predefined = false;
415415
}
416416

@@ -1676,7 +1676,7 @@ bool litehtml::element::find_styles_changes( position::vector& redraw_boxes, int
16761676

16771677
if(apply)
16781678
{
1679-
if(m_display == display_inline)
1679+
if(m_display == display_inline || m_display == display_table_row)
16801680
{
16811681
position::vector boxes;
16821682
get_inline_boxes(boxes);
@@ -1981,7 +1981,7 @@ void litehtml::element::draw_background( uint_ptr hdc, int x, int y, const posit
19811981
el_pos += m_padding;
19821982
el_pos += m_borders;
19831983

1984-
if(m_display != display_inline)
1984+
if(m_display != display_inline && m_display != display_table_row)
19851985
{
19861986
if(el_pos.does_intersect(clip))
19871987
{
@@ -2236,7 +2236,7 @@ int litehtml::element::place_element( element* el, int max_width )
22362236

22372237
bool litehtml::element::is_point_inside( int x, int y )
22382238
{
2239-
if(m_display != display_inline)
2239+
if(m_display != display_inline && m_display != display_table_row)
22402240
{
22412241
position pos = m_pos;
22422242
pos += m_padding;

litehtml/element.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ namespace litehtml
181181
virtual void get_content_size(size& sz, int max_width);
182182
virtual void draw_content(uint_ptr hdc, const litehtml::position& pos);
183183
virtual void init();
184-
void get_inline_boxes(position::vector& boxes);
184+
virtual void get_inline_boxes(position::vector& boxes);
185185

186186
private:
187187
bool select_one(const std::wstring& selector);

litehtml/litehtml.vcproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,10 @@
372372
RelativePath=".\el_title.cpp"
373373
>
374374
</File>
375+
<File
376+
RelativePath=".\el_tr.cpp"
377+
>
378+
</File>
375379
<File
376380
RelativePath=".\element.cpp"
377381
>
@@ -526,6 +530,10 @@
526530
RelativePath=".\el_title.h"
527531
>
528532
</File>
533+
<File
534+
RelativePath=".\el_tr.h"
535+
>
536+
</File>
529537
<File
530538
RelativePath=".\element.h"
531539
>

litehtml/table.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ void litehtml::table_grid::add_cell( element* el )
2323
}
2424

2525

26-
void litehtml::table_grid::begin_row()
26+
void litehtml::table_grid::begin_row(element* row)
2727
{
2828
std::vector<table_cell> r;
2929
m_cells.push_back(r);
30+
31+
m_rows.push_back(table_row(0, row));
32+
3033
}
3134

3235

@@ -71,11 +74,13 @@ void litehtml::table_grid::finish()
7174
m_columns.push_back(table_column(0, 0));
7275
}
7376

77+
/*
7478
m_rows.clear();
7579
for(int i = 0; i < m_rows_count; i++)
7680
{
7781
m_rows.push_back(table_row());
7882
}
83+
*/
7984

8085
for(int col = 0; col < m_cols_count; col++)
8186
{

litehtml/table.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,25 @@ namespace litehtml
66
{
77
typedef std::vector<table_row> vector;
88

9-
int height;
9+
int height;
10+
element* el_row;
1011

1112
table_row()
1213
{
1314
height = 0;
15+
el_row = 0;
1416
}
1517

16-
table_row(int h)
18+
table_row(int h, element* row)
1719
{
1820
height = h;
21+
el_row = row;
1922
}
2023

2124
table_row(const table_row& val)
2225
{
2326
height = val.height;
27+
el_row = val.el_row;
2428
}
2529
};
2630

@@ -140,7 +144,7 @@ namespace litehtml
140144
}
141145

142146
void clear();
143-
void begin_row();
147+
void begin_row(element* row);
144148
void add_cell(element* el);
145149
bool is_rowspanned(int r, int c);
146150
void finish();

0 commit comments

Comments
 (0)