Skip to content

Commit c26a5a4

Browse files
Evgeniy PrudnikoviText-CI
authored andcommitted
Resolve TODOs in CssPageRule and MediaExpression
DEVSIX-6348 Autoported commit. Original commit hash: [ffc141d09]
1 parent bc7b691 commit c26a5a4

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

itext.tests/itext.styledxmlparser.tests/itext/styledxmlparser/css/parse/CssStyleSheetParserTest.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ public virtual void Test10() {
139139

140140
[NUnit.Framework.Test]
141141
public virtual void Test11() {
142-
// TODO in this test declarations of the page at-rule with compound selector are duplicated.
143-
// See CssPageRule#addBodyCssDeclarations() method for the reason and possible solution if this becomes important.
142+
// TODO DEVSIX-6364 Fix the body declarations duplication for each pageSelector part
144143
String cssFile = sourceFolder + "css11.css";
145144
String cmpFile = sourceFolder + "cmp_css11.css";
146145
CssStyleSheet styleSheet = CssStyleSheetParser.Parse(new FileStream(cssFile, FileMode.Open, FileAccess.Read

itext/itext.styledxmlparser/itext/styledxmlparser/css/media/MediaExpression.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ public virtual bool Matches(MediaDeviceDescription deviceDescription) {
241241
/// </returns>
242242
private static float ParseAbsoluteLength(String value) {
243243
if (CssTypesValidationUtils.IsRelativeValue(value)) {
244-
// TODO here should be used default font size of the browser, it probably should be fetched from the more generic place than private class constant
244+
// TODO Use some shared default value (from default.css or CssDefaults)
245+
// rather than a constant of this class
245246
return CssDimensionParsingUtils.ParseRelativeValue(value, DEFAULT_FONT_SIZE);
246247
}
247248
else {

itext/itext.styledxmlparser/itext/styledxmlparser/css/page/CssMarginRule.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public CssMarginRule(String ruleName)
6868
* @see com.itextpdf.styledxmlparser.css.CssNestedAtRule#addBodyCssDeclarations(java.util.List)
6969
*/
7070
public override void AddBodyCssDeclarations(IList<CssDeclaration> cssDeclarations) {
71+
// TODO DEVSIX-6364 Fix the body declarations duplication for each pageSelector part
7172
foreach (ICssSelector pageSelector in pageSelectors) {
7273
this.body.Add(new CssNonStandardRuleSet(new CssPageMarginBoxSelector(GetRuleName(), pageSelector), cssDeclarations
7374
));

itext/itext.styledxmlparser/itext/styledxmlparser/css/page/CssPageRule.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,17 @@ public CssPageRule(String ruleParameters)
7777
* @see com.itextpdf.styledxmlparser.css.CssNestedAtRule#addBodyCssDeclarations(java.util.List)
7878
*/
7979
public override void AddBodyCssDeclarations(IList<CssDeclaration> cssDeclarations) {
80-
// TODO Due to this for-loop, on toString method call for the CssPageRule instance
80+
// TODO DEVSIX-6364 Fix the body declarations duplication for each pageSelector part
81+
// Due to this for-loop, on toString method call for the CssPageRule instance
8182
// all the body declarations will be duplicated for each pageSelector part.
8283
// This potentially could lead to a nasty behaviour when declarations will double
83-
// for each read-write iteration of the same css-file (however, this use case seems
84-
// to be unlikely to happen).
85-
// Possible solution would be to split single page rule with compound selector into
84+
// for each read-write iteration of the same css-file (however, this use case seems
85+
// to be unlikely to happen).
86+
// Possible solution would be to split single page rule with compound selector into
8687
// several page rules with simple selectors on addition of the page rule to it's parent.
8788
//
8889
// Also, the same concerns this method implementation in CssMarginRule class.
89-
//
90+
//
9091
// See CssStyleSheetParserTest#test11 test.
9192
foreach (ICssSelector pageSelector in pageSelectors) {
9293
this.body.Add(new CssNonStandardRuleSet(pageSelector, cssDeclarations));

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4575c74eaf100c0151ee203e9eac8aa2fa794de5
1+
ffc141d097ec67efe16fc83fbf565125712f9da4

0 commit comments

Comments
 (0)