Commit a commented-out algorithm
authorAryeh Gregor <AryehGregor+gitcommit@gmail.com>
Sun, 29 May 2011 15:19:36 -0600
changeset 186 da049543cff1
parent 185 a2c816de561d
child 187 06eb622b8eb3
Commit a commented-out algorithm

I honestly can't remember what prompted me to write this. Maybe I'll
remember at some point, though.
editcommands.html
source.html
--- a/editcommands.html	Sun May 29 14:44:34 2011 -0600
+++ b/editcommands.html	Sun May 29 15:19:36 2011 -0600
@@ -430,6 +430,57 @@
   <li>Return true.
 </ol>
 
+<!-- I don't remember why I wrote this.  Keeping it around just in case it
+turns out to be useful.
+
+<p><var title>node</var> is an <dfn>extraneous line break</dfn> if the following
+algorithm returns true:
+
+<p class=XXX>This is positively horrible.  It attempts to move complicated CSS
+logic into DOM methods, and does so badly.  Can we somehow make this less evil,
+preferably much less evil?
+
+<ol>
+  <li>If <var title>node</var> is not a <code data-anolis-spec=html title="the br element">br</code>, return false.
+
+  <li>Let <var title>ancestor block</var> be <var title>node</var>.
+
+  <li>While <var title>ancestor block</var> is an <span>inline node</span>, set
+  <var title>ancestor block</var> to its <span data-anolis-spec=domcore title=concept-tree-parent>parent</span>.
+
+  <li>Let <var title>previous box</var> be <var title>node</var>.
+
+  <li>While <var title>previous box</var> is equal to or an <span data-anolis-spec=domcore title=concept-tree-ancestor>ancestor</span> of
+  <var title>node</var>, set <var title>previous box</var> to the <span data-anolis-spec=domcore title=concept-node>node</span> immediately
+  before it in <span data-anolis-spec=domcore>tree order</span>, or null if there is no such <span data-anolis-spec=domcore title=concept-node>node</span>.
+
+  <li>Let <var title>next box</var> be the <span data-anolis-spec=domcore title=concept-node>node</span> immediately after <var title>node</var>
+  in <span data-anolis-spec=domcore>tree order</span>, or null if there is such <span data-anolis-spec=domcore title=concept-node>node</span>.
+
+  <li>If <var title>previous box</var> is null, or is not a <span data-anolis-spec=domcore title=concept-tree-descendant>descendant</span> of
+  <var title>ancestor block</var>, or is not an <span>inline node</span>, or is a
+  <code data-anolis-spec=html title="the br element">br</code>, return false.
+  <!- -
+  This means br either is the first thing in its block container that generates
+  an inline box, or it's the first thing after another block container, or the
+  first thing after a br.  In any case, the line break will be visible.
+
+  Otherwise, it will be invisible as long as it immediately precedes a block
+  box boundary.
+  - ->
+
+  <li>If <var title>ancestor block</var> is not null and <var title>node</var> is the last
+  <span data-anolis-spec=domcore title=concept-tree-descendant>descendant</span> of <var title>ancestor block</var>, return true.
+  <!- - Precedes the end of ancestor block's box. - ->
+
+  <li>If <var title>next box</var> is not null and not an <span>inline node</span>,
+  return true.
+  <!- - Precedes the start of next box's box. - ->
+
+  <li>Return false.
+</ol>
+-->
+
 <p>The <dfn id=css-styling-flag>CSS styling flag</dfn> is a boolean flag, which must initially be
 false.
 
--- a/source.html	Sun May 29 14:44:34 2011 -0600
+++ b/source.html	Sun May 29 15:19:36 2011 -0600
@@ -383,6 +383,57 @@
   <li>Return true.
 </ol>
 
+<!-- I don't remember why I wrote this.  Keeping it around just in case it
+turns out to be useful.
+
+<p><var>node</var> is an <dfn>extraneous line break</dfn> if the following
+algorithm returns true:
+
+<p class=XXX>This is positively horrible.  It attempts to move complicated CSS
+logic into DOM methods, and does so badly.  Can we somehow make this less evil,
+preferably much less evil?
+
+<ol>
+  <li>If <var>node</var> is not a [[br]], return false.
+
+  <li>Let <var>ancestor block</var> be <var>node</var>.
+
+  <li>While <var>ancestor block</var> is an <span>inline node</span>, set
+  <var>ancestor block</var> to its [[parent]].
+
+  <li>Let <var>previous box</var> be <var>node</var>.
+
+  <li>While <var>previous box</var> is equal to or an [[ancestor]] of
+  <var>node</var>, set <var>previous box</var> to the [[node]] immediately
+  before it in [[treeorder]], or null if there is no such [[node]].
+
+  <li>Let <var>next box</var> be the [[node]] immediately after <var>node</var>
+  in [[treeorder]], or null if there is such [[node]].
+
+  <li>If <var>previous box</var> is null, or is not a [[descendant]] of
+  <var>ancestor block</var>, or is not an <span>inline node</span>, or is a
+  [[br]], return false.
+  <!- -
+  This means br either is the first thing in its block container that generates
+  an inline box, or it's the first thing after another block container, or the
+  first thing after a br.  In any case, the line break will be visible.
+
+  Otherwise, it will be invisible as long as it immediately precedes a block
+  box boundary.
+  - ->
+
+  <li>If <var>ancestor block</var> is not null and <var>node</var> is the last
+  [[descendant]] of <var>ancestor block</var>, return true.
+  <!- - Precedes the end of ancestor block's box. - ->
+
+  <li>If <var>next box</var> is not null and not an <span>inline node</span>,
+  return true.
+  <!- - Precedes the start of next box's box. - ->
+
+  <li>Return false.
+</ol>
+-->
+
 <p>The <dfn>CSS styling flag</dfn> is a boolean flag, which must initially be
 false.