Revision: 3760
Author: [email protected]
Date: Sat Sep 26 18:53:57 2009
Log: bug 580: get(Next|Previous)Sibling is a cuckoo
http://codereview.appspot.com/124046

Hardened to make sure that:
  To fix, we either need to disable them or present proof
  that we know the parent.
holds.

[email protected]

http://code.google.com/p/google-caja/source/detail?r=3760

Modified:
 /trunk/src/com/google/caja/plugin/Config.java
 /trunk/src/com/google/caja/plugin/PluginCompilerMain.java
 /trunk/src/com/google/caja/plugin/domita.js

=======================================
--- /trunk/src/com/google/caja/plugin/Config.java       Wed Sep 23 19:16:39 2009
+++ /trunk/src/com/google/caja/plugin/Config.java       Sat Sep 26 18:53:57 2009
@@ -102,6 +102,12 @@
   private final Option VIEW = defineOption(
       "v", "view", "Gadget view to render (default is 'canvas')", true);

+  private final Option ID_CLASS = defineOption(
+      "c",
+      "id_class",
+      "The module ID if it is statically known",
+      true);
+
   private final Option DEBUG_MODE = defineBooleanOption(
       "g", "debug", "Set to add debugging info to cajoled output.");

@@ -134,6 +140,7 @@
   private boolean debugMode;
   private SourceRenderMode renderer;
   private int servicePort;
+  private String idClass;

   public Config(Class<?> mainClass, PrintStream stderr, String usageText) {
     this(mainClass, new PrintWriter(stderr), usageText);
@@ -176,6 +183,8 @@
   }

   public String getGadgetView() { return gadgetView; }
+
+  public String getIdClass() { return idClass; }

   public boolean debugMode() { return debugMode; }

@@ -285,6 +294,7 @@
       }

       gadgetView = cl.getOptionValue(VIEW.getOpt(), "canvas");
+      idClass = cl.getOptionValue(ID_CLASS.getOpt(), null);
       debugMode = cl.hasOption(DEBUG_MODE.getOpt());

       String servicePortString;
=======================================
--- /trunk/src/com/google/caja/plugin/PluginCompilerMain.java Wed Sep 23 19:16:39 2009 +++ /trunk/src/com/google/caja/plugin/PluginCompilerMain.java Sat Sep 26 18:53:57 2009
@@ -112,8 +112,9 @@
       PluginMeta meta = new PluginMeta(makeEnvironment(config));
       meta.setDebugMode(config.debugMode());
       meta.setValijaMode(true);
-      PluginCompiler compiler =
-          new PluginCompiler(BuildInfo.getInstance(), meta, mq);
+      meta.setIdClass(config.getIdClass());
+      PluginCompiler compiler = new PluginCompiler(
+          BuildInfo.getInstance(), meta, mq);
       mc = compiler.getMessageContext();
       compiler.setCssSchema(config.getCssSchema(mq));
       compiler.setHtmlSchema(config.getHtmlSchema(mq));
=======================================
--- /trunk/src/com/google/caja/plugin/domita.js Fri Sep 25 16:35:08 2009
+++ /trunk/src/com/google/caja/plugin/domita.js Sat Sep 26 18:53:57 2009
@@ -1511,12 +1511,12 @@
return defaultTameNode(this.node___.lastChild, this.childrenEditable___);
     };
     TameBackedNode.prototype.getNextSibling = function () {
- // TODO(mikesamuel): replace with cursors so that subtrees are delegable
-      return defaultTameNode(this.node___.nextSibling, this.editable___);
+      return tameRelatedNode(this.node___.nextSibling, this.editable___,
+                             defaultTameNode);
     };
     TameBackedNode.prototype.getPreviousSibling = function () {
- // TODO(mikesamuel): replace with cursors so that subtrees are delegable - return defaultTameNode(this.node___.previousSibling, this.editable___); + return tameRelatedNode(this.node___.previousSibling, this.editable___,
+                             defaultTameNode);
     };
     TameBackedNode.prototype.getParentNode = function () {
       return tameRelatedNode(

Reply via email to