- Revision
- 126842
- Author
- [email protected]
- Date
- 2012-08-27 22:41:50 -0700 (Mon, 27 Aug 2012)
Log Message
[ShadowDOM] Shadow elements in the input element should be focusable.
https://bugs.webkit.org/show_bug.cgi?id=95169
Reviewed by Kent Tamura.
This patch introduces new virtual function HTMLElement::hasCustomFocusLogic()
to allow input type implementations to use shadow element with focus
navigation.
No new tests. This patch doesn't change behavior.
(WebCore::HTMLElement::hasCustomFocusLogic): Added to return false as
default value.
* html/HTMLElement.h:
(HTMLElement): Added a declaration of hasCustomFocusLogic().
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::hasCustomFocusLogic): Added to call InputType::hasCustomFocusLogic(),
* html/HTMLInputElement.h:
(HTMLInputElement): Added a declaration of hasCustomFocusLogic().
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::hasCustomFocusLogic): Added to return true for "audio" and "video" elements.
* html/HTMLMediaElement.h:
(HTMLMediaElement): Add a declaration of hasCustomFocusLogic()
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::hasCustomFocusLogic): Added to return true.
* html/HTMLTextAreaElement.h:
(HTMLTextAreaElement): Add a declaration of hasCustomFocusLogic().
* page/FocusController.cpp:
(WebCore::hasCustomFocusLogic): Changed to call HTMLElement::hasCustomFocusLogic()
rather than checking tag names.
* html/InputType.cpp:
(WebCore::InputType::hasCustomFocusLogic): Added to return true as default value.
* html/InputType.h:
(InputType): Added a declaration of hasCustomFocusLogic().
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (126841 => 126842)
--- trunk/Source/WebCore/ChangeLog 2012-08-28 05:15:13 UTC (rev 126841)
+++ trunk/Source/WebCore/ChangeLog 2012-08-28 05:41:50 UTC (rev 126842)
@@ -1,3 +1,40 @@
+2012-08-27 Yoshifumi Inoue <[email protected]>
+
+ [ShadowDOM] Shadow elements in the input element should be focusable.
+ https://bugs.webkit.org/show_bug.cgi?id=95169
+
+ Reviewed by Kent Tamura.
+
+ This patch introduces new virtual function HTMLElement::hasCustomFocusLogic()
+ to allow input type implementations to use shadow element with focus
+ navigation.
+
+ No new tests. This patch doesn't change behavior.
+
+ (WebCore::HTMLElement::hasCustomFocusLogic): Added to return false as
+ default value.
+ * html/HTMLElement.h:
+ (HTMLElement): Added a declaration of hasCustomFocusLogic().
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::hasCustomFocusLogic): Added to call InputType::hasCustomFocusLogic(),
+ * html/HTMLInputElement.h:
+ (HTMLInputElement): Added a declaration of hasCustomFocusLogic().
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::hasCustomFocusLogic): Added to return true for "audio" and "video" elements.
+ * html/HTMLMediaElement.h:
+ (HTMLMediaElement): Add a declaration of hasCustomFocusLogic()
+ * html/HTMLTextAreaElement.cpp:
+ (WebCore::HTMLTextAreaElement::hasCustomFocusLogic): Added to return true.
+ * html/HTMLTextAreaElement.h:
+ (HTMLTextAreaElement): Add a declaration of hasCustomFocusLogic().
+ * page/FocusController.cpp:
+ (WebCore::hasCustomFocusLogic): Changed to call HTMLElement::hasCustomFocusLogic()
+ rather than checking tag names.
+ * html/InputType.cpp:
+ (WebCore::InputType::hasCustomFocusLogic): Added to return true as default value.
+ * html/InputType.h:
+ (InputType): Added a declaration of hasCustomFocusLogic().
+
2012-08-27 Beth Dakin <[email protected]>
https://bugs.webkit.org/show_bug.cgi?id=94848
Modified: trunk/Source/WebCore/html/HTMLElement.cpp (126841 => 126842)
--- trunk/Source/WebCore/html/HTMLElement.cpp 2012-08-28 05:15:13 UTC (rev 126841)
+++ trunk/Source/WebCore/html/HTMLElement.cpp 2012-08-28 05:41:50 UTC (rev 126842)
@@ -628,6 +628,11 @@
addPropertyToAttributeStyle(style, CSSPropertyVerticalAlign, verticalAlignValue);
}
+bool HTMLElement::hasCustomFocusLogic() const
+{
+ return false;
+}
+
bool HTMLElement::supportsFocus() const
{
return Element::supportsFocus() || (rendererIsEditable() && parentNode() && !parentNode()->rendererIsEditable());
Modified: trunk/Source/WebCore/html/HTMLElement.h (126841 => 126842)
--- trunk/Source/WebCore/html/HTMLElement.h 2012-08-28 05:15:13 UTC (rev 126841)
+++ trunk/Source/WebCore/html/HTMLElement.h 2012-08-28 05:41:50 UTC (rev 126842)
@@ -64,6 +64,7 @@
void insertAdjacentHTML(const String& where, const String& html, ExceptionCode&);
void insertAdjacentText(const String& where, const String& text, ExceptionCode&);
+ virtual bool hasCustomFocusLogic() const;
virtual bool supportsFocus() const;
String contentEditable() const;
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (126841 => 126842)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2012-08-28 05:15:13 UTC (rev 126841)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2012-08-28 05:41:50 UTC (rev 126842)
@@ -338,6 +338,12 @@
m_inputType->stepUp(-n, ec);
}
+
+bool HTMLInputElement::hasCustomFocusLogic() const
+{
+ return m_inputType->hasCustomFocusLogic();
+}
+
bool HTMLInputElement::isKeyboardFocusable(KeyboardEvent* event) const
{
return m_inputType->isKeyboardFocusable(event);
Modified: trunk/Source/WebCore/html/HTMLInputElement.h (126841 => 126842)
--- trunk/Source/WebCore/html/HTMLInputElement.h 2012-08-28 05:15:13 UTC (rev 126841)
+++ trunk/Source/WebCore/html/HTMLInputElement.h 2012-08-28 05:41:50 UTC (rev 126842)
@@ -294,6 +294,7 @@
virtual void removedFrom(ContainerNode*) OVERRIDE;
virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
+ virtual bool hasCustomFocusLogic() const OVERRIDE;
virtual bool isKeyboardFocusable(KeyboardEvent*) const;
virtual bool isMouseFocusable() const;
virtual bool isEnumeratable() const;
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (126841 => 126842)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-08-28 05:15:13 UTC (rev 126841)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-08-28 05:41:50 UTC (rev 126842)
@@ -330,6 +330,11 @@
HTMLElement::didMoveToNewDocument(oldDocument);
}
+bool HTMLMediaElement::hasCustomFocusLogic() const
+{
+ return true;
+}
+
bool HTMLMediaElement::supportsFocus() const
{
if (ownerDocument()->isMediaDocument())
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (126841 => 126842)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2012-08-28 05:15:13 UTC (rev 126841)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2012-08-28 05:41:50 UTC (rev 126842)
@@ -354,6 +354,7 @@
private:
void createMediaPlayer();
+ virtual bool hasCustomFocusLogic() const OVERRIDE;
virtual bool supportsFocus() const;
virtual bool isMouseFocusable() const;
virtual bool rendererIsNeeded(const NodeRenderingContext&);
Modified: trunk/Source/WebCore/html/HTMLTextAreaElement.cpp (126841 => 126842)
--- trunk/Source/WebCore/html/HTMLTextAreaElement.cpp 2012-08-28 05:15:13 UTC (rev 126841)
+++ trunk/Source/WebCore/html/HTMLTextAreaElement.cpp 2012-08-28 05:41:50 UTC (rev 126842)
@@ -216,6 +216,11 @@
setNonDirtyValue(defaultValue());
}
+bool HTMLTextAreaElement::hasCustomFocusLogic() const
+{
+ return true;
+}
+
bool HTMLTextAreaElement::isKeyboardFocusable(KeyboardEvent*) const
{
// If a given text area can be focused at all, then it will always be keyboard focusable.
Modified: trunk/Source/WebCore/html/HTMLTextAreaElement.h (126841 => 126842)
--- trunk/Source/WebCore/html/HTMLTextAreaElement.h 2012-08-28 05:15:13 UTC (rev 126841)
+++ trunk/Source/WebCore/html/HTMLTextAreaElement.h 2012-08-28 05:41:50 UTC (rev 126842)
@@ -102,6 +102,7 @@
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual bool appendFormData(FormDataList&, bool);
virtual void reset();
+ virtual bool hasCustomFocusLogic() const OVERRIDE;
virtual bool isMouseFocusable() const;
virtual bool isKeyboardFocusable(KeyboardEvent*) const;
virtual void updateFocusAppearance(bool restorePreviousSelection);
Modified: trunk/Source/WebCore/html/InputType.cpp (126841 => 126842)
--- trunk/Source/WebCore/html/InputType.cpp 2012-08-28 05:15:13 UTC (rev 126841)
+++ trunk/Source/WebCore/html/InputType.cpp 2012-08-28 05:41:50 UTC (rev 126842)
@@ -511,6 +511,11 @@
return true;
}
+bool InputType::hasCustomFocusLogic() const
+{
+ return true;
+}
+
bool InputType::isKeyboardFocusable(KeyboardEvent* event) const
{
return element()->isTextFormControlKeyboardFocusable(event);
Modified: trunk/Source/WebCore/html/InputType.h (126841 => 126842)
--- trunk/Source/WebCore/html/InputType.h 2012-08-28 05:15:13 UTC (rev 126841)
+++ trunk/Source/WebCore/html/InputType.h 2012-08-28 05:41:50 UTC (rev 126842)
@@ -200,6 +200,7 @@
// Helpers for event handlers.
virtual bool shouldSubmitImplicitly(Event*);
virtual PassRefPtr<HTMLFormElement> formForSubmission() const;
+ virtual bool hasCustomFocusLogic() const;
virtual bool isKeyboardFocusable(KeyboardEvent*) const;
virtual bool isMouseFocusable() const;
virtual bool shouldUseInputMethod() const;
Modified: trunk/Source/WebCore/page/FocusController.cpp (126841 => 126842)
--- trunk/Source/WebCore/page/FocusController.cpp 2012-08-28 05:15:13 UTC (rev 126841)
+++ trunk/Source/WebCore/page/FocusController.cpp 2012-08-28 05:41:50 UTC (rev 126842)
@@ -163,7 +163,7 @@
static inline bool hasCustomFocusLogic(Node* node)
{
- return node->hasTagName(inputTag) || node->hasTagName(textareaTag) || node->hasTagName(videoTag) || node->hasTagName(audioTag);
+ return node->isHTMLElement() && toHTMLElement(node)->hasCustomFocusLogic();
}
static inline bool isNonFocusableShadowHost(Node* node, KeyboardEvent* event)