Files
palemoon27/layout/generic/nsFontInflationData.h
roytam1 50a11752b7 import changes from `devel' branch of rmottola/Arctic-Fox:
- Bug 1135903 - OdinMonkey: Make signal-handler OOB checking an independent configuration r=luke (d9f2104a2)
- Bug 1138495 - pt 0 - Reftests for font inflation in vertical writing mode, initially annotated as failing. r=smontagu (6b1a2f47d)
- Bug 1138495 - pt 1 - Rename NS_FRAME_IN_CONSTRAINED_HEIGHT flag to NS_FRAME_IN_CONSTRAINED_BSIZE, and set it appropriately according to writing mode. r=smontagu (9d1dfbe3a)
- Bug 1138495 - pt 2 - Remove failure annotations from tests that no longer fail; note that the comparison of font-inflation-1c.html vs 1d still fails (they should inflate by different amounts). r=smontagu (1e7a9a2a7)
- Bug 1138495 - pt 3 - Compute font inflation based on inline-axis dimensions rather than always using physical width. r=smontagu (d7fc87566)
- Bug 1138495 - pt 4 - Remove failure annotation from the final testcase, and add specific equality tests for the correctly-inflated rendering of 1c and 1d. r=smontagu (81de3cb59)
- Bug 1132078 - Remove useless null checks after allocating memory with |new| from xpcom/io. r=nfroyd (3c59b0993)
2019-12-13 09:04:07 +08:00

76 lines
2.2 KiB
C++

/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Per-block-formatting-context manager of font size inflation for pan and zoom UI. */
#ifndef nsFontInflationData_h_
#define nsFontInflationData_h_
#include "nsContainerFrame.h"
struct nsHTMLReflowState;
class nsFontInflationData
{
public:
static nsFontInflationData* FindFontInflationDataFor(const nsIFrame *aFrame);
// Returns whether the effective width changed (which requires the
// caller to mark its descendants dirty
static bool
UpdateFontInflationDataISizeFor(const nsHTMLReflowState& aReflowState);
static void MarkFontInflationDataTextDirty(nsIFrame *aFrame);
bool InflationEnabled() {
if (mTextDirty) {
ScanText();
}
return mInflationEnabled;
}
nscoord EffectiveISize() const {
return mNCAISize;
}
private:
explicit nsFontInflationData(nsIFrame* aBFCFrame);
nsFontInflationData(const nsFontInflationData&) = delete;
void operator=(const nsFontInflationData&) = delete;
void UpdateISize(const nsHTMLReflowState &aReflowState);
enum SearchDirection { eFromStart, eFromEnd };
static nsIFrame* FindEdgeInflatableFrameIn(nsIFrame *aFrame,
SearchDirection aDirection);
void MarkTextDirty() { mTextDirty = true; }
void ScanText();
// Scan text in the subtree rooted at aFrame. Increment mTextAmount
// by multiplying the number of characters found by the font size
// (yielding the inline-size that would be occupied by the characters if
// they were all em squares). But stop scanning if mTextAmount
// crosses mTextThreshold.
void ScanTextIn(nsIFrame *aFrame);
static const nsIFrame* FlowRootFor(const nsIFrame *aFrame)
{
while (!(aFrame->GetStateBits() & NS_FRAME_FONT_INFLATION_FLOW_ROOT)) {
aFrame = aFrame->GetParent();
}
return aFrame;
}
nsIFrame *mBFCFrame;
nscoord mNCAISize;
nscoord mTextAmount, mTextThreshold;
bool mInflationEnabled; // for this BFC
bool mTextDirty;
};
#endif /* !defined(nsFontInflationData_h_) */