зеркало из https://github.com/mozilla/gecko-dev.git
Bug 531030 - Remove support for the spacer element; r=bzbarsky a=blocking-betaN
This commit is contained in:
Родитель
25a0d33107
Коммит
b00453d727
|
@ -159,7 +159,6 @@ NS_IMPL_RELEASE_INHERITED(nsHTMLSharedElement, nsGenericElement)
|
|||
DOMCI_DATA(HTMLParamElement, nsHTMLSharedElement)
|
||||
DOMCI_DATA(HTMLIsIndexElement, nsHTMLSharedElement)
|
||||
DOMCI_DATA(HTMLBaseElement, nsHTMLSharedElement)
|
||||
DOMCI_DATA(HTMLSpacerElement, nsHTMLSharedElement)
|
||||
DOMCI_DATA(HTMLDirectoryElement, nsHTMLSharedElement)
|
||||
DOMCI_DATA(HTMLMenuElement, nsHTMLSharedElement)
|
||||
DOMCI_DATA(HTMLQuoteElement, nsHTMLSharedElement)
|
||||
|
@ -178,9 +177,6 @@ nsHTMLSharedElement::GetClassInfoInternal()
|
|||
if (mNodeInfo->Equals(nsGkAtoms::base)) {
|
||||
return NS_GetDOMClassInfoInstance(eDOMClassInfo_HTMLBaseElement_id);
|
||||
}
|
||||
if (mNodeInfo->Equals(nsGkAtoms::spacer)) {
|
||||
return NS_GetDOMClassInfoInstance(eDOMClassInfo_HTMLSpacerElement_id);
|
||||
}
|
||||
if (mNodeInfo->Equals(nsGkAtoms::dir)) {
|
||||
return NS_GetDOMClassInfoInstance(eDOMClassInfo_HTMLDirectoryElement_id);
|
||||
}
|
||||
|
@ -278,27 +274,14 @@ nsHTMLSharedElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (mNodeInfo->Equals(nsGkAtoms::spacer)) {
|
||||
if (aAttribute == nsGkAtoms::size) {
|
||||
return aResult.ParseIntWithBounds(aValue, 0);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::align) {
|
||||
return ParseAlignValue(aValue, aResult);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::width ||
|
||||
aAttribute == nsGkAtoms::height) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aNamespaceID == kNameSpaceID_None &&
|
||||
(mNodeInfo->Equals(nsGkAtoms::dir) ||
|
||||
mNodeInfo->Equals(nsGkAtoms::menu))) {
|
||||
if (aAttribute == nsGkAtoms::type) {
|
||||
return aResult.ParseEnumValue(aValue, kListTypeTable, PR_FALSE);
|
||||
}
|
||||
else if (mNodeInfo->Equals(nsGkAtoms::dir) ||
|
||||
mNodeInfo->Equals(nsGkAtoms::menu)) {
|
||||
if (aAttribute == nsGkAtoms::type) {
|
||||
return aResult.ParseEnumValue(aValue, kListTypeTable, PR_FALSE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::start) {
|
||||
return aResult.ParseIntWithBounds(aValue, 1);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::start) {
|
||||
return aResult.ParseIntWithBounds(aValue, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,98 +289,6 @@ nsHTMLSharedElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
aResult);
|
||||
}
|
||||
|
||||
// spacer element code
|
||||
|
||||
static void
|
||||
SpacerMapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aData)
|
||||
{
|
||||
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
|
||||
|
||||
if (aData->mSIDs & (NS_STYLE_INHERIT_BIT(Position) |
|
||||
NS_STYLE_INHERIT_BIT(Display))) {
|
||||
PRBool typeIsBlock = PR_FALSE;
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::type);
|
||||
if (value && value->Type() == nsAttrValue::eString) {
|
||||
const nsString& tmp(value->GetStringValue());
|
||||
if (tmp.LowerCaseEqualsLiteral("line") ||
|
||||
tmp.LowerCaseEqualsLiteral("vert") ||
|
||||
tmp.LowerCaseEqualsLiteral("vertical") ||
|
||||
tmp.LowerCaseEqualsLiteral("block")) {
|
||||
// This is not strictly 100% compatible: if the spacer is given
|
||||
// a width of zero then it is basically ignored.
|
||||
typeIsBlock = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) {
|
||||
if (typeIsBlock) {
|
||||
// width: value
|
||||
if (aData->mPositionData->mWidth.GetUnit() == eCSSUnit_Null) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width);
|
||||
if (value && value->Type() == nsAttrValue::eInteger) {
|
||||
aData->mPositionData->
|
||||
mWidth.SetFloatValue((float)value->GetIntegerValue(),
|
||||
eCSSUnit_Pixel);
|
||||
} else if (value && value->Type() == nsAttrValue::ePercent) {
|
||||
aData->mPositionData->
|
||||
mWidth.SetPercentValue(value->GetPercentValue());
|
||||
}
|
||||
}
|
||||
|
||||
// height: value
|
||||
if (aData->mPositionData->mHeight.GetUnit() == eCSSUnit_Null) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::height);
|
||||
if (value && value->Type() == nsAttrValue::eInteger) {
|
||||
aData->mPositionData->
|
||||
mHeight.SetFloatValue((float)value->GetIntegerValue(),
|
||||
eCSSUnit_Pixel);
|
||||
} else if (value && value->Type() == nsAttrValue::ePercent) {
|
||||
aData->mPositionData->
|
||||
mHeight.SetPercentValue(value->GetPercentValue());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// size: value
|
||||
if (aData->mPositionData->mWidth.GetUnit() == eCSSUnit_Null) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::size);
|
||||
if (value && value->Type() == nsAttrValue::eInteger)
|
||||
aData->mPositionData->
|
||||
mWidth.SetFloatValue((float)value->GetIntegerValue(),
|
||||
eCSSUnit_Pixel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Display)) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::align);
|
||||
if (value && value->Type() == nsAttrValue::eEnum) {
|
||||
PRInt32 align = value->GetEnumValue();
|
||||
if (aData->mDisplayData->mFloat.GetUnit() == eCSSUnit_Null) {
|
||||
if (align == NS_STYLE_TEXT_ALIGN_LEFT)
|
||||
aData->mDisplayData->mFloat.SetIntValue(NS_STYLE_FLOAT_LEFT,
|
||||
eCSSUnit_Enumerated);
|
||||
else if (align == NS_STYLE_TEXT_ALIGN_RIGHT)
|
||||
aData->mDisplayData->mFloat.SetIntValue(NS_STYLE_FLOAT_RIGHT,
|
||||
eCSSUnit_Enumerated);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeIsBlock) {
|
||||
if (aData->mDisplayData->mDisplay.GetUnit() == eCSSUnit_Null) {
|
||||
aData->mDisplayData->mDisplay.SetIntValue(NS_STYLE_DISPLAY_BLOCK,
|
||||
eCSSUnit_Enumerated);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Any new structs that don't need typeIsBlock should go outside
|
||||
// the code that calculates it.
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
}
|
||||
|
||||
static void
|
||||
DirectoryMenuMapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aData)
|
||||
|
@ -422,25 +313,6 @@ DirectoryMenuMapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
NS_IMETHODIMP_(PRBool)
|
||||
nsHTMLSharedElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
{
|
||||
if (mNodeInfo->Equals(nsGkAtoms::spacer)) {
|
||||
static const MappedAttributeEntry attributes[] = {
|
||||
// XXXldb This is just wrong.
|
||||
{ &nsGkAtoms::usemap },
|
||||
{ &nsGkAtoms::ismap },
|
||||
{ &nsGkAtoms::align },
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
static const MappedAttributeEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
sImageMarginSizeAttributeMap,
|
||||
sImageBorderAttributeMap,
|
||||
};
|
||||
|
||||
return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
|
||||
}
|
||||
|
||||
if (mNodeInfo->Equals(nsGkAtoms::dir)) {
|
||||
static const MappedAttributeEntry attributes[] = {
|
||||
{ &nsGkAtoms::type },
|
||||
|
@ -598,11 +470,7 @@ nsHTMLSharedElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
|
|||
nsMapRuleToAttributesFunc
|
||||
nsHTMLSharedElement::GetAttributeMappingFunction() const
|
||||
{
|
||||
if (mNodeInfo->Equals(nsGkAtoms::spacer)) {
|
||||
return &SpacerMapAttributesIntoRule;
|
||||
}
|
||||
else if (mNodeInfo->Equals(nsGkAtoms::dir) ||
|
||||
mNodeInfo->Equals(nsGkAtoms::menu)) {
|
||||
if (mNodeInfo->Equals(nsGkAtoms::dir) || mNodeInfo->Equals(nsGkAtoms::menu)) {
|
||||
return &DirectoryMenuMapAttributesIntoRule;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,6 @@ objectIfaces2.push("nsIImageLoadingContent");
|
|||
ol
|
||||
param
|
||||
q
|
||||
spacer
|
||||
ul
|
||||
wbr
|
||||
head
|
||||
|
@ -210,7 +209,6 @@ HTML_TAG("script", "Script", [], [ "nsIScriptLoaderObserver" ]);
|
|||
HTML_TAG("section", "") // HTMLElement
|
||||
HTML_TAG("select", "Select");
|
||||
HTML_TAG("small", ""); // HTMLElement
|
||||
HTML_TAG("spacer", "Spacer");
|
||||
HTML_TAG("span", "Span");
|
||||
HTML_TAG("strike", ""); // HTMLElement
|
||||
HTML_TAG("strong", ""); // HTMLElement
|
||||
|
|
|
@ -837,8 +837,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
NS_DEFINE_CLASSINFO_DATA(HTMLSelectElement, nsHTMLSelectElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_GETPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(HTMLSpacerElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(HTMLSpanElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(HTMLStyleElement, nsElementSH,
|
||||
|
@ -2714,11 +2712,6 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(HTMLSpacerElement, nsIDOMHTMLElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLElement)
|
||||
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(HTMLSpanElement, nsIDOMHTMLElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLElement)
|
||||
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
|
||||
|
|
|
@ -130,7 +130,6 @@ DOMCI_CLASS(HTMLPreElement)
|
|||
DOMCI_CLASS(HTMLQuoteElement)
|
||||
DOMCI_CLASS(HTMLScriptElement)
|
||||
DOMCI_CLASS(HTMLSelectElement)
|
||||
DOMCI_CLASS(HTMLSpacerElement)
|
||||
DOMCI_CLASS(HTMLSpanElement)
|
||||
DOMCI_CLASS(HTMLStyleElement)
|
||||
DOMCI_CLASS(HTMLTableCaptionElement)
|
||||
|
|
|
@ -690,7 +690,6 @@ static const nsElementInfo kElements[eHTMLTag_userdefined] = {
|
|||
#if defined(MOZ_MEDIA)
|
||||
ELEM(source, PR_FALSE, PR_FALSE, GROUP_NONE, GROUP_NONE),
|
||||
#endif
|
||||
ELEM(spacer, PR_FALSE, PR_FALSE, GROUP_NONE, GROUP_NONE),
|
||||
ELEM(span, PR_TRUE, PR_TRUE, GROUP_SPECIAL, GROUP_INLINE_ELEMENT),
|
||||
ELEM(strike, PR_TRUE, PR_TRUE, GROUP_FONTSTYLE, GROUP_INLINE_ELEMENT),
|
||||
ELEM(strong, PR_TRUE, PR_TRUE, GROUP_PHRASE, GROUP_INLINE_ELEMENT),
|
||||
|
|
|
@ -3599,7 +3599,6 @@ nsCSSFrameConstructor::FindHTMLData(nsIContent* aContent,
|
|||
SIMPLE_TAG_CREATE(legend, NS_NewLegendFrame),
|
||||
SIMPLE_TAG_CREATE(frameset, NS_NewHTMLFramesetFrame),
|
||||
SIMPLE_TAG_CREATE(iframe, NS_NewSubDocumentFrame),
|
||||
SIMPLE_TAG_CREATE(spacer, NS_NewSpacerFrame),
|
||||
COMPLEX_TAG_CREATE(button, &nsCSSFrameConstructor::ConstructButtonFrame),
|
||||
SIMPLE_TAG_CREATE(canvas, NS_NewHTMLCanvasFrame),
|
||||
#if defined(MOZ_MEDIA)
|
||||
|
|
|
@ -112,7 +112,6 @@ CPPSRCS = \
|
|||
nsPlaceholderFrame.cpp \
|
||||
nsSelection.cpp \
|
||||
nsSimplePageSequence.cpp \
|
||||
nsSpacerFrame.cpp \
|
||||
nsSplittableFrame.cpp \
|
||||
nsTextFrameThebes.cpp \
|
||||
nsTextFrameUtils.cpp \
|
||||
|
|
|
@ -137,8 +137,6 @@ NS_NewPositionedInlineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
|||
nsIFrame*
|
||||
NS_NewObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
nsIFrame*
|
||||
NS_NewSpacerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
nsIFrame*
|
||||
NS_NewTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
nsIFrame*
|
||||
NS_NewContinuingTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
|
|
|
@ -245,7 +245,6 @@ public:
|
|||
nsVideoFrame_id,
|
||||
nsXULLabelFrame_id,
|
||||
nsXULScrollFrame_id,
|
||||
SpacerFrame_id,
|
||||
ViewportFrame_id,
|
||||
|
||||
// The PresArena implementation uses this bit to distinguish
|
||||
|
|
|
@ -1,214 +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
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* 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 ***** */
|
||||
|
||||
/* rendering object for HTML <spacer> element */
|
||||
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsFrame.h"
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
// Spacer type's
|
||||
#define TYPE_WORD 0 // horizontal space
|
||||
#define TYPE_LINE 1 // line-break + vertical space
|
||||
#define TYPE_IMAGE 2 // acts like a sized image with nothing to see
|
||||
|
||||
class SpacerFrame : public nsFrame
|
||||
{
|
||||
public:
|
||||
NS_DECL_FRAMEARENA_HELPERS
|
||||
|
||||
friend nsIFrame* NS_NewSpacerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
|
||||
// nsIHTMLReflow
|
||||
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
|
||||
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
|
||||
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
PRUint8 GetSpacerType();
|
||||
|
||||
protected:
|
||||
SpacerFrame(nsStyleContext* aContext) : nsFrame(aContext) {}
|
||||
virtual ~SpacerFrame();
|
||||
void GetDesiredSize(nsHTMLReflowMetrics& aMetrics, nsSize aPercentBase);
|
||||
};
|
||||
|
||||
nsIFrame*
|
||||
NS_NewSpacerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
const nsStyleDisplay* disp = aContext->GetStyleDisplay();
|
||||
NS_ASSERTION(!disp->IsAbsolutelyPositioned() && !disp->IsFloating(),
|
||||
"Spacers should not be positioned and should not float");
|
||||
#endif
|
||||
|
||||
return new (aPresShell) SpacerFrame(aContext);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(SpacerFrame)
|
||||
|
||||
SpacerFrame::~SpacerFrame()
|
||||
{
|
||||
}
|
||||
|
||||
/* virtual */ nscoord
|
||||
SpacerFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
|
||||
{
|
||||
nsHTMLReflowMetrics metrics;
|
||||
DISPLAY_MIN_WIDTH(this, metrics.width);
|
||||
GetDesiredSize(metrics, nsSize(0, 0));
|
||||
return metrics.width;
|
||||
}
|
||||
|
||||
/* virtual */ nscoord
|
||||
SpacerFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
|
||||
{
|
||||
nsHTMLReflowMetrics metrics;
|
||||
DISPLAY_PREF_WIDTH(this, metrics.width);
|
||||
GetDesiredSize(metrics, nsSize(0, 0));
|
||||
return metrics.width;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SpacerFrame::Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
DO_GLOBAL_REFLOW_COUNT("SpacerFrame");
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
|
||||
// XXX Bug 379654 Should use containing block size!
|
||||
nsSize percentBase(aReflowState.availableWidth, aReflowState.availableHeight);
|
||||
if (percentBase.width == NS_UNCONSTRAINEDSIZE)
|
||||
percentBase.width = 0;
|
||||
if (percentBase.height == NS_UNCONSTRAINEDSIZE)
|
||||
percentBase.height = 0;
|
||||
|
||||
if (GetSpacerType() == TYPE_LINE)
|
||||
aStatus = NS_INLINE_LINE_BREAK_AFTER(NS_FRAME_COMPLETE);
|
||||
|
||||
GetDesiredSize(aMetrics, percentBase);
|
||||
|
||||
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
SpacerFrame::GetDesiredSize(nsHTMLReflowMetrics& aMetrics, nsSize aPercentBase)
|
||||
{
|
||||
// By default, we have no area
|
||||
aMetrics.width = 0;
|
||||
aMetrics.height = 0;
|
||||
|
||||
// XXX Bug 379654 This code doesn't handle some value types for width
|
||||
// and height, doesn't handle min/max-width/height, doesn't handle
|
||||
// border and padding, doesn't handle 'ch' units, doesn't handle the
|
||||
// enumerated values on width, etc. But it probably doesn't much
|
||||
// matter.
|
||||
|
||||
const nsStylePosition* position = GetStylePosition();
|
||||
|
||||
PRUint8 type = GetSpacerType();
|
||||
switch (type) {
|
||||
case TYPE_WORD:
|
||||
break;
|
||||
|
||||
case TYPE_LINE:
|
||||
if (eStyleUnit_Coord == position->mHeight.GetUnit()) {
|
||||
aMetrics.height = position->mHeight.GetCoordValue();
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_IMAGE:
|
||||
// width
|
||||
nsStyleUnit unit = position->mWidth.GetUnit();
|
||||
if (eStyleUnit_Coord == unit) {
|
||||
aMetrics.width = position->mWidth.GetCoordValue();
|
||||
}
|
||||
else if (eStyleUnit_Percent == unit)
|
||||
{
|
||||
float factor = position->mWidth.GetPercentValue();
|
||||
aMetrics.width = NSToCoordRound(factor * aPercentBase.width);
|
||||
}
|
||||
// else treat enumerated values and calc() like 'auto'
|
||||
|
||||
// height
|
||||
unit = position->mHeight.GetUnit();
|
||||
if (eStyleUnit_Coord == unit) {
|
||||
aMetrics.height = position->mHeight.GetCoordValue();
|
||||
}
|
||||
else if (eStyleUnit_Percent == unit)
|
||||
{
|
||||
float factor = position->mHeight.GetPercentValue();
|
||||
aMetrics.height = NSToCoordRound(factor * aPercentBase.height);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (aMetrics.width || aMetrics.height) {
|
||||
// Make sure that the other dimension is non-zero
|
||||
if (!aMetrics.width) aMetrics.width = 1;
|
||||
if (!aMetrics.height) aMetrics.height = 1;
|
||||
}
|
||||
}
|
||||
|
||||
PRUint8
|
||||
SpacerFrame::GetSpacerType()
|
||||
{
|
||||
PRUint8 type = TYPE_WORD;
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::line, &nsGkAtoms::vert, &nsGkAtoms::vertical,
|
||||
&nsGkAtoms::block, nsnull};
|
||||
switch (mContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type,
|
||||
strings, eIgnoreCase)) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
return TYPE_LINE;
|
||||
case 3:
|
||||
return TYPE_IMAGE;
|
||||
}
|
||||
return type;
|
||||
}
|
|
@ -166,7 +166,6 @@ HTML_HTMLELEMENT_TAG(small)
|
|||
#if defined(MOZ_MEDIA)
|
||||
HTML_TAG(source, Source)
|
||||
#endif
|
||||
HTML_TAG(spacer, Shared)
|
||||
HTML_TAG(span, Span)
|
||||
HTML_HTMLELEMENT_TAG(strike)
|
||||
HTML_HTMLELEMENT_TAG(strong)
|
||||
|
|
|
@ -1074,16 +1074,6 @@ const nsHTMLElement gHTMLElements[] = {
|
|||
/*special parents,kids*/ &gSourceParents,0,
|
||||
},
|
||||
#endif
|
||||
{
|
||||
|
||||
/*tag*/ eHTMLTag_spacer,
|
||||
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
|
||||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kExtensions, kNone, kNone,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids*/ 0,0,
|
||||
},
|
||||
{
|
||||
|
||||
// I made span a special% tag again, (instead of inline).
|
||||
|
|
Загрузка…
Ссылка в новой задаче