diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2014-05-10 10:19:43 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2014-05-10 10:19:43 +0000 |
| commit | 9a1a8cfc1dd26f094a6c2dce291b50ba00fe2e5b (patch) | |
| tree | 73013082beff03c323804c9376685bc27183ae4f /src | |
| parent | Documentation. Man pages udpate. (diff) | |
| download | inkscape-9a1a8cfc1dd26f094a6c2dce291b50ba00fe2e5b.tar.gz inkscape-9a1a8cfc1dd26f094a6c2dce291b50ba00fe2e5b.zip | |
Style rewrite: 'text-decoration' requires access to style of ancestor element which set property.
(bzr r13348)
Diffstat (limited to 'src')
| -rw-r--r-- | src/style-internal.cpp | 20 | ||||
| -rw-r--r-- | src/style-internal.h | 12 |
2 files changed, 24 insertions, 8 deletions
diff --git a/src/style-internal.cpp b/src/style-internal.cpp index bfe708e7a..508fb677c 100644 --- a/src/style-internal.cpp +++ b/src/style-internal.cpp @@ -2440,6 +2440,11 @@ SPITextDecoration::read( gchar const *str ) { style->text_decoration_style.set = true; style->text_decoration_color.set = true; } + + // If we set text_decoration_line, then update style_td (for CSS2 text-decoration) + if( style->text_decoration_line.set == true ) { + style_td = style; + } } // Returns CSS2 'text-decoration' (using settings in SPTextDecorationLine) @@ -2474,10 +2479,17 @@ SPITextDecoration::write( guint const flags, SPIBase const *const base) const { return Glib::ustring(""); } -// Done in SPITextDecorationLine -// void -// SPITextDecoration::cascade( const SPIBase* const parent ) { -// } +void +SPITextDecoration::cascade( const SPIBase* const parent ) { + if( const SPITextDecoration* p = dynamic_cast<const SPITextDecoration*>(parent) ) { + if( style_td == NULL ) { + style_td = p->style_td; + } + } else { + std::cerr << "SPITextDecoration::cascade(): Incorrect parent type" << std::endl; + } + +} // void // SPITextDecoration::merge( const SPIBase* const parent ) { diff --git a/src/style-internal.h b/src/style-internal.h index e9cf6e604..a806afc81 100644 --- a/src/style-internal.h +++ b/src/style-internal.h @@ -837,19 +837,20 @@ class SPITextDecorationStyle : public SPIBase { // the right style. (See http://www.w3.org/TR/css-text-decor-3/#text-decoration-property ) /// Text decoration type internal to SPStyle. -class SPITextDecoration: public SPIBase { +class SPITextDecoration : public SPIBase { public: - SPITextDecoration() : SPIBase( "text-decoration" ) {}; + SPITextDecoration() : SPIBase( "text-decoration" ), style_td( NULL ) {}; virtual ~SPITextDecoration() {}; virtual void read( gchar const *str ); virtual const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, SPIBase const *const base = NULL ) const; virtual void clear() { SPIBase::clear(); + style_td = NULL; }; - virtual void cascade( const SPIBase* const parent ) {}; // Done in SPITextDecorationLine - virtual void merge( const SPIBase* const parent ) {}; // Done in SPITextDecorationLine + virtual void cascade( const SPIBase* const parent ); + virtual void merge( const SPIBase* const parent ) {}; // FIX ME SPITextDecoration& operator=(const SPITextDecoration& rhs) { SPIBase::operator=(rhs); @@ -859,6 +860,9 @@ class SPITextDecoration: public SPIBase { // Use CSS2 value virtual bool operator==(const SPIBase& rhs); virtual bool operator!=(const SPIBase& rhs) { return !(*this == rhs); }; + + public: + SPStyle* style_td; // Style to be used for drawing CSS2 text decorations }; |
