Diff
Modified: trunk/Source/WebCore/ChangeLog (199333 => 199334)
--- trunk/Source/WebCore/ChangeLog 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebCore/ChangeLog 2016-04-12 04:15:16 UTC (rev 199334)
@@ -1,3 +1,78 @@
+2016-04-11 Darin Adler <[email protected]>
+
+ Remove UsePointersEvenForNonNullableObjectArguments from HTMLSelectElement
+ https://bugs.webkit.org/show_bug.cgi?id=156458
+
+ Reviewed by Chris Dumez.
+
+ * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
+ (WebCore::JSHTMLOptionsCollection::remove): Updated to call remove with a reference
+ rather than a pointer.
+
+ * bindings/js/JSHTMLSelectElementCustom.cpp:
+ (WebCore::JSHTMLSelectElement::remove): Updated to call remove with a reference
+ rather than a pointer.
+ (WebCore::selectIndexSetter): Updated to call setOption with a reference rather
+ than a pointer.
+
+ * bindings/scripts/CodeGeneratorGObject.pm:
+ (GenerateFunction): Added basic support for passing wrappers by reference.
+ GObject bindings already check arguments for null, so didn't add any new checks.
+
+ * bindings/scripts/test/GObject/WebKitDOMTestActiveDOMObject.cpp:
+ * bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp:
+ * bindings/scripts/test/GObject/WebKitDOMTestCallbackFunction.cpp:
+ * bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp:
+ * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+ Updated.
+
+ * editing/FrameSelection.cpp: Updated includes.
+
+ * html/HTMLOptionElement.cpp:
+ (WebCore::HTMLOptionElement::setSelected): Pass reference when calling
+ HTMLSelectElement::optionSelectionStateChanged.
+ (WebCore::HTMLOptionElement::insertedInto): Ditto.
+
+ * html/HTMLOptionsCollection.cpp:
+ (WebCore::HTMLOptionsCollection::add): Moved null checking behavior here.
+ Preserves existing "silently do nothing if null".
+ (WebCore::HTMLOptionsCollection::remove): Changed function to take a reference
+ instead of a pointer.
+
+ * html/HTMLOptionsCollection.h: Updated include. Changed remove to take a
+ reference instead of a pointer.
+
+ * html/HTMLSelectElement.cpp:
+ (WebCore::HTMLSelectElement::add): Changed to take a reference instead of
+ a pointer. Also removed unneeded protect code, since insertBefore already
+ protects itself, and unneeded call to updateValidity, since the
+ HTMLSelectElement::childrenChanged function already calls updateValidity.
+ (WebCore::HTMLSelectElement::remove): Changed to take a reference instead
+ of a pointer.
+ (WebCore::HTMLSelectElement::setOption): Changed to take a reference
+ instead of a pointer.
+ (WebCore::HTMLSelectElement::setLength): Renamed "newLen" to "newLength".
+ Use Ref instead of RefPtr for result of createElement, which makes the
+ argument passed to add be a reference rather than a pointer.
+ (WebCore::HTMLSelectElement::willRespondToMouseClickEvents): Put the #if
+ for this here instead of in the header.
+ (WebCore::HTMLSelectElement::optionSelectionStateChanged): Changed to take
+ a reference instead of a pointer for the option element.
+
+ * html/HTMLSelectElement.h: Removed unneeded includes. Derive privately
+ from TypeAheadDataSource instead of publicly. Make all overrides final
+ except for the one that is actually overridden by a derived class.
+ Changed the arguments of the add, remove, setOption, and
+ optionSelectionStateChanged functions to be references instead of pointers.
+ Tweaked formatting a bit and used nullptr instead of 0. Override
+ willRespondToMouseClickEvents on all platforms, not just iOS.
+
+ * html/HTMLSelectElement.idl: Removed UsePointersEvenForNonNullableObjectArguments.
+ Removed a comment that is no longer needed. Made some types nullable to match
+ the specification, in places that currently have no effect on code generation.
+ Added a FIXME comment about the argument to setCustomValidity incorrectly being
+ marked as nullable.
+
2016-04-11 Brent Fulgham <[email protected]>
Use WeakPtrs to avoid using deallocated Widgets and ScrollableAreas
Modified: trunk/Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp (199333 => 199334)
--- trunk/Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp 2016-04-12 04:15:16 UTC (rev 199334)
@@ -75,7 +75,7 @@
// The argument can be an HTMLOptionElement or an index.
JSValue argument = state.argument(0);
if (HTMLOptionElement* option = JSHTMLOptionElement::toWrapped(argument))
- wrapped().remove(option);
+ wrapped().remove(*option);
else
wrapped().remove(argument.toInt32(&state));
return jsUndefined();
Modified: trunk/Source/WebCore/bindings/js/JSHTMLSelectElementCustom.cpp (199333 => 199334)
--- trunk/Source/WebCore/bindings/js/JSHTMLSelectElementCustom.cpp 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebCore/bindings/js/JSHTMLSelectElementCustom.cpp 2016-04-12 04:15:16 UTC (rev 199334)
@@ -44,7 +44,7 @@
} else {
// The HTMLSelectElement::remove() function can take either an option object or the index of an option.
if (HTMLOptionElement* option = JSHTMLOptionElement::toWrapped(state.argument(0)))
- select.remove(option);
+ select.remove(*option);
else
select.removeByIndex(state.argument(0).toInt32(&state));
}
@@ -62,7 +62,7 @@
if (!option)
ec = TYPE_MISMATCH_ERR;
else
- select->setOption(index, option, ec);
+ select->setOption(index, *option, ec);
setDOMException(exec, ec);
}
}
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm (199333 => 199334)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm 2016-04-12 04:15:16 UTC (rev 199334)
@@ -1109,6 +1109,9 @@
}
if ($paramIsGDOMType || ($paramIDLType eq "DOMString")) {
$paramName = "converted" . $codeGenerator->WK_ucfirst($paramName);
+ if ($prefix ne "set_" && $codeGenerator->ShouldPassWrapperByReference($param, $parentNode)) {
+ $paramName = "*$paramName";
+ }
}
if ($paramIDLType eq "NodeFilter" || $paramIDLType eq "XPathNSResolver") {
$paramName = "WTF::getPtr(" . $paramName . ")";
Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestActiveDOMObject.cpp (199333 => 199334)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestActiveDOMObject.cpp 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestActiveDOMObject.cpp 2016-04-12 04:15:16 UTC (rev 199334)
@@ -141,7 +141,7 @@
g_return_if_fail(WEBKIT_DOM_IS_NODE(nextChild));
WebCore::TestActiveDOMObject* item = WebKit::core(self);
WebCore::Node* convertedNextChild = WebKit::core(nextChild);
- item->excitingFunction(convertedNextChild);
+ item->excitingFunction(*convertedNextChild);
}
void webkit_dom_test_active_dom_object_post_message(WebKitDOMTestActiveDOMObject* self, const gchar* message)
Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp (199333 => 199334)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp 2016-04-12 04:15:16 UTC (rev 199334)
@@ -135,7 +135,7 @@
g_return_val_if_fail(WEBKIT_DOM_IS_FLOAT32ARRAY(arrayParam), FALSE);
WebCore::TestCallback* item = WebKit::core(self);
WebCore::Float32Array* convertedArrayParam = WebKit::core(arrayParam);
- gboolean result = item->callbackWithArrayParam(convertedArrayParam);
+ gboolean result = item->callbackWithArrayParam(*convertedArrayParam);
return result;
#else
UNUSED_PARAM(self);
@@ -191,7 +191,7 @@
g_return_val_if_fail(WEBKIT_DOM_IS_DOM_STRING_LIST(listParam), FALSE);
WebCore::TestCallback* item = WebKit::core(self);
WebCore::DOMStringList* convertedListParam = WebKit::core(listParam);
- gboolean result = item->callbackWithStringList(convertedListParam);
+ gboolean result = item->callbackWithStringList(*convertedListParam);
return result;
#else
UNUSED_PARAM(self);
@@ -225,7 +225,7 @@
g_return_val_if_fail(WEBKIT_DOM_IS_TEST_NODE(testNodeParam), FALSE);
WebCore::TestCallback* item = WebKit::core(self);
WebCore::TestNode* convertedTestNodeParam = WebKit::core(testNodeParam);
- gboolean result = item->callbackRequiresThisToPass(longParam, convertedTestNodeParam);
+ gboolean result = item->callbackRequiresThisToPass(longParam, *convertedTestNodeParam);
return result;
#else
UNUSED_PARAM(self);
Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallbackFunction.cpp (199333 => 199334)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallbackFunction.cpp 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallbackFunction.cpp 2016-04-12 04:15:16 UTC (rev 199334)
@@ -135,7 +135,7 @@
g_return_val_if_fail(WEBKIT_DOM_IS_FLOAT32ARRAY(arrayParam), FALSE);
WebCore::TestCallbackFunction* item = WebKit::core(self);
WebCore::Float32Array* convertedArrayParam = WebKit::core(arrayParam);
- gboolean result = item->callbackWithArrayParam(convertedArrayParam);
+ gboolean result = item->callbackWithArrayParam(*convertedArrayParam);
return result;
#else
UNUSED_PARAM(self);
@@ -191,7 +191,7 @@
g_return_val_if_fail(WEBKIT_DOM_IS_DOM_STRING_LIST(listParam), FALSE);
WebCore::TestCallbackFunction* item = WebKit::core(self);
WebCore::DOMStringList* convertedListParam = WebKit::core(listParam);
- gboolean result = item->callbackWithStringList(convertedListParam);
+ gboolean result = item->callbackWithStringList(*convertedListParam);
return result;
#else
UNUSED_PARAM(self);
@@ -225,7 +225,7 @@
g_return_val_if_fail(WEBKIT_DOM_IS_TEST_NODE(testNodeParam), FALSE);
WebCore::TestCallbackFunction* item = WebKit::core(self);
WebCore::TestNode* convertedTestNodeParam = WebKit::core(testNodeParam);
- gboolean result = item->callbackRequiresThisToPass(longParam, convertedTestNodeParam);
+ gboolean result = item->callbackRequiresThisToPass(longParam, *convertedTestNodeParam);
return result;
#else
UNUSED_PARAM(self);
Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp (199333 => 199334)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp 2016-04-12 04:15:16 UTC (rev 199334)
@@ -263,7 +263,7 @@
WTF::String convertedStrArg = WTF::String::fromUTF8(strArg);
WebCore::TestObj* convertedObjArg = WebKit::core(objArg);
WebCore::ExceptionCode ec = 0;
- RefPtr<WebCore::TestObj> gobjectResult = WTF::getPtr(item->implementsMethod2(convertedStrArg, convertedObjArg, ec));
+ RefPtr<WebCore::TestObj> gobjectResult = WTF::getPtr(item->implementsMethod2(convertedStrArg, *convertedObjArg, ec));
if (ec) {
WebCore::ExceptionCodeDescription ecdesc(ec);
g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
@@ -322,7 +322,7 @@
WTF::String convertedStrArg = WTF::String::fromUTF8(strArg);
WebCore::TestObj* convertedObjArg = WebKit::core(objArg);
WebCore::ExceptionCode ec = 0;
- RefPtr<WebCore::TestObj> gobjectResult = WTF::getPtr(WebCore::TestSupplemental::supplementalMethod2(*item, convertedStrArg, convertedObjArg, ec));
+ RefPtr<WebCore::TestObj> gobjectResult = WTF::getPtr(WebCore::TestSupplemental::supplementalMethod2(*item, convertedStrArg, *convertedObjArg, ec));
if (ec) {
WebCore::ExceptionCodeDescription ecdesc(ec);
g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp (199333 => 199334)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp 2016-04-12 04:15:16 UTC (rev 199334)
@@ -1216,7 +1216,7 @@
WebCore::TestObj* item = WebKit::core(self);
WTF::String convertedStrArg = WTF::String::fromUTF8(strArg);
WebCore::TestObj* convertedObjArg = WebKit::core(objArg);
- item->voidMethodWithArgs(longArg, convertedStrArg, convertedObjArg);
+ item->voidMethodWithArgs(longArg, convertedStrArg, *convertedObjArg);
}
gint8 webkit_dom_test_obj_byte_method(WebKitDOMTestObj* self)
@@ -1237,7 +1237,7 @@
WebCore::TestObj* item = WebKit::core(self);
WTF::String convertedStrArg = WTF::String::fromUTF8(strArg);
WebCore::TestObj* convertedObjArg = WebKit::core(objArg);
- gint8 result = item->byteMethodWithArgs(byteArg, convertedStrArg, convertedObjArg);
+ gint8 result = item->byteMethodWithArgs(byteArg, convertedStrArg, *convertedObjArg);
return result;
}
@@ -1259,7 +1259,7 @@
WebCore::TestObj* item = WebKit::core(self);
WTF::String convertedStrArg = WTF::String::fromUTF8(strArg);
WebCore::TestObj* convertedObjArg = WebKit::core(objArg);
- guint8 result = item->octetMethodWithArgs(octetArg, convertedStrArg, convertedObjArg);
+ guint8 result = item->octetMethodWithArgs(octetArg, convertedStrArg, *convertedObjArg);
return result;
}
@@ -1281,7 +1281,7 @@
WebCore::TestObj* item = WebKit::core(self);
WTF::String convertedStrArg = WTF::String::fromUTF8(strArg);
WebCore::TestObj* convertedObjArg = WebKit::core(objArg);
- glong result = item->longMethodWithArgs(longArg, convertedStrArg, convertedObjArg);
+ glong result = item->longMethodWithArgs(longArg, convertedStrArg, *convertedObjArg);
return result;
}
@@ -1303,7 +1303,7 @@
WebCore::TestObj* item = WebKit::core(self);
WTF::String convertedStrArg = WTF::String::fromUTF8(strArg);
WebCore::TestObj* convertedObjArg = WebKit::core(objArg);
- RefPtr<WebCore::TestObj> gobjectResult = WTF::getPtr(item->objMethodWithArgs(longArg, convertedStrArg, convertedObjArg));
+ RefPtr<WebCore::TestObj> gobjectResult = WTF::getPtr(item->objMethodWithArgs(longArg, convertedStrArg, *convertedObjArg));
return WebKit::kit(gobjectResult.get());
}
@@ -1375,7 +1375,7 @@
WTF::String convertedStrArg = WTF::String::fromUTF8(strArg);
WebCore::TestObj* convertedObjArg = WebKit::core(objArg);
WebCore::ExceptionCode ec = 0;
- RefPtr<WebCore::TestObj> gobjectResult = WTF::getPtr(item->methodThatRequiresAllArgsAndThrows(convertedStrArg, convertedObjArg, ec));
+ RefPtr<WebCore::TestObj> gobjectResult = WTF::getPtr(item->methodThatRequiresAllArgsAndThrows(convertedStrArg, *convertedObjArg, ec));
if (ec) {
WebCore::ExceptionCodeDescription ecdesc(ec);
g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
@@ -1646,7 +1646,7 @@
g_return_if_fail(WEBKIT_DOM_IS_TEST_NODE(value));
WebCore::TestObj* item = WebKit::core(self);
WebCore::TestNode* convertedValue = WebKit::core(value);
- item->convert1(convertedValue);
+ item->convert1(*convertedValue);
}
void webkit_dom_test_obj_convert2(WebKitDOMTestObj* self, WebKitDOMTestNode* value)
@@ -1733,7 +1733,7 @@
WebCore::TestObj* convertedObjArg = WebKit::core(objArg);
WebCore::long[]* convertedArray = WebKit::core(array);
WebCore::ExceptionCode ec = 0;
- RefPtr<WebCore::bool> gobjectResult = WTF::getPtr(item->strictFunctionWithArray(convertedObjArg, array, ec));
+ RefPtr<WebCore::bool> gobjectResult = WTF::getPtr(item->strictFunctionWithArray(*convertedObjArg, array, ec));
if (ec) {
WebCore::ExceptionCodeDescription ecdesc(ec);
g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
@@ -1770,7 +1770,7 @@
WebCore::TestObj* item = WebKit::core(self);
WebCore::Node* convertedHead = WebKit::core(head);
WebCore::Node* convertedTail = WebKit::core(tail);
- item->variadicNodeMethod(convertedHead, convertedTail);
+ item->variadicNodeMethod(*convertedHead, convertedTail);
}
void webkit_dom_test_obj_any(WebKitDOMTestObj* self, gfloat a, glong b)
Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (199333 => 199334)
--- trunk/Source/WebCore/editing/FrameSelection.cpp 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp 2016-04-12 04:15:16 UTC (rev 199334)
@@ -34,6 +34,7 @@
#include "EditorClient.h"
#include "Element.h"
#include "ElementIterator.h"
+#include "Event.h"
#include "EventHandler.h"
#include "ExceptionCode.h"
#include "FloatQuad.h"
@@ -46,8 +47,8 @@
#include "HTMLFormElement.h"
#include "HTMLFrameElementBase.h"
#include "HTMLInputElement.h"
+#include "HTMLNames.h"
#include "HTMLSelectElement.h"
-#include "HTMLNames.h"
#include "HitTestRequest.h"
#include "HitTestResult.h"
#include "InlineTextBox.h"
Modified: trunk/Source/WebCore/html/HTMLOptionElement.cpp (199333 => 199334)
--- trunk/Source/WebCore/html/HTMLOptionElement.cpp 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebCore/html/HTMLOptionElement.cpp 2016-04-12 04:15:16 UTC (rev 199334)
@@ -213,7 +213,7 @@
setSelectedState(selected);
if (HTMLSelectElement* select = ownerSelectElement())
- select->optionSelectionStateChanged(this, selected);
+ select->optionSelectionStateChanged(*this, selected);
}
void HTMLOptionElement::setSelectedState(bool selected)
@@ -314,7 +314,7 @@
// FIXME: Might be better to call this unconditionally, always passing m_isSelected,
// rather than only calling it if we are selected.
if (m_isSelected)
- select->optionSelectionStateChanged(this, true);
+ select->optionSelectionStateChanged(*this, true);
select->scrollToSelection();
}
Modified: trunk/Source/WebCore/html/HTMLOptionsCollection.cpp (199333 => 199334)
--- trunk/Source/WebCore/html/HTMLOptionsCollection.cpp 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebCore/html/HTMLOptionsCollection.cpp 2016-04-12 04:15:16 UTC (rev 199334)
@@ -38,7 +38,9 @@
void HTMLOptionsCollection::add(HTMLElement* element, HTMLElement* beforeElement, ExceptionCode& ec)
{
- selectElement().add(element, beforeElement, ec);
+ if (!element)
+ return;
+ selectElement().add(*element, beforeElement, ec);
}
void HTMLOptionsCollection::add(HTMLElement* element, int beforeIndex, ExceptionCode& ec)
@@ -51,7 +53,7 @@
selectElement().removeByIndex(index);
}
-void HTMLOptionsCollection::remove(HTMLOptionElement* option)
+void HTMLOptionsCollection::remove(HTMLOptionElement& option)
{
selectElement().remove(option);
}
Modified: trunk/Source/WebCore/html/HTMLOptionsCollection.h (199333 => 199334)
--- trunk/Source/WebCore/html/HTMLOptionsCollection.h 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebCore/html/HTMLOptionsCollection.h 2016-04-12 04:15:16 UTC (rev 199334)
@@ -25,6 +25,7 @@
#define HTMLOptionsCollection_h
#include "CachedHTMLCollection.h"
+#include "HTMLOptionElement.h"
#include "HTMLSelectElement.h"
namespace WebCore {
@@ -46,7 +47,7 @@
void add(HTMLElement*, HTMLElement* beforeElement, ExceptionCode&);
void add(HTMLElement*, int beforeIndex, ExceptionCode&);
void remove(int index);
- void remove(HTMLOptionElement*);
+ void remove(HTMLOptionElement&);
int selectedIndex() const;
void setSelectedIndex(int);
Modified: trunk/Source/WebCore/html/HTMLSelectElement.cpp (199333 => 199334)
--- trunk/Source/WebCore/html/HTMLSelectElement.cpp 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebCore/html/HTMLSelectElement.cpp 2016-04-12 04:15:16 UTC (rev 199334)
@@ -220,19 +220,14 @@
return lastSelectedListIndex();
}
-void HTMLSelectElement::add(HTMLElement* element, HTMLElement* beforeElement, ExceptionCode& ec)
+void HTMLSelectElement::add(HTMLElement& element, HTMLElement* beforeElement, ExceptionCode& ec)
{
- if (!element || !(is<HTMLOptionElement>(*element) || element->hasTagName(hrTag) || is<HTMLOptGroupElement>(*element)))
+ if (!(is<HTMLOptionElement>(element) || is<HTMLHRElement>(element) || is<HTMLOptGroupElement>(element)))
return;
-
- // Make sure the element is ref'd and deref'd so we don't leak it.
- Ref<HTMLElement> protectNewChild(*element);
-
- insertBefore(*element, beforeElement, ec);
- updateValidity();
+ insertBefore(element, beforeElement, ec);
}
-void HTMLSelectElement::add(HTMLElement* element, int beforeIndex, ExceptionCode& ec)
+void HTMLSelectElement::add(HTMLElement& element, int beforeIndex, ExceptionCode& ec)
{
add(element, item(beforeIndex), ec);
}
@@ -246,12 +241,12 @@
listItems()[listIndex]->remove(IGNORE_EXCEPTION);
}
-void HTMLSelectElement::remove(HTMLOptionElement* option)
+void HTMLSelectElement::remove(HTMLOptionElement& option)
{
- if (option->ownerSelectElement() != this)
+ if (option.ownerSelectElement() != this)
return;
- option->remove(IGNORE_EXCEPTION);
+ option.remove(IGNORE_EXCEPTION);
}
String HTMLSelectElement::value() const
@@ -435,7 +430,7 @@
return options()->item(index);
}
-void HTMLSelectElement::setOption(unsigned index, HTMLOptionElement* option, ExceptionCode& ec)
+void HTMLSelectElement::setOption(unsigned index, HTMLOptionElement& option, ExceptionCode& ec)
{
ec = 0;
if (index > maxSelectItems - 1)
@@ -453,22 +448,21 @@
// Finally add the new element.
if (!ec) {
add(option, before.get(), ec);
- if (diff >= 0 && option->selected())
+ if (diff >= 0 && option.selected())
optionSelectionStateChanged(option, true);
}
}
-void HTMLSelectElement::setLength(unsigned newLen, ExceptionCode& ec)
+void HTMLSelectElement::setLength(unsigned newLength, ExceptionCode& ec)
{
ec = 0;
- if (newLen > maxSelectItems)
- newLen = maxSelectItems;
- int diff = length() - newLen;
+ if (newLength > maxSelectItems)
+ newLength = maxSelectItems;
+ int diff = length() - newLength;
if (diff < 0) { // Add dummy elements.
do {
- RefPtr<Element> option = document().createElement(optionTag, false);
- ASSERT(option);
+ auto option = document().createElement(optionTag, false);
add(downcast<HTMLElement>(option.get()), nullptr, ec);
if (ec)
break;
@@ -481,7 +475,7 @@
Vector<Ref<Element>> itemsToRemove;
size_t optionIndex = 0;
for (auto& item : items) {
- if (is<HTMLOptionElement>(*item) && optionIndex++ >= newLen) {
+ if (is<HTMLOptionElement>(*item) && optionIndex++ >= newLength) {
ASSERT(item->parentNode());
itemsToRemove.append(*item);
}
@@ -500,12 +494,14 @@
return isRequired();
}
-#if PLATFORM(IOS)
bool HTMLSelectElement::willRespondToMouseClickEvents()
{
+#if PLATFORM(IOS)
return !isDisabledFormControl();
-}
+#else
+ return HTMLFormControlElementWithState::willRespondToMouseClickEvents();
#endif
+}
// Returns the 1st valid item |skip| items from |listIndex| in direction |direction| if there is one.
// Otherwise, it returns the valid item closest to that boundary which is past |listIndex| if there is one.
@@ -845,11 +841,11 @@
selectOption(index, DeselectOtherOptions);
}
-void HTMLSelectElement::optionSelectionStateChanged(HTMLOptionElement* option, bool optionIsSelected)
+void HTMLSelectElement::optionSelectionStateChanged(HTMLOptionElement& option, bool optionIsSelected)
{
- ASSERT(option->ownerSelectElement() == this);
+ ASSERT(option.ownerSelectElement() == this);
if (optionIsSelected)
- selectOption(option->index());
+ selectOption(option.index());
else if (!usesMenuList())
selectOption(-1);
else
Modified: trunk/Source/WebCore/html/HTMLSelectElement.h (199333 => 199334)
--- trunk/Source/WebCore/html/HTMLSelectElement.h 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebCore/html/HTMLSelectElement.h 2016-04-12 04:15:16 UTC (rev 199334)
@@ -26,17 +26,14 @@
#ifndef HTMLSelectElement_h
#define HTMLSelectElement_h
-#include "Event.h"
#include "HTMLFormControlElementWithState.h"
-#include "HTMLOptionElement.h"
#include "TypeAhead.h"
-#include <wtf/Vector.h>
namespace WebCore {
class HTMLOptionsCollection;
-class HTMLSelectElement : public HTMLFormControlElementWithState, public TypeAheadDataSource {
+class HTMLSelectElement : public HTMLFormControlElementWithState, private TypeAheadDataSource {
public:
static Ref<HTMLSelectElement> create(const QualifiedName&, Document&, HTMLFormElement*);
@@ -45,9 +42,8 @@
WEBCORE_EXPORT void optionSelectedByUser(int index, bool dispatchChangeEvent, bool allowMultipleSelection = false);
- // For ValidityState
- String validationMessage() const override;
- bool valueMissing() const override;
+ String validationMessage() const final;
+ bool valueMissing() const final;
unsigned length() const;
@@ -56,13 +52,12 @@
bool usesMenuList() const;
- void add(HTMLElement*, HTMLElement* beforeElement, ExceptionCode&);
- void add(HTMLElement*, int beforeIndex, ExceptionCode&);
+ void add(HTMLElement&, HTMLElement* beforeElement, ExceptionCode&);
+ void add(HTMLElement&, int beforeIndex, ExceptionCode&);
using Node::remove;
- // Should be remove(int) but it conflicts with Node::remove(ExceptionCode&).
- void removeByIndex(int);
- void remove(HTMLOptionElement*);
+ void remove(HTMLOptionElement&);
+ void removeByIndex(int); // Should be remove(int) but that conflicts with Node::remove(ExceptionCode&).
WEBCORE_EXPORT String value() const;
void setValue(const String&);
@@ -78,14 +73,14 @@
WEBCORE_EXPORT const Vector<HTMLElement*>& listItems() const;
- void accessKeyAction(bool sendMouseEvents) override;
+ void accessKeyAction(bool sendMouseEvents) final;
void accessKeySetSelectedIndex(int);
void setMultiple(bool);
void setSize(unsigned);
- void setOption(unsigned index, HTMLOptionElement*, ExceptionCode&);
+ void setOption(unsigned index, HTMLOptionElement&, ExceptionCode&);
void setLength(unsigned, ExceptionCode&);
HTMLOptionElement* namedItem(const AtomicString& name);
@@ -95,10 +90,6 @@
void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true);
-#if PLATFORM(IOS)
- bool willRespondToMouseClickEvents() override;
-#endif
-
bool canSelectAll() const;
void selectAll();
int listToOptionIndex(int listIndex) const;
@@ -109,43 +100,44 @@
void setActiveSelectionAnchorIndex(int);
void setActiveSelectionEndIndex(int);
void updateListBoxSelection(bool deselectOtherOptions);
-
+
// For use in the implementation of HTMLOptionElement.
- void optionSelectionStateChanged(HTMLOptionElement*, bool optionIsSelected);
+ void optionSelectionStateChanged(HTMLOptionElement&, bool optionIsSelected);
bool allowsNonContiguousSelection() const { return m_allowsNonContiguousSelection; };
protected:
HTMLSelectElement(const QualifiedName&, Document&, HTMLFormElement*);
private:
- const AtomicString& formControlType() const override;
+ const AtomicString& formControlType() const final;
- bool isKeyboardFocusable(KeyboardEvent*) const override;
- bool isMouseFocusable() const override;
+ bool isKeyboardFocusable(KeyboardEvent*) const final;
+ bool isMouseFocusable() const final;
void dispatchFocusEvent(RefPtr<Element>&& oldFocusedElement, FocusDirection) final;
void dispatchBlurEvent(RefPtr<Element>&& newFocusedElement) final;
- bool canStartSelection() const override { return false; }
+ bool canStartSelection() const final { return false; }
bool canHaveUserAgentShadowRoot() const final { return true; }
- bool isEnumeratable() const override { return true; }
- bool supportLabels() const override { return true; }
+ bool isEnumeratable() const final { return true; }
+ bool supportLabels() const final { return true; }
- FormControlState saveFormControlState() const override;
- void restoreFormControlState(const FormControlState&) override;
+ FormControlState saveFormControlState() const final;
+ void restoreFormControlState(const FormControlState&) final;
- void parseAttribute(const QualifiedName&, const AtomicString&) override;
- bool isPresentationAttribute(const QualifiedName&) const override;
+ void parseAttribute(const QualifiedName&, const AtomicString&) final;
+ bool isPresentationAttribute(const QualifiedName&) const final;
- bool childShouldCreateRenderer(const Node&) const override;
- RenderPtr<RenderElement> createElementRenderer(Ref<RenderStyle>&&, const RenderTreePosition&) override;
- bool appendFormData(FormDataList&, bool) override;
+ bool childShouldCreateRenderer(const Node&) const final;
+ RenderPtr<RenderElement> createElementRenderer(Ref<RenderStyle>&&, const RenderTreePosition&) final;
+ bool appendFormData(FormDataList&, bool) final;
- void reset() override;
+ void reset() final;
- void defaultEventHandler(Event*) override;
+ void defaultEventHandler(Event*) final;
+ bool willRespondToMouseClickEvents() final;
void dispatchChangeEventForMenuList();
@@ -153,14 +145,14 @@
void recalcListItems(bool updateSelectedStates = true) const;
- void deselectItems(HTMLOptionElement* excludeElement = 0);
+ void deselectItems(HTMLOptionElement* excludeElement = nullptr);
void typeAheadFind(KeyboardEvent&);
void saveLastSelection();
- InsertionNotificationRequest insertedInto(ContainerNode&) override;
+ InsertionNotificationRequest insertedInto(ContainerNode&) final;
- bool isOptionalFormControl() const override { return !isRequiredFormControl(); }
- bool isRequiredFormControl() const override;
+ bool isOptionalFormControl() const final { return !isRequiredFormControl(); }
+ bool isRequiredFormControl() const final;
bool hasPlaceholderLabelOption() const;
@@ -171,7 +163,7 @@
};
typedef unsigned SelectOptionFlags;
void selectOption(int optionIndex, SelectOptionFlags = 0);
- void deselectItemsWithoutValidation(HTMLElement* elementToExclude = 0);
+ void deselectItemsWithoutValidation(HTMLElement* elementToExclude = nullptr);
void parseMultipleAttribute(const AtomicString&);
int lastSelectedListIndex() const;
void updateSelectedState(int listIndex, bool multi, bool shift);
@@ -181,10 +173,7 @@
void setOptionsChangedOnRenderer();
size_t searchOptionsForValue(const String&, size_t listIndexStart, size_t listIndexEnd) const;
- enum SkipDirection {
- SkipBackwards = -1,
- SkipForwards = 1
- };
+ enum SkipDirection { SkipBackwards = -1, SkipForwards = 1 };
int nextValidIndex(int listIndex, SkipDirection, int skip) const;
int nextSelectableListIndex(int startIndex) const;
int previousSelectableListIndex(int startIndex) const;
@@ -192,13 +181,14 @@
int lastSelectableListIndex() const;
int nextSelectableListIndexPageAway(int startIndex, SkipDirection) const;
- void childrenChanged(const ChildChange&) override;
+ void childrenChanged(const ChildChange&) final;
// TypeAheadDataSource functions.
- int indexOfSelectedOption() const override;
- int optionCount() const override;
- String optionAtIndex(int index) const override;
+ int indexOfSelectedOption() const final;
+ int optionCount() const final;
+ String optionAtIndex(int index) const final;
+
// m_listItems contains HTMLOptionElement, HTMLOptGroupElement, and HTMLHRElement objects.
mutable Vector<HTMLElement*> m_listItems;
Vector<bool> m_lastOnChangeSelection;
Modified: trunk/Source/WebCore/html/HTMLSelectElement.idl (199333 => 199334)
--- trunk/Source/WebCore/html/HTMLSelectElement.idl 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebCore/html/HTMLSelectElement.idl 2016-04-12 04:15:16 UTC (rev 199334)
@@ -20,11 +20,10 @@
[
CustomIndexedSetter,
- UsePointersEvenForNonNullableObjectArguments,
] interface HTMLSelectElement : HTMLElement {
[Reflect] attribute boolean autofocus;
[Reflect] attribute boolean disabled;
- readonly attribute HTMLFormElement form;
+ readonly attribute HTMLFormElement? form;
attribute boolean multiple;
[Reflect] attribute DOMString name;
[Reflect] attribute boolean required;
@@ -39,8 +38,6 @@
readonly attribute HTMLOptionsCollection options;
#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
- // DOM Level 2 changes type of length attribute to unsigned long,
- // for compatibility we keep DOM Level 1 definition.
readonly attribute long length;
#else
[SetterRaisesException] attribute unsigned long length;
@@ -50,8 +47,8 @@
getter Node item(unsigned long index);
Node namedItem([Default=Undefined] optional DOMString name);
#else
- getter HTMLOptionElement item(unsigned long index);
- HTMLOptionElement namedItem([Default=Undefined] optional DOMString name);
+ getter HTMLOptionElement? item(unsigned long index);
+ HTMLOptionElement? namedItem([Default=Undefined] optional DOMString name);
#endif
[ObjCLegacyUnnamedParameters, RaisesException] void add(HTMLElement element, [Default=Undefined] optional HTMLElement? before);
@@ -63,17 +60,17 @@
#else
[ImplementedAs=removeByIndex] void remove(long index);
#endif
+
readonly attribute HTMLCollection selectedOptions;
attribute long selectedIndex;
- // FIXME: This should not use [TreatNullAs=LegacyNullString].
- [TreatNullAs=LegacyNullString] attribute DOMString value;
+ [TreatNullAs=LegacyNullString] attribute DOMString value; // FIXME: This should not use [TreatNullAs=LegacyNullString].
readonly attribute boolean willValidate;
readonly attribute ValidityState validity;
readonly attribute DOMString validationMessage;
boolean checkValidity();
- void setCustomValidity(DOMString? error);
+ void setCustomValidity(DOMString? error); // FIXME: Argument should not be nullable.
readonly attribute NodeList labels;
Modified: trunk/Source/WebKit/win/ChangeLog (199333 => 199334)
--- trunk/Source/WebKit/win/ChangeLog 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebKit/win/ChangeLog 2016-04-12 04:15:16 UTC (rev 199334)
@@ -1,3 +1,12 @@
+2016-04-11 Darin Adler <[email protected]>
+
+ Remove UsePointersEvenForNonNullableObjectArguments from HTMLSelectElement
+ https://bugs.webkit.org/show_bug.cgi?id=156458
+
+ Reviewed by Chris Dumez.
+
+ * DOMCoreClasses.cpp: Added now-needed include.
+
2016-04-11 Gavin Barraclough <[email protected]>
WebKit should adopt journal_mode=wal for all SQLite databases.
Modified: trunk/Source/WebKit/win/DOMCoreClasses.cpp (199333 => 199334)
--- trunk/Source/WebKit/win/DOMCoreClasses.cpp 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebKit/win/DOMCoreClasses.cpp 2016-04-12 04:15:16 UTC (rev 199334)
@@ -37,6 +37,7 @@
#include <WebCore/Document.h>
#include <WebCore/DragImage.h>
#include <WebCore/Element.h>
+#include <WebCore/Event.h>
#include <WebCore/Font.h>
#include <WebCore/FontCascade.h>
#include <WebCore/Frame.h>
Modified: trunk/Source/WebKit2/ChangeLog (199333 => 199334)
--- trunk/Source/WebKit2/ChangeLog 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebKit2/ChangeLog 2016-04-12 04:15:16 UTC (rev 199334)
@@ -1,3 +1,12 @@
+2016-04-11 Darin Adler <[email protected]>
+
+ Remove UsePointersEvenForNonNullableObjectArguments from HTMLSelectElement
+ https://bugs.webkit.org/show_bug.cgi?id=156458
+
+ Reviewed by Chris Dumez.
+
+ * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: Updated includes.
+
2016-04-11 Jeremy Jones <[email protected]>
When clearing cache, also clear AVFoundation cache.
Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm (199333 => 199334)
--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm 2016-04-12 03:42:29 UTC (rev 199333)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm 2016-04-12 04:15:16 UTC (rev 199334)
@@ -37,7 +37,7 @@
#import <WebCore/CSSPrimitiveValue.h>
#import <WebCore/CSSPropertyNames.h>
#import <WebCore/ColorMac.h>
-#import <WebCore/HTMLElement.h>
+#import <WebCore/Event.h>
#import <WebCore/HTMLInputElement.h>
#import <WebCore/HTMLNames.h>
#import <WebCore/HTMLOptionElement.h>