Closed Bug 301998 Opened 18 years ago Closed 18 years ago

Inner repeats should initialize to startindex on update

Categories

(Core Graveyard :: XForms, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: allan, Assigned: allan)

References

()

Details

(Keywords: fixed1.8)

Attachments

(2 files)

If setindex, insert, or delete modify the index of a repeat parent the inner
repeats should per the errata re-initialize to their startindex attribute (and
not 1 as it is now).
Blocks: 264329
Status: NEW → ASSIGNED
Attached patch PatchSplinter Review
Created a getStartingIndex() on nsXFormsRepeatElement, used to set the index to
"startindex" or 1 if it's not present.
Attachment #197407 - Flags: review?(smaug)
btw, attachment 197407 [details] [diff] [review] depends on bug 302918
Depends on: 302918
Attached file Testcase
Attachment #197407 - Flags: review?(smaug)
Attachment #197407 - Flags: review?(aaronr)
Attachment #197407 - Flags: review+
Comment on attachment 197407 [details] [diff] [review]
Patch


>--- xforms/nsXFormsRepeatElement.cpp	2005-09-26 14:46:07.000000000 +0200
>+++ xforms.repeatfix/nsXFormsRepeatElement.cpp	2005-09-26 14:51:43.000000000 +0200

> NS_IMETHODIMP
>+nsXFormsRepeatElement::GetStartingIndex(PRUint32 *aRes)
>+{
>+  nsresult rv = GetIntAttr(NS_LITERAL_STRING("startindex"),
>+                           (PRInt32*) aRes,
>+                           nsISchemaBuiltinType::BUILTIN_TYPE_POSITIVEINTEGER);
>+  if (NS_FAILED(rv)) {
>+    *aRes = 1;
>+  }
>+  if (*aRes < 1) {
>+    *aRes = 1;
>+  } else if (*aRes > mMaxIndex) {
>+    *aRes = mMaxIndex;
>+  }
>+  return NS_OK;
>+}
>+
>+

You should probably have a NS_ENSURE_ARG(aRes) at the beginning of this
function.  Might want to add one to ::GetIsParent while you are at it.


With that, r=me
Attachment #197407 - Flags: review?(aaronr) → review+
Checked in to trunk with smaug's comments
Whiteboard: xf-to-branch
(In reply to comment #5)
> Checked in to trunk with smaug's comments

Aaron's comments from comment 4, that is...
checked into branch 20051004
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Whiteboard: xf-to-branch
Keywords: fixed1.8
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.