Skip to content
Permalink
Browse files

8259635: Update to 610.2 version of WebKit

Reviewed-by: kcr, ghb, jvos
  • Loading branch information
arun-Joseph committed Jan 29, 2021
1 parent 6c1a0ca commit b0a404de731861a29d4d5130afac8cb9a1a8096a
Showing 5,412 changed files with 161,472 additions and 130,053 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
@@ -652,12 +652,7 @@ public void addMessageToConsole(String message, int lineNumber,
message = s1 + s2;
}
}
if (lineNumber == 0) {
out.printf("CONSOLE MESSAGE: %s\n", message);
} else {
out.printf("CONSOLE MESSAGE: line %d: %s\n",
lineNumber, message);
}
out.printf("CONSOLE MESSAGE: %s\n", message);
}

@Override
@@ -503,19 +503,17 @@ protected boolean shouldCalculateIntersection() {
}

@Override
public void fillRect(final float x, final float y, final float w, final float h, final Integer rgba) {
public void fillRect(final float x, final float y, final float w, final float h, final Color color) {
if (log.isLoggable(Level.FINE)) {
String format = (rgba != null)
? "fillRect(%f, %f, %f, %f, 0x%x)"
: "fillRect(%f, %f, %f, %f, null)";
log.fine(String.format(format, x, y, w, h, rgba));
String format = "fillRect(%f, %f, %f, %f, %s)";
log.fine(String.format(format, x, y, w, h, color));
}
if (!shouldRenderRect(x, y, w, h, state.getShadowNoClone(), null)) {
return;
}
new Composite() {
@Override void doPaint(Graphics g) {
Paint paint = (rgba != null) ? createColor(rgba) : state.getPaintNoClone();
Paint paint = (color != null) ? color : state.getPaintNoClone();
DropShadow shadow = state.getShadowNoClone();
// TextureMapperJava::drawSolidColor calls fillRect with perspective
// projection.
@@ -535,13 +533,13 @@ public void fillRect(final float x, final float y, final float w, final float h,
public void fillRoundedRect(final float x, final float y, final float w, final float h,
final float topLeftW, final float topLeftH, final float topRightW, final float topRightH,
final float bottomLeftW, final float bottomLeftH, final float bottomRightW, final float bottomRightH,
final int rgba)
final Color color)
{
if (log.isLoggable(Level.FINE)) {
log.fine(String.format("fillRoundedRect(%f, %f, %f, %f, "
+ "%f, %f, %f, %f, %f, %f, %f, %f, 0x%x)",
+ "%f, %f, %f, %f, %f, %f, %f, %f, %s)",
x, y, w, h, topLeftW, topLeftH, topRightW, topRightH,
bottomLeftW, bottomLeftH, bottomRightW, bottomRightH, rgba));
bottomLeftW, bottomLeftH, bottomRightW, bottomRightH, color));
}
if (!shouldRenderRect(x, y, w, h, state.getShadowNoClone(), null)) {
return;
@@ -554,14 +552,13 @@ public void fillRoundedRect(final float x, final float y, final float w, final f
float arcW = (topLeftW + topRightW + bottomLeftW + bottomRightW) / 2;
float arcH = (topLeftH + topRightH + bottomLeftH + bottomRightH) / 2;

Paint paint = createColor(rgba);
DropShadow shadow = state.getShadowNoClone();
if (shadow != null) {
final NGRectangle node = new NGRectangle();
node.updateRectangle(x, y, w, h, arcW, arcH);
render(g, shadow, paint, null, node);
render(g, shadow, color, null, node);
} else {
g.setPaint(paint);
g.setPaint(color);
g.fillRoundRect(x, y, w, h, arcW, arcH);
}
}
@@ -585,11 +582,11 @@ public void clearRect(final float x, final float y, final float w, final float h
}

@Override
public void setFillColor(int rgba) {
public void setFillColor(Color color) {
if (log.isLoggable(Level.FINE)) {
log.fine(String.format("setFillColor(0x%x)", rgba));
log.fine(String.format("setFillColor(%s)", color));
}
state.setPaint(createColor(rgba));
state.setPaint(color);
}

@Override
@@ -627,11 +624,11 @@ public void setStrokeStyle(int style) {
}

@Override
public void setStrokeColor(int rgba) {
public void setStrokeColor(Color color) {
if (log.isLoggable(Level.FINE)) {
log.fine(String.format("setStrokeColor(0x%x)", rgba));
log.fine(String.format("setStrokeColor(%s)", color));
}
state.getStrokeNoClone().setPaint(createColor(rgba));
state.getStrokeNoClone().setPaint(color);
}

@Override
@@ -701,12 +698,12 @@ public void setMiterLimit(float miterLimit) {
}

@Override
public void setShadow(float dx, float dy, float blur, int rgba) {
public void setShadow(float dx, float dy, float blur, Color color) {
if (log.isLoggable(Level.FINE)) {
String format = "setShadow(%f, %f, %f, 0x%x)";
log.fine(String.format(format, dx, dy, blur, rgba));
String format = "setShadow(%f, %f, %f, %s)";
log.fine(String.format(format, dx, dy, blur, color));
}
state.setShadow(createShadow(dx, dy, blur, rgba));
state.setShadow(createShadow(dx, dy, blur, color));
}

@Override
@@ -1018,16 +1015,16 @@ public void drawEllipse(final int x, final int y, final int w, final int h) {
new float[] {1.0f}, 0.0f);

@Override
public void drawFocusRing(final int x, final int y, final int w, final int h, final int rgba) {
public void drawFocusRing(final int x, final int y, final int w, final int h, final Color color) {
if (log.isLoggable(Level.FINE)) {
log.fine(String.format("drawFocusRing: %d, %d, %d, %d, 0x%x", x, y, w, h, rgba));
log.fine(String.format("drawFocusRing: %d, %d, %d, %d, %s", x, y, w, h, color));
}
if (!shouldRenderRect(x, y, w, h, null, focusRingStroke)) {
return;
}
new Composite() {
@Override void doPaint(Graphics g) {
g.setPaint(createColor(rgba));
g.setPaint(color);
BasicStroke stroke = g.getStroke();
g.setStroke(focusRingStroke);
g.drawRoundRect(x, y, w, h, 4, 4);
@@ -1115,31 +1112,22 @@ private static Rectangle intersect(Rectangle what, Rectangle with) {
return what;
}

static Color createColor(int rgba) {
float a = (0xFF & (rgba >> 24)) / 255.0f;
float r = (0xFF & (rgba >> 16)) / 255.0f;
float g = (0xFF & (rgba >> 8)) / 255.0f;
float b = (0xFF & (rgba)) / 255.0f;
return new Color(r, g, b, a);
}

private static Color4f createColor4f(int rgba) {
float a = (0xFF & (rgba >> 24)) / 255.0f;
float r = (0xFF & (rgba >> 16)) / 255.0f;
float g = (0xFF & (rgba >> 8)) / 255.0f;
float b = (0xFF & (rgba)) / 255.0f;
return new Color4f(r, g, b, a);
private static Color4f createColor4f(Color color) {
return new Color4f(color.getRed(),
color.getGreen(),
color.getBlue(),
color.getAlpha());
}

private DropShadow createShadow(float dx, float dy, float blur, int rgba) {
private DropShadow createShadow(float dx, float dy, float blur, Color color) {
if (dx == 0f && dy == 0f && blur == 0f) {
return null;
}
DropShadow shadow = new DropShadow();
shadow.setOffsetX((int) dx);
shadow.setOffsetY((int) dy);
shadow.setRadius((blur < 0f) ? 0f : (blur > 127f) ? 127f : blur);
shadow.setColor(createColor4f(rgba));
shadow.setColor(createColor4f(color));
return shadow;
}

@@ -25,6 +25,7 @@

package com.sun.javafx.webkit.prism;

import com.sun.prism.paint.Color;
import com.sun.prism.paint.LinearGradient;
import com.sun.prism.paint.Stop;
import com.sun.webkit.graphics.WCGradient;
@@ -47,8 +48,8 @@
}

@Override
protected void addStop(int argb, float offset) {
this.stops.add(new Stop(WCGraphicsPrismContext.createColor(argb), offset));
protected void addStop(Color color, float offset) {
this.stops.add(new Stop(color, offset));
}

public LinearGradient getPlatformGradient() {
@@ -48,6 +48,7 @@
import com.sun.media.jfxmedia.track.VideoTrack;
import com.sun.prism.Graphics;
import com.sun.prism.Texture;
import com.sun.prism.paint.Color;
import com.sun.webkit.graphics.WCGraphicsContext;
import com.sun.webkit.graphics.WCMediaPlayer;

@@ -355,7 +356,7 @@ private void renderImpl(WCGraphicsContext gc, int x, int y, int w, int h) {
texture.unlock();
} else {
log.finest(" (Prism)renderImpl, texture is null, draw black rect");
gc.fillRect(x, y, w, h, 0xFF000000);
gc.fillRect(x, y, w, h, Color.BLACK);
}
log.finer("<<(Prism)renderImpl");
}
@@ -239,23 +239,8 @@ public void closeSubpath() {
path.closePath();
}

public boolean hasCurrentPoint() {
return hasCP;
}

public boolean isEmpty() {
PathIterator pi = path.getPathIterator(null);
float [] coords = new float[6];
while(!pi.isDone()) {
switch(pi.currentSegment(coords)) {
case PathIterator.SEG_LINETO:
case PathIterator.SEG_QUADTO:
case PathIterator.SEG_CUBICTO:
return false;
}
pi.next();
}
return true;
return !hasCP;
}

public int getWindingRule() {
@@ -25,6 +25,7 @@

package com.sun.javafx.webkit.prism;

import com.sun.prism.paint.Color;
import com.sun.prism.paint.RadialGradient;
import com.sun.prism.paint.Stop;
import com.sun.webkit.graphics.WCGradient;
@@ -70,12 +71,12 @@
}

@Override
protected void addStop(int argb, float offset) {
protected void addStop(Color color, float offset) {
if (this.reverse) {
offset = 1.0f - offset;
}
offset = 1.0f - offset + offset * this.r2 * this.r1over;
this.stops.add(new Stop(WCGraphicsPrismContext.createColor(argb), offset));
this.stops.add(new Stop(color, offset));
}

public RadialGradient getPlatformGradient() {
@@ -26,6 +26,7 @@
package com.sun.webkit.graphics;

import com.sun.javafx.logging.PlatformLogger;
import com.sun.prism.paint.Color;

import java.lang.annotation.Native;
import java.nio.ByteBuffer;
@@ -112,7 +113,7 @@ static void decode(WCGraphicsManager gm, WCGraphicsContext gc, BufferData bdata)
buf.getFloat(),
buf.getFloat(),
buf.getFloat(),
buf.getInt());
getColor(buf));
break;
case FILL_ROUNDED_RECT:
gc.fillRoundedRect(
@@ -122,7 +123,7 @@ static void decode(WCGraphicsManager gm, WCGraphicsContext gc, BufferData bdata)
buf.getFloat(), buf.getFloat(), buf.getFloat(), buf.getFloat(),
// bottom corners w/h
buf.getFloat(), buf.getFloat(), buf.getFloat(), buf.getFloat(),
buf.getInt());
getColor(buf));
break;
case CLEARRECT_FFFF:
gc.clearRect(
@@ -140,7 +141,7 @@ static void decode(WCGraphicsManager gm, WCGraphicsContext gc, BufferData bdata)
buf.getFloat());
break;
case SETFILLCOLOR:
gc.setFillColor(buf.getInt());
gc.setFillColor(getColor(buf));
break;
case SET_TEXT_MODE:
gc.setTextMode(getBoolean(buf), getBoolean(buf), getBoolean(buf));
@@ -149,7 +150,7 @@ static void decode(WCGraphicsManager gm, WCGraphicsContext gc, BufferData bdata)
gc.setStrokeStyle(buf.getInt());
break;
case SETSTROKECOLOR:
gc.setStrokeColor(buf.getInt());
gc.setStrokeColor(getColor(buf));
break;
case SETSTROKEWIDTH:
gc.setStrokeWidth(buf.getFloat());
@@ -265,7 +266,7 @@ static void decode(WCGraphicsManager gm, WCGraphicsContext gc, BufferData bdata)
buf.getInt(),
buf.getInt(),
buf.getInt(),
buf.getInt());
getColor(buf));
break;
case SETALPHA:
gc.setAlpha(buf.getFloat());
@@ -287,7 +288,7 @@ static void decode(WCGraphicsManager gm, WCGraphicsContext gc, BufferData bdata)
buf.getFloat(),
buf.getFloat(),
buf.getFloat(),
buf.getInt());
getColor(buf));
break;
case DRAWSTRING:
gc.drawString(
@@ -473,6 +474,13 @@ private static WCRectangle getRectangle(ByteBuffer buf) {
buf.getFloat());
}

private static Color getColor(ByteBuffer buf) {
return new Color(buf.getFloat(),
buf.getFloat(),
buf.getFloat(),
buf.getFloat());
}

private static WCGradient getGradient(WCGraphicsContext gc, ByteBuffer buf) {
WCPoint p1 = getPoint(buf);
WCPoint p2 = getPoint(buf);
@@ -488,7 +496,7 @@ private static WCGradient getGradient(WCGraphicsContext gc, ByteBuffer buf) {
}
int count = buf.getInt();
for (int i = 0; i < count; i++) {
int color = buf.getInt();
Color color = getColor(buf);
float offset = buf.getFloat();
if (gradient != null) {
gradient.addStop(color, offset);
@@ -29,6 +29,8 @@
import java.util.HashMap;
import java.util.Map;

import com.sun.prism.paint.Color;

final class RenderMediaControls {
/**
* Media control part constants (types for the paintControl method)
@@ -127,9 +129,9 @@ static void paintControl(WCGraphicsContext gc,
}
}

private static final int TimeSliderTrackUnbufferedColor =
private static final Color TimeSliderTrackUnbufferedColor =
rgba(0xec, 0x87, 0x7d);
private static final int TimeSliderTrackBufferedColor =
private static final Color TimeSliderTrackBufferedColor =
rgba(0xf9, 0x1a, 0x02);
private static final int TimeSliderTrackThickness = 3;

@@ -197,7 +199,7 @@ static void paintTimeSliderTrack(WCGraphicsContext gc,
}
}

private static final int VolumeTrackColor = rgba(0xd0, 0xd0, 0xd0, 0x80);
private static final Color VolumeTrackColor = rgba(0xd0, 0xd0, 0xd0, 0x80);
private static final int VolumeTrackThickness = 1;

static void paintVolumeTrack(WCGraphicsContext gc,
@@ -277,10 +279,13 @@ private static void paintControlImage(String resName,
}
}

private static int rgba(int r, int g, int b, int a) {
return ((a & 0xFF) << 24) |((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF);
private static Color rgba(int r, int g, int b, int a) {
return new Color((r & 0xFF) / 255.0f,
(g & 0xFF) / 255.0f,
(b & 0xFF) / 255.0f,
(a & 0xFF) / 255.0f);
}
private static int rgba(int r, int g, int b) {
private static Color rgba(int r, int g, int b) {
return rgba(r, g, b, 0xFF);
}

1 comment on commit b0a404d

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on b0a404d Jan 29, 2021

Please sign in to comment.