mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
merge mozilla-inbound to mozilla-central a=merge
This commit is contained in:
commit
a661b33faa
@ -251,8 +251,6 @@ GetAccService()
|
||||
inline bool
|
||||
IPCAccessibilityActive()
|
||||
{
|
||||
// XXX temporarily disable ipc accessibility because of crashes.
|
||||
return false;
|
||||
#ifdef MOZ_B2G
|
||||
return false;
|
||||
#else
|
||||
|
@ -23,7 +23,8 @@ public:
|
||||
|
||||
ProxyAccessible(uint64_t aID, ProxyAccessible* aParent,
|
||||
DocAccessibleParent* aDoc, role aRole) :
|
||||
mParent(aParent), mDoc(aDoc), mID(aID), mRole(aRole), mOuterDoc(false)
|
||||
mParent(aParent), mDoc(aDoc), mWrapper(0), mID(aID), mRole(aRole),
|
||||
mOuterDoc(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(ProxyAccessible);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ _SUBDIR_CONFIG_ARGS="$ac_configure_args"
|
||||
dnl Set the version number of the libs included with mozilla
|
||||
dnl ========================================================
|
||||
MOZJPEG=62
|
||||
MOZPNG=10614
|
||||
MOZPNG=10616
|
||||
NSPR_VERSION=4
|
||||
NSPR_MINVER=4.10.3
|
||||
NSS_VERSION=3
|
||||
@ -2674,11 +2674,7 @@ AC_SUBST(VISIBILITY_FLAGS)
|
||||
|
||||
MOZ_GCC_PR49911
|
||||
MOZ_GCC_PR39608
|
||||
if test "$OS_TARGET" != WINNT; then
|
||||
# Only run this test with clang on non-Windows platforms, because clang
|
||||
# cannot do enough code gen for now to make this test work correctly.
|
||||
MOZ_LLVM_PR8927
|
||||
fi
|
||||
MOZ_LLVM_PR8927
|
||||
|
||||
dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
|
||||
dnl ========================================================
|
||||
|
@ -10,7 +10,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1024926
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=946529">Mozilla Bug 1024926</a>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1024926">Mozilla Bug 1024926</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<svg width="100%" height="1" id="svg">
|
||||
|
@ -9677,6 +9677,10 @@
|
||||
> cysteine/M
|
||||
19536a25296
|
||||
> decertify/DSGNX
|
||||
19759c25519
|
||||
< deliverable/U
|
||||
---
|
||||
> deliverable/US
|
||||
19935a25696
|
||||
> dequeue/DSG
|
||||
19999a25761
|
||||
@ -10430,6 +10434,10 @@
|
||||
< member/EAS
|
||||
---
|
||||
> member/EASM
|
||||
32386c38086
|
||||
< men
|
||||
---
|
||||
> men/M
|
||||
32708a38409
|
||||
> might've
|
||||
32717a38419
|
||||
@ -10461,6 +10469,10 @@
|
||||
< mister's
|
||||
---
|
||||
> mister/M
|
||||
33083c38784
|
||||
< mitigation/M
|
||||
---
|
||||
> mitigation/MS
|
||||
33107,33108c38808
|
||||
< mob's
|
||||
< mob/CS
|
||||
|
@ -25788,7 +25788,7 @@ delirious/PY
|
||||
deliriousness/M
|
||||
delirium/SM
|
||||
deliver/ADGS
|
||||
deliverable/U
|
||||
deliverable/US
|
||||
deliverance/M
|
||||
delivered/U
|
||||
deliverer/SM
|
||||
@ -38384,7 +38384,7 @@ memorize/DSG
|
||||
memorized/U
|
||||
memory/SM
|
||||
memsahib/S
|
||||
men
|
||||
men/M
|
||||
menace/MGDS
|
||||
menacing/Y
|
||||
menage/MS
|
||||
@ -39086,7 +39086,7 @@ mite/MZRS
|
||||
miter/MDG
|
||||
mitigate/DSGN
|
||||
mitigated/U
|
||||
mitigation/M
|
||||
mitigation/MS
|
||||
mitigatory
|
||||
mitochondria
|
||||
mitochondrial
|
||||
|
@ -277,7 +277,6 @@ struct SK_API SkIRect {
|
||||
rectangle. If either rectangle is empty, do nothing and return false.
|
||||
*/
|
||||
bool intersect(const SkIRect& a, const SkIRect& b) {
|
||||
SkASSERT(&a && &b);
|
||||
|
||||
if (!a.isEmpty() && !b.isEmpty() &&
|
||||
a.fLeft < b.fRight && b.fLeft < a.fRight &&
|
||||
@ -298,7 +297,6 @@ struct SK_API SkIRect {
|
||||
we assert that both rectangles are non-empty.
|
||||
*/
|
||||
bool intersectNoEmptyCheck(const SkIRect& a, const SkIRect& b) {
|
||||
SkASSERT(&a && &b);
|
||||
SkASSERT(!a.isEmpty() && !b.isEmpty());
|
||||
|
||||
if (a.fLeft < b.fRight && b.fLeft < a.fRight &&
|
||||
|
@ -129,7 +129,7 @@ public:
|
||||
*/
|
||||
int appendAction(const char label[], SkEventSinkID target);
|
||||
int appendList(const char label[], const char slotName[],
|
||||
SkEventSinkID target, int defaultIndex, const char[] ...);
|
||||
SkEventSinkID target, int defaultIndex, const char* ...);
|
||||
int appendSlider(const char label[], const char slotName[],
|
||||
SkEventSinkID target, SkScalar min, SkScalar max,
|
||||
SkScalar defaultValue);
|
||||
|
@ -1067,7 +1067,7 @@ void SkMatrix::mapVectors(SkPoint dst[], const SkPoint src[], int count) const {
|
||||
}
|
||||
|
||||
bool SkMatrix::mapRect(SkRect* dst, const SkRect& src) const {
|
||||
SkASSERT(dst && &src);
|
||||
SkASSERT(dst);
|
||||
|
||||
if (this->rectStaysRect()) {
|
||||
this->mapPoints((SkPoint*)dst, (const SkPoint*)&src, 2);
|
||||
|
@ -114,12 +114,10 @@ bool SkRect::intersect(SkScalar left, SkScalar top, SkScalar right,
|
||||
}
|
||||
|
||||
bool SkRect::intersect(const SkRect& r) {
|
||||
SkASSERT(&r);
|
||||
return this->intersect(r.fLeft, r.fTop, r.fRight, r.fBottom);
|
||||
}
|
||||
|
||||
bool SkRect::intersect2(const SkRect& r) {
|
||||
SkASSERT(&r);
|
||||
SkScalar L = SkMaxScalar(fLeft, r.fLeft);
|
||||
SkScalar R = SkMinScalar(fRight, r.fRight);
|
||||
if (L >= R) {
|
||||
@ -135,7 +133,6 @@ bool SkRect::intersect2(const SkRect& r) {
|
||||
}
|
||||
|
||||
bool SkRect::intersect(const SkRect& a, const SkRect& b) {
|
||||
SkASSERT(&a && &b);
|
||||
|
||||
if (!a.isEmpty() && !b.isEmpty() &&
|
||||
a.fLeft < b.fRight && b.fLeft < a.fRight &&
|
||||
|
@ -432,7 +432,7 @@ static SkEdge* sort_edges(SkEdge* list[], int count, SkEdge** last) {
|
||||
void sk_fill_path(const SkPath& path, const SkIRect* clipRect, SkBlitter* blitter,
|
||||
int start_y, int stop_y, int shiftEdgesUp,
|
||||
const SkRegion& clipRgn) {
|
||||
SkASSERT(&path && blitter);
|
||||
SkASSERT(blitter);
|
||||
|
||||
SkEdgeBuilder builder;
|
||||
|
||||
|
@ -1337,7 +1337,7 @@ void SkScalerContext_FreeType::generatePath(const SkGlyph& glyph,
|
||||
SkPath* path) {
|
||||
SkAutoMutexAcquire ac(gFTMutex);
|
||||
|
||||
SkASSERT(&glyph && path);
|
||||
SkASSERT(path);
|
||||
|
||||
if (this->setupSize()) {
|
||||
path->reset();
|
||||
|
@ -167,7 +167,7 @@ void SkTextBox::setSpacing(SkScalar mul, SkScalar add)
|
||||
|
||||
void SkTextBox::draw(SkCanvas* canvas, const char text[], size_t len, const SkPaint& paint)
|
||||
{
|
||||
SkASSERT(canvas && &paint && (text || len == 0));
|
||||
SkASSERT(canvas && (text || len == 0));
|
||||
|
||||
SkScalar marginWidth = fBox.width();
|
||||
|
||||
|
@ -17,7 +17,7 @@ void SkView::Artist::draw(SkView* view, SkCanvas* canvas)
|
||||
|
||||
void SkView::Artist::inflate(const SkDOM& dom, const SkDOM::Node* node)
|
||||
{
|
||||
SkASSERT(&dom && node);
|
||||
SkASSERT(node);
|
||||
this->onInflate(dom, node);
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ void SkView::Layout::layoutChildren(SkView* parent)
|
||||
|
||||
void SkView::Layout::inflate(const SkDOM& dom, const SkDOM::Node* node)
|
||||
{
|
||||
SkASSERT(&dom && node);
|
||||
SkASSERT(node);
|
||||
this->onInflate(dom, node);
|
||||
}
|
||||
|
||||
|
@ -2244,11 +2244,7 @@ AC_SUBST(VISIBILITY_FLAGS)
|
||||
|
||||
MOZ_GCC_PR49911
|
||||
MOZ_GCC_PR39608
|
||||
if test "$OS_TARGET" != WINNT; then
|
||||
# Only run this test with clang on non-Windows platforms, because clang
|
||||
# cannot do enough code gen for now to make this test work correctly.
|
||||
MOZ_LLVM_PR8927
|
||||
fi
|
||||
MOZ_LLVM_PR8927
|
||||
|
||||
dnl Checks for header files.
|
||||
dnl ========================================================
|
||||
|
@ -96,10 +96,16 @@
|
||||
return;
|
||||
}
|
||||
|
||||
window.focus();
|
||||
// Run the test in a separate window so we get a clean browser window.
|
||||
win = window.open("data:text/html,<html style='overflow:scroll'>",
|
||||
"", "scrollbars=yes,toolbar,menubar,width=500,height=500");
|
||||
setTimeout(setupWindow, 0);
|
||||
}
|
||||
|
||||
function setupWindow() {
|
||||
win.addEventListener("load", doTest, false);
|
||||
win.focus();
|
||||
}
|
||||
|
||||
nextTest();
|
||||
|
24
layout/generic/RubyReflowState.cpp
Normal file
24
layout/generic/RubyReflowState.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
/* states and methods used while laying out a ruby segment */
|
||||
|
||||
#include "RubyReflowState.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
RubyReflowState::RubyReflowState(
|
||||
WritingMode aLineWM,
|
||||
const nsTArray<nsRubyTextContainerFrame*>& aTextContainers)
|
||||
: mCurrentContainerIndex(kBaseContainerIndex)
|
||||
{
|
||||
uint32_t rtcCount = aTextContainers.Length();
|
||||
mTextContainers.SetCapacity(rtcCount);
|
||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||
mTextContainers.AppendElement(
|
||||
TextContainerInfo(aLineWM, aTextContainers[i]));
|
||||
}
|
||||
}
|
68
layout/generic/RubyReflowState.h
Normal file
68
layout/generic/RubyReflowState.h
Normal file
@ -0,0 +1,68 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
/* states and methods used while laying out a ruby segment */
|
||||
|
||||
#ifndef mozilla_RubyReflowState_h_
|
||||
#define mozilla_RubyReflowState_h_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "WritingModes.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#define RTC_ARRAY_SIZE 1
|
||||
|
||||
class nsRubyTextContainerFrame;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class MOZ_STACK_CLASS RubyReflowState MOZ_FINAL
|
||||
{
|
||||
public:
|
||||
explicit RubyReflowState(
|
||||
WritingMode aLineWM,
|
||||
const nsTArray<nsRubyTextContainerFrame*>& aTextContainers);
|
||||
|
||||
struct TextContainerInfo
|
||||
{
|
||||
nsRubyTextContainerFrame* mFrame;
|
||||
LogicalSize mLineSize;
|
||||
|
||||
TextContainerInfo(WritingMode aLineWM, nsRubyTextContainerFrame* aFrame)
|
||||
: mFrame(aFrame)
|
||||
, mLineSize(aLineWM) { }
|
||||
};
|
||||
|
||||
void AdvanceCurrentContainerIndex() { mCurrentContainerIndex++; }
|
||||
|
||||
void SetTextContainerInfo(int32_t aIndex,
|
||||
nsRubyTextContainerFrame* aContainer,
|
||||
const LogicalSize& aLineSize)
|
||||
{
|
||||
MOZ_ASSERT(mTextContainers[aIndex].mFrame == aContainer);
|
||||
mTextContainers[aIndex].mLineSize = aLineSize;
|
||||
}
|
||||
|
||||
const TextContainerInfo&
|
||||
GetCurrentTextContainerInfo(nsRubyTextContainerFrame* aFrame) const
|
||||
{
|
||||
MOZ_ASSERT(mTextContainers[mCurrentContainerIndex].mFrame == aFrame);
|
||||
return mTextContainers[mCurrentContainerIndex];
|
||||
}
|
||||
|
||||
private:
|
||||
static MOZ_CONSTEXPR_VAR int32_t kBaseContainerIndex = -1;
|
||||
// The index of the current reflowing container. When it equals to
|
||||
// kBaseContainerIndex, we are reflowing ruby base. Otherwise, it
|
||||
// stands for the index of text containers in the ruby segment.
|
||||
int32_t mCurrentContainerIndex;
|
||||
|
||||
nsAutoTArray<TextContainerInfo, RTC_ARRAY_SIZE> mTextContainers;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // mozilla_RubyReflowState_h_
|
@ -5,7 +5,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "RubyUtils.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -42,3 +41,20 @@ RubyUtils::GetReservedISize(nsIFrame* aFrame)
|
||||
value.mPointer = aFrame->Properties().Get(ReservedISize());
|
||||
return value.mCoord;
|
||||
}
|
||||
|
||||
RubyTextContainerIterator::RubyTextContainerIterator(
|
||||
nsRubyBaseContainerFrame* aBaseContainer)
|
||||
{
|
||||
mFrame = aBaseContainer;
|
||||
Next();
|
||||
}
|
||||
|
||||
void
|
||||
RubyTextContainerIterator::Next()
|
||||
{
|
||||
MOZ_ASSERT(mFrame, "Should have checked AtEnd()");
|
||||
mFrame = mFrame->GetNextSibling();
|
||||
if (mFrame && mFrame->GetType() != nsGkAtoms::rubyTextContainerFrame) {
|
||||
mFrame = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,8 @@
|
||||
#define mozilla_RubyUtils_h_
|
||||
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsRubyBaseContainerFrame.h"
|
||||
#include "nsRubyTextContainerFrame.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -58,6 +59,26 @@ public:
|
||||
static nscoord GetReservedISize(nsIFrame* aFrame);
|
||||
};
|
||||
|
||||
/**
|
||||
* This class iterates all ruby text containers paired with
|
||||
* the given ruby base container.
|
||||
*/
|
||||
class MOZ_STACK_CLASS RubyTextContainerIterator
|
||||
{
|
||||
public:
|
||||
explicit RubyTextContainerIterator(nsRubyBaseContainerFrame* aBaseContainer);
|
||||
|
||||
void Next();
|
||||
bool AtEnd() const { return !mFrame; }
|
||||
nsRubyTextContainerFrame* GetTextContainer() const
|
||||
{
|
||||
return static_cast<nsRubyTextContainerFrame*>(mFrame);
|
||||
}
|
||||
|
||||
private:
|
||||
nsIFrame* mFrame;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* !defined(mozilla_RubyUtils_h_) */
|
||||
|
@ -94,6 +94,7 @@ UNIFIED_SOURCES += [
|
||||
'nsTextRunTransformations.cpp',
|
||||
'nsVideoFrame.cpp',
|
||||
'nsViewportFrame.cpp',
|
||||
'RubyReflowState.cpp',
|
||||
'RubyUtils.cpp',
|
||||
'ScrollbarActivity.cpp',
|
||||
'StickyScrollContainer.cpp',
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "nsInlineFrame.h"
|
||||
#include "nsPlaceholderFrame.h"
|
||||
#include "nsRubyTextFrame.h"
|
||||
#include "nsRubyTextContainerFrame.h"
|
||||
#include "nsSVGContainerFrame.h"
|
||||
#include "nsTableCellFrame.h"
|
||||
#include "nsTableRowFrame.h"
|
||||
|
@ -523,6 +523,13 @@ FRAME_STATE_GROUP(RubyText, nsRubyTextFrame)
|
||||
FRAME_STATE_BIT(RubyText, 24, NS_RUBY_TEXT_FRAME_AUTOHIDE)
|
||||
|
||||
|
||||
// == Frame state bits that apply to ruby text container frames ===============
|
||||
|
||||
FRAME_STATE_GROUP(RubyTextContainer, nsRubyTextContainerFrame)
|
||||
|
||||
FRAME_STATE_BIT(RubyTextContainer, 20, NS_RUBY_TEXT_CONTAINER_IS_SPAN)
|
||||
|
||||
|
||||
// == Frame state bits that apply to placeholder frames =======================
|
||||
|
||||
FRAME_STATE_GROUP(Placeholder, nsPlaceholderFrame)
|
||||
|
@ -72,6 +72,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext,
|
||||
AvailableBSize() = aAvailableSpace.BSize(mWritingMode);
|
||||
mFloatManager = nullptr;
|
||||
mLineLayout = nullptr;
|
||||
mRubyReflowState = nullptr;
|
||||
memset(&mFlags, 0, sizeof(mFlags));
|
||||
mDiscoveredClearance = nullptr;
|
||||
mPercentHeightObserver = nullptr;
|
||||
@ -207,6 +208,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext,
|
||||
mLineLayout = aParentReflowState.mLineLayout;
|
||||
else
|
||||
mLineLayout = nullptr;
|
||||
mRubyReflowState = nullptr;
|
||||
|
||||
// Note: mFlags was initialized as a copy of aParentReflowState.mFlags up in
|
||||
// this constructor's init list, so the only flags that we need to explicitly
|
||||
|
@ -21,6 +21,10 @@ class nsLineLayout;
|
||||
class nsIPercentHeightObserver;
|
||||
struct nsHypotheticalBox;
|
||||
|
||||
namespace mozilla {
|
||||
class RubyReflowState;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return aValue clamped to [aMinValue, aMaxValue].
|
||||
*
|
||||
@ -258,6 +262,9 @@ struct nsHTMLReflowState : public nsCSSOffsetState {
|
||||
// LineLayout object (only for inline reflow; set to nullptr otherwise)
|
||||
nsLineLayout* mLineLayout;
|
||||
|
||||
// RubyReflowState object (only for ruby reflow; set to nullptr otherwise)
|
||||
mozilla::RubyReflowState* mRubyReflowState;
|
||||
|
||||
// The appropriate reflow state for the containing block (for
|
||||
// percentage widths, etc.) of this reflow state's frame.
|
||||
const nsHTMLReflowState *mCBReflowState;
|
||||
|
@ -66,6 +66,7 @@ nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
|
||||
mForceBreakFrameOffset(-1),
|
||||
mMinLineBSize(0),
|
||||
mTextIndent(0),
|
||||
mRubyReflowState(nullptr),
|
||||
mFirstLetterStyleOK(false),
|
||||
mIsTopOfPage(false),
|
||||
mImpactedByFloats(false),
|
||||
@ -868,6 +869,10 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
||||
aFrame, availSize);
|
||||
nsHTMLReflowState& reflowState = *reflowStateHolder;
|
||||
reflowState.mLineLayout = this;
|
||||
if (mRubyReflowState) {
|
||||
reflowState.mRubyReflowState = mRubyReflowState;
|
||||
mRubyReflowState = nullptr;
|
||||
}
|
||||
reflowState.mFlags.mIsTopOfPage = mIsTopOfPage;
|
||||
if (reflowState.ComputedISize() == NS_UNCONSTRAINEDSIZE) {
|
||||
reflowState.AvailableISize() = availableSpaceOnLine;
|
||||
|
@ -27,6 +27,10 @@
|
||||
class nsFloatManager;
|
||||
struct nsStyleText;
|
||||
|
||||
namespace mozilla {
|
||||
class RubyReflowState;
|
||||
}
|
||||
|
||||
class nsLineLayout {
|
||||
public:
|
||||
/**
|
||||
@ -98,6 +102,13 @@ public:
|
||||
|
||||
bool IsZeroBSize();
|
||||
|
||||
// The ruby layout will be passed to the next frame to be reflowed
|
||||
// via the HTML reflow state.
|
||||
void SetRubyReflowState(mozilla::RubyReflowState* aRubyReflowState)
|
||||
{
|
||||
mRubyReflowState = aRubyReflowState;
|
||||
}
|
||||
|
||||
// Reflows the frame and returns the reflow status. aPushedFrame is true
|
||||
// if the frame is pushed to the next line because it doesn't fit.
|
||||
void ReflowFrame(nsIFrame* aFrame,
|
||||
@ -558,6 +569,10 @@ protected:
|
||||
int32_t mLineNumber;
|
||||
mozilla::JustificationInfo mJustificationInfo;
|
||||
|
||||
// The ruby layout for the next frame to be reflowed.
|
||||
// It is reset every time it is used.
|
||||
mozilla::RubyReflowState* mRubyReflowState;
|
||||
|
||||
int32_t mTotalPlacedFrames;
|
||||
|
||||
nscoord mBStartEdge;
|
||||
|
@ -55,11 +55,23 @@ nsRubyBaseContainerFrame::GetFrameName(nsAString& aResult) const
|
||||
}
|
||||
#endif
|
||||
|
||||
class MOZ_STACK_CLASS PairEnumerator
|
||||
/**
|
||||
* Ruby column is a unit consists of one ruby base and all ruby
|
||||
* annotations paired with it.
|
||||
* See http://dev.w3.org/csswg/css-ruby/#ruby-pairing
|
||||
*/
|
||||
struct MOZ_STACK_CLASS mozilla::RubyColumn
|
||||
{
|
||||
nsIFrame* mBaseFrame;
|
||||
nsAutoTArray<nsIFrame*, RTC_ARRAY_SIZE> mTextFrames;
|
||||
RubyColumn() : mBaseFrame(nullptr) { }
|
||||
};
|
||||
|
||||
class MOZ_STACK_CLASS RubyColumnEnumerator
|
||||
{
|
||||
public:
|
||||
PairEnumerator(nsRubyBaseContainerFrame* aRBCFrame,
|
||||
const nsTArray<nsRubyTextContainerFrame*>& aRTCFrames);
|
||||
RubyColumnEnumerator(nsRubyBaseContainerFrame* aRBCFrame,
|
||||
const nsTArray<nsRubyTextContainerFrame*>& aRTCFrames);
|
||||
|
||||
void Next();
|
||||
bool AtEnd() const;
|
||||
@ -68,27 +80,31 @@ public:
|
||||
nsIFrame* GetFrame(uint32_t aIndex) const { return mFrames[aIndex]; }
|
||||
nsIFrame* GetBaseFrame() const { return GetFrame(0); }
|
||||
nsIFrame* GetTextFrame(uint32_t aIndex) const { return GetFrame(aIndex + 1); }
|
||||
void GetFrames(nsIFrame*& aBaseFrame, nsTArray<nsIFrame*>& aTextFrames) const;
|
||||
void GetColumn(RubyColumn& aColumn) const;
|
||||
|
||||
private:
|
||||
nsAutoTArray<nsIFrame*, RTC_ARRAY_SIZE + 1> mFrames;
|
||||
};
|
||||
|
||||
PairEnumerator::PairEnumerator(
|
||||
nsRubyBaseContainerFrame* aBaseContainer,
|
||||
const nsTArray<nsRubyTextContainerFrame*>& aTextContainers)
|
||||
RubyColumnEnumerator::RubyColumnEnumerator(
|
||||
nsRubyBaseContainerFrame* aBaseContainer,
|
||||
const nsTArray<nsRubyTextContainerFrame*>& aTextContainers)
|
||||
{
|
||||
const uint32_t rtcCount = aTextContainers.Length();
|
||||
mFrames.SetCapacity(rtcCount + 1);
|
||||
mFrames.AppendElement(aBaseContainer->GetFirstPrincipalChild());
|
||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||
nsIFrame* rtFrame = aTextContainers[i]->GetFirstPrincipalChild();
|
||||
nsRubyTextContainerFrame* container = aTextContainers[i];
|
||||
// If the container is for span, leave a nullptr here.
|
||||
// Spans do not take part in pairing.
|
||||
nsIFrame* rtFrame = !container->IsSpanContainer() ?
|
||||
aTextContainers[i]->GetFirstPrincipalChild() : nullptr;
|
||||
mFrames.AppendElement(rtFrame);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PairEnumerator::Next()
|
||||
RubyColumnEnumerator::Next()
|
||||
{
|
||||
for (uint32_t i = 0, iend = mFrames.Length(); i < iend; i++) {
|
||||
if (mFrames[i]) {
|
||||
@ -98,7 +114,7 @@ PairEnumerator::Next()
|
||||
}
|
||||
|
||||
bool
|
||||
PairEnumerator::AtEnd() const
|
||||
RubyColumnEnumerator::AtEnd() const
|
||||
{
|
||||
for (uint32_t i = 0, iend = mFrames.Length(); i < iend; i++) {
|
||||
if (mFrames[i]) {
|
||||
@ -109,33 +125,18 @@ PairEnumerator::AtEnd() const
|
||||
}
|
||||
|
||||
void
|
||||
PairEnumerator::GetFrames(nsIFrame*& aBaseFrame,
|
||||
nsTArray<nsIFrame*>& aTextFrames) const
|
||||
RubyColumnEnumerator::GetColumn(RubyColumn& aColumn) const
|
||||
{
|
||||
aBaseFrame = mFrames[0];
|
||||
aTextFrames.ClearAndRetainStorage();
|
||||
aColumn.mBaseFrame = mFrames[0];
|
||||
aColumn.mTextFrames.ClearAndRetainStorage();
|
||||
for (uint32_t i = 1, iend = mFrames.Length(); i < iend; i++) {
|
||||
aTextFrames.AppendElement(mFrames[i]);
|
||||
aColumn.mTextFrames.AppendElement(mFrames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsRubyBaseContainerFrame::CalculateMaxSpanISize(
|
||||
nsRenderingContext* aRenderingContext)
|
||||
{
|
||||
nscoord max = 0;
|
||||
uint32_t spanCount = mSpanContainers.Length();
|
||||
for (uint32_t i = 0; i < spanCount; i++) {
|
||||
nsIFrame* frame = mSpanContainers[i]->GetFirstPrincipalChild();
|
||||
nscoord isize = frame->GetPrefISize(aRenderingContext);
|
||||
max = std::max(max, isize);
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
static nscoord
|
||||
CalculatePairPrefISize(nsRenderingContext* aRenderingContext,
|
||||
const PairEnumerator& aEnumerator)
|
||||
CalculateColumnPrefISize(nsRenderingContext* aRenderingContext,
|
||||
const RubyColumnEnumerator& aEnumerator)
|
||||
{
|
||||
nscoord max = 0;
|
||||
uint32_t levelCount = aEnumerator.GetLevelCount();
|
||||
@ -152,19 +153,25 @@ CalculatePairPrefISize(nsRenderingContext* aRenderingContext,
|
||||
nsRubyBaseContainerFrame::AddInlineMinISize(
|
||||
nsRenderingContext *aRenderingContext, nsIFrame::InlineMinISizeData *aData)
|
||||
{
|
||||
if (!mSpanContainers.IsEmpty()) {
|
||||
// Since spans are not breakable internally, use our pref isize
|
||||
// directly if there is any span.
|
||||
aData->currentLine += GetPrefISize(aRenderingContext);
|
||||
return;
|
||||
AutoTextContainerArray textContainers;
|
||||
GetTextContainers(textContainers);
|
||||
|
||||
for (uint32_t i = 0, iend = textContainers.Length(); i < iend; i++) {
|
||||
if (textContainers[i]->IsSpanContainer()) {
|
||||
// Since spans are not breakable internally, use our pref isize
|
||||
// directly if there is any span.
|
||||
aData->currentLine += GetPrefISize(aRenderingContext);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nscoord max = 0;
|
||||
PairEnumerator enumerator(this, mTextContainers);
|
||||
RubyColumnEnumerator enumerator(this, textContainers);
|
||||
for (; !enumerator.AtEnd(); enumerator.Next()) {
|
||||
// We use *pref* isize for computing the min isize of pairs
|
||||
// We use *pref* isize for computing the min isize of columns
|
||||
// because ruby bases and texts are unbreakable internally.
|
||||
max = std::max(max, CalculatePairPrefISize(aRenderingContext, enumerator));
|
||||
max = std::max(max, CalculateColumnPrefISize(aRenderingContext,
|
||||
enumerator));
|
||||
}
|
||||
aData->currentLine += max;
|
||||
}
|
||||
@ -173,12 +180,20 @@ nsRubyBaseContainerFrame::AddInlineMinISize(
|
||||
nsRubyBaseContainerFrame::AddInlinePrefISize(
|
||||
nsRenderingContext *aRenderingContext, nsIFrame::InlinePrefISizeData *aData)
|
||||
{
|
||||
AutoTextContainerArray textContainers;
|
||||
GetTextContainers(textContainers);
|
||||
|
||||
nscoord sum = 0;
|
||||
PairEnumerator enumerator(this, mTextContainers);
|
||||
RubyColumnEnumerator enumerator(this, textContainers);
|
||||
for (; !enumerator.AtEnd(); enumerator.Next()) {
|
||||
sum += CalculatePairPrefISize(aRenderingContext, enumerator);
|
||||
sum += CalculateColumnPrefISize(aRenderingContext, enumerator);
|
||||
}
|
||||
for (uint32_t i = 0, iend = textContainers.Length(); i < iend; i++) {
|
||||
if (textContainers[i]->IsSpanContainer()) {
|
||||
nsIFrame* frame = textContainers[i]->GetFirstPrincipalChild();
|
||||
sum = std::max(sum, frame->GetPrefISize(aRenderingContext));
|
||||
}
|
||||
}
|
||||
sum = std::max(sum, CalculateMaxSpanISize(aRenderingContext));
|
||||
aData->currentLine += sum;
|
||||
}
|
||||
|
||||
@ -189,26 +204,13 @@ nsRubyBaseContainerFrame::IsFrameOfType(uint32_t aFlags) const
|
||||
~(nsIFrame::eLineParticipant));
|
||||
}
|
||||
|
||||
void nsRubyBaseContainerFrame::AppendTextContainer(nsIFrame* aFrame)
|
||||
void
|
||||
nsRubyBaseContainerFrame::GetTextContainers(TextContainerArray& aTextContainers)
|
||||
{
|
||||
nsRubyTextContainerFrame* rtcFrame = do_QueryFrame(aFrame);
|
||||
MOZ_ASSERT(rtcFrame, "Must provide a ruby text container.");
|
||||
|
||||
nsTArray<nsRubyTextContainerFrame*>* containers = &mTextContainers;
|
||||
if (!GetPrevContinuation() && !GetNextContinuation()) {
|
||||
nsIFrame* onlyChild = rtcFrame->PrincipalChildList().OnlyChild();
|
||||
if (onlyChild && onlyChild->IsPseudoFrame(rtcFrame->GetContent())) {
|
||||
// Per CSS Ruby spec, if the only child of an rtc frame is
|
||||
// a pseudo rt frame, it spans all bases in the segment.
|
||||
containers = &mSpanContainers;
|
||||
}
|
||||
MOZ_ASSERT(aTextContainers.IsEmpty());
|
||||
for (RubyTextContainerIterator iter(this); !iter.AtEnd(); iter.Next()) {
|
||||
aTextContainers.AppendElement(iter.GetTextContainer());
|
||||
}
|
||||
containers->AppendElement(rtcFrame);
|
||||
}
|
||||
|
||||
void nsRubyBaseContainerFrame::ClearTextContainers() {
|
||||
mSpanContainers.Clear();
|
||||
mTextContainers.Clear();
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
@ -238,6 +240,14 @@ nsRubyBaseContainerFrame::GetLogicalBaseline(WritingMode aWritingMode) const
|
||||
return mBaseline;
|
||||
}
|
||||
|
||||
struct nsRubyBaseContainerFrame::ReflowState
|
||||
{
|
||||
bool mAllowLineBreak;
|
||||
const TextContainerArray& mTextContainers;
|
||||
const nsHTMLReflowState& mBaseReflowState;
|
||||
const nsTArray<UniquePtr<nsHTMLReflowState>>& mTextReflowStates;
|
||||
};
|
||||
|
||||
// Check whether the given extra isize can fit in the line in base level.
|
||||
static bool
|
||||
ShouldBreakBefore(const nsHTMLReflowState& aReflowState, nscoord aExtraISize)
|
||||
@ -266,20 +276,22 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
"No line layout provided to RubyBaseContainerFrame reflow method.");
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(aReflowState.mRubyReflowState, "No ruby reflow state provided");
|
||||
|
||||
AutoTextContainerArray textContainers;
|
||||
GetTextContainers(textContainers);
|
||||
|
||||
MoveOverflowToChildList();
|
||||
// Ask text containers to drain overflows
|
||||
const uint32_t rtcCount = mTextContainers.Length();
|
||||
const uint32_t rtcCount = textContainers.Length();
|
||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||
mTextContainers[i]->MoveOverflowToChildList();
|
||||
textContainers[i]->MoveOverflowToChildList();
|
||||
}
|
||||
|
||||
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
|
||||
LogicalSize availSize(lineWM, aReflowState.AvailableWidth(),
|
||||
aReflowState.AvailableHeight());
|
||||
|
||||
const uint32_t spanCount = mSpanContainers.Length();
|
||||
const uint32_t totalCount = rtcCount + spanCount;
|
||||
// We have a reflow state and a line layout for each RTC.
|
||||
// They are conceptually the state of the RTCs, but we don't actually
|
||||
// reflow those RTCs in this code. These two arrays are holders of
|
||||
@ -289,29 +301,20 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
// reason, they are wrapped in UniquePtr here.
|
||||
nsAutoTArray<UniquePtr<nsHTMLReflowState>, RTC_ARRAY_SIZE> reflowStates;
|
||||
nsAutoTArray<UniquePtr<nsLineLayout>, RTC_ARRAY_SIZE> lineLayouts;
|
||||
reflowStates.SetCapacity(totalCount);
|
||||
lineLayouts.SetCapacity(totalCount);
|
||||
|
||||
nsAutoTArray<nsHTMLReflowState*, RTC_ARRAY_SIZE> rtcReflowStates;
|
||||
nsAutoTArray<nsHTMLReflowState*, RTC_ARRAY_SIZE> spanReflowStates;
|
||||
rtcReflowStates.SetCapacity(rtcCount);
|
||||
spanReflowStates.SetCapacity(spanCount);
|
||||
reflowStates.SetCapacity(rtcCount);
|
||||
lineLayouts.SetCapacity(rtcCount);
|
||||
|
||||
// Begin the line layout for each ruby text container in advance.
|
||||
for (uint32_t i = 0; i < totalCount; i++) {
|
||||
nsIFrame* textContainer;
|
||||
nsTArray<nsHTMLReflowState*>* reflowStateArray;
|
||||
if (i < rtcCount) {
|
||||
textContainer = mTextContainers[i];
|
||||
reflowStateArray = &rtcReflowStates;
|
||||
} else {
|
||||
textContainer = mSpanContainers[i - rtcCount];
|
||||
reflowStateArray = &spanReflowStates;
|
||||
bool hasSpan = false;
|
||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||
nsRubyTextContainerFrame* textContainer = textContainers[i];
|
||||
if (textContainer->IsSpanContainer()) {
|
||||
hasSpan = true;
|
||||
}
|
||||
|
||||
nsHTMLReflowState* reflowState = new nsHTMLReflowState(
|
||||
aPresContext, *aReflowState.parentReflowState, textContainer, availSize);
|
||||
reflowStates.AppendElement(reflowState);
|
||||
reflowStateArray->AppendElement(reflowState);
|
||||
nsLineLayout* lineLayout = new nsLineLayout(aPresContext,
|
||||
reflowState->mFloatManager,
|
||||
reflowState, nullptr,
|
||||
@ -362,21 +365,24 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
nscoord isize = 0;
|
||||
if (aStatus == NS_FRAME_COMPLETE) {
|
||||
// Reflow pairs excluding any span
|
||||
bool allowInternalLineBreak = allowLineBreak && mSpanContainers.IsEmpty();
|
||||
isize = ReflowPairs(aPresContext, allowInternalLineBreak,
|
||||
aReflowState, rtcReflowStates, aStatus);
|
||||
// Reflow columns excluding any span
|
||||
ReflowState reflowState = {
|
||||
allowLineBreak && !hasSpan, textContainers, aReflowState, reflowStates
|
||||
};
|
||||
isize = ReflowColumns(reflowState, aStatus);
|
||||
}
|
||||
|
||||
// If there exists any span, the pairs must either be completely
|
||||
// If there exists any span, the columns must either be completely
|
||||
// reflowed, or be not reflowed at all.
|
||||
MOZ_ASSERT(NS_INLINE_IS_BREAK_BEFORE(aStatus) ||
|
||||
NS_FRAME_IS_COMPLETE(aStatus) || mSpanContainers.IsEmpty());
|
||||
NS_FRAME_IS_COMPLETE(aStatus) || !hasSpan);
|
||||
if (!NS_INLINE_IS_BREAK_BEFORE(aStatus) &&
|
||||
NS_FRAME_IS_COMPLETE(aStatus) && !mSpanContainers.IsEmpty()) {
|
||||
NS_FRAME_IS_COMPLETE(aStatus) && hasSpan) {
|
||||
// Reflow spans
|
||||
nscoord spanISize = ReflowSpans(aPresContext, aReflowState,
|
||||
spanReflowStates);
|
||||
ReflowState reflowState = {
|
||||
false, textContainers, aReflowState, reflowStates
|
||||
};
|
||||
nscoord spanISize = ReflowSpans(reflowState);
|
||||
nscoord deltaISize = spanISize - isize;
|
||||
if (deltaISize <= 0) {
|
||||
RubyUtils::ClearReservedISize(this);
|
||||
@ -387,8 +393,7 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
aReflowState.mLineLayout->AdvanceICoord(deltaISize);
|
||||
isize = spanISize;
|
||||
}
|
||||
}
|
||||
// When there are spans, ReflowPairs and ReflowOnePair won't
|
||||
// When there are spans, ReflowColumns and ReflowOneColumn won't
|
||||
// record any optional break position. We have to record one
|
||||
// at the end of this segment.
|
||||
if (!NS_INLINE_IS_BREAK(aStatus) && allowLineBreak &&
|
||||
@ -397,6 +402,7 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
gfxBreakPriority::eNormalBreak)) {
|
||||
aStatus = NS_INLINE_LINE_BREAK_AFTER(aStatus);
|
||||
}
|
||||
}
|
||||
|
||||
DebugOnly<nscoord> lineSpanSize = aReflowState.mLineLayout->EndSpan(this);
|
||||
// When there are no frames inside the ruby base container, EndSpan
|
||||
@ -404,11 +410,10 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
// container could be non-zero because of non-empty ruby annotations.
|
||||
MOZ_ASSERT(NS_INLINE_IS_BREAK_BEFORE(aStatus) ||
|
||||
isize == lineSpanSize || mFrames.IsEmpty());
|
||||
for (uint32_t i = 0; i < totalCount; i++) {
|
||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||
// It happens before the ruby text container is reflowed, and that
|
||||
// when it is reflowed, it will just use this size.
|
||||
nsRubyTextContainerFrame* textContainer = i < rtcCount ?
|
||||
mTextContainers[i] : mSpanContainers[i - rtcCount];
|
||||
nsRubyTextContainerFrame* textContainer = textContainers[i];
|
||||
nsLineLayout* lineLayout = lineLayouts[i].get();
|
||||
|
||||
RubyUtils::ClearReservedISize(textContainer);
|
||||
@ -417,7 +422,7 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
// need reserving isize. For normal ruby text containers, their
|
||||
// children will be expanded properly. We only need to expand their
|
||||
// own size.
|
||||
if (i < rtcCount) {
|
||||
if (!textContainer->IsSpanContainer()) {
|
||||
rtcISize = isize;
|
||||
} else if (isize > rtcISize) {
|
||||
RubyUtils::SetReservedISize(textContainer, isize - rtcISize);
|
||||
@ -425,7 +430,7 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
lineLayout->VerticalAlignLine();
|
||||
LogicalSize lineSize(lineWM, isize, lineLayout->GetFinalLineBSize());
|
||||
textContainer->SetLineSize(lineSize);
|
||||
aReflowState.mRubyReflowState->SetTextContainerInfo(i, textContainer, lineSize);
|
||||
lineLayout->EndLineReflow();
|
||||
}
|
||||
|
||||
@ -443,34 +448,33 @@ struct MOZ_STACK_CLASS nsRubyBaseContainerFrame::PullFrameState
|
||||
{
|
||||
ContinuationTraversingState mBase;
|
||||
nsAutoTArray<ContinuationTraversingState, RTC_ARRAY_SIZE> mTexts;
|
||||
const TextContainerArray& mTextContainers;
|
||||
|
||||
explicit PullFrameState(nsRubyBaseContainerFrame* aFrame);
|
||||
PullFrameState(nsRubyBaseContainerFrame* aBaseContainer,
|
||||
const TextContainerArray& aTextContainers);
|
||||
};
|
||||
|
||||
nscoord
|
||||
nsRubyBaseContainerFrame::ReflowPairs(nsPresContext* aPresContext,
|
||||
bool aAllowLineBreak,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsTArray<nsHTMLReflowState*>& aReflowStates,
|
||||
nsReflowStatus& aStatus)
|
||||
nsRubyBaseContainerFrame::ReflowColumns(const ReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
nsLineLayout* lineLayout = aReflowState.mLineLayout;
|
||||
const uint32_t rtcCount = mTextContainers.Length();
|
||||
nsLineLayout* lineLayout = aReflowState.mBaseReflowState.mLineLayout;
|
||||
const uint32_t rtcCount = aReflowState.mTextContainers.Length();
|
||||
nscoord istart = lineLayout->GetCurrentICoord();
|
||||
nscoord icoord = istart;
|
||||
nsReflowStatus reflowStatus = NS_FRAME_COMPLETE;
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
|
||||
mPairCount = 0;
|
||||
nsIFrame* baseFrame = nullptr;
|
||||
nsAutoTArray<nsIFrame*, RTC_ARRAY_SIZE> textFrames;
|
||||
textFrames.SetCapacity(rtcCount);
|
||||
PairEnumerator e(this, mTextContainers);
|
||||
uint32_t columnIndex = 0;
|
||||
RubyColumn column;
|
||||
column.mTextFrames.SetCapacity(rtcCount);
|
||||
RubyColumnEnumerator e(this, aReflowState.mTextContainers);
|
||||
for (; !e.AtEnd(); e.Next()) {
|
||||
e.GetFrames(baseFrame, textFrames);
|
||||
icoord += ReflowOnePair(aPresContext, aAllowLineBreak,
|
||||
aReflowState, aReflowStates,
|
||||
baseFrame, textFrames, reflowStatus);
|
||||
e.GetColumn(column);
|
||||
icoord += ReflowOneColumn(aReflowState, columnIndex, column, reflowStatus);
|
||||
if (!NS_INLINE_IS_BREAK_BEFORE(reflowStatus)) {
|
||||
columnIndex++;
|
||||
}
|
||||
if (NS_INLINE_IS_BREAK(reflowStatus)) {
|
||||
break;
|
||||
}
|
||||
@ -479,28 +483,29 @@ nsRubyBaseContainerFrame::ReflowPairs(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
bool isComplete = false;
|
||||
PullFrameState pullFrameState(this);
|
||||
PullFrameState pullFrameState(this, aReflowState.mTextContainers);
|
||||
while (!NS_INLINE_IS_BREAK(reflowStatus)) {
|
||||
// We are not handling overflow here.
|
||||
MOZ_ASSERT(reflowStatus == NS_FRAME_COMPLETE);
|
||||
|
||||
// Try pull some frames from next continuations. This call replaces
|
||||
// |baseFrame| and |textFrames| with the frame pulled in each level.
|
||||
PullOnePair(lineLayout, pullFrameState, baseFrame, textFrames, isComplete);
|
||||
// frames in |column| with the frame pulled in each level.
|
||||
PullOneColumn(lineLayout, pullFrameState, column, isComplete);
|
||||
if (isComplete) {
|
||||
// No more frames can be pulled.
|
||||
break;
|
||||
}
|
||||
icoord += ReflowOnePair(aPresContext, aAllowLineBreak,
|
||||
aReflowState, aReflowStates,
|
||||
baseFrame, textFrames, reflowStatus);
|
||||
icoord += ReflowOneColumn(aReflowState, columnIndex, column, reflowStatus);
|
||||
if (!NS_INLINE_IS_BREAK_BEFORE(reflowStatus)) {
|
||||
columnIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!e.AtEnd() && NS_INLINE_IS_BREAK_AFTER(reflowStatus)) {
|
||||
// The current pair has been successfully placed.
|
||||
// Skip to the next pair and mark break before.
|
||||
// The current column has been successfully placed.
|
||||
// Skip to the next column and mark break before.
|
||||
e.Next();
|
||||
e.GetFrames(baseFrame, textFrames);
|
||||
e.GetColumn(column);
|
||||
reflowStatus = NS_INLINE_LINE_BREAK_BEFORE();
|
||||
}
|
||||
if (!e.AtEnd() || (GetNextInFlow() && !isComplete)) {
|
||||
@ -508,28 +513,28 @@ nsRubyBaseContainerFrame::ReflowPairs(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
if (NS_INLINE_IS_BREAK_BEFORE(reflowStatus)) {
|
||||
if (!mPairCount || !mSpanContainers.IsEmpty()) {
|
||||
// If no pair has been placed yet, or we have any span,
|
||||
if (!columnIndex || !aReflowState.mAllowLineBreak) {
|
||||
// If no column has been placed yet, or we have any span,
|
||||
// the whole container should be in the next line.
|
||||
aStatus = NS_INLINE_LINE_BREAK_BEFORE();
|
||||
return 0;
|
||||
}
|
||||
aStatus = NS_INLINE_LINE_BREAK_AFTER(aStatus);
|
||||
MOZ_ASSERT(NS_FRAME_IS_COMPLETE(aStatus) || mSpanContainers.IsEmpty());
|
||||
MOZ_ASSERT(NS_FRAME_IS_COMPLETE(aStatus) || aReflowState.mAllowLineBreak);
|
||||
|
||||
if (baseFrame) {
|
||||
PushChildren(baseFrame, baseFrame->GetPrevSibling());
|
||||
if (column.mBaseFrame) {
|
||||
PushChildren(column.mBaseFrame, column.mBaseFrame->GetPrevSibling());
|
||||
}
|
||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||
nsIFrame* textFrame = textFrames[i];
|
||||
nsIFrame* textFrame = column.mTextFrames[i];
|
||||
if (textFrame) {
|
||||
mTextContainers[i]->PushChildren(textFrame,
|
||||
textFrame->GetPrevSibling());
|
||||
aReflowState.mTextContainers[i]->PushChildren(
|
||||
textFrame, textFrame->GetPrevSibling());
|
||||
}
|
||||
}
|
||||
} else if (NS_INLINE_IS_BREAK_AFTER(reflowStatus)) {
|
||||
// |reflowStatus| being break after here may only happen when
|
||||
// there is a break after the pair just pulled, or the whole
|
||||
// there is a break after the column just pulled, or the whole
|
||||
// segment has been completely reflowed. In those cases, we do
|
||||
// not need to push anything.
|
||||
MOZ_ASSERT(e.AtEnd());
|
||||
@ -540,24 +545,24 @@ nsRubyBaseContainerFrame::ReflowPairs(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsRubyBaseContainerFrame::ReflowOnePair(nsPresContext* aPresContext,
|
||||
bool aAllowLineBreak,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsTArray<nsHTMLReflowState*>& aReflowStates,
|
||||
nsIFrame* aBaseFrame,
|
||||
const nsTArray<nsIFrame*>& aTextFrames,
|
||||
nsReflowStatus& aStatus)
|
||||
nsRubyBaseContainerFrame::ReflowOneColumn(const ReflowState& aReflowState,
|
||||
uint32_t aColumnIndex,
|
||||
const RubyColumn& aColumn,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
|
||||
const uint32_t rtcCount = mTextContainers.Length();
|
||||
MOZ_ASSERT(aTextFrames.Length() == rtcCount);
|
||||
MOZ_ASSERT(aReflowStates.Length() == rtcCount);
|
||||
nscoord istart = aReflowState.mLineLayout->GetCurrentICoord();
|
||||
nscoord pairISize = 0;
|
||||
const nsHTMLReflowState& baseReflowState = aReflowState.mBaseReflowState;
|
||||
const auto& textReflowStates = aReflowState.mTextReflowStates;
|
||||
|
||||
WritingMode lineWM = baseReflowState.mLineLayout->GetWritingMode();
|
||||
const uint32_t rtcCount = aReflowState.mTextContainers.Length();
|
||||
MOZ_ASSERT(aColumn.mTextFrames.Length() == rtcCount);
|
||||
MOZ_ASSERT(textReflowStates.Length() == rtcCount);
|
||||
nscoord istart = baseReflowState.mLineLayout->GetCurrentICoord();
|
||||
nscoord columnISize = 0;
|
||||
|
||||
nsAutoString baseText;
|
||||
if (aBaseFrame) {
|
||||
if (!nsContentUtils::GetNodeTextContent(aBaseFrame->GetContent(),
|
||||
if (aColumn.mBaseFrame) {
|
||||
if (!nsContentUtils::GetNodeTextContent(aColumn.mBaseFrame->GetContent(),
|
||||
true, baseText)) {
|
||||
NS_RUNTIMEABORT("OOM");
|
||||
}
|
||||
@ -565,7 +570,7 @@ nsRubyBaseContainerFrame::ReflowOnePair(nsPresContext* aPresContext,
|
||||
|
||||
// Reflow text frames
|
||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||
nsIFrame* textFrame = aTextFrames[i];
|
||||
nsIFrame* textFrame = aColumn.mTextFrames[i];
|
||||
if (textFrame) {
|
||||
MOZ_ASSERT(textFrame->GetType() == nsGkAtoms::rubyTextFrame);
|
||||
nsAutoString annotationText;
|
||||
@ -585,18 +590,19 @@ nsRubyBaseContainerFrame::ReflowOnePair(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
nsReflowStatus reflowStatus;
|
||||
nsHTMLReflowMetrics metrics(*aReflowStates[i]);
|
||||
nsHTMLReflowMetrics metrics(*textReflowStates[i]);
|
||||
RubyUtils::ClearReservedISize(textFrame);
|
||||
|
||||
bool pushedFrame;
|
||||
aReflowStates[i]->mLineLayout->ReflowFrame(textFrame, reflowStatus,
|
||||
&metrics, pushedFrame);
|
||||
textReflowStates[i]->mLineLayout->ReflowFrame(textFrame, reflowStatus,
|
||||
&metrics, pushedFrame);
|
||||
MOZ_ASSERT(!NS_INLINE_IS_BREAK(reflowStatus) && !pushedFrame,
|
||||
"Any line break inside ruby box should has been suppressed");
|
||||
pairISize = std::max(pairISize, metrics.ISize(lineWM));
|
||||
columnISize = std::max(columnISize, metrics.ISize(lineWM));
|
||||
}
|
||||
}
|
||||
if (aAllowLineBreak && ShouldBreakBefore(aReflowState, pairISize)) {
|
||||
if (aReflowState.mAllowLineBreak &&
|
||||
ShouldBreakBefore(baseReflowState, columnISize)) {
|
||||
// Since ruby text container uses an independent line layout, it
|
||||
// may successfully place a frame because the line is empty while
|
||||
// the line of base container is not.
|
||||
@ -605,32 +611,35 @@ nsRubyBaseContainerFrame::ReflowOnePair(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// Reflow the base frame
|
||||
if (aBaseFrame) {
|
||||
MOZ_ASSERT(aBaseFrame->GetType() == nsGkAtoms::rubyBaseFrame);
|
||||
if (aColumn.mBaseFrame) {
|
||||
MOZ_ASSERT(aColumn.mBaseFrame->GetType() == nsGkAtoms::rubyBaseFrame);
|
||||
nsReflowStatus reflowStatus;
|
||||
nsHTMLReflowMetrics metrics(aReflowState);
|
||||
RubyUtils::ClearReservedISize(aBaseFrame);
|
||||
nsHTMLReflowMetrics metrics(baseReflowState);
|
||||
RubyUtils::ClearReservedISize(aColumn.mBaseFrame);
|
||||
|
||||
bool pushedFrame;
|
||||
aReflowState.mLineLayout->ReflowFrame(aBaseFrame, reflowStatus,
|
||||
&metrics, pushedFrame);
|
||||
baseReflowState.mLineLayout->ReflowFrame(aColumn.mBaseFrame, reflowStatus,
|
||||
&metrics, pushedFrame);
|
||||
MOZ_ASSERT(!NS_INLINE_IS_BREAK(reflowStatus) && !pushedFrame,
|
||||
"Any line break inside ruby box should has been suppressed");
|
||||
pairISize = std::max(pairISize, metrics.ISize(lineWM));
|
||||
columnISize = std::max(columnISize, metrics.ISize(lineWM));
|
||||
}
|
||||
|
||||
// Align all the line layout to the new coordinate.
|
||||
nscoord icoord = istart + pairISize;
|
||||
nscoord deltaISize = icoord - aReflowState.mLineLayout->GetCurrentICoord();
|
||||
nscoord icoord = istart + columnISize;
|
||||
nscoord deltaISize = icoord - baseReflowState.mLineLayout->GetCurrentICoord();
|
||||
if (deltaISize > 0) {
|
||||
aReflowState.mLineLayout->AdvanceICoord(deltaISize);
|
||||
if (aBaseFrame) {
|
||||
RubyUtils::SetReservedISize(aBaseFrame, deltaISize);
|
||||
baseReflowState.mLineLayout->AdvanceICoord(deltaISize);
|
||||
if (aColumn.mBaseFrame) {
|
||||
RubyUtils::SetReservedISize(aColumn.mBaseFrame, deltaISize);
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||
nsLineLayout* lineLayout = aReflowStates[i]->mLineLayout;
|
||||
nsIFrame* textFrame = aTextFrames[i];
|
||||
if (aReflowState.mTextContainers[i]->IsSpanContainer()) {
|
||||
continue;
|
||||
}
|
||||
nsLineLayout* lineLayout = textReflowStates[i]->mLineLayout;
|
||||
nsIFrame* textFrame = aColumn.mTextFrames[i];
|
||||
nscoord deltaISize = icoord - lineLayout->GetCurrentICoord();
|
||||
if (deltaISize > 0) {
|
||||
lineLayout->AdvanceICoord(deltaISize);
|
||||
@ -638,49 +647,50 @@ nsRubyBaseContainerFrame::ReflowOnePair(nsPresContext* aPresContext,
|
||||
RubyUtils::SetReservedISize(textFrame, deltaISize);
|
||||
}
|
||||
}
|
||||
if (aBaseFrame && textFrame) {
|
||||
if (aColumn.mBaseFrame && textFrame) {
|
||||
lineLayout->AttachLastFrameToBaseLineLayout();
|
||||
}
|
||||
}
|
||||
|
||||
mPairCount++;
|
||||
if (aAllowLineBreak &&
|
||||
aReflowState.mLineLayout->NotifyOptionalBreakPosition(
|
||||
this, mPairCount, icoord <= aReflowState.AvailableISize(),
|
||||
if (aReflowState.mAllowLineBreak &&
|
||||
baseReflowState.mLineLayout->NotifyOptionalBreakPosition(
|
||||
this, aColumnIndex + 1, icoord <= baseReflowState.AvailableISize(),
|
||||
gfxBreakPriority::eNormalBreak)) {
|
||||
aStatus = NS_INLINE_LINE_BREAK_AFTER(aStatus);
|
||||
}
|
||||
|
||||
return pairISize;
|
||||
return columnISize;
|
||||
}
|
||||
|
||||
nsRubyBaseContainerFrame::PullFrameState::PullFrameState(
|
||||
nsRubyBaseContainerFrame* aFrame)
|
||||
: mBase(aFrame)
|
||||
nsRubyBaseContainerFrame* aBaseContainer,
|
||||
const TextContainerArray& aTextContainers)
|
||||
: mBase(aBaseContainer)
|
||||
, mTextContainers(aTextContainers)
|
||||
{
|
||||
const uint32_t rtcCount = aFrame->mTextContainers.Length();
|
||||
const uint32_t rtcCount = aTextContainers.Length();
|
||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||
mTexts.AppendElement(aFrame->mTextContainers[i]);
|
||||
mTexts.AppendElement(aTextContainers[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsRubyBaseContainerFrame::PullOnePair(nsLineLayout* aLineLayout,
|
||||
PullFrameState& aPullFrameState,
|
||||
nsIFrame*& aBaseFrame,
|
||||
nsTArray<nsIFrame*>& aTextFrames,
|
||||
bool& aIsComplete)
|
||||
nsRubyBaseContainerFrame::PullOneColumn(nsLineLayout* aLineLayout,
|
||||
PullFrameState& aPullFrameState,
|
||||
RubyColumn& aColumn,
|
||||
bool& aIsComplete)
|
||||
{
|
||||
const uint32_t rtcCount = mTextContainers.Length();
|
||||
const TextContainerArray& textContainers = aPullFrameState.mTextContainers;
|
||||
const uint32_t rtcCount = textContainers.Length();
|
||||
|
||||
aBaseFrame = PullNextInFlowChild(aPullFrameState.mBase);
|
||||
aIsComplete = !aBaseFrame;
|
||||
aColumn.mBaseFrame = PullNextInFlowChild(aPullFrameState.mBase);
|
||||
aIsComplete = !aColumn.mBaseFrame;
|
||||
|
||||
aTextFrames.ClearAndRetainStorage();
|
||||
aColumn.mTextFrames.ClearAndRetainStorage();
|
||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||
nsIFrame* nextText =
|
||||
mTextContainers[i]->PullNextInFlowChild(aPullFrameState.mTexts[i]);
|
||||
aTextFrames.AppendElement(nextText);
|
||||
textContainers[i]->PullNextInFlowChild(aPullFrameState.mTexts[i]);
|
||||
aColumn.mTextFrames.AppendElement(nextText);
|
||||
// If there exists any frame in continations, we haven't
|
||||
// completed the reflow process.
|
||||
aIsComplete = aIsComplete && !nextText;
|
||||
@ -693,22 +703,25 @@ nsRubyBaseContainerFrame::PullOnePair(nsLineLayout* aLineLayout,
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsRubyBaseContainerFrame::ReflowSpans(nsPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsTArray<nsHTMLReflowState*>& aReflowStates)
|
||||
nsRubyBaseContainerFrame::ReflowSpans(const ReflowState& aReflowState)
|
||||
{
|
||||
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
|
||||
const uint32_t spanCount = mSpanContainers.Length();
|
||||
WritingMode lineWM =
|
||||
aReflowState.mBaseReflowState.mLineLayout->GetWritingMode();
|
||||
nscoord spanISize = 0;
|
||||
|
||||
for (uint32_t i = 0; i < spanCount; i++) {
|
||||
nsRubyTextContainerFrame* container = mSpanContainers[i];
|
||||
for (uint32_t i = 0, iend = aReflowState.mTextContainers.Length();
|
||||
i < iend; i++) {
|
||||
nsRubyTextContainerFrame* container = aReflowState.mTextContainers[i];
|
||||
if (!container->IsSpanContainer()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nsIFrame* rtFrame = container->GetFirstPrincipalChild();
|
||||
nsReflowStatus reflowStatus;
|
||||
nsHTMLReflowMetrics metrics(*aReflowStates[i]);
|
||||
nsHTMLReflowMetrics metrics(*aReflowState.mTextReflowStates[i]);
|
||||
bool pushedFrame;
|
||||
aReflowStates[i]->mLineLayout->ReflowFrame(rtFrame, reflowStatus,
|
||||
&metrics, pushedFrame);
|
||||
aReflowState.mTextReflowStates[i]->mLineLayout->
|
||||
ReflowFrame(rtFrame, reflowStatus, &metrics, pushedFrame);
|
||||
MOZ_ASSERT(!NS_INLINE_IS_BREAK(reflowStatus) && !pushedFrame,
|
||||
"Any line break inside ruby box should has been suppressed");
|
||||
spanISize = std::max(spanISize, metrics.ISize(lineWM));
|
||||
|
@ -13,8 +13,7 @@
|
||||
#include "nsRubyTextContainerFrame.h"
|
||||
#include "nsRubyBaseFrame.h"
|
||||
#include "nsRubyTextFrame.h"
|
||||
|
||||
#define RTC_ARRAY_SIZE 1
|
||||
#include "RubyReflowState.h"
|
||||
|
||||
/**
|
||||
* Factory function.
|
||||
@ -23,6 +22,10 @@
|
||||
nsContainerFrame* NS_NewRubyBaseContainerFrame(nsIPresShell* aPresShell,
|
||||
nsStyleContext* aContext);
|
||||
|
||||
namespace mozilla {
|
||||
struct RubyColumn;
|
||||
}
|
||||
|
||||
class nsRubyBaseContainerFrame MOZ_FINAL : public nsContainerFrame
|
||||
{
|
||||
public:
|
||||
@ -59,67 +62,35 @@ public:
|
||||
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
void AssertTextContainersEmpty()
|
||||
{
|
||||
MOZ_ASSERT(mSpanContainers.IsEmpty());
|
||||
MOZ_ASSERT(mTextContainers.IsEmpty());
|
||||
}
|
||||
#endif
|
||||
|
||||
void AppendTextContainer(nsIFrame* aFrame);
|
||||
void ClearTextContainers();
|
||||
|
||||
protected:
|
||||
friend nsContainerFrame*
|
||||
NS_NewRubyBaseContainerFrame(nsIPresShell* aPresShell,
|
||||
nsStyleContext* aContext);
|
||||
explicit nsRubyBaseContainerFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
|
||||
|
||||
nscoord CalculateMaxSpanISize(nsRenderingContext* aRenderingContext);
|
||||
typedef nsTArray<nsRubyTextContainerFrame*> TextContainerArray;
|
||||
typedef nsAutoTArray<nsRubyTextContainerFrame*, RTC_ARRAY_SIZE> AutoTextContainerArray;
|
||||
void GetTextContainers(TextContainerArray& aTextContainers);
|
||||
|
||||
nscoord ReflowPairs(nsPresContext* aPresContext,
|
||||
bool aAllowLineBreak,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsTArray<nsHTMLReflowState*>& aReflowStates,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
nscoord ReflowOnePair(nsPresContext* aPresContext,
|
||||
bool aAllowLineBreak,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsTArray<nsHTMLReflowState*>& aReflowStates,
|
||||
nsIFrame* aBaseFrame,
|
||||
const nsTArray<nsIFrame*>& aTextFrames,
|
||||
struct ReflowState;
|
||||
nscoord ReflowColumns(const ReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
nscoord ReflowSpans(nsPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsTArray<nsHTMLReflowState*>& aReflowStates);
|
||||
nscoord ReflowOneColumn(const ReflowState& aReflowState,
|
||||
uint32_t aColumnIndex,
|
||||
const mozilla::RubyColumn& aColumn,
|
||||
nsReflowStatus& aStatus);
|
||||
nscoord ReflowSpans(const ReflowState& aReflowState);
|
||||
|
||||
struct PullFrameState;
|
||||
|
||||
// Pull ruby base and corresponding ruby text frames from
|
||||
// continuations after them.
|
||||
void PullOnePair(nsLineLayout* aLineLayout,
|
||||
PullFrameState& aPullFrameState,
|
||||
nsIFrame*& aBaseFrame,
|
||||
nsTArray<nsIFrame*>& aTextFrames,
|
||||
bool& aIsComplete);
|
||||
|
||||
/**
|
||||
* The arrays of ruby text containers below are filled before the ruby
|
||||
* frame (parent) starts reflowing this ruby segment, and cleared when
|
||||
* the reflow finishes.
|
||||
*/
|
||||
|
||||
// The text containers that contain a span, which spans all ruby
|
||||
// pairs in the ruby segment.
|
||||
nsTArray<nsRubyTextContainerFrame*> mSpanContainers;
|
||||
// Normal text containers that do not contain spans.
|
||||
nsTArray<nsRubyTextContainerFrame*> mTextContainers;
|
||||
void PullOneColumn(nsLineLayout* aLineLayout,
|
||||
PullFrameState& aPullFrameState,
|
||||
mozilla::RubyColumn& aColumn,
|
||||
bool& aIsComplete);
|
||||
|
||||
nscoord mBaseline;
|
||||
uint32_t mPairCount;
|
||||
};
|
||||
|
||||
#endif /* nsRubyBaseContainerFrame_h___ */
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "nsPresContext.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "WritingModes.h"
|
||||
#include "RubyUtils.h"
|
||||
#include "RubyReflowState.h"
|
||||
#include "nsRubyBaseContainerFrame.h"
|
||||
#include "nsRubyTextContainerFrame.h"
|
||||
|
||||
@ -59,71 +61,6 @@ nsRubyFrame::GetFrameName(nsAString& aResult) const
|
||||
}
|
||||
#endif
|
||||
|
||||
class MOZ_STACK_CLASS TextContainerIterator
|
||||
{
|
||||
public:
|
||||
explicit TextContainerIterator(nsRubyBaseContainerFrame* aBaseContainer);
|
||||
void Next();
|
||||
bool AtEnd() const { return !mFrame; }
|
||||
nsRubyTextContainerFrame* GetTextContainer() const
|
||||
{
|
||||
return static_cast<nsRubyTextContainerFrame*>(mFrame);
|
||||
}
|
||||
|
||||
private:
|
||||
nsIFrame* mFrame;
|
||||
};
|
||||
|
||||
TextContainerIterator::TextContainerIterator(
|
||||
nsRubyBaseContainerFrame* aBaseContainer)
|
||||
{
|
||||
mFrame = aBaseContainer;
|
||||
Next();
|
||||
}
|
||||
|
||||
void
|
||||
TextContainerIterator::Next()
|
||||
{
|
||||
if (mFrame) {
|
||||
mFrame = mFrame->GetNextSibling();
|
||||
if (mFrame && mFrame->GetType() != nsGkAtoms::rubyTextContainerFrame) {
|
||||
mFrame = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class is responsible for appending and clearing
|
||||
* text container list of the base container.
|
||||
*/
|
||||
class MOZ_STACK_CLASS AutoSetTextContainers
|
||||
{
|
||||
public:
|
||||
explicit AutoSetTextContainers(nsRubyBaseContainerFrame* aBaseContainer);
|
||||
~AutoSetTextContainers();
|
||||
|
||||
private:
|
||||
nsRubyBaseContainerFrame* mBaseContainer;
|
||||
};
|
||||
|
||||
AutoSetTextContainers::AutoSetTextContainers(
|
||||
nsRubyBaseContainerFrame* aBaseContainer)
|
||||
: mBaseContainer(aBaseContainer)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
aBaseContainer->AssertTextContainersEmpty();
|
||||
#endif
|
||||
for (TextContainerIterator iter(aBaseContainer);
|
||||
!iter.AtEnd(); iter.Next()) {
|
||||
aBaseContainer->AppendTextContainer(iter.GetTextContainer());
|
||||
}
|
||||
}
|
||||
|
||||
AutoSetTextContainers::~AutoSetTextContainers()
|
||||
{
|
||||
mBaseContainer->ClearTextContainers();
|
||||
}
|
||||
|
||||
/**
|
||||
* This enumerator enumerates each segment.
|
||||
*/
|
||||
@ -169,7 +106,6 @@ nsRubyFrame::AddInlineMinISize(nsRenderingContext *aRenderingContext,
|
||||
{
|
||||
nscoord max = 0;
|
||||
for (SegmentEnumerator e(this); !e.AtEnd(); e.Next()) {
|
||||
AutoSetTextContainers holder(e.GetBaseContainer());
|
||||
max = std::max(max, e.GetBaseContainer()->GetMinISize(aRenderingContext));
|
||||
}
|
||||
aData->currentLine += max;
|
||||
@ -181,7 +117,6 @@ nsRubyFrame::AddInlinePrefISize(nsRenderingContext *aRenderingContext,
|
||||
{
|
||||
nscoord sum = 0;
|
||||
for (SegmentEnumerator e(this); !e.AtEnd(); e.Next()) {
|
||||
AutoSetTextContainers holder(e.GetBaseContainer());
|
||||
sum += e.GetBaseContainer()->GetPrefISize(aRenderingContext);
|
||||
}
|
||||
aData->currentLine += sum;
|
||||
@ -294,19 +229,20 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
|
||||
nsRubyBaseContainerFrame* aBaseContainer,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
AutoSetTextContainers holder(aBaseContainer);
|
||||
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
|
||||
LogicalSize availSize(lineWM, aReflowState.AvailableISize(),
|
||||
aReflowState.AvailableBSize());
|
||||
|
||||
nsAutoTArray<nsRubyTextContainerFrame*, RTC_ARRAY_SIZE> textContainers;
|
||||
for (TextContainerIterator iter(aBaseContainer); !iter.AtEnd(); iter.Next()) {
|
||||
for (RubyTextContainerIterator iter(aBaseContainer); !iter.AtEnd(); iter.Next()) {
|
||||
textContainers.AppendElement(iter.GetTextContainer());
|
||||
}
|
||||
const uint32_t rtcCount = textContainers.Length();
|
||||
RubyReflowState rubyReflowState(lineWM, textContainers);
|
||||
|
||||
nsHTMLReflowMetrics baseMetrics(aReflowState);
|
||||
bool pushedFrame;
|
||||
aReflowState.mLineLayout->SetRubyReflowState(&rubyReflowState);
|
||||
aReflowState.mLineLayout->ReflowFrame(aBaseContainer, aStatus,
|
||||
&baseMetrics, pushedFrame);
|
||||
|
||||
@ -385,10 +321,13 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
|
||||
nsRect offsetRect = baseRect;
|
||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||
nsRubyTextContainerFrame* textContainer = textContainers[i];
|
||||
rubyReflowState.AdvanceCurrentContainerIndex();
|
||||
|
||||
nsReflowStatus textReflowStatus;
|
||||
nsHTMLReflowMetrics textMetrics(aReflowState);
|
||||
nsHTMLReflowState textReflowState(aPresContext, aReflowState,
|
||||
textContainer, availSize);
|
||||
textReflowState.mRubyReflowState = &rubyReflowState;
|
||||
// FIXME We probably shouldn't be using the same nsLineLayout for
|
||||
// the text containers. But it should be fine now as we are
|
||||
// not actually using this line layout to reflow something,
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "nsPresContext.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "WritingModes.h"
|
||||
#include "RubyReflowState.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -61,6 +62,60 @@ nsRubyTextContainerFrame::IsFrameOfType(uint32_t aFlags) const
|
||||
return nsRubyTextContainerFrameSuper::IsFrameOfType(aFlags);
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
nsRubyTextContainerFrame::SetInitialChildList(ChildListID aListID,
|
||||
nsFrameList& aChildList)
|
||||
{
|
||||
nsRubyTextContainerFrameSuper::SetInitialChildList(aListID, aChildList);
|
||||
UpdateSpanFlag();
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
nsRubyTextContainerFrame::AppendFrames(ChildListID aListID,
|
||||
nsFrameList& aFrameList)
|
||||
{
|
||||
nsRubyTextContainerFrameSuper::AppendFrames(aListID, aFrameList);
|
||||
UpdateSpanFlag();
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
nsRubyTextContainerFrame::InsertFrames(ChildListID aListID,
|
||||
nsIFrame* aPrevFrame,
|
||||
nsFrameList& aFrameList)
|
||||
{
|
||||
nsRubyTextContainerFrameSuper::InsertFrames(aListID, aPrevFrame, aFrameList);
|
||||
UpdateSpanFlag();
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
nsRubyTextContainerFrame::RemoveFrame(ChildListID aListID,
|
||||
nsIFrame* aOldFrame)
|
||||
{
|
||||
nsRubyTextContainerFrameSuper::RemoveFrame(aListID, aOldFrame);
|
||||
UpdateSpanFlag();
|
||||
}
|
||||
|
||||
void
|
||||
nsRubyTextContainerFrame::UpdateSpanFlag()
|
||||
{
|
||||
bool isSpan = false;
|
||||
// The continuation checks are safe here because spans never break.
|
||||
if (!GetPrevContinuation() && !GetNextContinuation()) {
|
||||
nsIFrame* onlyChild = mFrames.OnlyChild();
|
||||
if (onlyChild && onlyChild->IsPseudoFrame(GetContent())) {
|
||||
// Per CSS Ruby spec, if the only child of an rtc frame is
|
||||
// a pseudo rt frame, it spans all bases in the segment.
|
||||
isSpan = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isSpan) {
|
||||
AddStateBits(NS_RUBY_TEXT_CONTAINER_IS_SPAN);
|
||||
} else {
|
||||
RemoveStateBits(NS_RUBY_TEXT_CONTAINER_IS_SPAN);
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
@ -70,6 +125,8 @@ nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
DO_GLOBAL_REFLOW_COUNT("nsRubyTextContainerFrame");
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
|
||||
MOZ_ASSERT(aReflowState.mRubyReflowState, "No ruby reflow state provided");
|
||||
|
||||
// All rt children have already been reflowed. All we need to do is
|
||||
// to report complete and return the desired size provided by the
|
||||
// ruby base container.
|
||||
@ -80,5 +137,7 @@ nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
// will take care of our continuations.
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
|
||||
aDesiredSize.SetSize(lineWM, mLineSize);
|
||||
const RubyReflowState::TextContainerInfo& info =
|
||||
aReflowState.mRubyReflowState->GetCurrentTextContainerInfo(this);
|
||||
aDesiredSize.SetSize(lineWM, info.mLineSize);
|
||||
}
|
||||
|
@ -42,21 +42,32 @@ public:
|
||||
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
||||
#endif
|
||||
|
||||
// nsContainerFrame overrides
|
||||
virtual void SetInitialChildList(ChildListID aListID,
|
||||
nsFrameList& aChildList) MOZ_OVERRIDE;
|
||||
virtual void AppendFrames(ChildListID aListID,
|
||||
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
||||
virtual void InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
|
||||
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
||||
virtual void RemoveFrame(ChildListID aListID,
|
||||
nsIFrame* aOldFrame) MOZ_OVERRIDE;
|
||||
|
||||
bool IsSpanContainer() const
|
||||
{
|
||||
return GetStateBits() & NS_RUBY_TEXT_CONTAINER_IS_SPAN;
|
||||
}
|
||||
|
||||
protected:
|
||||
friend nsContainerFrame*
|
||||
NS_NewRubyTextContainerFrame(nsIPresShell* aPresShell,
|
||||
nsStyleContext* aContext);
|
||||
explicit nsRubyTextContainerFrame(nsStyleContext* aContext)
|
||||
: nsRubyTextContainerFrameSuper(aContext)
|
||||
, mLineSize(mozilla::WritingMode(aContext)) {}
|
||||
: nsRubyTextContainerFrameSuper(aContext) {}
|
||||
|
||||
void UpdateSpanFlag();
|
||||
|
||||
// For MoveOverflowToChildList
|
||||
friend class nsRubyBaseContainerFrame;
|
||||
void SetLineSize(const mozilla::LogicalSize& aSize) { mLineSize = aSize; }
|
||||
|
||||
// The intended dimensions of the ruby text container. It is set by
|
||||
// the corresponding ruby base container when the segment is reflowed,
|
||||
// and used when the ruby text container is reflowed by its parent.
|
||||
mozilla::LogicalSize mLineSize;
|
||||
};
|
||||
|
||||
#endif /* nsRubyTextContainerFrame_h___ */
|
||||
|
@ -5097,6 +5097,33 @@ Version 1.6.15rc03 [November 16, 2014]
|
||||
Removed the obsolete $ARCH variable from scripts/makefile.darwin.
|
||||
|
||||
Version 1.6.15 [November 20, 2014]
|
||||
No changes.
|
||||
|
||||
Version 1.6.16beta01 [December 14, 2014]
|
||||
Added ".align 2" to arm/filter_neon.S to support old GAS assemblers that
|
||||
don't do alignment correctly.
|
||||
Revised Makefile.am and scripts/symbols.dfn to work with MinGW/MSYS
|
||||
(Bob Friesenhahn).
|
||||
|
||||
Version 1.6.16beta02 [December 15, 2014]
|
||||
Revised Makefile.am and scripts/*.dfn again to work with MinGW/MSYS;
|
||||
renamed scripts/*.dfn to scripts/*.c (John Bowler).
|
||||
|
||||
Version 1.6.16beta03 [December 21, 2014]
|
||||
Quiet a "comparison always true" warning in pngstest.c (John Bowler).
|
||||
|
||||
Version 1.6.16rc01 [December 21, 2014]
|
||||
Restored a test on width that was removed from png.c at libpng-1.6.9
|
||||
(Bug report by Alex Eubanks).
|
||||
|
||||
Version 1.6.16rc02 [December 21, 2014]
|
||||
Undid the update to pngrutil.c in 1.6.16rc01.
|
||||
|
||||
Version 1.6.16rc03 [December 21, 2014]
|
||||
Fixed an overflow in png_combine_row with very wide interlaced images.
|
||||
|
||||
Version 1.6.16 [December 22, 2014]
|
||||
No changes.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
@ -10,7 +10,7 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.6.15, November 20, 2014, are
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
|
||||
Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
with the following individual added to the list of Contributing Authors
|
||||
@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
November 20, 2014
|
||||
December 22, 2014
|
||||
|
@ -1,12 +1,19 @@
|
||||
|
||||
Changes made to pristine libpng source by mozilla.org developers.
|
||||
|
||||
2014/12/22 -- Synced with libpng-1.6.16 (bug #1114360).
|
||||
Added arm.patch file.
|
||||
|
||||
2014/11/20 -- Synced with libpng-1.6.15 (bug #1102523).
|
||||
|
||||
2014/10/23 -- Synced with libpng-1.6.14 (bug #1087841).
|
||||
|
||||
2014/08/21 -- Synced with libpng-1.6.13 (bug #1021713).
|
||||
Renamed mozpngconf.h to pnglibconf.h.
|
||||
Revised system arm/filter_neon.S to include the lines
|
||||
#define PNG_READ_SUPPORTED and #define MOZ_PNG_HAVE_ARM_NEON
|
||||
because the moz.build system doesn't yet pass -DDefined
|
||||
macros to the assembler.
|
||||
|
||||
2014/03/21 -- Synced with libpng-1.6.10 (bug #980488) and disabled
|
||||
PNG_WARNINGS and PNG_ERROR_TEXT in non-debug builds.
|
||||
@ -16,10 +23,12 @@ Changes made to pristine libpng source by mozilla.org developers.
|
||||
2014/03/04 -- Enabled PNG_WARNINGS and other stuff in mozpngconf.h
|
||||
as part of enabling Freetype2 with PNG (bug #969814).
|
||||
|
||||
2014/03/03 -- Fixed hang with empty IDAT (bug #974825).
|
||||
2014/03/03 -- Fixed hang with empty IDAT (bug #974825). This will be
|
||||
fixed in libpng-1.6.10.
|
||||
|
||||
2014/02/18 -- Exposed png_error(), etc. redefinitions to applications
|
||||
(moved them from pngpriv.h to png.h).
|
||||
(moved them from pngpriv.h to png.h). This will be fixed
|
||||
in libpng-1.6.10.
|
||||
|
||||
2014/02/18 -- Disabled PNG_FIXED_POINT_SUPPORTED in mozpngconf.h (we
|
||||
don't need both FIXED and FLOATING_POINT support).
|
||||
@ -27,6 +36,7 @@ Changes made to pristine libpng source by mozilla.org developers.
|
||||
2014/02/15 -- Synced with libpng-1.6.9 (bug #952505).
|
||||
|
||||
2014/02/11 -- Fixed crash with empty PLTE, CVE-2013-6954 (bug #945912).
|
||||
This will be fixed in libpng-1.6.9.
|
||||
|
||||
2013/12/11 -- Enable ARM support (bug #832390).
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
README for libpng version 1.6.15 - November 20, 2014 (shared library 16.0)
|
||||
README for libpng version 1.6.16 - December 22, 2014 (shared library 16.0)
|
||||
See the note about version numbers near the top of png.h
|
||||
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
|
@ -278,7 +278,7 @@ Index: png.h
|
||||
===================================================================
|
||||
--- png.h
|
||||
+++ png.h
|
||||
@@ -473,6 +473,10 @@
|
||||
@@ -476,6 +476,10 @@
|
||||
# include "pnglibconf.h"
|
||||
#endif
|
||||
|
||||
@ -289,7 +289,7 @@ Index: png.h
|
||||
#ifndef PNG_VERSION_INFO_ONLY
|
||||
/* Machine specific configuration. */
|
||||
# include "pngconf.h"
|
||||
@@ -563,6 +567,17 @@
|
||||
@@ -566,6 +570,17 @@
|
||||
* See pngconf.h for base types that vary by machine/system
|
||||
*/
|
||||
|
||||
@ -307,7 +307,7 @@ Index: png.h
|
||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||
* do not agree upon the version number.
|
||||
*/
|
||||
@@ -883,6 +898,10 @@
|
||||
@@ -886,6 +901,10 @@
|
||||
#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
|
||||
#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
|
||||
#define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */
|
||||
@ -318,7 +318,7 @@ Index: png.h
|
||||
|
||||
/* This is used for the transformation routines, as some of them
|
||||
* change these values for the row. It also should enable using
|
||||
@@ -920,6 +939,10 @@
|
||||
@@ -923,6 +942,10 @@
|
||||
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
||||
typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop));
|
||||
typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop));
|
||||
@ -329,7 +329,7 @@ Index: png.h
|
||||
|
||||
/* The following callback receives png_uint_32 row_number, int pass for the
|
||||
* png_bytep data of the row. When transforming an interlaced image the
|
||||
@@ -3259,6 +3282,75 @@
|
||||
@@ -3262,6 +3285,75 @@
|
||||
* END OF HARDWARE AND SOFTWARE OPTIONS
|
||||
******************************************************************************/
|
||||
|
||||
@ -405,7 +405,7 @@ Index: png.h
|
||||
/* Maintainer: Put new public prototypes here ^, in libpng.3, in project
|
||||
* defs, and in scripts/symbols.def.
|
||||
*/
|
||||
@@ -3267,7 +3359,11 @@
|
||||
@@ -3270,7 +3362,11 @@
|
||||
* one to use is one more than this.)
|
||||
*/
|
||||
#ifdef PNG_EXPORT_LAST_ORDINAL
|
||||
@ -1023,7 +1023,7 @@ Index: pngrutil.c
|
||||
===================================================================
|
||||
--- pngrutil.c
|
||||
+++ pngrutil.c
|
||||
@@ -818,6 +818,11 @@
|
||||
@@ -819,6 +819,11 @@
|
||||
filter_type = buf[11];
|
||||
interlace_type = buf[12];
|
||||
|
||||
|
48
media/libpng/arm.patch
Normal file
48
media/libpng/arm.patch
Normal file
@ -0,0 +1,48 @@
|
||||
diff --git ../../../libpng-1.6.16/arm/arm_init.c arm/arm_init.c
|
||||
--- ../../../libpng-1.6.16/arm/arm_init.c 2014-12-21 22:08:08.000000000 -0500
|
||||
+++ arm/arm_init.c 2014-12-22 17:33:57.556305506 -0500
|
||||
@@ -29,17 +29,17 @@
|
||||
* You may set the macro PNG_ARM_NEON_FILE to the file name of file containing
|
||||
* a fragment of C source code which defines the png_have_neon function. There
|
||||
* are a number of implementations in contrib/arm-neon, but the only one that
|
||||
* has partial support is contrib/arm-neon/linux.c - a generic Linux
|
||||
* implementation which reads /proc/cpufino.
|
||||
*/
|
||||
#ifndef PNG_ARM_NEON_FILE
|
||||
# ifdef __linux__
|
||||
-# define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c"
|
||||
+# define PNG_ARM_NEON_FILE "linux.c"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef PNG_ARM_NEON_FILE
|
||||
|
||||
#include <signal.h> /* for sig_atomic_t */
|
||||
static int png_have_neon(png_structp png_ptr);
|
||||
#include PNG_ARM_NEON_FILE
|
||||
diff --git ../../../libpng-1.6.16/arm/filter_neon.S arm/filter_neon.S
|
||||
--- ../../../libpng-1.6.16/arm/filter_neon.S 2014-12-21 22:08:08.000000000 -0500
|
||||
+++ arm/filter_neon.S 2014-12-22 17:43:31.588323649 -0500
|
||||
@@ -5,16 +5,22 @@
|
||||
* Written by Mans Rullgard, 2011.
|
||||
* Last changed in libpng 1.6.16 [December 22, 2014]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*/
|
||||
|
||||
+/* These are required because Mozilla's moz.build system doesn't pass
|
||||
+ * -DDefined macros to the assembler.
|
||||
+ */
|
||||
+#define PNG_READ_SUPPORTED
|
||||
+#define MOZ_PNG_HAVE_ARM_NEON
|
||||
+
|
||||
/* This is required to get the symbol renames, which are #defines, and the
|
||||
* definitions (or not) of PNG_ARM_NEON_OPT and PNG_ARM_NEON_IMPLEMENTATION.
|
||||
*/
|
||||
#define PNG_VERSION_INFO_ONLY
|
||||
#include "../pngpriv.h"
|
||||
|
||||
#if defined(__linux__) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
* Last changed in libpng 1.6.10 [March 6, 2014]
|
||||
* Last changed in libpng 1.6.16 [December 22, 2014]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@ -17,12 +17,13 @@
|
||||
#include "../pngpriv.h"
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
|
||||
#if PNG_ARM_NEON_OPT > 0
|
||||
#ifdef PNG_ARM_NEON_CHECK_SUPPORTED /* Do run-time checks */
|
||||
/* WARNING: it is strongly recommended that you do not build libpng with
|
||||
* run-time checks for CPU features if at all possible. In the case of the ARM
|
||||
* NEON instructions there is no processor-specific way of detecting the
|
||||
* presense of the required support, therefore run-time detectioon is extremely
|
||||
* presence of the required support, therefore run-time detection is extremely
|
||||
* OS specific.
|
||||
*
|
||||
* You may set the macro PNG_ARM_NEON_FILE to the file name of file containing
|
||||
@ -130,4 +131,4 @@ png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
|
||||
}
|
||||
}
|
||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
#endif /* READ */
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
/* filter_neon.S - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2013 Glenn Randers-Pehrson
|
||||
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
* Last changed in libpng 1.6.16 [December 22, 2014]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@ -16,9 +16,8 @@
|
||||
#define PNG_READ_SUPPORTED
|
||||
#define MOZ_PNG_HAVE_ARM_NEON
|
||||
|
||||
/* This is required to get the symbol renames, which are #defines, and also
|
||||
* includes the definition (or not) of PNG_ARM_NEON_OPT and
|
||||
* PNG_ARM_NEON_IMPLEMENTATION.
|
||||
/* This is required to get the symbol renames, which are #defines, and the
|
||||
* definitions (or not) of PNG_ARM_NEON_OPT and PNG_ARM_NEON_IMPLEMENTATION.
|
||||
*/
|
||||
#define PNG_VERSION_INFO_ONLY
|
||||
#include "../pngpriv.h"
|
||||
@ -27,6 +26,8 @@
|
||||
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
|
||||
/* Assembler NEON support - only works for 32-bit ARM (i.e. it does not work for
|
||||
* ARM64). The code in arm/filter_neon_intrinsics.c supports ARM64, however it
|
||||
* only works if -mfpu=neon is specified on the GCC command line. See pngpriv.h
|
||||
@ -34,7 +35,6 @@
|
||||
*/
|
||||
#if PNG_ARM_NEON_IMPLEMENTATION == 2 /* hand-coded assembler */
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
#if PNG_ARM_NEON_OPT > 0
|
||||
|
||||
#ifdef __ELF__
|
||||
@ -55,9 +55,8 @@ ELF .size \name, . - \name
|
||||
.text
|
||||
|
||||
/* Explicitly specifying alignment here because some versions of
|
||||
gas don't align code correctly. See
|
||||
http://lists.gnu.org/archive/html/bug-binutils/2011-06/msg00199.html
|
||||
and https://bugzilla.mozilla.org/show_bug.cgi?id=920992
|
||||
* GAS don't align code correctly. This is harmless in correctly
|
||||
* written versions of GAS.
|
||||
*/
|
||||
.align 2
|
||||
|
||||
@ -256,5 +255,5 @@ func png_read_filter_row_paeth3_neon, export=1
|
||||
pop {r4,pc}
|
||||
endfunc
|
||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 2 (assembler) */
|
||||
#endif /* READ */
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
/* filter_neon_intrinsics.c - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2013 Glenn Randers-Pehrson
|
||||
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||
* Written by James Yu <james.yu at linaro.org>, October 2013.
|
||||
* Based on filter_neon.S, written by Mans Rullgard, 2011.
|
||||
*
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
* Last changed in libpng 1.6.16 [December 22, 2014]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@ -14,6 +14,8 @@
|
||||
|
||||
#include "../pngpriv.h"
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
|
||||
/* This code requires -mfpu=neon on the command line: */
|
||||
#if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
|
||||
|
||||
@ -35,7 +37,6 @@
|
||||
#define png_ldr(type,pointer)\
|
||||
(temp_pointer = png_ptr(type,pointer), *temp_pointer)
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
#if PNG_ARM_NEON_OPT > 0
|
||||
|
||||
void
|
||||
@ -368,5 +369,5 @@ png_read_filter_row_paeth4_neon(png_row_infop row_info, png_bytep row,
|
||||
}
|
||||
|
||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 1 (intrinsics) */
|
||||
#endif /* READ */
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||
* Written by John Bowler, 2014.
|
||||
* Last changed in libpng 1.6.10 [March 6, 2014]
|
||||
* Last changed in libpng 1.6.16 [December 22, 2014]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@ -16,8 +16,8 @@
|
||||
* png_have_neon implemented for Linux by reading the widely available
|
||||
* pseudo-file /proc/cpuinfo.
|
||||
*
|
||||
* This code is strict ANSI-C and is probably moderately portable, it does
|
||||
* however use <stdio.h> and assumes that /proc/cpuinfo is never localized.
|
||||
* This code is strict ANSI-C and is probably moderately portable; it does
|
||||
* however use <stdio.h> and it assumes that /proc/cpuinfo is never localized.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
@ -152,8 +152,10 @@ png_have_neon(png_structp png_ptr)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PNG_WARNINGS_SUPPORTED
|
||||
else
|
||||
png_warning(png_ptr, "/proc/cpuinfo open failed");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.6.15 - November 20, 2014
|
||||
libpng version 1.6.16 - December 22, 2014
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.6.15 - November 20, 2014
|
||||
libpng versions 0.97, January 1998, through 1.6.16 - December 22, 2014
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
|
||||
@ -648,15 +648,12 @@ User limits
|
||||
|
||||
The PNG specification allows the width and height of an image to be as
|
||||
large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns.
|
||||
Since very few applications really need to process such large images,
|
||||
we have imposed an arbitrary 1-million limit on rows and columns.
|
||||
Larger images will be rejected immediately with a png_error() call. If
|
||||
you wish to change this limit, you can use
|
||||
you wish to reduce these limits, you can use
|
||||
|
||||
png_set_user_limits(png_ptr, width_max, height_max);
|
||||
|
||||
to set your own limits, or use width_max = height_max = 0x7fffffffL
|
||||
to allow all valid dimensions (libpng may reject some very large images
|
||||
to set your own limits (libpng may reject some very wide images
|
||||
anyway because of potential buffer overflow conditions).
|
||||
|
||||
You should put this statement after you create the PNG structure and
|
||||
@ -5037,8 +5034,8 @@ where "rp" indicates a "restricted pointer".
|
||||
Error detection in some chunks has improved; in particular the iCCP chunk
|
||||
reader now does pretty complete validation of the basic format. Some bad
|
||||
profiles that were previously accepted are now accepted with a warning or
|
||||
rejected, depending upon the png_set_benign_errors() setting, in particular the
|
||||
very old broken Microsoft/HP 3144-byte sRGB profile. Starting with
|
||||
rejected, depending upon the png_set_benign_errors() setting, in particular
|
||||
the very old broken Microsoft/HP 3144-byte sRGB profile. Starting with
|
||||
libpng-1.6.11, recognizing and checking sRGB profiles can be avoided by
|
||||
means of
|
||||
|
||||
@ -5048,8 +5045,8 @@ means of
|
||||
PNG_OPTION_ON);
|
||||
#endif
|
||||
|
||||
It's not a good idea to do this if you are using the "simplified API",
|
||||
which needs to be able to recognize an sRGB profile conveyed via the iCCP
|
||||
It's not a good idea to do this if you are using the new "simplified API",
|
||||
which needs to be able to recognize sRGB profiles conveyed via the iCCP
|
||||
chunk.
|
||||
|
||||
The PNG spec requirement that only grayscale profiles may appear in images
|
||||
@ -5277,13 +5274,13 @@ Other rules can be inferred by inspecting the libpng source.
|
||||
|
||||
XVI. Y2K Compliance in libpng
|
||||
|
||||
November 20, 2014
|
||||
December 22, 2014
|
||||
|
||||
Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.6.15 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.6.16 are Y2K compliant. It is my belief that earlier
|
||||
versions were also Y2K compliant.
|
||||
|
||||
Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||
* Last changed in libpng 1.6.16 [December 22, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@ -14,7 +14,7 @@
|
||||
#include "pngpriv.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef png_libpng_version_1_6_15 Your_png_h_is_not_version_1_6_15;
|
||||
typedef png_libpng_version_1_6_16 Your_png_h_is_not_version_1_6_16;
|
||||
|
||||
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
||||
* of the PNG file signature. If the PNG data is embedded into another
|
||||
@ -769,13 +769,13 @@ png_get_copyright(png_const_structrp png_ptr)
|
||||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.15 - November 20, 2014" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.16 - December 22, 2014" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||
PNG_STRING_NEWLINE;
|
||||
# else
|
||||
return "libpng version 1.6.15 - November 20, 2014\
|
||||
return "libpng version 1.6.16 - December 22, 2014\
|
||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||
@ -1075,7 +1075,7 @@ png_colorspace_set_gamma(png_const_structrp png_ptr,
|
||||
png_colorspacerp colorspace, png_fixed_point gAMA)
|
||||
{
|
||||
/* Changed in libpng-1.5.4 to limit the values to ensure overflow can't
|
||||
* occur. Since the fixed point representation is assymetrical it is
|
||||
* occur. Since the fixed point representation is asymetrical it is
|
||||
* possible for 1/gamma to overflow the limit of 21474 and this means the
|
||||
* gamma value must be at least 5/100000 and hence at most 20000.0. For
|
||||
* safety the limits here are a little narrower. The values are 0.00016 to
|
||||
@ -1324,7 +1324,7 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
|
||||
* (1/white-y), so we can immediately see that as white-y approaches 0 the
|
||||
* accuracy inherent in the cHRM chunk drops off substantially.
|
||||
*
|
||||
* libpng arithmetic: a simple invertion of the above equations
|
||||
* libpng arithmetic: a simple inversion of the above equations
|
||||
* ------------------------------------------------------------
|
||||
*
|
||||
* white_scale = 1/white-y
|
||||
@ -1817,7 +1817,7 @@ png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||
PNG_UNUSED(pos)
|
||||
|
||||
/* This is recoverable, but make it unconditionally an app_error on write to
|
||||
* avoid writing invalid ICC profiles into PNG files. (I.e. we handle them
|
||||
* avoid writing invalid ICC profiles into PNG files (i.e., we handle them
|
||||
* on read, with a warning, but on write unless the app turns off
|
||||
* application errors the PNG won't be written.)
|
||||
*/
|
||||
@ -1836,7 +1836,7 @@ png_colorspace_set_sRGB(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||
/* sRGB sets known gamma, end points and (from the chunk) intent. */
|
||||
/* IMPORTANT: these are not necessarily the values found in an ICC profile
|
||||
* because ICC profiles store values adapted to a D50 environment; it is
|
||||
* expected that the ICC profile mediaWhitePointTag will be D50, see the
|
||||
* expected that the ICC profile mediaWhitePointTag will be D50; see the
|
||||
* checks and code elsewhere to understand this better.
|
||||
*
|
||||
* These XYZ values, which are accurate to 5dp, produce rgb to gray
|
||||
@ -2461,6 +2461,17 @@ png_colorspace_set_rgb_coefficients(png_structrp png_ptr)
|
||||
|
||||
#endif /* COLORSPACE */
|
||||
|
||||
#ifdef __GNUC__
|
||||
/* This exists solely to work round a warning from GNU C. */
|
||||
static int /* PRIVATE */
|
||||
png_gt(size_t a, size_t b)
|
||||
{
|
||||
return a > b;
|
||||
}
|
||||
#else
|
||||
# define png_gt(a,b) ((a) > (b))
|
||||
#endif
|
||||
|
||||
void /* PRIVATE */
|
||||
png_check_IHDR(png_const_structrp png_ptr,
|
||||
png_uint_32 width, png_uint_32 height, int bit_depth,
|
||||
@ -2480,6 +2491,28 @@ png_check_IHDR(png_const_structrp png_ptr,
|
||||
png_warning(png_ptr, "Invalid image width in IHDR");
|
||||
error = 1;
|
||||
}
|
||||
|
||||
else if (png_gt(width,
|
||||
(PNG_SIZE_MAX >> 3) /* 8-byte RGBA pixels */
|
||||
- 48 /* big_row_buf hack */
|
||||
- 1 /* filter byte */
|
||||
- 7*8 /* rounding width to multiple of 8 pix */
|
||||
- 8)) /* extra max_pixel_depth pad */
|
||||
{
|
||||
/* The size of the row must be within the limits of this architecture.
|
||||
* Because the read code can perform arbitrary transformations the
|
||||
* maximum size is checked here. Because the code in png_read_start_row
|
||||
* adds extra space "for safety's sake" in several places a conservative
|
||||
* limit is used here.
|
||||
*
|
||||
* NOTE: it would be far better to check the size that is actually used,
|
||||
* but the effect in the real world is minor and the changes are more
|
||||
* extensive, therefore much more dangerous and much more difficult to
|
||||
* write in a way that avoids compiler warnings.
|
||||
*/
|
||||
png_warning(png_ptr, "Image width is too large for this architecture");
|
||||
error = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.15, November 20, 2014
|
||||
* libpng version 1.6.16, December 22, 2014
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@ -11,7 +11,7 @@
|
||||
* Authors and maintainers:
|
||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||
* libpng versions 0.97, January 1998, through 1.6.15, November 20, 2014: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.6.16, December 22, 2014: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
@ -209,6 +209,9 @@
|
||||
* 1.6.15beta01-08 16 10615 16.so.16.15[.0]
|
||||
* 1.6.15rc01-03 16 10615 16.so.16.15[.0]
|
||||
* 1.6.15 16 10615 16.so.16.15[.0]
|
||||
* 1.6.16beta01-03 16 10616 16.so.16.16[.0]
|
||||
* 1.6.16rc01-02 16 10616 16.so.16.16[.0]
|
||||
* 1.6.16 16 10616 16.so.16.16[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
@ -240,7 +243,7 @@
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.6.15, November 20, 2014, are
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
|
||||
* Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
|
||||
* distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
* with the following individual added to the list of Contributing Authors:
|
||||
@ -352,13 +355,13 @@
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* November 20, 2014
|
||||
* December 22, 2014
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
*
|
||||
* This is your unofficial assurance that libpng from version 0.71 and
|
||||
* upward through 1.6.15 are Y2K compliant. It is my belief that
|
||||
* upward through 1.6.16 are Y2K compliant. It is my belief that
|
||||
* earlier versions were also Y2K compliant.
|
||||
*
|
||||
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||
@ -420,9 +423,9 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.15"
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.16"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.6.15 - November 20, 2014\n"
|
||||
" libpng version 1.6.16 - December 22, 2014\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
@ -430,7 +433,7 @@
|
||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||
#define PNG_LIBPNG_VER_MAJOR 1
|
||||
#define PNG_LIBPNG_VER_MINOR 6
|
||||
#define PNG_LIBPNG_VER_RELEASE 15
|
||||
#define PNG_LIBPNG_VER_RELEASE 16
|
||||
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
@ -461,7 +464,7 @@
|
||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
||||
*/
|
||||
#define PNG_LIBPNG_VER 10615 /* 1.6.15 */
|
||||
#define PNG_LIBPNG_VER 10616 /* 1.6.16 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* the library has been built.
|
||||
@ -581,7 +584,7 @@ extern "C" {
|
||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||
* do not agree upon the version number.
|
||||
*/
|
||||
typedef char* png_libpng_version_1_6_15;
|
||||
typedef char* png_libpng_version_1_6_16;
|
||||
|
||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.6.15,November 20, 2014
|
||||
* libpng version 1.6.16,December 22, 2014
|
||||
*
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -788,6 +788,7 @@ png_inflate_read(png_structrp png_ptr, png_bytep read_buffer, uInt read_size,
|
||||
#endif
|
||||
|
||||
/* Read and check the IDHR chunk */
|
||||
|
||||
void /* PRIVATE */
|
||||
png_handle_IHDR(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
{
|
||||
@ -857,8 +858,7 @@ png_handle_IHDR(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
}
|
||||
|
||||
/* Set up other useful info */
|
||||
png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth *
|
||||
png_ptr->channels);
|
||||
png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth * png_ptr->channels);
|
||||
png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->width);
|
||||
png_debug1(3, "bit_depth = %d", png_ptr->bit_depth);
|
||||
png_debug1(3, "channels = %d", png_ptr->channels);
|
||||
@ -3182,7 +3182,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
||||
{
|
||||
unsigned int pixel_depth = png_ptr->transformed_pixel_depth;
|
||||
png_const_bytep sp = png_ptr->row_buf + 1;
|
||||
png_uint_32 row_width = png_ptr->width;
|
||||
png_alloc_size_t row_width = png_ptr->width;
|
||||
unsigned int pass = png_ptr->pass;
|
||||
png_bytep end_ptr = 0;
|
||||
png_byte end_byte = 0;
|
||||
@ -3457,7 +3457,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
||||
|
||||
/* But don't allow this number to exceed the actual row width. */
|
||||
if (bytes_to_copy > row_width)
|
||||
bytes_to_copy = row_width;
|
||||
bytes_to_copy = (unsigned int)/*SAFE*/row_width;
|
||||
}
|
||||
|
||||
else /* normal row; Adam7 only ever gives us one pixel to copy. */
|
||||
@ -3637,7 +3637,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
||||
dp += bytes_to_jump;
|
||||
row_width -= bytes_to_jump;
|
||||
if (bytes_to_copy > row_width)
|
||||
bytes_to_copy = row_width;
|
||||
bytes_to_copy = (unsigned int)/*SAFE*/row_width;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4443,7 +4443,7 @@ png_read_start_row(png_structrp png_ptr)
|
||||
|
||||
max_pixel_depth = png_ptr->pixel_depth;
|
||||
|
||||
/* WARNING: * png_read_transform_info (pngrtran.c) performs a simpliar set of
|
||||
/* WARNING: * png_read_transform_info (pngrtran.c) performs a simpler set of
|
||||
* calculations to calculate the final pixel depth, then
|
||||
* png_do_read_transforms actually does the transforms. This means that the
|
||||
* code which effectively calculates this value is actually repeated in three
|
||||
|
Loading…
Reference in New Issue
Block a user