Last Comment Bug 301998 - Inner repeats should initialize to startindex on update
: Inner repeats should initialize to startindex on update
Status: RESOLVED FIXED
: fixed1.8
Product: Core Graveyard
Classification: Graveyard
Component: XForms (show other bugs)
: Trunk
: All All
: -- normal (vote)
: ---
Assigned To: Allan Beaufour
: Stephen Pride
:
Mentors:
http://www.w3.org/TR/xforms/
Depends on: 302918
Blocks: 264329
  Show dependency treegraph
 
Reported: 2005-07-25 01:43 PDT by Allan Beaufour
Modified: 2016-07-15 14:46 PDT (History)
3 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Patch (6.60 KB, patch)
2005-09-26 05:55 PDT, Allan Beaufour
bugs: review+
aaronr: review+
Details | Diff | Splinter Review
Testcase (1.47 KB, application/xhtml+xml)
2005-09-26 06:01 PDT, Allan Beaufour
no flags Details

Description Allan Beaufour 2005-07-25 01:43:25 PDT
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).
Comment 1 Allan Beaufour 2005-09-26 05:55:05 PDT
Created attachment 197407 [details] [diff] [review]
Patch

Created a getStartingIndex() on nsXFormsRepeatElement, used to set the index to
"startindex" or 1 if it's not present.
Comment 2 Allan Beaufour 2005-09-26 05:56:43 PDT
btw, attachment 197407 [details] [diff] [review] depends on bug 302918
Comment 3 Allan Beaufour 2005-09-26 06:01:05 PDT
Created attachment 197408 [details]
Testcase
Comment 4 aaronr 2005-09-26 16:31:05 PDT
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
Comment 5 Allan Beaufour 2005-09-27 04:54:00 PDT
Checked in to trunk with smaug's comments
Comment 6 Allan Beaufour 2005-09-27 06:17:45 PDT
(In reply to comment #5)
> Checked in to trunk with smaug's comments

Aaron's comments from comment 4, that is...
Comment 7 aaronr 2005-10-06 17:17:03 PDT
checked into branch 20051004

Note You need to log in before you can comment on or make changes to this bug.