本文整理汇总了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;
}
示例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();
}
示例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);
}
示例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;
}
示例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));
}
示例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);
}
}
示例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();
}
}
示例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());
}
示例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;
}
示例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;
}