| OLD | NEW |
| 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 "core/layout/ScrollAnchor.h" | 5 #include "core/layout/ScrollAnchor.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutBox.h" | 7 #include "core/layout/LayoutBox.h" |
| 8 #include "core/layout/LayoutTestHelper.h" | 8 #include "core/layout/LayoutTestHelper.h" |
| 9 #include "core/paint/PaintLayerScrollableArea.h" | 9 #include "core/paint/PaintLayerScrollableArea.h" |
| 10 #include "platform/testing/HistogramTester.h" | 10 #include "platform/testing/HistogramTester.h" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 " #a, #c { left: 0; }" | 285 " #a, #c { left: 0; }" |
| 286 " #b, #d { right: 0; }" | 286 " #b, #d { right: 0; }" |
| 287 " #c, #d { bottom: 0; }" | 287 " #c, #d { bottom: 0; }" |
| 288 " .big { width: 800px !important; height: 600px !important }" | 288 " .big { width: 800px !important; height: 600px !important }" |
| 289 "</style>" | 289 "</style>" |
| 290 "<div id=a></div>" | 290 "<div id=a></div>" |
| 291 "<div id=b></div>" | 291 "<div id=b></div>" |
| 292 "<div id=c></div>" | 292 "<div id=c></div>" |
| 293 "<div id=d></div>"); | 293 "<div id=d></div>"); |
| 294 | 294 |
| 295 checkCorner("a", Corner::BottomRight, DoublePoint(20, 20), DoubleSize(+400
, +300)); | 295 checkCorner("a", Corner::TopLeft, DoublePoint(20, 20), DoubleSize(0, 0)); |
| 296 checkCorner("b", Corner::BottomLeft, DoublePoint(420, 20), DoubleSize(-400
, +300)); | 296 checkCorner("b", Corner::TopLeft, DoublePoint(420, 20), DoubleSize(-400, 0)
); |
| 297 checkCorner("c", Corner::TopRight, DoublePoint(20, 320), DoubleSize(+400
, -300)); | 297 checkCorner("c", Corner::TopLeft, DoublePoint(20, 320), DoubleSize(0, -300)
); |
| 298 checkCorner("d", Corner::TopLeft, DoublePoint(420, 320), DoubleSize(-400
, -300)); | 298 checkCorner("d", Corner::TopLeft, DoublePoint(420, 320), DoubleSize(-400, -3
00)); |
| 299 } |
| 300 |
| 301 TEST_F(ScrollAnchorCornerTest, CornersVerticalLR) |
| 302 { |
| 303 setBodyInnerHTML( |
| 304 "<style>" |
| 305 " html {" |
| 306 " writing-mode: vertical-lr;" |
| 307 " }" |
| 308 " body {" |
| 309 " position: absolute; border: 10px solid #ccc;" |
| 310 " width: 1220px; height: 920px;" |
| 311 " }" |
| 312 " #a, #b, #c, #d {" |
| 313 " position: absolute; background-color: #ace;" |
| 314 " width: 400px; height: 300px;" |
| 315 " }" |
| 316 " #a, #b { top: 0; }" |
| 317 " #a, #c { left: 0; }" |
| 318 " #b, #d { right: 0; }" |
| 319 " #c, #d { bottom: 0; }" |
| 320 " .big { width: 800px !important; height: 600px !important }" |
| 321 "</style>" |
| 322 "<div id=a></div>" |
| 323 "<div id=b></div>" |
| 324 "<div id=c></div>" |
| 325 "<div id=d></div>"); |
| 326 |
| 327 checkCorner("a", Corner::TopLeft, DoublePoint(20, 20), DoubleSize(0, 0)); |
| 328 checkCorner("b", Corner::TopLeft, DoublePoint(420, 20), DoubleSize(-400, 0)
); |
| 329 checkCorner("c", Corner::TopLeft, DoublePoint(20, 320), DoubleSize(0, -300)
); |
| 330 checkCorner("d", Corner::TopLeft, DoublePoint(420, 320), DoubleSize(-400, -3
00)); |
| 331 } |
| 332 |
| 333 TEST_F(ScrollAnchorCornerTest, CornersRTL) |
| 334 { |
| 335 setBodyInnerHTML( |
| 336 "<style>" |
| 337 " html {" |
| 338 " direction: rtl;" |
| 339 " }" |
| 340 " body {" |
| 341 " position: absolute; border: 10px solid #ccc;" |
| 342 " width: 1220px; height: 920px;" |
| 343 " }" |
| 344 " #a, #b, #c, #d {" |
| 345 " position: absolute; background-color: #ace;" |
| 346 " width: 400px; height: 300px;" |
| 347 " }" |
| 348 " #a, #b { top: 0; }" |
| 349 " #a, #c { left: 0; }" |
| 350 " #b, #d { right: 0; }" |
| 351 " #c, #d { bottom: 0; }" |
| 352 " .big { width: 800px !important; height: 600px !important }" |
| 353 "</style>" |
| 354 "<div id=a></div>" |
| 355 "<div id=b></div>" |
| 356 "<div id=c></div>" |
| 357 "<div id=d></div>"); |
| 358 |
| 359 checkCorner("b", Corner::TopRight, DoublePoint(-20, 20), DoubleSize(0, 0))
; |
| 360 checkCorner("a", Corner::TopRight, DoublePoint(-420, 20), DoubleSize(400, 0
)); |
| 361 checkCorner("d", Corner::TopRight, DoublePoint(-20, 320), DoubleSize(0, -30
0)); |
| 362 checkCorner("c", Corner::TopRight, DoublePoint(-420, 320), DoubleSize(400, -
300)); |
| 363 } |
| 364 |
| 365 TEST_F(ScrollAnchorCornerTest, CornersVerticalRL) |
| 366 { |
| 367 setBodyInnerHTML( |
| 368 "<style>" |
| 369 " html {" |
| 370 " writing-mode: vertical-rl;" |
| 371 " }" |
| 372 " body {" |
| 373 " position: absolute; border: 10px solid #ccc;" |
| 374 " width: 1220px; height: 920px;" |
| 375 " }" |
| 376 " #a, #b, #c, #d {" |
| 377 " position: absolute; background-color: #ace;" |
| 378 " width: 400px; height: 300px;" |
| 379 " }" |
| 380 " #a, #b { top: 0; }" |
| 381 " #a, #c { left: 0; }" |
| 382 " #b, #d { right: 0; }" |
| 383 " #c, #d { bottom: 0; }" |
| 384 " .big { width: 800px !important; height: 600px !important }" |
| 385 "</style>" |
| 386 "<div id=a></div>" |
| 387 "<div id=b></div>" |
| 388 "<div id=c></div>" |
| 389 "<div id=d></div>"); |
| 390 |
| 391 checkCorner("b", Corner::TopRight, DoublePoint(-20, 20), DoubleSize(0, 0))
; |
| 392 checkCorner("a", Corner::TopRight, DoublePoint(-420, 20), DoubleSize(400, 0
)); |
| 393 checkCorner("d", Corner::TopRight, DoublePoint(-20, 320), DoubleSize(0, -30
0)); |
| 394 checkCorner("c", Corner::TopRight, DoublePoint(-420, 320), DoubleSize(400, -
300)); |
| 299 } | 395 } |
| 300 | 396 |
| 301 } | 397 } |
| OLD | NEW |