| Differences between
and this patch
- a/Source/WebCore/ChangeLog +23 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2017-02-09  Miguel Gomez  <magomez@igalia.com>, Gwang Yoon Hwang  <yoon@igalia.com>
2
3
        [GTK] scroll with transparent background not repainted after scrollY >= 32768
4
        https://bugs.webkit.org/show_bug.cgi?id=154283
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Due to a limitation of the pixman backend, which uses 16 bits to hold signed integers, cairo is
9
        not able to draw anything when using transformation matrices with values bigger than 32768. When
10
        drawing patterns into large pages, the matrices values can overflow those 16 bits, so cairo doesn't
11
        draw anything in, which causes the reported transparent backgrounds.
12
13
        The patch modifies the transformation matrices both from the current context and the pattern we
14
        are painting, to avoid them to hold values that cannot stored in 16 bits.
15
16
        There's still the possibility that this happens, but it would require using a pattern with a size
17
        bigger than 32768.
18
19
        No new tests.
20
21
        * platform/graphics/cairo/CairoUtilities.cpp:
22
        (WebCore::drawPatternToCairoContext):
23
1
2017-02-08  Zan Dobersek  <zdobersek@igalia.com>
24
2017-02-08  Zan Dobersek  <zdobersek@igalia.com>
2
25
3
        [EME] Implement MediaKeySession::remove()
26
        [EME] Implement MediaKeySession::remove()
- a/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp -2 / +22 lines
Lines 205-212 void drawPatternToCairoContext(cairo_t* cr, cairo_surface_t* image, const IntSiz a/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp_sec1
205
    cairo_pattern_t* pattern = cairo_pattern_create_for_surface(image);
205
    cairo_pattern_t* pattern = cairo_pattern_create_for_surface(image);
206
    cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);
206
    cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);
207
207
208
    // Cairo cannot convert a cairo_matrix to a Pixman's matrix if any of its components is bigger than maximum int size of Pixman.
209
    // With this condition, Cairo gives up to draw given pattern entirely. To workaround this problem, we reduce the coordinate
210
    // space by translating CTM and destRect.
211
    cairo_matrix_t ctm;
212
    cairo_get_matrix(cr, &ctm);
213
    double dx = 0, dy = 0;
214
    cairo_matrix_transform_point(&ctm, &dx, &dy);
215
    double xScale = 1, yScale = 1;
216
    cairo_matrix_transform_distance(&ctm, &xScale, &yScale);
217
218
    dx = std::trunc(-dx / tileRect.width()) * tileRect.width() / xScale;
219
    dy = std::trunc(-dy / tileRect.height()) * tileRect.height() / yScale;
220
    cairo_translate(cr, dx, dy);
221
222
    FloatRect adjustedDestRect(destRect);
223
    adjustedDestRect.move(-dx, -dy);
224
225
    // Again, we need to reduce the coordinate of the transformation matrix we are using for the pattern.
208
    cairo_matrix_t patternMatrix = cairo_matrix_t(patternTransform);
226
    cairo_matrix_t patternMatrix = cairo_matrix_t(patternTransform);
209
    cairo_matrix_t phaseMatrix = {1, 0, 0, 1, phase.x() + tileRect.x() * patternTransform.a(), phase.y() + tileRect.y() * patternTransform.d()};
227
    dx = phase.x() - std::trunc(phase.x() / tileRect.width()) * tileRect.width();
228
    dy = phase.y() - std::trunc(phase.y() / tileRect.height()) * tileRect.height();
229
    cairo_matrix_t phaseMatrix = {1, 0, 0, 1, dx + tileRect.x() * patternTransform.a(), dy + tileRect.y() * patternTransform.d()};
210
    cairo_matrix_t combined;
230
    cairo_matrix_t combined;
211
    cairo_matrix_multiply(&combined, &patternMatrix, &phaseMatrix);
231
    cairo_matrix_multiply(&combined, &patternMatrix, &phaseMatrix);
212
    cairo_matrix_invert(&combined);
232
    cairo_matrix_invert(&combined);
Lines 215-221 void drawPatternToCairoContext(cairo_t* cr, cairo_surface_t* image, const IntSiz a/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp_sec2
215
    cairo_set_operator(cr, op);
235
    cairo_set_operator(cr, op);
216
    cairo_set_source(cr, pattern);
236
    cairo_set_source(cr, pattern);
217
    cairo_pattern_destroy(pattern);
237
    cairo_pattern_destroy(pattern);
218
    cairo_rectangle(cr, destRect.x(), destRect.y(), destRect.width(), destRect.height());
238
    cairo_rectangle(cr, adjustedDestRect.x(), adjustedDestRect.y(), adjustedDestRect.width(), adjustedDestRect.height());
219
    cairo_fill(cr);
239
    cairo_fill(cr);
220
240
221
    cairo_restore(cr);
241
    cairo_restore(cr);

Return to Bug 154283