Skip to content
  • wangxianzhu@chromium.org's avatar
    Element.getBoundingClientRect() and Element.getClientRects() return incorrect... · 254f322b
    wangxianzhu@chromium.org authored
    Element.getBoundingClientRect() and Element.getClientRects() return incorrect values in frames in a scaled page
    https://bugs.webkit.org/show_bug.cgi?id=88430
    
    Source/WebCore:
    
    Element.getBoudingClientRect() and Element.getClientRects() should not scale back the rects
    if the element is in a frame because page scale only apply to elements in the main frame.
    
    Reviewed by James Robinson.
    
    Tests: fast/dom/Element/scale-page-bounding-client-rect-in-frame.html
           fast/dom/Element/scale-page-client-rects-in-frame.html
    
    * dom/Document.cpp:
    (WebCore):
    (WebCore::Document::adjustFloatQuadsForScrollAndAbsoluteZoomAndFrameScale): Extracted from Element.cpp and Range.cpp and fixed issue of pageScale in frames.
    (WebCore::Document::adjustFloatRectForScrollAndAbsoluteZoomAndFrameScale): Extracted from Element.cpp and fixed issue of pageScale in frames.
    * dom/Document.h:
    (WebCore):
    (Document):
    * dom/Element.cpp:
    (WebCore::Element::getClientRects):
    (WebCore::Element::getBoundingClientRect):
    * dom/Range.cpp:
    (WebCore):
    (WebCore::adjustFloatQuadsForScrollAndAbsoluteZoomAndPageScale): Moved into Document and fixed issue of pageScale in frames.
    (WebCore::Range::getBorderAndTextQuads):
    * rendering/RenderObject.h: Removed adjustFloatQuadForPageScale and adjustFloatRectForPageScale because they seem unrelated to RenderObject.
    (WebCore):
    
    LayoutTests:
    
    Reviewed by James Robinson.
    
    * fast/dom/Element/resources/client-rect-frame.html: Added.
    * fast/dom/Element/scale-page-bounding-client-rect-in-frame-expected.txt: Added.
    * fast/dom/Element/scale-page-bounding-client-rect-in-frame.html: Added.
    * fast/dom/Element/scale-page-client-rects-in-frame-expected.txt: Added.
    * fast/dom/Element/scale-page-client-rects-in-frame.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@119690 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    254f322b