Title: [123187] trunk/Source/WebCore
Revision
123187
Author
tk...@chromium.org
Date
2012-07-20 00:42:57 -0700 (Fri, 20 Jul 2012)

Log Message

[Chromium] Fix an assertion failure in TextFieldDecorationElement::hostInput()
https://bugs.webkit.org/show_bug.cgi?id=91824

Reviewed by Hajime Morita.

No new tests. This code is used only in Chromium browser.

* html/shadow/TextFieldDecorationElement.cpp:
(WebCore::TextFieldDecorationElement::hostInput):
Use shadowHost(), and allow to return 0.
(WebCore::TextFieldDecorationElement::defaultEventHandler):
Check 0.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (123186 => 123187)


--- trunk/Source/WebCore/ChangeLog	2012-07-20 07:36:17 UTC (rev 123186)
+++ trunk/Source/WebCore/ChangeLog	2012-07-20 07:42:57 UTC (rev 123187)
@@ -1,3 +1,18 @@
+2012-07-20  Kent Tamura  <tk...@chromium.org>
+
+        [Chromium] Fix an assertion failure in TextFieldDecorationElement::hostInput()
+        https://bugs.webkit.org/show_bug.cgi?id=91824
+
+        Reviewed by Hajime Morita.
+
+        No new tests. This code is used only in Chromium browser.
+
+        * html/shadow/TextFieldDecorationElement.cpp:
+        (WebCore::TextFieldDecorationElement::hostInput):
+        Use shadowHost(), and allow to return 0.
+        (WebCore::TextFieldDecorationElement::defaultEventHandler):
+        Check 0.
+
 2012-07-19  Simon Hausmann  <simon.hausm...@nokia.com>
 
         [Qt] Compile WebCore without QtWidgets

Modified: trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp (123186 => 123187)


--- trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp	2012-07-20 07:36:17 UTC (rev 123186)
+++ trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp	2012-07-20 07:42:57 UTC (rev 123187)
@@ -116,9 +116,10 @@
 
 inline HTMLInputElement* TextFieldDecorationElement::hostInput()
 {
-    ASSERT(shadowAncestorNode());
-    ASSERT(shadowAncestorNode()->hasTagName(inputTag));
-    return static_cast<HTMLInputElement*>(shadowAncestorNode());
+    // TextFieldDecorationElement is created only by C++ code, and it is always
+    // in <input> shadow.
+    ASSERT(!shadowHost() || shadowHost()->hasTagName(inputTag));
+    return static_cast<HTMLInputElement*>(shadowHost());
 }
 
 bool TextFieldDecorationElement::isTextFieldDecoration() const
@@ -181,7 +182,7 @@
 void TextFieldDecorationElement::defaultEventHandler(Event* event)
 {
     RefPtr<HTMLInputElement> input(hostInput());
-    if (input->disabled() || input->readOnly() || !event->isMouseEvent()) {
+    if (!input || input->disabled() || input->readOnly() || !event->isMouseEvent()) {
         if (!event->defaultHandled())
             HTMLDivElement::defaultEventHandler(event);
         return;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to