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

Unified Diff: Source/platform/graphics/paint/DisplayItemPropertyTreeBuilder.cpp

Issue 1284203004: Generate scroll/clip display item hierarchy for SPv2 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix failing test. Update test expectation. Created 5 years, 3 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
Index: Source/platform/graphics/paint/DisplayItemPropertyTreeBuilder.cpp
diff --git a/Source/platform/graphics/paint/DisplayItemPropertyTreeBuilder.cpp b/Source/platform/graphics/paint/DisplayItemPropertyTreeBuilder.cpp
index 6689f124037802d870a86390a1182af0ef09209d..b444544da138fea75b3aa6fcbc52c189c7f3e4f5 100644
--- a/Source/platform/graphics/paint/DisplayItemPropertyTreeBuilder.cpp
+++ b/Source/platform/graphics/paint/DisplayItemPropertyTreeBuilder.cpp
@@ -5,9 +5,11 @@
#include "config.h"
#include "platform/graphics/paint/DisplayItemPropertyTreeBuilder.h"
+#include "platform/RuntimeEnabledFeatures.h"
#include "platform/graphics/paint/DisplayItem.h"
#include "platform/graphics/paint/DisplayItemClipTree.h"
#include "platform/graphics/paint/DisplayItemTransformTree.h"
+#include "platform/graphics/paint/FixedPositionDisplayItem.h"
#include "platform/graphics/paint/ScrollDisplayItem.h"
#include "platform/graphics/paint/Transform3DDisplayItem.h"
#include "platform/graphics/paint/TransformDisplayItem.h"
@@ -56,6 +58,8 @@ void DisplayItemPropertyTreeBuilder::processDisplayItem(const DisplayItem& displ
processBeginItem(displayItem);
else if (displayItem.isEnd())
processEndItem(displayItem);
+ else if (displayItem.type() == DisplayItem::FixedPositionContainer)
+ processAnchorItem(displayItem);
m_currentIndex++;
}
@@ -63,12 +67,15 @@ namespace {
enum TransformKind { NotATransform = 0, Only2DTranslation, RequiresTransformNode };
enum ClipKind { NotAClip = 0, RequiresClipNode };
+enum SpecialKind { NotSpecial = 0, IsFixedPosition };
struct BeginDisplayItemClassification {
TransformKind transformKind = NotATransform;
TransformationMatrix matrix;
ClipKind clipKind = NotAClip;
FloatRect clipRect;
+ SpecialKind specialKind = NotSpecial;
+ DisplayItemClient anchorKey;
};
// Classifies a begin display item based on how it affects the property trees.
@@ -91,6 +98,9 @@ static BeginDisplayItemClassification classifyBeginItem(const DisplayItem& begin
const IntSize& offset = beginScroll.currentOffset();
result.matrix.translate(-offset.width(), -offset.height());
result.transformKind = Only2DTranslation;
+ } else if (type == DisplayItem::BeginFixedPosition) {
+ result.specialKind = IsFixedPosition;
+ result.anchorKey = static_cast<const BeginFixedPositionDisplayItem&>(beginDisplayItem).anchor();
}
return result;
}
@@ -101,7 +111,7 @@ void DisplayItemPropertyTreeBuilder::processBeginItem(const DisplayItem& display
{
BeginDisplayItemClassification classification = classifyBeginItem(displayItem);
- if (!classification.transformKind && !classification.clipKind) {
+ if (!classification.transformKind && !classification.clipKind && !classification.specialKind) {
currentState().ignoredBeginCount++;
return;
}
@@ -137,6 +147,23 @@ void DisplayItemPropertyTreeBuilder::processBeginItem(const DisplayItem& display
break;
}
+ switch (classification.specialKind) {
+ case NotSpecial:
+ break;
+ case IsFixedPosition:
+ BuilderState referredState(m_anchors.get(classification.anchorKey));
+ newState.transformNode = referredState.transformNode;
+ newState.offset = referredState.offset;
+ newState.clipNode = referredState.clipNode;
+ {
+ // Note: This is only temporarily workaround before we implement true
+ // transform-tree-based rasterization.
+ ASSERT(currentState().transformNode == newState.transformNode);
+ static_cast<const BeginFixedPositionDisplayItem&>(displayItem).setCounterScroll(newState.offset - currentState().offset);
+ }
+ break;
+ }
+
m_stateStack.append(newState);
}
@@ -153,6 +180,14 @@ void DisplayItemPropertyTreeBuilder::processEndItem(const DisplayItem& displayIt
}
}
+void DisplayItemPropertyTreeBuilder::processAnchorItem(const DisplayItem& displayItem)
+{
+ ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+ // Anchors can duplicate when we have reflection or fragments.
+ // We can't assert uniqueness here. However we may assume the most recent one is valid.
+ m_anchors.set(displayItem.client(), currentState());
+}
+
void DisplayItemPropertyTreeBuilder::finishRange()
{
// Don't emit an empty range record.

Powered by Google App Engine
This is Rietveld 408576698