Skip to content

Commit ffc141d

Browse files
Evgeniy PrudnikoviText-CI
authored andcommitted
Resolve TODOs in CssPageRule and MediaExpression
DEVSIX-6348
1 parent 4575c74 commit ffc141d

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

styled-xml-parser/src/main/java/com/itextpdf/styledxmlparser/css/media/MediaExpression.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ public boolean matches(MediaDeviceDescription deviceDescription) {
203203
*/
204204
private static float parseAbsoluteLength(String value) {
205205
if (CssTypesValidationUtils.isRelativeValue(value)) {
206-
// 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
206+
// TODO Use some shared default value (from default.css or CssDefaults)
207+
// rather than a constant of this class
207208
return CssDimensionParsingUtils.parseRelativeValue(value, DEFAULT_FONT_SIZE);
208209
} else {
209210
return CssDimensionParsingUtils.parseAbsoluteLength(value);

styled-xml-parser/src/main/java/com/itextpdf/styledxmlparser/css/page/CssMarginRule.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public CssMarginRule(String ruleName) {
7272
*/
7373
@Override
7474
public void addBodyCssDeclarations(List<CssDeclaration> cssDeclarations) {
75+
// TODO DEVSIX-6364 Fix the body declarations duplication for each pageSelector part
7576
for (ICssSelector pageSelector : pageSelectors) {
7677
this.body.add(new CssNonStandardRuleSet(new CssPageMarginBoxSelector(getRuleName(), pageSelector), cssDeclarations));
7778
}

styled-xml-parser/src/main/java/com/itextpdf/styledxmlparser/css/page/CssPageRule.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,17 @@ public CssPageRule(String ruleParameters) {
8585
*/
8686
@Override
8787
public void addBodyCssDeclarations(List<CssDeclaration> cssDeclarations) {
88-
// TODO Due to this for-loop, on toString method call for the CssPageRule instance
88+
// TODO DEVSIX-6364 Fix the body declarations duplication for each pageSelector part
89+
// Due to this for-loop, on toString method call for the CssPageRule instance
8990
// all the body declarations will be duplicated for each pageSelector part.
9091
// This potentially could lead to a nasty behaviour when declarations will double
91-
// for each read-write iteration of the same css-file (however, this use case seems
92-
// to be unlikely to happen).
93-
// Possible solution would be to split single page rule with compound selector into
92+
// for each read-write iteration of the same css-file (however, this use case seems
93+
// to be unlikely to happen).
94+
// Possible solution would be to split single page rule with compound selector into
9495
// several page rules with simple selectors on addition of the page rule to it's parent.
9596
//
9697
// Also, the same concerns this method implementation in CssMarginRule class.
97-
//
98+
//
9899
// See CssStyleSheetParserTest#test11 test.
99100
for (ICssSelector pageSelector : pageSelectors) {
100101
this.body.add(new CssNonStandardRuleSet(pageSelector, cssDeclarations));

styled-xml-parser/src/test/java/com/itextpdf/styledxmlparser/css/parse/CssStyleSheetParserTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,8 @@ public void test10() throws IOException {
135135
}
136136

137137
@Test
138+
// TODO DEVSIX-6364 Fix the body declarations duplication for each pageSelector part
138139
public void test11() throws IOException {
139-
// TODO in this test declarations of the page at-rule with compound selector are duplicated.
140-
// See CssPageRule#addBodyCssDeclarations() method for the reason and possible solution if this becomes important.
141-
142140
String cssFile = sourceFolder + "css11.css";
143141
String cmpFile = sourceFolder + "cmp_css11.css";
144142
CssStyleSheet styleSheet = CssStyleSheetParser.parse(new FileInputStream(cssFile));

0 commit comments

Comments
 (0)