[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
kocienda
kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:28:45 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 0c0fe84a6ed1607874ef4f8357f7cc8e2f760d7b
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Mar 5 23:01:26 2004 +0000
Reviewed by Dave.
Added initial support for retrieving the computed
style of document elements.
* WebCore.pbproj/project.pbxproj:
* khtml/css/css_computedstyle.cpp: Added.
(DOM::valueForLength): Helper to turn a khtml::Length into a computed value string.
(DOM::stringForBorderStyle): Helper to turn an EBorderStyle into a computed value string.
(DOM::stringForTextAlign): Helper to turn an ETextAlign into a computed value string.
(DOM::CSSComputedStyleDeclarationImpl::CSSComputedStyleDeclarationImpl): New function.
(DOM::CSSComputedStyleDeclarationImpl::~CSSComputedStyleDeclarationImpl): Ditto.
(DOM::CSSComputedStyleDeclarationImpl::cssText): Ditto.
(DOM::CSSComputedStyleDeclarationImpl::setCssText): Ditto.
(DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue): Ditto.
(DOM::CSSComputedStyleDeclarationImpl::getPropertyValue): Ditto.
(DOM::CSSComputedStyleDeclarationImpl::getPropertyPriority): Ditto.
(DOM::CSSComputedStyleDeclarationImpl::removeProperty): Ditto.
(DOM::CSSComputedStyleDeclarationImpl::setProperty): Ditto.
(DOM::CSSComputedStyleDeclarationImpl::setLengthProperty): Ditto.
(DOM::CSSComputedStyleDeclarationImpl::item): Ditto.
(DOM::CSSComputedStyleDeclarationImpl::property): Ditto.
* khtml/css/css_computedstyle.h: Added.
* khtml/css/css_valueimpl.cpp:
(CSSPrimitiveValueImpl::cssText): Fixed some formatting of Rect. Added
suppoprt for rgba colors.
* khtml/css/css_valueimpl.h:
(DOM::CSSStyleDeclarationImpl::node):
* khtml/ecma/kjs_css.cpp:
(KJS::getDOMCSSStyleDeclaration):
* khtml/ecma/kjs_dom.cpp:
(DOMDocument::getValueProperty): defaultView is a property, used to be a function,
which was wrong. Fixed.
(DOMDocumentProtoFunc::tryCall): Ditto.
* khtml/ecma/kjs_dom.lut.h:
(KJS::): Regenerated file.
* khtml/misc/khtmllayout.h:
(khtml::Length::length): Added an accessor to the value, to promote better coding
style, rather than peeking and poking the value directly.
* khtml/rendering/render_style.h:
(khtml::RenderStyle::borderLeftWidth): BHIDDEN also should be treated like BNONE when it comes
to returning a zero value. Now it is.
(khtml::RenderStyle::borderRightWidth): Ditto.
(khtml::RenderStyle::borderTopWidth): Ditto.
(khtml::RenderStyle::borderBottomWidth): Ditto.
(khtml::RenderStyle::outlineWidth): Ditto.
(khtml::RenderStyle::outlineOffset): Ditto.
* khtml/xml/dom2_viewsimpl.cpp:
(AbstractViewImpl::getComputedStyle): Added an implementation for this formerly stubbed out function.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6178 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 4301079..1bbbae0 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,57 @@
2004-03-05 Ken Kocienda <kocienda at apple.com>
+ Reviewed by Dave.
+
+ Added initial support for retrieving the computed
+ style of document elements.
+
+ * WebCore.pbproj/project.pbxproj:
+ * khtml/css/css_computedstyle.cpp: Added.
+ (DOM::valueForLength): Helper to turn a khtml::Length into a computed value string.
+ (DOM::stringForBorderStyle): Helper to turn an EBorderStyle into a computed value string.
+ (DOM::stringForTextAlign): Helper to turn an ETextAlign into a computed value string.
+ (DOM::CSSComputedStyleDeclarationImpl::CSSComputedStyleDeclarationImpl): New function.
+ (DOM::CSSComputedStyleDeclarationImpl::~CSSComputedStyleDeclarationImpl): Ditto.
+ (DOM::CSSComputedStyleDeclarationImpl::cssText): Ditto.
+ (DOM::CSSComputedStyleDeclarationImpl::setCssText): Ditto.
+ (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue): Ditto.
+ (DOM::CSSComputedStyleDeclarationImpl::getPropertyValue): Ditto.
+ (DOM::CSSComputedStyleDeclarationImpl::getPropertyPriority): Ditto.
+ (DOM::CSSComputedStyleDeclarationImpl::removeProperty): Ditto.
+ (DOM::CSSComputedStyleDeclarationImpl::setProperty): Ditto.
+ (DOM::CSSComputedStyleDeclarationImpl::setLengthProperty): Ditto.
+ (DOM::CSSComputedStyleDeclarationImpl::item): Ditto.
+ (DOM::CSSComputedStyleDeclarationImpl::property): Ditto.
+ * khtml/css/css_computedstyle.h: Added.
+ * khtml/css/css_valueimpl.cpp:
+ (CSSPrimitiveValueImpl::cssText): Fixed some formatting of Rect. Added
+ suppoprt for rgba colors.
+ * khtml/css/css_valueimpl.h:
+ (DOM::CSSStyleDeclarationImpl::node):
+ * khtml/ecma/kjs_css.cpp:
+ (KJS::getDOMCSSStyleDeclaration):
+ * khtml/ecma/kjs_dom.cpp:
+ (DOMDocument::getValueProperty): defaultView is a property, used to be a function,
+ which was wrong. Fixed.
+ (DOMDocumentProtoFunc::tryCall): Ditto.
+ * khtml/ecma/kjs_dom.lut.h:
+ (KJS::): Regenerated file.
+ * khtml/misc/khtmllayout.h:
+ (khtml::Length::length): Added an accessor to the value, to promote better coding
+ style, rather than peeking and poking the value directly.
+ * khtml/rendering/render_style.h:
+ (khtml::RenderStyle::borderLeftWidth): BHIDDEN also should be treated like BNONE when it comes
+ to returning a zero value. Now it is.
+ (khtml::RenderStyle::borderRightWidth): Ditto.
+ (khtml::RenderStyle::borderTopWidth): Ditto.
+ (khtml::RenderStyle::borderBottomWidth): Ditto.
+ (khtml::RenderStyle::outlineWidth): Ditto.
+ (khtml::RenderStyle::outlineOffset): Ditto.
+ * khtml/xml/dom2_viewsimpl.cpp:
+ (AbstractViewImpl::getComputedStyle): Added an implementation for this formerly stubbed out function.
+
+2004-03-05 Ken Kocienda <kocienda at apple.com>
+
Change by Darin. Reviewed by me.
* kwq/DOM.mm: Fixed the following functions to deal with
diff --git a/WebCore/WebCore.pbproj/project.pbxproj b/WebCore/WebCore.pbproj/project.pbxproj
index 533d7ab..44746f9 100644
--- a/WebCore/WebCore.pbproj/project.pbxproj
+++ b/WebCore/WebCore.pbproj/project.pbxproj
@@ -519,6 +519,7 @@
BE94EB6605EFFE6B0032DCB5,
BE94EB6705EFFE6B0032DCB5,
515B877605F5332F00EABBF9,
+ BE9970C305F7DD1C00611115,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -793,6 +794,7 @@
BE9185E305EE59B80081354D,
BE9185E405EE59B80081354D,
BE94EB6805EFFE6B0032DCB5,
+ BE9970C405F7DD1C00611115,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -2657,6 +2659,34 @@
);
};
};
+ BE9970C105F7DD1C00611115 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = css_computedstyle.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ BE9970C205F7DD1C00611115 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = css_computedstyle.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ BE9970C305F7DD1C00611115 = {
+ fileRef = BE9970C105F7DD1C00611115;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ BE9970C405F7DD1C00611115 = {
+ fileRef = BE9970C205F7DD1C00611115;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
BEB1DD0805C197DF00DD1F43 = {
children = (
BE9185E005EE59B80081354D,
@@ -3182,6 +3212,8 @@
BC8F61870405949900A80004,
BC8F618B040594BA00A80004,
BC8F618C040594BA00A80004,
+ BE9970C105F7DD1C00611115,
+ BE9970C205F7DD1C00611115,
F523D16402DE42E6018635CA,
F523D16502DE42E6018635CA,
F523D16602DE42E6018635CA,
diff --git a/WebCore/khtml/css/css_computedstyle.cpp b/WebCore/khtml/css/css_computedstyle.cpp
new file mode 100644
index 0000000..6724801
--- /dev/null
+++ b/WebCore/khtml/css/css_computedstyle.cpp
@@ -0,0 +1,642 @@
+/**
+ * css_computedstyle.cpp
+ *
+ * Copyright (C) 2004 Zack Rusin <zack at kde.org>
+ * Copyright (C) 2004 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA
+ */
+#include "css_computedstyle.h"
+
+#include "cssproperties.h"
+#include "dom_atomicstring.h"
+#include "font.h"
+#include "khtmllayout.h"
+#include "loader.h"
+#include "rendering/render_style.h"
+#include "rendering/render_object.h"
+
+#if APPLE_CHANGES
+#import "KWQAssertions.h"
+#import "KWQFontFamily.h"
+#import "KWQLogging.h"
+#endif
+
+using khtml::EBorderStyle;
+using khtml::ETextAlign;
+using khtml::Font;
+using khtml::FontDef;
+using khtml::Length;
+
+namespace DOM {
+
+static CSSValueImpl *valueForLength(const Length &length, int max)
+{
+ if (length.isPercent()) {
+ return new CSSPrimitiveValueImpl(length.length(), CSSPrimitiveValue::CSS_PERCENTAGE);
+ }
+ else {
+ return new CSSPrimitiveValueImpl(length.minWidth(max), CSSPrimitiveValue::CSS_PX);
+ }
+}
+
+static DOMString stringForBorderStyle(EBorderStyle style)
+{
+ switch (style) {
+ case khtml::BNONE:
+ return "none";
+ case khtml::BHIDDEN:
+ return "hidden";
+ case khtml::INSET:
+ return "inset";
+ case khtml::GROOVE:
+ return "groove";
+ case khtml::RIDGE:
+ return "ridge";
+ case khtml::OUTSET:
+ return "outset";
+ case khtml::DOTTED:
+ return "dotted";
+ case khtml::DASHED:
+ return "dashed";
+ case khtml::SOLID:
+ return "solid";
+ case khtml::DOUBLE:
+ return "double";
+ }
+ ASSERT_NOT_REACHED();
+ return "";
+}
+
+static DOMString stringForTextAlign(ETextAlign align)
+{
+ switch (align) {
+ case khtml::TAAUTO:
+ return "auto";
+ case khtml::LEFT:
+ return "left";
+ case khtml::RIGHT:
+ return "right";
+ case khtml::CENTER:
+ return "center";
+ case khtml::JUSTIFY:
+ return "justify";
+ case khtml::KHTML_LEFT:
+ return "-khtml-left";
+ case khtml::KHTML_RIGHT:
+ return "-khtml-right";
+ case khtml::KHTML_CENTER:
+ return "-khtml-center";
+ }
+ ASSERT_NOT_REACHED();
+ return "";
+}
+
+CSSComputedStyleDeclarationImpl::CSSComputedStyleDeclarationImpl(NodeImpl *n)
+ : CSSStyleDeclarationImpl(0)
+{
+ setNode(n);
+ m_renderer = node()->renderer();
+}
+
+CSSComputedStyleDeclarationImpl::~CSSComputedStyleDeclarationImpl()
+{
+}
+
+DOMString CSSComputedStyleDeclarationImpl::cssText() const
+{
+ ERROR("unimplemented");
+ return DOMString();
+}
+
+void CSSComputedStyleDeclarationImpl::setCssText(const DOMString &)
+{
+ ERROR("CSSComputedStyleDeclarationImpl is a read-only object");
+}
+
+CSSValueImpl *CSSComputedStyleDeclarationImpl::getPropertyCSSValue(int propertyID) const
+{
+ // Make sure our layout is up to date before we allow a query on these attributes.
+ DocumentImpl* docimpl = node()->getDocument();
+ if (docimpl)
+ docimpl->updateLayout();
+
+ switch(propertyID)
+ {
+ case CSS_PROP_BACKGROUND_COLOR:
+ return new CSSPrimitiveValueImpl(m_renderer->style()->backgroundColor().rgb());
+ case CSS_PROP_BACKGROUND_IMAGE:
+ if (m_renderer->style()->backgroundImage())
+ return new CSSPrimitiveValueImpl(m_renderer->style()->backgroundImage()->url(),
+ CSSPrimitiveValue::CSS_URI);
+ return 0;
+ case CSS_PROP_BACKGROUND_REPEAT:
+ switch (m_renderer->style()->backgroundRepeat()) {
+ case khtml::REPEAT:
+ return new CSSPrimitiveValueImpl("repeat", CSSPrimitiveValue::CSS_STRING);
+ case khtml::REPEAT_X:
+ return new CSSPrimitiveValueImpl("repeat-x", CSSPrimitiveValue::CSS_STRING);
+ case khtml::REPEAT_Y:
+ return new CSSPrimitiveValueImpl("repeat-y", CSSPrimitiveValue::CSS_STRING);
+ case khtml::NO_REPEAT:
+ return new CSSPrimitiveValueImpl("no-repeat", CSSPrimitiveValue::CSS_STRING);
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ case CSS_PROP_BACKGROUND_ATTACHMENT:
+ if (m_renderer->style()->backgroundAttachment())
+ return new CSSPrimitiveValueImpl("scroll", CSSPrimitiveValue::CSS_STRING);
+ else
+ return new CSSPrimitiveValueImpl("fixed", CSSPrimitiveValue::CSS_STRING);
+ case CSS_PROP_BACKGROUND_POSITION:
+ {
+ DOMString string;
+ Length length(m_renderer->style()->backgroundXPosition());
+ if (length.isPercent())
+ string = QString::number(length.length()) + "%";
+ else
+ string = QString::number(length.minWidth(m_renderer->contentWidth()));
+ string += " ";
+ length = m_renderer->style()->backgroundYPosition();
+ if (length.isPercent())
+ string += QString::number(length.length()) + "%";
+ else
+ string += QString::number(length.minWidth(m_renderer->contentWidth()));
+ return new CSSPrimitiveValueImpl(string, CSSPrimitiveValue::CSS_STRING);
+ }
+ case CSS_PROP_BACKGROUND_POSITION_X:
+ return valueForLength(m_renderer->style()->backgroundXPosition(), m_renderer->contentWidth());
+ case CSS_PROP_BACKGROUND_POSITION_Y:
+ return valueForLength(m_renderer->style()->backgroundYPosition(), m_renderer->contentHeight());
+#ifndef KHTML_NO_XBL
+ case CSS_PROP__KHTML_BINDING:
+ // FIXME: unimplemented
+ break;
+#endif
+ case CSS_PROP_BORDER_COLLAPSE:
+ if (m_renderer->style()->borderCollapse())
+ return new CSSPrimitiveValueImpl("collapse", CSSPrimitiveValue::CSS_STRING);
+ else
+ return new CSSPrimitiveValueImpl("separate", CSSPrimitiveValue::CSS_STRING);
+ case CSS_PROP_BORDER_SPACING:
+ {
+ QString string(QString::number(m_renderer->style()->horizontalBorderSpacing()) +
+ "px " +
+ QString::number(m_renderer->style()->verticalBorderSpacing()) +
+ "px");
+ return new CSSPrimitiveValueImpl(string, CSSPrimitiveValue::CSS_STRING);
+ }
+ case CSS_PROP__KHTML_BORDER_HORIZONTAL_SPACING:
+ return new CSSPrimitiveValueImpl(m_renderer->style()->horizontalBorderSpacing(), CSSPrimitiveValue::CSS_PX);
+ case CSS_PROP__KHTML_BORDER_VERTICAL_SPACING:
+ return new CSSPrimitiveValueImpl(m_renderer->style()->verticalBorderSpacing(), CSSPrimitiveValue::CSS_PX);
+ case CSS_PROP_BORDER_TOP_COLOR:
+ return new CSSPrimitiveValueImpl(m_renderer->style()->borderLeftColor().rgb());
+ case CSS_PROP_BORDER_RIGHT_COLOR:
+ return new CSSPrimitiveValueImpl(m_renderer->style()->borderRightColor().rgb());
+ case CSS_PROP_BORDER_BOTTOM_COLOR:
+ return new CSSPrimitiveValueImpl(m_renderer->style()->borderBottomColor().rgb());
+ case CSS_PROP_BORDER_LEFT_COLOR:
+ return new CSSPrimitiveValueImpl(m_renderer->style()->borderLeftColor().rgb());
+ case CSS_PROP_BORDER_TOP_STYLE:
+ return new CSSPrimitiveValueImpl(stringForBorderStyle(m_renderer->style()->borderTopStyle()), CSSPrimitiveValue::CSS_STRING);
+ case CSS_PROP_BORDER_RIGHT_STYLE:
+ return new CSSPrimitiveValueImpl(stringForBorderStyle(m_renderer->style()->borderRightStyle()), CSSPrimitiveValue::CSS_STRING);
+ case CSS_PROP_BORDER_BOTTOM_STYLE:
+ return new CSSPrimitiveValueImpl(stringForBorderStyle(m_renderer->style()->borderBottomStyle()), CSSPrimitiveValue::CSS_STRING);
+ case CSS_PROP_BORDER_LEFT_STYLE:
+ return new CSSPrimitiveValueImpl(stringForBorderStyle(m_renderer->style()->borderLeftStyle()), CSSPrimitiveValue::CSS_STRING);
+ case CSS_PROP_BORDER_TOP_WIDTH:
+ return new CSSPrimitiveValueImpl(m_renderer->style()->borderTopWidth(), CSSPrimitiveValue::CSS_PX);
+ case CSS_PROP_BORDER_RIGHT_WIDTH:
+ return new CSSPrimitiveValueImpl(m_renderer->style()->borderRightWidth(), CSSPrimitiveValue::CSS_PX);
+ case CSS_PROP_BORDER_BOTTOM_WIDTH:
+ return new CSSPrimitiveValueImpl(m_renderer->style()->borderBottomWidth(), CSSPrimitiveValue::CSS_PX);
+ case CSS_PROP_BORDER_LEFT_WIDTH:
+ return new CSSPrimitiveValueImpl(m_renderer->style()->borderLeftWidth(), CSSPrimitiveValue::CSS_PX);
+ case CSS_PROP_BOTTOM:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP__KHTML_BOX_ALIGN:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP__KHTML_BOX_DIRECTION:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP__KHTML_BOX_FLEX:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP__KHTML_BOX_FLEX_GROUP:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP__KHTML_BOX_LINES:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP__KHTML_BOX_ORDINAL_GROUP:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP__KHTML_BOX_ORIENT:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP__KHTML_BOX_PACK:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_CAPTION_SIDE:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_CLEAR:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_CLIP:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_COLOR:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_CONTENT:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_COUNTER_INCREMENT:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_COUNTER_RESET:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_CURSOR:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_DIRECTION:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_DISPLAY:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_EMPTY_CELLS:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_FLOAT:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_FONT_FAMILY:
+ {
+ FontDef def = m_renderer->style()->htmlFont().getFontDef();
+ return new CSSPrimitiveValueImpl(def.firstFamily().family().domString(), CSSPrimitiveValue::CSS_STRING);
+ }
+ case CSS_PROP_FONT_SIZE:
+ {
+ FontDef def = m_renderer->style()->htmlFont().getFontDef();
+ return new CSSPrimitiveValueImpl(def.specifiedSize, CSSPrimitiveValue::CSS_PX);
+ }
+ case CSS_PROP_FONT_SIZE_ADJUST:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_FONT_STRETCH:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_FONT_STYLE:
+ {
+ // FIXME: handle oblique
+ FontDef def = m_renderer->style()->htmlFont().getFontDef();
+ if (def.italic)
+ return new CSSPrimitiveValueImpl("italic", CSSPrimitiveValue::CSS_STRING);
+ else
+ return new CSSPrimitiveValueImpl("normal", CSSPrimitiveValue::CSS_STRING);
+ }
+ case CSS_PROP_FONT_VARIANT:
+ {
+ FontDef def = m_renderer->style()->htmlFont().getFontDef();
+ if (def.smallCaps)
+ return new CSSPrimitiveValueImpl("small-caps", CSSPrimitiveValue::CSS_STRING);
+ else
+ return new CSSPrimitiveValueImpl("normal", CSSPrimitiveValue::CSS_STRING);
+ }
+ case CSS_PROP_FONT_WEIGHT:
+ {
+ // FIXME: this does not reflect the full range of weights
+ // that can be expressed with CSS
+ FontDef def = m_renderer->style()->htmlFont().getFontDef();
+ if (def.weight == QFont::Bold)
+ return new CSSPrimitiveValueImpl("bold", CSSPrimitiveValue::CSS_STRING);
+ else
+ return new CSSPrimitiveValueImpl("normal", CSSPrimitiveValue::CSS_STRING);
+ }
+ case CSS_PROP_HEIGHT:
+ return new CSSPrimitiveValueImpl(m_renderer->contentHeight(), CSSPrimitiveValue::CSS_PX);
+ case CSS_PROP_LEFT:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_LETTER_SPACING:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_LINE_HEIGHT:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_LIST_STYLE_IMAGE:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_LIST_STYLE_POSITION:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_LIST_STYLE_TYPE:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_MARGIN_TOP:
+ return valueForLength(m_renderer->style()->marginTop(), m_renderer->contentHeight());
+ case CSS_PROP_MARGIN_RIGHT:
+ return valueForLength(m_renderer->style()->marginRight(), m_renderer->contentWidth());
+ case CSS_PROP_MARGIN_BOTTOM:
+ return valueForLength(m_renderer->style()->marginBottom(), m_renderer->contentHeight());
+ case CSS_PROP_MARGIN_LEFT:
+ return valueForLength(m_renderer->style()->marginLeft(), m_renderer->contentWidth());
+ case CSS_PROP__KHTML_MARQUEE:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP__KHTML_MARQUEE_DIRECTION:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP__KHTML_MARQUEE_INCREMENT:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP__KHTML_MARQUEE_REPETITION:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP__KHTML_MARQUEE_SPEED:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP__KHTML_MARQUEE_STYLE:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP__KHTML_USER_MODIFY:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_MAX_HEIGHT:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_MAX_WIDTH:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_MIN_HEIGHT:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_MIN_WIDTH:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_OPACITY:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_ORPHANS:
+ // FIXME: unimplemented
+ break;
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_OUTLINE_COLOR:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_OUTLINE_OFFSET:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_OUTLINE_STYLE:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_OUTLINE_WIDTH:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_OVERFLOW:
+ {
+ switch (m_renderer->style()->overflow()) {
+ case khtml::OVISIBLE:
+ return new CSSPrimitiveValueImpl("visible", CSSPrimitiveValue::CSS_STRING);
+ case khtml::OHIDDEN:
+ return new CSSPrimitiveValueImpl("hidden", CSSPrimitiveValue::CSS_STRING);
+ case khtml::OSCROLL:
+ return new CSSPrimitiveValueImpl("scroll", CSSPrimitiveValue::CSS_STRING);
+ case khtml::OAUTO:
+ return new CSSPrimitiveValueImpl("auto", CSSPrimitiveValue::CSS_STRING);
+ case khtml::OMARQUEE:
+ return new CSSPrimitiveValueImpl("marquee", CSSPrimitiveValue::CSS_STRING);
+ }
+ }
+ case CSS_PROP_PADDING_TOP:
+ return valueForLength(m_renderer->style()->paddingTop(), m_renderer->contentHeight());
+ case CSS_PROP_PADDING_RIGHT:
+ return valueForLength(m_renderer->style()->paddingRight(), m_renderer->contentWidth());
+ case CSS_PROP_PADDING_BOTTOM:
+ return valueForLength(m_renderer->style()->paddingBottom(), m_renderer->contentHeight());
+ case CSS_PROP_PADDING_LEFT:
+ return valueForLength(m_renderer->style()->paddingLeft(), m_renderer->contentWidth());
+ case CSS_PROP_PAGE:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_PAGE_BREAK_AFTER:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_PAGE_BREAK_BEFORE:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_PAGE_BREAK_INSIDE:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_POSITION:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_QUOTES:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_RIGHT:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_SIZE:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_TABLE_LAYOUT:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_TEXT_ALIGN:
+ return new CSSPrimitiveValueImpl(stringForTextAlign(m_renderer->style()->textAlign()), CSSPrimitiveValue::CSS_STRING);
+ case CSS_PROP_TEXT_DECORATION:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_TEXT_DECORATION_COLOR:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_TEXT_INDENT:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_TEXT_SHADOW:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_TEXT_TRANSFORM:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_TOP:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_UNICODE_BIDI:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_VERTICAL_ALIGN:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_VISIBILITY:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_WHITE_SPACE:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_WIDOWS:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_WIDTH:
+ return new CSSPrimitiveValueImpl(m_renderer->contentWidth(), CSSPrimitiveValue::CSS_PX);
+ case CSS_PROP_WORD_SPACING:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_Z_INDEX:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_BACKGROUND:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_BORDER:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_BORDER_COLOR:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_BORDER_STYLE:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_BORDER_TOP:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_BORDER_RIGHT:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_BORDER_BOTTOM:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_BORDER_LEFT:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_BORDER_WIDTH:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_FONT:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_LIST_STYLE:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_MARGIN:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_OUTLINE:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_PADDING:
+ // FIXME: unimplemented
+ break;
+#if !APPLE_CHANGES
+ case CSS_PROP_SCROLLBAR_FACE_COLOR:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_SCROLLBAR_SHADOW_COLOR:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_SCROLLBAR_HIGHLIGHT_COLOR:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_SCROLLBAR_3DLIGHT_COLOR:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_SCROLLBAR_DARKSHADOW_COLOR:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_SCROLLBAR_TRACK_COLOR:
+ // FIXME: unimplemented
+ break;
+ case CSS_PROP_SCROLLBAR_ARROW_COLOR:
+ // FIXME: unimplemented
+ break;
+#endif
+ case CSS_PROP__KHTML_FLOW_MODE:
+ // FIXME: unimplemented
+ break;
+ default:
+ break;
+ }
+ ERROR("unimplemented propertyID: %d", propertyID);
+ return 0;
+}
+
+DOMString CSSComputedStyleDeclarationImpl::getPropertyValue(int propertyID) const
+{
+ CSSProperty var = property(propertyID);
+ DOMString str = var.cssText();
+ return str;
+}
+
+bool CSSComputedStyleDeclarationImpl::getPropertyPriority(int) const
+{
+ // This class does not support the notion of priority, since the object
+ // is a computed value.
+ return false;
+}
+
+DOMString CSSComputedStyleDeclarationImpl::removeProperty(int)
+{
+ ASSERT_NOT_REACHED();
+ return DOMString();
+}
+
+bool CSSComputedStyleDeclarationImpl::setProperty(int, const DOMString &, bool)
+{
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
+void CSSComputedStyleDeclarationImpl::setProperty(int, int, bool)
+{
+ ASSERT_NOT_REACHED();
+}
+
+void CSSComputedStyleDeclarationImpl::setLengthProperty(int, const DOMString&, bool, bool)
+{
+ ASSERT_NOT_REACHED();
+}
+
+void CSSComputedStyleDeclarationImpl::setProperty(const DOMString &)
+{
+ ASSERT_NOT_REACHED();
+}
+
+DOMString CSSComputedStyleDeclarationImpl::item(unsigned long) const
+{
+ ERROR("unimplemented");
+ return DOMString();
+}
+
+
+CSSProperty CSSComputedStyleDeclarationImpl::property(int id) const
+{
+ CSSProperty prop;
+ prop.m_id = id;
+ prop.m_bImportant = false;
+ prop.setValue(getPropertyCSSValue(id));
+ return prop;
+}
+
+} // namespace DOM
diff --git a/WebCore/khtml/css/css_computedstyle.h b/WebCore/khtml/css/css_computedstyle.h
new file mode 100644
index 0000000..1ecbb0b
--- /dev/null
+++ b/WebCore/khtml/css/css_computedstyle.h
@@ -0,0 +1,70 @@
+/**
+ * css_computedstyle.h
+ *
+ * Copyright (C) 2004 Zack Rusin <zack at kde.org>
+ * Copyright (C) 2004 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA
+ */
+#ifndef CSS_COMPUTEDSTYLE_H
+#define CSS_COMPUTEDSTYLE_H
+
+#include "css/css_valueimpl.h"
+#include "dom/dom_string.h"
+
+namespace khtml {
+ class RenderObject;
+}
+
+namespace DOM {
+
+class CSSProperty;
+class CSSStyleDeclarationImpl;
+class CSSValueImpl;
+class DOMString;
+class NodeImpl;
+
+class CSSComputedStyleDeclarationImpl : public CSSStyleDeclarationImpl
+{
+public:
+ CSSComputedStyleDeclarationImpl(NodeImpl *node);
+ virtual ~CSSComputedStyleDeclarationImpl();
+
+ virtual DOMString cssText() const;
+ virtual void setCssText(const DOMString &);
+
+ virtual CSSValueImpl *getPropertyCSSValue(int propertyID) const;
+ virtual DOMString getPropertyValue(int propertyID) const;
+ virtual bool getPropertyPriority(int propertyID) const;
+
+ virtual DOMString removeProperty(int propertyID);
+ virtual bool setProperty(int propertyId, const DOMString &value, bool important = false);
+ virtual void setProperty(int propertyId, int value, bool important = false);
+ virtual void setLengthProperty(int id, const DOMString &value, bool important, bool multiLength = false);
+
+ virtual void setProperty(const DOMString &propertyString);
+ virtual DOMString item(unsigned long index) const;
+
+private:
+ CSSProperty property(int id) const;
+
+ khtml::RenderObject *m_renderer;
+};
+
+
+}
+
+#endif
diff --git a/WebCore/khtml/css/css_valueimpl.cpp b/WebCore/khtml/css/css_valueimpl.cpp
index 5237936..285847f 100644
--- a/WebCore/khtml/css/css_valueimpl.cpp
+++ b/WebCore/khtml/css/css_valueimpl.cpp
@@ -750,7 +750,7 @@ DOM::DOMString CSSPrimitiveValueImpl::cssText() const
// ###
break;
case CSSPrimitiveValue::CSS_STRING:
- // ###
+ text = DOMString(m_value.string);
break;
case CSSPrimitiveValue::CSS_URI:
text = "url(";
@@ -768,17 +768,29 @@ DOM::DOMString CSSPrimitiveValueImpl::cssText() const
break;
case CSSPrimitiveValue::CSS_RECT: {
RectImpl* rectVal = getRectValue();
- text = "rect(";
- text += rectVal->top()->cssText() + " ";
- text += rectVal->right()->cssText() + " ";
- text += rectVal->bottom()->cssText() + " ";
- text += rectVal->left()->cssText() + ")";
+ text = "rect(";
+ text += rectVal->top()->cssText() + " ";
+ text += rectVal->right()->cssText() + " ";
+ text += rectVal->bottom()->cssText() + " ";
+ text += rectVal->left()->cssText() + ")";
break;
}
case CSSPrimitiveValue::CSS_RGBCOLOR:
- text = QColor(m_value.rgbcolor).name();
+ {
+ QColor color(m_value.rgbcolor);
+ if (qAlpha(m_value.rgbcolor))
+ text = "rgba(";
+ else
+ text = "rgb(";
+ text += QString::number(color.red()) + ", ";
+ text += QString::number(color.green()) + ", ";
+ text += QString::number(color.blue());
+ if (qAlpha(m_value.rgbcolor))
+ text += ", " + QString::number((float)qAlpha(m_value.rgbcolor) / 0xFF);
+ text += ")";
break;
- default:
+ }
+ default:
break;
}
return text;
diff --git a/WebCore/khtml/css/css_valueimpl.h b/WebCore/khtml/css/css_valueimpl.h
index 7b92b0d..f0ae93d 100644
--- a/WebCore/khtml/css/css_valueimpl.h
+++ b/WebCore/khtml/css/css_valueimpl.h
@@ -56,33 +56,33 @@ public:
unsigned long length() const;
CSSRuleImpl *parentRule() const;
- DOM::DOMString removeProperty(int propertyID, bool notifyChanged = true);
- bool setProperty(int propertyId, const DOM::DOMString &value, bool important = false, bool notifyChanged = true);
- void setProperty(int propertyId, int value, bool important = false, bool notifyChanged = true);
+ virtual DOM::DOMString removeProperty(int propertyID, bool notifyChanged = true);
+ virtual bool setProperty(int propertyId, const DOM::DOMString &value, bool important = false, bool notifyChanged = true);
+ virtual void setProperty(int propertyId, int value, bool important = false, bool notifyChanged = true);
// this treats integers as pixels!
// needed for conversion of html attributes
- void setLengthProperty(int id, const DOM::DOMString &value, bool important,bool multiLength = false);
- void setStringProperty(int propertyId, const DOM::DOMString &value, DOM::CSSPrimitiveValue::UnitTypes, bool important = false); // parsed string value
- void setImageProperty(int propertyId, const DOM::DOMString &URL, bool important = false);
+ virtual void setLengthProperty(int id, const DOM::DOMString &value, bool important,bool multiLength = false);
+ virtual void setStringProperty(int propertyId, const DOM::DOMString &value, DOM::CSSPrimitiveValue::UnitTypes, bool important = false); // parsed string value
+ virtual void setImageProperty(int propertyId, const DOM::DOMString &URL, bool important = false);
// add a whole, unparsed property
- void setProperty ( const DOMString &propertyString);
- DOM::DOMString item ( unsigned long index );
+ virtual void setProperty ( const DOMString &propertyString);
+ virtual DOM::DOMString item ( unsigned long index );
virtual DOM::DOMString cssText() const;
- void setCssText(const DOM::DOMString& str);
+ virtual void setCssText(const DOM::DOMString& str);
virtual bool isStyleDeclaration() { return true; }
virtual bool parseString( const DOMString &string, bool = false );
- CSSValueImpl *getPropertyCSSValue( int propertyID ) const;
- DOMString getPropertyValue( int propertyID ) const;
- bool getPropertyPriority( int propertyID ) const;
+ virtual CSSValueImpl *getPropertyCSSValue( int propertyID ) const;
+ virtual DOMString getPropertyValue( int propertyID ) const;
+ virtual bool getPropertyPriority( int propertyID ) const;
QPtrList<CSSProperty> *values() { return m_lstValues; }
void setNode(NodeImpl *_node) { m_node = _node; }
- NodeImpl* node() { return m_node; }
+ NodeImpl* node() const { return m_node; }
void setChanged();
@@ -393,6 +393,9 @@ public:
bool m_bImportant : 1;
protected:
CSSValueImpl *m_value;
+
+private:
+ CSSProperty &operator=(const CSSProperty&);
};
diff --git a/WebCore/khtml/ecma/kjs_css.cpp b/WebCore/khtml/ecma/kjs_css.cpp
index ccfb0e3..627092e 100644
--- a/WebCore/khtml/ecma/kjs_css.cpp
+++ b/WebCore/khtml/ecma/kjs_css.cpp
@@ -224,7 +224,7 @@ Value DOMCSSStyleDeclarationProtoFunc::tryCall(ExecState *exec, Object &thisObj,
Value KJS::getDOMCSSStyleDeclaration(ExecState *exec, DOM::CSSStyleDeclaration s)
{
- return cacheDOMObject<DOM::CSSStyleDeclaration, KJS::DOMCSSStyleDeclaration>(exec, s);
+ return Value(cacheDOMObject<DOM::CSSStyleDeclaration, KJS::DOMCSSStyleDeclaration>(exec, s));
}
// -------------------------------------------------------------------------
diff --git a/WebCore/khtml/ecma/kjs_dom.cpp b/WebCore/khtml/ecma/kjs_dom.cpp
index 85eb8c0..71b9ea6 100644
--- a/WebCore/khtml/ecma/kjs_dom.cpp
+++ b/WebCore/khtml/ecma/kjs_dom.cpp
@@ -691,7 +691,6 @@ void DOMAttr::putValue(ExecState *exec, int token, const Value& value, int /*att
createRange DOMDocument::CreateRange DontDelete|Function 0
createNodeIterator DOMDocument::CreateNodeIterator DontDelete|Function 3
createTreeWalker DOMDocument::CreateTreeWalker DontDelete|Function 4
- defaultView DOMDocument::DefaultView DontDelete|Function 0
createEvent DOMDocument::CreateEvent DontDelete|Function 1
getOverrideStyle DOMDocument::GetOverrideStyle DontDelete|Function 2
@end
@@ -711,6 +710,7 @@ const ClassInfo DOMDocument::info = { "Document", &DOMNode::info, &DOMDocumentTa
preferredStylesheetSet DOMDocument::PreferredStylesheetSet DontDelete|ReadOnly
selectedStylesheetSet DOMDocument::SelectedStylesheetSet DontDelete
readyState DOMDocument::ReadyState DontDelete|ReadOnly
+ defaultView DOMDocument::DefaultView DontDelete|ReadOnly
@end
*/
@@ -768,6 +768,8 @@ Value DOMDocument::getValueProperty(ExecState *exec, int token) const
}
return Undefined();
}
+ case DOMDocument::DefaultView: // DOM2
+ return getDOMAbstractView(exec,doc.defaultView());
default:
kdWarning() << "DOMDocument::getValueProperty unhandled token " << token << endl;
return Value();
@@ -870,8 +872,6 @@ Value DOMDocumentProtoFunc::tryCall(ExecState *exec, Object &thisObj, const List
else
return getDOMCSSStyleDeclaration(exec,doc.getOverrideStyle(static_cast<DOM::Element>(arg0),args[1].toString(exec).string()));
}
- case DOMDocument::DefaultView: // DOM2
- return getDOMAbstractView(exec,doc.defaultView());
default:
break;
}
diff --git a/WebCore/khtml/ecma/kjs_dom.lut.h b/WebCore/khtml/ecma/kjs_dom.lut.h
index b12fb98..740b3d2 100644
--- a/WebCore/khtml/ecma/kjs_dom.lut.h
+++ b/WebCore/khtml/ecma/kjs_dom.lut.h
@@ -123,7 +123,7 @@ namespace KJS {
const struct HashEntry DOMDocumentProtoTableEntries[] = {
{ "createCDATASection", DOMDocument::CreateCDATASection, DontDelete|Function, 1, 0 },
{ 0, 0, 0, 0, 0 },
- { "createDocumentFragment", DOMDocument::CreateDocumentFragment, DontDelete|Function, 1, &DOMDocumentProtoTableEntries[28] },
+ { "createDocumentFragment", DOMDocument::CreateDocumentFragment, DontDelete|Function, 1, &DOMDocumentProtoTableEntries[29] },
{ 0, 0, 0, 0, 0 },
{ "getElementsByTagName", DOMDocument::GetElementsByTagName, DontDelete|Function, 1, &DOMDocumentProtoTableEntries[25] },
{ 0, 0, 0, 0, 0 },
@@ -136,7 +136,7 @@ const struct HashEntry DOMDocumentProtoTableEntries[] = {
{ "createAttribute", DOMDocument::CreateAttribute, DontDelete|Function, 1, &DOMDocumentProtoTableEntries[24] },
{ "createTextNode", DOMDocument::CreateTextNode, DontDelete|Function, 1, 0 },
{ "createEntityReference", DOMDocument::CreateEntityReference, DontDelete|Function, 1, &DOMDocumentProtoTableEntries[26] },
- { "createProcessingInstruction", DOMDocument::CreateProcessingInstruction, DontDelete|Function, 1, &DOMDocumentProtoTableEntries[29] },
+ { "createProcessingInstruction", DOMDocument::CreateProcessingInstruction, DontDelete|Function, 1, &DOMDocumentProtoTableEntries[28] },
{ 0, 0, 0, 0, 0 },
{ "createComment", DOMDocument::CreateComment, DontDelete|Function, 1, &DOMDocumentProtoTableEntries[27] },
{ 0, 0, 0, 0, 0 },
@@ -149,28 +149,28 @@ const struct HashEntry DOMDocumentProtoTableEntries[] = {
{ "getElementsByTagNameNS", DOMDocument::GetElementsByTagNameNS, DontDelete|Function, 2, 0 },
{ "getElementById", DOMDocument::GetElementById, DontDelete|Function, 1, 0 },
{ "createRange", DOMDocument::CreateRange, DontDelete|Function, 0, 0 },
- { "defaultView", DOMDocument::DefaultView, DontDelete|Function, 0, &DOMDocumentProtoTableEntries[30] },
{ "createEvent", DOMDocument::CreateEvent, DontDelete|Function, 1, 0 },
{ "getOverrideStyle", DOMDocument::GetOverrideStyle, DontDelete|Function, 2, 0 }
};
-const struct HashTable DOMDocumentProtoTable = { 2, 31, DOMDocumentProtoTableEntries, 23 };
+const struct HashTable DOMDocumentProtoTable = { 2, 30, DOMDocumentProtoTableEntries, 23 };
} // namespace
namespace KJS {
const struct HashEntry DOMDocumentTableEntries[] = {
- { "doctype", DOMDocument::DocType, DontDelete|ReadOnly, 0, 0 },
+ { "doctype", DOMDocument::DocType, DontDelete|ReadOnly, 0, &DOMDocumentTableEntries[7] },
{ "documentElement", DOMDocument::DocumentElement, DontDelete|ReadOnly, 0, &DOMDocumentTableEntries[4] },
{ "implementation", DOMDocument::Implementation, DontDelete|ReadOnly, 0, &DOMDocumentTableEntries[6] },
{ "selectedStylesheetSet", DOMDocument::SelectedStylesheetSet, DontDelete, 0, 0 },
{ "styleSheets", DOMDocument::StyleSheets, DontDelete|ReadOnly, 0, &DOMDocumentTableEntries[5] },
{ "preferredStylesheetSet", DOMDocument::PreferredStylesheetSet, DontDelete|ReadOnly, 0, 0 },
- { "readyState", DOMDocument::ReadyState, DontDelete|ReadOnly, 0, 0 }
+ { "readyState", DOMDocument::ReadyState, DontDelete|ReadOnly, 0, 0 },
+ { "defaultView", DOMDocument::DefaultView, DontDelete|ReadOnly, 0, 0 }
};
-const struct HashTable DOMDocumentTable = { 2, 7, DOMDocumentTableEntries, 4 };
+const struct HashTable DOMDocumentTable = { 2, 8, DOMDocumentTableEntries, 4 };
} // namespace
diff --git a/WebCore/khtml/misc/khtmllayout.h b/WebCore/khtml/misc/khtmllayout.h
index 872f03f..c0891b7 100644
--- a/WebCore/khtml/misc/khtmllayout.h
+++ b/WebCore/khtml/misc/khtmllayout.h
@@ -58,6 +58,8 @@ namespace khtml
{ return *((Q_UINT32 *)this) != *((Q_UINT32 *)&o); }
+ int length() const { return value; }
+
/*
* works only for Fixed and Percent, returns -1 otherwise
*/
diff --git a/WebCore/khtml/rendering/render_style.h b/WebCore/khtml/rendering/render_style.h
index 5be18c9..035cd2e 100644
--- a/WebCore/khtml/rendering/render_style.h
+++ b/WebCore/khtml/rendering/render_style.h
@@ -948,28 +948,28 @@ public:
const BorderValue& borderBottom() const { return surround->border.bottom; }
unsigned short borderLeftWidth() const
- { if( surround->border.left.style == BNONE) return 0; return surround->border.left.width; }
+ { if( surround->border.left.style == BNONE || surround->border.left.style == BHIDDEN) return 0; return surround->border.left.width; }
EBorderStyle borderLeftStyle() const { return surround->border.left.style; }
const QColor & borderLeftColor() const { return surround->border.left.color; }
bool borderLeftIsTransparent() const { return surround->border.left.isTransparent(); }
unsigned short borderRightWidth() const
- { if (surround->border.right.style == BNONE) return 0; return surround->border.right.width; }
+ { if (surround->border.right.style == BNONE || surround->border.right.style == BHIDDEN) return 0; return surround->border.right.width; }
EBorderStyle borderRightStyle() const { return surround->border.right.style; }
const QColor & borderRightColor() const { return surround->border.right.color; }
bool borderRightIsTransparent() const { return surround->border.right.isTransparent(); }
unsigned short borderTopWidth() const
- { if(surround->border.top.style == BNONE) return 0; return surround->border.top.width; }
+ { if(surround->border.top.style == BNONE || surround->border.top.style == BHIDDEN) return 0; return surround->border.top.width; }
EBorderStyle borderTopStyle() const {return surround->border.top.style; }
const QColor & borderTopColor() const { return surround->border.top.color; }
bool borderTopIsTransparent() const { return surround->border.top.isTransparent(); }
unsigned short borderBottomWidth() const
- { if(surround->border.bottom.style == BNONE) return 0; return surround->border.bottom.width; }
+ { if(surround->border.bottom.style == BNONE || surround->border.bottom.style == BHIDDEN) return 0; return surround->border.bottom.width; }
EBorderStyle borderBottomStyle() const { return surround->border.bottom.style; }
const QColor & borderBottomColor() const { return surround->border.bottom.color; }
bool borderBottomIsTransparent() const { return surround->border.bottom.isTransparent(); }
unsigned short outlineSize() const { return outlineWidth() + outlineOffset(); }
- unsigned short outlineWidth() const { if (background->outline.style == BNONE) return 0; return background->outline.width; }
+ unsigned short outlineWidth() const { if (background->outline.style == BNONE || background->outline.style == BHIDDEN) return 0; return background->outline.width; }
EBorderStyle outlineStyle() const { return background->outline.style; }
bool outlineStyleIsAuto() const { return background->outline._auto; }
const QColor & outlineColor() const { return background->outline.color; }
@@ -1061,7 +1061,7 @@ public:
BindingURI* bindingURIs() const { return css3NonInheritedData->bindingURI; }
#endif
int outlineOffset() const {
- if (background->outline.style == BNONE) return 0; return background->outline._offset;
+ if (background->outline.style == BNONE || background->outline.style == BHIDDEN) return 0; return background->outline._offset;
}
ShadowData* textShadow() const { return css3InheritedData->textShadow; }
float opacity() { return css3NonInheritedData->opacity; }
diff --git a/WebCore/khtml/xml/dom2_viewsimpl.cpp b/WebCore/khtml/xml/dom2_viewsimpl.cpp
index 1f5493d..c2a7c2f 100644
--- a/WebCore/khtml/xml/dom2_viewsimpl.cpp
+++ b/WebCore/khtml/xml/dom2_viewsimpl.cpp
@@ -2,6 +2,7 @@
* This file is part of the DOM implementation for KDE.
*
* (C) 2001 Peter Kelly (pmk at post.com)
+ * Copyright (C) 2004 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -22,7 +23,17 @@
#include "dom2_viewsimpl.h"
-using namespace DOM;
+#include "css/css_base.h"
+#include "css/css_computedstyle.h"
+#include "css/css_stylesheetimpl.h"
+#include "rendering/render_object.h"
+
+using DOM::AbstractViewImpl;
+using DOM::CSSComputedStyleDeclarationImpl;
+using DOM::CSSStyleDeclarationImpl;
+using DOM::DocumentImpl;
+using DOM::DOMStringImpl;
+using DOM::ElementImpl;
AbstractViewImpl::AbstractViewImpl(DocumentImpl *_document)
{
@@ -33,8 +44,12 @@ AbstractViewImpl::~AbstractViewImpl()
{
}
-CSSStyleDeclarationImpl *AbstractViewImpl::getComputedStyle(ElementImpl */*elt*/, DOMStringImpl */*pseudoElt*/)
+CSSStyleDeclarationImpl *AbstractViewImpl::getComputedStyle(ElementImpl *elt, DOMStringImpl *pseudoElt)
{
- return 0; // ###
-}
+ // FIXME: This should work even if we do not have a renderer.
+
+ if (!elt || !elt->renderer())
+ return 0;
+ return new CSSComputedStyleDeclarationImpl(elt);
+}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list