Скрыть
Обновление TeX-like форматирования
Выйдя из вечернего душа, подумалось мне, а не пофиксить ли баги в TeX. Заодно и ввел "code", пока без параметров. Вот пример:
- #ifndef nsHTMLReflowMetrics_h___
- #define nsHTMLReflowMetrics_h___
-
- #include <stdio.h>
- #include "nsISupports.h"
- #include "nsMargin.h"
- #include "nsRect.h"
- // for MOZ_MATHML
- #include "nsIRenderingContext.h" //to get struct nsBoundingMetrics
-
- //———————————————————————-
-
- // Option flags
- #define NS_REFLOW_CALC_MAX_WIDTH 0x0001
- #ifdef MOZ_MATHML
- #define NS_REFLOW_CALC_BOUNDING_METRICS 0x0002
- #endif
-
- /**
- * An nsCollapsingMargin represents a vertical collapsing margin between
- * blocks as described in section 8.3.1 of CSS2,
- * <URL: http://www.w3.org/TR/REC-CSS2/box.html#collapsing-margins >.
- *
- * All adjacent vertical margins collapse, and the resulting margin is
- * the sum of the largest positive margin included and the smallest (most
- * negative) negative margin included.
- */
- struct nsCollapsingMargin {
- private:
- nscoord mMostPos; // the largest positive margin included
- nscoord mMostNeg; // the smallest negative margin included
-
- public:
- nsCollapsingMargin()
- : mMostPos(0),
- mMostNeg(0)
- {
- }
-
- nsCollapsingMargin(const nsCollapsingMargin& aOther)
- : mMostPos(aOther.mMostPos),
- mMostNeg(aOther.mMostNeg)
- {
- }
-
- nsCollapsingMargin& operator=(const nsCollapsingMargin& aOther)
- {
- mMostPos = aOther.mMostPos;
- mMostNeg = aOther.mMostNeg;
- return *this;
- }
-
- void Include(nscoord aCoord)
- {
- if (aCoord > mMostPos)
- mMostPos = aCoord;
- else if (aCoord < mMostNeg)
- mMostNeg = aCoord;
- }
-
- void Include(const nsCollapsingMargin& aOther)
- {
- if (aOther.mMostPos > mMostPos)
- mMostPos = aOther.mMostPos;
- if (aOther.mMostNeg < mMostNeg)
- mMostNeg = aOther.mMostNeg;
- }
-
- void Zero()
- {
- mMostPos = 0;
- mMostNeg = 0;
- }
-
- PRBool IsZero() const
- {
- return (mMostPos == 0) && (mMostNeg == 0);
- }
-
- nscoord get() const
- {
- return mMostPos + mMostNeg;
- }
- };
Re:Обновление TeX-like форматирования
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.10) Gecko/2009042523 Ubuntu/9.04 (jaunty) Firefox/3.0.10