mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
ee05861206
- Bug 1187056 - Dispatch the meta tag mutation events sooner so that any meta-viewport changes can be processed before scripts continue running. r=smaug (2e6f76079f)
- Bug 1238804. Make <base> actually work in a srcdoc document. r=smaug (a421e7c598)
- Bug 1239585 - Remove eSupportSVG from nsObjectLoadingContent capabilities; r=bz (68a79ef21b)
- Bug 1170572 - MQ CSS change not observed by picture source elements r=jdm (efc0be616e)
- Bug 1206720 - Remove invalid assertions during response image loading. r=jdm (0b6485de95)
- Bug 1229032 - don't copy arrays in PerformanceObserver::Observe; r=baku (f1b70e0bd2)
- Bug 1241840 - Set table cell colspan=0 to 1 instead per the HTML spec. r=bz (1900962d4c)
- Bug 812899 part 1. Split the "image is overflow" concept in ImageDocument into two separate booleans for vertical and horizontal overflow. r=khuey (8735b610f3)
- Bug 812899 part 2. Change the centering code in nsImageDocument to only try vertically centering via auto margins when we're not overflowing in the vertical direction, because if we _are_ overflowing that should cut off part of the image per spec. r=khuey (c3b84a8048)
- Bug 812899 part 3 - Make vertical 'auto' margins on absolutely positioned elements always center, even when the margins are negative. r=dbaron (e345fb9383)
- Bug 1238427 - Avoid a strong reference from the timeout timer to nsGeolocationRequest. r=jdm (2ad4dd3955)
- Bug 1240906 - Shut down geolocation service at xpcom-shutdown instead of quit-application. r=dougt (1e7fc9e624)
- Bug 1129633 - part1. Use win8 geolocation with a fallback to MLS - r=m_kato (3323b4a120)
- Bug 1145111: ensure the pos. cache isn't reset when nsGeolocationService shuts down provider. r=jdm (e69cab889a)
- Bug 1240664 - Only enable bug 1216148's behavior when there is a wakelock support. r=kanru (543a3a55b4)
- Bug 1240766 - Fix startup crash in Geolocation::Init() when principal URI is null r=jdm (1ece684418)
- Bug 1238873 - Handle the bug that if we take cached data, we might not get any update later. r=kchen. r=jdm. (ca186e89b3)
- Bug 1240666 - Follow-up to bug 1216148. r=kchen. (3f650b5f72)
- Bug 1227119 - Set a default value for variable ret. r=dougt (5b68dd1a22)
- Bug 1027734 - Convert mozPay to WebIDL. r=bzbarsky. (a4fd10d539)
- Bug 1214488 - Allow native callers in GetEntryGlobal. r=me (ca68cc8896)
- Bug 1248719. Fix things so that taking ownership of error reporting on an AutoJSAPI on a worker is OK even if that AutoJSAPI was initialized without an explicit global. r=bholley (b8e59eebc6)
- Bug 1156065 - Send cloneable messages from SiteSpecificUserAgent.js to fix UA overrides r=billm (e5cdbe96f6)
- Bug 1210099 - Fix structured clone of expanded principal (r=bholley) (01a5fd4e47)
- Bug 1230351: Replace ThirdPartyUtil::IsThirdPartyInternal's warning-spammy NS_ENSURE_ARG with an equivalent check that lacks the warning. r=mrbkap (037c39472c)
- Bug 1184293 - Don't call ThirdPartyUtil::GetBaseDomain if aUri is null. r=jduell (4853c0e9e0)
- Bug 862147 - instrument usage of window.sidebar.addSearchEngine, r=froydnj,smaug. (ef52ded1c0)
- Bug 1214764 - Convert NS_ENSURE to a plain return in nsDocument::IsScriptEnabled. r=bholley (0f3b6d63b4)
- Bug 1245950: Privately inherit from legacy interfaces nsIDOMWindow/nsIDOMWindowInternal. r=smaug (ff1d431d0d)
- Bug 1245950: Followup to null check before asserting. r=me CLOSED TREE (6e93af4a4a)
- Bug 1236607, pointerlock code should null check inner window before using it, r=xidorn (896d9723d5)
- Bug 1245245 - Fix typo in error string URL. r=botond (58c9548f15)
- Bug 1220604 - Remove dead code from nsGlobalWindow::SetNewDocument. r=baku (fc875db5e4)
- Bug 1247049 - Optimize GetScreenXY by using the new nsDeviceContext method to get desktop scale factor. r=emk (de66d59631)
- missing bit of Bug 962249 part 3 (0b15f8b670)
- Bug 1240978 - Shorten timeout for black screen in fullscreen transition. r=smaug (2554a8e5a7)
- Bug 1246346 - patch 1 - Expose a DesktopToDevice scale factor on nsDeviceContext. r=emk (03856ec7b4)
- Bug 1246346 - patch 2 - Correct the origin of the DOM screen coordinates (screen.left, screen.top) for secondary display on a mixed-DPI configuration. r=emk (15ac2d3be6)
- Bug 1196159 - Set nsGlobalWindow::mIsClosed properly after window.close(). r=billm (27334e4b61)
- Bug 1240241 - Don't recurse infinitely in FilterCachedColorModels::ForColorModel if the original filter node was null. r=roc (1730db5ca7)
- Bug 1247706 - "Please don't disable WebGL if crashed on WebGL context". r=dvander (e25621753e)
- Bug 1244742. Use the default copy constructor and assignment operators. (0dac3bcbfb)
- Bug 1230929 - modified the logic in order to prvent null pointer dereference. r=jmuizelaar (1d5761abc9)
- Bug 1247979. Optimize ScaleToOutsidePixels. r=kats (2b9ef41111)
- Bug 1249368 - use UniquePtr instead of nsAutoArrayPtr in gfxAlphaBoxBlur; r=jrmuizel (e60419d49d)
- Bug 1082598 - Part 4: Workaround for naming conflict in unified sources for Skia and thebes DWrite fonts. r=jrmuizel (84a9e11ded)
- Bug 1172817 - Remove PL_DHashTableEnumerate() use from FontNameCache. r=jtd. (b0632cd825)
- Bug 1197717 - Load fonts from profile-agnostic writable location. r=jfkthame (c9227268ff)
- Bug 1246889 - Correctly check whether hb_blob_create failed in ShareTableAndGetBlob. r=jfkthame (f8c62776be)
- Bug 1246834 - Fix memory reporting of nsFontFamily{List,Name}. r=jfkthame. (0535b8c110)
- Bug 1238134 P1 Provide a Response.cloneUnfiltered() method for chrome code to access internal Response state. r=ehsan (3dc25b1501)
- Bug 1238134 P2 Test chrome-only Response.cloneUnfiltered(). r=ehsan (3c307c4ec0)
- Bug 1100949 - wrap font info reads with structured exception handler. r=bas (2c2cacb05e)
- Bug 1241931 - On shutdown stop any ongoing loading of fonts; GDI in particular. r=jdaggett (057aae8cab)
- Bug 1154182 - enable native keybindings for graphene. r=billm (33e706a020)
- Bug 1167081 - Call PuppetWidget::Destroy() in its destructor. r=roc (58115c3029)
- Bug 1222662 - Disable cursor caching in the content process on Windows. r=aklotz (e760794ee2)
- Bug 1240891 - Silence warning from calling GetNativeData(NS_NATIVE_WINDOW). r=roc (d766a47f66)
- Bug 1248981 - Fix spelling error in nsMenuUtilsX.mm, a=tomcat (b93c16b961)
- Bug 1197925 - Use channel->Open2() in intl/hyphenation/hnjstdio.cpp (r=sicking) (2bf5dd3cd3)
- Bug 1248339 - fix header sort order of hal. r=gsvelto (01b61a2f5d)
- Bug 1232687: Add system-service interface to HAL, r=gsvelto (ab692e1508)
- Bug 1236762 - Simplify locking APIs for SharedSurface. - r=jrmuizel (901ae94a85)
547 lines
13 KiB
C++
547 lines
13 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=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/. */
|
|
|
|
#include "mozilla/dom/HTMLTableCellElement.h"
|
|
#include "mozilla/dom/HTMLTableElement.h"
|
|
#include "mozilla/dom/HTMLTableRowElement.h"
|
|
#include "nsMappedAttributes.h"
|
|
#include "nsAttrValueInlines.h"
|
|
#include "nsRuleData.h"
|
|
#include "nsRuleWalker.h"
|
|
#include "celldata.h"
|
|
#include "mozilla/dom/HTMLTableCellElementBinding.h"
|
|
|
|
NS_IMPL_NS_NEW_HTML_ELEMENT(TableCell)
|
|
|
|
namespace mozilla {
|
|
namespace dom {
|
|
|
|
HTMLTableCellElement::~HTMLTableCellElement()
|
|
{
|
|
}
|
|
|
|
JSObject*
|
|
HTMLTableCellElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
|
{
|
|
return HTMLTableCellElementBinding::Wrap(aCx, this, aGivenProto);
|
|
}
|
|
|
|
NS_IMPL_ISUPPORTS_INHERITED(HTMLTableCellElement, nsGenericHTMLElement,
|
|
nsIDOMHTMLTableCellElement)
|
|
|
|
NS_IMPL_ELEMENT_CLONE(HTMLTableCellElement)
|
|
|
|
|
|
// protected method
|
|
HTMLTableRowElement*
|
|
HTMLTableCellElement::GetRow() const
|
|
{
|
|
return HTMLTableRowElement::FromContentOrNull(GetParent());
|
|
}
|
|
|
|
// protected method
|
|
HTMLTableElement*
|
|
HTMLTableCellElement::GetTable() const
|
|
{
|
|
nsIContent *parent = GetParent();
|
|
if (!parent) {
|
|
return nullptr;
|
|
}
|
|
|
|
// parent should be a row.
|
|
nsIContent* section = parent->GetParent();
|
|
if (!section) {
|
|
return nullptr;
|
|
}
|
|
|
|
if (section->IsHTMLElement(nsGkAtoms::table)) {
|
|
// XHTML, without a row group.
|
|
return static_cast<HTMLTableElement*>(section);
|
|
}
|
|
|
|
// We have a row group.
|
|
nsIContent* result = section->GetParent();
|
|
if (result && result->IsHTMLElement(nsGkAtoms::table)) {
|
|
return static_cast<HTMLTableElement*>(result);
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
int32_t
|
|
HTMLTableCellElement::CellIndex() const
|
|
{
|
|
HTMLTableRowElement* row = GetRow();
|
|
if (!row) {
|
|
return -1;
|
|
}
|
|
|
|
nsIHTMLCollection* cells = row->Cells();
|
|
if (!cells) {
|
|
return -1;
|
|
}
|
|
|
|
uint32_t numCells = cells->Length();
|
|
for (uint32_t i = 0; i < numCells; i++) {
|
|
if (cells->Item(i) == this) {
|
|
return i;
|
|
}
|
|
}
|
|
|
|
return -1;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::GetCellIndex(int32_t* aCellIndex)
|
|
{
|
|
*aCellIndex = CellIndex();
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
|
{
|
|
nsresult rv = nsGenericHTMLElement::WalkContentStyleRules(aRuleWalker);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (HTMLTableElement* table = GetTable()) {
|
|
nsMappedAttributes* tableInheritedAttributes =
|
|
table->GetAttributesMappedForCell();
|
|
if (tableInheritedAttributes) {
|
|
aRuleWalker->Forward(tableInheritedAttributes);
|
|
}
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::SetAbbr(const nsAString& aAbbr)
|
|
{
|
|
ErrorResult rv;
|
|
SetAbbr(aAbbr, rv);
|
|
return rv.StealNSResult();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::GetAbbr(nsAString& aAbbr)
|
|
{
|
|
DOMString abbr;
|
|
GetAbbr(abbr);
|
|
abbr.ToString(aAbbr);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::SetAxis(const nsAString& aAxis)
|
|
{
|
|
ErrorResult rv;
|
|
SetAxis(aAxis, rv);
|
|
return rv.StealNSResult();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::GetAxis(nsAString& aAxis)
|
|
{
|
|
DOMString axis;
|
|
GetAxis(axis);
|
|
axis.ToString(aAxis);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::SetAlign(const nsAString& aAlign)
|
|
{
|
|
ErrorResult rv;
|
|
SetAlign(aAlign, rv);
|
|
return rv.StealNSResult();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::GetAlign(nsAString& aAlign)
|
|
{
|
|
DOMString align;
|
|
GetAlign(align);
|
|
align.ToString(aAlign);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::SetVAlign(const nsAString& aVAlign)
|
|
{
|
|
ErrorResult rv;
|
|
SetVAlign(aVAlign, rv);
|
|
return rv.StealNSResult();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::GetVAlign(nsAString& aVAlign)
|
|
{
|
|
DOMString vAlign;
|
|
GetVAlign(vAlign);
|
|
vAlign.ToString(aVAlign);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::SetCh(const nsAString& aCh)
|
|
{
|
|
ErrorResult rv;
|
|
SetCh(aCh, rv);
|
|
return rv.StealNSResult();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::GetCh(nsAString& aCh)
|
|
{
|
|
DOMString ch;
|
|
GetCh(ch);
|
|
ch.ToString(aCh);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::SetChOff(const nsAString& aChOff)
|
|
{
|
|
ErrorResult rv;
|
|
SetChOff(aChOff, rv);
|
|
return rv.StealNSResult();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::GetChOff(nsAString& aChOff)
|
|
{
|
|
DOMString chOff;
|
|
GetChOff(chOff);
|
|
chOff.ToString(aChOff);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::SetBgColor(const nsAString& aBgColor)
|
|
{
|
|
ErrorResult rv;
|
|
SetBgColor(aBgColor, rv);
|
|
return rv.StealNSResult();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::GetBgColor(nsAString& aBgColor)
|
|
{
|
|
DOMString bgColor;
|
|
GetBgColor(bgColor);
|
|
bgColor.ToString(aBgColor);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::SetHeight(const nsAString& aHeight)
|
|
{
|
|
ErrorResult rv;
|
|
SetHeight(aHeight, rv);
|
|
return rv.StealNSResult();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::GetHeight(nsAString& aHeight)
|
|
{
|
|
DOMString height;
|
|
GetHeight(height);
|
|
height.ToString(aHeight);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::SetWidth(const nsAString& aWidth)
|
|
{
|
|
ErrorResult rv;
|
|
SetWidth(aWidth, rv);
|
|
return rv.StealNSResult();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::GetWidth(nsAString& aWidth)
|
|
{
|
|
DOMString width;
|
|
GetWidth(width);
|
|
width.ToString(aWidth);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::SetNoWrap(bool aNoWrap)
|
|
{
|
|
ErrorResult rv;
|
|
SetNoWrap(aNoWrap, rv);
|
|
return rv.StealNSResult();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::GetNoWrap(bool* aNoWrap)
|
|
{
|
|
*aNoWrap = NoWrap();
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::SetScope(const nsAString& aScope)
|
|
{
|
|
ErrorResult rv;
|
|
SetScope(aScope, rv);
|
|
return rv.StealNSResult();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::GetScope(nsAString& aScope)
|
|
{
|
|
DOMString scope;
|
|
GetScope(scope);
|
|
scope.ToString(aScope);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::SetHeaders(const nsAString& aHeaders)
|
|
{
|
|
ErrorResult rv;
|
|
SetHeaders(aHeaders, rv);
|
|
return rv.StealNSResult();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::GetHeaders(nsAString& aHeaders)
|
|
{
|
|
DOMString headers;
|
|
GetHeaders(headers);
|
|
headers.ToString(aHeaders);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::SetColSpan(int32_t aColSpan)
|
|
{
|
|
ErrorResult rv;
|
|
SetColSpan(aColSpan, rv);
|
|
return rv.StealNSResult();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::GetColSpan(int32_t* aColSpan)
|
|
{
|
|
*aColSpan = ColSpan();
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::SetRowSpan(int32_t aRowSpan)
|
|
{
|
|
ErrorResult rv;
|
|
SetRowSpan(aRowSpan, rv);
|
|
return rv.StealNSResult();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
HTMLTableCellElement::GetRowSpan(int32_t* aRowSpan)
|
|
{
|
|
*aRowSpan = RowSpan();
|
|
return NS_OK;
|
|
}
|
|
|
|
void
|
|
HTMLTableCellElement::GetAlign(DOMString& aValue)
|
|
{
|
|
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::align, aValue)) {
|
|
// There's no align attribute, ask the row for the alignment.
|
|
HTMLTableRowElement* row = GetRow();
|
|
if (row) {
|
|
row->GetAlign(aValue);
|
|
}
|
|
}
|
|
}
|
|
|
|
static const nsAttrValue::EnumTable kCellScopeTable[] = {
|
|
{ "row", NS_STYLE_CELL_SCOPE_ROW },
|
|
{ "col", NS_STYLE_CELL_SCOPE_COL },
|
|
{ "rowgroup", NS_STYLE_CELL_SCOPE_ROWGROUP },
|
|
{ "colgroup", NS_STYLE_CELL_SCOPE_COLGROUP },
|
|
{ 0 }
|
|
};
|
|
|
|
bool
|
|
HTMLTableCellElement::ParseAttribute(int32_t aNamespaceID,
|
|
nsIAtom* aAttribute,
|
|
const nsAString& aValue,
|
|
nsAttrValue& aResult)
|
|
{
|
|
if (aNamespaceID == kNameSpaceID_None) {
|
|
/* ignore these attributes, stored simply as strings
|
|
abbr, axis, ch, headers
|
|
*/
|
|
if (aAttribute == nsGkAtoms::charoff) {
|
|
/* attributes that resolve to integers with a min of 0 */
|
|
return aResult.ParseIntWithBounds(aValue, 0);
|
|
}
|
|
if (aAttribute == nsGkAtoms::colspan) {
|
|
bool res = aResult.ParseIntWithBounds(aValue, -1);
|
|
if (res) {
|
|
int32_t val = aResult.GetIntegerValue();
|
|
// reset large colspan values as IE and opera do
|
|
if (val > MAX_COLSPAN || val <= 0) {
|
|
aResult.SetTo(1, &aValue);
|
|
}
|
|
}
|
|
return res;
|
|
}
|
|
if (aAttribute == nsGkAtoms::rowspan) {
|
|
bool res = aResult.ParseIntWithBounds(aValue, -1, MAX_ROWSPAN);
|
|
if (res) {
|
|
int32_t val = aResult.GetIntegerValue();
|
|
// quirks mode does not honor the special html 4 value of 0
|
|
if (val < 0 || (0 == val && InNavQuirksMode(OwnerDoc()))) {
|
|
aResult.SetTo(1, &aValue);
|
|
}
|
|
}
|
|
return res;
|
|
}
|
|
if (aAttribute == nsGkAtoms::height) {
|
|
return aResult.ParseSpecialIntValue(aValue);
|
|
}
|
|
if (aAttribute == nsGkAtoms::width) {
|
|
return aResult.ParseSpecialIntValue(aValue);
|
|
}
|
|
if (aAttribute == nsGkAtoms::align) {
|
|
return ParseTableCellHAlignValue(aValue, aResult);
|
|
}
|
|
if (aAttribute == nsGkAtoms::bgcolor) {
|
|
return aResult.ParseColor(aValue);
|
|
}
|
|
if (aAttribute == nsGkAtoms::scope) {
|
|
return aResult.ParseEnumValue(aValue, kCellScopeTable, false);
|
|
}
|
|
if (aAttribute == nsGkAtoms::valign) {
|
|
return ParseTableVAlignValue(aValue, aResult);
|
|
}
|
|
}
|
|
|
|
return nsGenericHTMLElement::ParseBackgroundAttribute(aNamespaceID,
|
|
aAttribute, aValue,
|
|
aResult) ||
|
|
nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
|
aResult);
|
|
}
|
|
|
|
void
|
|
HTMLTableCellElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|
nsRuleData* aData)
|
|
{
|
|
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) {
|
|
// width: value
|
|
nsCSSValue* width = aData->ValueForWidth();
|
|
if (width->GetUnit() == eCSSUnit_Null) {
|
|
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width);
|
|
if (value && value->Type() == nsAttrValue::eInteger) {
|
|
if (value->GetIntegerValue() > 0)
|
|
width->SetFloatValue((float)value->GetIntegerValue(), eCSSUnit_Pixel);
|
|
// else 0 implies auto for compatibility.
|
|
}
|
|
else if (value && value->Type() == nsAttrValue::ePercent) {
|
|
if (value->GetPercentValue() > 0.0f)
|
|
width->SetPercentValue(value->GetPercentValue());
|
|
// else 0 implies auto for compatibility
|
|
}
|
|
}
|
|
|
|
// height: value
|
|
nsCSSValue* height = aData->ValueForHeight();
|
|
if (height->GetUnit() == eCSSUnit_Null) {
|
|
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::height);
|
|
if (value && value->Type() == nsAttrValue::eInteger) {
|
|
if (value->GetIntegerValue() > 0)
|
|
height->SetFloatValue((float)value->GetIntegerValue(), eCSSUnit_Pixel);
|
|
// else 0 implies auto for compatibility.
|
|
}
|
|
else if (value && value->Type() == nsAttrValue::ePercent) {
|
|
if (value->GetPercentValue() > 0.0f)
|
|
height->SetPercentValue(value->GetPercentValue());
|
|
// else 0 implies auto for compatibility
|
|
}
|
|
}
|
|
}
|
|
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Text)) {
|
|
nsCSSValue* textAlign = aData->ValueForTextAlign();
|
|
if (textAlign->GetUnit() == eCSSUnit_Null) {
|
|
// align: enum
|
|
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::align);
|
|
if (value && value->Type() == nsAttrValue::eEnum)
|
|
textAlign->SetIntValue(value->GetEnumValue(), eCSSUnit_Enumerated);
|
|
}
|
|
|
|
nsCSSValue* whiteSpace = aData->ValueForWhiteSpace();
|
|
if (whiteSpace->GetUnit() == eCSSUnit_Null) {
|
|
// nowrap: enum
|
|
if (aAttributes->GetAttr(nsGkAtoms::nowrap)) {
|
|
// See if our width is not a nonzero integer width.
|
|
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width);
|
|
nsCompatibility mode = aData->mPresContext->CompatibilityMode();
|
|
if (!value || value->Type() != nsAttrValue::eInteger ||
|
|
value->GetIntegerValue() == 0 ||
|
|
eCompatibility_NavQuirks != mode) {
|
|
whiteSpace->SetIntValue(NS_STYLE_WHITESPACE_NOWRAP, eCSSUnit_Enumerated);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(TextReset)) {
|
|
nsCSSValue* verticalAlign = aData->ValueForVerticalAlign();
|
|
if (verticalAlign->GetUnit() == eCSSUnit_Null) {
|
|
// valign: enum
|
|
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::valign);
|
|
if (value && value->Type() == nsAttrValue::eEnum)
|
|
verticalAlign->SetIntValue(value->GetEnumValue(), eCSSUnit_Enumerated);
|
|
}
|
|
}
|
|
|
|
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aData);
|
|
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
|
}
|
|
|
|
NS_IMETHODIMP_(bool)
|
|
HTMLTableCellElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
|
{
|
|
static const MappedAttributeEntry attributes[] = {
|
|
{ &nsGkAtoms::align },
|
|
{ &nsGkAtoms::valign },
|
|
{ &nsGkAtoms::nowrap },
|
|
#if 0
|
|
// XXXldb If these are implemented, they might need to move to
|
|
// GetAttributeChangeHint (depending on how, and preferably not).
|
|
{ &nsGkAtoms::abbr },
|
|
{ &nsGkAtoms::axis },
|
|
{ &nsGkAtoms::headers },
|
|
{ &nsGkAtoms::scope },
|
|
#endif
|
|
{ &nsGkAtoms::width },
|
|
{ &nsGkAtoms::height },
|
|
{ nullptr }
|
|
};
|
|
|
|
static const MappedAttributeEntry* const map[] = {
|
|
attributes,
|
|
sCommonAttributeMap,
|
|
sBackgroundAttributeMap,
|
|
};
|
|
|
|
return FindAttributeDependence(aAttribute, map);
|
|
}
|
|
|
|
nsMapRuleToAttributesFunc
|
|
HTMLTableCellElement::GetAttributeMappingFunction() const
|
|
{
|
|
return &MapAttributesIntoRule;
|
|
}
|
|
|
|
} // namespace dom
|
|
} // namespace mozilla
|