Title: [227480] trunk/Source/WebKitLegacy/win
Revision
227480
Author
wenson_hs...@apple.com
Date
2018-01-24 01:01:00 -0800 (Wed, 24 Jan 2018)

Log Message

Unreviewed, try to fix the Windows build after r227479.

Tweak some Windows WebKitLegacy code to use updated HTMLFormElement methods.

* WebFrame.cpp:
(WebFrame::elementWithName):
(WebFrame::controlsInForm):

Modified Paths

Diff

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (227479 => 227480)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2018-01-24 08:19:16 UTC (rev 227479)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2018-01-24 09:01:00 UTC (rev 227480)
@@ -1,3 +1,13 @@
+2018-01-24  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Unreviewed, try to fix the Windows build after r227479.
+
+        Tweak some Windows WebKitLegacy code to use updated HTMLFormElement methods.
+
+        * WebFrame.cpp:
+        (WebFrame::elementWithName):
+        (WebFrame::controlsInForm):
+
 2018-01-19  Per Arne Vollan  <pvol...@apple.com>
 
         [Win] Compile error: 'WebKitQuartzCoreAdditionsBase.h' not found.

Modified: trunk/Source/WebKitLegacy/win/WebFrame.cpp (227479 => 227480)


--- trunk/Source/WebKitLegacy/win/WebFrame.cpp	2018-01-24 08:19:16 UTC (rev 227479)
+++ trunk/Source/WebKitLegacy/win/WebFrame.cpp	2018-01-24 09:01:00 UTC (rev 227480)
@@ -1088,13 +1088,12 @@
 
     HTMLFormElement* formElement = formElementFromDOMElement(form);
     if (formElement) {
-        const Vector<FormAssociatedElement*>& elements = formElement->associatedElements();
         AtomicString targetName((UChar*)name, SysStringLen(name));
-        for (unsigned int i = 0; i < elements.size(); i++) {
-            if (!is<HTMLFormControlElement>(*elements[i]))
+        for (auto& element : formElement->copyAssociatedElementsVector()) {
+            if (!is<HTMLFormControlElement>(element.get()))
                 continue;
-            HTMLFormControlElement& elt = downcast<HTMLFormControlElement>(*elements[i]);
-            // Skip option elements, other duds
+            auto& elt = downcast<HTMLFormControlElement>(element.get());
+            // Skip option elements, other duds.
             if (elt.name() == targetName) {
                 *element = DOMElement::createInstance(&elt);
                 return S_OK;
@@ -1267,8 +1266,9 @@
     if (!formElement)
         return E_FAIL;
 
+    auto elements = formElement->copyAssociatedElementsVector();
     int inCount = *cControls;
-    int count = (int) formElement->associatedElements().size();
+    int count = (int) elements.size();
     *cControls = count;
     if (!controls)
         return S_OK;
@@ -1276,10 +1276,10 @@
         return E_FAIL;
 
     *cControls = 0;
-    const Vector<FormAssociatedElement*>& elements = formElement->associatedElements();
-    for (int i = 0; i < count; i++) {
-        if (elements.at(i)->isEnumeratable()) { // Skip option elements, other duds
-            controls[*cControls] = DOMElement::createInstance(&elements.at(i)->asHTMLElement());
+    for (auto& element : elements) {
+        if (element->isEnumeratable()) {
+            // Skip option elements, other duds.
+            controls[*cControls] = DOMElement::createInstance(&element->asHTMLElement());
             (*cControls)++;
         }
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to