Skip to content

Commit

Permalink
#364 Finally got boxing correct including for block content in footno…
Browse files Browse the repository at this point in the history
…tes.

Also cleanup and documentation around styling code.
  • Loading branch information
danfickle committed Jun 14, 2021
1 parent c1af88d commit f6d67fe
Show file tree
Hide file tree
Showing 11 changed files with 239 additions and 511 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,192 +268,3 @@ public void setSupportCMYKColors(boolean b) {
_stylesheetFactory.setSupportCMYKColors(b);
}
}

/*
* $Id$
*
* $Log$
* Revision 1.22 2008/07/27 00:21:46 peterbrant
* Implement CMYK color support for PDF output, starting with patch from Mykola Gurov / Banish java.awt.Color from FS core layout classes
*
* Revision 1.21 2008/04/04 13:32:38 peterbrant
* Fix method name
*
* Revision 1.20 2008/04/04 13:28:38 peterbrant
* Make sure user agent is provided to StyleReference when it's modified / Light cleanup
*
* Revision 1.19 2008/01/22 00:29:23 peterbrant
* Need to propagate changes to user agent in SharedContext to containing StyleReference
*
* Revision 1.18 2007/10/31 23:14:42 peterbrant
* Add rudimentary support for @font-face rules
*
* Revision 1.17 2007/08/19 22:22:52 peterbrant
* Merge R8pbrant changes to HEAD
*
* Revision 1.16.2.1 2007/07/09 22:18:04 peterbrant
* Begin work on running headers and footers and named pages
*
* Revision 1.16 2007/05/26 19:04:13 peterbrant
* Implement support for removing all references to a particular Element (in order to support limited dynamic DOM changes)
*
* Revision 1.15 2007/05/20 23:25:34 peterbrant
* Various code cleanups (e.g. remove unused imports)
*
* Patch from Sean Bright
*
* Revision 1.14 2007/05/16 22:27:14 peterbrant
* Only load default stylesheet once
*
* Revision 1.13 2007/02/20 23:44:51 peterbrant
* Minor formatting change
*
* Revision 1.12 2007/02/20 01:17:10 peterbrant
* Start CSS parser cleanup
*
* Revision 1.11 2007/02/19 14:53:42 peterbrant
* Integrate new CSS parser
*
* Revision 1.10 2006/09/11 19:23:29 peterbrant
* Parse element styles all at once
*
* Revision 1.9 2006/08/27 00:36:14 peterbrant
* Initial commit of (initial) R7 work
*
* Revision 1.8 2006/01/03 23:02:37 peterbrant
* Remove unused variable
*
* Revision 1.7 2005/12/30 01:32:43 peterbrant
* First merge of parts of pagination work
*
* Revision 1.6 2005/11/11 01:33:15 peterbrant
* Add ability to clear all cached stylesheets
*
* Revision 1.5 2005/10/27 00:08:51 tobega
* Sorted out Context into RenderingContext and LayoutContext
*
* Revision 1.4 2005/06/26 15:48:10 tobega
* Converted to almost standard html4 default css, which shook out a bug: position should not inherit
*
* Revision 1.3 2005/06/25 19:27:46 tobega
* UAC now supplies Resources
*
* Revision 1.2 2005/06/23 17:03:40 tobega
* css now independent of DOM
*
* Revision 1.1 2005/06/22 23:48:40 tobega
* Refactored the css package to allow a clean separation from the core.
*
* Revision 1.34 2005/06/16 12:59:23 pdoubleya
* Cleaned up support for reloading documents.
*
* Revision 1.33 2005/06/16 11:29:12 pdoubleya
* First cut support for reload page, flushes inline stylesheets.
*
* Revision 1.32 2005/06/16 07:24:48 tobega
* Fixed background image bug.
* Caching images in browser.
* Enhanced LinkListener.
* Some house-cleaning, playing with Idea's code inspection utility.
*
* Revision 1.31 2005/06/15 11:53:45 tobega
* Changed UserAgentCallback to getInputStream instead of getReader. Fixed up some consequences of previous change.
*
* Revision 1.30 2005/06/01 21:36:37 tobega
* Got image scaling working, and did some refactoring along the way
*
* Revision 1.29 2005/05/17 06:56:23 tobega
* Inline backgrounds now work correctly, as does mixing of inlines and blocks for style inheritance
*
* Revision 1.28 2005/05/08 15:37:29 tobega
* Fixed up style caching so it really works (internalize CascadedStyles and let each CalculatedStyle keep track of its derived children)
*
* Revision 1.27 2005/05/08 14:51:22 tobega
* Removed the need for the Styler
*
* Revision 1.26 2005/05/08 14:36:54 tobega
* Refactored away the need for having a context in a CalculatedStyle
*
* Revision 1.25 2005/03/24 23:18:38 pdoubleya
* Added use of SharedContext (Kevin).
*
* Revision 1.24 2005/01/29 20:19:22 pdoubleya
* Clean/reformat code. Removed commented blocks, checked copyright.
*
* Revision 1.23 2005/01/29 12:49:24 pdoubleya
* Fixed cast on get...PropertiesMap().
*
* Revision 1.22 2005/01/24 19:01:09 pdoubleya
* Mass checkin. Changed to use references to CSSName, which now has a Singleton instance for each property, everywhere property names were being used before. Removed commented code. Cascaded and Calculated style now store properties in arrays rather than maps, for optimization.
*
* Revision 1.21 2005/01/24 14:36:30 pdoubleya
* Mass commit, includes: updated for changes to property declaration instantiation, and new use of DerivedValue. Removed any references to older XR... classes (e.g. XRProperty). Cleaned imports.
*
* Revision 1.20 2005/01/16 18:50:03 tobega
* Re-introduced caching of styles, which make hamlet and alice scroll nicely again. Background painting still slow though.
*
* Revision 1.19 2005/01/08 15:56:54 tobega
* Further work on extensibility interfaces. Documented it - see website.
*
* Revision 1.18 2005/01/08 11:55:16 tobega
* Started massaging the extension interfaces
*
* Revision 1.17 2005/01/04 10:19:11 tobega
* resolve selectors to styles direcly on match, should reduce memory footprint and not affect speed very much.
*
* Revision 1.16 2005/01/03 23:40:40 tobega
* Cleaned out unnecessary styling/matching code. styling/matching is now called during boxing/rendering rather than as a separate stage.
*
* Revision 1.15 2004/12/29 10:39:27 tobega
* Separated current state Context into LayoutContext and the rest into SharedContext.
*
* Revision 1.14 2004/12/28 01:48:22 tobega
* More cleaning. Magically, the financial report demo is starting to look reasonable, without any effort being put on it.
*
* Revision 1.13 2004/12/11 18:18:08 tobega
* Still broken, won't even compile at the moment. Working hard to fix it, though. Replace the StyleReference interface with our only concrete implementation, it was a bother changing in two places all the time.
*
* Revision 1.22 2004/12/05 18:11:36 tobega
* Now uses style cache for pseudo-element styles. Also started preparing to replace inline node handling with inline content handling.
*
* Revision 1.21 2004/12/05 14:35:38 tobega
* Cleaned up some usages of Node (and removed unused stuff) in layout code. The goal is to pass "better" objects than Node wherever possible in an attempt to shake out the bugs in tree-traversal (probably often unnecessary tree-traversal)
*
* Revision 1.20 2004/12/05 00:48:53 tobega
* Cleaned up so that now all property-lookups use the CalculatedStyle. Also added support for relative values of top, left, width, etc.
*
* Revision 1.19 2004/12/02 19:46:35 tobega
* Refactored handling of inline styles to fit with StylesheetInfo and media handling (is also now correct if there should be more than one style element)
*
* Revision 1.18 2004/12/01 14:02:51 joshy
* modified media to use the value from the rendering context
* added the inline-block box
* - j
*
* Revision 1.17 2004/11/30 23:47:56 tobega
* At-media rules should now work (not tested). Also fixed at-import rules, which got broken at previous modification.
*
* Revision 1.16 2004/11/29 23:25:37 tobega
* Had to redo thinking about Stylesheets and StylesheetInfos. Now StylesheetInfos are passed around instead of Stylesheets because any Stylesheet should only be linked to its URI. Bonus: the external sheets get lazy-loaded only if needed for the medium.
*
* Revision 1.15 2004/11/28 23:29:00 tobega
* Now handles media on Stylesheets, still need to handle at-media-rules. The media-type should be set in Context.media (set by default to "screen") before calling setContext on StyleReference.
*
* Revision 1.14 2004/11/15 22:22:08 tobega
* Now handles @import stylesheets
*
* Revision 1.13 2004/11/15 19:46:13 tobega
* Refactoring in preparation for handling @import stylesheets
*
* Revision 1.12 2004/11/15 12:42:22 pdoubleya
* Across this checkin (all may not apply to this particular file)
* Changed default/package-access members to private.
* Changed to use XRRuntimeException where appropriate.
* Began move from System.err.println to std logging.
* Standard code reformat.
* Removed some unnecessary SAC member variables that were only used in initialization.
* CVS log section.
*
*
*/

Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public class CascadedStyle {
/**
* Map of PropertyDeclarations, keyed by {@link CSSName}
*/
private Map<CSSName, PropertyDeclaration> cascadedProperties;
private final Map<CSSName, PropertyDeclaration> cascadedProperties;

private String fingerprint;

/**
Expand Down Expand Up @@ -136,8 +136,9 @@ private CascadedStyle(CascadedStyle startingPoint, Iterator<PropertyDeclaration>
private CascadedStyle() {
cascadedProperties = new TreeMap<>();
}

/**
* Creates a <code>CascadedStyle</code>, setting the display property to
* Creates an otherwise empty <code>CascadedStyle</code>, setting the display property
* to the value of the <code>display</code> parameter.
*/
public static CascadedStyle createAnonymousStyle(IdentValue display) {
Expand Down Expand Up @@ -190,8 +191,9 @@ private void addProperties(java.util.Iterator<PropertyDeclaration> iter) {
* @return True if the property is defined in this set.
*/
public boolean hasProperty(CSSName cssName) {
return cascadedProperties.get(cssName) != null;
return cascadedProperties.containsKey(cssName);
}

/**
* Returns a {@link com.openhtmltopdf.css.sheet.PropertyDeclaration} by CSS
* property name, e.g. "font-family". Properties are already cascaded during
Expand Down Expand Up @@ -243,75 +245,4 @@ public String getFingerprint() {
}
return this.fingerprint;
}
}// end class

/*
* $Id$
*
* $Log$
* Revision 1.19 2007/10/31 23:14:41 peterbrant
* Add rudimentary support for @font-face rules
*
* Revision 1.18 2007/04/12 12:29:11 peterbrant
* Properly handle floated tables with captions
*
* Revision 1.17 2007/02/20 17:23:15 peterbrant
* Optimize fingerprint calculation
*
* Revision 1.16 2007/02/20 01:17:09 peterbrant
* Start CSS parser cleanup
*
* Revision 1.15 2007/02/07 16:33:14 peterbrant
* Initial commit of rewritten table support and associated refactorings
*
* Revision 1.14 2006/06/15 20:02:39 tobega
* Using a TreeMap to get properties in sorted order should be able to reduce the size of the caches in CalculatedStyle when styles are the same apart from order of declaration of properties.
*
* Revision 1.13 2006/01/09 23:22:24 peterbrant
* Cache fingerprint after initial creation
*
* Revision 1.12 2005/10/20 20:48:02 pdoubleya
* Updates for refactoring to style classes. CalculatedStyle now has lookup methods to cover all general cases, so propertyByName() is private, which means the backing classes for styling were able to be replaced.
*
* Revision 1.11 2005/06/21 08:06:47 pdoubleya
* Changed to use Map of properties again.
*
* Revision 1.10 2005/05/16 13:48:58 tobega
* Fixe inline border mismatch and started on styling problem in switching between blocks and inlines
*
* Revision 1.9 2005/05/08 15:37:26 tobega
* Fixed up style caching so it really works (internalize CascadedStyles and let each CalculatedStyle keep track of its derived children)
*
* Revision 1.8 2005/05/08 13:02:36 tobega
* Fixed a bug whereby styles could get lost for inline elements, notably if root element was inline. Did a few other things which probably has no importance at this moment, e.g. refactored out some unused stuff.
*
* Revision 1.7 2005/04/20 14:13:07 tobega
* Issue number:
* Obtained from:
* Submitted by:
* Reviewed by:
*
* Revision 1.6 2005/01/29 20:22:25 pdoubleya
* Clean/reformat code. Removed commented blocks, checked copyright.
*
* Revision 1.5 2005/01/25 14:45:55 pdoubleya
* Added support for IdentValue mapping on property declarations. On both CascadedStyle and PropertyDeclaration you can now request the value as an IdentValue, for object-object comparisons. Updated 99% of references that used to get the string value of PD to return the IdentValue instead; remaining cases are for pseudo-elements where the PD content needs to be manipulated as a String.
*
* Revision 1.4 2005/01/24 19:01:06 pdoubleya
* Mass checkin. Changed to use references to CSSName, which now has a Singleton instance for each property, everywhere property names were being used before. Removed commented code. Cascaded and Calculated style now store properties in arrays rather than maps, for optimization.
*
* Revision 1.3 2004/11/15 13:40:14 pdoubleya
* Updated JavaDoc.
*
* Revision 1.2 2004/11/15 12:42:22 pdoubleya
* Across this checkin (all may not apply to this particular file)
* Changed default/package-access members to private.
* Changed to use XRRuntimeException where appropriate.
* Began move from System.err.println to std logging.
* Standard code reformat.
* Removed some unnecessary SAC member variables that were only used in initialization.
* CVS log section.
*
*
*/

}
Loading

0 comments on commit f6d67fe

Please sign in to comment.