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

Side by Side Diff: Source/core/rendering/RenderBoxModelObject.cpp

Issue 323013004: Clean up transform methods in GraphicsContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2nd Attempt Mac build fix Created 6 years, 6 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
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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 context->clipRoundedRect(RoundedRect(topCorner, topCornerRadii)); 467 context->clipRoundedRect(RoundedRect(topCorner, topCornerRadii));
468 468
469 IntRect bottomCorner(clipRect.rect().x(), rect.y(), rect.maxX() - cl ipRect.rect().x(), clipRect.rect().maxY() - rect.y()); 469 IntRect bottomCorner(clipRect.rect().x(), rect.y(), rect.maxX() - cl ipRect.rect().x(), clipRect.rect().maxY() - rect.y());
470 RoundedRect::Radii bottomCornerRadii; 470 RoundedRect::Radii bottomCornerRadii;
471 bottomCornerRadii.setBottomLeft(clipRect.radii().bottomLeft()); 471 bottomCornerRadii.setBottomLeft(clipRect.radii().bottomLeft());
472 context->clipRoundedRect(RoundedRect(bottomCorner, bottomCornerRadii )); 472 context->clipRoundedRect(RoundedRect(bottomCorner, bottomCornerRadii ));
473 } 473 }
474 } 474 }
475 } 475 }
476 476
477 // FIXME: See crbug.com/382491. The use of getCTM in this context is incorrect b ecause the matrix returned does not
478 // include scales applied at raster time, such as the device zoom.
477 static LayoutRect shrinkRectByOnePixel(GraphicsContext* context, const LayoutRec t& rect) 479 static LayoutRect shrinkRectByOnePixel(GraphicsContext* context, const LayoutRec t& rect)
478 { 480 {
479 LayoutRect shrunkRect = rect; 481 LayoutRect shrunkRect = rect;
480 AffineTransform transform = context->getCTM(); 482 AffineTransform transform = context->getCTM();
481 shrunkRect.inflateX(-static_cast<LayoutUnit>(ceil(1 / transform.xScale()))); 483 shrunkRect.inflateX(-static_cast<LayoutUnit>(ceil(1 / transform.xScale())));
482 shrunkRect.inflateY(-static_cast<LayoutUnit>(ceil(1 / transform.yScale()))); 484 shrunkRect.inflateY(-static_cast<LayoutUnit>(ceil(1 / transform.yScale())));
483 return shrunkRect; 485 return shrunkRect;
484 } 486 }
485 487
486 LayoutRect RenderBoxModelObject::borderInnerRectAdjustedForBleedAvoidance(Graphi csContext* context, const LayoutRect& rect, BackgroundBleedAvoidance bleedAvoida nce) const 488 LayoutRect RenderBoxModelObject::borderInnerRectAdjustedForBleedAvoidance(Graphi csContext* context, const LayoutRect& rect, BackgroundBleedAvoidance bleedAvoida nce) const
(...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after
2547 // of the box itself, which is always pixel-aligned. 2549 // of the box itself, which is always pixel-aligned.
2548 IntRect rectToClipOut = border.rect(); 2550 IntRect rectToClipOut = border.rect();
2549 2551
2550 // If the box is opaque, it is unnecessary to clip it out. H owever, doing so saves time 2552 // If the box is opaque, it is unnecessary to clip it out. H owever, doing so saves time
2551 // when painting the shadow. On the other hand, it introduce s subpixel gaps along the 2553 // when painting the shadow. On the other hand, it introduce s subpixel gaps along the
2552 // edges if they are not pixel-aligned. Those are avoided by insetting the clipping path 2554 // edges if they are not pixel-aligned. Those are avoided by insetting the clipping path
2553 // by one pixel. 2555 // by one pixel.
2554 if (hasOpaqueBackground) { 2556 if (hasOpaqueBackground) {
2555 // FIXME: The function to decide on the policy based on the transform should be a named function. 2557 // FIXME: The function to decide on the policy based on the transform should be a named function.
2556 // FIXME: It's not clear if this check is right. What ab out integral scale factors? 2558 // FIXME: It's not clear if this check is right. What ab out integral scale factors?
2559 // FIXME: See crbug.com/382491. The use of getCTM may al so be wrong because it does not include
2560 // device zoom applied at raster time.
2557 AffineTransform transform = context->getCTM(); 2561 AffineTransform transform = context->getCTM();
2558 if (transform.a() != 1 || (transform.d() != 1 && transfo rm.d() != -1) || transform.b() || transform.c()) 2562 if (transform.a() != 1 || (transform.d() != 1 && transfo rm.d() != -1) || transform.b() || transform.c())
2559 rectToClipOut.inflate(-1); 2563 rectToClipOut.inflate(-1);
2560 } 2564 }
2561 2565
2562 if (!rectToClipOut.isEmpty()) { 2566 if (!rectToClipOut.isEmpty()) {
2563 context->clipOut(rectToClipOut); 2567 context->clipOut(rectToClipOut);
2564 } 2568 }
2565 } 2569 }
2566 } 2570 }
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2726 2730
2727 LayoutUnit y = paddingTop() + borderTop(); 2731 LayoutUnit y = paddingTop() + borderTop();
2728 2732
2729 return currentStyle->isHorizontalWritingMode() ? LayoutRect(x, y, caretWidth , height) : LayoutRect(y, x, height, caretWidth); 2733 return currentStyle->isHorizontalWritingMode() ? LayoutRect(x, y, caretWidth , height) : LayoutRect(y, x, height, caretWidth);
2730 } 2734 }
2731 2735
2732 bool RenderBoxModelObject::shouldAntialiasLines(GraphicsContext* context) 2736 bool RenderBoxModelObject::shouldAntialiasLines(GraphicsContext* context)
2733 { 2737 {
2734 // FIXME: We may want to not antialias when scaled by an integral value, 2738 // FIXME: We may want to not antialias when scaled by an integral value,
2735 // and we may want to antialias when translated by a non-integral value. 2739 // and we may want to antialias when translated by a non-integral value.
2740 // FIXME: See crbug.com/382491. getCTM does not include scale factors applie d at raster time, such
2741 // as device zoom.
2736 return !context->getCTM().isIdentityOrTranslationOrFlipped(); 2742 return !context->getCTM().isIdentityOrTranslationOrFlipped();
2737 } 2743 }
2738 2744
2739 void RenderBoxModelObject::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, Tra nsformState& transformState) const 2745 void RenderBoxModelObject::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, Tra nsformState& transformState) const
2740 { 2746 {
2741 // We don't expect to be called during layout. 2747 // We don't expect to be called during layout.
2742 ASSERT(!view() || !view()->layoutStateEnabled()); 2748 ASSERT(!view() || !view()->layoutStateEnabled());
2743 2749
2744 RenderObject* o = container(); 2750 RenderObject* o = container();
2745 if (!o) 2751 if (!o)
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
2836 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 2842 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
2837 for (RenderObject* child = startChild; child && child != endChild; ) { 2843 for (RenderObject* child = startChild; child && child != endChild; ) {
2838 // Save our next sibling as moveChildTo will clear it. 2844 // Save our next sibling as moveChildTo will clear it.
2839 RenderObject* nextSibling = child->nextSibling(); 2845 RenderObject* nextSibling = child->nextSibling();
2840 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 2846 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
2841 child = nextSibling; 2847 child = nextSibling;
2842 } 2848 }
2843 } 2849 }
2844 2850
2845 } // namespace WebCore 2851 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.cpp ('k') | Source/core/rendering/RenderLayerScrollableArea.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698