Lines Matching refs:getCommonAncestor

69 10!=f.nodeType&&new CKEDITOR.dom.node(f);while(b&&a&&!a(b));return b},getNext:function(a){var f=this.$,b;do b=(f=f.nextSibling)&&new CKEDITOR.dom.node(f);while(b&&a&&!a(b));return b},getParent:function(a){var f=this.$.parentNode;return f&&(f.nodeType==CKEDITOR.NODE_ELEMENT||a&&f.nodeType==CKEDITOR.NODE_DOCUMENT_FRAGMENT)?new CKEDITOR.dom.node(f):null},getParents:function(a){var f=this,b=[];do b[a?"push":"unshift"](f);while(f=f.getParent());return b},getCommonAncestor:function(a){if(a.equals(this))return this;
145 a.getNextSourceNode()||a}if(b.type==CKEDITOR.NODE_ELEMENT)if(e=b.getChildCount(),e>d)b=b.getChild(d).getPreviousSourceNode(!0);else if(1>e)b=b.getPreviousSourceNode();else{for(b=b.$;b.lastChild;)b=b.lastChild;b=new CKEDITOR.dom.node(b)}a.getPosition(b)&CKEDITOR.POSITION_FOLLOWING&&(a=b);return{startNode:a,endNode:b}},getCommonAncestor:function(a,b){var c=this.startContainer,d=this.endContainer,c=c.equals(d)?a&&c.type==CKEDITOR.NODE_ELEMENT&&this.startOffset==this.endOffset-1?c.getChild(this.startOffset):
146 c:c.getCommonAncestor(d);return b&&!c.is?c.getParent():c},optimize:function(){var a=this.startContainer,b=this.startOffset;a.type!=CKEDITOR.NODE_ELEMENT&&(b?b>=a.getLength()&&this.setStartAfter(a):this.setStartBefore(a));a=this.endContainer;b=this.endOffset;a.type!=CKEDITOR.NODE_ELEMENT&&(b?b>=a.getLength()&&this.setEndAfter(a):this.setEndBefore(a))},optimizeBookmark:function(){var a=this.startContainer,b=this.endContainer;a.is&&a.is("span")&&a.data("cke-bookmark")&&this.setStartAt(a,CKEDITOR.POSITION_BEFORE_START);
149 c.setStart(a,b);c.setEndAt(h,CKEDITOR.POSITION_BEFORE_END);var c=new CKEDITOR.dom.walker(c),g;for(c.guard=function(a){return!(a.type==CKEDITOR.NODE_ELEMENT&&a.isBlockBoundary())};g=c.next();){if(g.type!=CKEDITOR.NODE_TEXT)return!1;C=g!=a?g.getText():g.substring(b);if(d.test(C))return!1}return!0};if(this.collapsed)break;var m=this.getCommonAncestor(),h=this.root,k,l,r,z,A,y=!1,D,C;D=this.startContainer;var F=this.startOffset;D.type==CKEDITOR.NODE_TEXT?(F&&(D=!CKEDITOR.tools.trim(D.substring(0,F)).length&&
177 b=e.startContainer.split(e.startOffset),a.insertAfter(e.startContainer)):e.insertNode(a);a.scrollIntoView();d&&(e.startContainer.setText(c),b.remove());a.remove()},_setStartContainer:function(a){this.startContainer=a},_setEndContainer:function(a){this.endContainer=a},_find:function(a,b){var c=this.getCommonAncestor(),d=this.getBoundaryNodes(),e=[],f,m,h,k;if(c&&c.find)for(m=c.find(a),f=0;f<m.count();f++)if(c=m.getItem(f),b||!c.isReadOnly())h=c.getPosition(d.startNode)&CKEDITOR.POSITION_FOLLOWING||
331 h=g.getRanges()[0],m;if(CKEDITOR.env.gecko||CKEDITOR.env.ie&&CKEDITOR.env.needsBrFiller)if(g=f(g,d))g.appendBogus(),m=CKEDITOR.env.ie;k(b,d.block,e)&&h.collapsed&&!h.getCommonAncestor().isReadOnly()&&(d=h.clone(),d.enlarge(CKEDITOR.ENLARGE_BLOCK_CONTENTS),e=new CKEDITOR.dom.walker(d),e.guard=function(a){return!c(a)||a.type==CKEDITOR.NODE_COMMENT||a.isReadOnly()},!e.checkForward()||d.checkStartOfBlock()&&d.checkEndOfBlock())&&(b=h.fixBlock(!0,b.activeEnterMode==CKEDITOR.ENTER_DIV?"div":"p"),CKEDITOR.env.needsBrFiller||
335 a.activeEnterMode==CKEDITOR.ENTER_DIV?"div":"p":!1}function h(a){var b=a.editor;b.getSelection().scrollIntoView();setTimeout(function(){b.fire("saveSnapshot")},0)}function m(a,b,c){var d=a.getCommonAncestor(b);for(b=a=c?b:a;(a=a.getParent())&&!d.equals(a)&&1==a.getChildCount();)b=a;b.remove()}var g,n,p,t,w,q,v,u,x,B;CKEDITOR.editable=CKEDITOR.tools.createClass({base:CKEDITOR.dom.element,$:function(a,b){this.base(b.$||b);this.editor=a;this.status="unloaded";this.hasFocus=!1;this.setup()},proto:{focus:function(){var a;
342 b.deleteContents(1);b.startContainer.type==CKEDITOR.NODE_ELEMENT&&(b.startContainer.is({tr:1,table:1,tbody:1,thead:1,tfoot:1})?v(b):b.startContainer.is(CKEDITOR.dtd.$list)&&u(b));var f,h;if(g)for(;(f=b.getCommonAncestor(0,1))&&(h=CKEDITOR.dtd[f.getName()])&&(!h||!h[e]);)f.getName()in CKEDITOR.dtd.span?b.splitElement(f):b.checkStartOfBlock()&&b.checkEndOfBlock()?(b.setStartBefore(f),b.collapse(!0),f.remove()):b.splitBlock(d==CKEDITOR.ENTER_DIV?"div":"p",c.editable());b.insertNode(a);return!0},setData:function(a,
370 p.root;n={type:G,dontFilter:w,editable:n,editor:q,range:p,blockLimit:t,mergeCandidates:[],zombies:[]};G=n.range;p=n.mergeCandidates;var B,I;"text"==n.type&&G.shrink(CKEDITOR.SHRINK_ELEMENT,!0,!1)&&(B=CKEDITOR.dom.element.createFromHtml("\x3cspan\x3e\x26nbsp;\x3c/span\x3e",G.document),G.insertNode(B),G.setStartAfter(B));w=new CKEDITOR.dom.elementPath(G.startContainer);n.endPath=t=new CKEDITOR.dom.elementPath(G.endContainer);if(!G.collapsed){var q=t.block||t.blockLimit,fa=G.getCommonAncestor();q&&!q.equals(fa)&&
374 R.remove()}}n.dataWrapper=I;B=x}if(B){R=n.range;B=R.document;var M;I=n.blockLimit;p=0;var U,Q=[],T,Y;x=q=0;var W,Z;G=R.startContainer;var w=n.endPath.elements[0],aa,t=w.getPosition(G),fa=!!w.getCommonAncestor(G)&&t!=CKEDITOR.POSITION_IDENTICAL&&!(t&CKEDITOR.POSITION_CONTAINS+CKEDITOR.POSITION_IS_CONTAINED);G=b(n.dataWrapper,n);for(m(G,R);p<G.length;p++){t=G[p];if(M=t.isLineBreak){M=R;W=I;var X=void 0,ba=void 0;t.hasBlockSibling?M=1:(X=M.startContainer.getAscendant(l.$block,1))&&X.is({div:1,p:1})?
384 b=b.endNode;!b||!t(b)||c&&c.equals(b)||a.range.setEndBefore(b)}},tree:{rebuild:function(a,b){var c=a.range,d=c.getCommonAncestor(),e=new CKEDITOR.dom.elementPath(d,b),g=new CKEDITOR.dom.elementPath(c.startContainer,b),c=new CKEDITOR.dom.elementPath(c.endContainer,b),f;d.type==CKEDITOR.NODE_TEXT&&(d=d.getParent());if(e.blockLimit.is({tr:1,table:1})){var h=e.contains("table").getParent();f=function(a){return!a.equals(h)}}else if(e.block&&e.block.is(CKEDITOR.dtd.$listItem)&&(g=g.contains(CKEDITOR.dtd.$list),
392 CKEDITOR.END)&&(b=a.range.clone(),b.setStartBefore(c),b.setEndAfter(g),a.purgeTableBookmark=b.createBookmark())}},detectRanges:function(e,g){var f=c(g,e.bookmark),h=f.clone(),m,k,l=f.getCommonAncestor();l.is(CKEDITOR.dtd.$tableContent)&&!l.is(d)&&(l=l.getAscendant("table",!0));k=l;l=new CKEDITOR.dom.elementPath(f.startContainer,k);k=new CKEDITOR.dom.elementPath(f.endContainer,k);l=l.contains("table");k=k.contains("table");if(l||k)l&&k&&b(l,k)?(e.tableSurroundingRange=h,h.setStartAt(l,CKEDITOR.POSITION_AFTER_END),
405 function w(a){for(var b=0;b<a.length;b++){var c=a[b];c.getCommonAncestor().isReadOnly()&&a.splice(b,1);if(!c.collapsed){if(c.startContainer.isReadOnly())for(var d=c.startContainer,e;d&&!((e=d.type==CKEDITOR.NODE_ELEMENT)&&d.is("body")||!d.isReadOnly());)e&&"false"==d.getAttribute("contentEditable")&&c.setStartAfter(d),d=d.getParent();d=c.startContainer;e=c.endContainer;var g=c.startOffset,f=c.endOffset,h=c.clone();d&&d.type==CKEDITOR.NODE_TEXT&&(g>=d.getLength()?h.setStartAfter(d):h.setStartBefore(d));
432 this.isLocked=1},unlock:function(b){if(this.isLocked){if(b)var d=this.getSelectedElement(),e=this.getRanges(),g=this.isFake;this.isLocked=0;this.reset();b&&(b=d||e[0]&&e[0].getCommonAncestor())&&b.getAscendant("body",1)&&(a(e)?c.call(this,e):g?this.fake(d):d?this.selectElement(d):this.selectRanges(e))}},reset:function(){this._.cache={};this.isFake=0;var a=this.root.editor;if(a&&a._.fakeSelection)if(this.rev==a._.fakeSelection.rev){delete a._.fakeSelection;var b=a._.hiddenSelectionContainer;if(b){var c=
438 b.length-1&&(v=b[p],x=b[p+1],n=v.clone(),n.setStart(v.endContainer,v.endOffset),n.setEnd(x.startContainer,x.startOffset),!n.collapsed&&(n.shrink(CKEDITOR.NODE_ELEMENT,!0),d=n.getCommonAncestor(),n=n.getEnclosedNode(),d.isReadOnly()||n&&n.isReadOnly()))){x.setStart(v.startContainer,v.startOffset);b.splice(p--,1);continue}d=b[p];x=this.document.$.createRange();d.collapsed&&CKEDITOR.env.webkit&&h(d)&&(n=m(this.root),d.insertNode(n),(v=n.getNext())&&!n.getPrevious()&&v.type==CKEDITOR.NODE_ELEMENT&&"br"==
440 this.reset();p(c,b);var d=this._.cache,e=new CKEDITOR.dom.range(this.root);e.setStartBefore(a);e.setEndAfter(a);d.ranges=new CKEDITOR.dom.rangeList(e);d.selectedElement=d.startElement=a;d.type=CKEDITOR.SELECTION_ELEMENT;d.selectedText=d.nativeSel=null;this.isFake=1;this.rev=v++;c._.fakeSelection=this;this.root.fire("selectionchange")},isHidden:function(){var a=this.getCommonAncestor();a&&a.type==CKEDITOR.NODE_TEXT&&(a=a.getParent());return!(!a||!a.data("cke-hidden-sel"))},isInTable:function(){return a(this.getRanges())},
442 !a(c)?this.fake(d):this.selectRanges(c);return this},getCommonAncestor:function(){var a=this.getRanges();return a.length?a[0].startContainer.getCommonAncestor(a[a.length-1].endContainer):null},scrollIntoView:function(){this.type!=CKEDITOR.SELECTION_NONE&&this.getRanges()[0].scrollIntoView()},removeAllRanges:function(){if(this.getType()!=CKEDITOR.SELECTION_NONE){var a=this.getNative();try{a&&a[q?"empty":"removeAllRanges"]()}catch(b){}this.reset()}}}}(),"use strict",CKEDITOR.STYLE_BLOCK=1,CKEDITOR.STYLE_INLINE=
444 k||h.includeReadonly;null==l&&(l=c.root.getCustomData("cke_includeReadonly"));var n=CKEDITOR.dtd[g];n||(m=!0,n=CKEDITOR.dtd.span);c.enlarge(CKEDITOR.ENLARGE_INLINE,1);c.trim();var r=c.createBookmark(),v=r.startNode,p=r.endNode,x=v,q;if(!k){var t=c.getCommonAncestor(),k=a(v,t),t=a(p,t);k&&(x=k.getNextSourceNode(!0));t&&(p=t)}for(x.getPosition(p)==CKEDITOR.POSITION_FOLLOWING&&(x=0);x;){k=!1;if(x.equals(p))x=null,k=!0;else{var B=x.type==CKEDITOR.NODE_ELEMENT?x.getName():null,t=B&&"false"==x.getAttribute("contentEditable"),
446 !0;else{if(q||B&&CKEDITOR.dtd.$removeEmpty[B]&&(x.getPosition(p)|L)!=L||(q=c.clone(),q.setStartBefore(x)),B=x.type,B==CKEDITOR.NODE_TEXT||t||B==CKEDITOR.NODE_ELEMENT&&!x.getChildCount()){for(var B=x,F;(k=!B.getNext(I))&&(F=B.getParent(),n[F.getName()])&&f(F,v,h,N);)B=F;q.setEndAfter(B)}}else k=!0;x=x.getNextSourceNode(z||t)}if(k&&q&&!q.collapsed){for(var k=u(this,d),t=k.hasAttributes(),z=q.getCommonAncestor(),B={},y={},D={},C={},ea,E,ha;k&&z;){if(z.getName()==g){for(ea in h.attributes)!C[ea]&&(ha=
451 [];a.forEach(function(a){if("true"==a.getAttribute("contenteditable"))return b.push(a),!1},CKEDITOR.NODE_ELEMENT,!0);return b}function l(a){var b=a.getEnclosedNode()||a.getCommonAncestor(!1,!0);(a=(new CKEDITOR.dom.elementPath(b,a.root)).contains(this.element,1))&&!a.isReadOnly()&&x(a,this)}function k(a){var b=a.getCommonAncestor(!0,!0);if(a=(new CKEDITOR.dom.elementPath(b,a.root)).contains(this.element,1)){var b=this._.definition,c=b.attributes;if(c)for(var d in c)a.removeAttribute(d,c[d]);if(b.styles)for(var e in b.styles)b.styles.hasOwnProperty(e)&&
608 b,c){var d=a.getCommonAncestor(!1,!0);a=a.clone();a.enlarge(c==CKEDITOR.ENTER_BR?CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS:CKEDITOR.ENLARGE_BLOCK_CONTENTS);if(a.checkBoundaryOfElement(d,CKEDITOR.START)&&a.checkBoundaryOfElement(d,CKEDITOR.END)){for(var e;d&&d.type==CKEDITOR.NODE_ELEMENT&&(e=d.getParent())&&1==e.getChildCount()&&!(d.getName()in b);)d=e;return d.type==CKEDITOR.NODE_ELEMENT&&d.getName()in b&&d}}function b(b){return{context:"p",allowedContent:{"h1 h2 h3 h4 h5 h6 table ul ol blockquote div tr p div li td":{propertiesOnly:!0,
617 0;d<k.length;d++)b=k[d],h=h.getCommonAncestor(b.getParent());for(b={table:1,tbody:1,tr:1,ol:1,ul:1};b[h.getName()];)h=h.getParent();for(d=null;0<k.length;){for(b=k.shift();!b.getParent().equals(h);)b=b.getParent();b.equals(d)||e.push(b);d=b}for(;0<e.length;)if(b=e.shift(),"blockquote"==b.getName()){for(d=new CKEDITOR.dom.documentFragment(a.document);b.getFirst();)d.append(b.getFirst().remove()),k.push(d.getLast());d.replace(b)}else k.push(b);e=a.document.createElement("blockquote");for(e.insertBefore(k[0]);0<
895 w.push(C)}h&&h.listNode.replace(f);if(w&&w.length)for(l=0;l<w.length;l++){for(C=f=w[l];(C=C.getNext())&&C.is&&C.getName()in k;)CKEDITOR.env.needsNbspFiller&&!f.getFirst(b)&&f.append(t.document.createText(" ")),f.append(C);f.insertAfter(p)}h&&a.fire("contentDomInvalidated");return!0}for(var e=this,g=this.database,k=this.context,l=a.getSelection(),l=(l&&l.getRanges()).createIterator(),t;t=l.getNextRange();){for(var w=t.getCommonAncestor();w&&(w.type!=CKEDITOR.NODE_ELEMENT||!k[w.getName()]);){if(a.editable().equals(w)){w=
921 f=c.getRanges(),e=[],g;if(!b&&d&&d.is("a"))return d;for(d=0;d<f.length;d++)if(g=c.getRanges()[d],g.shrink(CKEDITOR.SHRINK_TEXT,!1,{skipBogus:!0}),(g=a.elementPath(g.getCommonAncestor()).contains("a",1))&&b)e.push(g);else if(g)return g;return b?e:null},getEditorAnchors:function(a){for(var b=a.editable(),c=b.isInline()&&!a.plugins.divarea?a.document:b,b=c.getElementsByTag("a"),c=c.getElementsByTag("img"),d=[],f=0,e;e=b.getItem(f++);)(e.data("cke-saved-name")||e.hasAttribute("name"))&&d.push({name:e.data("cke-saved-name")||
949 for(A=0;A<C&&(t=y.listNode.getChild(A));A++)t.getName()==this.type&&l.push(t);y.listNode.replace(n.root);h.fire("contentDomInvalidated")}else{t=b;l=y;A=F;C=l.contents;h=l.root.getDocument();n=[];1==C.length&&C[0].equals(l.root)&&(y=h.createElement("div"),C[0].moveChildren&&C[0].moveChildren(y),C[0].append(y),C[0]=y);l=l.contents[0].getParent();for(E=0;E<C.length;E++)l=l.getCommonAncestor(C[E].getParent());I=t.config.useComputedState;t=y=void 0;I=void 0===I||I;for(E=0;E<C.length;E++)for(H=C[E];L=H.getParent();){if(L.equals(l)){n.push(H);
1087 this.hideGroup(b["panelTitle"+String(CKEDITOR.STYLE_OBJECT)])},refresh:function(){var b=a.elementPath();if(b){for(var d in c)if(c[d].checkApplicable(b,a,a.activeFilter))return;this.setState(CKEDITOR.TRISTATE_DISABLED)}},reset:function(){c={};e=[]}})}})}(),function(){function a(a){return{editorFocus:!1,canUndo:!1,modes:{wysiwyg:1},exec:function(b){if(b.editable().hasFocus){var c=b.getSelection(),d;if(d=(new CKEDITOR.dom.elementPath(c.getCommonAncestor(),c.root)).contains({td:1,th:1},1)){var c=b.createRange(),
1097 !t.test(a.getName())||a.getCustomData("selected_cell")||(CKEDITOR.dom.element.setMarker(g,a,"selected_cell",!0),f.push(a))}if(a){for(var e=a.getRanges(),f=[],g={},h=0;h<e.length;h++){var k=e[h];if(k.collapsed)(k=k.getCommonAncestor().getAscendant({td:1,th:1},!0))&&c(k)&&f.push(k);else{var k=new CKEDITOR.dom.walker(k),l;for(k.guard=d;l=k.next();)l.type==CKEDITOR.NODE_ELEMENT&&l.is(CKEDITOR.dtd.table)||(l=l.getAscendant({td:1,th:1},!0))&&!l.getCustomData("selected_cell")&&c(l)&&(CKEDITOR.dom.element.setMarker(g,
1105 -1:null}function g(b,c,d){var e=a(b),f;if((c?1!=e.length:2>e.length)||(f=b.getCommonAncestor())&&f.type==CKEDITOR.NODE_ELEMENT&&f.is("table"))return!1;var g;b=e[0];f=b.getAscendant("table");var h=CKEDITOR.tools.buildTableMap(f),k=h.length,l=h[0].length,n=b.getParent().$.rowIndex,p=m(h,n,b);if(c){var t;try{var w=parseInt(b.getAttribute("rowspan"),10)||1;g=parseInt(b.getAttribute("colspan"),10)||1;t=h["up"==c?n-w:"down"==c?n+w:n]["left"==c?p-g:"right"==c?p+g:p]}catch(I){return!1}if(!t||b.$==t)return!1;
1129 b){return a&&b?a.equals(b)||a.contains(b)||b.contains(a)||a.getCommonAncestor(b).is(q):!1}function e(a){return!a.getAscendant("table",!0)&&a.getDocument().equals(g.document)}var g=a.editor||a.listenerData.editor,m=g.getSelection(1),n=b(g),p=a.data.getTarget(),t=p&&p.getAscendant({td:1,th:1},!0),p=p&&p.getAscendant("table",!0),q={table:1,thead:1,tbody:1,tfoot:1,tr:1,td:1,th:1};(function(a,b,c,g){return"mousedown"===a.name&&(f(a)||!g)||"mouseup"===a.name&&!e(a.data.getTarget())&&!d(c,g)?!0:!1})(a,m,