From 8bdee8d2d9e0096928e41f006ff3485bb91b0149 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Thu, 2 Feb 2006 16:20:22 +0000 Subject: [PATCH] Bugzilla #38453: Bugfix: Text-decoration was not promoted if no text-decoration attribute was specified on a nested element. Nice side-effect: more efficient evaluation of text-decoration. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@374425 13f79535-47bb-0310-9956-ffa450edef68 --- .../fo/properties/CommonTextDecoration.java | 105 +++++++++--------- status.xml | 4 + .../standard-testcases/text-decoration_2.xml | 7 +- 3 files changed, 64 insertions(+), 52 deletions(-) diff --git a/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java b/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java index a48fd170f..072cb5417 100644 --- a/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java +++ b/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java @@ -1,5 +1,5 @@ /* - * Copyright 2005 The Apache Software Foundation. + * Copyright 2005-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,60 +68,63 @@ public class CommonTextDecoration { deco = calcTextDecoration(parentList); } //For rules, see XSL 1.0, chapters 5.5.6 and 7.16.4 - List list = pList.get(Constants.PR_TEXT_DECORATION).getList(); - Iterator i = list.iterator(); - while (i.hasNext()) { - Property prop = (Property)i.next(); - int prop_enum = prop.getEnum(); - if (prop_enum == Constants.EN_NONE) { - if (deco != null) { - deco.decoration = 0; - } - return deco; - } else if (prop_enum == Constants.EN_UNDERLINE) { - if (deco == null) { - deco = new CommonTextDecoration(); - } - deco.decoration |= UNDERLINE; - deco.underColor = pList.get(Constants.PR_COLOR).getColorType(); - } else if (prop_enum == Constants.EN_NO_UNDERLINE) { - if (deco != null) { - deco.decoration &= OVERLINE | LINE_THROUGH | BLINK; + Property textDecoProp = pList.getExplicit(Constants.PR_TEXT_DECORATION); + if (textDecoProp != null) { + List list = textDecoProp.getList(); + Iterator i = list.iterator(); + while (i.hasNext()) { + Property prop = (Property)i.next(); + int propEnum = prop.getEnum(); + if (propEnum == Constants.EN_NONE) { + if (deco != null) { + deco.decoration = 0; + } + return deco; + } else if (propEnum == Constants.EN_UNDERLINE) { + if (deco == null) { + deco = new CommonTextDecoration(); + } + deco.decoration |= UNDERLINE; deco.underColor = pList.get(Constants.PR_COLOR).getColorType(); - } - } else if (prop_enum == Constants.EN_OVERLINE) { - if (deco == null) { - deco = new CommonTextDecoration(); - } - deco.decoration |= OVERLINE; - deco.overColor = pList.get(Constants.PR_COLOR).getColorType(); - } else if (prop_enum == Constants.EN_NO_OVERLINE) { - if (deco != null) { - deco.decoration &= UNDERLINE | LINE_THROUGH | BLINK; + } else if (propEnum == Constants.EN_NO_UNDERLINE) { + if (deco != null) { + deco.decoration &= OVERLINE | LINE_THROUGH | BLINK; + deco.underColor = pList.get(Constants.PR_COLOR).getColorType(); + } + } else if (propEnum == Constants.EN_OVERLINE) { + if (deco == null) { + deco = new CommonTextDecoration(); + } + deco.decoration |= OVERLINE; deco.overColor = pList.get(Constants.PR_COLOR).getColorType(); - } - } else if (prop_enum == Constants.EN_LINE_THROUGH) { - if (deco == null) { - deco = new CommonTextDecoration(); - } - deco.decoration |= LINE_THROUGH; - deco.throughColor = pList.get(Constants.PR_COLOR).getColorType(); - } else if (prop_enum == Constants.EN_NO_LINE_THROUGH) { - if (deco != null) { - deco.decoration &= UNDERLINE | OVERLINE | BLINK; + } else if (propEnum == Constants.EN_NO_OVERLINE) { + if (deco != null) { + deco.decoration &= UNDERLINE | LINE_THROUGH | BLINK; + deco.overColor = pList.get(Constants.PR_COLOR).getColorType(); + } + } else if (propEnum == Constants.EN_LINE_THROUGH) { + if (deco == null) { + deco = new CommonTextDecoration(); + } + deco.decoration |= LINE_THROUGH; deco.throughColor = pList.get(Constants.PR_COLOR).getColorType(); + } else if (propEnum == Constants.EN_NO_LINE_THROUGH) { + if (deco != null) { + deco.decoration &= UNDERLINE | OVERLINE | BLINK; + deco.throughColor = pList.get(Constants.PR_COLOR).getColorType(); + } + } else if (propEnum == Constants.EN_BLINK) { + if (deco == null) { + deco = new CommonTextDecoration(); + } + deco.decoration |= BLINK; + } else if (propEnum == Constants.EN_NO_BLINK) { + if (deco != null) { + deco.decoration &= UNDERLINE | OVERLINE | LINE_THROUGH; + } + } else { + throw new PropertyException("Illegal value encountered: " + prop.getString()); } - } else if (prop_enum == Constants.EN_BLINK) { - if (deco == null) { - deco = new CommonTextDecoration(); - } - deco.decoration |= BLINK; - } else if (prop_enum == Constants.EN_NO_BLINK) { - if (deco != null) { - deco.decoration &= UNDERLINE | OVERLINE | LINE_THROUGH; - } - } else { - throw new PropertyException("Illegal value encountered: " + prop.getString()); } } return deco; diff --git a/status.xml b/status.xml index 5c17e4b58..216c6c593 100644 --- a/status.xml +++ b/status.xml @@ -27,6 +27,10 @@ + + Bugfix: Text-decoration was not promoted if no text-decoration attribute was + specified on a nested element. + Added support for the from-table-column() function. (Thanks to gerhard.oettl.at.oesoft.at for the inspiration.) diff --git a/test/layoutengine/standard-testcases/text-decoration_2.xml b/test/layoutengine/standard-testcases/text-decoration_2.xml index 04229fcc8..c481f6d2f 100644 --- a/test/layoutengine/standard-testcases/text-decoration_2.xml +++ b/test/layoutengine/standard-testcases/text-decoration_2.xml @@ -1,6 +1,6 @@ normal under through none under normal + Everything in this paragraph including this link must be underlined. @@ -84,5 +85,9 @@ + + + + -- 2.39.5