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

Side by Side Diff: Source/core/dom/Element.cpp

Issue 18601002: Add infrastructure for partial layouts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Put behind PartialLayout runtime flag Created 7 years, 3 months 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 | Annotate | Revision Log
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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 static int adjustForLocalZoom(LayoutUnit value, RenderObject* renderer) 562 static int adjustForLocalZoom(LayoutUnit value, RenderObject* renderer)
563 { 563 {
564 float zoomFactor = localZoomForRenderer(renderer); 564 float zoomFactor = localZoomForRenderer(renderer);
565 if (zoomFactor == 1) 565 if (zoomFactor == 1)
566 return value; 566 return value;
567 return lroundf(value / zoomFactor); 567 return lroundf(value / zoomFactor);
568 } 568 }
569 569
570 int Element::offsetLeft() 570 int Element::offsetLeft()
571 { 571 {
572 document().updateLayoutIgnorePendingStylesheets(); 572 document().partialUpdateLayoutIgnorePendingStylesheets(this);
573 if (RenderBoxModelObject* renderer = renderBoxModelObject()) 573 if (RenderBoxModelObject* renderer = renderBoxModelObject())
574 return adjustForLocalZoom(renderer->pixelSnappedOffsetLeft(), renderer); 574 return adjustForLocalZoom(renderer->pixelSnappedOffsetLeft(), renderer);
575 return 0; 575 return 0;
576 } 576 }
577 577
578 int Element::offsetTop() 578 int Element::offsetTop()
579 { 579 {
580 document().updateLayoutIgnorePendingStylesheets(); 580 document().partialUpdateLayoutIgnorePendingStylesheets(this);
581 if (RenderBoxModelObject* renderer = renderBoxModelObject()) 581 if (RenderBoxModelObject* renderer = renderBoxModelObject())
582 return adjustForLocalZoom(renderer->pixelSnappedOffsetTop(), renderer); 582 return adjustForLocalZoom(renderer->pixelSnappedOffsetTop(), renderer);
583 return 0; 583 return 0;
584 } 584 }
585 585
586 int Element::offsetWidth() 586 int Element::offsetWidth()
587 { 587 {
588 document().updateStyleForNodeIfNeeded(this); 588 document().updateStyleForNodeIfNeeded(this);
589 589
590 if (RenderBox* renderer = renderBox()) { 590 if (RenderBox* renderer = renderBox()) {
591 if (!renderer->requiresLayoutToDetermineWidth()) 591 if (!renderer->requiresLayoutToDetermineWidth())
592 return adjustLayoutUnitForAbsoluteZoom(renderer->fixedOffsetWidth(), renderer).round(); 592 return adjustLayoutUnitForAbsoluteZoom(renderer->fixedOffsetWidth(), renderer).round();
593 } 593 }
594 594
595 document().updateLayoutIgnorePendingStylesheets(); 595 document().partialUpdateLayoutIgnorePendingStylesheets(this);
596 if (RenderBoxModelObject* renderer = renderBoxModelObject()) 596 if (RenderBoxModelObject* renderer = renderBoxModelObject())
597 return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedOffsetWidth (), renderer).round(); 597 return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedOffsetWidth (), renderer).round();
598 return 0; 598 return 0;
599 } 599 }
600 600
601 int Element::offsetHeight() 601 int Element::offsetHeight()
602 { 602 {
603 document().updateLayoutIgnorePendingStylesheets(); 603 document().partialUpdateLayoutIgnorePendingStylesheets(this);
604 if (RenderBoxModelObject* renderer = renderBoxModelObject()) 604 if (RenderBoxModelObject* renderer = renderBoxModelObject())
605 return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedOffsetHeigh t(), renderer).round(); 605 return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedOffsetHeigh t(), renderer).round();
606 return 0; 606 return 0;
607 } 607 }
608 608
609 Element* Element::bindingsOffsetParent() 609 Element* Element::bindingsOffsetParent()
610 { 610 {
611 Element* element = offsetParent(); 611 Element* element = offsetParent();
612 if (!element || !element->isInShadowTree()) 612 if (!element || !element->isInShadowTree())
613 return element; 613 return element;
(...skipping 3020 matching lines...) Expand 10 before | Expand all | Expand 10 after
3634 return 0; 3634 return 0;
3635 } 3635 }
3636 3636
3637 Attribute* UniqueElementData::attributeItem(unsigned index) 3637 Attribute* UniqueElementData::attributeItem(unsigned index)
3638 { 3638 {
3639 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); 3639 ASSERT_WITH_SECURITY_IMPLICATION(index < length());
3640 return &m_attributeVector.at(index); 3640 return &m_attributeVector.at(index);
3641 } 3641 }
3642 3642
3643 } // namespace WebCore 3643 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698