Also look for parent-ident in parent sheetstyle(if a parent exists).
Change-Id: I39a48ae77a0f51d8c5668434edddda6c9941974e
diff --git a/src/lib/IWORKStyle.cpp b/src/lib/IWORKStyle.cpp
index 96eb44a..e7b9bea 100644
--- a/src/lib/IWORKStyle.cpp
+++ b/src/lib/IWORKStyle.cpp
@@ -9,6 +9,9 @@
#include "IWORKStyle.h"
#include <set>
#include "libetonyek_utils.h"
#include "IWORKStyleStack.h"
namespace libetonyek
@@ -41,6 +44,7 @@
if (currentStylesheet && (m_ident == m_parentIdent))
{
// checkme: do we need that? seem odd
assert(currentStylesheet->parent != currentStylesheet);
currentStylesheet = currentStylesheet->parent;
}
@@ -48,10 +52,31 @@
if (!currentStylesheet)
return false;
const IWORKStyleMap_t::const_iterator it = currentStylesheet->m_styles.find(m_parentIdent.get());
if (currentStylesheet->m_styles.end() != it)
m_parent = it->second;
std::set<IWORKStylesheet const *> seen;
do
{
if (seen.find(currentStylesheet.get())!=seen.end())
{
ETONYEK_DEBUG_MSG(("IWORKStyle::link: oops, find a looop in parent zone\n"));
break;
}
seen.insert(currentStylesheet.get());
const IWORKStyleMap_t::const_iterator it = currentStylesheet->m_styles.find(m_parentIdent.get());
if (currentStylesheet->m_styles.end() != it)
{
m_parent = it->second;
break;
}
if (currentStylesheet == currentStylesheet->parent)
currentStylesheet.reset();
else
currentStylesheet = currentStylesheet->parent;
if (!currentStylesheet)
{
ETONYEK_DEBUG_MSG(("IWORKStyle::link: can not find parent %s\n", m_parentIdent.get().c_str()));
}
}
while (currentStylesheet);
if (m_parent)
m_props.setParent(&m_parent->getPropertyMap());