mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
0c05a61d5f
- Bug 1208584 - Silence unconstrained size warning by default. r=jfkthame (31f1771976) - Bug 1248864 - Part 1: Move RestyleManager.h to EXPORTS.mozilla. r=dholbert (2ab8ae0d6a) - Bug 1248864 - Part 2: Add skeleton ServoRestyleManager and a RestyleManagerHandle smart pointer. r=dholbert (8c9e032edc) - Bug 1248864 - Part 3: Use RestyleManagerHandle instead of concrete restyle manager class. r=dholbert (ec282e77fa) - Bug 1237825. Find the root scroll frame even if the root element doesn't have a primary frame. r=mstange (ed4f14ebd4) - Bug 1237813. Refactor nsLayoutUtils::FindScrollableFrameFor to use GetScrollFrameFromContent. r=botond (403968c84c) - Bug 1238777: Bail early from ComputeSnappedImageDrawingParameters if we're somehow drawing from a 0-sized subimage. r=tn (da3ccc27f0) - Bug 1250377 - Part 1: Use MOZ_STYLO environment variable to switch on Servo-backed style system. r=bholley (4ce8d0bcf0) - Bug 1250377 - Part 2: Stub out enough ServoStyleSet methods to be able to create one for a document. r=bholley (1ef3b5c843) - Bug 1250377 - Part 3: Create a ServoStyleSet for HTML documents in content docshells. r=bholley (4ed1a5e6fc) - Bug 1250790 - Don't try to add CSSStyleSheets from the style sheet service to a ServoStyleSet. r=bholley (f1291300d7) - Bug 1247478: Rename FirstAdditionalAuthorSheet() to GetFirstAdditionalAuthorSheet(), since it can return null. r=heycam (cffd112172) - Bug 1253007 - part 1 - use UniquePtr for RangePaintInfo in nsPresShell.cpp; r=dholbert (ad14ef91b7) - Bug 1253007 - part 2 - pass a const& to PaintRangePaintInfo; rs=dholbert (9317f5b704) - Bug 1171371 - On memory-pressure, remove any stale images from the visible images list. r=tn (9108fdc561) - Bug 1251150. Add some crash annotations to try to track down a crash bug. r=dholbert (0b81d26d89) - Bug 1257315 (Part 1) - Add a visualization of visibility tracking to the APZ minimap. r=botond,mattwoodrow (c15a5ce0f8) - Bug 1257315 (Part 2) - Release old visible regions info when new info is available or a layers ID is no longer used. r=botond (3c5a1fb6e0) - Rename PCompositor to PCompositorBridge. (bug 1258479 part 1, r=mattwoodrow) (77390ba817) - Bug 1134385. Silk documentation. r=kats (23f43fa035) - Bug 1134385 follow-up - fix link to image in documentation. DONTBUILD because NPOTB. r=me (68809f8347) - Bug 1238743 - remove a bogus assertion in TextureClient.cpp. r=kats (6b10b546c5) - Bug 1241484 - Null check mActor in WaitForCompositorRecycle. r=nical (95f848830f) - Bug 1250117 - Fix b2g timeouts when gralloc is disabled. r=sotaro (2e67d92251) - Bug 1250117 - Trivial b2g build fix. r=me (9fab71821d) - Bug 1249273 - Enable BufferTextureHost to recycle a TextureSource that is not marked as owned. r=sotaro (f09b043af6) - Bug 1250500 - Avoid copying BufferTextureHost when possible. r=sotaro (8f44549c6c) - Bug 1248323: P1. Add support for YUV422 IOSurface. r=nical (e3eb53aa1c) - Bug 1248323: P2. Add readback code for converting YUV422 MacIOSurfaces into RGB. r=nical (d93574fd13) - Bug 1248323: P3. Add test for NV12/YUV422 readback. r=me (5373a2f839) - Bug 1249273 - Lazily prepare TextureSources and recycle them when possible in ImageHost. r=sotaro (66bb273c84) - Bug 1251910: Fix YUV422 IOSurface. r=mattwoodrow. (bfdbb2f60b)
206 lines
7.2 KiB
C++
206 lines
7.2 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* 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/. */
|
|
|
|
#include "nsMathMLTokenFrame.h"
|
|
#include "nsPresContext.h"
|
|
#include "nsContentUtils.h"
|
|
#include "nsTextFrame.h"
|
|
#include "mozilla/RestyleManager.h"
|
|
#include <algorithm>
|
|
|
|
using namespace mozilla;
|
|
|
|
nsIFrame*
|
|
NS_NewMathMLTokenFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
|
{
|
|
return new (aPresShell) nsMathMLTokenFrame(aContext);
|
|
}
|
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsMathMLTokenFrame)
|
|
|
|
nsMathMLTokenFrame::~nsMathMLTokenFrame()
|
|
{
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsMathMLTokenFrame::InheritAutomaticData(nsIFrame* aParent)
|
|
{
|
|
// let the base class get the default from our parent
|
|
nsMathMLContainerFrame::InheritAutomaticData(aParent);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
eMathMLFrameType
|
|
nsMathMLTokenFrame::GetMathMLFrameType()
|
|
{
|
|
// treat everything other than <mi> as ordinary...
|
|
if (!mContent->IsMathMLElement(nsGkAtoms::mi_)) {
|
|
return eMathMLFrameType_Ordinary;
|
|
}
|
|
|
|
uint8_t mathVariant = StyleFont()->mMathVariant;
|
|
if ((mathVariant == NS_MATHML_MATHVARIANT_NONE &&
|
|
(StyleFont()->mFont.style == NS_STYLE_FONT_STYLE_ITALIC ||
|
|
HasAnyStateBits(NS_FRAME_IS_IN_SINGLE_CHAR_MI))) ||
|
|
mathVariant == NS_MATHML_MATHVARIANT_ITALIC ||
|
|
mathVariant == NS_MATHML_MATHVARIANT_BOLD_ITALIC ||
|
|
mathVariant == NS_MATHML_MATHVARIANT_SANS_SERIF_ITALIC ||
|
|
mathVariant == NS_MATHML_MATHVARIANT_SANS_SERIF_BOLD_ITALIC) {
|
|
return eMathMLFrameType_ItalicIdentifier;
|
|
}
|
|
return eMathMLFrameType_UprightIdentifier;
|
|
}
|
|
|
|
void
|
|
nsMathMLTokenFrame::MarkTextFramesAsTokenMathML()
|
|
{
|
|
nsIFrame* child = nullptr;
|
|
uint32_t childCount = 0;
|
|
|
|
// Set flags on child text frames
|
|
// - to force them to trim their leading and trailing whitespaces.
|
|
// - Indicate which frames are suitable for mathvariant
|
|
// - flag single character <mi> frames for special italic treatment
|
|
for (nsIFrame* childFrame = PrincipalChildList().FirstChild(); childFrame;
|
|
childFrame = childFrame->GetNextSibling()) {
|
|
for (nsIFrame* childFrame2 = childFrame->PrincipalChildList().FirstChild();
|
|
childFrame2; childFrame2 = childFrame2->GetNextSibling()) {
|
|
if (childFrame2->GetType() == nsGkAtoms::textFrame) {
|
|
childFrame2->AddStateBits(TEXT_IS_IN_TOKEN_MATHML);
|
|
child = childFrame2;
|
|
childCount++;
|
|
}
|
|
}
|
|
}
|
|
if (mContent->IsMathMLElement(nsGkAtoms::mi_) && childCount == 1) {
|
|
nsAutoString data;
|
|
nsContentUtils::GetNodeTextContent(mContent, false, data);
|
|
|
|
data.CompressWhitespace();
|
|
int32_t length = data.Length();
|
|
|
|
bool isSingleCharacter = length == 1 ||
|
|
(length == 2 && NS_IS_HIGH_SURROGATE(data[0]));
|
|
|
|
if (isSingleCharacter) {
|
|
child->AddStateBits(NS_FRAME_IS_IN_SINGLE_CHAR_MI);
|
|
AddStateBits(NS_FRAME_IS_IN_SINGLE_CHAR_MI);
|
|
}
|
|
}
|
|
}
|
|
|
|
void
|
|
nsMathMLTokenFrame::SetInitialChildList(ChildListID aListID,
|
|
nsFrameList& aChildList)
|
|
{
|
|
// First, let the base class do its work
|
|
nsMathMLContainerFrame::SetInitialChildList(aListID, aChildList);
|
|
MarkTextFramesAsTokenMathML();
|
|
}
|
|
|
|
void
|
|
nsMathMLTokenFrame::AppendFrames(ChildListID aListID,
|
|
nsFrameList& aChildList)
|
|
{
|
|
nsMathMLContainerFrame::AppendFrames(aListID, aChildList);
|
|
MarkTextFramesAsTokenMathML();
|
|
}
|
|
|
|
void
|
|
nsMathMLTokenFrame::InsertFrames(ChildListID aListID,
|
|
nsIFrame* aPrevFrame,
|
|
nsFrameList& aChildList)
|
|
{
|
|
nsMathMLContainerFrame::InsertFrames(aListID, aPrevFrame, aChildList);
|
|
MarkTextFramesAsTokenMathML();
|
|
}
|
|
|
|
void
|
|
nsMathMLTokenFrame::Reflow(nsPresContext* aPresContext,
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
const nsHTMLReflowState& aReflowState,
|
|
nsReflowStatus& aStatus)
|
|
{
|
|
MarkInReflow();
|
|
mPresentationData.flags &= ~NS_MATHML_ERROR;
|
|
|
|
// initializations needed for empty markup like <mtag></mtag>
|
|
aDesiredSize.ClearSize();
|
|
aDesiredSize.SetBlockStartAscent(0);
|
|
aDesiredSize.mBoundingMetrics = nsBoundingMetrics();
|
|
|
|
for (nsIFrame* childFrame : PrincipalChildList()) {
|
|
// ask our children to compute their bounding metrics
|
|
nsHTMLReflowMetrics childDesiredSize(aReflowState.GetWritingMode(),
|
|
aDesiredSize.mFlags
|
|
| NS_REFLOW_CALC_BOUNDING_METRICS);
|
|
WritingMode wm = childFrame->GetWritingMode();
|
|
LogicalSize availSize = aReflowState.ComputedSize(wm);
|
|
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
|
nsHTMLReflowState childReflowState(aPresContext, aReflowState,
|
|
childFrame, availSize);
|
|
ReflowChild(childFrame, aPresContext, childDesiredSize,
|
|
childReflowState, aStatus);
|
|
//NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
|
|
SaveReflowAndBoundingMetricsFor(childFrame, childDesiredSize,
|
|
childDesiredSize.mBoundingMetrics);
|
|
}
|
|
|
|
// place and size children
|
|
FinalizeReflow(aReflowState.rendContext->GetDrawTarget(), aDesiredSize);
|
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
|
}
|
|
|
|
// For token elements, mBoundingMetrics is computed at the ReflowToken
|
|
// pass, it is not computed here because our children may be text frames
|
|
// that do not implement the GetBoundingMetrics() interface.
|
|
/* virtual */ nsresult
|
|
nsMathMLTokenFrame::Place(DrawTarget* aDrawTarget,
|
|
bool aPlaceOrigin,
|
|
nsHTMLReflowMetrics& aDesiredSize)
|
|
{
|
|
mBoundingMetrics = nsBoundingMetrics();
|
|
for (nsIFrame* childFrame :PrincipalChildList()) {
|
|
nsHTMLReflowMetrics childSize(aDesiredSize.GetWritingMode());
|
|
GetReflowAndBoundingMetricsFor(childFrame, childSize,
|
|
childSize.mBoundingMetrics, nullptr);
|
|
// compute and cache the bounding metrics
|
|
mBoundingMetrics += childSize.mBoundingMetrics;
|
|
}
|
|
|
|
RefPtr<nsFontMetrics> fm =
|
|
nsLayoutUtils::GetInflatedFontMetricsForFrame(this);
|
|
nscoord ascent = fm->MaxAscent();
|
|
nscoord descent = fm->MaxDescent();
|
|
|
|
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
|
aDesiredSize.Width() = mBoundingMetrics.width;
|
|
aDesiredSize.SetBlockStartAscent(std::max(mBoundingMetrics.ascent, ascent));
|
|
aDesiredSize.Height() = aDesiredSize.BlockStartAscent() +
|
|
std::max(mBoundingMetrics.descent, descent);
|
|
|
|
if (aPlaceOrigin) {
|
|
nscoord dy, dx = 0;
|
|
for (nsIFrame* childFrame : PrincipalChildList()) {
|
|
nsHTMLReflowMetrics childSize(aDesiredSize.GetWritingMode());
|
|
GetReflowAndBoundingMetricsFor(childFrame, childSize,
|
|
childSize.mBoundingMetrics);
|
|
|
|
// place and size the child; (dx,0) makes the caret happy - bug 188146
|
|
dy = childSize.Height() == 0 ? 0 : aDesiredSize.BlockStartAscent() - childSize.BlockStartAscent();
|
|
FinishReflowChild(childFrame, PresContext(), childSize, nullptr, dx, dy, 0);
|
|
dx += childSize.Width();
|
|
}
|
|
}
|
|
|
|
SetReference(nsPoint(0, aDesiredSize.BlockStartAscent()));
|
|
|
|
return NS_OK;
|
|
}
|
|
|