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

Side by Side Diff: sky/engine/core/dom/Element.cpp

Issue 710113003: Initial step of removing CSS zoom related properties. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « sky/engine/core/dom/Document.cpp ('k') | sky/engine/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 document().updateLayoutIgnorePendingStylesheets(); 349 document().updateLayoutIgnorePendingStylesheets();
350 if (RenderBoxModelObject* renderer = renderBoxModelObject()) 350 if (RenderBoxModelObject* renderer = renderBoxModelObject())
351 return lroundf(adjustForLocalZoom(renderer->pixelSnappedOffsetTop(), *re nderer)); 351 return lroundf(adjustForLocalZoom(renderer->pixelSnappedOffsetTop(), *re nderer));
352 return 0; 352 return 0;
353 } 353 }
354 354
355 int Element::offsetWidth() 355 int Element::offsetWidth()
356 { 356 {
357 document().updateLayoutIgnorePendingStylesheets(); 357 document().updateLayoutIgnorePendingStylesheets();
358 if (RenderBoxModelObject* renderer = renderBoxModelObject()) 358 if (RenderBoxModelObject* renderer = renderBoxModelObject())
359 return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedOffsetWidth (), *renderer).round(); 359 return renderer->pixelSnappedOffsetWidth();
360 return 0; 360 return 0;
361 } 361 }
362 362
363 int Element::offsetHeight() 363 int Element::offsetHeight()
364 { 364 {
365 document().updateLayoutIgnorePendingStylesheets(); 365 document().updateLayoutIgnorePendingStylesheets();
366 if (RenderBoxModelObject* renderer = renderBoxModelObject()) 366 if (RenderBoxModelObject* renderer = renderBoxModelObject())
367 return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedOffsetHeigh t(), *renderer).round(); 367 return renderer->pixelSnappedOffsetHeight();
368 return 0; 368 return 0;
369 } 369 }
370 370
371 Element* Element::offsetParent() 371 Element* Element::offsetParent()
372 { 372 {
373 document().updateLayoutIgnorePendingStylesheets(); 373 document().updateLayoutIgnorePendingStylesheets();
374 if (RenderObject* renderer = this->renderer()) 374 if (RenderObject* renderer = this->renderer())
375 return renderer->offsetParent(); 375 return renderer->offsetParent();
376 return 0; 376 return 0;
377 } 377 }
378 378
379 int Element::clientLeft() 379 int Element::clientLeft()
380 { 380 {
381 document().updateLayoutIgnorePendingStylesheets(); 381 document().updateLayoutIgnorePendingStylesheets();
382 382
383 if (RenderBox* renderer = renderBox()) 383 if (RenderBox* renderer = renderBox())
384 return adjustLayoutUnitForAbsoluteZoom(roundToInt(renderer->clientLeft() ), *renderer); 384 return roundToInt(renderer->clientLeft());
385 return 0; 385 return 0;
386 } 386 }
387 387
388 int Element::clientTop() 388 int Element::clientTop()
389 { 389 {
390 document().updateLayoutIgnorePendingStylesheets(); 390 document().updateLayoutIgnorePendingStylesheets();
391 391
392 if (RenderBox* renderer = renderBox()) 392 if (RenderBox* renderer = renderBox())
393 return adjustLayoutUnitForAbsoluteZoom(roundToInt(renderer->clientTop()) , *renderer); 393 return roundToInt(renderer->clientTop());
394 return 0; 394 return 0;
395 } 395 }
396 396
397 int Element::clientWidth() 397 int Element::clientWidth()
398 { 398 {
399 document().updateLayoutIgnorePendingStylesheets(); 399 document().updateLayoutIgnorePendingStylesheets();
400 400
401 // FIXME(sky): Can we just use getBoundingClientRect() instead? 401 // FIXME(sky): Can we just use getBoundingClientRect() instead?
402 if (document().documentElement() == this) { 402 if (document().documentElement() == this) {
403 if (FrameView* view = document().view()) { 403 if (FrameView* view = document().view())
404 if (RenderView* renderView = document().renderView()) 404 return view->layoutSize().width();
405 return adjustLayoutUnitForAbsoluteZoom(view->layoutSize().width( ), *renderView);
406 }
407 } 405 }
408 406
409 if (RenderBox* renderer = renderBox()) 407 if (RenderBox* renderer = renderBox())
410 return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedClientWidth (), *renderer).round(); 408 return renderer->pixelSnappedClientWidth();
411 return 0; 409 return 0;
412 } 410 }
413 411
414 int Element::clientHeight() 412 int Element::clientHeight()
415 { 413 {
416 document().updateLayoutIgnorePendingStylesheets(); 414 document().updateLayoutIgnorePendingStylesheets();
417 415
418 // FIXME(sky): Can we just use getBoundingClientRect() instead? 416 // FIXME(sky): Can we just use getBoundingClientRect() instead?
419 if (document().documentElement() == this) { 417 if (document().documentElement() == this) {
420 if (FrameView* view = document().view()) { 418 if (FrameView* view = document().view())
421 if (RenderView* renderView = document().renderView()) 419 return view->layoutSize().height();
422 return adjustLayoutUnitForAbsoluteZoom(view->layoutSize().height (), *renderView);
423 }
424 } 420 }
425 421
426 if (RenderBox* renderer = renderBox()) 422 if (RenderBox* renderer = renderBox())
427 return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedClientHeigh t(), *renderer).round(); 423 return renderer->pixelSnappedClientHeight();
428 return 0; 424 return 0;
429 } 425 }
430 426
431 int Element::scrollLeft() 427 int Element::scrollLeft()
432 { 428 {
433 document().updateLayoutIgnorePendingStylesheets(); 429 document().updateLayoutIgnorePendingStylesheets();
434 430
435 if (document().documentElement() != this) { 431 if (document().documentElement() != this) {
436 if (RenderBox* rend = renderBox()) 432 if (RenderBox* rend = renderBox())
437 return adjustDoubleForAbsoluteZoom(rend->scrollLeft(), *rend); 433 return rend->scrollLeft();
438 } 434 }
439 435
440 return 0; 436 return 0;
441 } 437 }
442 438
443 int Element::scrollTop() 439 int Element::scrollTop()
444 { 440 {
445 document().updateLayoutIgnorePendingStylesheets(); 441 document().updateLayoutIgnorePendingStylesheets();
446 442
447 if (document().documentElement() != this) { 443 if (document().documentElement() != this) {
448 if (RenderBox* rend = renderBox()) 444 if (RenderBox* rend = renderBox())
449 return adjustLayoutUnitForAbsoluteZoom(rend->scrollTop(), *rend); 445 return rend->scrollTop();
450 } 446 }
451 447
452 return 0; 448 return 0;
453 } 449 }
454 450
455 void Element::setScrollLeft(int newLeft) 451 void Element::setScrollLeft(int newLeft)
456 { 452 {
457 document().updateLayoutIgnorePendingStylesheets(); 453 document().updateLayoutIgnorePendingStylesheets();
458 454
459 if (document().documentElement() != this) { 455 if (document().documentElement() != this) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 } 507 }
512 508
513 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant ly. 509 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant ly.
514 setScrollTop(position); 510 setScrollTop(position);
515 } 511 }
516 512
517 int Element::scrollWidth() 513 int Element::scrollWidth()
518 { 514 {
519 document().updateLayoutIgnorePendingStylesheets(); 515 document().updateLayoutIgnorePendingStylesheets();
520 if (RenderBox* rend = renderBox()) 516 if (RenderBox* rend = renderBox())
521 return adjustLayoutUnitForAbsoluteZoom(rend->scrollWidth(), *rend).toDou ble(); 517 return rend->scrollWidth().toDouble();
522 return 0; 518 return 0;
523 } 519 }
524 520
525 int Element::scrollHeight() 521 int Element::scrollHeight()
526 { 522 {
527 document().updateLayoutIgnorePendingStylesheets(); 523 document().updateLayoutIgnorePendingStylesheets();
528 if (RenderBox* rend = renderBox()) 524 if (RenderBox* rend = renderBox())
529 return adjustLayoutUnitForAbsoluteZoom(rend->scrollHeight(), *rend).toDo uble(); 525 return rend->scrollHeight().toDouble();
530 return 0; 526 return 0;
531 } 527 }
532 528
533 PassRefPtr<ClientRectList> Element::getClientRects() 529 PassRefPtr<ClientRectList> Element::getClientRects()
534 { 530 {
535 document().updateLayoutIgnorePendingStylesheets(); 531 document().updateLayoutIgnorePendingStylesheets();
536 532
537 RenderBoxModelObject* renderBoxModelObject = this->renderBoxModelObject(); 533 RenderBoxModelObject* renderBoxModelObject = this->renderBoxModelObject();
538 if (!renderBoxModelObject) 534 if (!renderBoxModelObject)
539 return ClientRectList::create(); 535 return ClientRectList::create();
(...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1842 return false; 1838 return false;
1843 // Turn off style sharing for elements that can gain layers for reasons outs ide of the style system. 1839 // Turn off style sharing for elements that can gain layers for reasons outs ide of the style system.
1844 // See comments in RenderObject::setStyle(). 1840 // See comments in RenderObject::setStyle().
1845 // FIXME: Why does gaining a layer from outside the style system require dis abling sharing? 1841 // FIXME: Why does gaining a layer from outside the style system require dis abling sharing?
1846 if (isHTMLCanvasElement(*this)) 1842 if (isHTMLCanvasElement(*this))
1847 return false; 1843 return false;
1848 return true; 1844 return true;
1849 } 1845 }
1850 1846
1851 } // namespace blink 1847 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/dom/Document.cpp ('k') | sky/engine/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698