[webkit-changes] cvs commit: WebCore/khtml/xml dom_nodeimpl.h
David
hyatt at opensource.apple.com
Thu Jul 28 16:27:15 PDT 2005
hyatt 05/07/28 16:27:14
Modified: . ChangeLog
khtml/css css_base.cpp css_base.h cssstyleselector.cpp
khtml/html html_formimpl.h
khtml/rendering render_theme.cpp
khtml/xml dom_nodeimpl.h
Log:
Implement support for the :checked, :enabled and :disabled pseudo-classes.
Reviewed by john
* khtml/css/css_base.cpp:
(CSSSelector::extractPseudoType):
* khtml/css/css_base.h:
(DOM::CSSSelector::):
* khtml/css/cssstyleselector.cpp:
(khtml::CSSStyleSelector::checkOneSelector):
* khtml/html/html_formimpl.h:
(DOM::HTMLGenericFormElementImpl::isControl):
(DOM::HTMLGenericFormElementImpl::isEnabled):
(DOM::HTMLInputElementImpl::isChecked):
* khtml/rendering/render_theme.cpp:
(khtml::RenderTheme::isChecked):
(khtml::RenderTheme::isEnabled):
* khtml/xml/dom_nodeimpl.h:
(DOM::NodeImpl::isControl):
(DOM::NodeImpl::isEnabled):
(DOM::NodeImpl::isChecked):
Revision Changes Path
1.4486 +24 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4485
retrieving revision 1.4486
diff -u -r1.4485 -r1.4486
--- ChangeLog 28 Jul 2005 22:52:46 -0000 1.4485
+++ ChangeLog 28 Jul 2005 23:27:04 -0000 1.4486
@@ -1,3 +1,27 @@
+2005-07-28 David Hyatt <hyatt at apple.com>
+
+ Implement support for the :checked, :enabled and :disabled pseudo-classes.
+
+ Reviewed by john
+
+ * khtml/css/css_base.cpp:
+ (CSSSelector::extractPseudoType):
+ * khtml/css/css_base.h:
+ (DOM::CSSSelector::):
+ * khtml/css/cssstyleselector.cpp:
+ (khtml::CSSStyleSelector::checkOneSelector):
+ * khtml/html/html_formimpl.h:
+ (DOM::HTMLGenericFormElementImpl::isControl):
+ (DOM::HTMLGenericFormElementImpl::isEnabled):
+ (DOM::HTMLInputElementImpl::isChecked):
+ * khtml/rendering/render_theme.cpp:
+ (khtml::RenderTheme::isChecked):
+ (khtml::RenderTheme::isEnabled):
+ * khtml/xml/dom_nodeimpl.h:
+ (DOM::NodeImpl::isControl):
+ (DOM::NodeImpl::isEnabled):
+ (DOM::NodeImpl::isChecked):
+
2005-07-28 Beth Dakin <bdakin at apple.com>
This is a fix for <rdar://problem/4190684>. Hyatt and I
1.18 +10 -1 WebCore/khtml/css/css_base.cpp
Index: css_base.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_base.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- css_base.cpp 18 Jul 2005 21:44:13 -0000 1.17
+++ css_base.cpp 28 Jul 2005 23:27:11 -0000 1.18
@@ -141,8 +141,11 @@
static AtomicString after("after");
static AtomicString anyLink("-khtml-any-link");
static AtomicString before("before");
+ static AtomicString checked("checked");
+ static AtomicString disabled("disabled");
static AtomicString drag("-khtml-drag");
static AtomicString empty("empty");
+ static AtomicString enabled("enabled");
static AtomicString firstChild("first-child");
static AtomicString firstLetter("first-letter");
static AtomicString firstLine("first-line");
@@ -171,8 +174,14 @@
else if (value == before) {
_pseudoType = PseudoBefore;
element = compat = true;
- } else if (value == drag)
+ } else if (value == checked)
+ _pseudoType = PseudoChecked;
+ else if (value == disabled)
+ _pseudoType = PseudoDisabled;
+ else if (value == drag)
_pseudoType = PseudoDrag;
+ else if (value == enabled)
+ _pseudoType = PseudoEnabled;
else if (value == empty)
_pseudoType = PseudoEmpty;
else if (value == firstChild)
1.15 +3 -0 WebCore/khtml/css/css_base.h
Index: css_base.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_base.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- css_base.h 18 Jul 2005 21:44:13 -0000 1.14
+++ css_base.h 28 Jul 2005 23:27:12 -0000 1.15
@@ -158,6 +158,9 @@
PseudoDrag,
PseudoFocus,
PseudoActive,
+ PseudoChecked,
+ PseudoEnabled,
+ PseudoDisabled,
PseudoTarget,
PseudoBefore,
PseudoAfter,
1.196 +18 -0 WebCore/khtml/css/cssstyleselector.cpp
Index: cssstyleselector.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/cssstyleselector.cpp,v
retrieving revision 1.195
retrieving revision 1.196
diff -u -r1.195 -r1.196
--- cssstyleselector.cpp 28 Jul 2005 20:47:25 -0000 1.195
+++ cssstyleselector.cpp 28 Jul 2005 23:27:12 -0000 1.196
@@ -1334,6 +1334,24 @@
return true;
}
break;
+ case CSSSelector::PseudoEnabled:
+ if (e && e->isControl())
+ // The UI spec states that you can't match :enabled unless you are an object that can
+ // "receive focus and be activated." We will limit matching of this pseudo-class to elements
+ // that are controls.
+ return e->isEnabled();
+ break;
+ case CSSSelector::PseudoDisabled:
+ if (e && e->isControl())
+ // The UI spec states that you can't match :enabled unless you are an object that can
+ // "receive focus and be activated." We will limit matching of this pseudo-class to elements
+ // that are controls.
+ return !e->isEnabled();
+ break;
+ case CSSSelector::PseudoChecked:
+ if (e && e->isChecked())
+ return true;
+ break;
case CSSSelector::PseudoRoot:
if (e == e->getDocument()->documentElement())
return true;
1.81 +5 -0 WebCore/khtml/html/html_formimpl.h
Index: html_formimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_formimpl.h,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- html_formimpl.h 20 Jul 2005 02:35:31 -0000 1.80
+++ html_formimpl.h 28 Jul 2005 23:27:13 -0000 1.81
@@ -172,6 +172,9 @@
virtual DOMString type() const = 0;
+ virtual bool isControl() const { return true; }
+ virtual bool isEnabled() const { return !disabled(); }
+
virtual void parseMappedAttribute(MappedAttributeImpl *attr);
virtual void attach();
virtual void insertedIntoDocument();
@@ -339,6 +342,8 @@
bool autoComplete() const { return m_autocomplete; }
+ virtual bool isChecked() const { return checked(); }
+
bool checked() const { return m_checked; }
void setChecked(bool);
long maxLength() const { return m_maxLen; }
1.5 +4 -4 WebCore/khtml/rendering/render_theme.cpp
Index: render_theme.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_theme.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- render_theme.cpp 28 Jul 2005 21:28:00 -0000 1.4
+++ render_theme.cpp 28 Jul 2005 23:27:13 -0000 1.5
@@ -84,16 +84,16 @@
bool RenderTheme::isChecked(const RenderObject* o) const
{
- if (!o->element() || !o->element()->hasTagName(HTMLTags::input()))
+ if (!o->element())
return false;
- return static_cast<HTMLInputElementImpl*>(o->element())->checked();
+ return o->element()->isChecked();
}
bool RenderTheme::isEnabled(const RenderObject* o) const
{
- if (!o->element() || !o->element()->hasTagName(HTMLTags::input()))
+ if (!o->element())
return true;
- return !static_cast<HTMLInputElementImpl*>(o->element())->disabled();
+ return o->element()->isEnabled();
}
bool RenderTheme::isFocused(const RenderObject* o) const
1.91 +3 -0 WebCore/khtml/xml/dom_nodeimpl.h
Index: dom_nodeimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.h,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -r1.90 -r1.91
--- dom_nodeimpl.h 18 Jul 2005 21:44:29 -0000 1.90
+++ dom_nodeimpl.h 28 Jul 2005 23:27:14 -0000 1.91
@@ -244,6 +244,9 @@
virtual bool isFocusable() const;
virtual bool isKeyboardFocusable() const;
virtual bool isMouseFocusable() const;
+ virtual bool isControl() const { return false; } // Eventually the notion of what is a control will be extensible.
+ virtual bool isEnabled() const { return true; }
+ virtual bool isChecked() const { return false; }
virtual bool isContentEditable() const;
virtual QRect getRect() const;
More information about the webkit-changes
mailing list