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

Unified Diff: Source/core/paint/BackgroundImageGeometry.h

Issue 1300103003: Refactor code for calculating background image geometry (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/LayoutBox.cpp ('k') | Source/core/paint/BackgroundImageGeometry.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/BackgroundImageGeometry.h
diff --git a/Source/core/paint/BackgroundImageGeometry.h b/Source/core/paint/BackgroundImageGeometry.h
index b73de7bd4c5062faaf785f48b9ee5181f1275723..c93526541a6a3838f144ba331b2c88ec8f01c9a4 100644
--- a/Source/core/paint/BackgroundImageGeometry.h
+++ b/Source/core/paint/BackgroundImageGeometry.h
@@ -5,6 +5,7 @@
#ifndef BackgroundImageGeometry_h
#define BackgroundImageGeometry_h
+#include "core/paint/PaintPhase.h"
#include "platform/geometry/IntPoint.h"
#include "platform/geometry/IntRect.h"
#include "platform/geometry/IntSize.h"
@@ -12,6 +13,11 @@
namespace blink {
+class FillLayer;
+class LayoutBoxModelObject;
+class LayoutObject;
+class LayoutRect;
+
class BackgroundImageGeometry {
STACK_ALLOCATED();
public:
@@ -19,51 +25,38 @@ public:
: m_hasNonLocalGeometry(false)
{ }
- IntRect destRect() const { return m_destRect; }
- void setDestRect(const IntRect& destRect)
- {
- m_destRect = destRect;
- }
-
- IntPoint phase() const { return m_phase; }
- void setPhase(const IntPoint& phase)
- {
- m_phase = phase;
- }
+ void calculate(const LayoutBoxModelObject&, const LayoutBoxModelObject* paintContainer,
+ const GlobalPaintFlags, const FillLayer&, const LayoutRect& paintRect,
+ LayoutObject* backgroundObject = nullptr);
+ IntRect destRect() const { return m_destRect; }
IntSize tileSize() const { return m_tileSize; }
- void setTileSize(const IntSize& tileSize)
- {
- m_tileSize = tileSize;
- }
-
+ IntPoint phase() const { return m_phase; }
// Space-size represents extra width and height that may be added to
- // the image if used as a pattern with repeat: space
+ // the image if used as a pattern with background-repeat: space.
IntSize spaceSize() const { return m_repeatSpacing; }
- void setSpaceSize(const IntSize& repeatSpacing)
- {
- m_repeatSpacing = repeatSpacing;
- }
+ // Has background-attachment: fixed. Implies that we can't always cheaply compute destRect.
+ bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; }
+private:
+ void setDestRect(const IntRect& destRect) { m_destRect = destRect; }
+ void setPhase(const IntPoint& phase) { m_phase = phase; }
+ void setTileSize(const IntSize& tileSize) { m_tileSize = tileSize; }
+ void setSpaceSize(const IntSize& repeatSpacing) { m_repeatSpacing = repeatSpacing; }
void setPhaseX(int x) { m_phase.setX(x); }
void setPhaseY(int y) { m_phase.setY(y); }
-
void setNoRepeatX(int xOffset);
void setNoRepeatY(int yOffset);
void useFixedAttachment(const IntPoint& attachmentPoint);
-
void clip(const IntRect&);
-
void setHasNonLocalGeometry() { m_hasNonLocalGeometry = true; }
- bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; }
-private:
IntRect m_destRect;
IntPoint m_phase;
IntSize m_tileSize;
IntSize m_repeatSpacing;
- bool m_hasNonLocalGeometry; // Has background-attachment: fixed. Implies that we can't always cheaply compute destRect.
+ bool m_hasNonLocalGeometry;
};
} // namespace blink
« no previous file with comments | « Source/core/layout/LayoutBox.cpp ('k') | Source/core/paint/BackgroundImageGeometry.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698