Examples of ContentView


Examples of org.waveprotocol.wave.client.editor.content.ContentView

      }
      try {
        searchingForAdjacentArea = true;

        HtmlView filteredHtml = filteredHtmlView;
        ContentView renderedContent = renderedContentView;

        // Is this method slow? we need it often enough, but not in 95% of scenarios,
        // so there is room to optimise.

        // See if there are other text nodes we should check
        Text selNode = previousSelectionStart.getContainer().cast();
        int selOffset = previousSelectionStart.getTextOffset();

        // TODO(patcoleman): see if being zero here is actually a problem.
        // assert selNode.getLength() > 0;

        if (selOffset == 0 && firstWrapper.getImplNodelet() == selNode) {
          // if we are at beginning of mutating node
          ContentNode prev = renderedContent.getPreviousSibling(firstWrapper);
          if (prev != null && prev.isTextNode()) {
            firstWrapper = (ContentTextNode)prev;
          }
        } else {
          ContentNode nextNode = renderedContent.getNextSibling(lastWrapper);
          Node nextNodelet = nextNode != null ? nextNode.getImplNodelet() : null;
          if (selOffset == selNode.getLength() &&
              filteredHtml.getNextSibling(selNode) == nextNodelet) {
            // if we are at end of mutating node
            if (nextNode != null && nextNode.isTextNode()) {
View Full Code Here

Examples of org.waveprotocol.wave.client.editor.content.ContentView

  /**
   * {@inheritDoc}
   */
  @Override
  public void assertHealthy(ContentElement paragraph) {
    ContentView renderedContent = paragraph.getRenderedContentView();
    if (renderedContent.getFirstChild(paragraph) != null) {
      Node child =
        paragraph.getImplNodelet().getFirstChild();
      while (child != null) {
        assert !isSpacer(child) : "Non-empty paragraph should not have spacer";
        child = child.getNextSibling();
View Full Code Here

Examples of org.waveprotocol.wave.client.editor.content.ContentView

  /**
   * {@inheritDoc}
   */
  @Override
  public void assertHealthy(ContentElement paragraph) {
    ContentView renderedContent = paragraph.getRenderedContentView();
    if (renderedContent.getFirstChild(paragraph) == null) {
      Element nodelet = paragraph.getImplNodelet();
      assert 0 == nodelet.getChildCount() : "Empty Paragraph nodelet should have no chldren";
      // Magic flag test
      // TODO(user): can we find a test for this also for the <title> element?
      // NOTE(user): temporarily disabling this, as it messes with setting
View Full Code Here

Examples of org.waveprotocol.wave.client.editor.content.ContentView

  /**
   * {@inheritDoc}
   */
  @Override
  public void assertHealthy(ContentElement paragraph) {
    ContentView renderedContent = paragraph.getRenderedContentView();
    if (renderedContent.getFirstChild(paragraph) != null) {
      Element nodelet = paragraph.getImplNodelet();
      Node last = nodelet.getLastChild();
      assert isSpacer(last) : "Last nodelet child should be spacer";
      Node child = nodelet.getFirstChild();
      while (child != null && !child.equals(last)) {
View Full Code Here

Examples of org.waveprotocol.wave.client.editor.content.ContentView

    // problem is that we can't always safely force the typing extractor to
    // extract out those operations. Therefore, we assume that most of the time,
    // doodads are inserted via selection on a non-editing document.
    ContentRange selectionPoints = createSelectionHelper(content).getOrderedSelectionPoints();
    CMutableDocument document = content.getMutableDoc();
    ContentView view = content.getPersistentView();
    return DocumentUtil.getLocationNearSelection(document, view, selectionPoints);
  }
View Full Code Here

Examples of org.waveprotocol.wave.client.editor.content.ContentView

  /**
   * {@inheritDoc}
   */
  @Override
  public void assertHealthy(ContentElement paragraph) {
    ContentView renderedContent = paragraph.getRenderedContentView();
    if (renderedContent.getFirstChild(paragraph) == null) {
      Element nodelet = paragraph.getImplNodelet();
      assert 0 == nodelet.getChildCount() : "Empty Paragraph nodelet should have no chldren";
      // Magic flag test
      // TODO(user): can we find a test for this also for the <title> element?
      // NOTE(user): temporarily disabling this, as it messes with setting
View Full Code Here

Examples of org.waveprotocol.wave.client.editor.content.ContentView

  /**
   * {@inheritDoc}
   */
  @Override
  public void assertHealthy(ContentElement paragraph) {
    ContentView renderedContent = paragraph.getRenderedContentView();
    if (renderedContent.getFirstChild(paragraph) != null) {
      Element nodelet = paragraph.getImplNodelet();
      Node last = nodelet.getLastChild();
      assert isSpacer(last) : "Last nodelet child should be spacer";
      Node child = nodelet.getFirstChild();
      while (child != null && !child.equals(last)) {
View Full Code Here

Examples of org.waveprotocol.wave.client.editor.content.ContentView

     *   typing sequence.
     */
    private void startTypingSequence(Point.Tx<Node> previousSelectionStart)
        throws HtmlMissing, HtmlInserted {
      Text node = previousSelectionStart.getContainer().cast();
      ContentView renderedContent = renderedContentView;
      HtmlView filteredHtml = filteredHtmlView;
      try {
        // This might throw an exception
        ContentTextNode wrapper = manager.findTextWrapper(node, true);

View Full Code Here

Examples of org.waveprotocol.wave.client.editor.content.ContentView

      }
      try {
        searchingForAdjacentArea = true;

        HtmlView filteredHtml = filteredHtmlView;
        ContentView renderedContent = renderedContentView;

        // Is this method slow? we need it often enough, but not in 95% of scenarios,
        // so there is room to optimise.

        // See if there are other text nodes we should check
        Text selNode = previousSelectionStart.getContainer().cast();
        int selOffset = previousSelectionStart.getTextOffset();

        // TODO(patcoleman): see if being zero here is actually a problem.
        // assert selNode.getLength() > 0;

        if (selOffset == 0 && firstWrapper.getImplNodelet() == selNode) {
          // if we are at beginning of mutating node
          ContentNode prev = renderedContent.getPreviousSibling(firstWrapper);
          if (prev != null && prev.isTextNode()) {
            firstWrapper = (ContentTextNode)prev;
          }
        } else {
          ContentNode nextNode = renderedContent.getNextSibling(lastWrapper);
          Node nextNodelet = nextNode != null ? nextNode.getImplNodelet() : null;
          if (selOffset == selNode.getLength() &&
              filteredHtml.getNextSibling(selNode) == nextNodelet) {
            // if we are at end of mutating node
            if (nextNode != null && nextNode.isTextNode()) {
View Full Code Here

Examples of org.waveprotocol.wave.client.editor.content.ContentView

     * from there up into the wrapper world, then scan rightwards across both
     * doms to find the matching pair, using current as our cursor into the html
     * dom, and possibleOwnerNode as our cursor into the wrapper dom.
     */

    ContentView renderedContent = renderedContentView;
    HtmlView filteredHtml = filteredHtmlView;

    // The element before all previous text node siblings of target,
    // or null if no such element
    Node nodeletBeforeTextNodes;
    ContentNode wrapperBeforeTextNodes;

    // Our cursors
    Text current = target;
    ContentNode possibleOwnerNode;

    // Go leftwards to find the start of the text nodelet sequence
    for (nodeletBeforeTextNodes = filteredHtml.getPreviousSibling(target);
         nodeletBeforeTextNodes != null;
         nodeletBeforeTextNodes = filteredHtml.getPreviousSibling(nodeletBeforeTextNodes)) {
      Text maybeText = filteredHtml.asText(nodeletBeforeTextNodes);
      if (maybeText == null) {
        break;
      }
      current = maybeText;
    }

    Element parentNodelet = filteredHtml.getParentElement(target);
    if (parentNodelet == null) {
      throw new RuntimeException(
          "Somehow we are asking for the wrapper of something not in the editor??");
    }
    ContentElement parentElement = NodeManager.getBackReference(parentNodelet);

    // Find our foothold in wrapper land
    if (nodeletBeforeTextNodes == null) {
      // reached the beginning
      wrapperBeforeTextNodes = null;
      possibleOwnerNode = renderedContent.getFirstChild(parentElement);
    } else {
      // reached an element
      wrapperBeforeTextNodes = NodeManager.getBackReference(
          nodeletBeforeTextNodes.<Element>cast());
      possibleOwnerNode = renderedContent.getNextSibling(wrapperBeforeTextNodes);
    }

    // Scan to find a matching pair
    while (true) {
      // TODO(danilatos): Clarify and possibly reorganise this loop
      // TODO(danilatos): Write more unit tests to thoroughly cover all scenarios

      if (possibleOwnerNode == null) {
        // Scenario (D)
        throw new HtmlInserted(
              Point.inElement(parentElement, (ContentNode) null),
              Point.start(filteredHtml, parentNodelet)
            );
      }

      ContentTextNode possibleOwner;
      try {
        possibleOwner = (ContentTextNode) possibleOwnerNode;
      } catch (ClassCastException e) {
        if (possibleOwnerNode.isImplAttached()) {
          // Scenario (C)
          throw new HtmlInserted(
                Point.inElement(parentElement, possibleOwnerNode),
                Point.inElementReverse(filteredHtml, parentNodelet, nodeletBeforeTextNodes)
              );
        } else {
          // Scenario (A)
          // Not minor, an element has gone missing
          throw new HtmlMissing(possibleOwnerNode, parentNodelet);
        }
      }

      ContentNode nextNode = renderedContent.getNextSibling(possibleOwner);
      if (nextNode != null && !nextNode.isImplAttached()) {
        // Scenario (E)
        throw new HtmlMissing(nextNode, parentNodelet);
      }

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.