当前位置: 首页>>代码示例>>Java>>正文


Java UserAgent.isWebkit方法代码示例

本文整理汇总了Java中org.waveprotocol.wave.client.common.util.UserAgent.isWebkit方法的典型用法代码示例。如果您正苦于以下问题:Java UserAgent.isWebkit方法的具体用法?Java UserAgent.isWebkit怎么用?Java UserAgent.isWebkit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.waveprotocol.wave.client.common.util.UserAgent的用法示例。


在下文中一共展示了UserAgent.isWebkit方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSelectionGuarded

import org.waveprotocol.wave.client.common.util.UserAgent; //导入方法依赖的package包/类
/**
 * Gets the current selection, trying to place it in correspond actual DOM when the selection
 * itself is reported as not being in the actual document.
 * @return The selection in the page's DOM document, or null if it cannot be calculated.
 */
public static SelectionW3CNative getSelectionGuarded() {
  SelectionW3CNative selection = getSelectionUnsafe();
  // NOTE(patcoleman) -
  // It is possible for the selection to be in a node in the shadow, which
  //   causes errors whenever you try to read attributes.
  if (selection != null && DomHelper.isUnreadable(selection.anchorNode())) {
    if (UserAgent.isFirefox()) {
      // In firefox, the focus can be practically anywhere, so we give up:
      return null;
    } else if (UserAgent.isWebkit()) {
      // In webkit, the focus should be on the element the shadow dom comes from:
      selection.setCaret(NativeSelectionUtil.getActiveElement(), 0);
      return selection;
    }
    return null; // not sure what anything else does, so be safe and assume we're beyond repair.
  }
  return selection;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:24,代码来源:SelectionW3CNative.java

示例2: setCollapsed

import org.waveprotocol.wave.client.common.util.UserAgent; //导入方法依赖的package包/类
public void setCollapsed(boolean collapsed) {
  if (collapsed) {
    self.setAttribute(COLLAPSED_ATTRIBUTE, COLLAPSED_VALUE);

    // Webkit's incremental layout is incorrect, so we have to kick it a bit.
    if (UserAgent.isWebkit()) {
      self.getStyle().setDisplay(Display.INLINE_BLOCK);
      // Force layout.
      self.getOffsetParent();
      // Revert to CSS display property (layed out correctly now).
      self.getStyle().clearDisplay();
    }
  } else {
    self.removeAttribute("c");
  }
  updatedCssClassNames();
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:18,代码来源:CollapsibleDomImpl.java

示例3: append

import org.waveprotocol.wave.client.common.util.UserAgent; //导入方法依赖的package包/类
@Override
public ParticipantView append(
    ParticipantsDomImpl impl, Conversation conv, ParticipantId participant) {
  Element t = getRenderer().render(conv, participant);
  DomViewHelper.attachBefore(impl.getParticipantContainer(), impl.getSimpleMenu(), t);
  // Kick Webkit, because of its incremental layout bugs.
  if (UserAgent.isWebkit()) {

    String oldDisplay = impl.getElement().getStyle().getDisplay();

    // Erase layout. Querying getOffsetParent() forces layout.
    impl.getElement().getStyle().setDisplay(Display.NONE);
    impl.getElement().getOffsetParent();

    // Restore layout.
    impl.getElement().getStyle().setProperty("display", oldDisplay);
  }
  return asParticipant(t);
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:20,代码来源:FullStructure.java

示例4: createHtml

import org.waveprotocol.wave.client.common.util.UserAgent; //导入方法依赖的package包/类
private static Element createHtml(boolean isAnchor) {
  Element e = isAnchor
      ? Document.get().createAnchorElement()
      : Document.get().createSpanElement();

  // Prevents some browsers (to my knowledge, currently just Webkit)
  // from removing empty elements from the dom too much
  if (UserAgent.isWebkit()) {
    e.setAttribute("x", "y");
  }

  return e;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:14,代码来源:AnnotationSpreadRenderer.java

示例5: EditorEventHandler

import org.waveprotocol.wave.client.common.util.UserAgent; //导入方法依赖的package包/类
/**
 * @param editorInteractor
 * @param subHandler
 */
public EditorEventHandler(EditorInteractor editorInteractor, EditorEventsSubHandler subHandler,
    NodeEventRouter router,
    boolean useWhiteListFlag, boolean useWebkitCompositionFlag) {
  this(new SchedulerTimerService(SchedulerInstance.get(), Scheduler.Priority.CRITICAL),
      editorInteractor, subHandler, router,
      useWhiteListFlag,
      // We may want to turn off composition events for webkit if something goes wrong...
      QuirksConstants.SUPPORTS_COMPOSITION_EVENTS &&
          (UserAgent.isWebkit() ? useWebkitCompositionFlag : true));
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:15,代码来源:EditorEventHandler.java

示例6: kickWebkit

import org.waveprotocol.wave.client.common.util.UserAgent; //导入方法依赖的package包/类
private static void kickWebkit(Element element) {
  if (UserAgent.isWebkit()) {

    Style style = element.getStyle();
    String oldDisplay = style.getDisplay();

    // Erase layout. Querying getOffsetParent() forces layout.
    style.setDisplay(Display.NONE);
    element.getOffsetParent();

    // Restore layout.
    style.setProperty("display", oldDisplay);
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:15,代码来源:FullStructure.java

示例7: remove

import org.waveprotocol.wave.client.common.util.UserAgent; //导入方法依赖的package包/类
@Override
public void remove(ParticipantNameDomImpl impl) {
  Element container = impl.getElement().getParentElement();
  impl.remove();

  // Kick Webkit, because of its incremental layout bugs.
  if (UserAgent.isWebkit()) {
    // Erase layout. Querying getOffsetParent() forces layout.
    container.getStyle().setDisplay(Display.NONE);
    container.getOffsetParent();
    // Restore layout.
    container.getStyle().clearDisplay();
  }
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:15,代码来源:FullStructure.java

示例8: create

import org.waveprotocol.wave.client.common.util.UserAgent; //导入方法依赖的package包/类
public static ParagraphHelper create() {
  return UserAgent.isIE() ? new ParagraphHelperIE() : (UserAgent.isWebkit()
      ? new ParagraphHelperWebkit() : new ParagraphHelperAlwaysBr());
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:5,代码来源:ParagraphHelper.java

示例9: isBlackListedCombo

import org.waveprotocol.wave.client.common.util.UserAgent; //导入方法依赖的package包/类
private boolean isBlackListedCombo(SignalEvent event) {
  KeyCombo keyCombo = EventWrapper.getKeyCombo(event);
  switch (keyCombo) {
    // Disallow undo
    case META_Z:
    case CTRL_Z:
      return true;
  }

  if (UserAgent.isMac()) {
    switch (keyCombo) {
      case CTRL_D: // Deletes a character, needs to be handled manually
      case CTRL_H: // Deletes a character backwards
      case CTRL_K: // Deletes to end of line, needs to be handled manually
        return true;
    }

    if (UserAgent.isFirefox()) {
      switch (keyCombo) {
        case CTRL_W: // Deletes a word backwards
          return true;
        case CTRL_U: // Kills line
          // NOTE(user): Implement this when Firefox updates their selection API.
          return true;
      }
    }

    if (UserAgent.isWebkit()) {
      switch (keyCombo) {
        case CTRL_O: // Inserts a new line
          return true;
      }
    }
  }

  if (QuirksConstants.PLAINTEXT_PASTE_DOES_NOT_EMIT_PASTE_EVENT
      && (keyCombo == KeyCombo.META_ALT_SHIFT_V || keyCombo == KeyCombo.CTRL_ALT_SHIFT_V)) {
    return true;
  }

  return false;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:43,代码来源:EditorEventHandler.java

示例10: isBlackListedCombo

import org.waveprotocol.wave.client.common.util.UserAgent; //导入方法依赖的package包/类
private boolean isBlackListedCombo(SignalEvent event) {
  KeyCombo keyCombo = EventWrapper.getKeyCombo(event);
  switch (keyCombo) {
    // Disallow undo
    case ORDER_Z:
      return true;
  }

  if (UserAgent.isMac()) {
    switch (keyCombo) {
      case CTRL_D: // Deletes a character, needs to be handled manually
      case CTRL_H: // Deletes a character backwards
      case CTRL_K: // Deletes to end of line, needs to be handled manually
        return true;
    }

    if (UserAgent.isFirefox()) {
      switch (keyCombo) {
        case CTRL_W: // Deletes a word backwards
          return true;
        case CTRL_U: // Kills line
          // NOTE(user): Implement this when Firefox updates their selection API.
          return true;
      }
    }

    if (UserAgent.isWebkit()) {
      switch (keyCombo) {
        case CTRL_O: // Inserts a new line
          return true;
      }
    }
  }

  if (QuirksConstants.PLAINTEXT_PASTE_DOES_NOT_EMIT_PASTE_EVENT
      && keyCombo == KeyCombo.ORDER_ALT_SHIFT_V) {
    return true;
  }

  return false;
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:42,代码来源:EditorEventHandler.java


注:本文中的org.waveprotocol.wave.client.common.util.UserAgent.isWebkit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。