mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Backed out 1 changesets (bug 1401653) for failing no matching function for call in src/layout/generic/TextDrawTarget.h:143:43 r=backout on a CLOSED TREE.
Backed out changeset 5055d2703f2f (bug 1401653)
This commit is contained in:
parent
ad3fb07012
commit
1fc19f42dc
@ -1112,9 +1112,25 @@ DisplayListBuilder::PushLine(const wr::LayoutRect& aClip,
|
||||
bool aIsBackfaceVisible,
|
||||
const wr::Line& aLine)
|
||||
{
|
||||
wr_dp_push_line(mWrState, &aClip, aIsBackfaceVisible,
|
||||
&aLine.bounds, aLine.wavyLineThickness, aLine.orientation,
|
||||
&aLine.color, aLine.style);
|
||||
wr_dp_push_line(mWrState, aClip, aIsBackfaceVisible, aLine.baseline, aLine.start, aLine.end,
|
||||
aLine.orientation, aLine.width, aLine.color, aLine.style);
|
||||
|
||||
/* TODO(Gankro): remove this
|
||||
LayoutRect rect;
|
||||
if (aLine.orientation == wr::LineOrientation::Horizontal) {
|
||||
rect.origin.x = aLine.start;
|
||||
rect.origin.y = aLine.baseline;
|
||||
rect.size.width = aLine.end - aLine.start;
|
||||
rect.size.height = aLine.width;
|
||||
} else {
|
||||
rect.origin.x = aLine.baseline;
|
||||
rect.origin.y = aLine.start;
|
||||
rect.size.width = aLine.width;
|
||||
rect.size.height = aLine.end - aLine.start;
|
||||
}
|
||||
|
||||
PushRect(rect, aClip, aLine.color);
|
||||
*/
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -42,10 +42,12 @@ class RendererEvent;
|
||||
// This isn't part of WR's API, but we define it here to simplify layout's
|
||||
// logic and data plumbing.
|
||||
struct Line {
|
||||
wr::LayoutRect bounds;
|
||||
float wavyLineThickness;
|
||||
wr::LineOrientation orientation;
|
||||
float baseline;
|
||||
float start;
|
||||
float end;
|
||||
float width;
|
||||
wr::ColorF color;
|
||||
wr::LineOrientation orientation;
|
||||
wr::LineStyle style;
|
||||
};
|
||||
|
||||
|
@ -1525,28 +1525,18 @@ pub extern "C" fn wr_dp_pop_all_shadows(state: &mut WrState) {
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_line(state: &mut WrState,
|
||||
clip: &LayoutRect,
|
||||
clip: LayoutRect,
|
||||
is_backface_visible: bool,
|
||||
bounds: &LayoutRect,
|
||||
_wavy_line_thickness: f32,
|
||||
baseline: f32,
|
||||
start: f32,
|
||||
end: f32,
|
||||
orientation: LineOrientation,
|
||||
color: &ColorF,
|
||||
width: f32,
|
||||
color: ColorF,
|
||||
style: LineStyle) {
|
||||
debug_assert!(unsafe { is_in_main_thread() });
|
||||
|
||||
// TODO: remove this once WR is updated to just check the bounds.
|
||||
let (baseline, start, end, width) = match orientation {
|
||||
LineOrientation::Horizontal => (bounds.origin.y,
|
||||
bounds.origin.x,
|
||||
bounds.origin.x + bounds.size.width,
|
||||
bounds.size.height),
|
||||
LineOrientation::Vertical => (bounds.origin.x,
|
||||
bounds.origin.y,
|
||||
bounds.origin.y + bounds.size.height,
|
||||
bounds.size.width),
|
||||
};
|
||||
|
||||
let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(*bounds, (*clip).into());
|
||||
let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(LayoutRect::zero(), clip.into());
|
||||
prim_info.is_backface_visible = is_backface_visible;
|
||||
state.frame_builder
|
||||
.dl_builder
|
||||
@ -1556,7 +1546,7 @@ pub extern "C" fn wr_dp_push_line(state: &mut WrState,
|
||||
end,
|
||||
orientation,
|
||||
width,
|
||||
*color,
|
||||
color,
|
||||
style);
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* Generated with cbindgen:0.1.25 */
|
||||
/* Generated with cbindgen:0.1.26 */
|
||||
|
||||
/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
|
||||
* To generate this file:
|
||||
@ -319,6 +319,17 @@ struct WrOpacityProperty {
|
||||
}
|
||||
};
|
||||
|
||||
// A 3d transform stored as a 4 by 4 matrix in row-major order in memory.
|
||||
//
|
||||
// Transforms can be parametrized over the source and destination units, to describe a
|
||||
// transformation from a space to another.
|
||||
// For example, `TypedTransform3D<f32, WordSpace, ScreenSpace>::transform_point3d`
|
||||
// takes a `TypedPoint3D<f32, WordSpace>` and returns a `TypedPoint3D<f32, ScreenSpace>`.
|
||||
//
|
||||
// Transforms expose a set of convenience methods for pre- and post-transformations.
|
||||
// A pre-transformation corresponds to adding an operation that is applied before
|
||||
// the rest of the transformation, while a post-transformation adds an operation
|
||||
// that is applied after.
|
||||
struct TypedTransform3D_f32__LayoutPixel__LayoutPixel {
|
||||
float m11;
|
||||
float m12;
|
||||
@ -401,6 +412,7 @@ struct ColorF {
|
||||
}
|
||||
};
|
||||
|
||||
// A 2d Point tagged with a unit.
|
||||
struct TypedPoint2D_f32__LayerPixel {
|
||||
float x;
|
||||
float y;
|
||||
@ -570,6 +582,7 @@ struct NinePatchDescriptor {
|
||||
}
|
||||
};
|
||||
|
||||
// A 2d Vector tagged with a unit.
|
||||
struct TypedVector2D_f32__LayerPixel {
|
||||
float x;
|
||||
float y;
|
||||
@ -650,6 +663,7 @@ struct ByteSlice {
|
||||
}
|
||||
};
|
||||
|
||||
// A 2d Point tagged with a unit.
|
||||
struct TypedPoint2D_u16__Tiles {
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
@ -1112,12 +1126,14 @@ WR_FUNC;
|
||||
|
||||
WR_INLINE
|
||||
void wr_dp_push_line(WrState *aState,
|
||||
const LayoutRect *aClip,
|
||||
LayoutRect aClip,
|
||||
bool aIsBackfaceVisible,
|
||||
const LayoutRect *aBounds,
|
||||
float aWavyLineThickness,
|
||||
float aBaseline,
|
||||
float aStart,
|
||||
float aEnd,
|
||||
LineOrientation aOrientation,
|
||||
const ColorF *aColor,
|
||||
float aWidth,
|
||||
ColorF aColor,
|
||||
LineStyle aStyle)
|
||||
WR_FUNC;
|
||||
|
||||
|
@ -137,18 +137,6 @@ public:
|
||||
mBackfaceVisible, &glyphOptions);
|
||||
}
|
||||
|
||||
void
|
||||
PushClipRect(const Rect &aRect) override {
|
||||
auto rect = mSc.ToRelativeLayoutRect(LayoutDeviceRect::FromUnknownRect(aRect));
|
||||
auto clipId = mBuilder.DefineClip(rect);
|
||||
mBuilder.PushClip(clipId);
|
||||
}
|
||||
|
||||
void
|
||||
PopClip() override {
|
||||
mBuilder.PopClip();
|
||||
}
|
||||
|
||||
void
|
||||
AppendShadow(const wr::Shadow& aShadow)
|
||||
{
|
||||
@ -173,20 +161,6 @@ public:
|
||||
mBuilder.PushRect(rect, mClipRect, mBackfaceVisible, color);
|
||||
}
|
||||
|
||||
|
||||
// This function is basically designed to slide into the decoration drawing
|
||||
// code of nsCSSRendering with minimum disruption, to minimize the
|
||||
// chances of implementation drift. As such, it mostly looks like a call
|
||||
// to a skia-style StrokeLine method: two end-points, with a thickness
|
||||
// and style. Notably the end-points are *centered* in the block direction,
|
||||
// even though webrender wants a rect-like representation, where the points
|
||||
// are on corners.
|
||||
//
|
||||
// So we mangle the format here in a single centralized place, where neither
|
||||
// webrender nor nsCSSRendering has to care about this mismatch.
|
||||
//
|
||||
// NOTE: we assume the points are axis-aligned, and aStart should be used
|
||||
// as the top-left corner of the rect.
|
||||
void
|
||||
AppendDecoration(const Point& aStart,
|
||||
const Point& aEnd,
|
||||
@ -195,20 +169,22 @@ public:
|
||||
const Color& aColor,
|
||||
const uint8_t aStyle)
|
||||
{
|
||||
auto pos = LayoutDevicePoint::FromUnknownPoint(aStart);
|
||||
LayoutDeviceSize size;
|
||||
|
||||
if (aVertical) {
|
||||
pos.x -= aThickness / 2; // adjust from center to corner
|
||||
size = LayoutDeviceSize(aThickness, aEnd.y - aStart.y);
|
||||
} else {
|
||||
pos.y -= aThickness / 2; // adjust from center to corner
|
||||
size = LayoutDeviceSize(aEnd.x - aStart.x, aThickness);
|
||||
}
|
||||
|
||||
wr::Line decoration;
|
||||
decoration.bounds = mSc.ToRelativeLayoutRect(LayoutDeviceRect(pos, size));
|
||||
decoration.wavyLineThickness = 0; // dummy value, unused
|
||||
|
||||
// This function is basically designed to slide into the decoration drawing
|
||||
// code of nsCSSRendering with minimum disruption, to minimize the
|
||||
// chances of implementation drift. As such, it mostly looks like a call
|
||||
// to a skia-style StrokeLine method: two end-points, with a thickness
|
||||
// and style. Notably the end-points are *centered* in the block direction,
|
||||
// even though webrender wants a rect-like representation, where the points
|
||||
// are on corners.
|
||||
//
|
||||
// So we mangle the format here in a single centralized place, where neither
|
||||
// webrender nor nsCSSRendering has to care about this mismatch.
|
||||
decoration.baseline = (aVertical ? aStart.x : aStart.y) - aThickness / 2;
|
||||
decoration.start = aVertical ? aStart.y : aStart.x;
|
||||
decoration.end = aVertical ? aEnd.y : aEnd.x;
|
||||
decoration.width = aThickness;
|
||||
decoration.color = wr::ToColorF(aColor);
|
||||
decoration.orientation = aVertical
|
||||
? wr::LineOrientation::Vertical
|
||||
@ -224,8 +200,9 @@ public:
|
||||
case NS_STYLE_TEXT_DECORATION_STYLE_DASHED:
|
||||
decoration.style = wr::LineStyle::Dashed;
|
||||
break;
|
||||
// Wavy lines should go through AppendWavyDecoration
|
||||
case NS_STYLE_TEXT_DECORATION_STYLE_WAVY:
|
||||
decoration.style = wr::LineStyle::Wavy;
|
||||
break;
|
||||
// Double lines should be lowered to two solid lines
|
||||
case NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE:
|
||||
default:
|
||||
@ -235,29 +212,6 @@ public:
|
||||
mBuilder.PushLine(mClipRect, mBackfaceVisible, decoration);
|
||||
}
|
||||
|
||||
// Seperated out from AppendDecoration because Wavy Lines are completely
|
||||
// different, and trying to merge the concept is more of a mess than it's
|
||||
// worth.
|
||||
void
|
||||
AppendWavyDecoration(const Rect& aBounds,
|
||||
const float aThickness,
|
||||
const bool aVertical,
|
||||
const Color& aColor)
|
||||
{
|
||||
wr::Line decoration;
|
||||
|
||||
decoration.bounds = mSc.ToRelativeLayoutRect(
|
||||
LayoutDeviceRect::FromUnknownRect(aBounds));
|
||||
decoration.wavyLineThickness = aThickness;
|
||||
decoration.color = wr::ToColorF(aColor);
|
||||
decoration.orientation = aVertical
|
||||
? wr::LineOrientation::Vertical
|
||||
: wr::LineOrientation::Horizontal;
|
||||
decoration.style = wr::LineStyle::Wavy;
|
||||
|
||||
mBuilder.PushLine(mClipRect, mBackfaceVisible, decoration);
|
||||
}
|
||||
|
||||
private:
|
||||
// Whether anything unsupported was encountered. Currently:
|
||||
//
|
||||
@ -418,14 +372,20 @@ public:
|
||||
}
|
||||
|
||||
void PushClip(const Path *aPath) override {
|
||||
MOZ_CRASH("TextDrawTarget: Method shouldn't be called");
|
||||
// Fine to pretend we do this
|
||||
}
|
||||
|
||||
void PushClipRect(const Rect &aRect) override {
|
||||
// Fine to pretend we do this
|
||||
}
|
||||
|
||||
void PushDeviceSpaceClipRects(const IntRect* aRects, uint32_t aCount) override {
|
||||
MOZ_CRASH("TextDrawTarget: Method shouldn't be called");
|
||||
}
|
||||
|
||||
|
||||
void PopClip() override {
|
||||
// Fine to pretend we do this
|
||||
}
|
||||
|
||||
void PushLayer(bool aOpaque, Float aOpacity,
|
||||
SourceSurface* aMask,
|
||||
|
@ -4078,6 +4078,8 @@ nsCSSRendering::PaintDecorationLine(nsIFrame* aFrame, DrawTarget& aDrawTarget,
|
||||
* directions in the above description.
|
||||
*/
|
||||
|
||||
// TODO(gankro)
|
||||
|
||||
Float& rectICoord = aParams.vertical ? rect.y : rect.x;
|
||||
Float& rectISize = aParams.vertical ? rect.height : rect.width;
|
||||
const Float rectBSize = aParams.vertical ? rect.width : rect.height;
|
||||
@ -4091,20 +4093,9 @@ nsCSSRendering::PaintDecorationLine(nsIFrame* aFrame, DrawTarget& aDrawTarget,
|
||||
rect = ExpandPaintingRectForDecorationLine(aFrame, aParams.style, rect,
|
||||
aParams.icoordInFrame,
|
||||
cycleLength, aParams.vertical);
|
||||
|
||||
if (textDrawer) {
|
||||
// Undo attempted centering
|
||||
Float& rectBCoord = aParams.vertical ? rect.x : rect.y;
|
||||
rectBCoord -= lineThickness / 2;
|
||||
|
||||
textDrawer->AppendWavyDecoration(rect, lineThickness,
|
||||
aParams.vertical, color);
|
||||
return;
|
||||
}
|
||||
|
||||
// figure out if we can trim whole cycles from the left and right edges
|
||||
// of the line, to try and avoid creating an unnecessarily long and
|
||||
// complex path (but don't do this for webrender, )
|
||||
// complex path
|
||||
const Float dirtyRectICoord = aParams.vertical ? aParams.dirtyRect.y
|
||||
: aParams.dirtyRect.x;
|
||||
int32_t skipCycles = floor((dirtyRectICoord - rectICoord) / cycleLength);
|
||||
@ -4115,6 +4106,16 @@ nsCSSRendering::PaintDecorationLine(nsIFrame* aFrame, DrawTarget& aDrawTarget,
|
||||
|
||||
rectICoord += lineThickness / 2.0;
|
||||
|
||||
if (textDrawer) {
|
||||
Point p1 = rect.TopLeft();
|
||||
Point p2 = aParams.vertical ? rect.BottomLeft() : rect.TopRight();
|
||||
|
||||
textDrawer->AppendDecoration(
|
||||
p1, p2, adv, aParams.vertical, color,
|
||||
NS_STYLE_TEXT_DECORATION_STYLE_WAVY);
|
||||
return;
|
||||
}
|
||||
|
||||
Point pt(rect.TopLeft());
|
||||
Float& ptICoord = aParams.vertical ? pt.y : pt.x;
|
||||
Float& ptBCoord = aParams.vertical ? pt.x : pt.y;
|
||||
|
Loading…
Reference in New Issue
Block a user