summaryrefslogtreecommitdiffstats
path: root/webkit/port/css
diff options
context:
space:
mode:
authorinitial.commit <initial.commit@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-27 00:20:51 +0000
committerinitial.commit <initial.commit@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-27 00:20:51 +0000
commitf5b16fed647e941aa66933178da85db2860d639b (patch)
treef00e9856c04aad3b558a140955e7674add33f051 /webkit/port/css
parent920c091ac3ee15079194c82ae8a7a18215f3f23c (diff)
downloadchromium_src-f5b16fed647e941aa66933178da85db2860d639b.zip
chromium_src-f5b16fed647e941aa66933178da85db2860d639b.tar.gz
chromium_src-f5b16fed647e941aa66933178da85db2860d639b.tar.bz2
Add webkit to the repository.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port/css')
-rw-r--r--webkit/port/css/CSSPrimitiveValue.idl79
-rw-r--r--webkit/port/css/RGBColor.cpp50
-rw-r--r--webkit/port/css/RGBColor.h53
-rw-r--r--webkit/port/css/html4-overrides.css68
-rw-r--r--webkit/port/css/quirks-overrides.css12
5 files changed, 262 insertions, 0 deletions
diff --git a/webkit/port/css/CSSPrimitiveValue.idl b/webkit/port/css/CSSPrimitiveValue.idl
new file mode 100644
index 0000000..53cda5b
--- /dev/null
+++ b/webkit/port/css/CSSPrimitiveValue.idl
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+module css {
+
+ interface [
+ GenerateConstructor,
+ InterfaceUUID=a286b0cb-4ff0-4482-aa6e-7c5fb39afaba,
+ ImplementationUUID=c310c84d-480f-4bbb-9187-28e00956ac47
+ ] CSSPrimitiveValue : CSSValue {
+
+ // UnitTypes
+ const unsigned short CSS_UNKNOWN = 0;
+ const unsigned short CSS_NUMBER = 1;
+ const unsigned short CSS_PERCENTAGE = 2;
+ const unsigned short CSS_EMS = 3;
+ const unsigned short CSS_EXS = 4;
+ const unsigned short CSS_PX = 5;
+ const unsigned short CSS_CM = 6;
+ const unsigned short CSS_MM = 7;
+ const unsigned short CSS_IN = 8;
+ const unsigned short CSS_PT = 9;
+ const unsigned short CSS_PC = 10;
+ const unsigned short CSS_DEG = 11;
+ const unsigned short CSS_RAD = 12;
+ const unsigned short CSS_GRAD = 13;
+ const unsigned short CSS_MS = 14;
+ const unsigned short CSS_S = 15;
+ const unsigned short CSS_HZ = 16;
+ const unsigned short CSS_KHZ = 17;
+ const unsigned short CSS_DIMENSION = 18;
+ const unsigned short CSS_STRING = 19;
+ const unsigned short CSS_URI = 20;
+ const unsigned short CSS_IDENT = 21;
+ const unsigned short CSS_ATTR = 22;
+ const unsigned short CSS_COUNTER = 23;
+ const unsigned short CSS_RECT = 24;
+ const unsigned short CSS_RGBCOLOR = 25;
+
+ readonly attribute unsigned short primitiveType;
+
+ [OldStyleObjC] void setFloatValue(in unsigned short unitType,
+ in float floatValue)
+ raises(DOMException);
+ float getFloatValue(in unsigned short unitType)
+ raises(DOMException);
+ [OldStyleObjC] void setStringValue(in unsigned short stringType,
+ in DOMString stringValue)
+ raises(DOMException);
+ DOMString getStringValue()
+ raises(DOMException);
+ Counter getCounterValue()
+ raises(DOMException);
+ Rect getRectValue()
+ raises(DOMException);
+#if !defined(LANGUAGE_COM)
+ [Custom] RGBColor getRGBColorValue()
+ raises(DOMException);
+#endif
+
+ };
+
+}
diff --git a/webkit/port/css/RGBColor.cpp b/webkit/port/css/RGBColor.cpp
new file mode 100644
index 0000000..526a23a
--- /dev/null
+++ b/webkit/port/css/RGBColor.cpp
@@ -0,0 +1,50 @@
+// Copyright (c) 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "RGBColor.h"
+
+namespace WebCore {
+
+CSSPrimitiveValue* RGBColor::red() {
+ unsigned int value = (m_rgbcolor >> 16) & 0xFF;
+ return new CSSPrimitiveValue(value, CSSPrimitiveValue::CSS_NUMBER);
+}
+
+CSSPrimitiveValue* RGBColor::green() {
+ unsigned int value = (m_rgbcolor >> 8) & 0xFF;
+ return new CSSPrimitiveValue(value, CSSPrimitiveValue::CSS_NUMBER);
+}
+
+CSSPrimitiveValue* RGBColor::blue() {
+ unsigned int value = m_rgbcolor & 0xFF;
+ return new CSSPrimitiveValue(value, CSSPrimitiveValue::CSS_NUMBER);
+}
+
+} // namespace WebCore
+
diff --git a/webkit/port/css/RGBColor.h b/webkit/port/css/RGBColor.h
new file mode 100644
index 0000000..c29a288
--- /dev/null
+++ b/webkit/port/css/RGBColor.h
@@ -0,0 +1,53 @@
+// Copyright 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef RGBColor_h
+#define RGBColor_h
+
+#include "config.h"
+#include "CSSPrimitiveValue.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class RGBColor : public RefCounted<RGBColor> {
+ public:
+ RGBColor::RGBColor(unsigned rgbcolor) : m_rgbcolor(rgbcolor) { }
+
+ CSSPrimitiveValue* red();
+ CSSPrimitiveValue* green();
+ CSSPrimitiveValue* blue();
+
+ private:
+ unsigned m_rgbcolor;
+};
+
+} // namespace WebCore
+
+#endif // RGBColor_h
diff --git a/webkit/port/css/html4-overrides.css b/webkit/port/css/html4-overrides.css
new file mode 100644
index 0000000..ef4f658
--- /dev/null
+++ b/webkit/port/css/html4-overrides.css
@@ -0,0 +1,68 @@
+/* Copyright 2008 Google Inc. All Rights Reserved. */
+/* Author: ojan@google.com (Ojan Vafai) */
+
+/* These styles override the default styling for HTML elements as defined in
+ WebCore/css/html4.css. So far we have used this file exclusively for
+ making our form elements match Firefoxes. If we find other needs for this
+ file we should seriously consider if this is the right place of them. */
+
+input:not([type]),
+input[type="text"],
+input[type="password"],
+input[type="search"] {
+ margin:0;
+ padding:1px 0;
+}
+
+input[type="checkbox"] {
+ margin:3px 3px 3px 4px;
+}
+
+input[type="radio"] {
+ margin:3px 3px 0 5px;
+}
+
+/* Not sure this is the right color. #EBEBE4 is what Firefox uses.
+ TODO(ojan): Figure out how to support legacy input rendering.
+ TODO(ojan): Add input[type="file"] once we figure out our file inputs.
+ TODO(ojan): Add input[type="image"] once we figure out our image inputs.
+ TODO(ojan): We probably do the wrong thing if you put an invalid input type.
+ do we care?
+*/
+textarea:disabled,
+input:not([type]):disabled,
+input[type="text"]:disabled,
+input[type="password"]:disabled,
+input[type="search"]:disabled {
+ background-color: #EBEBE4;
+}
+
+/* Chrome should render input[type="search"] the same as input with no type.
+ This search thing is an Apple-ism to get mac style search inputs. */
+input[type="search"] {
+ -webkit-appearance: textfield;
+ -webkit-box-sizing: content-box;
+}
+
+input[type="button"], input[type="submit"], input[type="reset"], input[type="file"]::-webkit-file-upload-button, button {
+ /* Matches Firefox */
+ padding: 0 6px;
+ margin: 0;
+}
+
+/* Chrome selects are not rounded. Custom borders for them shouldn't be either. */
+keygen,
+select,
+select[size="0"],
+select[size="1"] {
+ -webkit-border-radius: 0;
+ margin: 0;
+}
+
+textarea {
+ font-family: monospace;
+ margin: 1px 0;
+
+ /* Matches IE */
+ padding: 2px;
+}
diff --git a/webkit/port/css/quirks-overrides.css b/webkit/port/css/quirks-overrides.css
new file mode 100644
index 0000000..b0300ee
--- /dev/null
+++ b/webkit/port/css/quirks-overrides.css
@@ -0,0 +1,12 @@
+/* Copyright 2008 Google Inc. All Rights Reserved. */
+/* Author: ojan@google.com (Ojan Vafai) */
+
+/* These styles override the default styling for HTML elements in quirks-mode
+ as defined in WebCore/css/quirks.css. So far we have used this file exclusively for
+ making our form elements match Firefoxes. If we find other needs for this
+ file we should seriously consider if this is the right place of them. */
+
+textarea {
+ /* Matches IE's text offsets in quirksmode (causes text to wrap the same as IE). */
+ padding: 2px 0 0 2px;
+}