Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp

Issue 1461223002: Implement SVG's transform and effect paint property nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix fixed position bug discovered by TienRen Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "core/layout/LayoutTestHelper.h" 7 #include "core/layout/LayoutTestHelper.h"
8 #include "core/layout/LayoutTreeAsText.h" 8 #include "core/layout/LayoutTreeAsText.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "core/paint/ObjectPaintProperties.h" 10 #include "core/paint/ObjectPaintProperties.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } 185 }
186 186
187 TEST_F(PaintPropertyTreeBuilderTest, NestedOpacityEffect) 187 TEST_F(PaintPropertyTreeBuilderTest, NestedOpacityEffect)
188 { 188 {
189 setBodyInnerHTML( 189 setBodyInnerHTML(
190 "<div id='nodeWithoutOpacity'>" 190 "<div id='nodeWithoutOpacity'>"
191 " <div id='childWithOpacity' style='opacity: 0.5'>" 191 " <div id='childWithOpacity' style='opacity: 0.5'>"
192 " <div id='grandChildWithoutOpacity'>" 192 " <div id='grandChildWithoutOpacity'>"
193 " <div id='greatGrandChildWithOpacity' style='opacity: 0.2'/>" 193 " <div id='greatGrandChildWithOpacity' style='opacity: 0.2'/>"
194 " </div>" 194 " </div>"
195 " </div" 195 " </div>"
196 "</div>"); 196 "</div>");
197 197
198 LayoutObject& nodeWithoutOpacity = *document().getElementById("nodeWithoutOp acity")->layoutObject(); 198 LayoutObject& nodeWithoutOpacity = *document().getElementById("nodeWithoutOp acity")->layoutObject();
199 ObjectPaintProperties* nodeWithoutOpacityProperties = nodeWithoutOpacity.obj ectPaintProperties(); 199 ObjectPaintProperties* nodeWithoutOpacityProperties = nodeWithoutOpacity.obj ectPaintProperties();
200 EXPECT_EQ(nullptr, nodeWithoutOpacityProperties); 200 EXPECT_EQ(nullptr, nodeWithoutOpacityProperties);
201 201
202 LayoutObject& childWithOpacity = *document().getElementById("childWithOpacit y")->layoutObject(); 202 LayoutObject& childWithOpacity = *document().getElementById("childWithOpacit y")->layoutObject();
203 ObjectPaintProperties* childWithOpacityProperties = childWithOpacity.objectP aintProperties(); 203 ObjectPaintProperties* childWithOpacityProperties = childWithOpacity.objectP aintProperties();
204 EXPECT_EQ(0.5f, childWithOpacityProperties->effect()->opacity()); 204 EXPECT_EQ(0.5f, childWithOpacityProperties->effect()->opacity());
205 // childWithOpacity is the root effect node. 205 // childWithOpacity is the root effect node.
206 EXPECT_EQ(nullptr, childWithOpacityProperties->effect()->parent()); 206 EXPECT_EQ(nullptr, childWithOpacityProperties->effect()->parent());
207 207
208 LayoutObject& grandChildWithoutOpacity = *document().getElementById("grandCh ildWithoutOpacity")->layoutObject(); 208 LayoutObject& grandChildWithoutOpacity = *document().getElementById("grandCh ildWithoutOpacity")->layoutObject();
209 EXPECT_EQ(nullptr, grandChildWithoutOpacity.objectPaintProperties()); 209 EXPECT_EQ(nullptr, grandChildWithoutOpacity.objectPaintProperties());
210 210
211 LayoutObject& greatGrandChildWithOpacity = *document().getElementById("great GrandChildWithOpacity")->layoutObject(); 211 LayoutObject& greatGrandChildWithOpacity = *document().getElementById("great GrandChildWithOpacity")->layoutObject();
212 ObjectPaintProperties* greatGrandChildWithOpacityProperties = greatGrandChil dWithOpacity.objectPaintProperties(); 212 ObjectPaintProperties* greatGrandChildWithOpacityProperties = greatGrandChil dWithOpacity.objectPaintProperties();
213 EXPECT_EQ(0.2f, greatGrandChildWithOpacityProperties->effect()->opacity()); 213 EXPECT_EQ(0.2f, greatGrandChildWithOpacityProperties->effect()->opacity());
214 EXPECT_EQ(childWithOpacityProperties->effect(), greatGrandChildWithOpacityPr operties->effect()->parent()); 214 EXPECT_EQ(childWithOpacityProperties->effect(), greatGrandChildWithOpacityPr operties->effect()->parent());
215 } 215 }
216 216
217 TEST_F(PaintPropertyTreeBuilderTest, TransformNodeDoesNotAffectEffectNodes) 217 TEST_F(PaintPropertyTreeBuilderTest, TransformNodeDoesNotAffectEffectNodes)
218 { 218 {
219 setBodyInnerHTML( 219 setBodyInnerHTML(
220 "<div id='nodeWithOpacity' style='opacity: 0.6'>" 220 "<div id='nodeWithOpacity' style='opacity: 0.6'>"
221 " <div id='childWithTransform' style='transform: translate3d(10px, 10px , 0px);'>" 221 " <div id='childWithTransform' style='transform: translate3d(10px, 10px , 0px);'>"
222 " <div id='grandChildWithOpacity' style='opacity: 0.4'/>" 222 " <div id='grandChildWithOpacity' style='opacity: 0.4'/>"
223 " </div" 223 " </div>"
224 "</div>"); 224 "</div>");
225 225
226 LayoutObject& nodeWithOpacity = *document().getElementById("nodeWithOpacity" )->layoutObject(); 226 LayoutObject& nodeWithOpacity = *document().getElementById("nodeWithOpacity" )->layoutObject();
227 ObjectPaintProperties* nodeWithOpacityProperties = nodeWithOpacity.objectPai ntProperties(); 227 ObjectPaintProperties* nodeWithOpacityProperties = nodeWithOpacity.objectPai ntProperties();
228 EXPECT_EQ(0.6f, nodeWithOpacityProperties->effect()->opacity()); 228 EXPECT_EQ(0.6f, nodeWithOpacityProperties->effect()->opacity());
229 EXPECT_EQ(nullptr, nodeWithOpacityProperties->effect()->parent()); 229 EXPECT_EQ(nullptr, nodeWithOpacityProperties->effect()->parent());
230 EXPECT_EQ(nullptr, nodeWithOpacityProperties->transform()); 230 EXPECT_EQ(nullptr, nodeWithOpacityProperties->transform());
231 231
232 LayoutObject& childWithTransform = *document().getElementById("childWithTran sform")->layoutObject(); 232 LayoutObject& childWithTransform = *document().getElementById("childWithTran sform")->layoutObject();
233 ObjectPaintProperties* childWithTransformProperties = childWithTransform.obj ectPaintProperties(); 233 ObjectPaintProperties* childWithTransformProperties = childWithTransform.obj ectPaintProperties();
234 EXPECT_EQ(nullptr, childWithTransformProperties->effect()); 234 EXPECT_EQ(nullptr, childWithTransformProperties->effect());
235 EXPECT_EQ(TransformationMatrix().translate(10, 10), childWithTransformProper ties->transform()->matrix()); 235 EXPECT_EQ(TransformationMatrix().translate(10, 10), childWithTransformProper ties->transform()->matrix());
236 236
237 LayoutObject& grandChildWithOpacity = *document().getElementById("grandChild WithOpacity")->layoutObject(); 237 LayoutObject& grandChildWithOpacity = *document().getElementById("grandChild WithOpacity")->layoutObject();
238 ObjectPaintProperties* grandChildWithOpacityProperties = grandChildWithOpaci ty.objectPaintProperties(); 238 ObjectPaintProperties* grandChildWithOpacityProperties = grandChildWithOpaci ty.objectPaintProperties();
239 EXPECT_EQ(0.4f, grandChildWithOpacityProperties->effect()->opacity()); 239 EXPECT_EQ(0.4f, grandChildWithOpacityProperties->effect()->opacity());
240 EXPECT_EQ(nodeWithOpacityProperties->effect(), grandChildWithOpacityProperti es->effect()->parent()); 240 EXPECT_EQ(nodeWithOpacityProperties->effect(), grandChildWithOpacityProperti es->effect()->parent());
241 EXPECT_EQ(nullptr, grandChildWithOpacityProperties->transform()); 241 EXPECT_EQ(nullptr, grandChildWithOpacityProperties->transform());
242 } 242 }
243 243
244 TEST_F(PaintPropertyTreeBuilderTest, EffectNodesAcrossStackingContext) 244 TEST_F(PaintPropertyTreeBuilderTest, EffectNodesAcrossStackingContext)
245 { 245 {
246 setBodyInnerHTML( 246 setBodyInnerHTML(
247 "<div id='nodeWithOpacity' style='opacity: 0.6'>" 247 "<div id='nodeWithOpacity' style='opacity: 0.6'>"
248 " <div id='childWithStackingContext' style='position:absolute;'>" 248 " <div id='childWithStackingContext' style='position:absolute;'>"
249 " <div id='grandChildWithOpacity' style='opacity: 0.4'/>" 249 " <div id='grandChildWithOpacity' style='opacity: 0.4'/>"
250 " </div" 250 " </div>"
251 "</div>"); 251 "</div>");
252 252
253 LayoutObject& nodeWithOpacity = *document().getElementById("nodeWithOpacity" )->layoutObject(); 253 LayoutObject& nodeWithOpacity = *document().getElementById("nodeWithOpacity" )->layoutObject();
254 ObjectPaintProperties* nodeWithOpacityProperties = nodeWithOpacity.objectPai ntProperties(); 254 ObjectPaintProperties* nodeWithOpacityProperties = nodeWithOpacity.objectPai ntProperties();
255 EXPECT_EQ(0.6f, nodeWithOpacityProperties->effect()->opacity()); 255 EXPECT_EQ(0.6f, nodeWithOpacityProperties->effect()->opacity());
256 EXPECT_EQ(nullptr, nodeWithOpacityProperties->effect()->parent()); 256 EXPECT_EQ(nullptr, nodeWithOpacityProperties->effect()->parent());
257 EXPECT_EQ(nullptr, nodeWithOpacityProperties->transform()); 257 EXPECT_EQ(nullptr, nodeWithOpacityProperties->transform());
258 258
259 LayoutObject& childWithStackingContext = *document().getElementById("childWi thStackingContext")->layoutObject(); 259 LayoutObject& childWithStackingContext = *document().getElementById("childWi thStackingContext")->layoutObject();
260 EXPECT_EQ(nullptr, childWithStackingContext.objectPaintProperties()); 260 EXPECT_EQ(nullptr, childWithStackingContext.objectPaintProperties());
261 261
262 LayoutObject& grandChildWithOpacity = *document().getElementById("grandChild WithOpacity")->layoutObject(); 262 LayoutObject& grandChildWithOpacity = *document().getElementById("grandChild WithOpacity")->layoutObject();
263 ObjectPaintProperties* grandChildWithOpacityProperties = grandChildWithOpaci ty.objectPaintProperties(); 263 ObjectPaintProperties* grandChildWithOpacityProperties = grandChildWithOpaci ty.objectPaintProperties();
264 EXPECT_EQ(0.4f, grandChildWithOpacityProperties->effect()->opacity()); 264 EXPECT_EQ(0.4f, grandChildWithOpacityProperties->effect()->opacity());
265 EXPECT_EQ(nodeWithOpacityProperties->effect(), grandChildWithOpacityProperti es->effect()->parent()); 265 EXPECT_EQ(nodeWithOpacityProperties->effect(), grandChildWithOpacityProperti es->effect()->parent());
266 EXPECT_EQ(nullptr, grandChildWithOpacityProperties->transform()); 266 EXPECT_EQ(nullptr, grandChildWithOpacityProperties->transform());
267 } 267 }
268 268
269 TEST_F(PaintPropertyTreeBuilderTest, EffectNodesInSVG)
270 {
271 setBodyInnerHTML(
272 "<svg id='svgRoot'>"
273 " <g id='groupWithOpacity' opacity='0.6'>"
274 " <rect id='rectWithoutOpacity' />"
275 " <rect id='rectWithOpacity' opacity='0.4' />"
276 " <text id='textWithOpacity' opacity='0.2'>"
277 " <tspan id='tspanWithOpacity' opacity='0.1' />"
278 " </text>"
279 " </g>"
280 "</svg>");
281
282 LayoutObject& groupWithOpacity = *document().getElementById("groupWithOpacit y")->layoutObject();
283 ObjectPaintProperties* groupWithOpacityProperties = groupWithOpacity.objectP aintProperties();
284 EXPECT_EQ(0.6f, groupWithOpacityProperties->effect()->opacity());
285 EXPECT_EQ(nullptr, groupWithOpacityProperties->effect()->parent());
286
287 LayoutObject& rectWithoutOpacity = *document().getElementById("rectWithoutOp acity")->layoutObject();
288 ObjectPaintProperties* rectWithoutOpacityProperties = rectWithoutOpacity.obj ectPaintProperties();
289 EXPECT_EQ(nullptr, rectWithoutOpacityProperties);
290
291 LayoutObject& rectWithOpacity = *document().getElementById("rectWithOpacity" )->layoutObject();
292 ObjectPaintProperties* rectWithOpacityProperties = rectWithOpacity.objectPai ntProperties();
293 EXPECT_EQ(0.4f, rectWithOpacityProperties->effect()->opacity());
294 EXPECT_EQ(groupWithOpacityProperties->effect(), rectWithOpacityProperties->e ffect()->parent());
295
296 // Ensure that opacity nodes are created for LayoutSVGText which inherits fr om LayoutSVGBlock instead of LayoutSVGModelObject.
297 LayoutObject& textWithOpacity = *document().getElementById("textWithOpacity" )->layoutObject();
298 ObjectPaintProperties* textWithOpacityProperties = textWithOpacity.objectPai ntProperties();
299 EXPECT_EQ(0.2f, textWithOpacityProperties->effect()->opacity());
300 EXPECT_EQ(groupWithOpacityProperties->effect(), textWithOpacityProperties->e ffect()->parent());
301
302 // Ensure that opacity nodes are created for LayoutSVGTSpan which inherits f rom LayoutSVGInline instead of LayoutSVGModelObject.
303 LayoutObject& tspanWithOpacity = *document().getElementById("tspanWithOpacit y")->layoutObject();
304 ObjectPaintProperties* tspanWithOpacityProperties = tspanWithOpacity.objectP aintProperties();
305 EXPECT_EQ(0.1f, tspanWithOpacityProperties->effect()->opacity());
306 EXPECT_EQ(textWithOpacityProperties->effect(), tspanWithOpacityProperties->e ffect()->parent());
307 }
308
309 TEST_F(PaintPropertyTreeBuilderTest, EffectNodesAcrossHTMLSVGBoundary)
310 {
311 setBodyInnerHTML(
312 "<div id='divWithOpacity' style='opacity: 0.2;'>"
313 " <svg id='svgRootWithOpacity' style='opacity: 0.3;'>"
314 " <rect id='rectWithOpacity' opacity='0.4' />"
315 " </svg>"
316 "</div>");
317
318 LayoutObject& divWithOpacity = *document().getElementById("divWithOpacity")- >layoutObject();
319 ObjectPaintProperties* divWithOpacityProperties = divWithOpacity.objectPaint Properties();
320 EXPECT_EQ(0.2f, divWithOpacityProperties->effect()->opacity());
321 EXPECT_EQ(nullptr, divWithOpacityProperties->effect()->parent());
322
323 LayoutObject& svgRootWithOpacity = *document().getElementById("svgRootWithOp acity")->layoutObject();
324 ObjectPaintProperties* svgRootWithOpacityProperties = svgRootWithOpacity.obj ectPaintProperties();
325 EXPECT_EQ(0.3f, svgRootWithOpacityProperties->effect()->opacity());
326 EXPECT_EQ(divWithOpacityProperties->effect(), svgRootWithOpacityProperties-> effect()->parent());
327
328 LayoutObject& rectWithOpacity = *document().getElementById("rectWithOpacity" )->layoutObject();
329 ObjectPaintProperties* rectWithOpacityProperties = rectWithOpacity.objectPai ntProperties();
330 EXPECT_EQ(0.4f, rectWithOpacityProperties->effect()->opacity());
331 EXPECT_EQ(svgRootWithOpacityProperties->effect(), rectWithOpacityProperties- >effect()->parent());
332 }
333
334 TEST_F(PaintPropertyTreeBuilderTest, EffectNodesAcrossSVGHTMLBoundary)
335 {
336 setBodyInnerHTML(
337 "<svg id='svgRootWithOpacity' style='opacity: 0.3;'>"
338 " <foreignObject id='foreignObjectWithOpacity' opacity='0.4'>"
339 " <body>"
340 " <span id='spanWithOpacity' style='opacity: 0.5'/>"
341 " </body>"
342 " </foreignObject>"
343 "</svg>");
344
345 LayoutObject& svgRootWithOpacity = *document().getElementById("svgRootWithOp acity")->layoutObject();
346 ObjectPaintProperties* svgRootWithOpacityProperties = svgRootWithOpacity.obj ectPaintProperties();
347 EXPECT_EQ(0.3f, svgRootWithOpacityProperties->effect()->opacity());
348 EXPECT_EQ(nullptr, svgRootWithOpacityProperties->effect()->parent());
349
350 LayoutObject& foreignObjectWithOpacity = *document().getElementById("foreign ObjectWithOpacity")->layoutObject();
351 ObjectPaintProperties* foreignObjectWithOpacityProperties = foreignObjectWit hOpacity.objectPaintProperties();
352 EXPECT_EQ(0.4f, foreignObjectWithOpacityProperties->effect()->opacity());
353 EXPECT_EQ(svgRootWithOpacityProperties->effect(), foreignObjectWithOpacityPr operties->effect()->parent());
354
355 LayoutObject& spanWithOpacity = *document().getElementById("spanWithOpacity" )->layoutObject();
356 ObjectPaintProperties* spanWithOpacityProperties = spanWithOpacity.objectPai ntProperties();
357 EXPECT_EQ(0.5f, spanWithOpacityProperties->effect()->opacity());
358 EXPECT_EQ(foreignObjectWithOpacityProperties->effect(), spanWithOpacityPrope rties->effect()->parent());
359 }
360
361 TEST_F(PaintPropertyTreeBuilderTest, TransformNodesInSVG)
362 {
363 setBodyInnerHTML(
364 "<style>"
365 " body {"
366 " margin: 0px;"
367 " }"
368 " svg {"
369 " margin-left: 50px;"
370 " transform: translate3d(1px, 2px, 3px);"
371 " position: absolute;"
372 " left: 20px;"
373 " top: 25px;"
374 " }"
375 " rect {"
376 " transform: translate(100px, 100px) rotate(45deg);"
377 " transform-origin: 50px 25px;"
378 " }"
379 "</style>"
380 "<svg id='svgRootWith3dTransform' width='100px' height='100px'>"
381 " <rect id='rectWith2dTransform' width='100px' height='100px' />"
382 "</svg>");
383
384 LayoutObject& svgRootWith3dTransform = *document().getElementById("svgRootWi th3dTransform")->layoutObject();
385 ObjectPaintProperties* svgRootWith3dTransformProperties = svgRootWith3dTrans form.objectPaintProperties();
386 EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), svgRootWith3dTransfor mProperties->transform()->matrix());
387 EXPECT_EQ(FloatPoint3D(50, 50, 0), svgRootWith3dTransformProperties->transfo rm()->origin());
388 EXPECT_EQ(svgRootWith3dTransformProperties->paintOffsetTranslation(), svgRoo tWith3dTransformProperties->transform()->parent());
389 EXPECT_EQ(TransformationMatrix().translate(70, 25), svgRootWith3dTransformPr operties->paintOffsetTranslation()->matrix());
390 EXPECT_EQ(document().view()->scrollTranslation(), svgRootWith3dTransformProp erties->paintOffsetTranslation()->parent());
391
392 LayoutObject& rectWith2dTransform = *document().getElementById("rectWith2dTr ansform")->layoutObject();
393 ObjectPaintProperties* rectWith2dTransformProperties = rectWith2dTransform.o bjectPaintProperties();
394 TransformationMatrix matrix;
395 matrix.translate(100, 100);
396 matrix.rotate(45);
397 // SVG's transform origin is baked into the transform.
398 matrix.applyTransformOrigin(50, 25, 0);
399 EXPECT_EQ(matrix, rectWith2dTransformProperties->transform()->matrix());
400 EXPECT_EQ(FloatPoint3D(0, 0, 0), rectWith2dTransformProperties->transform()- >origin());
401 // SVG does not use paint offset.
402 EXPECT_EQ(nullptr, rectWith2dTransformProperties->paintOffsetTranslation());
403 }
404
405 TEST_F(PaintPropertyTreeBuilderTest, SVGRootPaintOffsetTransformNode)
406 {
407 setBodyInnerHTML(
408 "<style>body { margin: 0px; } </style>"
409 "<svg id='svg' style='margin-left: 50px; margin-top: 25px; width: 100px; height: 100px;' />");
410
411 LayoutObject& svg = *document().getElementById("svg")->layoutObject();
412 ObjectPaintProperties* svgProperties = svg.objectPaintProperties();
413 // Ensure that a paint offset transform is emitted for SVG, even without a C SS transform.
414 EXPECT_EQ(nullptr, svgProperties->transform());
415 EXPECT_EQ(TransformationMatrix().translate(50, 25), svgProperties->paintOffs etTranslation()->matrix());
416 EXPECT_EQ(document().view()->scrollTranslation(), svgProperties->paintOffset Translation()->parent());
417 }
418
419 TEST_F(PaintPropertyTreeBuilderTest, TransformNodesAcrossSVGHTMLBoundary)
420 {
421 setBodyInnerHTML(
422 "<style> body { margin: 0px; } </style>"
423 "<svg id='svgWithTransform' style='transform: translate3d(1px, 2px, 3px) ;'>"
424 " <foreignObject>"
425 " <body>"
426 " <div id='divWithTransform' style='transform: translate3d(3px, 4px , 5px);'></div>"
427 " </body>"
428 " </foreignObject>"
429 "</svg>");
430
431 LayoutObject& svgWithTransform = *document().getElementById("svgWithTransfor m")->layoutObject();
432 ObjectPaintProperties* svgWithTransformProperties = svgWithTransform.objectP aintProperties();
433 EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), svgWithTransformPrope rties->transform()->matrix());
434
435 LayoutObject& divWithTransform = *document().getElementById("divWithTransfor m")->layoutObject();
436 ObjectPaintProperties* divWithTransformProperties = divWithTransform.objectP aintProperties();
437 EXPECT_EQ(TransformationMatrix().translate3d(3, 4, 5), divWithTransformPrope rties->transform()->matrix());
438 // Ensure the div's transform node is a child of the svg's transform node.
439 EXPECT_EQ(svgWithTransformProperties->transform(), divWithTransformPropertie s->transform()->parent());
440 }
441
442 TEST_F(PaintPropertyTreeBuilderTest, FixedTransformAncestorAcrossSVGHTMLBoundary )
443 {
444 setBodyInnerHTML(
445 "<style> body { margin: 0px; } </style>"
446 "<svg id='svg' style='transform: translate3d(1px, 2px, 3px);'>"
447 " <g id='container' transform='translate(20 30)'>"
448 " <foreignObject>"
449 " <body>"
450 " <div id='fixed' style='position: fixed; left: 200px; top: 150px ;'></div>"
451 " </body>"
452 " </foreignObject>"
453 " </g>"
454 "</svg>");
455
456 LayoutObject& svg = *document().getElementById("svg")->layoutObject();
457 ObjectPaintProperties* svgProperties = svg.objectPaintProperties();
458 EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), svgProperties->transf orm()->matrix());
459
460 LayoutObject& container = *document().getElementById("container")->layoutObj ect();
461 ObjectPaintProperties* containerProperties = container.objectPaintProperties ();
462 EXPECT_EQ(TransformationMatrix().translate(20, 30), containerProperties->tra nsform()->matrix());
463 EXPECT_EQ(svgProperties->transform(), containerProperties->transform()->pare nt());
464
465 Element* fixed = document().getElementById("fixed");
466 ObjectPaintProperties* fixedProperties = fixed->layoutObject()->objectPaintP roperties();
467 EXPECT_EQ(TransformationMatrix().translate(200, 150), fixedProperties->paint OffsetTranslation()->matrix());
468 // Ensure the fixed position element is rooted at the nearest transform cont ainer.
469 EXPECT_EQ(containerProperties->transform(), fixedProperties->paintOffsetTran slation()->parent());
470 }
471
269 } // namespace blink 472 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698