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

Unified Diff: Source/core/rendering/RenderObject.h

Issue 19697011: Change rendering code to use RenderObject::resolveColor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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/rendering/RenderMultiColumnSet.cpp ('k') | Source/core/rendering/RenderObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderObject.h
diff --git a/Source/core/rendering/RenderObject.h b/Source/core/rendering/RenderObject.h
index 663713313b1f60cc7004468919e7d955be23800a..b2e3263622ed77a15f97404ffd4a41a76e003238 100644
--- a/Source/core/rendering/RenderObject.h
+++ b/Source/core/rendering/RenderObject.h
@@ -243,7 +243,7 @@ public:
// again. We have to make sure the render tree updates as needed to accommodate the new
// normal flow object.
void handleDynamicFloatPositionChange();
-
+
// RenderObject tree manipulation
//////////////////////////////////////////
virtual bool canHaveChildren() const { return virtualChildren(); }
@@ -263,7 +263,7 @@ protected:
void setParent(RenderObject* parent)
{
m_parent = parent;
-
+
// Only update if our flow thread state is different from our new parent and if we're not a RenderFlowThread.
// A RenderFlowThread is always considered to be inside itself, so it never has to change its state
// in response to parent changes.
@@ -499,7 +499,7 @@ public:
// This function is kept in sync with anonymous block creation conditions in
// RenderBlock::createAnonymousBlock(). This includes creating an anonymous
// RenderBlock having a BLOCK or BOX display. Other classes such as RenderTextFragment
- // are not RenderBlocks and will return false. See https://bugs.webkit.org/show_bug.cgi?id=56709.
+ // are not RenderBlocks and will return false. See https://bugs.webkit.org/show_bug.cgi?id=56709.
return isAnonymous() && (style()->display() == BLOCK || style()->display() == BOX) && style()->styleType() == NOPSEUDO && isRenderBlock() && !isListMarker() && !isRenderFlowThread()
&& !isRenderFullScreen()
&& !isRenderFullScreenPlaceholder();
@@ -559,7 +559,7 @@ public:
bool posChildNeedsLayout() const { return m_bitfields.posChildNeedsLayout(); }
bool needsSimplifiedNormalFlowLayout() const { return m_bitfields.needsSimplifiedNormalFlowLayout(); }
bool normalChildNeedsLayout() const { return m_bitfields.normalChildNeedsLayout(); }
-
+
bool preferredLogicalWidthsDirty() const { return m_bitfields.preferredLogicalWidthsDirty(); }
bool isSelectionBorder() const;
@@ -583,7 +583,7 @@ public:
// any pseudo classes (and therefore has no concept of changing state).
RenderStyle* getCachedPseudoStyle(PseudoId, RenderStyle* parentStyle = 0) const;
PassRefPtr<RenderStyle> getUncachedPseudoStyle(const PseudoStyleRequest&, RenderStyle* parentStyle = 0, RenderStyle* ownStyle = 0) const;
-
+
virtual void updateDragState(bool dragOn);
RenderView* view() const { return document()->renderView(); };
@@ -624,7 +624,7 @@ public:
void setNeedsSimplifiedNormalFlowLayout();
void setPreferredLogicalWidthsDirty(bool, MarkingBehavior = MarkContainingBlockChain);
void invalidateContainerPreferredLogicalWidths();
-
+
void setNeedsLayoutAndPrefWidthsRecalc()
{
setNeedsLayout(true);
@@ -666,7 +666,7 @@ public:
/* This function performs a layout only if one is needed. */
void layoutIfNeeded() { if (needsLayout()) layout(); }
-
+
// used for element state updates that cannot be fixed with a
// repaint and do not need a relayout
virtual void updateFromElement() { }
@@ -731,7 +731,7 @@ public:
virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&, bool* offsetDependsOnPoint = 0) const;
// Return the offset from an object up the container() chain. Asserts that none of the intermediate objects have transforms.
LayoutSize offsetFromAncestorContainer(RenderObject*) const;
-
+
virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint&) const { }
// FIXME: useTransforms should go away eventually
@@ -755,6 +755,27 @@ public:
RenderStyle* firstLineStyle() const { return document()->styleSheetCollection()->usesFirstLineRules() ? cachedFirstLineStyle() : style(); }
RenderStyle* style(bool firstLine) const { return firstLine ? firstLineStyle() : style(); }
+ inline Color resolveColor(const RenderStyle* styleToUse, int colorProperty) const
+ {
+ return styleToUse->visitedDependentColor(colorProperty);
+ }
+
+ inline Color resolveColor(int colorProperty) const
+ {
+ return style()->visitedDependentColor(colorProperty);
+ }
+
+ inline Color resolveColor(int colorProperty, Color fallback) const
+ {
+ Color color = resolveColor(colorProperty);
+ return color.isValid() ? color : fallback;
+ }
+
+ inline Color resolveColor(Color color) const
+ {
+ return color;
+ }
+
// Used only by Element::pseudoStyleCacheIsInvalid to get a first line style based off of a
// given new style, without accessing the cache.
PassRefPtr<RenderStyle> uncachedFirstLineStyle(RenderStyle*) const;
@@ -762,7 +783,7 @@ public:
// Anonymous blocks that are part of of a continuation chain will return their inline continuation's outline style instead.
// This is typically only relevant when repainting.
virtual RenderStyle* outlineStyleForRepaint() const { return style(); }
-
+
virtual CursorDirective getCursor(const LayoutPoint&, Cursor&) const;
void getTextDecorationColors(int decorations, Color& underline, Color& overline, Color& linethrough, bool quirksMode = false, bool firstlineStyle = false);
@@ -774,7 +795,7 @@ public:
// Actually do the repaint of rect r for this object which has been computed in the coordinate space
// of repaintContainer. If repaintContainer is 0, repaint via the view.
void repaintUsingContainer(const RenderLayerModelObject* repaintContainer, const IntRect&) const;
-
+
// Repaint the entire object. Called when, e.g., the color of a border changes, or when a border
// style changes.
void repaint() const;
@@ -904,7 +925,7 @@ public:
virtual bool willRenderImage(CachedImage*);
void selectionStartEnd(int& spos, int& epos) const;
-
+
void remove() { if (parent()) parent()->removeChild(this); }
AnimationController* animation() const;
@@ -921,13 +942,13 @@ public:
// Pushes state onto RenderGeometryMap about how to map coordinates from this renderer to its container, or ancestorToStopAt (whichever is encountered first).
// Returns the renderer which was mapped to (container or ancestorToStopAt).
virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const;
-
+
bool shouldUseTransformFromContainer(const RenderObject* container) const;
void getTransformFromContainer(const RenderObject* container, const LayoutSize& offsetInContainer, TransformationMatrix&) const;
-
+
// return true if this object requires a new stacking context
- bool createsGroup() const { return isTransparent() || hasMask() || hasFilter() || hasBlendMode(); }
-
+ bool createsGroup() const { return isTransparent() || hasMask() || hasFilter() || hasBlendMode(); }
+
virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& /* additionalOffset */, const RenderLayerModelObject* /* paintContainer */ = 0) { };
LayoutRect absoluteOutlineBounds() const
@@ -955,7 +976,7 @@ protected:
void paintFocusRing(PaintInfo&, const LayoutPoint&, RenderStyle*);
void paintOutline(PaintInfo&, const LayoutRect&);
void addPDFURLRect(GraphicsContext*, const LayoutRect&);
-
+
virtual LayoutRect viewRect() const;
void adjustRectForOutlineAndShadow(LayoutRect&) const;
@@ -1048,7 +1069,7 @@ private:
, m_boxDecorationState(NoBoxDecorations)
{
}
-
+
// 31 bits have been used here. There is one bit available.
ADD_BOOLEAN_BITFIELD(needsLayout, NeedsLayout);
ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovementLayout);
@@ -1099,7 +1120,7 @@ private:
ALWAYS_INLINE SelectionState selectionState() const { return static_cast<SelectionState>(m_selectionState); }
ALWAYS_INLINE void setSelectionState(SelectionState selectionState) { m_selectionState = selectionState; }
-
+
ALWAYS_INLINE FlowThreadState flowThreadState() const { return static_cast<FlowThreadState>(m_flowThreadState); }
ALWAYS_INLINE void setFlowThreadState(FlowThreadState flowThreadState) { m_flowThreadState = flowThreadState; }
« no previous file with comments | « Source/core/rendering/RenderMultiColumnSet.cpp ('k') | Source/core/rendering/RenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698