Changeset 93728 in webkit


Ignore:
Timestamp:
Aug 24, 2011 1:20:57 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

[CSSRegions] Fix Element::getBoundingClientRect and Element::getClientRects for content flow
https://bugs.webkit.org/show_bug.cgi?id=66641

Original author of the patch is Mihnea Ovidenie <mihnea@adobe.com>.

Source/WebCore:

Redirected the mapLocalToContainer method to the appropriate RenderRegion.

Note: RenderObject::absoluteQuads method needs some refactor to support multiple regions,
will do that in a separate bug.

Patch by Alexandru Chiculita <Alexandru Chiculita> on 2011-08-24
Reviewed by David Hyatt.

Tests: fast/regions/flowed-content-bounding-client-rect-horizontal-bt.html

fast/regions/flowed-content-bounding-client-rect-vertical-rl.html
fast/regions/flowed-content-bounding-client-rect-vertical.html
fast/regions/flowed-content-bounding-client-rect.html
fast/regions/flowed-content-transform-bounding-client-rect.html

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::mapLocalToContainer):

  • rendering/RenderFlowThread.cpp:

(WebCore::RenderFlowThread::renderRegionForLine):
(WebCore::RenderFlowThread::mapFromFlowToRegion):

  • rendering/RenderFlowThread.h:

LayoutTests:

Patch by Alexandru Chiculita <Alexandru Chiculita> on 2011-08-24
Reviewed by David Hyatt.

  • fast/regions/flowed-content-bounding-client-rect-expected.txt: Added.
  • fast/regions/flowed-content-bounding-client-rect-horizontal-bt-expected.txt: Added.
  • fast/regions/flowed-content-bounding-client-rect-horizontal-bt.html: Added.
  • fast/regions/flowed-content-bounding-client-rect-vertical-expected.txt: Added.
  • fast/regions/flowed-content-bounding-client-rect-vertical-rl-expected.txt: Added.
  • fast/regions/flowed-content-bounding-client-rect-vertical-rl.html: Added.
  • fast/regions/flowed-content-bounding-client-rect-vertical.html: Added.
  • fast/regions/flowed-content-bounding-client-rect.html: Added.
  • fast/regions/flowed-content-transform-bounding-client-rect-expected.txt: Added.
  • fast/regions/flowed-content-transform-bounding-client-rect.html: Added.
  • fast/regions/resources/helper.js: Added.

(rectToArray):
(areEqualNumbers):
(areEqualRects):
(assertEqualRects):
(testBoundingRects):

Location:
trunk
Files:
11 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r93726 r93728  
     12011-08-24  Alexandru Chiculita  <achicu@adobe.com>
     2
     3        [CSSRegions] Fix Element::getBoundingClientRect and Element::getClientRects for content flow
     4        https://bugs.webkit.org/show_bug.cgi?id=66641
     5
     6        Original author of the patch is Mihnea Ovidenie <mihnea@adobe.com>.
     7
     8        Reviewed by David Hyatt.
     9
     10        * fast/regions/flowed-content-bounding-client-rect-expected.txt: Added.
     11        * fast/regions/flowed-content-bounding-client-rect-horizontal-bt-expected.txt: Added.
     12        * fast/regions/flowed-content-bounding-client-rect-horizontal-bt.html: Added.
     13        * fast/regions/flowed-content-bounding-client-rect-vertical-expected.txt: Added.
     14        * fast/regions/flowed-content-bounding-client-rect-vertical-rl-expected.txt: Added.
     15        * fast/regions/flowed-content-bounding-client-rect-vertical-rl.html: Added.
     16        * fast/regions/flowed-content-bounding-client-rect-vertical.html: Added.
     17        * fast/regions/flowed-content-bounding-client-rect.html: Added.
     18        * fast/regions/flowed-content-transform-bounding-client-rect-expected.txt: Added.
     19        * fast/regions/flowed-content-transform-bounding-client-rect.html: Added.
     20        * fast/regions/resources/helper.js: Added.
     21        (rectToArray):
     22        (areEqualNumbers):
     23        (areEqualRects):
     24        (assertEqualRects):
     25        (testBoundingRects):
     26
    1272011-08-24  Nate Chapin  <japhet@chromium.org>
    228
  • trunk/Source/WebCore/ChangeLog

    r93727 r93728  
     12011-08-24  Alexandru Chiculita  <achicu@adobe.com>
     2
     3        [CSSRegions] Fix Element::getBoundingClientRect and Element::getClientRects for content flow
     4        https://bugs.webkit.org/show_bug.cgi?id=66641
     5
     6        Original author of the patch is Mihnea Ovidenie <mihnea@adobe.com>.
     7
     8        Redirected the mapLocalToContainer method to the appropriate RenderRegion.
     9
     10        Note: RenderObject::absoluteQuads method needs some refactor to support multiple regions,
     11        will do that in a separate bug.
     12
     13        Reviewed by David Hyatt.
     14
     15        Tests: fast/regions/flowed-content-bounding-client-rect-horizontal-bt.html
     16               fast/regions/flowed-content-bounding-client-rect-vertical-rl.html
     17               fast/regions/flowed-content-bounding-client-rect-vertical.html
     18               fast/regions/flowed-content-bounding-client-rect.html
     19               fast/regions/flowed-content-transform-bounding-client-rect.html
     20
     21        * rendering/RenderBox.cpp:
     22        (WebCore::RenderBox::mapLocalToContainer):
     23        * rendering/RenderFlowThread.cpp:
     24        (WebCore::RenderFlowThread::renderRegionForLine):
     25        (WebCore::RenderFlowThread::mapFromFlowToRegion):
     26        * rendering/RenderFlowThread.h:
     27
    1282011-08-24  Alok Priyadarshi  <alokp@chromium.org>
    229
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r93547 r93728  
    4242#include "PaintInfo.h"
    4343#include "RenderArena.h"
     44#include "RenderFlowThread.h"
    4445#include "RenderInline.h"
    4546#include "RenderLayer.h"
    4647#include "RenderPart.h"
     48#include "RenderRegion.h"
    4749#include "RenderTableCell.h"
    4850#include "RenderTheme.h"
     
    12591261        return;
    12601262    }
    1261    
     1263
     1264    if (o->isRenderFlowThread()) {
     1265        // Transform from render flow coordinates into region coordinates.
     1266        RenderRegion* region = toRenderFlowThread(o)->mapFromFlowToRegion(transformState);
     1267        if (region)
     1268            region->mapLocalToContainer(region->containerForRepaint(), fixed, useTransforms, transformState, wasFixed);
     1269        return;
     1270    }
     1271
    12621272    o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, wasFixed);
    12631273}
  • trunk/Source/WebCore/rendering/RenderFlowThread.cpp

    r93708 r93728  
    3939#include "RenderRegion.h"
    4040#include "RenderView.h"
     41#include "TransformState.h"
    4142
    4243namespace WebCore {
     
    472473    ASSERT(!m_regionsInvalidated);
    473474   
    474     // All the regions should start at 0.
    475     ASSERT(position >= 0);
    476    
    477475    // If no region matches the position and extendLastRegion is true, it will return
    478476    // the last valid region. It is similar to auto extending the size of the last region.
     
    486484            continue;
    487485
     486        if (position <= 0)
     487            return region;
     488
    488489        LayoutRect regionRect = region->regionRect();
    489490
     
    515516
    516517
     518RenderRegion* RenderFlowThread::mapFromFlowToRegion(TransformState& transformState) const
     519{
     520    if (!hasValidRegions())
     521        return 0;
     522
     523    LayoutRect boxRect = transformState.mappedQuad().enclosingBoundingBox();
     524    flipForWritingMode(boxRect);
     525
     526    // FIXME: We need to refactor RenderObject::absoluteQuads to be able to split the quads across regions,
     527    // for now we just take the center of the mapped enclosing box and map it to a region.
     528    // Note: Using the center in order to avoid rounding errors.
     529
     530    const bool extendLastRegion = true;
     531    LayoutPoint center = boxRect.center();
     532    RenderRegion* renderRegion = renderRegionForLine(isHorizontalWritingMode() ? center.y() : center.x(), extendLastRegion);
     533    if (!renderRegion)
     534        return 0;
     535
     536    LayoutRect flippedRegionRect(renderRegion->regionRect());
     537    flipForWritingMode(flippedRegionRect);
     538
     539    transformState.move(renderRegion->contentBoxRect().location() - flippedRegionRect.location());
     540
     541    return renderRegion;
     542}
     543
    517544} // namespace WebCore
  • trunk/Source/WebCore/rendering/RenderFlowThread.h

    r93708 r93728  
    104104    void enableRegionFitting() { ASSERT(m_regionFittingDisableCount > 0); m_regionFittingDisableCount--; }
    105105
     106    RenderRegion* mapFromFlowToRegion(TransformState&) const;
     107
    106108private:
    107109    virtual const char* renderName() const { return "RenderFlowThread"; }
Note: See TracChangeset for help on using the changeset viewer.