Diff
Modified: trunk/Source/WebCore/ChangeLog (150696 => 150697)
--- trunk/Source/WebCore/ChangeLog 2013-05-26 00:51:00 UTC (rev 150696)
+++ trunk/Source/WebCore/ChangeLog 2013-05-26 02:22:04 UTC (rev 150697)
@@ -1,3 +1,25 @@
+2013-05-25 Andreas Kling <akl...@apple.com>
+
+ Move Node::focusDelegate() to Element.
+ <http://webkit.org/b/116768>
+
+ Reviewed by Anders Carlsson.
+
+ Only Element can be a focus delegate (it's currently only ever HTMLInputElement actually)
+ so move Node::focusDelegate() to Element. Sprinkled isElementNode() checks as needed.
+
+ * dom/Node.cpp:
+ * dom/Node.h:
+ * dom/Element.h:
+ * dom/Element.cpp:
+ * html/shadow/SliderThumbElement.cpp:
+ (WebCore::SliderThumbElement::focusDelegate):
+ * html/shadow/SliderThumbElement.h:
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::isFocused):
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::paintSliderThumb):
+
2013-05-25 Alberto Garcia <agar...@igalia.com>
Path: clean up addPathForRoundedRect()
Modified: trunk/Source/WebCore/dom/Element.cpp (150696 => 150697)
--- trunk/Source/WebCore/dom/Element.cpp 2013-05-26 00:51:00 UTC (rev 150696)
+++ trunk/Source/WebCore/dom/Element.cpp 2013-05-26 02:22:04 UTC (rev 150697)
@@ -244,6 +244,11 @@
return hasRareData() && elementRareData()->tabIndexSetExplicitly();
}
+Element* Element::focusDelegate()
+{
+ return this;
+}
+
short Element::tabIndex() const
{
return hasRareData() ? elementRareData()->tabIndex() : 0;
Modified: trunk/Source/WebCore/dom/Element.h (150696 => 150697)
--- trunk/Source/WebCore/dom/Element.h 2013-05-26 00:51:00 UTC (rev 150696)
+++ trunk/Source/WebCore/dom/Element.h 2013-05-26 02:22:04 UTC (rev 150697)
@@ -435,6 +435,8 @@
virtual bool isKeyboardFocusable(KeyboardEvent*) const;
virtual bool isMouseFocusable() const;
+ virtual Element* focusDelegate();
+
RenderStyle* computedStyle(PseudoId = NOPSEUDO);
// Methods for indicating the style is affected by dynamic updates (e.g., children changing, our position changing in our sibling list, etc.)
Modified: trunk/Source/WebCore/dom/Node.cpp (150696 => 150697)
--- trunk/Source/WebCore/dom/Node.cpp 2013-05-26 00:51:00 UTC (rev 150696)
+++ trunk/Source/WebCore/dom/Node.cpp 2013-05-26 02:22:04 UTC (rev 150697)
@@ -885,11 +885,6 @@
return true;
}
-Node* Node::focusDelegate()
-{
- return this;
-}
-
unsigned Node::nodeIndex() const
{
Node *_tempNode = previousSibling();
Modified: trunk/Source/WebCore/dom/Node.h (150696 => 150697)
--- trunk/Source/WebCore/dom/Node.h 2013-05-26 00:51:00 UTC (rev 150696)
+++ trunk/Source/WebCore/dom/Node.h 2013-05-26 02:22:04 UTC (rev 150697)
@@ -406,7 +406,6 @@
virtual bool supportsFocus() const;
// Whether the node can actually be focused.
virtual bool isFocusable() const;
- virtual Node* focusDelegate();
enum UserSelectAllTreatment {
UserSelectAllDoesNotAffectEditability,
Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp (150696 => 150697)
--- trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp 2013-05-26 00:51:00 UTC (rev 150696)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp 2013-05-26 02:22:04 UTC (rev 150697)
@@ -237,7 +237,7 @@
return hostInput()->matchesReadWritePseudoClass();
}
-Node* SliderThumbElement::focusDelegate()
+Element* SliderThumbElement::focusDelegate()
{
return hostInput();
}
Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.h (150696 => 150697)
--- trunk/Source/WebCore/html/shadow/SliderThumbElement.h 2013-05-26 00:51:00 UTC (rev 150696)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.h 2013-05-26 02:22:04 UTC (rev 150697)
@@ -68,7 +68,7 @@
virtual bool isDisabledFormControl() const OVERRIDE;
virtual bool matchesReadOnlyPseudoClass() const OVERRIDE;
virtual bool matchesReadWritePseudoClass() const OVERRIDE;
- virtual Node* focusDelegate();
+ virtual Element* focusDelegate() OVERRIDE;
void startDragging();
void stopDragging();
Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (150696 => 150697)
--- trunk/Source/WebCore/rendering/RenderTheme.cpp 2013-05-26 00:51:00 UTC (rev 150696)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp 2013-05-26 02:22:04 UTC (rev 150697)
@@ -794,13 +794,13 @@
bool RenderTheme::isFocused(const RenderObject* o) const
{
Node* node = o->node();
- if (!node)
+ if (!node || !node->isElementNode())
return false;
- node = node->focusDelegate();
- Document* document = node->document();
+ Element* focusDelegate = toElement(node)->focusDelegate();
+ Document* document = focusDelegate->document();
Frame* frame = document->frame();
- return node == document->focusedNode() && frame && frame->selection()->isFocusedAndActive();
+ return focusDelegate == document->focusedNode() && frame && frame->selection()->isFocusedAndActive();
}
bool RenderTheme::isPressed(const RenderObject* o) const
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (150696 => 150697)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2013-05-26 00:51:00 UTC (rev 150696)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2013-05-26 02:22:04 UTC (rev 150697)
@@ -1762,7 +1762,8 @@
// Update the various states we respond to.
updateActiveState(sliderThumbCell, o);
updateEnabledState(sliderThumbCell, o);
- updateFocusedState(sliderThumbCell, (o->node() && o->node()->focusDelegate()->renderer()) ? o->node()->focusDelegate()->renderer() : o);
+ Element* focusDelegate = (o->node() && o->node()->isElementNode()) ? toElement(o->node())->focusDelegate() : 0;
+ updateFocusedState(sliderThumbCell, focusDelegate ? focusDelegate->renderer() : 0);
// Update the pressed state using the NSCell tracking methods, since that's how NSSliderCell keeps track of it.
bool oldPressed;