Ejemplo n.º 1
0
bool nsCaret::IsVisible()
{
  if (!mVisible || mHideCount) {
    return false;
  }

  if (!mShowDuringSelection &&
      !(sSelectionCaretEnabled && sSelectionCaretsAffectCaret)) {
    Selection* selection = GetSelectionInternal();
    if (!selection) {
      return false;
    }
    bool isCollapsed;
    if (NS_FAILED(selection->GetIsCollapsed(&isCollapsed)) || !isCollapsed) {
      return false;
    }
  }

  // The Android IME can have a visible caret when there is a composition
  // selection, due to auto-suggest/auto-correct styling (underlining),
  // but never when the SelectionCarets are visible.
  if (sSelectionCaretEnabled && sSelectionCaretsAffectCaret) {
    nsCOMPtr<nsISelectionController> selCon = do_QueryReferent(mPresShell);
    if (selCon) {
      bool visible = false;
      selCon->GetSelectionCaretsVisibility(&visible);
      if (visible) {
        return false;
      }
    }
  }

  if (IsMenuPopupHidingCaret()) {
    return false;
  }

  return true;
}
Ejemplo n.º 2
0
bool nsCaret::IsVisible()
{
  if (!mVisible || mHideCount) {
    return false;
  }

  if (!mShowDuringSelection) {
    Selection* selection = GetSelectionInternal();
    if (!selection) {
      return false;
    }
    bool isCollapsed;
    if (NS_FAILED(selection->GetIsCollapsed(&isCollapsed)) || !isCollapsed) {
      return false;
    }
  }

  if (IsMenuPopupHidingCaret()) {
    return false;
  }

  return true;
}