Title: [227538] branches/safari-605-branch/Source/WebKitLegacy/win
Revision
227538
Author
jmarc...@apple.com
Date
2018-01-24 12:15:43 -0800 (Wed, 24 Jan 2018)

Log Message

Cherry-pick r227480. rdar://problem/36830349

Modified Paths

Diff

Modified: branches/safari-605-branch/Source/WebKitLegacy/win/ChangeLog (227537 => 227538)


--- branches/safari-605-branch/Source/WebKitLegacy/win/ChangeLog	2018-01-24 20:15:40 UTC (rev 227537)
+++ branches/safari-605-branch/Source/WebKitLegacy/win/ChangeLog	2018-01-24 20:15:43 UTC (rev 227538)
@@ -1,3 +1,17 @@
+2018-01-24  Jason Marcell  <jmarc...@apple.com>
+
+        Cherry-pick r227480. rdar://problem/36830349
+
+    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-22  Jason Marcell  <jmarc...@apple.com>
 
         Cherry-pick r227209. rdar://problem/36722622

Modified: branches/safari-605-branch/Source/WebKitLegacy/win/WebFrame.cpp (227537 => 227538)


--- branches/safari-605-branch/Source/WebKitLegacy/win/WebFrame.cpp	2018-01-24 20:15:40 UTC (rev 227537)
+++ branches/safari-605-branch/Source/WebKitLegacy/win/WebFrame.cpp	2018-01-24 20:15:43 UTC (rev 227538)
@@ -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