Bug 1453953 - natively implement xul textboxes. r=mstange

This commit is contained in:
Alexis Beingessner 2018-08-30 18:39:22 -04:00 коммит произвёл Jeff Muizelaar
Родитель 73d10cc5f0
Коммит ea7bc06418
4 изменённых файлов: 45 добавлений и 7 удалений

Просмотреть файл

@ -6143,7 +6143,7 @@ nsLayoutUtils::PaintTextShadow(const nsIFrame* aFrame,
wrShadow.color = wr::ToColorF(ToDeviceColor(shadowColor));
textDrawer->AppendShadow(wrShadow);
return;
continue;
}
gfxContext* shadowContext = contextBoxBlur.Init(shadowRect, 0, blurRadius,

Просмотреть файл

@ -412,7 +412,7 @@ fuzzy-if(Android,0-2,0-18) == 315920-17.html 315920-17-ref.html
== 320979-1.html 320979-1-ref.html
!= 321402-1.html about:blank
!= 321402-2.html about:blank
fuzzy-if(webrender&&winWidget,35-35,1-1) == 321402-3.xul 321402-3-ref.xul
== 321402-3.xul 321402-3-ref.xul
== 321402-4.xul 321402-4-ref.xul
== 321402-5.xul 321402-5-ref.xul
== 321402-6.xul 321402-6-ref.xul
@ -1002,7 +1002,7 @@ asserts(1) == 418574-2.html 418574-2-ref.html # bug 478135
== 421069-ref.html 421069-ref2.html
== 421203-1.xul 421203-1-ref.html
== 421203-2.xul 421203-1-ref.html
fuzzy-if(webrender&&winWidget,35-35,1-1) == 421203-3.xul 321402-3-ref.xul
== 421203-3.xul 321402-3-ref.xul
== 421203-4.xul 321402-4-ref.xul
== 421203-5.xul 321402-5-ref.xul
== 421203-6.xul 321402-6-ref.xul

Просмотреть файл

@ -1,10 +1,10 @@
== 723669.html 723669-ref.html
fuzzy-if(webrender&&winWidget,1-1,7-7) fuzzy-if(webrender&&cocoaWidget,1-1,20-20) == basic.xul basic-ref.xul
random-if(Android) fuzzy-if(webrender&&winWidget,1-1,6-6) fuzzy-if(webrender&&cocoaWidget,1-1,53-53) == basic-negcoord.xul basic-negcoord-ref.xul
== basic.xul basic-ref.xul
random-if(Android) == basic-negcoord.xul basic-negcoord-ref.xul
!= blur.xul blur-notref.xul
fuzzy-if(webrender&&winWidget,1-1,6-6) fuzzy-if(webrender&&cocoaWidget,1-1,32-32) == color-inherit.xul color-inherit-ref.xul
fuzzy-if(webrender&&winWidget,1-1,44-44) fuzzy-if(webrender&&cocoaWidget,2-2,176-176) == multiple-noblur.xul multiple-noblur-ref.xul
== color-inherit.xul color-inherit-ref.xul
== multiple-noblur.xul multiple-noblur-ref.xul
== blur-opacity.html blur-opacity-ref.html
== basic.html basic-ref.html

Просмотреть файл

@ -35,6 +35,8 @@
#include "nsLayoutUtils.h"
#include "mozilla/Attributes.h"
#include "nsUnicodeProperties.h"
#include "mozilla/layers/WebRenderLayerManager.h"
#include "TextDrawTarget.h"
#ifdef ACCESSIBILITY
#include "nsAccessibilityService.h"
@ -308,6 +310,12 @@ public:
void PaintTextToContext(gfxContext* aCtx,
nsPoint aOffset,
const nscolor* aColor);
virtual bool CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder) override;
};
static void
@ -348,6 +356,36 @@ nsDisplayXULTextBox::PaintTextToContext(gfxContext* aCtx,
PaintTitle(*aCtx, GetPaintRect(), ToReferenceFrame() + aOffset, aColor);
}
bool
nsDisplayXULTextBox::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder)
{
bool snap = false;
auto bounds = GetBounds(aDisplayListBuilder, &snap);
if (bounds.IsEmpty()) {
return true;
}
auto appUnitsPerDevPixel = Frame()->PresContext()->AppUnitsPerDevPixel();
gfx::Point deviceOffset = LayoutDevicePoint::FromAppUnits(
bounds.TopLeft(), appUnitsPerDevPixel).ToUnknownPoint();
RefPtr<mozilla::layout::TextDrawTarget> textDrawer =
new mozilla::layout::TextDrawTarget(aBuilder, aResources, aSc, aManager, this, bounds);
RefPtr<gfxContext> captureCtx = gfxContext::CreateOrNull(textDrawer, deviceOffset);
Paint(aDisplayListBuilder, captureCtx);
textDrawer->TerminateShadows();
return !textDrawer->HasUnsupportedFeatures();
}
nsRect
nsDisplayXULTextBox::GetBounds(nsDisplayListBuilder* aBuilder,
bool* aSnap) const