Skip to content

Commit

Permalink
#364 Progress on pseudo classes plus cleanup of BoxBuilder.
Browse files Browse the repository at this point in the history
  • Loading branch information
danfickle committed May 25, 2021
1 parent 2bc0a97 commit d28dc9b
Show file tree
Hide file tree
Showing 7 changed files with 235 additions and 480 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ public class IdentValue implements FSDerivedValue {
* CSS footnotes for use in float: footnote
*/
public static final IdentValue FOOTNOTE = addValue("footnote");
public static final IdentValue FS_FOOTNOTE_BODY = addValue("-fs-footnote-body");

/**
* Constructor for the IdentValue object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public class CSSParser {
SUPPORTED_PSEUDO_ELEMENTS.add("before");
SUPPORTED_PSEUDO_ELEMENTS.add("after");

SUPPORTED_PSEUDO_ELEMENTS.add("footnote-call");
SUPPORTED_PSEUDO_ELEMENTS.add("footnote-marker");

CSS21_PSEUDO_ELEMENTS = new HashSet<>();
CSS21_PSEUDO_ELEMENTS.add("first-line");
CSS21_PSEUDO_ELEMENTS.add("first-letter");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,10 @@ public boolean isFootnote() {
return isIdent(CSSName.FLOAT, IdentValue.FOOTNOTE);
}

public boolean isFootnoteBody() {
return isIdent(CSSName.DISPLAY, IdentValue.FS_FOOTNOTE_BODY);
}

public boolean isRelative() {
return isIdent(CSSName.POSITION, IdentValue.RELATIVE);
}
Expand Down Expand Up @@ -1449,353 +1453,3 @@ public List<BackgroundContainer> getBackgroundImages() {
return backgrounds;
}
}

/*
* $Id$
*
* $Log$
* Revision 1.110 2010/01/12 14:33:27 peterbrant
* Ignore auto margins when calculating table min/max width. Also, when deciding whether or not to proceed with the auto margin calculation for a table, make sure we compare consistently with how the table min width is actually set.
*
* Revision 1.109 2009/11/08 23:52:48 peterbrant
* Treat percentage widths as auto when calculating min/max widths
*
* Revision 1.108 2009/05/09 14:17:41 pdoubleya
* FindBugs: static field should not be mutable; use inner class to declare CSS 4-side properties
*
* Revision 1.107 2009/04/25 10:48:42 pdoubleya
* Small opt, don't pull Ident unless needed, patch from Peter Fassev issue #263
*
* Revision 1.106 2008/12/14 19:27:16 peterbrant
* Always treat running elements as blocks
*
* Revision 1.105 2008/12/14 13:53:32 peterbrant
* Implement -fs-keep-with-inline: keep property that instructs FS to try to avoid breaking a box so that only borders and padding appear on a page
*
* Revision 1.104 2008/09/06 18:21:50 peterbrant
* Need to account for list-marker-position: inside when calculating inline min/max widths
*
* Revision 1.103 2008/08/01 22:23:54 peterbrant
* Fix various bugs related to collapsed table borders (one manifestation found by Olly Headey)
*
* Revision 1.102 2008/07/27 00:21:48 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.101 2008/07/14 11:12:37 peterbrant
* Fix two bugs when -fs-table-paginate is paginate. Block boxes in cells in a <thead> that were also early on the page could be positioned incorrectly. Line boxes contained within inline-block or inline-table content in a paginated table were generally placed incorrectly.
*
* Revision 1.100 2007/08/29 22:18:19 peterbrant
* Experiment with text justification
*
* Revision 1.99 2007/08/27 19:44:06 peterbrant
* Rename -fs-table-pagination to -fs-table-paginate
*
* Revision 1.98 2007/08/19 22:22:53 peterbrant
* Merge R8pbrant changes to HEAD
*
* Revision 1.97.2.4 2007/08/17 23:53:32 peterbrant
* Get rid of layer hack for overflow: hidden
*
* Revision 1.97.2.3 2007/08/16 22:38:48 peterbrant
* Further progress on table pagination
*
* Revision 1.97.2.2 2007/07/11 22:48:29 peterbrant
* Further progress on running headers and footers
*
* Revision 1.97.2.1 2007/07/09 22:18:04 peterbrant
* Begin work on running headers and footers and named pages
*
* Revision 1.97 2007/06/26 18:24:52 peterbrant
* Improve calculation of line-height: normal / If leading is positive, recalculate to center glyph area in inline box
*
* Revision 1.96 2007/06/19 22:31:46 peterbrant
* Only cache all zeros margin, border, padding. See discussion on bug #147 for more info.
*
* Revision 1.95 2007/06/14 22:39:31 tobega
* Handling counters in LayoutContext instead. We still need to get the value from the counter function and change list-item counting.
*
* Revision 1.94 2007/06/13 14:16:00 peterbrant
* Comment out body of resolveCounters() for now
*
* Revision 1.93 2007/06/12 22:59:23 tobega
* Handling counters is done. Now we just need to get the values appropriately.
*
* Revision 1.92 2007/06/05 19:29:54 peterbrant
* More progress on counter support
*
* Revision 1.91 2007/05/24 19:56:52 peterbrant
* Add support for cursor property (predefined cursors only)
*
* Patch from Sean Bright
*
* Revision 1.90 2007/04/16 01:10:06 peterbrant
* Vertical margin and padding with percentage values may be incorrect if box participated in a shrink-to-fit calculation. Fix margin calculation.
*
* Revision 1.89 2007/04/14 20:09:39 peterbrant
* Add method to clear cached rects
*
* Revision 1.88 2007/03/01 20:17:10 peterbrant
* Tables with collapsed borders don't have padding
*
* Revision 1.87 2007/02/28 18:16:32 peterbrant
* Support multiple values for text-decoration (per spec)
*
* Revision 1.86 2007/02/26 16:25:51 peterbrant
* Method name change to avoid confusion with visibility: hidden / Don't create empty inline boxes after all (inline layout will ignore them anyway) / Robustness improvements to generated content (treat display: table/table row groups/table-row as regular block boxes)
*
* Revision 1.85 2007/02/24 00:46:38 peterbrant
* Paint root element background over entire canvas (or it's first child if the root element doesn't define a background)
*
* Revision 1.84 2007/02/23 21:04:26 peterbrant
* Implement complete support for background-position and background-attachment
*
* Revision 1.83 2007/02/23 16:54:38 peterbrant
* Allow special ident -fs-intial-value to reset a property value to its initial value (used by border related shorthand properties as 'color' won't be known at property construction time)
*
* Revision 1.82 2007/02/22 18:21:20 peterbrant
* Add support for overflow: visible/hidden
*
* Revision 1.81 2007/02/21 01:19:12 peterbrant
* Need to take unit into account when creating Length objects with non-pixel units
*
* Revision 1.80 2007/02/20 20:05:40 peterbrant
* Complete support for absolute and relative font sizes
*
* Revision 1.79 2007/02/20 16:11:11 peterbrant
* Comment out references to CSSName.OVERFLOW
*
* Revision 1.78 2007/02/20 01:17:11 peterbrant
* Start CSS parser cleanup
*
* Revision 1.77 2007/02/20 00:01:12 peterbrant
* asColor() fix
*
* Revision 1.76 2007/02/19 23:18:43 peterbrant
* Further work on new CSS parser / Misc. bug fixes
*
* Revision 1.75 2007/02/19 14:53:43 peterbrant
* Integrate new CSS parser
*
* Revision 1.74 2007/02/07 16:33:28 peterbrant
* Initial commit of rewritten table support and associated refactorings
*
* Revision 1.73 2007/01/16 16:11:38 peterbrant
* Don't copy derived values as they propagate down the style tree (don't need to anymore
* now that we don't cache length values in LengthValue and PointValue)
*
* Revision 1.72 2006/10/04 23:52:57 peterbrant
* Implement support for margin: auto (centering blocks in their containing block)
*
* Revision 1.71 2006/09/06 22:21:43 peterbrant
* Fixes to shrink-to-fit implementation / Implement min/max-width (non-replaced content) only
*
* Revision 1.70 2006/09/01 23:49:40 peterbrant
* Implement basic margin collapsing / Various refactorings in preparation for shrink-to-fit / Add hack to treat auto margins as zero
*
* Revision 1.69 2006/08/29 17:29:14 peterbrant
* Make Style object a thing of the past
*
* Revision 1.68 2006/08/27 00:36:16 peterbrant
* Initial commit of (initial) R7 work
*
* Revision 1.67 2006/05/15 05:46:51 pdoubleya
* Return value from abs value check never assigned!
*
* Revision 1.66 2006/05/08 21:24:24 pdoubleya
* Log, don't throw exception, if we check for an absolute unit but it doesn't make sense to do so (IdentValue.hasAbsoluteUnit()).
*
* Revision 1.65 2006/05/08 20:56:09 pdoubleya
* Clean exception handling for case where assigned property value is not understood as a valid value; use initial value instead.
*
* Revision 1.64 2006/02/21 19:30:34 peterbrant
* Reset negative values for padding/border-width to 0
*
* Revision 1.63 2006/02/01 01:30:16 peterbrant
* Initial commit of PDF work
*
* Revision 1.62 2006/01/27 01:15:44 peterbrant
* Start on better support for different output devices
*
* Revision 1.61 2006/01/03 17:04:54 peterbrant
* Many pagination bug fixes / Add ability to position absolute boxes in margin area
*
* Revision 1.60 2006/01/03 02:11:15 peterbrant
* Expose asString() for all
*
* Revision 1.59 2006/01/01 02:38:22 peterbrant
* Merge more pagination work / Various minor cleanups
*
* Revision 1.58 2005/12/13 02:41:36 peterbrant
* Initial implementation of vertical-align: top/bottom (not done yet) / Minor cleanup and optimization
*
* Revision 1.57 2005/12/08 02:16:11 peterbrant
* Thread safety fix
*
* Revision 1.56 2005/12/05 00:09:04 peterbrant
* Couple of optimizations which improve layout speed by about 10%
*
* Revision 1.55 2005/11/25 16:57:26 peterbrant
* Initial commit of inline content refactoring
*
* Revision 1.54 2005/11/10 22:15:41 peterbrant
* Fix (hopefully) exception on identifiers which are converted by the CSS layer (e.g. thick becomes 3px)
*
* Revision 1.53 2005/11/08 22:53:44 tobega
* added getLineHeight method to CalculatedStyle and hacked in some list-item support
*
* Revision 1.52 2005/10/31 22:43:15 tobega
* Some memory optimization of the Matcher. Probably cleaner code, too.
*
* Revision 1.51 2005/10/31 19:02:12 pdoubleya
* support for inherited padding and margins.
*
* Revision 1.50 2005/10/31 18:01:44 pdoubleya
* InheritedLength is created per-length, to accomodate calls that need to defer to a specific parent.
*
* Revision 1.49 2005/10/31 12:38:14 pdoubleya
* Additional inheritance fixes.
*
* Revision 1.48 2005/10/31 10:16:08 pdoubleya
* Preliminary support for inherited lengths.
*
* Revision 1.47 2005/10/25 15:38:28 pdoubleya
* Moved guessType() to ValueConstants, applied fix to method suggested by Chris Oliver, to avoid exception-based catch.
*
* Revision 1.46 2005/10/25 00:38:47 tobega
* Reduced memory footprint of Matcher and stopped trying to cache the possibly uncache-able CascadedStyles, the fingerprint works just as well or better as a key in CalculatedStyle!
*
* Revision 1.45 2005/10/24 15:37:35 pdoubleya
* Caching border, margin and property instances directly.
*
* Revision 1.44 2005/10/24 10:19:40 pdoubleya
* CSSName FS_ID is now public and final, allowing direct access to the id, bypassing getAssignedID(); micro-optimization :); getAssignedID() and setAssignedID() have been removed. IdentValue string property is also final (as should have been).
*
* Revision 1.43 2005/10/22 22:58:15 peterbrant
* Box level restyle works again (really this time!)
*
* Revision 1.42 2005/10/21 23:51:48 peterbrant
* Rollback ill-advised change in revision 1.40
*
* Revision 1.41 2005/10/21 23:11:26 pdoubleya
* Store key for margin, border and padding in each style instance, was re-creating on each call.
*
* Revision 1.40 2005/10/21 23:04:02 peterbrant
* Make box level restyle work again
*
* Revision 1.39 2005/10/21 18:49:46 pdoubleya
* Fixed border painting bug.
*
* Revision 1.38 2005/10/21 18:14:59 pdoubleya
* set initial capacity for cached rects.
*
* Revision 1.37 2005/10/21 18:10:50 pdoubleya
* Support for cachable borders. Still buggy on some pages, but getting there.
*
* Revision 1.36 2005/10/21 13:02:20 pdoubleya
* Changed to cache padding in RectPropertySet.
*
* Revision 1.35 2005/10/21 12:20:04 pdoubleya
* Added array for margin side props.
*
* Revision 1.34 2005/10/21 12:16:18 pdoubleya
* Removed use of MarginPropertySet; using RectPS now.
*
* Revision 1.33 2005/10/21 12:01:13 pdoubleya
* Added cachable rect property for margin, cleanup minor in styling.
*
* Revision 1.32 2005/10/21 10:02:54 pdoubleya
* Cleanup, removed unneeded vars, reorg code in CS.
*
* Revision 1.31 2005/10/20 20:48:01 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.30 2005/10/03 23:44:43 tobega
* thread-safer css code and improved style caching
*
* Revision 1.29 2005/09/11 20:43:15 tobega
* Fixed table-css interaction bug, colspan now works again
*
* Revision 1.28 2005/07/20 22:47:33 joshy
* fix for 94, percentage for top absolute position
*
* Revision 1.27 2005/06/22 23:48:41 tobega
* Refactored the css package to allow a clean separation from the core.
*
* Revision 1.26 2005/06/21 08:23:13 pdoubleya
* Added specific list and count of primitive, non shorthand properties, and CalculatedStyle now sizes array to this size.
*
* Revision 1.25 2005/06/16 07:24:46 tobega
* Fixed background image bug.
* Caching images in browser.
* Enhanced LinkListener.
* Some house-cleaning, playing with Idea's code inspection utility.
*
* Revision 1.24 2005/06/03 23:06:21 tobega
* Now uses value of "color" as initial value for "border-color" and rgb-triples are supported
*
* Revision 1.23 2005/06/01 00:47:02 tobega
* Partly confused hack trying to get width and height working properly for replaced elements.
*
* Revision 1.22 2005/05/29 16:38:58 tobega
* Handling of ex values should now be working well. Handling of em values improved. Is it correct?
* Also started defining dividing responsibilities between Context and RenderingContext.
*
* Revision 1.21 2005/05/13 11:49:57 tobega
* Started to fix up borders on inlines. Got caught up in refactoring.
* Boxes shouldn't cache borders and stuff unless necessary. Started to remove unnecessary references.
* Hover is not working completely well now, might get better when I'm done.
*
* Revision 1.20 2005/05/09 20:35:38 tobega
* Caching fonts in CalculatedStyle
*
* Revision 1.19 2005/05/08 15:37:28 tobega
* Fixed up style caching so it really works (internalize CascadedStyles and let each CalculatedStyle keep track of its derived children)
*
* Revision 1.18 2005/05/08 14:51:21 tobega
* Removed the need for the Styler
*
* Revision 1.17 2005/05/08 14:36:54 tobega
* Refactored away the need for having a context in a CalculatedStyle
*
* Revision 1.16 2005/04/07 16:33:34 pdoubleya
* Fix border width if set to "none" in CSS (Kevin).
*
* Revision 1.15 2005/03/24 23:16:33 pdoubleya
* Added use of SharedContext (Kevin).
*
* Revision 1.14 2005/02/03 23:15:50 pdoubleya
* .
*
* Revision 1.13 2005/01/29 20:22:20 pdoubleya
* Clean/reformat code. Removed commented blocks, checked copyright.
*
* Revision 1.12 2005/01/25 12:46:12 pdoubleya
* Refactored duplicate code into separate method.
*
* Revision 1.11 2005/01/24 22:46:43 pdoubleya
* Added support for ident-checks using IdentValue instead of string comparisons.
*
* Revision 1.10 2005/01/24 19:01:05 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.9 2005/01/24 14:36:31 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.8 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.7 2004/12/05 00:48:54 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.6 2004/11/15 12:42:23 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 d28dc9b

Please sign in to comment.