Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8238526: Cherry pick GTK WebKit 2.26.3 changes
Reviewed-by: kcr, jvos
  • Loading branch information
Guru Hb committed Feb 7, 2020
1 parent 6968e38 commit e224e54
Show file tree
Hide file tree
Showing 19 changed files with 64 additions and 84 deletions.
Expand Up @@ -1815,9 +1815,11 @@ class ObjectAllocationSinkingPhase : public Phase {
availabilityCalculator.m_availability, identifier, phiDef->value());

for (PromotedHeapLocation location : hintsForPhi[variable->index()]) {
m_insertionSet.insert(0,
location.createHint(m_graph, block->at(0)->origin.withInvalidExit(), phiDef->value()));
m_localMapping.set(location, phiDef->value());
if (m_heap.onlyLocalAllocation(location.base())) {
m_insertionSet.insert(0,
location.createHint(m_graph, block->at(0)->origin.withInvalidExit(), phiDef->value()));
m_localMapping.set(location, phiDef->value());
}
}
}

Expand Down
Expand Up @@ -31,6 +31,7 @@
#include "CodeBlockWithJITType.h"
#include "DFGClobberize.h"
#include "DFGClobbersExitState.h"
#include "DFGDominators.h"
#include "DFGMayExit.h"
#include "JSCInlines.h"
#include <wtf/Assertions.h>
Expand Down Expand Up @@ -775,6 +776,10 @@ class Validate {
VALIDATE((), !m_graph.m_argumentFormats.isEmpty()); // We always have at least one entrypoint.
VALIDATE((), m_graph.m_rootToArguments.isEmpty()); // This is only used in CPS.

m_graph.initializeNodeOwners();

auto& dominators = m_graph.ensureSSADominators();

for (unsigned entrypointIndex : m_graph.m_entrypointIndexToCatchBytecodeOffset.keys())
VALIDATE((), entrypointIndex > 0); // By convention, 0 is the entrypoint index for the op_enter entrypoint, which can not be in a catch.

Expand All @@ -788,6 +793,8 @@ class Validate {
bool didSeeExitOK = false;
bool isOSRExited = false;

HashSet<Node*> nodesInThisBlock;

for (auto* node : *block) {
didSeeExitOK |= node->origin.exitOK;
switch (node->op()) {
Expand Down Expand Up @@ -906,7 +913,13 @@ class Validate {
});
break;
}

isOSRExited |= node->isPseudoTerminal();

m_graph.doToChildren(node, [&] (Edge child) {
VALIDATE((node), dominators.strictlyDominates(child->owner, block) || nodesInThisBlock.contains(child.node()));
});
nodesInThisBlock.add(node);
}
}
}
Expand Down
Expand Up @@ -628,9 +628,7 @@ def parseSequence(final, comment)
firstCodeOrigin = @tokens[@idx].codeOrigin
list = []
loop {
if (@idx == @tokens.length and not final) or (final and @tokens[@idx] =~ final)
break
elsif @tokens[@idx].is_a? Annotation
if @tokens[@idx].is_a? Annotation
# This is the only place where we can encounter a global
# annotation, and hence need to be able to distinguish between
# them.
Expand All @@ -644,6 +642,8 @@ def parseSequence(final, comment)
list << Instruction.new(codeOrigin, annotationOpcode, [], @tokens[@idx].string)
@annotation = nil
@idx += 2 # Consume the newline as well.
elsif (@idx == @tokens.length and not final) or (final and @tokens[@idx] =~ final)
break
elsif @tokens[@idx] == "\n"
# ignore
@idx += 1
Expand Down
Expand Up @@ -22,6 +22,7 @@

#include "Error.h"
#include "InternalFunction.h"
#include "JSGlobalObject.h"
#include "NativeErrorPrototype.h"

namespace JSC {
Expand Down
Expand Up @@ -1449,7 +1449,7 @@
#endif
#endif

#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000) || PLATFORM(GTK)
#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000)
#define HAVE_OS_DARK_MODE_SUPPORT 1
#endif

Expand Down
Expand Up @@ -301,7 +301,7 @@ static bool allCharactersInIDNScriptWhiteList(const UChar* buffer, int32_t lengt
Optional<UChar32> previousCodePoint;
while (i < length) {
UChar32 c;
U16_NEXT(buffer, i, length, c)
U16_NEXT(buffer, i, length, c);
UErrorCode error = U_ZERO_ERROR;
UScriptCode script = uscript_getScript(c, &error);
if (error != U_ZERO_ERROR) {
Expand Down
Expand Up @@ -4960,12 +4960,12 @@ static bool isValidNameNonASCII(const UChar* characters, unsigned length)
unsigned i = 0;

UChar32 c;
U16_NEXT(characters, i, length, c)
U16_NEXT(characters, i, length, c);
if (!isValidNameStart(c))
return false;

while (i < length) {
U16_NEXT(characters, i, length, c)
U16_NEXT(characters, i, length, c);
if (!isValidNamePart(c))
return false;
}
Expand Down Expand Up @@ -5025,7 +5025,7 @@ ExceptionOr<std::pair<AtomString, AtomString>> Document::parseQualifiedName(cons

for (unsigned i = 0; i < length; ) {
UChar32 c;
U16_NEXT(qualifiedName, i, length, c)
U16_NEXT(qualifiedName, i, length, c);
if (c == ':') {
if (sawColon)
return Exception { InvalidCharacterError };
Expand Down Expand Up @@ -6943,7 +6943,6 @@ bool Document::useSystemAppearance() const

bool Document::useDarkAppearance(const RenderStyle* style) const
{
#if HAVE(OS_DARK_MODE_SUPPORT)
#if ENABLE(DARK_MODE_CSS)
OptionSet<ColorScheme> colorScheme;

Expand Down Expand Up @@ -6972,9 +6971,6 @@ bool Document::useDarkAppearance(const RenderStyle* style) const
if (colorScheme.contains(ColorScheme::Dark))
return pageUsesDarkAppearance;
#endif
#else
UNUSED_PARAM(style);
#endif

return false;
}
Expand Down
Expand Up @@ -2971,12 +2971,7 @@ void FrameView::setBaseBackgroundColor(const Color& backgroundColor)
void FrameView::updateBackgroundRecursively(const Optional<Color>& backgroundColor)
{
#if HAVE(OS_DARK_MODE_SUPPORT)
#if PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
static const auto cssValueControlBackground = CSSValueAppleSystemControlBackground;
#else
static const auto cssValueControlBackground = CSSValueWindow;
#endif
Color baseBackgroundColor = backgroundColor.valueOr(RenderTheme::singleton().systemColor(cssValueControlBackground, styleColorOptions()));
Color baseBackgroundColor = backgroundColor.valueOr(RenderTheme::singleton().systemColor(CSSValueAppleSystemControlBackground, styleColorOptions()));
#else
Color baseBackgroundColor = backgroundColor.valueOr(Color::white);
#endif
Expand Down
Expand Up @@ -2714,7 +2714,7 @@ void Page::setUseSystemAppearance(bool value)

void Page::effectiveAppearanceDidChange(bool useDarkAppearance, bool useElevatedUserInterfaceLevel)
{
#if HAVE(OS_DARK_MODE_SUPPORT)
#if ENABLE(DARK_MODE_CSS)
if (m_useDarkAppearance == useDarkAppearance && m_useElevatedUserInterfaceLevel == useElevatedUserInterfaceLevel)
return;

Expand All @@ -2738,7 +2738,7 @@ void Page::effectiveAppearanceDidChange(bool useDarkAppearance, bool useElevated

bool Page::useDarkAppearance() const
{
#if HAVE(OS_DARK_MODE_SUPPORT)
#if ENABLE(DARK_MODE_CSS)
FrameView* view = mainFrame().view();
if (!view || !equalLettersIgnoringASCIICase(view->mediaType(), "screen"))
return false;
Expand Down
Expand Up @@ -205,7 +205,8 @@ unsigned ComplexTextController::offsetForPosition(float h, bool includePartialGl
for (unsigned j = 0; j < complexTextRun.glyphCount(); ++j) {
unsigned index = offsetIntoAdjustedGlyphs + j;
float adjustedAdvance = m_adjustedBaseAdvances[index].width();
if (x < adjustedAdvance) {
bool hit = m_run.ltr() ? x < adjustedAdvance : (x <= adjustedAdvance && adjustedAdvance);
if (hit) {
unsigned hitGlyphStart = complexTextRun.indexAt(j);
unsigned hitGlyphEnd;
if (m_run.ltr())
Expand All @@ -215,7 +216,18 @@ unsigned ComplexTextController::offsetForPosition(float h, bool includePartialGl

// FIXME: Instead of dividing the glyph's advance equally between the characters, this
// could use the glyph's "ligature carets". This is available in CoreText via CTFontGetLigatureCaretPositions().
unsigned hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (m_run.ltr() ? x / adjustedAdvance : 1 - x / adjustedAdvance);
unsigned hitIndex;
if (m_run.ltr())
hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (x / adjustedAdvance);
else {
if (hitGlyphStart == hitGlyphEnd)
hitIndex = hitGlyphStart;
else if (x)
hitIndex = hitGlyphEnd - (hitGlyphEnd - hitGlyphStart) * (x / adjustedAdvance);
else
hitIndex = hitGlyphEnd - 1;
}

unsigned stringLength = complexTextRun.stringLength();
CachedTextBreakIterator cursorPositionIterator(StringView(complexTextRun.characters(), stringLength), TextBreakIterator::Mode::Caret, nullAtom());
unsigned clusterStart;
Expand Down
Expand Up @@ -279,7 +279,7 @@ HbUniquePtr<hb_font_t> FontPlatformData::createOpenTypeMathHarfBuzzFont() const
if (!ftFace)
return nullptr;

HbUniquePtr<hb_face_t> face(hb_ft_face_create_cached(ftFace));
HbUniquePtr<hb_face_t> face(hb_ft_face_create_referenced(ftFace));
if (!hb_ot_math_has_data(face.get()))
return nullptr;

Expand Down
Expand Up @@ -164,17 +164,15 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(hb_buffer_t* buffer, const
}

float offsetX = harfBuzzPositionToFloat(glyphPositions[i].x_offset);
float offsetY = -harfBuzzPositionToFloat(glyphPositions[i].y_offset);
float offsetY = harfBuzzPositionToFloat(glyphPositions[i].y_offset);
float advanceX = harfBuzzPositionToFloat(glyphPositions[i].x_advance);
float advanceY = harfBuzzPositionToFloat(glyphPositions[i].y_advance);

if (!i)
m_initialAdvance = { offsetX, -offsetY };

m_glyphs[i] = glyph;
m_baseAdvances[i] = { advanceX, advanceY };
m_glyphOrigins[i] = { offsetX, offsetY };
}
m_initialAdvance = toFloatSize(m_glyphOrigins[0]);
}

static const hb_tag_t s_vertTag = HB_TAG('v', 'e', 'r', 't');
Expand Down
Expand Up @@ -525,17 +525,15 @@ void RenderFrameSet::positionFrames()
int width = m_cols.m_sizes[c];

// has to be resized and itself resize its contents
if (width != child->width() || height != child->height()) {
child->setWidth(width);
child->setHeight(height);
child->setWidth(width);
child->setHeight(height);
#if PLATFORM(IOS_FAMILY)
// FIXME: Is this iOS-specific?
child->setNeedsLayout(MarkOnlyThis);
// FIXME: Is this iOS-specific?
child->setNeedsLayout(MarkOnlyThis);
#else
child->setNeedsLayout();
child->setNeedsLayout();
#endif
child->layout();
}
child->layout();

xPos += width + borderThickness;

Expand Down
Expand Up @@ -124,22 +124,6 @@ int RenderThemeGtk::sliderTickOffsetFromTrackCenter() const
}
#endif

static void themeChangedCallback()
{
Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment();
}

RenderThemeGtk::RenderThemeGtk()
{
static bool themeMonitorInitialized = false;
if (!themeMonitorInitialized) {
GtkSettings* settings = gtk_settings_get_default();
g_signal_connect(settings, "notify::gtk-theme-name", G_CALLBACK(themeChangedCallback), nullptr);
g_signal_connect(settings, "notify::gtk-color-scheme", G_CALLBACK(themeChangedCallback), nullptr);
themeMonitorInitialized = true;
}
}

enum RenderThemePart {
Entry,
EntrySelection,
Expand Down Expand Up @@ -951,17 +935,6 @@ Color RenderThemeGtk::systemColor(CSSValueID cssValueId, OptionSet<StyleColor::O
return styleColor(Entry, GTK_STATE_FLAG_ACTIVE, StyleColorForeground);
case CSSValueGraytext:
return styleColor(Entry, GTK_STATE_FLAG_INSENSITIVE, StyleColorForeground);
case CSSValueWebkitControlBackground:
return styleColor(Entry, GTK_STATE_FLAG_ACTIVE, StyleColorBackground);
case CSSValueWindow: {
// Only get window color from the theme in dark mode.
gboolean preferDarkTheme = FALSE;
if (auto* settings = gtk_settings_get_default())
g_object_get(settings, "gtk-application-prefer-dark-theme", &preferDarkTheme, nullptr);
if (preferDarkTheme)
return styleColor(Window, GTK_STATE_FLAG_ACTIVE, StyleColorBackground);
break;
}
default:
break;
}
Expand Down
Expand Up @@ -104,7 +104,6 @@ class RenderThemeGtk final : public RenderTheme {
bool shouldHaveCapsLockIndicator(const HTMLInputElement&) const override;

private:
RenderThemeGtk();
virtual ~RenderThemeGtk();

bool paintCheckbox(const RenderObject&, const PaintInfo&, const IntRect&) override;
Expand Down
Expand Up @@ -299,6 +299,8 @@ WTF::IteratorRange<RunResolver::Iterator> RunResolver::rangeForRendererWithOffse
{
ASSERT(startOffset <= endOffset);
auto range = rangeForRenderer(renderer);
if (range.begin() == range.end())
return { end(), end() };
auto it = range.begin();
auto localEnd = (*it).start() + endOffset;
// Advance to the first run with the start offset inside. Only the first node in a range can have a startOffset.
Expand Down
Expand Up @@ -58,6 +58,12 @@ class SVGAnimatedPropertyPairAccessor : public SVGMemberAccessor<OwnerType> {
Ref<AnimatedPropertyType2>& property2(OwnerType& owner) const { return m_accessor2.property(owner); }
const Ref<AnimatedPropertyType2>& property2(const OwnerType& owner) const { return m_accessor2.property(owner); }

void detach(const OwnerType& owner) const override
{
property1(owner)->detach();
property2(owner)->detach();
}

bool matches(const OwnerType& owner, const SVGAnimatedProperty& animatedProperty) const override
{
return m_accessor1.matches(owner, animatedProperty) || m_accessor2.matches(owner, animatedProperty);
Expand Down
Expand Up @@ -51,10 +51,6 @@
#include "SoupNetworkSession.h"
#endif

#if PLATFORM(GTK)
#include <gtk/gtk.h>
#endif

namespace WebCore {

InternalSettings::Backup::Backup(Settings& settings)
Expand Down Expand Up @@ -542,16 +538,6 @@ ExceptionOr<bool> InternalSettings::shouldDisplayTrackKind(const String& kind)

void InternalSettings::setUseDarkAppearanceInternal(bool useDarkAppearance)
{
#if PLATFORM(GTK)
// GTK doesn't allow to change the theme from the web process, but tests need to do it, so
// we do it here only for tests.
if (auto* settings = gtk_settings_get_default()) {
gboolean preferDarkTheme;
g_object_get(settings, "gtk-application-prefer-dark-theme", &preferDarkTheme, nullptr);
if (preferDarkTheme != useDarkAppearance)
g_object_set(settings, "gtk-application-prefer-dark-theme", useDarkAppearance, nullptr);
}
#endif
ASSERT(m_page);
m_page->effectiveAppearanceDidChange(useDarkAppearance, m_page->useElevatedUserInterfaceLevel());
}
Expand Down
@@ -1,11 +1,11 @@
include(GNUInstallDirs)
include(VersioningUtils)

SET_PROJECT_VERSION(2 26 2)
SET_PROJECT_VERSION(2 26 3)
set(WEBKITGTK_API_VERSION 4.0)

CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(WEBKIT 76 3 39)
CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(JAVASCRIPTCORE 32 7 14)
CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(WEBKIT 76 4 39)
CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(JAVASCRIPTCORE 32 8 14)

# These are shared variables, but we special case their definition so that we can use the
# CMAKE_INSTALL_* variables that are populated by the GNUInstallDirs macro.
Expand Down Expand Up @@ -195,7 +195,6 @@ set(GDK_LIBRARIES ${GDK3_LIBRARIES})
set(GDK_INCLUDE_DIRS ${GDK3_INCLUDE_DIRS})

SET_AND_EXPOSE_TO_BUILD(HAVE_GTK_UNIX_PRINTING ${GTKUnixPrint_FOUND})
SET_AND_EXPOSE_TO_BUILD(HAVE_OS_DARK_MODE_SUPPORT 1)

if (USE_WPE_RENDERER)
find_package(WPE 1.3.0)
Expand Down

0 comments on commit e224e54

Please sign in to comment.