From 67826f3ab237f673a7959a0456bdcb63c021f2c6 Mon Sep 17 00:00:00 2001 From: Joanmarie Diggs Date: Fri, 20 Jun 2014 15:00:38 -0400 Subject: [PATCH] GLib: Correct poppler_structure_element_get_table_{row,column}_span() As per the PDF spec, cell elements (TD and TH) have row and column spans; table elements do not. --- glib/poppler-structure-element.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/glib/poppler-structure-element.cc b/glib/poppler-structure-element.cc index fdde41e..e5008a4 100644 --- a/glib/poppler-structure-element.cc +++ b/glib/poppler-structure-element.cc @@ -2111,7 +2111,7 @@ poppler_structure_element_get_form_description (PopplerStructureElement *poppler * poppler_structure_element_get_table_row_span: * @poppler_structure_element: A #PopplerStructureElement * - * Obtains the number of rows the table element spans to. + * Obtains the number of rows the table cell element spans to. * * Return value: A positive, non-zero value. * @@ -2120,7 +2120,9 @@ poppler_structure_element_get_form_description (PopplerStructureElement *poppler guint poppler_structure_element_get_table_row_span (PopplerStructureElement *poppler_structure_element) { - g_return_val_if_fail (poppler_structure_element_get_kind (poppler_structure_element) == POPPLER_STRUCTURE_ELEMENT_TABLE, 0); + PopplerStructureElementKind kind = poppler_structure_element_get_kind (poppler_structure_element); + + g_return_val_if_fail (kind == POPPLER_STRUCTURE_ELEMENT_TABLE_DATA || kind == POPPLER_STRUCTURE_ELEMENT_TABLE_HEADING, 0); return static_cast (attr_value_or_default (poppler_structure_element, Attribute::RowSpan)->getInt ()); } @@ -2129,7 +2131,7 @@ poppler_structure_element_get_table_row_span (PopplerStructureElement *poppler_s * poppler_structure_element_get_table_column_span: * @poppler_structure_element: A #PopplerStructureElement * - * Obtains the number of columns the table element spans to. + * Obtains the number of columns the table cell element spans to. * * Return value: A positive, non-zero value. * @@ -2138,7 +2140,9 @@ poppler_structure_element_get_table_row_span (PopplerStructureElement *poppler_s guint poppler_structure_element_get_table_column_span (PopplerStructureElement *poppler_structure_element) { - g_return_val_if_fail (poppler_structure_element_get_kind (poppler_structure_element) == POPPLER_STRUCTURE_ELEMENT_TABLE, 0); + PopplerStructureElementKind kind = poppler_structure_element_get_kind (poppler_structure_element); + + g_return_val_if_fail (kind == POPPLER_STRUCTURE_ELEMENT_TABLE_DATA || kind == POPPLER_STRUCTURE_ELEMENT_TABLE_HEADING, 0); return static_cast (attr_value_or_default (poppler_structure_element, Attribute::ColSpan)->getInt ()); } -- 1.9.3