Bug 263359 part 1.5: remove nsDirectionalFrame. r=roc

This commit is contained in:
Simon Montagu 2011-04-11 10:59:30 +03:00
parent a156186d20
commit b202223ff2
7 changed files with 27 additions and 218 deletions

View File

@ -1722,7 +1722,6 @@ GK_ATOM(columnSetFrame, "ColumnSetFrame")
GK_ATOM(comboboxControlFrame, "ComboboxControlFrame")
GK_ATOM(comboboxDisplayFrame, "ComboboxDisplayFrame")
GK_ATOM(deckFrame, "DeckFrame")
GK_ATOM(directionalFrame, "DirectionalFrame")
GK_ATOM(fieldSetFrame, "FieldSetFrame")
GK_ATOM(frameSetFrame, "FrameSetFrame")
GK_ATOM(gfxButtonControlFrame, "gfxButtonControlFrame")

View File

@ -47,7 +47,6 @@
#include "nsRenderingContext.h"
#include "nsIServiceManager.h"
#include "nsFrameManager.h"
#include "nsBidiFrames.h"
#include "nsBidiUtils.h"
#include "nsCSSFrameConstructor.h"
#include "nsHTMLContainerFrame.h"
@ -75,8 +74,7 @@ static const PRUnichar ALEF = 0x05D0;
#define CHAR_IS_HEBREW(c) ((0x0590 <= (c)) && ((c)<= 0x05FF))
// Note: The above code are moved from gfx/src/windows/nsRenderingContextWin.cpp
nsIFrame*
NS_NewDirectionalFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
#define NS_BIDI_CONTROL_FRAME ((nsIFrame*)0xfffb1d1)
nsBidiPresUtils::nsBidiPresUtils() : mArraySize(8),
mIndexMap(nsnull),
@ -320,8 +318,6 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame)
mBuffer.SetLength(0);
nsPresContext *presContext = aBlockFrame->PresContext();
nsIPresShell* shell = presContext->PresShell();
nsStyleContext* styleContext = aBlockFrame->GetStyleContext();
// handle bidi-override being set on the block itself before calling
// InitLogicalArray.
@ -330,8 +326,6 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame)
PRUnichar ch = 0;
if (text->mUnicodeBidi == NS_STYLE_UNICODE_BIDI_OVERRIDE) {
nsIFrame *directionalFrame = nsnull;
if (NS_STYLE_DIRECTION_RTL == vis->mDirection) {
ch = kRLO;
}
@ -339,11 +333,8 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame)
ch = kLRO;
}
if (ch != 0) {
directionalFrame = NS_NewDirectionalFrame(shell, styleContext);
if (directionalFrame) {
mLogicalFrames.AppendElement(directionalFrame);
mBuffer.Append(ch);
}
mLogicalFrames.AppendElement(NS_BIDI_CONTROL_FRAME);
mBuffer.Append(ch);
}
}
mPrevContent = nsnull;
@ -354,11 +345,8 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame)
}
if (ch != 0) {
nsIFrame* directionalFrame = NS_NewDirectionalFrame(shell, styleContext);
if (directionalFrame) {
mLogicalFrames.AppendElement(directionalFrame);
mBuffer.Append(kPDF);
}
mLogicalFrames.AppendElement(NS_BIDI_CONTROL_FRAME);
mBuffer.Append(kPDF);
}
// XXX: TODO: Handle preformatted text ('\n')
@ -398,7 +386,6 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame)
nsIFrame* frame = nsnull;
nsIContent* content = nsnull;
PRInt32 contentTextLength;
nsIAtom* frameType = nsnull;
FramePropertyTable *propTable = presContext->PropertyTable();
@ -452,9 +439,17 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame)
break;
}
frame = mLogicalFrames[frameIndex];
frameType = frame->GetType();
lineNeedsUpdate = PR_TRUE;
if (nsGkAtoms::textFrame == frameType) {
if (frame == NS_BIDI_CONTROL_FRAME ||
nsGkAtoms::textFrame != frame->GetType()) {
/*
* Any non-text frame corresponds to a single character in the text buffer
* (a bidi control character, LINE SEPARATOR, or OBJECT SUBSTITUTE)
*/
isTextFrame = PR_FALSE;
fragmentLength = 1;
}
else {
content = frame->GetContent();
if (!content) {
mSuccess = NS_OK;
@ -479,14 +474,6 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame)
contentOffset = start;
isTextFrame = PR_TRUE;
}
else {
/*
* Any non-text frame corresponds to a single character in the text buffer
* (a bidi control character, LINE SEPARATOR, or OBJECT SUBSTITUTE)
*/
isTextFrame = PR_FALSE;
fragmentLength = 1;
}
} // if (fragmentLength <= 0)
if (runLength <= 0) {
@ -505,8 +492,7 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame)
}
} // if (runLength <= 0)
if (nsGkAtoms::directionalFrame == frameType) {
frame->Destroy();
if (frame == NS_BIDI_CONTROL_FRAME) {
frame = nsnull;
++lineOffset;
}
@ -561,7 +547,7 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame)
*/
PRInt32 newIndex = frameIndex;
do {
} while (mLogicalFrames[++newIndex]->GetType() == nsGkAtoms::directionalFrame);
} while (mLogicalFrames[++newIndex] == NS_BIDI_CONTROL_FRAME);
RemoveBidiContinuation(frame, frameIndex, newIndex, lineOffset);
} else if (runLength == fragmentLength) {
/*
@ -585,7 +571,7 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame)
else {
++lineOffset;
}
} // not directionalFrame
} // not bidi control frame
PRInt32 temp = runLength;
runLength -= fragmentLength;
fragmentLength -= temp;
@ -653,9 +639,6 @@ nsBidiPresUtils::InitLogicalArray(nsIFrame* aCurrentFrame)
if (!aCurrentFrame)
return;
nsIPresShell* shell = aCurrentFrame->PresContext()->PresShell();
nsStyleContext* styleContext;
for (nsIFrame* childFrame = aCurrentFrame; childFrame;
childFrame = childFrame->GetNextSibling()) {
@ -679,8 +662,6 @@ nsBidiPresUtils::InitLogicalArray(nsIFrame* aCurrentFrame)
case NS_STYLE_UNICODE_BIDI_NORMAL:
break;
case NS_STYLE_UNICODE_BIDI_EMBED:
styleContext = frame->GetStyleContext();
if (NS_STYLE_DIRECTION_RTL == vis->mDirection) {
ch = kRLE;
}
@ -689,8 +670,6 @@ nsBidiPresUtils::InitLogicalArray(nsIFrame* aCurrentFrame)
}
break;
case NS_STYLE_UNICODE_BIDI_OVERRIDE:
styleContext = frame->GetStyleContext();
if (NS_STYLE_DIRECTION_RTL == vis->mDirection) {
ch = kRLO;
}
@ -700,14 +679,11 @@ nsBidiPresUtils::InitLogicalArray(nsIFrame* aCurrentFrame)
break;
}
// Create a directional frame before the first frame of an
// element specifying embedding or override
// Add a dummy frame pointer representing a bidi control code before the
// first frame of an element specifying embedding or override
if (ch != 0 && !frame->GetPrevContinuation()) {
nsIFrame* dirFrame = NS_NewDirectionalFrame(shell, styleContext);
if (dirFrame) {
mLogicalFrames.AppendElement(dirFrame);
mBuffer.Append(ch);
}
mLogicalFrames.AppendElement(NS_BIDI_CONTROL_FRAME);
mBuffer.Append(ch);
}
}
@ -747,13 +723,10 @@ nsBidiPresUtils::InitLogicalArray(nsIFrame* aCurrentFrame)
// If the element is attributed by dir, indicate direction pop (add PDF frame)
if (ch != 0 && !frame->GetNextContinuation()) {
// Create a directional frame after the last frame of an
// element specifying embedding or override
nsIFrame* dirFrame = NS_NewDirectionalFrame(shell, styleContext);
if (dirFrame) {
mLogicalFrames.AppendElement(dirFrame);
mBuffer.Append(kPDF);
}
// Add a dummy frame pointer representing a bidi control code after the
// last frame of an element specifying embedding or override
mLogicalFrames.AppendElement(NS_BIDI_CONTROL_FRAME);
mBuffer.Append(kPDF);
}
} // for
}
@ -1219,8 +1192,7 @@ nsBidiPresUtils::RemoveBidiContinuation(nsIFrame* aFrame,
for (PRInt32 index = aFirstIndex + 1; index <= aLastIndex; index++) {
nsIFrame* frame = mLogicalFrames[index];
if (nsGkAtoms::directionalFrame == frame->GetType()) {
frame->Destroy();
if (frame == NS_BIDI_CONTROL_FRAME) {
++aOffset;
}
else {

View File

@ -71,13 +71,6 @@ EXPORTS = \
nsObjectFrame.h \
$(NULL)
ifdef IBMBIDI
EXPORTS += \
nsBidiFrames.h \
$(NULL)
endif
CPPSRCS = \
nsAbsoluteContainingBlock.cpp \
nsBRFrame.cpp \
@ -126,12 +119,6 @@ CPPSRCS += \
$(NULL)
endif
ifdef IBMBIDI
CPPSRCS += \
nsBidiFrames.cpp \
$(NULL)
endif
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
CMMSRCS += \
nsPluginUtilsOSX.mm \

View File

@ -1,76 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* IBM Corporation.
* Portions created by the Initial Developer are Copyright (C) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifdef IBMBIDI
#include "nsBidiFrames.h"
#include "nsGkAtoms.h"
nsDirectionalFrame::nsDirectionalFrame(nsStyleContext* aContext)
: nsFrame(aContext)
{
}
nsDirectionalFrame::~nsDirectionalFrame()
{
}
nsIAtom*
nsDirectionalFrame::GetType() const
{
return nsGkAtoms::directionalFrame;
}
#ifdef NS_DEBUG
NS_IMETHODIMP
nsDirectionalFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("Directional"), aResult);
}
#endif
nsIFrame*
NS_NewDirectionalFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) nsDirectionalFrame(aContext);
}
NS_IMPL_FRAMEARENA_HELPERS(nsDirectionalFrame)
#endif /* IBMBIDI */

View File

@ -1,71 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* IBM Corporation.
* Portions created by the Initial Developer are Copyright (C) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifdef IBMBIDI
#ifndef nsBidiFrames_h___
#define nsBidiFrames_h___
#include "nsFrame.h"
class nsDirectionalFrame : public nsFrame
{
protected:
virtual ~nsDirectionalFrame();
public:
NS_DECL_FRAMEARENA_HELPERS
nsDirectionalFrame(nsStyleContext* aContext);
/**
* Get the "type" of the frame
*
* @see nsGkAtoms::directionalFrame
*/
virtual nsIAtom* GetType() const;
#ifdef NS_DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const;
#endif
};
#endif /* nsBidiFrames_h___ */
#endif /* IBMBIDI */

View File

@ -88,7 +88,6 @@ public:
nsContainerFrame_id,
nsContinuingTextFrame_id,
nsDeckFrame_id,
nsDirectionalFrame_id,
nsDocElementBoxFrame_id,
nsFieldSetFrame_id,
nsFileControlFrame_id,

View File

@ -106,7 +106,6 @@
#endif
#include "nsAutoPtr.h"
#include "nsBidiFrames.h"
#include "nsBidiPresUtils.h"
#include "nsBidiUtils.h"