I decided to improve the output of my function further.
The output I'm aiming for is like this:

{
  "documentHeight": 539,
  "documentWidth": 1436,
  "levels": [
    [
      {
        "nodeIndex": 0,
        "x": 0,
        "y": 0,
        "w": 100,
        "h": 200
      },
      {
        "nodeIndex": 1,
        "x": 0,
        "y": 0,
        "w": 300,
        "h": 400
      }
    ],
    [
      {
        "nodeIndex": 2,
        "x": 0,
        "y": 0,
        "w": 100,
        "h": 200
      },
      {
        "nodeIndex": 3,
        "x": 0,
        "y": 0,
        "w": 300,
        "h": 400
      }
    ]
  ],
  "nodes": [
    "node1",
    "node2",
    "node3",
    "node4"
  ]
}

After your previous comments I thought it would be straightforward, but I've 
been trying all day without success.
Somehow I have declared the dictionaries as protected?

This is what I have with the errors raised:

// in Document.webidl
dictionary myFunctionElementInfo {
  required unsigned long nodeIndex;
  required long x;
  required long y;
  required unsigned long w;
  required unsigned long h;
};

dictionary myFunctionResultContainer {
  required sequence<Node> nodes;
  required sequence<sequence<myFunctionElementInfo>> levels;
  required unsigned long documentWidth;
  required unsigned long documentHeight;
};

// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-document-interface
partial interface Document {
    myFunctionResultContainer myFunction ();
};


 0:15.57 /source/release/dom/base/nsDocument.cpp:3585:24: error: 
'AppendElement' is a protected member of 
'nsTArray_Impl<mozilla::OwningNonNull<nsINode>, nsTArrayFallibleAllocator>'
 0:15.57         aResult.mNodes.AppendElement(node);
 0:15.57         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
 0:15.57 /build/dist/include/nsTArray.h:1589:14: note: declared protected here
 0:15.57   elem_type* AppendElement(Item&& aItem)
 0:15.57              ^
 0:15.57 In file included from /build/dom/base/Unified_cpp_dom_base5.cpp:92:
 0:15.57 /source/release/dom/base/nsDocument.cpp:3586:25: error: 
'EnsureLengthAtLeast' is a protected member of 
'nsTArray_Impl<mozilla::dom::Sequence<mozilla::dom::myFunctionElementInfo>, 
nsTArrayFallibleAllocator>'
 0:15.57         aResult.mLevels.EnsureLengthAtLeast(level+1);
 0:15.57         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
 0:15.57 /build/dist/include/nsTArray.h:1809:36: note: declared protected here
 0:15.57   typename ActualAlloc::ResultType EnsureLengthAtLeast(size_type 
aMinLen)
 0:15.57                                    ^
 0:15.57 In file included from /build/dom/base/Unified_cpp_dom_base5.cpp:92:
 0:15.57 /source/release/dom/base/nsDocument.cpp:3587:84: error: 
'AppendElement' is a protected member of 
'nsTArray_Impl<mozilla::dom::myFunctionElementInfo, nsTArrayFallibleAllocator>'
 0:15.57         mozilla::dom::myFunctionElementInfo* e = 
aResult.mLevels.ElementAt(level).AppendElement();
 0:15.57                                                   
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
 0:15.57 /build/dist/include/nsTArray.h:1642:14: note: declared protected here
 0:15.57   elem_type* AppendElement()
 0:15.57              ^
 0:16.49 /build/dist/include/nsTArray.h:527:34: error: no matching constructor 
for initialization of 'mozilla::OwningNonNull<nsINode>'
 0:16.50     new (static_cast<void*>(aE)) E(mozilla::Forward<A>(aArg));
 0:16.50                                  ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
 0:16.50 /build/dist/include/nsTArray.h:1596:18: note: in instantiation of 
function template specialization 
'nsTArrayElementTraits<mozilla::OwningNonNull<nsINode> >::Construct<nsIContent 
*&>' requested here
 0:16.50     elem_traits::Construct(elem, mozilla::Forward<Item>(aItem));
 0:16.50                  ^
 0:16.50 /source/release/dom/base/nsDocument.cpp:3585:24: note: in 
instantiation of function template specialization 
'nsTArray_Impl<mozilla::OwningNonNull<nsINode>, 
nsTArrayFallibleAllocator>::AppendElement<nsIContent *&, 
nsTArrayFallibleAllocator>' requested here
 0:16.50         aResult.mNodes.AppendElement(node);
 0:16.50                        ^
 0:16.50 /build/dist/include/mozilla/OwningNonNull.h:23:16: note: candidate 
constructor not viable: no known conversion from 'nsIContent *' to 'nsINode &' 
for 1st argument; dereference the argument with *
 0:16.50   MOZ_IMPLICIT OwningNonNull(T& aValue)
 0:16.50                ^
 0:16.50 /build/dist/include/mozilla/OwningNonNull.h:18:7: note: candidate 
constructor (the implicit move constructor) not viable: no known conversion 
from 'nsIContent *' to 'mozilla::OwningNonNull<nsINode>' for 1st argument
 0:16.50 class OwningNonNull
 0:16.50       ^
 0:16.50 /build/dist/include/mozilla/OwningNonNull.h:18:7: note: candidate 
constructor (the implicit copy constructor) not viable: no known conversion 
from 'nsIContent *' to 'const mozilla::OwningNonNull<nsINode>' for 1st argument
 0:16.50 class OwningNonNull
 0:16.50       ^
 0:16.50 /build/dist/include/mozilla/OwningNonNull.h:29:16: note: candidate 
template ignored: could not match 'already_AddRefed<type-parameter-0-0>' 
against 'nsIContent *'
 0:16.50   MOZ_IMPLICIT OwningNonNull(already_AddRefed<U>&& aValue)
 0:16.50                ^
 0:16.50 /build/dist/include/mozilla/OwningNonNull.h:21:3: note: candidate 
constructor not viable: requires 0 arguments, but 1 was provided
 0:16.50   OwningNonNull() {}
 0:16.50   ^
 0:16.62 4 errors generated.
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout

Reply via email to