Skip to content

Commit b0a404d

Browse files
committed
8259635: Update to 610.2 version of WebKit
Reviewed-by: kcr, ghb, jvos
1 parent 6c1a0ca commit b0a404d

File tree

5,412 files changed

+161472
-130053
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,412 files changed

+161472
-130053
lines changed

modules/javafx.web/src/main/java/com/sun/javafx/webkit/drt/DumpRenderTree.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -652,12 +652,7 @@ public void addMessageToConsole(String message, int lineNumber,
652652
message = s1 + s2;
653653
}
654654
}
655-
if (lineNumber == 0) {
656-
out.printf("CONSOLE MESSAGE: %s\n", message);
657-
} else {
658-
out.printf("CONSOLE MESSAGE: line %d: %s\n",
659-
lineNumber, message);
660-
}
655+
out.printf("CONSOLE MESSAGE: %s\n", message);
661656
}
662657

663658
@Override

modules/javafx.web/src/main/java/com/sun/javafx/webkit/prism/WCGraphicsPrismContext.java

+29-41
Original file line numberDiff line numberDiff line change
@@ -503,19 +503,17 @@ protected boolean shouldCalculateIntersection() {
503503
}
504504

505505
@Override
506-
public void fillRect(final float x, final float y, final float w, final float h, final Integer rgba) {
506+
public void fillRect(final float x, final float y, final float w, final float h, final Color color) {
507507
if (log.isLoggable(Level.FINE)) {
508-
String format = (rgba != null)
509-
? "fillRect(%f, %f, %f, %f, 0x%x)"
510-
: "fillRect(%f, %f, %f, %f, null)";
511-
log.fine(String.format(format, x, y, w, h, rgba));
508+
String format = "fillRect(%f, %f, %f, %f, %s)";
509+
log.fine(String.format(format, x, y, w, h, color));
512510
}
513511
if (!shouldRenderRect(x, y, w, h, state.getShadowNoClone(), null)) {
514512
return;
515513
}
516514
new Composite() {
517515
@Override void doPaint(Graphics g) {
518-
Paint paint = (rgba != null) ? createColor(rgba) : state.getPaintNoClone();
516+
Paint paint = (color != null) ? color : state.getPaintNoClone();
519517
DropShadow shadow = state.getShadowNoClone();
520518
// TextureMapperJava::drawSolidColor calls fillRect with perspective
521519
// projection.
@@ -535,13 +533,13 @@ public void fillRect(final float x, final float y, final float w, final float h,
535533
public void fillRoundedRect(final float x, final float y, final float w, final float h,
536534
final float topLeftW, final float topLeftH, final float topRightW, final float topRightH,
537535
final float bottomLeftW, final float bottomLeftH, final float bottomRightW, final float bottomRightH,
538-
final int rgba)
536+
final Color color)
539537
{
540538
if (log.isLoggable(Level.FINE)) {
541539
log.fine(String.format("fillRoundedRect(%f, %f, %f, %f, "
542-
+ "%f, %f, %f, %f, %f, %f, %f, %f, 0x%x)",
540+
+ "%f, %f, %f, %f, %f, %f, %f, %f, %s)",
543541
x, y, w, h, topLeftW, topLeftH, topRightW, topRightH,
544-
bottomLeftW, bottomLeftH, bottomRightW, bottomRightH, rgba));
542+
bottomLeftW, bottomLeftH, bottomRightW, bottomRightH, color));
545543
}
546544
if (!shouldRenderRect(x, y, w, h, state.getShadowNoClone(), null)) {
547545
return;
@@ -554,14 +552,13 @@ public void fillRoundedRect(final float x, final float y, final float w, final f
554552
float arcW = (topLeftW + topRightW + bottomLeftW + bottomRightW) / 2;
555553
float arcH = (topLeftH + topRightH + bottomLeftH + bottomRightH) / 2;
556554

557-
Paint paint = createColor(rgba);
558555
DropShadow shadow = state.getShadowNoClone();
559556
if (shadow != null) {
560557
final NGRectangle node = new NGRectangle();
561558
node.updateRectangle(x, y, w, h, arcW, arcH);
562-
render(g, shadow, paint, null, node);
559+
render(g, shadow, color, null, node);
563560
} else {
564-
g.setPaint(paint);
561+
g.setPaint(color);
565562
g.fillRoundRect(x, y, w, h, arcW, arcH);
566563
}
567564
}
@@ -585,11 +582,11 @@ public void clearRect(final float x, final float y, final float w, final float h
585582
}
586583

587584
@Override
588-
public void setFillColor(int rgba) {
585+
public void setFillColor(Color color) {
589586
if (log.isLoggable(Level.FINE)) {
590-
log.fine(String.format("setFillColor(0x%x)", rgba));
587+
log.fine(String.format("setFillColor(%s)", color));
591588
}
592-
state.setPaint(createColor(rgba));
589+
state.setPaint(color);
593590
}
594591

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

629626
@Override
630-
public void setStrokeColor(int rgba) {
627+
public void setStrokeColor(Color color) {
631628
if (log.isLoggable(Level.FINE)) {
632-
log.fine(String.format("setStrokeColor(0x%x)", rgba));
629+
log.fine(String.format("setStrokeColor(%s)", color));
633630
}
634-
state.getStrokeNoClone().setPaint(createColor(rgba));
631+
state.getStrokeNoClone().setPaint(color);
635632
}
636633

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

703700
@Override
704-
public void setShadow(float dx, float dy, float blur, int rgba) {
701+
public void setShadow(float dx, float dy, float blur, Color color) {
705702
if (log.isLoggable(Level.FINE)) {
706-
String format = "setShadow(%f, %f, %f, 0x%x)";
707-
log.fine(String.format(format, dx, dy, blur, rgba));
703+
String format = "setShadow(%f, %f, %f, %s)";
704+
log.fine(String.format(format, dx, dy, blur, color));
708705
}
709-
state.setShadow(createShadow(dx, dy, blur, rgba));
706+
state.setShadow(createShadow(dx, dy, blur, color));
710707
}
711708

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

10201017
@Override
1021-
public void drawFocusRing(final int x, final int y, final int w, final int h, final int rgba) {
1018+
public void drawFocusRing(final int x, final int y, final int w, final int h, final Color color) {
10221019
if (log.isLoggable(Level.FINE)) {
1023-
log.fine(String.format("drawFocusRing: %d, %d, %d, %d, 0x%x", x, y, w, h, rgba));
1020+
log.fine(String.format("drawFocusRing: %d, %d, %d, %d, %s", x, y, w, h, color));
10241021
}
10251022
if (!shouldRenderRect(x, y, w, h, null, focusRingStroke)) {
10261023
return;
10271024
}
10281025
new Composite() {
10291026
@Override void doPaint(Graphics g) {
1030-
g.setPaint(createColor(rgba));
1027+
g.setPaint(color);
10311028
BasicStroke stroke = g.getStroke();
10321029
g.setStroke(focusRingStroke);
10331030
g.drawRoundRect(x, y, w, h, 4, 4);
@@ -1115,31 +1112,22 @@ private static Rectangle intersect(Rectangle what, Rectangle with) {
11151112
return what;
11161113
}
11171114

1118-
static Color createColor(int rgba) {
1119-
float a = (0xFF & (rgba >> 24)) / 255.0f;
1120-
float r = (0xFF & (rgba >> 16)) / 255.0f;
1121-
float g = (0xFF & (rgba >> 8)) / 255.0f;
1122-
float b = (0xFF & (rgba)) / 255.0f;
1123-
return new Color(r, g, b, a);
1124-
}
1125-
1126-
private static Color4f createColor4f(int rgba) {
1127-
float a = (0xFF & (rgba >> 24)) / 255.0f;
1128-
float r = (0xFF & (rgba >> 16)) / 255.0f;
1129-
float g = (0xFF & (rgba >> 8)) / 255.0f;
1130-
float b = (0xFF & (rgba)) / 255.0f;
1131-
return new Color4f(r, g, b, a);
1115+
private static Color4f createColor4f(Color color) {
1116+
return new Color4f(color.getRed(),
1117+
color.getGreen(),
1118+
color.getBlue(),
1119+
color.getAlpha());
11321120
}
11331121

1134-
private DropShadow createShadow(float dx, float dy, float blur, int rgba) {
1122+
private DropShadow createShadow(float dx, float dy, float blur, Color color) {
11351123
if (dx == 0f && dy == 0f && blur == 0f) {
11361124
return null;
11371125
}
11381126
DropShadow shadow = new DropShadow();
11391127
shadow.setOffsetX((int) dx);
11401128
shadow.setOffsetY((int) dy);
11411129
shadow.setRadius((blur < 0f) ? 0f : (blur > 127f) ? 127f : blur);
1142-
shadow.setColor(createColor4f(rgba));
1130+
shadow.setColor(createColor4f(color));
11431131
return shadow;
11441132
}
11451133

modules/javafx.web/src/main/java/com/sun/javafx/webkit/prism/WCLinearGradient.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
package com.sun.javafx.webkit.prism;
2727

28+
import com.sun.prism.paint.Color;
2829
import com.sun.prism.paint.LinearGradient;
2930
import com.sun.prism.paint.Stop;
3031
import com.sun.webkit.graphics.WCGradient;
@@ -47,8 +48,8 @@ final class WCLinearGradient extends WCGradient<LinearGradient> {
4748
}
4849

4950
@Override
50-
protected void addStop(int argb, float offset) {
51-
this.stops.add(new Stop(WCGraphicsPrismContext.createColor(argb), offset));
51+
protected void addStop(Color color, float offset) {
52+
this.stops.add(new Stop(color, offset));
5253
}
5354

5455
public LinearGradient getPlatformGradient() {

modules/javafx.web/src/main/java/com/sun/javafx/webkit/prism/WCMediaPlayerImpl.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import com.sun.media.jfxmedia.track.VideoTrack;
4949
import com.sun.prism.Graphics;
5050
import com.sun.prism.Texture;
51+
import com.sun.prism.paint.Color;
5152
import com.sun.webkit.graphics.WCGraphicsContext;
5253
import com.sun.webkit.graphics.WCMediaPlayer;
5354

@@ -355,7 +356,7 @@ private void renderImpl(WCGraphicsContext gc, int x, int y, int w, int h) {
355356
texture.unlock();
356357
} else {
357358
log.finest(" (Prism)renderImpl, texture is null, draw black rect");
358-
gc.fillRect(x, y, w, h, 0xFF000000);
359+
gc.fillRect(x, y, w, h, Color.BLACK);
359360
}
360361
log.finer("<<(Prism)renderImpl");
361362
}

modules/javafx.web/src/main/java/com/sun/javafx/webkit/prism/WCPathImpl.java

+1-16
Original file line numberDiff line numberDiff line change
@@ -239,23 +239,8 @@ public void closeSubpath() {
239239
path.closePath();
240240
}
241241

242-
public boolean hasCurrentPoint() {
243-
return hasCP;
244-
}
245-
246242
public boolean isEmpty() {
247-
PathIterator pi = path.getPathIterator(null);
248-
float [] coords = new float[6];
249-
while(!pi.isDone()) {
250-
switch(pi.currentSegment(coords)) {
251-
case PathIterator.SEG_LINETO:
252-
case PathIterator.SEG_QUADTO:
253-
case PathIterator.SEG_CUBICTO:
254-
return false;
255-
}
256-
pi.next();
257-
}
258-
return true;
243+
return !hasCP;
259244
}
260245

261246
public int getWindingRule() {

modules/javafx.web/src/main/java/com/sun/javafx/webkit/prism/WCRadialGradient.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
package com.sun.javafx.webkit.prism;
2727

28+
import com.sun.prism.paint.Color;
2829
import com.sun.prism.paint.RadialGradient;
2930
import com.sun.prism.paint.Stop;
3031
import com.sun.webkit.graphics.WCGradient;
@@ -70,12 +71,12 @@ final class WCRadialGradient extends WCGradient<RadialGradient> {
7071
}
7172

7273
@Override
73-
protected void addStop(int argb, float offset) {
74+
protected void addStop(Color color, float offset) {
7475
if (this.reverse) {
7576
offset = 1.0f - offset;
7677
}
7778
offset = 1.0f - offset + offset * this.r2 * this.r1over;
78-
this.stops.add(new Stop(WCGraphicsPrismContext.createColor(argb), offset));
79+
this.stops.add(new Stop(color, offset));
7980
}
8081

8182
public RadialGradient getPlatformGradient() {

modules/javafx.web/src/main/java/com/sun/webkit/graphics/GraphicsDecoder.java

+15-7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
package com.sun.webkit.graphics;
2727

2828
import com.sun.javafx.logging.PlatformLogger;
29+
import com.sun.prism.paint.Color;
2930

3031
import java.lang.annotation.Native;
3132
import java.nio.ByteBuffer;
@@ -112,7 +113,7 @@ static void decode(WCGraphicsManager gm, WCGraphicsContext gc, BufferData bdata)
112113
buf.getFloat(),
113114
buf.getFloat(),
114115
buf.getFloat(),
115-
buf.getInt());
116+
getColor(buf));
116117
break;
117118
case FILL_ROUNDED_RECT:
118119
gc.fillRoundedRect(
@@ -122,7 +123,7 @@ static void decode(WCGraphicsManager gm, WCGraphicsContext gc, BufferData bdata)
122123
buf.getFloat(), buf.getFloat(), buf.getFloat(), buf.getFloat(),
123124
// bottom corners w/h
124125
buf.getFloat(), buf.getFloat(), buf.getFloat(), buf.getFloat(),
125-
buf.getInt());
126+
getColor(buf));
126127
break;
127128
case CLEARRECT_FFFF:
128129
gc.clearRect(
@@ -140,7 +141,7 @@ static void decode(WCGraphicsManager gm, WCGraphicsContext gc, BufferData bdata)
140141
buf.getFloat());
141142
break;
142143
case SETFILLCOLOR:
143-
gc.setFillColor(buf.getInt());
144+
gc.setFillColor(getColor(buf));
144145
break;
145146
case SET_TEXT_MODE:
146147
gc.setTextMode(getBoolean(buf), getBoolean(buf), getBoolean(buf));
@@ -149,7 +150,7 @@ static void decode(WCGraphicsManager gm, WCGraphicsContext gc, BufferData bdata)
149150
gc.setStrokeStyle(buf.getInt());
150151
break;
151152
case SETSTROKECOLOR:
152-
gc.setStrokeColor(buf.getInt());
153+
gc.setStrokeColor(getColor(buf));
153154
break;
154155
case SETSTROKEWIDTH:
155156
gc.setStrokeWidth(buf.getFloat());
@@ -265,7 +266,7 @@ static void decode(WCGraphicsManager gm, WCGraphicsContext gc, BufferData bdata)
265266
buf.getInt(),
266267
buf.getInt(),
267268
buf.getInt(),
268-
buf.getInt());
269+
getColor(buf));
269270
break;
270271
case SETALPHA:
271272
gc.setAlpha(buf.getFloat());
@@ -287,7 +288,7 @@ static void decode(WCGraphicsManager gm, WCGraphicsContext gc, BufferData bdata)
287288
buf.getFloat(),
288289
buf.getFloat(),
289290
buf.getFloat(),
290-
buf.getInt());
291+
getColor(buf));
291292
break;
292293
case DRAWSTRING:
293294
gc.drawString(
@@ -473,6 +474,13 @@ private static WCRectangle getRectangle(ByteBuffer buf) {
473474
buf.getFloat());
474475
}
475476

477+
private static Color getColor(ByteBuffer buf) {
478+
return new Color(buf.getFloat(),
479+
buf.getFloat(),
480+
buf.getFloat(),
481+
buf.getFloat());
482+
}
483+
476484
private static WCGradient getGradient(WCGraphicsContext gc, ByteBuffer buf) {
477485
WCPoint p1 = getPoint(buf);
478486
WCPoint p2 = getPoint(buf);
@@ -488,7 +496,7 @@ private static WCGradient getGradient(WCGraphicsContext gc, ByteBuffer buf) {
488496
}
489497
int count = buf.getInt();
490498
for (int i = 0; i < count; i++) {
491-
int color = buf.getInt();
499+
Color color = getColor(buf);
492500
float offset = buf.getFloat();
493501
if (gradient != null) {
494502
gradient.addStop(color, offset);

modules/javafx.web/src/main/java/com/sun/webkit/graphics/RenderMediaControls.java

+11-6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import java.util.HashMap;
3030
import java.util.Map;
3131

32+
import com.sun.prism.paint.Color;
33+
3234
final class RenderMediaControls {
3335
/**
3436
* Media control part constants (types for the paintControl method)
@@ -127,9 +129,9 @@ static void paintControl(WCGraphicsContext gc,
127129
}
128130
}
129131

130-
private static final int TimeSliderTrackUnbufferedColor =
132+
private static final Color TimeSliderTrackUnbufferedColor =
131133
rgba(0xec, 0x87, 0x7d);
132-
private static final int TimeSliderTrackBufferedColor =
134+
private static final Color TimeSliderTrackBufferedColor =
133135
rgba(0xf9, 0x1a, 0x02);
134136
private static final int TimeSliderTrackThickness = 3;
135137

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

200-
private static final int VolumeTrackColor = rgba(0xd0, 0xd0, 0xd0, 0x80);
202+
private static final Color VolumeTrackColor = rgba(0xd0, 0xd0, 0xd0, 0x80);
201203
private static final int VolumeTrackThickness = 1;
202204

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

280-
private static int rgba(int r, int g, int b, int a) {
281-
return ((a & 0xFF) << 24) |((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF);
282+
private static Color rgba(int r, int g, int b, int a) {
283+
return new Color((r & 0xFF) / 255.0f,
284+
(g & 0xFF) / 255.0f,
285+
(b & 0xFF) / 255.0f,
286+
(a & 0xFF) / 255.0f);
282287
}
283-
private static int rgba(int r, int g, int b) {
288+
private static Color rgba(int r, int g, int b) {
284289
return rgba(r, g, b, 0xFF);
285290
}
286291

0 commit comments

Comments
 (0)