< prev index next >
modules/javafx.web/src/main/java/com/sun/webkit/WebPage.java
Print this page
*** 24,33 ****
--- 24,35 ----
*/
package com.sun.webkit;
import com.sun.glass.utils.NativeLibLoader;
+ import com.sun.javafx.logging.PlatformLogger;
+ import com.sun.javafx.logging.PlatformLogger.Level;
import com.sun.webkit.event.WCFocusEvent;
import com.sun.webkit.event.WCInputMethodEvent;
import com.sun.webkit.event.WCKeyEvent;
import com.sun.webkit.event.WCMouseEvent;
import com.sun.webkit.event.WCMouseWheelEvent;
*** 54,65 ****
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.ReentrantLock;
- import java.util.logging.Level;
- import java.util.logging.Logger;
import netscape.javascript.JSException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
--- 56,65 ----
*** 74,85 ****
* <li>supporting policy checking {@link PolicyClient}
* </ul>
*/
public final class WebPage {
! private final static Logger log = Logger.getLogger(WebPage.class.getName());
! private final static Logger paintLog = Logger.getLogger(WebPage.class.getName() + ".paint");
private static final int MAX_FRAME_QUEUE_SIZE = 10;
// Native WebPage* pointer
private long pPage = 0;
--- 74,85 ----
* <li>supporting policy checking {@link PolicyClient}
* </ul>
*/
public final class WebPage {
! private final static PlatformLogger log = PlatformLogger.getLogger(WebPage.class.getName());
! private final static PlatformLogger paintLog = PlatformLogger.getLogger(WebPage.class.getName() + ".paint");
private static final int MAX_FRAME_QUEUE_SIZE = 10;
// Native WebPage* pointer
private long pPage = 0;
*** 275,286 ****
}
}
private void updateDirty(WCRectangle clip) {
if (paintLog.isLoggable(Level.FINEST)) {
! paintLog.log(Level.FINEST, "Entering, "
! + "dirtyRects: {0}, currentFrame: {1}",
new Object[] {dirtyRects, currentFrame});
}
if (isDisposed || width <= 0 || height <= 0) {
// If there're any dirty rects left, they are invalid.
--- 275,285 ----
}
}
private void updateDirty(WCRectangle clip) {
if (paintLog.isLoggable(Level.FINEST)) {
! paintLog.finest("Entering, dirtyRects: {0}, currentFrame: {1}",
new Object[] {dirtyRects, currentFrame});
}
if (isDisposed || width <= 0 || height <= 0) {
// If there're any dirty rects left, they are invalid.
*** 298,308 ****
while (!oldDirtyRects.isEmpty()) {
WCRectangle r = oldDirtyRects.remove(0).intersection(clip);
if (r.getWidth() <= 0 || r.getHeight() <= 0) {
continue;
}
! paintLog.log(Level.FINEST, "Updating: {0}", r);
WCRenderQueue rq = WCGraphicsManager.getGraphicsManager()
.createRenderQueue(r, true);
twkUpdateContent(getPage(), rq, r.getIntX() - 1, r.getIntY() - 1,
r.getIntWidth() + 2, r.getIntHeight() + 2);
currentFrame.addRenderQueue(rq);
--- 297,307 ----
while (!oldDirtyRects.isEmpty()) {
WCRectangle r = oldDirtyRects.remove(0).intersection(clip);
if (r.getWidth() <= 0 || r.getHeight() <= 0) {
continue;
}
! paintLog.finest("Updating: {0}", r);
WCRenderQueue rq = WCGraphicsManager.getGraphicsManager()
.createRenderQueue(r, true);
twkUpdateContent(getPage(), rq, r.getIntX() - 1, r.getIntY() - 1,
r.getIntWidth() + 2, r.getIntHeight() + 2);
currentFrame.addRenderQueue(rq);
*** 315,343 ****
clip.getIntWidth(), clip.getIntHeight());
currentFrame.addRenderQueue(rq);
}
if (paintLog.isLoggable(Level.FINEST)) {
! paintLog.log(Level.FINEST, "Dirty rects processed, "
! + "dirtyRects: {0}, currentFrame: {1}",
new Object[] {dirtyRects, currentFrame});
}
if (currentFrame.getRQList().size() > 0) {
synchronized (frameQueue) {
! paintLog.log(Level.FINEST, "About to update frame queue, "
! + "frameQueue: {0}", frameQueue);
Iterator<RenderFrame> it = frameQueue.iterator();
while (it.hasNext()) {
RenderFrame frame = it.next();
for (WCRenderQueue rq : currentFrame.getRQList()) {
WCRectangle rqRect = rq.getClip();
if (rq.isOpaque()
&& rqRect.contains(frame.getEnclosingRect()))
{
! paintLog.log(Level.FINEST, "Dropping: {0}", frame);
frame.drop();
it.remove();
break;
}
}
--- 314,340 ----
clip.getIntWidth(), clip.getIntHeight());
currentFrame.addRenderQueue(rq);
}
if (paintLog.isLoggable(Level.FINEST)) {
! paintLog.finest("Dirty rects processed, dirtyRects: {0}, currentFrame: {1}",
new Object[] {dirtyRects, currentFrame});
}
if (currentFrame.getRQList().size() > 0) {
synchronized (frameQueue) {
! paintLog.finest("About to update frame queue, frameQueue: {0}", frameQueue);
Iterator<RenderFrame> it = frameQueue.iterator();
while (it.hasNext()) {
RenderFrame frame = it.next();
for (WCRenderQueue rq : currentFrame.getRQList()) {
WCRectangle rqRect = rq.getClip();
if (rq.isOpaque()
&& rqRect.contains(frame.getEnclosingRect()))
{
! paintLog.finest("Dropping: {0}", frame);
frame.drop();
it.remove();
break;
}
}
*** 345,368 ****
frameQueue.add(currentFrame);
currentFrame = new RenderFrame();
if (frameQueue.size() > MAX_FRAME_QUEUE_SIZE) {
! paintLog.log(Level.FINEST, "Frame queue exceeded maximum "
+ "size, clearing and requesting full repaint");
dropRenderFrames();
repaintAll();
}
! paintLog.log(Level.FINEST, "Frame queue updated, "
! + "frameQueue: {0}", frameQueue);
}
}
if (paintLog.isLoggable(Level.FINEST)) {
! paintLog.log(Level.FINEST,
! "Exiting, dirtyRects: {0}, currentFrame: {1}",
new Object[] {dirtyRects, currentFrame});
}
}
private void scroll(int x, int y, int w, int h, int dx, int dy) {
--- 342,363 ----
frameQueue.add(currentFrame);
currentFrame = new RenderFrame();
if (frameQueue.size() > MAX_FRAME_QUEUE_SIZE) {
! paintLog.finest("Frame queue exceeded maximum "
+ "size, clearing and requesting full repaint");
dropRenderFrames();
repaintAll();
}
! paintLog.finest("Frame queue updated, frameQueue: {0}", frameQueue);
}
}
if (paintLog.isLoggable(Level.FINEST)) {
! paintLog.finest("Exiting, dirtyRects: {0}, currentFrame: {1}",
new Object[] {dirtyRects, currentFrame});
}
}
private void scroll(int x, int y, int w, int h, int dx, int dy) {
*** 400,410 ****
if (!dirtyRects.isEmpty()) {
WCRectangle scrollRect = new WCRectangle(x, y, w, h);
for (WCRectangle r: dirtyRects) {
if (scrollRect.contains(r)) {
if (paintLog.isLoggable(Level.FINEST)) {
! paintLog.log(Level.FINEST, "translating old dirty rect by the delta: " + r);
}
r.translate(dx, dy);
}
}
}
--- 395,405 ----
if (!dirtyRects.isEmpty()) {
WCRectangle scrollRect = new WCRectangle(x, y, w, h);
for (WCRectangle r: dirtyRects) {
if (scrollRect.contains(r)) {
if (paintLog.isLoggable(Level.FINEST)) {
! paintLog.finest("translating old dirty rect by the delta: " + r);
}
r.translate(dx, dy);
}
}
}
*** 528,540 ****
// *************************************************************************
public void setBounds(int x, int y, int w, int h) {
lockPage();
try {
! log.log(Level.FINE, "setBounds: " + x + " " + y + " " + w + " " + h);
if (isDisposed) {
! log.log(Level.FINE, "setBounds() request for a disposed web page.");
return;
}
width = w;
height = h;
twkSetBounds(getPage(), 0, 0, w, h);
--- 523,535 ----
// *************************************************************************
public void setBounds(int x, int y, int w, int h) {
lockPage();
try {
! log.fine("setBounds: " + x + " " + y + " " + w + " " + h);
if (isDisposed) {
! log.fine("setBounds() request for a disposed web page.");
return;
}
width = w;
height = h;
twkSetBounds(getPage(), 0, 0, w, h);
*** 563,575 ****
}
public void setOpaque(long frameID, boolean isOpaque) {
lockPage();
try {
! log.log(Level.FINE, "setOpaque: " + isOpaque);
if (isDisposed) {
! log.log(Level.FINE, "setOpaque() request for a disposed web page.");
return;
}
if (!frames.contains(frameID)) {
return;
}
--- 558,570 ----
}
public void setOpaque(long frameID, boolean isOpaque) {
lockPage();
try {
! log.fine("setOpaque: " + isOpaque);
if (isDisposed) {
! log.fine("setOpaque() request for a disposed web page.");
return;
}
if (!frames.contains(frameID)) {
return;
}
*** 581,593 ****
}
public void setBackgroundColor(long frameID, int backgroundColor) {
lockPage();
try {
! log.log(Level.FINE, "setBackgroundColor: " + backgroundColor);
if (isDisposed) {
! log.log(Level.FINE, "setBackgroundColor() request for a disposed web page.");
return;
}
if (!frames.contains(frameID)) {
return;
}
--- 576,588 ----
}
public void setBackgroundColor(long frameID, int backgroundColor) {
lockPage();
try {
! log.fine("setBackgroundColor: " + backgroundColor);
if (isDisposed) {
! log.fine("setBackgroundColor() request for a disposed web page.");
return;
}
if (!frames.contains(frameID)) {
return;
}
*** 599,612 ****
}
public void setBackgroundColor(int backgroundColor) {
lockPage();
try {
! log.log(Level.FINE, "setBackgroundColor: " + backgroundColor +
" for all frames");
if (isDisposed) {
! log.log(Level.FINE, "setBackgroundColor() request for a disposed web page.");
return;
}
for (long frameID: frames) {
twkSetBackgroundColor(frameID, backgroundColor);
--- 594,607 ----
}
public void setBackgroundColor(int backgroundColor) {
lockPage();
try {
! log.fine("setBackgroundColor: " + backgroundColor +
" for all frames");
if (isDisposed) {
! log.fine("setBackgroundColor() request for a disposed web page.");
return;
}
for (long frameID: frames) {
twkSetBackgroundColor(frameID, backgroundColor);
*** 623,633 ****
public void updateContent(WCRectangle toPaint) {
lockPage();
try {
++updateContentCycleID;
! paintLog.log(Level.FINEST, "toPaint: {0}", toPaint);
if (isDisposed) {
paintLog.fine("updateContent() request for a disposed web page.");
return;
}
updateDirty(toPaint);
--- 618,628 ----
public void updateContent(WCRectangle toPaint) {
lockPage();
try {
++updateContentCycleID;
! paintLog.finest("toPaint: {0}", toPaint);
if (isDisposed) {
paintLog.fine("updateContent() request for a disposed web page.");
return;
}
updateDirty(toPaint);
*** 720,733 ****
synchronized (frameQueue) {
framesToRender = new ArrayList(frameQueue);
frameQueue.clear();
}
! paintLog.log(Level.FINEST, "Frames to render: {0}", framesToRender);
for (RenderFrame frame : framesToRender) {
! paintLog.log(Level.FINEST, "Rendering: {0}", frame);
for (WCRenderQueue rq : frame.getRQList()) {
gc.saveState();
if (rq.getClip() != null) {
gc.setClip(rq.getClip());
}
--- 715,728 ----
synchronized (frameQueue) {
framesToRender = new ArrayList(frameQueue);
frameQueue.clear();
}
! paintLog.finest("Frames to render: {0}", framesToRender);
for (RenderFrame frame : framesToRender) {
! paintLog.finest("Rendering: {0}", frame);
for (WCRenderQueue rq : frame.getRQList()) {
gc.saveState();
if (rq.getClip() != null) {
gc.setClip(rq.getClip());
}
*** 756,768 ****
}
public void dispatchFocusEvent(WCFocusEvent fe) {
lockPage();
try {
! log.log(Level.FINEST, "dispatchFocusEvent: " + fe);
if (isDisposed) {
! log.log(Level.FINE, "Focus event for a disposed web page.");
return;
}
twkProcessFocusEvent(getPage(), fe.getID(), fe.getDirection());
} finally {
--- 751,763 ----
}
public void dispatchFocusEvent(WCFocusEvent fe) {
lockPage();
try {
! log.finest("dispatchFocusEvent: " + fe);
if (isDisposed) {
! log.fine("Focus event for a disposed web page.");
return;
}
twkProcessFocusEvent(getPage(), fe.getID(), fe.getDirection());
} finally {
*** 771,787 ****
}
public boolean dispatchKeyEvent(WCKeyEvent ke) {
lockPage();
try {
! log.log(Level.FINEST, "dispatchKeyEvent: " + ke);
if (isDisposed) {
! log.log(Level.FINE, "Key event for a disposed web page.");
return false;
}
if (WCKeyEvent.filterEvent(ke)) {
! log.log(Level.FINEST, "filtered");
return false;
}
return twkProcessKeyEvent(getPage(), ke.getType(), ke.getText(),
ke.getKeyIdentifier(),
ke.getWindowsVirtualKeyCode(),
--- 766,782 ----
}
public boolean dispatchKeyEvent(WCKeyEvent ke) {
lockPage();
try {
! log.finest("dispatchKeyEvent: " + ke);
if (isDisposed) {
! log.fine("Key event for a disposed web page.");
return false;
}
if (WCKeyEvent.filterEvent(ke)) {
! log.finest("filtered");
return false;
}
return twkProcessKeyEvent(getPage(), ke.getType(), ke.getText(),
ke.getKeyIdentifier(),
ke.getWindowsVirtualKeyCode(),
*** 793,805 ****
}
public boolean dispatchMouseEvent(WCMouseEvent me) {
lockPage();
try {
! log.log(Level.FINEST, "dispatchMouseEvent: " + me.getX() + "," + me.getY());
if (isDisposed) {
! log.log(Level.FINE, "Mouse event for a disposed web page.");
return false;
}
return !isDragConfirmed() //When Webkit informes FX about drag start, it waits
//for system DnD loop and not intereasted in
--- 788,800 ----
}
public boolean dispatchMouseEvent(WCMouseEvent me) {
lockPage();
try {
! log.finest("dispatchMouseEvent: " + me.getX() + "," + me.getY());
if (isDisposed) {
! log.fine("Mouse event for a disposed web page.");
return false;
}
return !isDragConfirmed() //When Webkit informes FX about drag start, it waits
//for system DnD loop and not intereasted in
*** 815,827 ****
}
public boolean dispatchMouseWheelEvent(WCMouseWheelEvent me) {
lockPage();
try {
! log.log(Level.FINEST, "dispatchMouseWheelEvent: " + me);
if (isDisposed) {
! log.log(Level.FINE, "MouseWheel event for a disposed web page.");
return false;
}
return twkProcessMouseWheelEvent(getPage(),
me.getX(), me.getY(), me.getScreenX(), me.getScreenY(),
me.getDeltaX(), me.getDeltaY(),
--- 810,822 ----
}
public boolean dispatchMouseWheelEvent(WCMouseWheelEvent me) {
lockPage();
try {
! log.finest("dispatchMouseWheelEvent: " + me);
if (isDisposed) {
! log.fine("MouseWheel event for a disposed web page.");
return false;
}
return twkProcessMouseWheelEvent(getPage(),
me.getX(), me.getY(), me.getScreenX(), me.getScreenY(),
me.getDeltaX(), me.getDeltaY(),
*** 833,845 ****
}
public boolean dispatchInputMethodEvent(WCInputMethodEvent ie) {
lockPage();
try {
! log.log(Level.FINEST, "dispatchInputMethodEvent: " + ie);
if (isDisposed) {
! log.log(Level.FINE, "InputMethod event for a disposed web page.");
return false;
}
switch (ie.getID()) {
case WCInputMethodEvent.INPUT_METHOD_TEXT_CHANGED:
return twkProcessInputTextChange(getPage(),
--- 828,840 ----
}
public boolean dispatchInputMethodEvent(WCInputMethodEvent ie) {
lockPage();
try {
! log.finest("dispatchInputMethodEvent: " + ie);
if (isDisposed) {
! log.fine("InputMethod event for a disposed web page.");
return false;
}
switch (ie.getID()) {
case WCInputMethodEvent.INPUT_METHOD_TEXT_CHANGED:
return twkProcessInputTextChange(getPage(),
*** 876,890 ****
int screenX, int screenY,
int dndActionId)
{
lockPage();
try {
! log.log(Level.FINEST, "dispatchDragOperation: " + x + "," + y
+ " dndCommand:" + commandId
+ " dndAction" + dndActionId);
if (isDisposed) {
! log.log(Level.FINE, "DnD event for a disposed web page.");
return 0;
}
return twkProcessDrag(getPage(),
commandId,
mimeTypes, values,
--- 871,885 ----
int screenX, int screenY,
int dndActionId)
{
lockPage();
try {
! log.finest("dispatchDragOperation: " + x + "," + y
+ " dndCommand:" + commandId
+ " dndAction" + dndActionId);
if (isDisposed) {
! log.fine("DnD event for a disposed web page.");
return 0;
}
return twkProcessDrag(getPage(),
commandId,
mimeTypes, values,
*** 913,923 ****
public int[] getClientTextLocation(int index) {
lockPage();
try {
if (isDisposed) {
! log.log(Level.FINE, "getClientTextLocation() request for a disposed web page.");
return new int[] { 0, 0, 0, 0 };
}
Invoker.getInvoker().checkEventThread();
return twkGetTextLocation(getPage(), index);
--- 908,918 ----
public int[] getClientTextLocation(int index) {
lockPage();
try {
if (isDisposed) {
! log.fine("getClientTextLocation() request for a disposed web page.");
return new int[] { 0, 0, 0, 0 };
}
Invoker.getInvoker().checkEventThread();
return twkGetTextLocation(getPage(), index);
*** 928,938 ****
public int getClientLocationOffset(int x, int y) {
lockPage();
try {
if (isDisposed) {
! log.log(Level.FINE, "getClientLocationOffset() request for a disposed web page.");
return 0;
}
Invoker.getInvoker().checkEventThread();
return twkGetInsertPositionOffset(getPage());
--- 923,933 ----
public int getClientLocationOffset(int x, int y) {
lockPage();
try {
if (isDisposed) {
! log.fine("getClientLocationOffset() request for a disposed web page.");
return 0;
}
Invoker.getInvoker().checkEventThread();
return twkGetInsertPositionOffset(getPage());
*** 943,953 ****
public int getClientInsertPositionOffset() {
lockPage();
try {
if (isDisposed) {
! log.log(Level.FINE, "getClientInsertPositionOffset() request for a disposed web page.");
return 0;
}
return twkGetInsertPositionOffset(getPage());
} finally {
--- 938,948 ----
public int getClientInsertPositionOffset() {
lockPage();
try {
if (isDisposed) {
! log.fine("getClientInsertPositionOffset() request for a disposed web page.");
return 0;
}
return twkGetInsertPositionOffset(getPage());
} finally {
*** 957,967 ****
public int getClientCommittedTextLength() {
lockPage();
try {
if (isDisposed) {
! log.log(Level.FINE, "getClientCommittedTextOffset() request for a disposed web page.");
return 0;
}
return twkGetCommittedTextLength(getPage());
} finally {
--- 952,962 ----
public int getClientCommittedTextLength() {
lockPage();
try {
if (isDisposed) {
! log.fine("getClientCommittedTextOffset() request for a disposed web page.");
return 0;
}
return twkGetCommittedTextLength(getPage());
} finally {
*** 971,981 ****
public String getClientCommittedText() {
lockPage();
try {
if (isDisposed) {
! log.log(Level.FINE, "getClientCommittedText() request for a disposed web page.");
return "";
}
return twkGetCommittedText(getPage());
} finally {
--- 966,976 ----
public String getClientCommittedText() {
lockPage();
try {
if (isDisposed) {
! log.fine("getClientCommittedText() request for a disposed web page.");
return "";
}
return twkGetCommittedText(getPage());
} finally {
*** 985,995 ****
public String getClientSelectedText() {
lockPage();
try {
if (isDisposed) {
! log.log(Level.FINE, "getClientSelectedText() request for a disposed web page.");
return "";
}
return twkGetSelectedText(getPage());
} finally {
--- 980,990 ----
public String getClientSelectedText() {
lockPage();
try {
if (isDisposed) {
! log.fine("getClientSelectedText() request for a disposed web page.");
return "";
}
return twkGetSelectedText(getPage());
} finally {
*** 1002,1022 ****
// *************************************************************************
public void dispose() {
lockPage();
try {
! log.log(Level.FINER, "dispose");
stop();
dropRenderFrames();
isDisposed = true;
twkDestroyPage(pPage);
pPage = 0;
for (long frameID : frames) {
! log.log(Level.FINE, "Undestroyed frame view: " + frameID);
}
frames.clear();
if (backbuffer != null) {
backbuffer.deref();
--- 997,1017 ----
// *************************************************************************
public void dispose() {
lockPage();
try {
! log.finer("dispose");
stop();
dropRenderFrames();
isDisposed = true;
twkDestroyPage(pPage);
pPage = 0;
for (long frameID : frames) {
! log.fine("Undestroyed frame view: " + frameID);
}
frames.clear();
if (backbuffer != null) {
backbuffer.deref();
*** 1028,1040 ****
}
public String getName(long frameID) {
lockPage();
try {
! log.log(Level.FINE, "Get Name: frame = " + frameID);
if (isDisposed) {
! log.log(Level.FINE, "getName() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
}
--- 1023,1035 ----
}
public String getName(long frameID) {
lockPage();
try {
! log.fine("Get Name: frame = " + frameID);
if (isDisposed) {
! log.fine("getName() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
}
*** 1046,1058 ****
}
public String getURL(long frameID) {
lockPage();
try {
! log.log(Level.FINE, "Get URL: frame = " + frameID);
if (isDisposed) {
! log.log(Level.FINE, "getURL() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
}
--- 1041,1053 ----
}
public String getURL(long frameID) {
lockPage();
try {
! log.fine("Get URL: frame = " + frameID);
if (isDisposed) {
! log.fine("getURL() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
}
*** 1064,1076 ****
}
public String getEncoding() {
lockPage();
try {
! log.log(Level.FINE, "Get encoding");
if (isDisposed) {
! log.log(Level.FINE, "getEncoding() request for a disposed web page.");
return null;
}
return twkGetEncoding(getPage());
} finally {
--- 1059,1071 ----
}
public String getEncoding() {
lockPage();
try {
! log.fine("Get encoding");
if (isDisposed) {
! log.fine("getEncoding() request for a disposed web page.");
return null;
}
return twkGetEncoding(getPage());
} finally {
*** 1079,1091 ****
}
public void setEncoding(String encoding) {
lockPage();
try {
! log.log(Level.FINE, "Set encoding: encoding = " + encoding);
if (isDisposed) {
! log.log(Level.FINE, "setEncoding() request for a disposed web page.");
return;
}
if (encoding != null && !encoding.isEmpty()) {
twkSetEncoding(getPage(), encoding);
}
--- 1074,1086 ----
}
public void setEncoding(String encoding) {
lockPage();
try {
! log.fine("Set encoding: encoding = " + encoding);
if (isDisposed) {
! log.fine("setEncoding() request for a disposed web page.");
return;
}
if (encoding != null && !encoding.isEmpty()) {
twkSetEncoding(getPage(), encoding);
}
*** 1097,1109 ****
// DRT support
public String getInnerText(long frameID) {
lockPage();
try {
! log.log(Level.FINE, "Get inner text: frame = " + frameID);
if (isDisposed) {
! log.log(Level.FINE, "getInnerText() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
}
--- 1092,1104 ----
// DRT support
public String getInnerText(long frameID) {
lockPage();
try {
! log.fine("Get inner text: frame = " + frameID);
if (isDisposed) {
! log.fine("getInnerText() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
}
*** 1116,1128 ****
// DRT support
public String getRenderTree(long frameID) {
lockPage();
try {
! log.log(Level.FINE, "Get render tree: frame = " + frameID);
if (isDisposed) {
! log.log(Level.FINE, "getRenderTree() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
}
--- 1111,1123 ----
// DRT support
public String getRenderTree(long frameID) {
lockPage();
try {
! log.fine("Get render tree: frame = " + frameID);
if (isDisposed) {
! log.fine("getRenderTree() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
}
*** 1135,1147 ****
// DRT support
public int getUnloadEventListenersCount(long frameID) {
lockPage();
try {
! log.log(Level.FINE, "frame: " + frameID);
if (isDisposed) {
! log.log(Level.FINE, "request for a disposed web page.");
return 0;
}
if (!frames.contains(frameID)) {
return 0;
}
--- 1130,1142 ----
// DRT support
public int getUnloadEventListenersCount(long frameID) {
lockPage();
try {
! log.fine("frame: " + frameID);
if (isDisposed) {
! log.fine("request for a disposed web page.");
return 0;
}
if (!frames.contains(frameID)) {
return 0;
}
*** 1153,1165 ****
}
public String getContentType(long frameID) {
lockPage();
try {
! log.log(Level.FINE, "Get content type: frame = " + frameID);
if (isDisposed) {
! log.log(Level.FINE, "getContentType() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
}
--- 1148,1160 ----
}
public String getContentType(long frameID) {
lockPage();
try {
! log.fine("Get content type: frame = " + frameID);
if (isDisposed) {
! log.fine("getContentType() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
}
*** 1171,1183 ****
}
public String getTitle(long frameID) {
lockPage();
try {
! log.log(Level.FINE, "Get title: frame = " + frameID);
if (isDisposed) {
! log.log(Level.FINE, "getTitle() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
}
--- 1166,1178 ----
}
public String getTitle(long frameID) {
lockPage();
try {
! log.fine("Get title: frame = " + frameID);
if (isDisposed) {
! log.fine("getTitle() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
}
*** 1189,1201 ****
}
public WCImage getIcon(long frameID) {
lockPage();
try {
! log.log(Level.FINE, "Get icon: frame = " + frameID);
if (isDisposed) {
! log.log(Level.FINE, "getIcon() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
}
--- 1184,1196 ----
}
public WCImage getIcon(long frameID) {
lockPage();
try {
! log.fine("Get icon: frame = " + frameID);
if (isDisposed) {
! log.fine("getIcon() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
}
*** 1212,1224 ****
}
public void open(final long frameID, final String url) {
lockPage();
try {
! log.log(Level.FINE, "Open URL: " + url);
if (isDisposed) {
! log.log(Level.FINE, "open() request for a disposed web page.");
return;
}
if (!frames.contains(frameID)) {
return;
}
--- 1207,1219 ----
}
public void open(final long frameID, final String url) {
lockPage();
try {
! log.fine("Open URL: " + url);
if (isDisposed) {
! log.fine("open() request for a disposed web page.");
return;
}
if (!frames.contains(frameID)) {
return;
}
*** 1238,1253 ****
}
public void load(final long frameID, final String text, final String contentType) {
lockPage();
try {
! log.log(Level.FINE, "Load text: " + text);
if (text == null) {
return;
}
if (isDisposed) {
! log.log(Level.FINE, "load() request for a disposed web page.");
return;
}
if (!frames.contains(frameID)) {
return;
}
--- 1233,1248 ----
}
public void load(final long frameID, final String text, final String contentType) {
lockPage();
try {
! log.fine("Load text: " + text);
if (text == null) {
return;
}
if (isDisposed) {
! log.fine("load() request for a disposed web page.");
return;
}
if (!frames.contains(frameID)) {
return;
}
*** 1268,1283 ****
}
public void stop(final long frameID) {
lockPage();
try {
! log.log(Level.FINE, "Stop loading: frame = " + frameID);
String url;
String contentType;
if (isDisposed) {
! log.log(Level.FINE, "cancel() request for a disposed web page.");
return;
}
if (!frames.contains(frameID)) {
return;
}
--- 1263,1278 ----
}
public void stop(final long frameID) {
lockPage();
try {
! log.fine("Stop loading: frame = " + frameID);
String url;
String contentType;
if (isDisposed) {
! log.fine("cancel() request for a disposed web page.");
return;
}
if (!frames.contains(frameID)) {
return;
}
*** 1295,1307 ****
// stops all loading synchronously
public void stop() {
lockPage();
try {
! log.log(Level.FINE, "Stop loading sync");
if (isDisposed) {
! log.log(Level.FINE, "stopAll() request for a disposed web page.");
return;
}
twkStopAll(getPage());
} finally {
--- 1290,1302 ----
// stops all loading synchronously
public void stop() {
lockPage();
try {
! log.fine("Stop loading sync");
if (isDisposed) {
! log.fine("stopAll() request for a disposed web page.");
return;
}
twkStopAll(getPage());
} finally {
*** 1310,1322 ****
}
public void refresh(final long frameID) {
lockPage();
try {
! log.log(Level.FINE, "Refresh: frame = " + frameID);
if (isDisposed) {
! log.log(Level.FINE, "refresh() request for a disposed web page.");
return;
}
if (!frames.contains(frameID)) {
return;
}
--- 1305,1317 ----
}
public void refresh(final long frameID) {
lockPage();
try {
! log.fine("Refresh: frame = " + frameID);
if (isDisposed) {
! log.fine("refresh() request for a disposed web page.");
return;
}
if (!frames.contains(frameID)) {
return;
}
*** 1332,1344 ****
}
public boolean goBack() {
lockPage();
try {
! log.log(Level.FINE, "Go back");
if (isDisposed) {
! log.log(Level.FINE, "goBack() request for a disposed web page.");
return false;
}
return twkGoBackForward(getPage(), -1);
} finally {
--- 1327,1339 ----
}
public boolean goBack() {
lockPage();
try {
! log.fine("Go back");
if (isDisposed) {
! log.fine("goBack() request for a disposed web page.");
return false;
}
return twkGoBackForward(getPage(), -1);
} finally {
*** 1347,1359 ****
}
public boolean goForward() {
lockPage();
try {
! log.log(Level.FINE, "Go forward");
if (isDisposed) {
! log.log(Level.FINE, "goForward() request for a disposed web page.");
return false;
}
return twkGoBackForward(getPage(), 1);
} finally {
--- 1342,1354 ----
}
public boolean goForward() {
lockPage();
try {
! log.fine("Go forward");
if (isDisposed) {
! log.fine("goForward() request for a disposed web page.");
return false;
}
return twkGoBackForward(getPage(), 1);
} finally {
*** 1362,1374 ****
}
public boolean copy() {
lockPage();
try {
! log.log(Level.FINE, "Copy");
if (isDisposed) {
! log.log(Level.FINE, "copy() request for a disposed web page.");
return false;
}
long frameID = getMainFrame();
if (!frames.contains(frameID)) {
return false;
--- 1357,1369 ----
}
public boolean copy() {
lockPage();
try {
! log.fine("Copy");
if (isDisposed) {
! log.fine("copy() request for a disposed web page.");
return false;
}
long frameID = getMainFrame();
if (!frames.contains(frameID)) {
return false;
*** 1382,1395 ****
// Find in page
public boolean find(String stringToFind, boolean forward, boolean wrap, boolean matchCase) {
lockPage();
try {
! log.log(Level.FINE, "Find in page: stringToFind = " + stringToFind + ", " +
(forward ? "forward" : "backward") + (wrap ? ", wrap" : "") + (matchCase ? ", matchCase" : ""));
if (isDisposed) {
! log.log(Level.FINE, "find() request for a disposed web page.");
return false;
}
return twkFindInPage(getPage(), stringToFind, forward, wrap, matchCase);
} finally {
--- 1377,1390 ----
// Find in page
public boolean find(String stringToFind, boolean forward, boolean wrap, boolean matchCase) {
lockPage();
try {
! log.fine("Find in page: stringToFind = " + stringToFind + ", " +
(forward ? "forward" : "backward") + (wrap ? ", wrap" : "") + (matchCase ? ", matchCase" : ""));
if (isDisposed) {
! log.fine("find() request for a disposed web page.");
return false;
}
return twkFindInPage(getPage(), stringToFind, forward, wrap, matchCase);
} finally {
*** 1401,1414 ****
public boolean find(long frameID,
String stringToFind, boolean forward, boolean wrap, boolean matchCase)
{
lockPage();
try {
! log.log(Level.FINE, "Find in frame: stringToFind = " + stringToFind + ", " +
(forward ? "forward" : "backward") + (wrap ? ", wrap" : "") + (matchCase ? ", matchCase" : ""));
if (isDisposed) {
! log.log(Level.FINE, "find() request for a disposed web page.");
return false;
}
if (!frames.contains(frameID)) {
return false;
}
--- 1396,1409 ----
public boolean find(long frameID,
String stringToFind, boolean forward, boolean wrap, boolean matchCase)
{
lockPage();
try {
! log.fine("Find in frame: stringToFind = " + stringToFind + ", " +
(forward ? "forward" : "backward") + (wrap ? ", wrap" : "") + (matchCase ? ", matchCase" : ""));
if (isDisposed) {
! log.fine("find() request for a disposed web page.");
return false;
}
if (!frames.contains(frameID)) {
return false;
}
*** 1438,1450 ****
}
public float getZoomFactor(boolean textOnly) {
lockPage();
try {
! log.log(Level.FINE, "Get zoom factor, textOnly=" + textOnly);
if (isDisposed) {
! log.log(Level.FINE, "getZoomFactor() request for a disposed web page.");
return 1.0f;
}
long frameID = getMainFrame();
if (!frames.contains(frameID)) {
return 1.0f;
--- 1433,1445 ----
}
public float getZoomFactor(boolean textOnly) {
lockPage();
try {
! log.fine("Get zoom factor, textOnly=" + textOnly);
if (isDisposed) {
! log.fine("getZoomFactor() request for a disposed web page.");
return 1.0f;
}
long frameID = getMainFrame();
if (!frames.contains(frameID)) {
return 1.0f;
*** 1458,1468 ****
public void setZoomFactor(float zoomFactor, boolean textOnly) {
lockPage();
try {
log.fine(String.format("Set zoom factor %.2f, textOnly=%b", zoomFactor, textOnly));
if (isDisposed) {
! log.log(Level.FINE, "setZoomFactor() request for a disposed web page.");
return;
}
long frameID = getMainFrame();
if ((frameID == 0) || !frames.contains(frameID)) {
return;
--- 1453,1463 ----
public void setZoomFactor(float zoomFactor, boolean textOnly) {
lockPage();
try {
log.fine(String.format("Set zoom factor %.2f, textOnly=%b", zoomFactor, textOnly));
if (isDisposed) {
! log.fine("setZoomFactor() request for a disposed web page.");
return;
}
long frameID = getMainFrame();
if ((frameID == 0) || !frames.contains(frameID)) {
return;
*** 1480,1492 ****
// DRT support
public void reset(long frameID) {
lockPage();
try {
! log.log(Level.FINE, "Reset: frame = " + frameID);
if (isDisposed) {
! log.log(Level.FINE, "reset() request for a disposed web page.");
return;
}
if ((frameID == 0) || !frames.contains(frameID)) {
return;
}
--- 1475,1487 ----
// DRT support
public void reset(long frameID) {
lockPage();
try {
! log.fine("Reset: frame = " + frameID);
if (isDisposed) {
! log.fine("reset() request for a disposed web page.");
return;
}
if ((frameID == 0) || !frames.contains(frameID)) {
return;
}
*** 1498,1510 ****
}
public Object executeScript(long frameID, String script) throws JSException {
lockPage();
try {
! log.log(Level.FINE, "execute script: \"" + script + "\" in frame = " + frameID);
if (isDisposed) {
! log.log(Level.FINE, "executeScript() request for a disposed web page.");
return null;
}
if ((frameID == 0) || !frames.contains(frameID)) {
return null;
}
--- 1493,1505 ----
}
public Object executeScript(long frameID, String script) throws JSException {
lockPage();
try {
! log.fine("execute script: \"" + script + "\" in frame = " + frameID);
if (isDisposed) {
! log.fine("executeScript() request for a disposed web page.");
return null;
}
if ((frameID == 0) || !frames.contains(frameID)) {
return null;
}
*** 1516,1545 ****
}
public long getMainFrame() {
lockPage();
try {
! log.log(Level.FINER, "getMainFrame: page = " + pPage);
if (isDisposed) {
! log.log(Level.FINE, "getMainFrame() request for a disposed web page.");
return 0L;
}
long mainFrameID = twkGetMainFrame(getPage());
! log.log(Level.FINER, "Main frame = " + mainFrameID);
frames.add(mainFrameID);
return mainFrameID;
} finally {
unlockPage();
}
}
public long getParentFrame(long childID) {
lockPage();
try {
! log.log(Level.FINE, "getParentFrame: child = " + childID);
if (isDisposed) {
! log.log(Level.FINE, "getParentFrame() request for a disposed web page.");
return 0L;
}
if (!frames.contains(childID)) {
return 0L;
}
--- 1511,1540 ----
}
public long getMainFrame() {
lockPage();
try {
! log.finer("getMainFrame: page = " + pPage);
if (isDisposed) {
! log.fine("getMainFrame() request for a disposed web page.");
return 0L;
}
long mainFrameID = twkGetMainFrame(getPage());
! log.finer("Main frame = " + mainFrameID);
frames.add(mainFrameID);
return mainFrameID;
} finally {
unlockPage();
}
}
public long getParentFrame(long childID) {
lockPage();
try {
! log.fine("getParentFrame: child = " + childID);
if (isDisposed) {
! log.fine("getParentFrame() request for a disposed web page.");
return 0L;
}
if (!frames.contains(childID)) {
return 0L;
}
*** 1550,1562 ****
}
public List<Long> getChildFrames(long parentID) {
lockPage();
try {
! log.log(Level.FINE, "getChildFrames: parent = " + parentID);
if (isDisposed) {
! log.log(Level.FINE, "getChildFrames() request for a disposed web page.");
return null;
}
if (!frames.contains(parentID)) {
return null;
}
--- 1545,1557 ----
}
public List<Long> getChildFrames(long parentID) {
lockPage();
try {
! log.fine("getChildFrames: parent = " + parentID);
if (isDisposed) {
! log.fine("getChildFrames() request for a disposed web page.");
return null;
}
if (!frames.contains(parentID)) {
return null;
}
*** 1618,1630 ****
// ---- DOM ---- //
public Document getDocument(long frameID) {
lockPage();
try {
! log.log(Level.FINE, "getDocument");
if (isDisposed) {
! log.log(Level.FINE, "getDocument() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
--- 1613,1625 ----
// ---- DOM ---- //
public Document getDocument(long frameID) {
lockPage();
try {
! log.fine("getDocument");
if (isDisposed) {
! log.fine("getDocument() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
*** 1636,1648 ****
}
public Element getOwnerElement(long frameID) {
lockPage();
try {
! log.log(Level.FINE, "getOwnerElement");
if (isDisposed) {
! log.log(Level.FINE, "getOwnerElement() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
--- 1631,1643 ----
}
public Element getOwnerElement(long frameID) {
lockPage();
try {
! log.fine("getOwnerElement");
if (isDisposed) {
! log.fine("getOwnerElement() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
*** 1657,1743 ****
public boolean executeCommand(String command, String value) {
lockPage();
try {
if (log.isLoggable(Level.FINE)) {
! log.log(Level.FINE, "command: [{0}], value: [{1}]",
new Object[] {command, value});
}
if (isDisposed) {
! log.log(Level.FINE, "Web page is already disposed");
return false;
}
boolean result = twkExecuteCommand(getPage(), command, value);
! log.log(Level.FINE, "result: [{0}]", result);
return result;
} finally {
unlockPage();
}
}
public boolean queryCommandEnabled(String command) {
lockPage();
try {
! log.log(Level.FINE, "command: [{0}]", command);
if (isDisposed) {
! log.log(Level.FINE, "Web page is already disposed");
return false;
}
boolean result = twkQueryCommandEnabled(getPage(), command);
! log.log(Level.FINE, "result: [{0}]", result);
return result;
} finally {
unlockPage();
}
}
public boolean queryCommandState(String command) {
lockPage();
try {
! log.log(Level.FINE, "command: [{0}]", command);
if (isDisposed) {
! log.log(Level.FINE, "Web page is already disposed");
return false;
}
boolean result = twkQueryCommandState(getPage(), command);
! log.log(Level.FINE, "result: [{0}]", result);
return result;
} finally {
unlockPage();
}
}
public String queryCommandValue(String command) {
lockPage();
try {
! log.log(Level.FINE, "command: [{0}]", command);
if (isDisposed) {
! log.log(Level.FINE, "Web page is already disposed");
return null;
}
String result = twkQueryCommandValue(getPage(), command);
! log.log(Level.FINE, "result: [{0}]", result);
return result;
} finally {
unlockPage();
}
}
public boolean isEditable() {
lockPage();
try {
! log.log(Level.FINE, "isEditable");
if (isDisposed) {
! log.log(Level.FINE, "isEditable() request for a disposed web page.");
return false;
}
return twkIsEditable(getPage());
} finally {
--- 1652,1738 ----
public boolean executeCommand(String command, String value) {
lockPage();
try {
if (log.isLoggable(Level.FINE)) {
! log.fine("command: [{0}], value: [{1}]",
new Object[] {command, value});
}
if (isDisposed) {
! log.fine("Web page is already disposed");
return false;
}
boolean result = twkExecuteCommand(getPage(), command, value);
! log.fine("result: [{0}]", result);
return result;
} finally {
unlockPage();
}
}
public boolean queryCommandEnabled(String command) {
lockPage();
try {
! log.fine("command: [{0}]", command);
if (isDisposed) {
! log.fine("Web page is already disposed");
return false;
}
boolean result = twkQueryCommandEnabled(getPage(), command);
! log.fine("result: [{0}]", result);
return result;
} finally {
unlockPage();
}
}
public boolean queryCommandState(String command) {
lockPage();
try {
! log.fine("command: [{0}]", command);
if (isDisposed) {
! log.fine("Web page is already disposed");
return false;
}
boolean result = twkQueryCommandState(getPage(), command);
! log.fine("result: [{0}]", result);
return result;
} finally {
unlockPage();
}
}
public String queryCommandValue(String command) {
lockPage();
try {
! log.fine("command: [{0}]", command);
if (isDisposed) {
! log.fine("Web page is already disposed");
return null;
}
String result = twkQueryCommandValue(getPage(), command);
! log.fine("result: [{0}]", result);
return result;
} finally {
unlockPage();
}
}
public boolean isEditable() {
lockPage();
try {
! log.fine("isEditable");
if (isDisposed) {
! log.fine("isEditable() request for a disposed web page.");
return false;
}
return twkIsEditable(getPage());
} finally {
*** 1746,1758 ****
}
public void setEditable(boolean editable) {
lockPage();
try {
! log.log(Level.FINE, "setEditable");
if (isDisposed) {
! log.log(Level.FINE, "setEditable() request for a disposed web page.");
return;
}
twkSetEditable(getPage(), editable);
} finally {
--- 1741,1753 ----
}
public void setEditable(boolean editable) {
lockPage();
try {
! log.fine("setEditable");
if (isDisposed) {
! log.fine("setEditable() request for a disposed web page.");
return;
}
twkSetEditable(getPage(), editable);
} finally {
*** 1765,1777 ****
* or null if frame document is absent or non-HTML.
*/
public String getHtml(long frameID) {
lockPage();
try {
! log.log(Level.FINE, "getHtml");
if (isDisposed) {
! log.log(Level.FINE, "getHtml() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
}
--- 1760,1772 ----
* or null if frame document is absent or non-HTML.
*/
public String getHtml(long frameID) {
lockPage();
try {
! log.fine("getHtml");
if (isDisposed) {
! log.fine("getHtml() request for a disposed web page.");
return null;
}
if (!frames.contains(frameID)) {
return null;
}
*** 1873,1892 ****
}
public int getFrameHeight(long frameID) {
lockPage();
try {
! log.log(Level.FINE, "Get page height");
if (isDisposed) {
! log.log(Level.FINE, "getFrameHeight() request for a disposed web page.");
return 0;
}
if (!frames.contains(frameID)) {
return 0;
}
int height = twkGetFrameHeight(frameID);
! log.log(Level.FINE, "Height = " + height);
return height;
} finally {
unlockPage();
}
}
--- 1868,1887 ----
}
public int getFrameHeight(long frameID) {
lockPage();
try {
! log.fine("Get page height");
if (isDisposed) {
! log.fine("getFrameHeight() request for a disposed web page.");
return 0;
}
if (!frames.contains(frameID)) {
return 0;
}
int height = twkGetFrameHeight(frameID);
! log.fine("Height = " + height);
return height;
} finally {
unlockPage();
}
}
*** 1894,1906 ****
public float adjustFrameHeight(long frameID,
float oldTop, float oldBottom, float bottomLimit)
{
lockPage();
try {
! log.log(Level.FINE, "Adjust page height");
if (isDisposed) {
! log.log(Level.FINE, "adjustFrameHeight() request for a disposed web page.");
return 0;
}
if (!frames.contains(frameID)) {
return 0;
}
--- 1889,1901 ----
public float adjustFrameHeight(long frameID,
float oldTop, float oldBottom, float bottomLimit)
{
lockPage();
try {
! log.fine("Adjust page height");
if (isDisposed) {
! log.fine("adjustFrameHeight() request for a disposed web page.");
return 0;
}
if (!frames.contains(frameID)) {
return 0;
}
*** 1942,1966 ****
public boolean getDeveloperExtrasEnabled() {
lockPage();
try {
boolean result = twkGetDeveloperExtrasEnabled(getPage());
! log.log(Level.FINE,
! "Getting developerExtrasEnabled, result: [{0}]",
! result);
return result;
} finally {
unlockPage();
}
}
public void setDeveloperExtrasEnabled(boolean enabled) {
lockPage();
try {
! log.log(Level.FINE,
! "Setting developerExtrasEnabled, value: [{0}]",
! enabled);
twkSetDeveloperExtrasEnabled(getPage(), enabled);
} finally {
unlockPage();
}
}
--- 1937,1957 ----
public boolean getDeveloperExtrasEnabled() {
lockPage();
try {
boolean result = twkGetDeveloperExtrasEnabled(getPage());
! log.fine("Getting developerExtrasEnabled, result: [{0}]", result);
return result;
} finally {
unlockPage();
}
}
public void setDeveloperExtrasEnabled(boolean enabled) {
lockPage();
try {
! log.fine("Setting developerExtrasEnabled, value: [{0}]", enabled);
twkSetDeveloperExtrasEnabled(getPage(), enabled);
} finally {
unlockPage();
}
}
*** 2049,2083 ****
// ---- INSPECTOR SUPPORT ---- //
public void connectInspectorFrontend() {
lockPage();
try {
! log.log(Level.FINE, "Connecting inspector frontend");
twkConnectInspectorFrontend(getPage());
} finally {
unlockPage();
}
}
public void disconnectInspectorFrontend() {
lockPage();
try {
! log.log(Level.FINE, "Disconnecting inspector frontend");
twkDisconnectInspectorFrontend(getPage());
} finally {
unlockPage();
}
}
public void dispatchInspectorMessageFromFrontend(String message) {
lockPage();
try {
if (log.isLoggable(Level.FINE)) {
! log.log(Level.FINE,
! "Dispatching inspector message from frontend, "
! + "message: [{0}]",
! message);
}
twkDispatchInspectorMessageFromFrontend(getPage(), message);
} finally {
unlockPage();
}
--- 2040,2072 ----
// ---- INSPECTOR SUPPORT ---- //
public void connectInspectorFrontend() {
lockPage();
try {
! log.fine("Connecting inspector frontend");
twkConnectInspectorFrontend(getPage());
} finally {
unlockPage();
}
}
public void disconnectInspectorFrontend() {
lockPage();
try {
! log.fine("Disconnecting inspector frontend");
twkDisconnectInspectorFrontend(getPage());
} finally {
unlockPage();
}
}
public void dispatchInspectorMessageFromFrontend(String message) {
lockPage();
try {
if (log.isLoggable(Level.FINE)) {
! log.fine("Dispatching inspector message from frontend, "
! + "message: [{0}]", message);
}
twkDispatchInspectorMessageFromFrontend(getPage(), message);
} finally {
unlockPage();
}
*** 2086,2117 ****
// *************************************************************************
// Native callbacks
// *************************************************************************
private void fwkFrameCreated(long frameID) {
! log.log(Level.FINE, "Frame created: frame = " + frameID);
if (frames.contains(frameID)) {
! log.log(Level.FINE, "Error in fwkFrameCreated: frame is already in frames");
return;
}
frames.add(frameID);
}
private void fwkFrameDestroyed(long frameID) {
! log.log(Level.FINE, "Frame destroyed: frame = " + frameID);
if (!frames.contains(frameID)) {
! log.log(Level.FINE, "Error in fwkFrameDestroyed: frame is not found in frames");
return;
}
frames.remove(frameID);
}
private void fwkRepaint(int x, int y, int w, int h) {
lockPage();
try {
if (paintLog.isLoggable(Level.FINEST)) {
! paintLog.log(Level.FINEST, "x: {0}, y: {1}, w: {2}, h: {3}",
new Object[] {x, y, w, h});
}
addDirtyRect(new WCRectangle(x, y, w, h));
} finally {
unlockPage();
--- 2075,2106 ----
// *************************************************************************
// Native callbacks
// *************************************************************************
private void fwkFrameCreated(long frameID) {
! log.fine("Frame created: frame = " + frameID);
if (frames.contains(frameID)) {
! log.fine("Error in fwkFrameCreated: frame is already in frames");
return;
}
frames.add(frameID);
}
private void fwkFrameDestroyed(long frameID) {
! log.fine("Frame destroyed: frame = " + frameID);
if (!frames.contains(frameID)) {
! log.fine("Error in fwkFrameDestroyed: frame is not found in frames");
return;
}
frames.remove(frameID);
}
private void fwkRepaint(int x, int y, int w, int h) {
lockPage();
try {
if (paintLog.isLoggable(Level.FINEST)) {
! paintLog.finest("x: {0}, y: {1}, w: {2}, h: {3}",
new Object[] {x, y, w, h});
}
addDirtyRect(new WCRectangle(x, y, w, h));
} finally {
unlockPage();
*** 2129,2224 ****
}
scroll(x, y, w, h, deltaX, deltaY);
}
private void fwkTransferFocus(boolean forward) {
! log.log(Level.FINER, "Transfer focus " + (forward ? "forward" : "backward"));
if (pageClient != null) {
pageClient.transferFocus(forward);
}
}
private void fwkSetCursor(long id) {
! log.log(Level.FINER, "Set cursor: " + id);
if (pageClient != null) {
pageClient.setCursor(id);
}
}
private void fwkSetFocus(boolean focus) {
! log.log(Level.FINER, "Set focus: " + (focus ? "true" : "false"));
if (pageClient != null) {
pageClient.setFocus(focus);
}
}
private void fwkSetTooltip(String tooltip) {
! log.log(Level.FINER, "Set tooltip: " + tooltip);
if (pageClient != null) {
pageClient.setTooltip(tooltip);
}
}
private void fwkPrint() {
! log.log(Level.FINER, "Print");
if (uiClient != null) {
uiClient.print();
}
}
private void fwkSetRequestURL(long pFrame, int id, String url) {
! log.log(Level.FINER, "Set request URL: id = " + id + ", url = " + url);
synchronized (requestURLs) {
requestURLs.put(id, url);
}
}
private void fwkRemoveRequestURL(long pFrame, int id) {
! log.log(Level.FINER, "Set request URL: id = " + id);
synchronized (requestURLs) {
requestURLs.remove(id);
requestStarted.remove(id);
}
}
private WebPage fwkCreateWindow(
boolean menu, boolean status, boolean toolbar, boolean resizable) {
! log.log(Level.FINER, "Create window");
if (uiClient != null) {
return uiClient.createPage(menu, status, toolbar, resizable);
}
return null;
}
private void fwkShowWindow() {
! log.log(Level.FINER, "Show window");
if (uiClient != null) {
uiClient.showView();
}
}
private void fwkCloseWindow() {
! log.log(Level.FINER, "Close window");
if (permitCloseWindowAction()) {
if (uiClient != null) {
uiClient.closePage();
}
}
}
private WCRectangle fwkGetWindowBounds() {
! log.log(Level.FINE, "Get window bounds");
if (uiClient != null) {
WCRectangle bounds = uiClient.getViewBounds();
if (bounds != null) {
return bounds;
--- 2118,2213 ----
}
scroll(x, y, w, h, deltaX, deltaY);
}
private void fwkTransferFocus(boolean forward) {
! log.finer("Transfer focus " + (forward ? "forward" : "backward"));
if (pageClient != null) {
pageClient.transferFocus(forward);
}
}
private void fwkSetCursor(long id) {
! log.finer("Set cursor: " + id);
if (pageClient != null) {
pageClient.setCursor(id);
}
}
private void fwkSetFocus(boolean focus) {
! log.finer("Set focus: " + (focus ? "true" : "false"));
if (pageClient != null) {
pageClient.setFocus(focus);
}
}
private void fwkSetTooltip(String tooltip) {
! log.finer("Set tooltip: " + tooltip);
if (pageClient != null) {
pageClient.setTooltip(tooltip);
}
}
private void fwkPrint() {
! log.finer("Print");
if (uiClient != null) {
uiClient.print();
}
}
private void fwkSetRequestURL(long pFrame, int id, String url) {
! log.finer("Set request URL: id = " + id + ", url = " + url);
synchronized (requestURLs) {
requestURLs.put(id, url);
}
}
private void fwkRemoveRequestURL(long pFrame, int id) {
! log.finer("Set request URL: id = " + id);
synchronized (requestURLs) {
requestURLs.remove(id);
requestStarted.remove(id);
}
}
private WebPage fwkCreateWindow(
boolean menu, boolean status, boolean toolbar, boolean resizable) {
! log.finer("Create window");
if (uiClient != null) {
return uiClient.createPage(menu, status, toolbar, resizable);
}
return null;
}
private void fwkShowWindow() {
! log.finer("Show window");
if (uiClient != null) {
uiClient.showView();
}
}
private void fwkCloseWindow() {
! log.finer("Close window");
if (permitCloseWindowAction()) {
if (uiClient != null) {
uiClient.closePage();
}
}
}
private WCRectangle fwkGetWindowBounds() {
! log.fine("Get window bounds");
if (uiClient != null) {
WCRectangle bounds = uiClient.getViewBounds();
if (bounds != null) {
return bounds;
*** 2226,2261 ****
}
return fwkGetPageBounds();
}
private void fwkSetWindowBounds(int x, int y, int w, int h) {
! log.log(Level.FINER, "Set window bounds: " + x + " " + y + " " + w + " " + h);
if (uiClient != null) {
uiClient.setViewBounds(new WCRectangle(x, y, w, h));
}
}
private WCRectangle fwkGetPageBounds() {
! log.log(Level.FINER, "Get page bounds");
return new WCRectangle(0, 0, width, height);
}
private void fwkSetScrollbarsVisible(boolean visible) {
// TODO: handle this request internally
}
private void fwkSetStatusbarText(String text) {
! log.log(Level.FINER, "Set statusbar text: " + text);
if (uiClient != null) {
uiClient.setStatusbarText(text);
}
}
private String[] fwkChooseFile(String initialFileName, boolean multiple, String mimeFilters) {
! log.log(Level.FINER, "Choose file, initial=" + initialFileName);
return uiClient != null
? uiClient.chooseFile(initialFileName, multiple, mimeFilters)
: null;
}
--- 2215,2250 ----
}
return fwkGetPageBounds();
}
private void fwkSetWindowBounds(int x, int y, int w, int h) {
! log.finer("Set window bounds: " + x + " " + y + " " + w + " " + h);
if (uiClient != null) {
uiClient.setViewBounds(new WCRectangle(x, y, w, h));
}
}
private WCRectangle fwkGetPageBounds() {
! log.finer("Get page bounds");
return new WCRectangle(0, 0, width, height);
}
private void fwkSetScrollbarsVisible(boolean visible) {
// TODO: handle this request internally
}
private void fwkSetStatusbarText(String text) {
! log.finer("Set statusbar text: " + text);
if (uiClient != null) {
uiClient.setStatusbarText(text);
}
}
private String[] fwkChooseFile(String initialFileName, boolean multiple, String mimeFilters) {
! log.finer("Choose file, initial=" + initialFileName);
return uiClient != null
? uiClient.chooseFile(initialFileName, multiple, mimeFilters)
: null;
}
*** 2265,2275 ****
int imageOffsetX, int imageOffsetY,
int eventPosX, int eventPosY,
String[] mimeTypes, Object[] values,
boolean isImageSource)
{
! log.log(Level.FINER, "Start drag: ");
if (uiClient != null) {
uiClient.startDrag(
WCImage.getImage(image),
imageOffsetX, imageOffsetY,
eventPosX, eventPosY,
--- 2254,2264 ----
int imageOffsetX, int imageOffsetY,
int eventPosX, int eventPosY,
String[] mimeTypes, Object[] values,
boolean isImageSource)
{
! log.finer("Start drag: ");
if (uiClient != null) {
uiClient.startDrag(
WCImage.getImage(image),
imageOffsetX, imageOffsetY,
eventPosX, eventPosY,
*** 2277,2380 ****
isImageSource);
}
}
private WCPoint fwkScreenToWindow(WCPoint ptScreen) {
! log.log(Level.FINER, "fwkScreenToWindow");
if (pageClient != null) {
return pageClient.screenToWindow(ptScreen);
}
return ptScreen;
}
private WCPoint fwkWindowToScreen(WCPoint ptWindow) {
! log.log(Level.FINER, "fwkWindowToScreen");
if (pageClient != null) {
return pageClient.windowToScreen(ptWindow);
}
return ptWindow;
}
private void fwkAlert(String text) {
! log.log(Level.FINE, "JavaScript alert(): text = " + text);
if (uiClient != null) {
uiClient.alert(text);
}
}
private boolean fwkConfirm(String text) {
! log.log(Level.FINE, "JavaScript confirm(): text = " + text);
if (uiClient != null) {
return uiClient.confirm(text);
}
return false;
}
private String fwkPrompt(String text, String defaultValue) {
! log.log(Level.FINE, "JavaScript prompt(): text = " + text + ", default = " + defaultValue);
if (uiClient != null) {
return uiClient.prompt(text, defaultValue);
}
return null;
}
private boolean fwkCanRunBeforeUnloadConfirmPanel() {
! log.log(Level.FINE, "JavaScript canRunBeforeUnloadConfirmPanel()");
if (uiClient != null) {
return uiClient.canRunBeforeUnloadConfirmPanel();
}
return false;
}
private boolean fwkRunBeforeUnloadConfirmPanel(String message) {
! log.log(Level.FINE, "JavaScript runBeforeUnloadConfirmPanel(): message = " + message);
if (uiClient != null) {
return uiClient.runBeforeUnloadConfirmPanel(message);
}
return false;
}
private void fwkAddMessageToConsole(String message, int lineNumber,
String sourceId)
{
! log.log(Level.FINE, "fwkAddMessageToConsole(): message = " + message
+ ", lineNumber = " + lineNumber + ", sourceId = " + sourceId);
if (pageClient != null) {
pageClient.addMessageToConsole(message, lineNumber, sourceId);
}
}
private void fwkFireLoadEvent(long frameID, int state,
String url, String contentType,
double progress, int errorCode)
{
! log.log(Level.FINER, "Load event: pFrame = " + frameID + ", state = " + state +
", url = " + url + ", contenttype=" + contentType +
", progress = " + progress + ", error = " + errorCode);
fireLoadEvent(frameID, state, url, contentType, progress, errorCode);
}
private void fwkFireResourceLoadEvent(long frameID, int state,
int id, String contentType,
double progress, int errorCode)
{
! log.log(Level.FINER, "Resource load event: pFrame = " + frameID + ", state = " + state +
", id = " + id + ", contenttype=" + contentType +
", progress = " + progress + ", error = " + errorCode);
String url = requestURLs.get(id);
if (url == null) {
! log.log(Level.FINE, "Error in fwkFireResourceLoadEvent: unknown request id " + id);
return;
}
int eventState = state;
// convert second and all subsequent STARTED into REDIRECTED
--- 2266,2369 ----
isImageSource);
}
}
private WCPoint fwkScreenToWindow(WCPoint ptScreen) {
! log.finer("fwkScreenToWindow");
if (pageClient != null) {
return pageClient.screenToWindow(ptScreen);
}
return ptScreen;
}
private WCPoint fwkWindowToScreen(WCPoint ptWindow) {
! log.finer("fwkWindowToScreen");
if (pageClient != null) {
return pageClient.windowToScreen(ptWindow);
}
return ptWindow;
}
private void fwkAlert(String text) {
! log.fine("JavaScript alert(): text = " + text);
if (uiClient != null) {
uiClient.alert(text);
}
}
private boolean fwkConfirm(String text) {
! log.fine("JavaScript confirm(): text = " + text);
if (uiClient != null) {
return uiClient.confirm(text);
}
return false;
}
private String fwkPrompt(String text, String defaultValue) {
! log.fine("JavaScript prompt(): text = " + text + ", default = " + defaultValue);
if (uiClient != null) {
return uiClient.prompt(text, defaultValue);
}
return null;
}
private boolean fwkCanRunBeforeUnloadConfirmPanel() {
! log.fine("JavaScript canRunBeforeUnloadConfirmPanel()");
if (uiClient != null) {
return uiClient.canRunBeforeUnloadConfirmPanel();
}
return false;
}
private boolean fwkRunBeforeUnloadConfirmPanel(String message) {
! log.fine("JavaScript runBeforeUnloadConfirmPanel(): message = " + message);
if (uiClient != null) {
return uiClient.runBeforeUnloadConfirmPanel(message);
}
return false;
}
private void fwkAddMessageToConsole(String message, int lineNumber,
String sourceId)
{
! log.fine("fwkAddMessageToConsole(): message = " + message
+ ", lineNumber = " + lineNumber + ", sourceId = " + sourceId);
if (pageClient != null) {
pageClient.addMessageToConsole(message, lineNumber, sourceId);
}
}
private void fwkFireLoadEvent(long frameID, int state,
String url, String contentType,
double progress, int errorCode)
{
! log.finer("Load event: pFrame = " + frameID + ", state = " + state +
", url = " + url + ", contenttype=" + contentType +
", progress = " + progress + ", error = " + errorCode);
fireLoadEvent(frameID, state, url, contentType, progress, errorCode);
}
private void fwkFireResourceLoadEvent(long frameID, int state,
int id, String contentType,
double progress, int errorCode)
{
! log.finer("Resource load event: pFrame = " + frameID + ", state = " + state +
", id = " + id + ", contenttype=" + contentType +
", progress = " + progress + ", error = " + errorCode);
String url = requestURLs.get(id);
if (url == null) {
! log.fine("Error in fwkFireResourceLoadEvent: unknown request id " + id);
return;
}
int eventState = state;
// convert second and all subsequent STARTED into REDIRECTED
*** 2388,2427 ****
fireResourceLoadEvent(frameID, eventState, url, contentType, progress, errorCode);
}
private boolean fwkPermitNavigateAction(long pFrame, String url) {
! log.log(Level.FINE, "Policy: permit NAVIGATE: pFrame = " + pFrame + ", url = " + url);
if (policyClient != null) {
return policyClient.permitNavigateAction(pFrame, str2url(url));
}
return true;
}
private boolean fwkPermitRedirectAction(long pFrame, String url) {
! log.log(Level.FINE, "Policy: permit REDIRECT: pFrame = " + pFrame + ", url = " + url);
if (policyClient != null) {
return policyClient.permitRedirectAction(pFrame, str2url(url));
}
return true;
}
private boolean fwkPermitAcceptResourceAction(long pFrame, String url) {
! log.log(Level.FINE, "Policy: permit ACCEPT_RESOURCE: pFrame + " + pFrame + ", url = " + url);
if (policyClient != null) {
return policyClient.permitAcceptResourceAction(pFrame, str2url(url));
}
return true;
}
private boolean fwkPermitSubmitDataAction(long pFrame, String url,
String httpMethod, boolean isSubmit)
{
! log.log(Level.FINE, "Policy: permit " + (isSubmit ? "" : "RE") + "SUBMIT_DATA: pFrame = " +
pFrame + ", url = " + url + ", httpMethod = " + httpMethod);
if (policyClient != null) {
if (isSubmit) {
return policyClient.permitSubmitDataAction(pFrame, str2url(url), httpMethod);
--- 2377,2416 ----
fireResourceLoadEvent(frameID, eventState, url, contentType, progress, errorCode);
}
private boolean fwkPermitNavigateAction(long pFrame, String url) {
! log.fine("Policy: permit NAVIGATE: pFrame = " + pFrame + ", url = " + url);
if (policyClient != null) {
return policyClient.permitNavigateAction(pFrame, str2url(url));
}
return true;
}
private boolean fwkPermitRedirectAction(long pFrame, String url) {
! log.fine("Policy: permit REDIRECT: pFrame = " + pFrame + ", url = " + url);
if (policyClient != null) {
return policyClient.permitRedirectAction(pFrame, str2url(url));
}
return true;
}
private boolean fwkPermitAcceptResourceAction(long pFrame, String url) {
! log.fine("Policy: permit ACCEPT_RESOURCE: pFrame + " + pFrame + ", url = " + url);
if (policyClient != null) {
return policyClient.permitAcceptResourceAction(pFrame, str2url(url));
}
return true;
}
private boolean fwkPermitSubmitDataAction(long pFrame, String url,
String httpMethod, boolean isSubmit)
{
! log.fine("Policy: permit " + (isSubmit ? "" : "RE") + "SUBMIT_DATA: pFrame = " +
pFrame + ", url = " + url + ", httpMethod = " + httpMethod);
if (policyClient != null) {
if (isSubmit) {
return policyClient.permitSubmitDataAction(pFrame, str2url(url), httpMethod);
*** 2431,2487 ****
}
return true;
}
private boolean fwkPermitEnableScriptsAction(long pFrame, String url) {
! log.log(Level.FINE, "Policy: permit ENABLE_SCRIPTS: pFrame + " + pFrame + ", url = " + url);
if (policyClient != null) {
return policyClient.permitEnableScriptsAction(pFrame, str2url(url));
}
return true;
}
private boolean fwkPermitNewWindowAction(long pFrame, String url) {
! log.log(Level.FINE, "Policy: permit NEW_PAGE: pFrame = " + pFrame + ", url = " + url);
if (policyClient != null) {
return policyClient.permitNewPageAction(pFrame, str2url(url));
}
return true;
}
// Called from fwkCloseWindow, that's why no "fwk" prefix
private boolean permitCloseWindowAction() {
! log.log(Level.FINE, "Policy: permit CLOSE_PAGE");
if (policyClient != null) {
// Unfortunately, webkit doesn't provide an information about what
// web frame initiated close window request, so using main frame here
return policyClient.permitClosePageAction(getMainFrame());
}
return true;
}
private void fwkRepaintAll() {
! log.log(Level.FINE, "Repainting the entire page");
repaintAll();
}
private boolean fwkSendInspectorMessageToFrontend(String message) {
if (log.isLoggable(Level.FINE)) {
! log.log(Level.FINE,
! "Sending inspector message to frontend, message: [{0}]",
message);
}
boolean result = false;
if (inspectorClient != null) {
! log.log(Level.FINE, "Invoking inspector client");
result = inspectorClient.sendMessageToFrontend(message);
}
if (log.isLoggable(Level.FINE)) {
! log.log(Level.FINE, "Result: [{0}]", result);
}
return result;
}
// ---- DumpRenderTree support ---- //
--- 2420,2475 ----
}
return true;
}
private boolean fwkPermitEnableScriptsAction(long pFrame, String url) {
! log.fine("Policy: permit ENABLE_SCRIPTS: pFrame + " + pFrame + ", url = " + url);
if (policyClient != null) {
return policyClient.permitEnableScriptsAction(pFrame, str2url(url));
}
return true;
}
private boolean fwkPermitNewWindowAction(long pFrame, String url) {
! log.fine("Policy: permit NEW_PAGE: pFrame = " + pFrame + ", url = " + url);
if (policyClient != null) {
return policyClient.permitNewPageAction(pFrame, str2url(url));
}
return true;
}
// Called from fwkCloseWindow, that's why no "fwk" prefix
private boolean permitCloseWindowAction() {
! log.fine("Policy: permit CLOSE_PAGE");
if (policyClient != null) {
// Unfortunately, webkit doesn't provide an information about what
// web frame initiated close window request, so using main frame here
return policyClient.permitClosePageAction(getMainFrame());
}
return true;
}
private void fwkRepaintAll() {
! log.fine("Repainting the entire page");
repaintAll();
}
private boolean fwkSendInspectorMessageToFrontend(String message) {
if (log.isLoggable(Level.FINE)) {
! log.fine("Sending inspector message to frontend, message: [{0}]",
message);
}
boolean result = false;
if (inspectorClient != null) {
! log.fine("Invoking inspector client");
result = inspectorClient.sendMessageToFrontend(message);
}
if (log.isLoggable(Level.FINE)) {
! log.fine("Result: [{0}]", result);
}
return result;
}
// ---- DumpRenderTree support ---- //
*** 2504,2514 ****
private URL str2url(String url) {
try {
return newURL(url);
} catch (MalformedURLException ex) {
! log.log(Level.FINE, "Exception while converting \"" + url + "\" to URL", ex);
}
return null;
}
private void fireLoadEvent(long frameID, int state, String url,
--- 2492,2502 ----
private URL str2url(String url) {
try {
return newURL(url);
} catch (MalformedURLException ex) {
! log.fine("Exception while converting \"" + url + "\" to URL", ex);
}
return null;
}
private void fireLoadEvent(long frameID, int state, String url,
< prev index next >