Skip to content

Commit e224e54

Browse files
author
Guru Hb
committed
8238526: Cherry pick GTK WebKit 2.26.3 changes
Reviewed-by: kcr, jvos
1 parent 6968e38 commit e224e54

File tree

19 files changed

+64
-84
lines changed

19 files changed

+64
-84
lines changed

modules/javafx.web/src/main/native/Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,9 +1815,11 @@ class ObjectAllocationSinkingPhase : public Phase {
18151815
availabilityCalculator.m_availability, identifier, phiDef->value());
18161816

18171817
for (PromotedHeapLocation location : hintsForPhi[variable->index()]) {
1818-
m_insertionSet.insert(0,
1819-
location.createHint(m_graph, block->at(0)->origin.withInvalidExit(), phiDef->value()));
1820-
m_localMapping.set(location, phiDef->value());
1818+
if (m_heap.onlyLocalAllocation(location.base())) {
1819+
m_insertionSet.insert(0,
1820+
location.createHint(m_graph, block->at(0)->origin.withInvalidExit(), phiDef->value()));
1821+
m_localMapping.set(location, phiDef->value());
1822+
}
18211823
}
18221824
}
18231825

modules/javafx.web/src/main/native/Source/JavaScriptCore/dfg/DFGValidate.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "CodeBlockWithJITType.h"
3232
#include "DFGClobberize.h"
3333
#include "DFGClobbersExitState.h"
34+
#include "DFGDominators.h"
3435
#include "DFGMayExit.h"
3536
#include "JSCInlines.h"
3637
#include <wtf/Assertions.h>
@@ -775,6 +776,10 @@ class Validate {
775776
VALIDATE((), !m_graph.m_argumentFormats.isEmpty()); // We always have at least one entrypoint.
776777
VALIDATE((), m_graph.m_rootToArguments.isEmpty()); // This is only used in CPS.
777778

779+
m_graph.initializeNodeOwners();
780+
781+
auto& dominators = m_graph.ensureSSADominators();
782+
778783
for (unsigned entrypointIndex : m_graph.m_entrypointIndexToCatchBytecodeOffset.keys())
779784
VALIDATE((), entrypointIndex > 0); // By convention, 0 is the entrypoint index for the op_enter entrypoint, which can not be in a catch.
780785

@@ -788,6 +793,8 @@ class Validate {
788793
bool didSeeExitOK = false;
789794
bool isOSRExited = false;
790795

796+
HashSet<Node*> nodesInThisBlock;
797+
791798
for (auto* node : *block) {
792799
didSeeExitOK |= node->origin.exitOK;
793800
switch (node->op()) {
@@ -906,7 +913,13 @@ class Validate {
906913
});
907914
break;
908915
}
916+
909917
isOSRExited |= node->isPseudoTerminal();
918+
919+
m_graph.doToChildren(node, [&] (Edge child) {
920+
VALIDATE((node), dominators.strictlyDominates(child->owner, block) || nodesInThisBlock.contains(child.node()));
921+
});
922+
nodesInThisBlock.add(node);
910923
}
911924
}
912925
}

modules/javafx.web/src/main/native/Source/JavaScriptCore/offlineasm/parser.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,7 @@ def parseSequence(final, comment)
628628
firstCodeOrigin = @tokens[@idx].codeOrigin
629629
list = []
630630
loop {
631-
if (@idx == @tokens.length and not final) or (final and @tokens[@idx] =~ final)
632-
break
633-
elsif @tokens[@idx].is_a? Annotation
631+
if @tokens[@idx].is_a? Annotation
634632
# This is the only place where we can encounter a global
635633
# annotation, and hence need to be able to distinguish between
636634
# them.
@@ -644,6 +642,8 @@ def parseSequence(final, comment)
644642
list << Instruction.new(codeOrigin, annotationOpcode, [], @tokens[@idx].string)
645643
@annotation = nil
646644
@idx += 2 # Consume the newline as well.
645+
elsif (@idx == @tokens.length and not final) or (final and @tokens[@idx] =~ final)
646+
break
647647
elsif @tokens[@idx] == "\n"
648648
# ignore
649649
@idx += 1

modules/javafx.web/src/main/native/Source/JavaScriptCore/runtime/NativeErrorConstructor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include "Error.h"
2424
#include "InternalFunction.h"
25+
#include "JSGlobalObject.h"
2526
#include "NativeErrorPrototype.h"
2627

2728
namespace JSC {

modules/javafx.web/src/main/native/Source/WTF/wtf/Platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,7 @@
14491449
#endif
14501450
#endif
14511451

1452-
#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000) || PLATFORM(GTK)
1452+
#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000)
14531453
#define HAVE_OS_DARK_MODE_SUPPORT 1
14541454
#endif
14551455

modules/javafx.web/src/main/native/Source/WTF/wtf/URLHelpers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ static bool allCharactersInIDNScriptWhiteList(const UChar* buffer, int32_t lengt
301301
Optional<UChar32> previousCodePoint;
302302
while (i < length) {
303303
UChar32 c;
304-
U16_NEXT(buffer, i, length, c)
304+
U16_NEXT(buffer, i, length, c);
305305
UErrorCode error = U_ZERO_ERROR;
306306
UScriptCode script = uscript_getScript(c, &error);
307307
if (error != U_ZERO_ERROR) {

modules/javafx.web/src/main/native/Source/WebCore/dom/Document.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4960,12 +4960,12 @@ static bool isValidNameNonASCII(const UChar* characters, unsigned length)
49604960
unsigned i = 0;
49614961

49624962
UChar32 c;
4963-
U16_NEXT(characters, i, length, c)
4963+
U16_NEXT(characters, i, length, c);
49644964
if (!isValidNameStart(c))
49654965
return false;
49664966

49674967
while (i < length) {
4968-
U16_NEXT(characters, i, length, c)
4968+
U16_NEXT(characters, i, length, c);
49694969
if (!isValidNamePart(c))
49704970
return false;
49714971
}
@@ -5025,7 +5025,7 @@ ExceptionOr<std::pair<AtomString, AtomString>> Document::parseQualifiedName(cons
50255025

50265026
for (unsigned i = 0; i < length; ) {
50275027
UChar32 c;
5028-
U16_NEXT(qualifiedName, i, length, c)
5028+
U16_NEXT(qualifiedName, i, length, c);
50295029
if (c == ':') {
50305030
if (sawColon)
50315031
return Exception { InvalidCharacterError };
@@ -6943,7 +6943,6 @@ bool Document::useSystemAppearance() const
69436943

69446944
bool Document::useDarkAppearance(const RenderStyle* style) const
69456945
{
6946-
#if HAVE(OS_DARK_MODE_SUPPORT)
69476946
#if ENABLE(DARK_MODE_CSS)
69486947
OptionSet<ColorScheme> colorScheme;
69496948

@@ -6972,9 +6971,6 @@ bool Document::useDarkAppearance(const RenderStyle* style) const
69726971
if (colorScheme.contains(ColorScheme::Dark))
69736972
return pageUsesDarkAppearance;
69746973
#endif
6975-
#else
6976-
UNUSED_PARAM(style);
6977-
#endif
69786974

69796975
return false;
69806976
}

modules/javafx.web/src/main/native/Source/WebCore/page/FrameView.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,12 +2971,7 @@ void FrameView::setBaseBackgroundColor(const Color& backgroundColor)
29712971
void FrameView::updateBackgroundRecursively(const Optional<Color>& backgroundColor)
29722972
{
29732973
#if HAVE(OS_DARK_MODE_SUPPORT)
2974-
#if PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
2975-
static const auto cssValueControlBackground = CSSValueAppleSystemControlBackground;
2976-
#else
2977-
static const auto cssValueControlBackground = CSSValueWindow;
2978-
#endif
2979-
Color baseBackgroundColor = backgroundColor.valueOr(RenderTheme::singleton().systemColor(cssValueControlBackground, styleColorOptions()));
2974+
Color baseBackgroundColor = backgroundColor.valueOr(RenderTheme::singleton().systemColor(CSSValueAppleSystemControlBackground, styleColorOptions()));
29802975
#else
29812976
Color baseBackgroundColor = backgroundColor.valueOr(Color::white);
29822977
#endif

modules/javafx.web/src/main/native/Source/WebCore/page/Page.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2714,7 +2714,7 @@ void Page::setUseSystemAppearance(bool value)
27142714

27152715
void Page::effectiveAppearanceDidChange(bool useDarkAppearance, bool useElevatedUserInterfaceLevel)
27162716
{
2717-
#if HAVE(OS_DARK_MODE_SUPPORT)
2717+
#if ENABLE(DARK_MODE_CSS)
27182718
if (m_useDarkAppearance == useDarkAppearance && m_useElevatedUserInterfaceLevel == useElevatedUserInterfaceLevel)
27192719
return;
27202720

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

27392739
bool Page::useDarkAppearance() const
27402740
{
2741-
#if HAVE(OS_DARK_MODE_SUPPORT)
2741+
#if ENABLE(DARK_MODE_CSS)
27422742
FrameView* view = mainFrame().view();
27432743
if (!view || !equalLettersIgnoringASCIICase(view->mediaType(), "screen"))
27442744
return false;

modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/ComplexTextController.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ unsigned ComplexTextController::offsetForPosition(float h, bool includePartialGl
205205
for (unsigned j = 0; j < complexTextRun.glyphCount(); ++j) {
206206
unsigned index = offsetIntoAdjustedGlyphs + j;
207207
float adjustedAdvance = m_adjustedBaseAdvances[index].width();
208-
if (x < adjustedAdvance) {
208+
bool hit = m_run.ltr() ? x < adjustedAdvance : (x <= adjustedAdvance && adjustedAdvance);
209+
if (hit) {
209210
unsigned hitGlyphStart = complexTextRun.indexAt(j);
210211
unsigned hitGlyphEnd;
211212
if (m_run.ltr())
@@ -215,7 +216,18 @@ unsigned ComplexTextController::offsetForPosition(float h, bool includePartialGl
215216

216217
// FIXME: Instead of dividing the glyph's advance equally between the characters, this
217218
// could use the glyph's "ligature carets". This is available in CoreText via CTFontGetLigatureCaretPositions().
218-
unsigned hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (m_run.ltr() ? x / adjustedAdvance : 1 - x / adjustedAdvance);
219+
unsigned hitIndex;
220+
if (m_run.ltr())
221+
hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (x / adjustedAdvance);
222+
else {
223+
if (hitGlyphStart == hitGlyphEnd)
224+
hitIndex = hitGlyphStart;
225+
else if (x)
226+
hitIndex = hitGlyphEnd - (hitGlyphEnd - hitGlyphStart) * (x / adjustedAdvance);
227+
else
228+
hitIndex = hitGlyphEnd - 1;
229+
}
230+
219231
unsigned stringLength = complexTextRun.stringLength();
220232
CachedTextBreakIterator cursorPositionIterator(StringView(complexTextRun.characters(), stringLength), TextBreakIterator::Mode::Caret, nullAtom());
221233
unsigned clusterStart;

0 commit comments

Comments
 (0)